dsh-plugin-dev-kb 1.0.9 → 1.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +26 -0
- package/README.en.md +14 -8
- package/README.md +14 -8
- package/docs/banner.svg +25 -0
- package/kb/INDEX.md +8 -2
- package/kb/README.md +4 -4
- package/kb/extra/AGENTS.md +3 -3
- package/kb/extra/cookbook/adding-a-remote-api.md +197 -0
- package/kb/extra/cookbook/adding-a-remote-api.zh.md +197 -0
- package/kb/extra/cookbook/adding-a-session-format-version.md +109 -0
- package/kb/extra/cookbook/adding-a-session-format-version.zh.md +109 -0
- package/kb/extra/cookbook/adding-a-vendored-package.md +1 -1
- package/kb/extra/cookbook/adding-a-vendored-package.zh.md +1 -1
- package/kb/extra/cookbook/responding-to-pr-review-on-a-stack.md +1 -1
- package/kb/extra/cookbook/responding-to-pr-review-on-a-stack.zh.md +1 -1
- package/kb/extra/deepseek-llm-api-wire-extensions.md +19 -15
- package/kb/extra/deepseek-llm-api-wire-extensions.zh.md +19 -15
- package/kb/extra/development.md +13 -3
- package/kb/extra/development.zh.md +13 -3
- package/kb/extra/event-producer-consumer.md +49 -46
- package/kb/extra/event-producer-consumer.zh.md +52 -49
- package/kb/extra/i18n/README.md +2 -1
- package/kb/extra/i18n/README.zh.md +3 -2
- package/kb/extra/i18n/style-samples.md +2 -2
- package/kb/extra/i18n/translation-prompt.md +1 -1
- package/kb/extra/module-graph.md +493 -1002
- package/kb/extra/module-graph.zh.md +495 -1004
- package/kb/extra/rescope.md +1 -1
- package/kb/extra/rescope.zh.md +1 -1
- package/kb/extra/session-format-status.md +47 -0
- package/kb/extra/session-format-status.zh.md +47 -0
- package/kb/extra/subsystems/agent-team.md +3 -2
- package/kb/extra/subsystems/agent-team.zh.md +3 -2
- package/kb/extra/subsystems/attachment.md +157 -4
- package/kb/extra/subsystems/attachment.zh.md +157 -4
- package/kb/extra/subsystems/feedback.md +164 -30
- package/kb/extra/subsystems/feedback.zh.md +164 -30
- package/kb/extra/testing.md +9 -4
- package/kb/extra/testing.zh.md +9 -4
- package/kb/extra/web-styling.md +5 -0
- package/kb/extra/web-styling.zh.md +5 -0
- package/kb/meta/search-index.json +223 -151
- package/kb/meta/site-pages.txt +187 -181
- package/kb/meta/source.json +5 -5
- package/kb/meta/topics.md +5 -5
- package/kb/site/develop/basic/publish.md +1 -1
- package/kb/site/develop/cordis-tutorial/07-into-the-harness.md +3 -2
- package/kb/site/develop/practice/llm-adapter.md +4 -3
- package/kb/site/en/develop/basic/publish.md +1 -1
- package/kb/site/en/develop/cordis-tutorial/07-into-the-harness.md +3 -2
- package/kb/site/en/develop/practice/llm-adapter.md +4 -3
- package/kb/site/en/guide/network-proxy.md +87 -0
- package/kb/site/en/guide/providers.md +70 -17
- package/kb/site/en/guide/python-sdk.md +19 -3
- package/kb/site/en/guide/schedule.md +2 -0
- package/kb/site/en/reference/agent-lifecycle.md +17 -8
- package/kb/site/en/reference/api-gateway.md +2 -2
- package/kb/site/en/reference/capability-seams.md +24 -10
- package/kb/site/en/reference/config-catalog.md +322 -264
- package/kb/site/en/reference/cookbook/adding-a-package.md +1 -2
- package/kb/site/en/reference/cookbook/adding-a-settings-card.md +10 -8
- package/kb/site/en/reference/cookbook/adding-a-tool.md +1 -1
- package/kb/site/en/reference/cookbook/extension-cookbook.md +16 -13
- package/kb/site/en/reference/index.md +26 -9
- package/kb/site/en/reference/persistence-catalog.md +189 -95
- package/kb/site/en/reference/subsystems/approval.md +1 -1
- package/kb/site/en/reference/subsystems/client-modules.md +9 -0
- package/kb/site/en/reference/subsystems/client-resources.md +94 -0
- package/kb/site/en/reference/subsystems/code-runtime.md +7 -3
- package/kb/site/en/reference/subsystems/commands.md +25 -16
- package/kb/site/en/reference/subsystems/compaction.md +10 -10
- package/kb/site/en/reference/subsystems/conversation.md +11 -4
- package/kb/site/en/reference/subsystems/core.md +173 -29
- package/kb/site/en/reference/subsystems/credentials.md +5 -4
- package/kb/site/en/reference/subsystems/filesystem.md +15 -0
- package/kb/site/en/reference/subsystems/goal.md +38 -2
- package/kb/site/en/reference/subsystems/index.md +3 -1
- package/kb/site/en/reference/subsystems/invariants.md +1 -1
- package/kb/site/en/reference/subsystems/llm-streaming.md +43 -12
- package/kb/site/en/reference/subsystems/lsp.md +1 -1
- package/kb/site/en/reference/subsystems/permission-presets.md +5 -5
- package/kb/site/en/reference/subsystems/persistence.md +211 -199
- package/kb/site/en/reference/subsystems/plan.md +3 -3
- package/kb/site/en/reference/subsystems/sandbox.md +2 -0
- package/kb/site/en/reference/subsystems/schedule.md +9 -3
- package/kb/site/en/reference/subsystems/scope.md +1 -1
- package/kb/site/en/reference/subsystems/session-projection.md +50 -24
- package/kb/site/en/reference/subsystems/session-query.md +19 -13
- package/kb/site/en/reference/subsystems/session-reference.md +29 -1
- package/kb/site/en/reference/subsystems/session-telemetry.md +27 -10
- package/kb/site/en/reference/subsystems/session-title.md +6 -6
- package/kb/site/en/reference/subsystems/session.md +208 -103
- package/kb/site/en/reference/subsystems/settings.md +30 -12
- package/kb/site/en/reference/subsystems/shell.md +9 -6
- package/kb/site/en/reference/subsystems/sidebar-right.md +151 -0
- package/kb/site/en/reference/subsystems/skills.md +1 -1
- package/kb/site/en/reference/subsystems/slots.md +41 -32
- package/kb/site/en/reference/subsystems/spill.md +13 -6
- package/kb/site/en/reference/subsystems/storage.md +28 -5
- package/kb/site/en/reference/subsystems/subagent.md +58 -105
- package/kb/site/en/reference/subsystems/subprocess.md +25 -26
- package/kb/site/en/reference/subsystems/system-prompt.md +18 -3
- package/kb/site/en/reference/subsystems/token-meter.md +4 -3
- package/kb/site/en/reference/subsystems/tools.md +5 -5
- package/kb/site/en/reference/subsystems/typert.md +18 -18
- package/kb/site/en/reference/subsystems/web-client.md +1 -1
- package/kb/site/en/reference/subsystems/workspace.md +88 -9
- package/kb/site/en/reference/tool-catalog.md +56 -66
- package/kb/site/en/reference/tool-execution-pipeline.md +2 -2
- package/kb/site/guide/network-proxy.md +87 -0
- package/kb/site/guide/providers.md +70 -17
- package/kb/site/guide/python-sdk.md +19 -3
- package/kb/site/guide/schedule.md +2 -0
- package/kb/site/reference/agent-lifecycle.md +17 -8
- package/kb/site/reference/api-gateway.md +2 -2
- package/kb/site/reference/capability-seams.md +24 -10
- package/kb/site/reference/config-catalog.md +321 -263
- package/kb/site/reference/cookbook/adding-a-package.md +1 -2
- package/kb/site/reference/cookbook/adding-a-settings-card.md +10 -8
- package/kb/site/reference/cookbook/adding-a-tool.md +1 -1
- package/kb/site/reference/cookbook/extension-cookbook.md +16 -13
- package/kb/site/reference/index.md +26 -9
- package/kb/site/reference/persistence-catalog.md +190 -96
- package/kb/site/reference/subsystems/approval.md +1 -1
- package/kb/site/reference/subsystems/client-modules.md +9 -0
- package/kb/site/reference/subsystems/client-resources.md +94 -0
- package/kb/site/reference/subsystems/code-runtime.md +7 -3
- package/kb/site/reference/subsystems/commands.md +25 -16
- package/kb/site/reference/subsystems/compaction.md +10 -10
- package/kb/site/reference/subsystems/conversation.md +11 -4
- package/kb/site/reference/subsystems/core.md +173 -29
- package/kb/site/reference/subsystems/credentials.md +5 -4
- package/kb/site/reference/subsystems/filesystem.md +15 -0
- package/kb/site/reference/subsystems/goal.md +38 -2
- package/kb/site/reference/subsystems/index.md +14 -12
- package/kb/site/reference/subsystems/invariants.md +1 -1
- package/kb/site/reference/subsystems/llm-streaming.md +43 -12
- package/kb/site/reference/subsystems/lsp.md +1 -1
- package/kb/site/reference/subsystems/permission-presets.md +5 -5
- package/kb/site/reference/subsystems/persistence.md +210 -198
- package/kb/site/reference/subsystems/plan.md +3 -3
- package/kb/site/reference/subsystems/schedule.md +9 -3
- package/kb/site/reference/subsystems/scope.md +1 -1
- package/kb/site/reference/subsystems/session-projection.md +50 -24
- package/kb/site/reference/subsystems/session-query.md +19 -13
- package/kb/site/reference/subsystems/session-reference.md +29 -1
- package/kb/site/reference/subsystems/session-telemetry.md +27 -10
- package/kb/site/reference/subsystems/session-title.md +6 -6
- package/kb/site/reference/subsystems/session.md +208 -103
- package/kb/site/reference/subsystems/settings.md +30 -12
- package/kb/site/reference/subsystems/shell.md +9 -6
- package/kb/site/reference/subsystems/sidebar-right.md +151 -0
- package/kb/site/reference/subsystems/skills.md +1 -1
- package/kb/site/reference/subsystems/slots.md +41 -32
- package/kb/site/reference/subsystems/spill.md +13 -6
- package/kb/site/reference/subsystems/storage.md +28 -5
- package/kb/site/reference/subsystems/subagent.md +58 -105
- package/kb/site/reference/subsystems/subprocess.md +25 -26
- package/kb/site/reference/subsystems/system-prompt.md +18 -3
- package/kb/site/reference/subsystems/token-meter.md +4 -3
- package/kb/site/reference/subsystems/tools.md +5 -5
- package/kb/site/reference/subsystems/typert.md +18 -18
- package/kb/site/reference/subsystems/web-client.md +1 -1
- package/kb/site/reference/subsystems/workspace.md +88 -9
- package/kb/site/reference/tool-catalog.md +55 -65
- package/kb/site/reference/tool-execution-pipeline.md +2 -2
- package/lib/index.js +25 -44
- package/package.json +3 -2
- package/skills/dsh-plugin-dev-kb.md +4 -4
package/kb/extra/rescope.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
English | [中文](rescope.zh.md)
|
|
4
4
|
|
|
5
|
-
The Cordis framework and its foundation libraries are vendored under [`vendor/`](../vendor/README.md) and published under the `@deepseek-ai` scope, because every harness package declares the framework as a peer dependency: publishing the harness publishes this layer with it, and under the upstream names that publication would squat them on the registry. This page is the name mapping; the decision and its consequences live in the [rescope Agent Note](../.agents/notes/
|
|
5
|
+
The Cordis framework and its foundation libraries are vendored under [`vendor/`](../vendor/README.md) and published under the `@deepseek-ai` scope, because every harness package declares the framework as a peer dependency: publishing the harness publishes this layer with it, and under the upstream names that publication would squat them on the registry. This page is the name mapping; the decision and its consequences live in the [rescope Agent Note](../.agents/notes/archived/process/2026-08-10-vendor-package-rescope.md), and the upstream commits in [`vendor/README.md`](../vendor/README.md).
|
|
6
6
|
|
|
7
7
|
## Name mapping
|
|
8
8
|
|
package/kb/extra/rescope.zh.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
[English](rescope.md) | 中文
|
|
4
4
|
|
|
5
|
-
Cordis 框架及其基础库以源码形式 vendored 在 [`vendor/`](../vendor/README.md) 下,并以 `@deepseek-ai` scope 发布:每个 harness 包都把框架声明为 peer dependency,发布 harness 就会连带发布这一层,用上游名发布等于在 registry 上占用别人的名字。本页是名字映射表;决策与影响见 [改名 Agent Note](../.agents/notes/
|
|
5
|
+
Cordis 框架及其基础库以源码形式 vendored 在 [`vendor/`](../vendor/README.md) 下,并以 `@deepseek-ai` scope 发布:每个 harness 包都把框架声明为 peer dependency,发布 harness 就会连带发布这一层,用上游名发布等于在 registry 上占用别人的名字。本页是名字映射表;决策与影响见 [改名 Agent Note](../.agents/notes/archived/process/2026-08-10-vendor-package-rescope.md),上游 commit 见 [`vendor/README.md`](../vendor/README.md)。
|
|
6
6
|
|
|
7
7
|
## 名字映射
|
|
8
8
|
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
# Session format version and release status
|
|
2
|
+
|
|
3
|
+
English | [中文](session-format-status.zh.md)
|
|
4
|
+
|
|
5
|
+
## Summary
|
|
6
|
+
|
|
7
|
+
Use this reference to distinguish the checkout’s Session writer version from the latest published Session format. The code constant owns the writer version; the release record below owns the latest released format and its publication evidence. Other documentation links here instead of restating which version is current, next, or unreleased.
|
|
8
|
+
|
|
9
|
+
## Table of Contents
|
|
10
|
+
|
|
11
|
+
- [Sources of truth](#sources-of-truth)
|
|
12
|
+
- [Release record](#release-record)
|
|
13
|
+
- [Updating the record](#updating-the-record)
|
|
14
|
+
- [Dev Note](#dev-note)
|
|
15
|
+
|
|
16
|
+
<a id="sources-of-truth"></a>
|
|
17
|
+
## Sources of truth
|
|
18
|
+
|
|
19
|
+
- **Checkout writer:** `SESSION_FORMAT_VERSION` in [core Session types](../packages/core/session/src/types.ts) is the only hand-maintained current-writer number in code. The [catalog generator](../scripts/gen-session-format-catalog.ts) derives codec ordering and checks that adjacent migrations reach it. A package version, codec export name, fixture filename, or projection-cache version is not the writer authority.
|
|
20
|
+
- **Latest released format:** `latestReleasedVersion` in the following record identifies the published Session format. `evidenceTag` names a published product release whose tagged writer has that value; it need not be the first release carrying the format. The bilingual copy is checked against the same record, not maintained as a separate decision.
|
|
21
|
+
- **Release status:** compare the writer constant with the verified release record. Equality means the writer format has shipped. A greater writer version is a development target beyond the recorded release. When comparing an older checkout against a newer branch’s verified record, a lower writer version identifies an older writer format; the local consistency gate rejects that ordering within one checkout. No separate released boolean is maintained. Before declaring a greater version unreleased, verify that no published release has advanced the record.
|
|
22
|
+
|
|
23
|
+
An alpha, beta, or release-candidate product publication establishes released Session-format obligations. GitHub’s prerelease flag does not make persisted user data disposable. A missing release record is not evidence of non-publication. The [versioning and authority decision](../.agents/notes/implemented/architecture/2026-08-10-session-log-version-mechanism.md) owns compatibility decisions; [released-format migration](../.agents/notes/implemented/architecture/2026-08-31-released-session-format-migrations.md) owns immutable generations and adjacent conversion.
|
|
24
|
+
|
|
25
|
+
<a id="release-record"></a>
|
|
26
|
+
## Release record
|
|
27
|
+
|
|
28
|
+
```yaml session-format-release
|
|
29
|
+
latestReleasedVersion: 3
|
|
30
|
+
evidenceTag: dsh-v0.1.5-alpha.1
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
Evidence: [published release](https://github.com/deepseek-harness/deepseek-harness/releases/tag/dsh-v0.1.5-alpha.1) and [its tagged writer source](https://github.com/deepseek-harness/deepseek-harness/blob/dsh-v0.1.5-alpha.1/packages/core/session/src/types.ts).
|
|
34
|
+
|
|
35
|
+
<a id="updating-the-record"></a>
|
|
36
|
+
## Updating the record
|
|
37
|
+
|
|
38
|
+
When a structural writer change is implemented, update the code constant and adjacent catalog together; do not advance this release record before publication. When a product release first publishes a higher Session format, confirm publication and its tagged writer, then advance this record and both evidence links in the same bilingual update. Later product releases carrying the same format do not require changing the record. Never lower it on the development trunk.
|
|
39
|
+
|
|
40
|
+
The [documentation-standard test](../scripts/doc-standard.spec.ts) checks record structure, bilingual equality, evidence-link consistency, and that the documented release does not exceed the checkout writer. This keyless check does not query GitHub or prove that the record is up to date; publication verification remains part of the release update.
|
|
41
|
+
|
|
42
|
+
Use “current format” and “next adjacent version” for general behavior. Keep explicit numbers for fixed migration inputs and outputs, wire schemas, historical evidence, and tests of those particular versions. The [format-version cookbook](cookbook/adding-a-session-format-version.md) uses N for the verified latest released format and N+1 for its successor.
|
|
43
|
+
|
|
44
|
+
<a id="dev-note"></a>
|
|
45
|
+
## Dev Note
|
|
46
|
+
|
|
47
|
+
None.
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
# Session 格式版本与发布状态
|
|
2
|
+
|
|
3
|
+
[English](session-format-status.md) | 中文
|
|
4
|
+
|
|
5
|
+
## 概述
|
|
6
|
+
|
|
7
|
+
本参考区分工作区的 Session 写入器版本与最新已发布的 Session 格式。代码常量拥有写入器版本;下方发布记录拥有最新已发布格式及其发布证据。其他文档链接到这里,而不重复声明哪个版本是当前、下一个或尚未发布的版本。
|
|
8
|
+
|
|
9
|
+
## 目录
|
|
10
|
+
|
|
11
|
+
- [单一真源](#sources-of-truth)
|
|
12
|
+
- [发布记录](#release-record)
|
|
13
|
+
- [更新记录](#updating-the-record)
|
|
14
|
+
- [开发备注](#dev-note)
|
|
15
|
+
|
|
16
|
+
<a id="sources-of-truth"></a>
|
|
17
|
+
## 单一真源
|
|
18
|
+
|
|
19
|
+
- **工作区写入器:**[核心 Session 类型](../packages/core/session/src/types.ts)中的 `SESSION_FORMAT_VERSION` 是代码中唯一手工维护的当前写入器版本号。[目录生成器](../scripts/gen-session-format-catalog.ts)推导 codec 顺序,并检查相邻迁移是否到达该版本。包版本、codec 导出名称、fixture(测试前置数据)文件名或投影缓存版本都不是写入器版本的权威来源。
|
|
20
|
+
- **最新已发布格式:**下方记录中的 `latestReleasedVersion` 标识已发布的 Session 格式。`evidenceTag` 指定一个已发布的产品版本,其标签对应的写入器具有该值;它不必是首次携带该格式的发布。双语副本按同一记录校验,不作为独立决策维护。
|
|
21
|
+
- **发布状态:**比较写入器常量与已核实的发布记录。相等表示写入器格式已经发布。写入器版本更高表示它是超出记录中发布版本的开发目标。用较新分支中已核实的记录对比旧工作区时,较低的写入器版本表示较旧的写入器格式;本地一致性门禁会拒绝同一工作区内的这种大小关系。不另行维护 released 布尔值。在声明更高版本尚未发布前,必须核实是否已有产品发布推进了记录。
|
|
22
|
+
|
|
23
|
+
产品的 alpha、beta 或 release-candidate 发布都会确立已发布 Session 格式的义务。GitHub 的 prerelease 标记不会让持久化用户数据成为可丢弃数据。缺少发布记录不代表尚未发布。[版本与真源决策](../.agents/notes/implemented/architecture/2026-08-10-session-log-version-mechanism.zh.md)拥有兼容性决策;[已发布格式迁移](../.agents/notes/implemented/architecture/2026-08-31-released-session-format-migrations.zh.md)拥有不可变代际与相邻转换规则。
|
|
24
|
+
|
|
25
|
+
<a id="release-record"></a>
|
|
26
|
+
## 发布记录
|
|
27
|
+
|
|
28
|
+
```yaml session-format-release
|
|
29
|
+
latestReleasedVersion: 3
|
|
30
|
+
evidenceTag: dsh-v0.1.5-alpha.1
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
证据:[已发布产品版本](https://github.com/deepseek-harness/deepseek-harness/releases/tag/dsh-v0.1.5-alpha.1)及[对应标签的写入器源码](https://github.com/deepseek-harness/deepseek-harness/blob/dsh-v0.1.5-alpha.1/packages/core/session/src/types.ts)。
|
|
34
|
+
|
|
35
|
+
<a id="updating-the-record"></a>
|
|
36
|
+
## 更新记录
|
|
37
|
+
|
|
38
|
+
实现结构性写入器变更时,一起更新代码常量与相邻迁移目录;不要在产品发布前推进此发布记录。当产品首次发布更高的 Session 格式时,确认发布事实及对应标签的写入器,然后在同一次双语更新中推进本记录与两个证据链接。后续携带相同格式的产品发布无需改变此记录。开发主干上的记录绝不降低。
|
|
39
|
+
|
|
40
|
+
[文档标准测试](../scripts/doc-standard.spec.ts)检查记录结构、双语一致性、证据链接一致性,以及文档中的已发布版本不高于工作区写入器。这个无密钥检查不会查询 GitHub,也不能证明记录是最新的;核实发布事实仍属于发布更新的一部分。
|
|
41
|
+
|
|
42
|
+
一般行为使用“当前格式”和“下一条相邻版本”等表述。固定迁移的输入与输出、协议 schema、历史证据及针对特定版本的测试保留明确版本号。[格式版本实操手册](cookbook/adding-a-session-format-version.zh.md)用 N 表示已核实的最新发布格式,用 N+1 表示其后继版本。
|
|
43
|
+
|
|
44
|
+
<a id="dev-note"></a>
|
|
45
|
+
## 开发备注
|
|
46
|
+
|
|
47
|
+
无。
|
|
@@ -34,11 +34,12 @@ interface TeamMessageSnapshot {
|
|
|
34
34
|
readonly senderId: SessionId
|
|
35
35
|
readonly senderName: string
|
|
36
36
|
readonly targetId: SessionId
|
|
37
|
-
readonly delivery: 'quiet' | 'wakeup'
|
|
38
37
|
readonly content: ContentBlock[]
|
|
39
38
|
}
|
|
40
39
|
```
|
|
41
40
|
|
|
41
|
+
Every message attempts Steer delivery. A running target receives it at the nearest step boundary, an idle target starts a turn, and an inactive teammate cold-resumes. Scheduling is not stored in the durable record because callers cannot select another mode.
|
|
42
|
+
|
|
42
43
|
The target Session keeps message identity and sender attribution on both the pending inbox item and the eventual user message. Folding that source across inbox and history is the target-side de-duplication key; the model-visible framing repeats the id and sender.
|
|
43
44
|
|
|
44
45
|
```ts type-equiv
|
|
@@ -116,7 +117,7 @@ async spawnTeammate(caller: Agent, request: SpawnTeammateRequest): Promise<Spawn
|
|
|
116
117
|
/**
|
|
117
118
|
* Queue one durable peer message, then attempt immediate delivery.
|
|
118
119
|
* @param caller - exact live sending Team member.
|
|
119
|
-
* @param request - target name, content,
|
|
120
|
+
* @param request - target name, content, and pre-queue cancellation.
|
|
120
121
|
* @returns durable message identity and immediate-delivery observation.
|
|
121
122
|
*/
|
|
122
123
|
async sendMessage(caller: Agent, request: SendTeamMessageRequest): Promise<SendTeamMessageResult>
|
|
@@ -34,11 +34,12 @@ interface TeamMessageSnapshot {
|
|
|
34
34
|
readonly senderId: SessionId
|
|
35
35
|
readonly senderName: string
|
|
36
36
|
readonly targetId: SessionId
|
|
37
|
-
readonly delivery: 'quiet' | 'wakeup'
|
|
38
37
|
readonly content: ContentBlock[]
|
|
39
38
|
}
|
|
40
39
|
```
|
|
41
40
|
|
|
41
|
+
每条消息都会尝试 Steer 投递。running target 在最近的步骤边界收到消息,idle target 启动一个轮次,inactive teammate 则冷恢复。调用方不能选择其他模式,因此持久记录不存储调度方式。
|
|
42
|
+
|
|
42
43
|
target Session 会在 pending inbox 条目和最终用户消息上保留消息身份与发送者归因。跨 inbox 与历史折叠该 source 构成 target 侧去重键;模型可见的 framing 会重复 id 和发送者。
|
|
43
44
|
|
|
44
45
|
```ts type-equiv
|
|
@@ -116,7 +117,7 @@ async spawnTeammate(caller: Agent, request: SpawnTeammateRequest): Promise<Spawn
|
|
|
116
117
|
/**
|
|
117
118
|
* Queue one durable peer message, then attempt immediate delivery.
|
|
118
119
|
* @param caller - exact live sending Team member.
|
|
119
|
-
* @param request - target name, content,
|
|
120
|
+
* @param request - target name, content, and pre-queue cancellation.
|
|
120
121
|
* @returns durable message identity and immediate-delivery observation.
|
|
121
122
|
*/
|
|
122
123
|
async sendMessage(caller: Agent, request: SendTeamMessageRequest): Promise<SendTeamMessageResult>
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
# Durable
|
|
1
|
+
# Durable Attachments
|
|
2
2
|
|
|
3
3
|
English | [中文](attachment.zh.md)
|
|
4
4
|
|
|
5
|
-
The attachment seam separates binary image ownership from the session log. A producer gives
|
|
5
|
+
The attachment seam separates binary image and generic-file ownership from the session log. A producer gives bytes to [`ctx.attachments`](#ctxattachments--attachmentstore-abstract-seam); the service publishes an immutable content-addressed reference only after the object is durable. Session events and model-visible attachment blocks contain that reference and metadata, never a browser object URL, host temporary path, provider URL, or base64 payload. The independent [`ctx.fileUploads`](#ctxfileuploads--fileuploads) service binds browser file transfers and staged receipts to the receiving Agent.
|
|
6
6
|
|
|
7
|
-
Unsent browser drafts may stay in memory and native clients may stage them in operating-system temporary storage. Once the host accepts a user message, its images move below `<DSH_HOME>/attachments/v1` before the user event is appended. Structured model image output follows the same persist-before-event rule.
|
|
7
|
+
Unsent browser drafts may stay in memory and native clients may stage them in operating-system temporary storage. Browser generic files become durable before they receive a staged prompt receipt. Once the host accepts a user message, its images move below `<DSH_HOME>/attachments/v1` before the user event is appended. Structured model image output follows the same persist-before-event rule.
|
|
8
8
|
|
|
9
9
|
Source: [`packages/attachment/attachment/src/types.ts`](../../packages/attachment/attachment/src/types.ts)
|
|
10
10
|
|
|
@@ -62,6 +62,38 @@ The reference records intrinsic dimensions and encoded length so clients can lay
|
|
|
62
62
|
|
|
63
63
|
## Commit and verified-read payloads
|
|
64
64
|
|
|
65
|
+
```ts type-equiv
|
|
66
|
+
/**
|
|
67
|
+
* Browser-submitted prompt content accepted by Host prompt endpoints; the
|
|
68
|
+
* accepting Host promotes image parts to durable references through
|
|
69
|
+
* `ctx.attachments.admitPromptContent()` before any message is created, so a wire caller can
|
|
70
|
+
* never cite an attachment it did not upload.
|
|
71
|
+
*/
|
|
72
|
+
type PromptContentPart =
|
|
73
|
+
| { readonly type: 'text'; readonly text: string }
|
|
74
|
+
| {
|
|
75
|
+
readonly type: 'image'
|
|
76
|
+
readonly mediaType: ImageMediaType
|
|
77
|
+
readonly data: string
|
|
78
|
+
readonly name?: string
|
|
79
|
+
}
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
```ts type-equiv
|
|
83
|
+
/** Host prompt content whose file receipts are resolved and whose image bytes await admission. */
|
|
84
|
+
type AttachmentAdmissionPart =
|
|
85
|
+
| PromptContentPart
|
|
86
|
+
| { readonly type: 'file'; readonly attachment: FileAttachmentRef }
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
```ts type-equiv
|
|
90
|
+
/** Host-admitted prompt content with every attachment represented by its durable reference. */
|
|
91
|
+
type AdmittedPromptContentPart =
|
|
92
|
+
| { readonly type: 'text'; readonly text: string }
|
|
93
|
+
| { readonly type: 'image'; readonly attachment: ImageAttachmentRef }
|
|
94
|
+
| { readonly type: 'file'; readonly attachment: FileAttachmentRef }
|
|
95
|
+
```
|
|
96
|
+
|
|
65
97
|
```ts type-equiv
|
|
66
98
|
/** Base64-encoded image upload accompanying one wire request. */
|
|
67
99
|
interface EncodedImageAttachment {
|
|
@@ -125,7 +157,7 @@ interface RequestImageAttachment {
|
|
|
125
157
|
}
|
|
126
158
|
```
|
|
127
159
|
|
|
128
|
-
`saveImage()` prepares and atomically commits a provider-independent normalized attachment before returning its `ImageAttachmentRef`. `saveImages()` prepares every validated attachment once before publishing the batch, so validation rejection leaves no partial objects and publication does not repeat decoding or quality selection. `
|
|
160
|
+
`saveImage()` prepares and atomically commits a provider-independent normalized attachment before returning its `ImageAttachmentRef`. `saveImages()` prepares every validated attachment once before publishing the batch, so validation rejection leaves no partial objects and publication does not repeat decoding or quality selection. `admitPromptContent()` accepts the complete ordered Host prompt after file receipt resolution, replaces base64 image uploads with durable references, and passes durable file references unchanged. `admitEncodedImages()` supports other wire entries and delegates count, aggregate-byte, and ordered batch admission to `saveImages()`. `admitEncodedFile()` gives encoded protocol adapters the same service-owned canonical-base64 admission, and `isAttachmentError()` lets those adapters recognize stable attachment failures without importing implementation helpers. `readImage()` verifies a normalized attachment from an authorized session path. `imageHostPath()` exposes only the provider-owned host object location; it does not decide whether the current tool execution world can read it. `readImageRequest()` derives and caches one deterministic request version under an exact route pixel and byte budget. That version contains encoded bytes and metadata but no execution-world path. New entries are fully decoded before publication, while cache hits use a bounded metadata probe. Callers use `Promise.all` over the singular method when they need an ordered batch. The local implementation lazily encodes preferred candidates, singleflights equal request identities, lets each waiter cancel independently, stops shared work when no waiter remains, and bounds all transforms with its instance-level limiter, which defaults to two simultaneous transformations. The service is retention-neutral: resumed and forked sessions may share objects, so reference-aware garbage collection is deferred rather than tied to one session's deletion.
|
|
129
161
|
|
|
130
162
|
<!-- BEGIN GENERATED cordis-surface (gen-cordis-catalog.ts) — do not edit between markers -->
|
|
131
163
|
|
|
@@ -157,6 +189,30 @@ abstract validateImage(input: SaveImageAttachment): Promise<void>
|
|
|
157
189
|
*/
|
|
158
190
|
async saveImages(inputs: readonly SaveImageAttachment[]): Promise<readonly ImageAttachmentRef[]>
|
|
159
191
|
|
|
192
|
+
/**
|
|
193
|
+
* Admit one Host prompt and replace each uploaded image with its durable reference.
|
|
194
|
+
* Text and durable file references pass through unchanged. A prompt without image parts performs no storage operation.
|
|
195
|
+
* @param content - prompt parts in message order after file receipt resolution.
|
|
196
|
+
* @returns admitted prompt parts in the same order as `content`.
|
|
197
|
+
* @throws AttachmentError when the image batch is refused.
|
|
198
|
+
*/
|
|
199
|
+
async admitPromptContent( content: readonly AttachmentAdmissionPart[], ): Promise<AdmittedPromptContentPart[]>
|
|
200
|
+
|
|
201
|
+
/**
|
|
202
|
+
* Decode and durably commit one canonical base64 file upload.
|
|
203
|
+
* @param input - canonical base64 bytes and optional display name.
|
|
204
|
+
* @returns the durable content-addressed file reference.
|
|
205
|
+
* @throws AttachmentError when the encoding or storage operation is refused.
|
|
206
|
+
*/
|
|
207
|
+
admitEncodedFile(input: EncodedFileAttachment): Promise<FileAttachmentRef>
|
|
208
|
+
|
|
209
|
+
/**
|
|
210
|
+
* Identify a failure emitted by this attachment capability by its stable code.
|
|
211
|
+
* @param error - value caught from an attachment operation.
|
|
212
|
+
* @returns whether the value is an attachment failure.
|
|
213
|
+
*/
|
|
214
|
+
isAttachmentError(error: unknown): error is AttachmentError
|
|
215
|
+
|
|
160
216
|
/**
|
|
161
217
|
* Validate and durably commit one image before its owning session event is appended.
|
|
162
218
|
* The returned reference describes the persisted normalized image. When
|
|
@@ -184,6 +240,43 @@ abstract readImage(ref: ImageAttachmentRef, signal?: AbortSignal): Promise<Store
|
|
|
184
240
|
*/
|
|
185
241
|
imageHostPath(ref: ImageAttachmentRef): string | undefined
|
|
186
242
|
|
|
243
|
+
/**
|
|
244
|
+
* Durably commit one file byte-for-byte before its owning session event is
|
|
245
|
+
* appended. Files carry no admission limits: any byte content and length is
|
|
246
|
+
* accepted, and the stored object is the exact submitted bytes. Backends
|
|
247
|
+
* without verbatim file storage keep this default rejection.
|
|
248
|
+
* @param input - exact bytes and optional display name.
|
|
249
|
+
* @returns the durable content-addressed file reference.
|
|
250
|
+
*/
|
|
251
|
+
saveFile(input: SaveFileAttachment): Promise<FileAttachmentRef>
|
|
252
|
+
|
|
253
|
+
/**
|
|
254
|
+
* Durably commit one file byte-for-byte from bounded chunks. Providers must
|
|
255
|
+
* apply backpressure and must not collect the complete file in memory.
|
|
256
|
+
* Backends without streamed verbatim storage keep this default rejection.
|
|
257
|
+
* @param input - ordered exact bytes, optional cancellation, and display name.
|
|
258
|
+
* @returns the durable content-addressed file reference.
|
|
259
|
+
*/
|
|
260
|
+
saveFileStream(input: SaveFileStreamAttachment): Promise<FileAttachmentRef>
|
|
261
|
+
|
|
262
|
+
/**
|
|
263
|
+
* Read and verify one verbatim stored file as bounded chunks. Providers must
|
|
264
|
+
* not collect the complete file in memory. Backends without verbatim file
|
|
265
|
+
* reads keep this default rejection.
|
|
266
|
+
* @param ref - durable reference from the session log.
|
|
267
|
+
* @param signal - optional cancellation for backend reads and verification work.
|
|
268
|
+
* @returns exact file bytes in order; integrity failures reject the iteration.
|
|
269
|
+
*/
|
|
270
|
+
async *readFileStream( ref: FileAttachmentRef, signal?: AbortSignal, ): AsyncIterable<Uint8Array>
|
|
271
|
+
|
|
272
|
+
/**
|
|
273
|
+
* Locate the verbatim stored file object in the harness host filesystem.
|
|
274
|
+
* @param ref - durable file reference.
|
|
275
|
+
* @returns an absolute host path, or undefined when this backend is not host-file-backed.
|
|
276
|
+
* @throws an AttachmentError when the durable reference is invalid.
|
|
277
|
+
*/
|
|
278
|
+
fileHostPath(ref: FileAttachmentRef): string | undefined
|
|
279
|
+
|
|
187
280
|
/**
|
|
188
281
|
* Generate or read one deterministic model-request version from the stored normalized image.
|
|
189
282
|
* @param ref - durable provider-independent normalized attachment reference.
|
|
@@ -195,4 +288,64 @@ readImageRequest( ref: ImageAttachmentRef, policy: ImageRequestPolicy, signal?:
|
|
|
195
288
|
```
|
|
196
289
|
|
|
197
290
|
Source: [`packages/attachment/attachment/src/index.ts`](../../packages/attachment/attachment/src/index.ts)
|
|
291
|
+
|
|
292
|
+
<a id="ctxfileuploads--fileuploads"></a>
|
|
293
|
+
|
|
294
|
+
### `ctx.fileUploads` — `FileUploads`
|
|
295
|
+
|
|
296
|
+
Host service owning upload storage and Agent-scoped staged receipts.
|
|
297
|
+
|
|
298
|
+
```ts cordis-catalog
|
|
299
|
+
/**
|
|
300
|
+
* Register the ordinary-Session resolver used when a raw upload addresses a cold Session.
|
|
301
|
+
* @param resolve - resolver that returns the exact live Agent or throws a Remote error.
|
|
302
|
+
* @returns disposer removing this resolver.
|
|
303
|
+
*/
|
|
304
|
+
registerAgentResolver(resolve: AgentResolver): () => void
|
|
305
|
+
|
|
306
|
+
/**
|
|
307
|
+
* Persist one encoded upload and stage it under the Agent receiver selected by Typert.
|
|
308
|
+
* @param agent - receiving Agent resolved from the Remote Agent scope.
|
|
309
|
+
* @param request - canonical base64 bytes and optional display name.
|
|
310
|
+
* @param signal - caller cancellation before storage begins.
|
|
311
|
+
* @returns the staged receipt and durable file reference.
|
|
312
|
+
*/
|
|
313
|
+
@Remote('upload') upload(agent: Agent, request: EncodedFileUploadRequest, signal: AbortSignal): Promise<FileUploadValue>
|
|
314
|
+
|
|
315
|
+
/**
|
|
316
|
+
* Persist raw chunks for one Session without aggregating the upload.
|
|
317
|
+
* @param request - Session identity, ordered bytes, cancellation, and optional display name.
|
|
318
|
+
* @returns the staged receipt and durable file reference.
|
|
319
|
+
*/
|
|
320
|
+
async uploadStream(request: { readonly sessionId: SessionId readonly data: AsyncIterable<Uint8Array> readonly signal?: AbortSignal readonly name?: string }): Promise<FileUploadValue>
|
|
321
|
+
|
|
322
|
+
/**
|
|
323
|
+
* Resolve one staged receipt inside its receiving Agent scope.
|
|
324
|
+
* @param agent - receiving Agent.
|
|
325
|
+
* @param receiptId - opaque receipt minted for one completed upload.
|
|
326
|
+
* @returns durable file reference, or `undefined` for an unknown or foreign receipt.
|
|
327
|
+
*/
|
|
328
|
+
resolve(agent: Agent, receiptId: FileUploadReceiptId): FileAttachmentRef | undefined
|
|
329
|
+
|
|
330
|
+
/**
|
|
331
|
+
* Bind receipts while one prompt enters an Agent inbox.
|
|
332
|
+
* Disposal restores every prior binding unless the caller commits successful delivery.
|
|
333
|
+
* @param agent - receiving Agent.
|
|
334
|
+
* @param receiptIds - distinct staged receipts referenced by the prompt.
|
|
335
|
+
* @param requestId - prompt identity later observed in queue or history.
|
|
336
|
+
* @returns binding kept after commit until queue or history observation retires its receipts.
|
|
337
|
+
*/
|
|
338
|
+
bindPrompt( agent: Agent, receiptIds: readonly FileUploadReceiptId[], requestId: string, ): PromptFileBinding
|
|
339
|
+
|
|
340
|
+
/**
|
|
341
|
+
* Retire every receipt accepted by one removed queue occurrence.
|
|
342
|
+
* @param agent - receiving Agent.
|
|
343
|
+
* @param requestId - prompt identity carried by the queue occurrence.
|
|
344
|
+
*/
|
|
345
|
+
retirePrompt(agent: Agent, requestId: string): void
|
|
346
|
+
```
|
|
347
|
+
|
|
348
|
+
Types: [Agent](core.md) · [SessionId](core.md)
|
|
349
|
+
|
|
350
|
+
Source: [`packages/client/file-upload/src/index.ts`](../../packages/client/file-upload/src/index.ts)
|
|
198
351
|
<!-- END GENERATED cordis-surface -->
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
#
|
|
1
|
+
# 持久附件
|
|
2
2
|
|
|
3
3
|
[English](attachment.md) | 中文
|
|
4
4
|
|
|
5
|
-
附件 seam
|
|
5
|
+
附件 seam 将二进制图片和通用文件的所有权与会话日志分离。生产方把字节交给 [`ctx.attachments`](#ctxattachments--attachmentstore-abstract-seam);只有对象完成持久化后,该服务才会发布不可变的内容寻址引用。会话事件和模型可见的附件块包含该引用及其元数据,绝不包含浏览器对象 URL、宿主临时路径、提供方 URL 或 base64 数据。独立的 [`ctx.fileUploads`](#ctxfileuploads--fileuploads) 服务把浏览器文件传输与暂存凭证绑定到接收方 Agent。
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
未发送的浏览器草稿可以保留在内存中,原生客户端也可以将其暂存于操作系统临时存储。浏览器通用文件取得暂存 prompt 凭证前会完成持久化。宿主接受用户消息后,会先把消息中的图片移到 `<DSH_HOME>/attachments/v1` 下,再追加用户事件。结构化模型图片输出遵循同样的先持久化、后追加事件规则。
|
|
8
8
|
|
|
9
9
|
来源:[`packages/attachment/attachment/src/types.ts`](../../packages/attachment/attachment/src/types.ts)
|
|
10
10
|
|
|
@@ -62,6 +62,38 @@ interface ImageAttachmentLimits {
|
|
|
62
62
|
|
|
63
63
|
## 提交与经校验读取的数据
|
|
64
64
|
|
|
65
|
+
```ts type-equiv
|
|
66
|
+
/**
|
|
67
|
+
* Browser-submitted prompt content accepted by Host prompt endpoints; the
|
|
68
|
+
* accepting Host promotes image parts to durable references through
|
|
69
|
+
* `ctx.attachments.admitPromptContent()` before any message is created, so a wire caller can
|
|
70
|
+
* never cite an attachment it did not upload.
|
|
71
|
+
*/
|
|
72
|
+
type PromptContentPart =
|
|
73
|
+
| { readonly type: 'text'; readonly text: string }
|
|
74
|
+
| {
|
|
75
|
+
readonly type: 'image'
|
|
76
|
+
readonly mediaType: ImageMediaType
|
|
77
|
+
readonly data: string
|
|
78
|
+
readonly name?: string
|
|
79
|
+
}
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
```ts type-equiv
|
|
83
|
+
/** Host prompt content whose file receipts are resolved and whose image bytes await admission. */
|
|
84
|
+
type AttachmentAdmissionPart =
|
|
85
|
+
| PromptContentPart
|
|
86
|
+
| { readonly type: 'file'; readonly attachment: FileAttachmentRef }
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
```ts type-equiv
|
|
90
|
+
/** Host-admitted prompt content with every attachment represented by its durable reference. */
|
|
91
|
+
type AdmittedPromptContentPart =
|
|
92
|
+
| { readonly type: 'text'; readonly text: string }
|
|
93
|
+
| { readonly type: 'image'; readonly attachment: ImageAttachmentRef }
|
|
94
|
+
| { readonly type: 'file'; readonly attachment: FileAttachmentRef }
|
|
95
|
+
```
|
|
96
|
+
|
|
65
97
|
```ts type-equiv
|
|
66
98
|
/** Base64-encoded image upload accompanying one wire request. */
|
|
67
99
|
interface EncodedImageAttachment {
|
|
@@ -125,7 +157,7 @@ interface RequestImageAttachment {
|
|
|
125
157
|
}
|
|
126
158
|
```
|
|
127
159
|
|
|
128
|
-
`saveImage()` 准备并原子提交提供方无关的规范化附件,然后直接返回 `ImageAttachmentRef`。`saveImages()` 在发布批次前为每个成员各准备一次经过验证的附件,因此校验拒绝不会留下部分对象,发布也不会重复解码或选择质量。`
|
|
160
|
+
`saveImage()` 准备并原子提交提供方无关的规范化附件,然后直接返回 `ImageAttachmentRef`。`saveImages()` 在发布批次前为每个成员各准备一次经过验证的附件,因此校验拒绝不会留下部分对象,发布也不会重复解码或选择质量。`admitPromptContent()` 在文件凭证解析后接收完整且有序的 Host prompt,把 base64 图片上传替换为持久引用,并让持久文件引用原样通过。`admitEncodedImages()` 支持其他 wire 入口,把张数、聚合字节和有序批量准入交给 `saveImages()`。`admitEncodedFile()` 让编码协议适配器使用服务拥有的规范 base64 准入,`isAttachmentError()` 让这些适配器无需导入实现辅助函数即可识别稳定的附件错误。`readImage()` 校验来自已授权会话路径的规范化附件。`imageHostPath()` 只公开提供方所持对象的宿主位置,不判断当前工具执行环境能否读取它。`readImageRequest()` 按确切路由的像素和字节预算派生并缓存确定性请求版本。该版本包含编码字节和元数据,不包含执行环境路径。新条目在发布前完整解码,缓存命中只做有界元数据探测。调用方需要有序批次时,对单数方法使用 `Promise.all`。本地实现按需编码首选候选、合并相同请求身份的并发任务、允许每个等待方单独取消、没有等待方时停止共享任务,并通过实例级限流器限制全部变换,默认同时执行两项。该服务不规定保留策略:恢复和 fork 后的会话可能共享对象,因此基于引用的垃圾回收会延期实现,不与单个会话的删除绑定。
|
|
129
161
|
|
|
130
162
|
<!-- BEGIN GENERATED cordis-surface (gen-cordis-catalog.ts) — do not edit between markers -->
|
|
131
163
|
|
|
@@ -157,6 +189,30 @@ abstract validateImage(input: SaveImageAttachment): Promise<void>
|
|
|
157
189
|
*/
|
|
158
190
|
async saveImages(inputs: readonly SaveImageAttachment[]): Promise<readonly ImageAttachmentRef[]>
|
|
159
191
|
|
|
192
|
+
/**
|
|
193
|
+
* Admit one Host prompt and replace each uploaded image with its durable reference.
|
|
194
|
+
* Text and durable file references pass through unchanged. A prompt without image parts performs no storage operation.
|
|
195
|
+
* @param content - prompt parts in message order after file receipt resolution.
|
|
196
|
+
* @returns admitted prompt parts in the same order as `content`.
|
|
197
|
+
* @throws AttachmentError when the image batch is refused.
|
|
198
|
+
*/
|
|
199
|
+
async admitPromptContent( content: readonly AttachmentAdmissionPart[], ): Promise<AdmittedPromptContentPart[]>
|
|
200
|
+
|
|
201
|
+
/**
|
|
202
|
+
* Decode and durably commit one canonical base64 file upload.
|
|
203
|
+
* @param input - canonical base64 bytes and optional display name.
|
|
204
|
+
* @returns the durable content-addressed file reference.
|
|
205
|
+
* @throws AttachmentError when the encoding or storage operation is refused.
|
|
206
|
+
*/
|
|
207
|
+
admitEncodedFile(input: EncodedFileAttachment): Promise<FileAttachmentRef>
|
|
208
|
+
|
|
209
|
+
/**
|
|
210
|
+
* Identify a failure emitted by this attachment capability by its stable code.
|
|
211
|
+
* @param error - value caught from an attachment operation.
|
|
212
|
+
* @returns whether the value is an attachment failure.
|
|
213
|
+
*/
|
|
214
|
+
isAttachmentError(error: unknown): error is AttachmentError
|
|
215
|
+
|
|
160
216
|
/**
|
|
161
217
|
* Validate and durably commit one image before its owning session event is appended.
|
|
162
218
|
* The returned reference describes the persisted normalized image. When
|
|
@@ -184,6 +240,43 @@ abstract readImage(ref: ImageAttachmentRef, signal?: AbortSignal): Promise<Store
|
|
|
184
240
|
*/
|
|
185
241
|
imageHostPath(ref: ImageAttachmentRef): string | undefined
|
|
186
242
|
|
|
243
|
+
/**
|
|
244
|
+
* Durably commit one file byte-for-byte before its owning session event is
|
|
245
|
+
* appended. Files carry no admission limits: any byte content and length is
|
|
246
|
+
* accepted, and the stored object is the exact submitted bytes. Backends
|
|
247
|
+
* without verbatim file storage keep this default rejection.
|
|
248
|
+
* @param input - exact bytes and optional display name.
|
|
249
|
+
* @returns the durable content-addressed file reference.
|
|
250
|
+
*/
|
|
251
|
+
saveFile(input: SaveFileAttachment): Promise<FileAttachmentRef>
|
|
252
|
+
|
|
253
|
+
/**
|
|
254
|
+
* Durably commit one file byte-for-byte from bounded chunks. Providers must
|
|
255
|
+
* apply backpressure and must not collect the complete file in memory.
|
|
256
|
+
* Backends without streamed verbatim storage keep this default rejection.
|
|
257
|
+
* @param input - ordered exact bytes, optional cancellation, and display name.
|
|
258
|
+
* @returns the durable content-addressed file reference.
|
|
259
|
+
*/
|
|
260
|
+
saveFileStream(input: SaveFileStreamAttachment): Promise<FileAttachmentRef>
|
|
261
|
+
|
|
262
|
+
/**
|
|
263
|
+
* Read and verify one verbatim stored file as bounded chunks. Providers must
|
|
264
|
+
* not collect the complete file in memory. Backends without verbatim file
|
|
265
|
+
* reads keep this default rejection.
|
|
266
|
+
* @param ref - durable reference from the session log.
|
|
267
|
+
* @param signal - optional cancellation for backend reads and verification work.
|
|
268
|
+
* @returns exact file bytes in order; integrity failures reject the iteration.
|
|
269
|
+
*/
|
|
270
|
+
async *readFileStream( ref: FileAttachmentRef, signal?: AbortSignal, ): AsyncIterable<Uint8Array>
|
|
271
|
+
|
|
272
|
+
/**
|
|
273
|
+
* Locate the verbatim stored file object in the harness host filesystem.
|
|
274
|
+
* @param ref - durable file reference.
|
|
275
|
+
* @returns an absolute host path, or undefined when this backend is not host-file-backed.
|
|
276
|
+
* @throws an AttachmentError when the durable reference is invalid.
|
|
277
|
+
*/
|
|
278
|
+
fileHostPath(ref: FileAttachmentRef): string | undefined
|
|
279
|
+
|
|
187
280
|
/**
|
|
188
281
|
* Generate or read one deterministic model-request version from the stored normalized image.
|
|
189
282
|
* @param ref - durable provider-independent normalized attachment reference.
|
|
@@ -195,4 +288,64 @@ readImageRequest( ref: ImageAttachmentRef, policy: ImageRequestPolicy, signal?:
|
|
|
195
288
|
```
|
|
196
289
|
|
|
197
290
|
Source: [`packages/attachment/attachment/src/index.ts`](../../packages/attachment/attachment/src/index.ts)
|
|
291
|
+
|
|
292
|
+
<a id="ctxfileuploads--fileuploads"></a>
|
|
293
|
+
|
|
294
|
+
### `ctx.fileUploads` — `FileUploads`
|
|
295
|
+
|
|
296
|
+
Host service owning upload storage and Agent-scoped staged receipts.
|
|
297
|
+
|
|
298
|
+
```ts cordis-catalog
|
|
299
|
+
/**
|
|
300
|
+
* Register the ordinary-Session resolver used when a raw upload addresses a cold Session.
|
|
301
|
+
* @param resolve - resolver that returns the exact live Agent or throws a Remote error.
|
|
302
|
+
* @returns disposer removing this resolver.
|
|
303
|
+
*/
|
|
304
|
+
registerAgentResolver(resolve: AgentResolver): () => void
|
|
305
|
+
|
|
306
|
+
/**
|
|
307
|
+
* Persist one encoded upload and stage it under the Agent receiver selected by Typert.
|
|
308
|
+
* @param agent - receiving Agent resolved from the Remote Agent scope.
|
|
309
|
+
* @param request - canonical base64 bytes and optional display name.
|
|
310
|
+
* @param signal - caller cancellation before storage begins.
|
|
311
|
+
* @returns the staged receipt and durable file reference.
|
|
312
|
+
*/
|
|
313
|
+
@Remote('upload') upload(agent: Agent, request: EncodedFileUploadRequest, signal: AbortSignal): Promise<FileUploadValue>
|
|
314
|
+
|
|
315
|
+
/**
|
|
316
|
+
* Persist raw chunks for one Session without aggregating the upload.
|
|
317
|
+
* @param request - Session identity, ordered bytes, cancellation, and optional display name.
|
|
318
|
+
* @returns the staged receipt and durable file reference.
|
|
319
|
+
*/
|
|
320
|
+
async uploadStream(request: { readonly sessionId: SessionId readonly data: AsyncIterable<Uint8Array> readonly signal?: AbortSignal readonly name?: string }): Promise<FileUploadValue>
|
|
321
|
+
|
|
322
|
+
/**
|
|
323
|
+
* Resolve one staged receipt inside its receiving Agent scope.
|
|
324
|
+
* @param agent - receiving Agent.
|
|
325
|
+
* @param receiptId - opaque receipt minted for one completed upload.
|
|
326
|
+
* @returns durable file reference, or `undefined` for an unknown or foreign receipt.
|
|
327
|
+
*/
|
|
328
|
+
resolve(agent: Agent, receiptId: FileUploadReceiptId): FileAttachmentRef | undefined
|
|
329
|
+
|
|
330
|
+
/**
|
|
331
|
+
* Bind receipts while one prompt enters an Agent inbox.
|
|
332
|
+
* Disposal restores every prior binding unless the caller commits successful delivery.
|
|
333
|
+
* @param agent - receiving Agent.
|
|
334
|
+
* @param receiptIds - distinct staged receipts referenced by the prompt.
|
|
335
|
+
* @param requestId - prompt identity later observed in queue or history.
|
|
336
|
+
* @returns binding kept after commit until queue or history observation retires its receipts.
|
|
337
|
+
*/
|
|
338
|
+
bindPrompt( agent: Agent, receiptIds: readonly FileUploadReceiptId[], requestId: string, ): PromptFileBinding
|
|
339
|
+
|
|
340
|
+
/**
|
|
341
|
+
* Retire every receipt accepted by one removed queue occurrence.
|
|
342
|
+
* @param agent - receiving Agent.
|
|
343
|
+
* @param requestId - prompt identity carried by the queue occurrence.
|
|
344
|
+
*/
|
|
345
|
+
retirePrompt(agent: Agent, requestId: string): void
|
|
346
|
+
```
|
|
347
|
+
|
|
348
|
+
Types: [Agent](core.zh.md) · [SessionId](core.zh.md)
|
|
349
|
+
|
|
350
|
+
Source: [`packages/client/file-upload/src/index.ts`](../../packages/client/file-upload/src/index.ts)
|
|
198
351
|
<!-- END GENERATED cordis-surface -->
|