diff options
Diffstat (limited to 'docs')
| -rw-r--r-- | docs/Design.md | 12 | ||||
| -rw-r--r-- | docs/mcp.md | 41 |
2 files changed, 51 insertions, 2 deletions
diff --git a/docs/Design.md b/docs/Design.md index f370b74..b9a05c7 100644 --- a/docs/Design.md +++ b/docs/Design.md @@ -96,12 +96,24 @@ content または metadata を部分更新する。`expected_revision` が一致 次の view を持つ。 - `history`: session の時系列ページ。安定 cursor を返す +- `content`: message contentをUTF-8 byte offsetとbounded limitで分割取得する - `context`: target の前後メッセージと incoming/outgoing relation を返す。relation depth は 0~2 - `sessions`: session ごとの件数、kind 集計、代表 summary、最終時刻を返す - `export`: versioned JSONL をページ出力する互換 view レスポンスは 8 MiB budget を超えない位置でページを区切る。 +`content` viewは既定4096 bytes、最大65536 bytesを返す。offsetは0、末尾、またはUTF-8 +code point境界だけを受理し、limit位置がcode point途中なら直前の境界まで戻す。limitが +1 code pointより小さい場合だけ、そのcode pointを完全に返して進捗を保証する。各responseの +`revision`と`total_bytes`を返し、2回目以降の`expected_revision`で途中更新を`CONFLICT`として +検出する。このviewは永続data、access履歴、revisionを変更しない。message検索に必要な既存の +in-memory indexは、他のread viewと同様に必要時だけ構築する。 + +このview追加は既存toolへのadditive schema changeだけである。既存viewのinput、response、 +cursor semanticsと、保存recordおよびsnapshotのformat versionは変更しないため、data migration +とrebuildは不要であり、旧binaryと新binaryは同じdataを読み込める。 + ### `search_messages` content、summary、tags を対象に検索する。session、kind、tier、tag、minimum importance で絞り込める。matched fields、score と field 別 score 内訳、任意の前後 context を返す。 diff --git a/docs/mcp.md b/docs/mcp.md index 788fc84..e7b959d 100644 --- a/docs/mcp.md +++ b/docs/mcp.md @@ -143,13 +143,13 @@ messageのidentity、session、role、作成時刻を維持し、contentまたã� ## `read_messages` -`view`によりhistory、context、sessionsの3種類を返す。`view`省略時は`history`。 +`view`によりhistory、content、context、sessionsの4種類を返す。`view`省略時は`history`。 ### 共通Input | Parameter | 必須 | 型 | 説明 | |---|---:|---|---| -| `view` | No | string | `history` / `context` / `sessions` | +| `view` | No | string | `history` / `content` / `context` / `sessions` | | `limit` | No | integer | 1~1000、default 100 | | `cursor` | No | string | 前回responseの`nextCursor`。内容はopaque | @@ -174,6 +174,43 @@ session内のlive messageを作成順に返す。 続きを読む場合は同じ`session_id`と`nextCursor`を渡す。 +### `content` view + +live message 1件のcontentを、保存状態を変更せずにUTF-8 byte rangeで取得する。MCP hostの +tool-result上限を避けるため、`next_content_offset`を使って末尾まで反復する。 + +追加parameter: + +| Parameter | 必須 | 型 | Default | 説明 | +|---|---:|---|---:|---| +| `message_id` | Yes | string | — | 対象の26文字ULID | +| `content_offset` | No | integer | 0 | UTF-8 byte offset。0、末尾、またはcode point境界 | +| `content_limit` | No | integer | 4096 | 目標chunk bytes、1~65536 | +| `expected_revision` | No | integer | — | 指定時は現在revisionとの一致を要求 | + +```json +{ + "content_range": { + "message_id": "01ARZ3NDEKTSV4RRFFQ69G5FAV", + "revision": 1, + "total_bytes": 14420, + "content_offset": 4096, + "next_content_offset": 8191, + "complete": false, + "content": "..." + } +} +``` + +`complete`がfalseなら、同じ`message_id`、返された`next_content_offset`、最初のresponseで得た +`revision`を`expected_revision`として次を取得する。limit位置がUTF-8 code point途中なら、 +通常は直前の境界まで短くする。limitが1 code pointより小さい場合だけ、その1文字を完全に +返すため最大3 bytes超えることがある。 + +messageが存在しないか削除済みなら`NOT_FOUND`、offsetが範囲外またはUTF-8境界でなければ +`VALIDATION_ERROR`、`expected_revision`不一致なら`CONFLICT`を返す。このviewはlogical I/O +counterを含む永続状態を変更しない。 + ### `context` view 指定message、同一sessionの前後message、relation graphを返す。 |
