dsh-plugin-dev-kb 1.0.2 → 1.0.4

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.
Files changed (144) hide show
  1. package/CHANGELOG.md +31 -0
  2. package/kb/README.md +1 -1
  3. package/kb/extra/cookbook/adding-a-vendored-package.zh.md +3 -3
  4. package/kb/extra/cookbook/maintaining-dsh-code-review.zh.md +1 -1
  5. package/kb/extra/cookbook/responding-to-pr-review-on-a-stack.zh.md +1 -1
  6. package/kb/extra/defensive-patterns.zh.md +3 -1
  7. package/kb/extra/development.zh.md +15 -9
  8. package/kb/extra/event-producer-consumer.md +5 -2
  9. package/kb/extra/event-producer-consumer.zh.md +5 -2
  10. package/kb/extra/graph-atlas.zh.md +7 -7
  11. package/kb/extra/i18n/README.md +3 -3
  12. package/kb/extra/i18n/README.zh.md +9 -7
  13. package/kb/extra/i18n/style-samples.md +1 -1
  14. package/kb/extra/i18n/translation-prompt.md +3 -3
  15. package/kb/extra/i18n/translation-rules.md +2 -2
  16. package/kb/extra/i18n/translation-rules.zh.md +3 -3
  17. package/kb/extra/module-graph.md +18 -9
  18. package/kb/extra/module-graph.zh.md +18 -9
  19. package/kb/extra/postmortem/0001-acp-default-export-drops-inject.zh.md +1 -1
  20. package/kb/extra/postmortem/0002-js-expression-disabled-filesystem-tools.zh.md +1 -1
  21. package/kb/extra/postmortem/0004-landlock-partial-notice-misclassified-child-failures.zh.md +1 -1
  22. package/kb/extra/postmortem/README.zh.md +5 -5
  23. package/kb/extra/rescope.zh.md +1 -1
  24. package/kb/extra/subsystems/agent-team.md +2 -2
  25. package/kb/extra/subsystems/agent-team.zh.md +6 -6
  26. package/kb/extra/subsystems/attachment.md +63 -12
  27. package/kb/extra/subsystems/attachment.zh.md +63 -12
  28. package/kb/extra/subsystems/extensions.md +9 -9
  29. package/kb/extra/subsystems/extensions.zh.md +12 -12
  30. package/kb/extra/subsystems/feedback.md +2 -2
  31. package/kb/extra/subsystems/feedback.zh.md +2 -2
  32. package/kb/extra/testing.md +1 -1
  33. package/kb/extra/testing.zh.md +7 -7
  34. package/kb/extra/web-styling.zh.md +2 -2
  35. package/kb/meta/search-index.json +132 -132
  36. package/kb/meta/source.json +2 -2
  37. package/kb/meta/topics.md +2 -2
  38. package/kb/site/develop/basic/index.md +1 -1
  39. package/kb/site/develop/basic/publish.md +3 -3
  40. package/kb/site/develop/cordis-tutorial/index.md +1 -1
  41. package/kb/site/en/reference/capability-seams.md +5 -0
  42. package/kb/site/en/reference/config-catalog.md +52 -17
  43. package/kb/site/en/reference/persistence-catalog.md +1 -1
  44. package/kb/site/en/reference/subsystems/approval.md +3 -3
  45. package/kb/site/en/reference/subsystems/client-modules.md +7 -7
  46. package/kb/site/en/reference/subsystems/code-runtime.md +2 -2
  47. package/kb/site/en/reference/subsystems/commands.md +3 -3
  48. package/kb/site/en/reference/subsystems/compaction.md +3 -3
  49. package/kb/site/en/reference/subsystems/core.md +19 -19
  50. package/kb/site/en/reference/subsystems/credentials.md +163 -8
  51. package/kb/site/en/reference/subsystems/filesystem.md +5 -5
  52. package/kb/site/en/reference/subsystems/goal.md +3 -3
  53. package/kb/site/en/reference/subsystems/invariants.md +2 -2
  54. package/kb/site/en/reference/subsystems/jobs.md +2 -2
  55. package/kb/site/en/reference/subsystems/llm-streaming.md +16 -4
  56. package/kb/site/en/reference/subsystems/lsp.md +2 -2
  57. package/kb/site/en/reference/subsystems/permission-presets.md +2 -2
  58. package/kb/site/en/reference/subsystems/persistence.md +2 -2
  59. package/kb/site/en/reference/subsystems/plan.md +2 -2
  60. package/kb/site/en/reference/subsystems/sandbox.md +3 -3
  61. package/kb/site/en/reference/subsystems/session-projection.md +60 -35
  62. package/kb/site/en/reference/subsystems/session-query.md +2 -2
  63. package/kb/site/en/reference/subsystems/session-reference.md +3 -3
  64. package/kb/site/en/reference/subsystems/session-telemetry.md +3 -3
  65. package/kb/site/en/reference/subsystems/session-title.md +2 -2
  66. package/kb/site/en/reference/subsystems/session.md +6 -6
  67. package/kb/site/en/reference/subsystems/settings.md +4 -4
  68. package/kb/site/en/reference/subsystems/shell.md +3 -3
  69. package/kb/site/en/reference/subsystems/skills.md +3 -3
  70. package/kb/site/en/reference/subsystems/spill.md +2 -2
  71. package/kb/site/en/reference/subsystems/storage.md +4 -4
  72. package/kb/site/en/reference/subsystems/subagent.md +6 -6
  73. package/kb/site/en/reference/subsystems/subprocess.md +3 -3
  74. package/kb/site/en/reference/subsystems/system-prompt.md +4 -4
  75. package/kb/site/en/reference/subsystems/terminal.md +2 -2
  76. package/kb/site/en/reference/subsystems/token-meter.md +2 -2
  77. package/kb/site/en/reference/subsystems/tools.md +8 -8
  78. package/kb/site/en/reference/subsystems/typert.md +4 -4
  79. package/kb/site/en/reference/subsystems/user-questions.md +2 -2
  80. package/kb/site/en/reference/subsystems/web-server.md +46 -6
  81. package/kb/site/en/reference/subsystems/web.md +2 -2
  82. package/kb/site/en/reference/subsystems/workflow.md +8 -8
  83. package/kb/site/en/reference/subsystems/workspace.md +3 -3
  84. package/kb/site/en/reference/tool-catalog.md +3 -3
  85. package/kb/site/guide/providers.md +2 -2
  86. package/kb/site/guide/python-sdk.md +2 -2
  87. package/kb/site/guide/quickstart.md +2 -2
  88. package/kb/site/reference/capability-seams.md +5 -0
  89. package/kb/site/reference/config-catalog.md +53 -18
  90. package/kb/site/reference/cookbook/adding-a-conversation-node.md +1 -1
  91. package/kb/site/reference/cookbook/adding-a-package.md +5 -3
  92. package/kb/site/reference/cookbook/adding-a-settings-card.md +1 -1
  93. package/kb/site/reference/cookbook/adding-a-tool.md +6 -6
  94. package/kb/site/reference/cookbook/adding-an-llm-adapter.md +2 -2
  95. package/kb/site/reference/cookbook/extension-cookbook.md +6 -4
  96. package/kb/site/reference/index.md +4 -4
  97. package/kb/site/reference/persistence-catalog.md +5 -5
  98. package/kb/site/reference/subsystems/approval.md +3 -3
  99. package/kb/site/reference/subsystems/client-modules.md +8 -8
  100. package/kb/site/reference/subsystems/code-runtime.md +4 -4
  101. package/kb/site/reference/subsystems/commands.md +5 -5
  102. package/kb/site/reference/subsystems/compaction.md +7 -7
  103. package/kb/site/reference/subsystems/core.md +26 -24
  104. package/kb/site/reference/subsystems/credentials.md +163 -8
  105. package/kb/site/reference/subsystems/filesystem.md +6 -6
  106. package/kb/site/reference/subsystems/goal.md +5 -5
  107. package/kb/site/reference/subsystems/index.md +5 -5
  108. package/kb/site/reference/subsystems/invariants.md +5 -5
  109. package/kb/site/reference/subsystems/jobs.md +4 -4
  110. package/kb/site/reference/subsystems/llm-streaming.md +21 -9
  111. package/kb/site/reference/subsystems/lsp.md +3 -3
  112. package/kb/site/reference/subsystems/permission-presets.md +3 -3
  113. package/kb/site/reference/subsystems/persistence.md +6 -6
  114. package/kb/site/reference/subsystems/plan.md +4 -4
  115. package/kb/site/reference/subsystems/sandbox.md +7 -5
  116. package/kb/site/reference/subsystems/schedule.md +1 -1
  117. package/kb/site/reference/subsystems/scope.md +1 -1
  118. package/kb/site/reference/subsystems/session-projection.md +61 -36
  119. package/kb/site/reference/subsystems/session-query.md +2 -2
  120. package/kb/site/reference/subsystems/session-reference.md +3 -3
  121. package/kb/site/reference/subsystems/session-telemetry.md +5 -5
  122. package/kb/site/reference/subsystems/session-title.md +2 -2
  123. package/kb/site/reference/subsystems/session.md +13 -11
  124. package/kb/site/reference/subsystems/settings.md +4 -4
  125. package/kb/site/reference/subsystems/shell.md +6 -6
  126. package/kb/site/reference/subsystems/skills.md +3 -3
  127. package/kb/site/reference/subsystems/spill.md +3 -3
  128. package/kb/site/reference/subsystems/storage.md +7 -7
  129. package/kb/site/reference/subsystems/subagent.md +11 -9
  130. package/kb/site/reference/subsystems/subprocess.md +4 -4
  131. package/kb/site/reference/subsystems/system-prompt.md +5 -5
  132. package/kb/site/reference/subsystems/terminal.md +3 -3
  133. package/kb/site/reference/subsystems/token-meter.md +2 -2
  134. package/kb/site/reference/subsystems/tools.md +9 -9
  135. package/kb/site/reference/subsystems/typert.md +5 -5
  136. package/kb/site/reference/subsystems/user-questions.md +2 -2
  137. package/kb/site/reference/subsystems/web-server.md +48 -8
  138. package/kb/site/reference/subsystems/web.md +3 -3
  139. package/kb/site/reference/subsystems/workflow.md +11 -11
  140. package/kb/site/reference/subsystems/workspace.md +5 -5
  141. package/kb/site/reference/tool-catalog.md +9 -5
  142. package/lib/index.js +9 -1
  143. package/package.json +2 -1
  144. package/skills/dsh-plugin-dev-kb.md +1 -1
@@ -179,6 +179,7 @@ flowchart TD
179
179
  pkg_tmux_context["tmux-context"]
180
180
  end
181
181
  subgraph group_credentials["packages/credentials"]
182
+ pkg_authorization["authorization"]
182
183
  pkg_credentials["credentials"]
183
184
  pkg_credentials_local["credentials-local"]
184
185
  end
@@ -412,20 +413,16 @@ flowchart TD
412
413
  pkg_settings_file --> pkg_invariants
413
414
  pkg_settings_file --> pkg_settings
414
415
  pkg_llm_deepseek --> pkg_anonymous_user_id
416
+ pkg_llm_deepseek --> pkg_atomic_write
415
417
  pkg_llm_deepseek --> pkg_attachment
418
+ pkg_llm_deepseek --> pkg_brand
416
419
  pkg_llm_deepseek --> pkg_credentials
420
+ pkg_llm_deepseek --> pkg_home_paths
417
421
  pkg_llm_deepseek --> pkg_invariants
418
422
  pkg_llm_deepseek --> pkg_launch_environment
419
423
  pkg_llm_deepseek --> pkg_llm
420
424
  pkg_llm_deepseek --> pkg_settings
421
425
  pkg_llm_deepseek --> pkg_timeout
422
- pkg_llm_pi_ai --> pkg_attachment
423
- pkg_llm_pi_ai --> pkg_credentials
424
- pkg_llm_pi_ai --> pkg_invariants
425
- pkg_llm_pi_ai --> pkg_launch_environment
426
- pkg_llm_pi_ai --> pkg_llm
427
- pkg_llm_pi_ai --> pkg_settings
428
- pkg_llm_pi_ai --> pkg_timeout
429
426
  pkg_session --> pkg_brand
430
427
  pkg_session --> pkg_invariants
431
428
  pkg_session --> pkg_llm
@@ -439,9 +436,20 @@ flowchart TD
439
436
  pkg_skill --> pkg_scope
440
437
  pkg_web --> pkg_invariants
441
438
  pkg_web --> pkg_llm
439
+ pkg_authorization --> pkg_credentials
440
+ pkg_authorization --> pkg_invariants
441
+ pkg_authorization --> pkg_llm
442
442
  pkg_lsp --> pkg_brand
443
443
  pkg_lsp --> pkg_invariants
444
444
  pkg_lsp --> pkg_llm
445
+ pkg_llm_pi_ai --> pkg_attachment
446
+ pkg_llm_pi_ai --> pkg_authorization
447
+ pkg_llm_pi_ai --> pkg_credentials
448
+ pkg_llm_pi_ai --> pkg_invariants
449
+ pkg_llm_pi_ai --> pkg_launch_environment
450
+ pkg_llm_pi_ai --> pkg_llm
451
+ pkg_llm_pi_ai --> pkg_settings
452
+ pkg_llm_pi_ai --> pkg_timeout
445
453
  pkg_agent --> pkg_invariants
446
454
  pkg_agent --> pkg_llm
447
455
  pkg_agent --> pkg_scope
@@ -1501,13 +1509,14 @@ flowchart TD
1501
1509
  | [`client-hmr`](../packages/client/hmr) | `client` | [`client-modules`](../packages/client/modules), [`host-webserver`](../packages/host/webserver), [`invariants`](../packages/runtime-diagnostics/invariants) |
1502
1510
  | [`credentials-local`](../packages/credentials/credentials-local) | `credentials` | [`atomic-write`](../packages/util/atomic-write), [`credentials`](../packages/credentials/credentials), [`home-paths`](../packages/util/home-paths), [`invariants`](../packages/runtime-diagnostics/invariants), [`launch-environment`](../packages/util/launch-environment) |
1503
1511
  | [`settings-file`](../packages/settings/settings-file) | `settings` | [`atomic-write`](../packages/util/atomic-write), [`home-paths`](../packages/util/home-paths), [`invariants`](../packages/runtime-diagnostics/invariants), [`settings`](../packages/settings/settings) |
1504
- | [`llm-deepseek`](../packages/llm/llm-deepseek) | `llm` | [`anonymous-user-id`](../packages/identity/anonymous-user-id), [`attachment`](../packages/attachment/attachment), [`credentials`](../packages/credentials/credentials), [`invariants`](../packages/runtime-diagnostics/invariants), [`launch-environment`](../packages/util/launch-environment), [`llm`](../packages/llm/llm), [`settings`](../packages/settings/settings), [`timeout`](../packages/util/timeout) |
1505
- | [`llm-pi-ai`](../packages/llm/llm-pi-ai) | `llm` | [`attachment`](../packages/attachment/attachment), [`credentials`](../packages/credentials/credentials), [`invariants`](../packages/runtime-diagnostics/invariants), [`launch-environment`](../packages/util/launch-environment), [`llm`](../packages/llm/llm), [`settings`](../packages/settings/settings), [`timeout`](../packages/util/timeout) |
1512
+ | [`llm-deepseek`](../packages/llm/llm-deepseek) | `llm` | [`anonymous-user-id`](../packages/identity/anonymous-user-id), [`atomic-write`](../packages/util/atomic-write), [`attachment`](../packages/attachment/attachment), [`brand`](../packages/util/brand), [`credentials`](../packages/credentials/credentials), [`home-paths`](../packages/util/home-paths), [`invariants`](../packages/runtime-diagnostics/invariants), [`launch-environment`](../packages/util/launch-environment), [`llm`](../packages/llm/llm), [`settings`](../packages/settings/settings), [`timeout`](../packages/util/timeout) |
1506
1513
  | [`session`](../packages/core/session) | `core` | [`brand`](../packages/util/brand), [`invariants`](../packages/runtime-diagnostics/invariants), [`llm`](../packages/llm/llm), [`scope`](../packages/core/scope), [`typert-protocol`](../packages/typert/protocol) |
1507
1514
  | [`system-prompt`](../packages/core/system-prompt) | `core` | [`invariants`](../packages/runtime-diagnostics/invariants), [`llm`](../packages/llm/llm), [`scope`](../packages/core/scope) |
1508
1515
  | [`skill`](../packages/skill/skill) | `skill` | [`invariants`](../packages/runtime-diagnostics/invariants), [`llm`](../packages/llm/llm), [`scope`](../packages/core/scope) |
1509
1516
  | [`web`](../packages/web/web) | `web` | [`invariants`](../packages/runtime-diagnostics/invariants), [`llm`](../packages/llm/llm) |
1517
+ | [`authorization`](../packages/credentials/authorization) | `credentials` | [`credentials`](../packages/credentials/credentials), [`invariants`](../packages/runtime-diagnostics/invariants), [`llm`](../packages/llm/llm) |
1510
1518
  | [`lsp`](../packages/lsp/lsp) | `lsp` | [`brand`](../packages/util/brand), [`invariants`](../packages/runtime-diagnostics/invariants), [`llm`](../packages/llm/llm) |
1519
+ | [`llm-pi-ai`](../packages/llm/llm-pi-ai) | `llm` | [`attachment`](../packages/attachment/attachment), [`authorization`](../packages/credentials/authorization), [`credentials`](../packages/credentials/credentials), [`invariants`](../packages/runtime-diagnostics/invariants), [`launch-environment`](../packages/util/launch-environment), [`llm`](../packages/llm/llm), [`settings`](../packages/settings/settings), [`timeout`](../packages/util/timeout) |
1511
1520
  | [`agent`](../packages/core/agent) | `core` | [`invariants`](../packages/runtime-diagnostics/invariants), [`llm`](../packages/llm/llm), [`scope`](../packages/core/scope), [`session`](../packages/core/session), [`system-prompt`](../packages/core/system-prompt), [`typert-protocol`](../packages/typert/protocol) |
1512
1521
  | [`skill-badge`](../packages/skill/skill-badge) | `skill` | [`invariants`](../packages/runtime-diagnostics/invariants), [`skill`](../packages/skill/skill) |
1513
1522
  | [`web-fetch-http`](../packages/web/web-fetch-http) | `web` | [`invariants`](../packages/runtime-diagnostics/invariants), [`timeout`](../packages/util/timeout), [`web`](../packages/web/web) |
@@ -181,6 +181,7 @@ flowchart TD
181
181
  pkg_tmux_context["tmux-context"]
182
182
  end
183
183
  subgraph group_credentials["packages/credentials"]
184
+ pkg_authorization["authorization"]
184
185
  pkg_credentials["credentials"]
185
186
  pkg_credentials_local["credentials-local"]
186
187
  end
@@ -414,20 +415,16 @@ flowchart TD
414
415
  pkg_settings_file --> pkg_invariants
415
416
  pkg_settings_file --> pkg_settings
416
417
  pkg_llm_deepseek --> pkg_anonymous_user_id
418
+ pkg_llm_deepseek --> pkg_atomic_write
417
419
  pkg_llm_deepseek --> pkg_attachment
420
+ pkg_llm_deepseek --> pkg_brand
418
421
  pkg_llm_deepseek --> pkg_credentials
422
+ pkg_llm_deepseek --> pkg_home_paths
419
423
  pkg_llm_deepseek --> pkg_invariants
420
424
  pkg_llm_deepseek --> pkg_launch_environment
421
425
  pkg_llm_deepseek --> pkg_llm
422
426
  pkg_llm_deepseek --> pkg_settings
423
427
  pkg_llm_deepseek --> pkg_timeout
424
- pkg_llm_pi_ai --> pkg_attachment
425
- pkg_llm_pi_ai --> pkg_credentials
426
- pkg_llm_pi_ai --> pkg_invariants
427
- pkg_llm_pi_ai --> pkg_launch_environment
428
- pkg_llm_pi_ai --> pkg_llm
429
- pkg_llm_pi_ai --> pkg_settings
430
- pkg_llm_pi_ai --> pkg_timeout
431
428
  pkg_session --> pkg_brand
432
429
  pkg_session --> pkg_invariants
433
430
  pkg_session --> pkg_llm
@@ -441,9 +438,20 @@ flowchart TD
441
438
  pkg_skill --> pkg_scope
442
439
  pkg_web --> pkg_invariants
443
440
  pkg_web --> pkg_llm
441
+ pkg_authorization --> pkg_credentials
442
+ pkg_authorization --> pkg_invariants
443
+ pkg_authorization --> pkg_llm
444
444
  pkg_lsp --> pkg_brand
445
445
  pkg_lsp --> pkg_invariants
446
446
  pkg_lsp --> pkg_llm
447
+ pkg_llm_pi_ai --> pkg_attachment
448
+ pkg_llm_pi_ai --> pkg_authorization
449
+ pkg_llm_pi_ai --> pkg_credentials
450
+ pkg_llm_pi_ai --> pkg_invariants
451
+ pkg_llm_pi_ai --> pkg_launch_environment
452
+ pkg_llm_pi_ai --> pkg_llm
453
+ pkg_llm_pi_ai --> pkg_settings
454
+ pkg_llm_pi_ai --> pkg_timeout
447
455
  pkg_agent --> pkg_invariants
448
456
  pkg_agent --> pkg_llm
449
457
  pkg_agent --> pkg_scope
@@ -1503,13 +1511,14 @@ flowchart TD
1503
1511
  | [`client-hmr`](../packages/client/hmr) | `client` | [`client-modules`](../packages/client/modules), [`host-webserver`](../packages/host/webserver), [`invariants`](../packages/runtime-diagnostics/invariants) |
1504
1512
  | [`credentials-local`](../packages/credentials/credentials-local) | `credentials` | [`atomic-write`](../packages/util/atomic-write), [`credentials`](../packages/credentials/credentials), [`home-paths`](../packages/util/home-paths), [`invariants`](../packages/runtime-diagnostics/invariants), [`launch-environment`](../packages/util/launch-environment) |
1505
1513
  | [`settings-file`](../packages/settings/settings-file) | `settings` | [`atomic-write`](../packages/util/atomic-write), [`home-paths`](../packages/util/home-paths), [`invariants`](../packages/runtime-diagnostics/invariants), [`settings`](../packages/settings/settings) |
1506
- | [`llm-deepseek`](../packages/llm/llm-deepseek) | `llm` | [`anonymous-user-id`](../packages/identity/anonymous-user-id), [`attachment`](../packages/attachment/attachment), [`credentials`](../packages/credentials/credentials), [`invariants`](../packages/runtime-diagnostics/invariants), [`launch-environment`](../packages/util/launch-environment), [`llm`](../packages/llm/llm), [`settings`](../packages/settings/settings), [`timeout`](../packages/util/timeout) |
1507
- | [`llm-pi-ai`](../packages/llm/llm-pi-ai) | `llm` | [`attachment`](../packages/attachment/attachment), [`credentials`](../packages/credentials/credentials), [`invariants`](../packages/runtime-diagnostics/invariants), [`launch-environment`](../packages/util/launch-environment), [`llm`](../packages/llm/llm), [`settings`](../packages/settings/settings), [`timeout`](../packages/util/timeout) |
1514
+ | [`llm-deepseek`](../packages/llm/llm-deepseek) | `llm` | [`anonymous-user-id`](../packages/identity/anonymous-user-id), [`atomic-write`](../packages/util/atomic-write), [`attachment`](../packages/attachment/attachment), [`brand`](../packages/util/brand), [`credentials`](../packages/credentials/credentials), [`home-paths`](../packages/util/home-paths), [`invariants`](../packages/runtime-diagnostics/invariants), [`launch-environment`](../packages/util/launch-environment), [`llm`](../packages/llm/llm), [`settings`](../packages/settings/settings), [`timeout`](../packages/util/timeout) |
1508
1515
  | [`session`](../packages/core/session) | `core` | [`brand`](../packages/util/brand), [`invariants`](../packages/runtime-diagnostics/invariants), [`llm`](../packages/llm/llm), [`scope`](../packages/core/scope), [`typert-protocol`](../packages/typert/protocol) |
1509
1516
  | [`system-prompt`](../packages/core/system-prompt) | `core` | [`invariants`](../packages/runtime-diagnostics/invariants), [`llm`](../packages/llm/llm), [`scope`](../packages/core/scope) |
1510
1517
  | [`skill`](../packages/skill/skill) | `skill` | [`invariants`](../packages/runtime-diagnostics/invariants), [`llm`](../packages/llm/llm), [`scope`](../packages/core/scope) |
1511
1518
  | [`web`](../packages/web/web) | `web` | [`invariants`](../packages/runtime-diagnostics/invariants), [`llm`](../packages/llm/llm) |
1519
+ | [`authorization`](../packages/credentials/authorization) | `credentials` | [`credentials`](../packages/credentials/credentials), [`invariants`](../packages/runtime-diagnostics/invariants), [`llm`](../packages/llm/llm) |
1512
1520
  | [`lsp`](../packages/lsp/lsp) | `lsp` | [`brand`](../packages/util/brand), [`invariants`](../packages/runtime-diagnostics/invariants), [`llm`](../packages/llm/llm) |
1521
+ | [`llm-pi-ai`](../packages/llm/llm-pi-ai) | `llm` | [`attachment`](../packages/attachment/attachment), [`authorization`](../packages/credentials/authorization), [`credentials`](../packages/credentials/credentials), [`invariants`](../packages/runtime-diagnostics/invariants), [`launch-environment`](../packages/util/launch-environment), [`llm`](../packages/llm/llm), [`settings`](../packages/settings/settings), [`timeout`](../packages/util/timeout) |
1513
1522
  | [`agent`](../packages/core/agent) | `core` | [`invariants`](../packages/runtime-diagnostics/invariants), [`llm`](../packages/llm/llm), [`scope`](../packages/core/scope), [`session`](../packages/core/session), [`system-prompt`](../packages/core/system-prompt), [`typert-protocol`](../packages/typert/protocol) |
1514
1523
  | [`skill-badge`](../packages/skill/skill-badge) | `skill` | [`invariants`](../packages/runtime-diagnostics/invariants), [`skill`](../packages/skill/skill) |
1515
1524
  | [`web-fetch-http`](../packages/web/web-fetch-http) | `web` | [`invariants`](../packages/runtime-diagnostics/invariants), [`timeout`](../packages/util/timeout), [`web`](../packages/web/web) |
@@ -103,7 +103,7 @@ if (!ctx.fiber.runtime) return ctx.reflect.get(prop, false) // ← direct glob
103
103
  - **`AgentLoop.resume` 使用 `this.ctx.get('sessionPersistence')`**(`packages/core/agent-loop/src/index.ts`)——Bug #2 的修复,附注释说明 shadow 遍历陷阱。
104
104
  - **无需 key 的 `session/new` e2e,通过真实 stdio 运行**(`examples/acp-agent/tests/acp.e2e.ts`):以子进程方式通过真实 Loader 启动示例,并断言 `session/new` 正常返回。无需 API key 即可明确暴露 Bug #1。已验证恢复 `export default apply` 时测试失败。
105
105
  - **e2e spawn 中设置 `TSX_TSCONFIG_PATH`**:子进程从临时 cwd 运行,tsx 无法通过向上搜索找到仓库根的 tsconfig `paths` 映射——因此 dsh-* 的 import 静默回退到已构建的 `lib/`。将 tsx 指向仓库 tsconfig 使解析不依赖 cwd,确保测试运行的是*源码*而非可能陈旧的构建产物。
106
- - **[docs/testing.md](../testing.md) 规则**:「测试真实入口路径」,行覆盖率不等于行为覆盖率——将这一教训编纂为所有未来插件的规则。
106
+ - **[docs/testing.md](../testing.zh.md) 规则**:「测试真实入口路径」,行覆盖率不等于行为覆盖率——将这一教训编纂为所有未来插件的规则。
107
107
 
108
108
  ## 经验教训
109
109
 
@@ -36,7 +36,7 @@ Cordis Include 将每个 `!!js` 标量解析为一个表达式对象。Loader
36
36
  ## 已添加的防护措施
37
37
 
38
38
  - 文件系统场景启动 `fs.cordis.yml`:一个显式的固定全权限 overlay,配有对应的回放配置和独立的 request-header 类。
39
- - [`AGENTS.md`](../../AGENTS.md) 与 [Cordis 入门](../cordis-primer.md#loader-configuration)明确说明 `!!js` 仅在插件 `config` 内有效,条件式组合应使用 overlay。
39
+ - [`AGENTS.md`](../../AGENTS.md) 与 [Cordis 入门](../cordis-primer.zh.md#loader-configuration)明确说明 `!!js` 仅在插件 `config` 内有效,条件式组合应使用 overlay。
40
40
  - `verify-cordis-config` 解析仓库中的 Cordis YAML,拒绝 Loader 配置项元数据中的表达式节点(包括 include patch 和插入的配置项)。
41
41
  - `dsh-acp-snapshot` 在全新运行和已提交的会话 fixture 中拒绝结构化的 `UNKNOWN_TOOL` 结果,防止其被提交为预期输出。
42
42
 
@@ -40,7 +40,7 @@ stderr 仍是带内归因通道。受限子进程可以故意复现 runner 的
40
40
 
41
41
  ## 已添加的防护措施
42
42
 
43
- - [`RunnerFailureRule`](../subsystems/sandbox.md#wrapped-argv-and-classification-dialects) 携带可选的允许退出码、不区分大小写的逐行致命签名,以及按不区分大小写的整行精确匹配排除的信息性行。
43
+ - [`RunnerFailureRule`](../subsystems/sandbox.zh.md#wrapped-argv-and-classification-dialects) 携带可选的允许退出码、不区分大小写的逐行致命签名,以及按不区分大小写的整行精确匹配排除的信息性行。
44
44
  - [`dsh-sandbox-local`](../../packages/sandbox/sandbox-local/) 把 Landlock 映射为退出码 125 加一行非通知的 `landlock-run:` 诊断,而 bwrap、Seatbelt 和自定义 runner 仍仅依据签名。
45
45
  - [`dsh-bash-sandbox`](../../packages/shell/bash-sandbox/) 直接 spawn 提供方 argv,因此启动前遭拒时使用 spawn 错误通道,而非本地化的 shell 诊断。已结算的前台与后台执行共用一个返回证据的分类器;致命证据优先于拒绝,前台错误会报告匹配到的致命行,同时保持捕获的 stderr 不变。
46
46
  - [`dsh-tool-fs-search`](../../packages/fs/tool-fs-search/) 通过 `ctx.subprocess` 运行打包的 ripgrep,并继续位于沙箱化 bash seam 之外。
@@ -4,7 +4,7 @@
4
4
 
5
5
  事故复盘记录的是:一个 bug 出现在了不该出现的地方(真实用户、已合并的 PR(Pull Request)、已发布的版本),值得关注的是*为什么我们的流程放过了它*,而不仅仅是那一行修复。
6
6
 
7
- 事故复盘不是 [Agent Note](../../.agents/notes/README.md)(Agent Note 记录一个经过深思熟虑的设计决策及其被否决的替代方案,或提出未来工作)。它是一份回顾性的失败记录:什么坏了、机制是什么、为什么每道安全网都没拦住、以及为此新增了哪些具体防护措施,以确保同类 bug 下次出现时会明确报错。
7
+ 事故复盘不是 [Agent Note](../../.agents/notes/README.zh.md)(Agent Note 记录一个经过深思熟虑的设计决策及其被否决的替代方案,或提出未来工作)。它是一份回顾性的失败记录:什么坏了、机制是什么、为什么每道安全网都没拦住、以及为此新增了哪些具体防护措施,以确保同类 bug 下次出现时会明确报错。
8
8
 
9
9
  当一个 bug 满足以下条件时,请撰写事故复盘:**隐蔽**(机制不显而易见,即使是细心的工程师也得费力重新推导)、**系统性**(逃逸的原因是测试、工具、约定的缺口,而非一次性的笔误)、**重新发现的代价高**(它消耗了真实的调试时间,且下次还会如此)。请链接该事故复盘所推动建立的防护措施(测试、AGENTS.md 规则、ADR)。
10
10
 
@@ -12,7 +12,7 @@
12
12
 
13
13
  | # | 标题 |
14
14
  |---|---|
15
- | [0001](0001-acp-default-export-drops-inject.md) | ACP(Agent Client Protocol)服务器在连接时崩溃:`export default` 丢失了插件的 `inject` |
16
- | [0002](0002-js-expression-disabled-filesystem-tools.md) | 文件系统快照工具被一个字面量 `!!js` 对象永久禁用 |
17
- | [0003](0003-web-agent-gui-feedback-loop.md) | Web agent(智能体)验证了替代服务器,而非承载其会话的 GUI |
18
- | [0004](0004-landlock-partial-notice-misclassified-child-failures.md) | Landlock 部分强制执行通知导致子进程失败被误归类 |
15
+ | [0001](0001-acp-default-export-drops-inject.zh.md) | ACP(Agent Client Protocol)服务器在连接时崩溃:`export default` 丢失了插件的 `inject` |
16
+ | [0002](0002-js-expression-disabled-filesystem-tools.zh.md) | 文件系统快照工具被一个字面量 `!!js` 对象永久禁用 |
17
+ | [0003](0003-web-agent-gui-feedback-loop.zh.md) | Web agent(智能体)验证了替代服务器,而非承载其会话的 GUI |
18
+ | [0004](0004-landlock-partial-notice-misclassified-child-failures.zh.md) | Landlock 部分强制执行通知导致子进程失败被误归类 |
@@ -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/implemented/process/2026-08-10-vendor-package-rescope.md),上游 commit 见 [`vendor/README.md`](../vendor/README.md)。
5
+ Cordis 框架及其基础库以源码形式 vendored 在 [`vendor/`](../vendor/README.md) 下,并以 `@deepseek-ai` scope 发布:每个 harness 包都把框架声明为 peer dependency,发布 harness 就会连带发布这一层,用上游名发布等于在 registry 上占用别人的名字。本页是名字映射表;决策与影响见 [改名 Agent Note](../.agents/notes/implemented/process/2026-08-10-vendor-package-rescope.zh.md),上游 commit 见 [`vendor/README.md`](../vendor/README.md)。
6
6
 
7
7
  ## 名字映射
8
8
 
@@ -82,7 +82,7 @@ interface TeamTaskSnapshot {
82
82
 
83
83
  ## Cordis API
84
84
 
85
- Generated from source by `scripts/gen-cordis-catalog.ts` (verified fresh by `pnpm run verify-cordis-catalog` in doc-sync; regenerate with `pnpm run gen-cordis-catalog`) — this section is byte-identical in both language sides of the page. Signature blocks use a `ts cordis-catalog` fence and keep the original source JSDoc; dispatch modes are defined in the [primer](../cordis-primer.md#dispatch-modes), and the framework-inherited `ctx` API lives in [cordis-api/inherited.md](../cordis-api/inherited.md).
85
+ Generated from source by `scripts/gen-cordis-catalog.ts` (verified fresh by `pnpm run verify-cordis-catalog` in doc-sync; regenerate with `pnpm run gen-cordis-catalog`) — the language sides differ only in locale-specific paired document paths. Signature blocks use a `ts cordis-catalog` fence and keep the original source JSDoc; dispatch modes are defined in the [primer](../cordis-primer.md#dispatch-modes), and the framework-inherited `ctx` API lives in [cordis-api/inherited.md](../cordis-api/inherited.md).
86
86
 
87
87
  <a id="ctxagentteams--teamservice"></a>
88
88
 
@@ -179,5 +179,5 @@ tryMembership(agent: Agent): TeamMembership | undefined
179
179
 
180
180
  Types: [Agent](core.md)
181
181
 
182
- Source: [`packages/experimental/agent-team/src/index.ts:56`](../../packages/experimental/agent-team/src/index.ts)
182
+ Source: [`packages/experimental/agent-team/src/index.ts`](../../packages/experimental/agent-team/src/index.ts)
183
183
  <!-- END GENERATED cordis-surface -->
@@ -2,11 +2,11 @@
2
2
 
3
3
  [English](agent-team.md) | 中文
4
4
 
5
- 实验性隐式 Root Team 领域、模型工具与宿主适配器共享的类型。[Agent Teams Agent Note](../../.agents/notes/implemented/feature/2026-08-05-agent-teams.md)负责身份、mailbox、task 与共享 checkout 决策;本页记录 [`packages/experimental/agent-team/src/types.ts`](../../packages/experimental/agent-team/src/types.ts) 中的字面持久形式。
5
+ 实验性隐式 Root Team 领域、模型工具与宿主适配器共享的类型。[Agent Teams Agent Note](../../.agents/notes/implemented/feature/2026-08-05-agent-teams.zh.md)负责身份、mailbox、task 与共享 checkout 决策;本页记录 [`packages/experimental/agent-team/src/types.ts`](../../packages/experimental/agent-team/src/types.ts) 中的字面持久形式。
6
6
 
7
7
  ## 身份与 roster
8
8
 
9
- `TeamId` 是具有独立[品牌](core.md#branded-ids)的 Root `SessionId`。`TeamTaskId` 在 Team 内按 `task-<n>` 单调分配;`TeamMessageId` 是全局随机值。teammate 的 Session id 始终是持久身份,而 `name` 是不可变的模型/UI 标签。
9
+ `TeamId` 是具有独立[品牌](core.zh.md#branded-ids)的 Root `SessionId`。`TeamTaskId` 在 Team 内按 `task-<n>` 单调分配;`TeamMessageId` 是全局随机值。teammate 的 Session id 始终是持久身份,而 `name` 是不可变的模型/UI 标签。
10
10
 
11
11
  ```ts type-equiv
12
12
  /** Whole durable value written on every teammate lifecycle change. */
@@ -74,7 +74,7 @@ interface TeamTaskSnapshot {
74
74
 
75
75
  ## 回放
76
76
 
77
- `foldTeam()` 把一个 Root Session 回放成每个 Team 操作所读取的 roster、任务板与 queued-minus-delivered mailbox。它按 `TeamId` 选取记录,因此普通 fork 继承的 event 保留 ancestor id,绝不会进入新 Root 的状态。Session event 的 `seq` 与 `time` 继续负责顺序和时间记录,Team snapshot 不再重复保存它们。roster 与 task 读取以 view 形式到达调用方,附带 owner name、readiness 与 write-scope 警告,而 pending 邮件仅供投递与恢复内部使用。包 [README](../../packages/experimental/agent-team/README.md)负责 operation、authorization、recovery 和限制行为。
77
+ `foldTeam()` 把一个 Root Session 回放成每个 Team 操作所读取的 roster、任务板与 queued-minus-delivered mailbox。它按 `TeamId` 选取记录,因此普通 fork 继承的 event 保留 ancestor id,绝不会进入新 Root 的状态。Session event 的 `seq` 与 `time` 继续负责顺序和时间记录,Team snapshot 不再重复保存它们。roster 与 task 读取以 view 形式到达调用方,附带 owner name、readiness 与 write-scope 警告,而 pending 邮件仅供投递与恢复内部使用。包 [README](../../packages/experimental/agent-team/README.zh.md)负责 operation、authorization、recovery 和限制行为。
78
78
 
79
79
  <!-- BEGIN GENERATED cordis-surface (gen-cordis-catalog.ts) — do not edit between markers -->
80
80
 
@@ -82,7 +82,7 @@ interface TeamTaskSnapshot {
82
82
 
83
83
  ## Cordis API
84
84
 
85
- Generated from source by `scripts/gen-cordis-catalog.ts` (verified fresh by `pnpm run verify-cordis-catalog` in doc-sync; regenerate with `pnpm run gen-cordis-catalog`) — this section is byte-identical in both language sides of the page. Signature blocks use a `ts cordis-catalog` fence and keep the original source JSDoc; dispatch modes are defined in the [primer](../cordis-primer.md#dispatch-modes), and the framework-inherited `ctx` API lives in [cordis-api/inherited.md](../cordis-api/inherited.md).
85
+ Generated from source by `scripts/gen-cordis-catalog.ts` (verified fresh by `pnpm run verify-cordis-catalog` in doc-sync; regenerate with `pnpm run gen-cordis-catalog`) — the language sides differ only in locale-specific paired document paths. Signature blocks use a `ts cordis-catalog` fence and keep the original source JSDoc; dispatch modes are defined in the [primer](../cordis-primer.zh.md#dispatch-modes), and the framework-inherited `ctx` API lives in [cordis-api/inherited.md](../cordis-api/inherited.md).
86
86
 
87
87
  <a id="ctxagentteams--teamservice"></a>
88
88
 
@@ -177,7 +177,7 @@ interrupt(caller: Agent, targetName: string): { previousStatus: 'running' | 'idl
177
177
  tryMembership(agent: Agent): TeamMembership | undefined
178
178
  ```
179
179
 
180
- Types: [Agent](core.md)
180
+ Types: [Agent](core.zh.md)
181
181
 
182
- Source: [`packages/experimental/agent-team/src/index.ts:56`](../../packages/experimental/agent-team/src/index.ts)
182
+ Source: [`packages/experimental/agent-team/src/index.ts`](../../packages/experimental/agent-team/src/index.ts)
183
183
  <!-- END GENERATED cordis-surface -->
@@ -18,7 +18,7 @@ type ImageMediaType = 'image/png' | 'image/jpeg' | 'image/webp' | 'image/gif'
18
18
  ```
19
19
 
20
20
  ```ts type-equiv
21
- /** Durable, serializable metadata for one immutable image object. */
21
+ /** Durable, serializable reference to one immutable normalized image. */
22
22
  interface ImageAttachmentRef {
23
23
  /** Opaque storage identifier; never a filesystem path or bearer URL. */
24
24
  attachmentId: AttachmentId
@@ -32,6 +32,14 @@ interface ImageAttachmentRef {
32
32
  height: number
33
33
  /** Optional display name stripped of local path information. */
34
34
  name?: string
35
+ /**
36
+ * Input dimensions after applying EXIF orientation and before normalization
37
+ * scaling. Present only when normalization reduced the image.
38
+ */
39
+ originalDimensions?: {
40
+ width: number
41
+ height: number
42
+ }
35
43
  }
36
44
  ```
37
45
 
@@ -48,6 +56,8 @@ interface ImageAttachmentLimits {
48
56
  }
49
57
  ```
50
58
 
59
+ The local backend admits at most 20 images and 200 MiB of encoded source data per message. One source may use up to 20 MiB, 64,000,000 pixels, and 8192 pixels on either side. These source limits precede the independent normalization stage, which limits the long edge to 2048 pixels and encoded data to 4 MiB by default.
60
+
51
61
  The reference records intrinsic dimensions and encoded length so clients can lay out history without decoding first, while every authoritative read still re-checks digest, media signature, dimensions, and metadata against the object.
52
62
 
53
63
  ## Commit and verified-read payloads
@@ -83,7 +93,39 @@ interface StoredImageAttachment {
83
93
  }
84
94
  ```
85
95
 
86
- `saveImage()` validates bytes and atomically commits one object before returning its reference. `validateImage()` runs the same admission checks without persisting anything; batch callers validate every member through it before saving any member, so validation rejection leaves no partial objects behind. `admitEncodedImages()` is the wire entry for base64 uploads: it enforces canonical base64, then delegates batch admission to `saveImages()`, which owns the count and aggregate-byte limits and the validate-all-before-save order. `readImage()` accepts a reference from an authorized session path and returns bytes only after integrity verification. The service is deliberately retention-neutral: resumed and forked sessions may share objects, so reference-aware garbage collection is deferred rather than tied to any one session's deletion.
96
+ ```ts type-equiv
97
+ /** Deterministic request-image policy selected by one exact model route. */
98
+ interface ImageRequestPolicy {
99
+ /** Maximum width multiplied by height after aspect-preserving projection. */
100
+ maxPixels: number
101
+ /** Encoded-byte cap before base64 expansion or Files API upload. */
102
+ maxBytes: number
103
+ }
104
+ ```
105
+
106
+ ```ts type-equiv
107
+ /** Cached request version derived from one provider-independent normalized attachment. */
108
+ interface RequestImageAttachment {
109
+ /** Cache and upload-index key over the attachment id, policy, and fixed encoder parameters. */
110
+ variantId: ImageVariantId
111
+ /** Durable normalized attachment from which this request version was derived. */
112
+ attachment: ImageAttachmentRef
113
+ /** Encoded request bytes. */
114
+ data: Uint8Array
115
+ mediaType: ImageMediaType
116
+ bytes: number
117
+ width: number
118
+ height: number
119
+ /** Provider-compatible sample depth proven after request encoding. */
120
+ depth: 'uchar'
121
+ /** Provider-compatible color space proven after request encoding. */
122
+ space: 'srgb'
123
+ /** Whether the encoded request version retains an alpha channel. */
124
+ hasAlpha: boolean
125
+ }
126
+ ```
127
+
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. `admitEncodedImages()` is the wire entry for base64 uploads and delegates count, aggregate-byte, and ordered batch admission to `saveImages()`. `readImage()` verifies a normalized attachment from an authorized session path. `readImageRequest()` derives and caches one request version under an exact route pixel and byte budget; 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.
87
129
 
88
130
  <!-- BEGIN GENERATED cordis-surface (gen-cordis-catalog.ts) — do not edit between markers -->
89
131
 
@@ -91,7 +133,7 @@ interface StoredImageAttachment {
91
133
 
92
134
  ## Cordis API
93
135
 
94
- Generated from source by `scripts/gen-cordis-catalog.ts` (verified fresh by `pnpm run verify-cordis-catalog` in doc-sync; regenerate with `pnpm run gen-cordis-catalog`) — this section is byte-identical in both language sides of the page. Signature blocks use a `ts cordis-catalog` fence and keep the original source JSDoc; dispatch modes are defined in the [primer](../cordis-primer.md#dispatch-modes), and the framework-inherited `ctx` API lives in [cordis-api/inherited.md](../cordis-api/inherited.md).
136
+ Generated from source by `scripts/gen-cordis-catalog.ts` (verified fresh by `pnpm run verify-cordis-catalog` in doc-sync; regenerate with `pnpm run gen-cordis-catalog`) — the language sides differ only in locale-specific paired document paths. Signature blocks use a `ts cordis-catalog` fence and keep the original source JSDoc; dispatch modes are defined in the [primer](../cordis-primer.md#dispatch-modes), and the framework-inherited `ctx` API lives in [cordis-api/inherited.md](../cordis-api/inherited.md).
95
137
 
96
138
  <a id="ctxattachments--attachmentstore-abstract-seam"></a>
97
139
 
@@ -109,19 +151,19 @@ Immutable binary attachment service. Implementations validate bytes before publi
109
151
  abstract validateImage(input: SaveImageAttachment): Promise<void>
110
152
 
111
153
  /**
112
- * Validate one ordered image batch before committing any member.
113
- * Validation failures start no writes; storage failures return no partial
114
- * references, although already published content-addressed objects may stay
115
- * unreachable until a future retention policy collects them.
116
- * @param inputs - encoded images in their owning message order.
117
- * @returns durable references in the exact input order.
154
+ * Validate and durably commit one ordered image batch.
155
+ * @param inputs - encoded images in owning-message order.
156
+ * @returns durable normalized attachment references in the same order after every member succeeds.
118
157
  */
119
158
  async saveImages(inputs: readonly SaveImageAttachment[]): Promise<readonly ImageAttachmentRef[]>
120
159
 
121
160
  /**
122
161
  * Validate and durably commit one image before its owning session event is appended.
162
+ * The returned reference describes the persisted normalized image. When
163
+ * normalization reduces the raster, its `originalDimensions` records the
164
+ * orientation-applied input dimensions.
123
165
  * @param input - encoded bytes, declared media type, and optional display name.
124
- * @returns a durable content-addressed reference.
166
+ * @returns the durable content-addressed normalized image reference.
125
167
  */
126
168
  abstract saveImage(input: SaveImageAttachment): Promise<ImageAttachmentRef>
127
169
 
@@ -129,11 +171,20 @@ abstract saveImage(input: SaveImageAttachment): Promise<ImageAttachmentRef>
129
171
  * Read one image and verify that bytes still match the recorded reference.
130
172
  * @param ref - durable reference from the session log.
131
173
  * @param signal - optional cancellation for backend read and verification work.
132
- * @returns the verified bytes and canonical reference.
174
+ * @returns the verified bytes and normalized attachment reference.
133
175
  * @throws the signal reason when aborted, or a storage error when verification fails.
134
176
  */
135
177
  abstract readImage(ref: ImageAttachmentRef, signal?: AbortSignal): Promise<StoredImageAttachment>
178
+
179
+ /**
180
+ * Generate or read one deterministic model-request version from the stored normalized image.
181
+ * @param ref - durable provider-independent normalized attachment reference.
182
+ * @param policy - exact route pixel and encoded-byte budget.
183
+ * @param signal - optional cancellation.
184
+ * @returns request bytes and the cache/upload identity covering every transform input.
185
+ */
186
+ readImageRequest( ref: ImageAttachmentRef, policy: ImageRequestPolicy, signal?: AbortSignal, ): Promise<RequestImageAttachment>
136
187
  ```
137
188
 
138
- Source: [`packages/attachment/attachment/src/index.ts:33`](../../packages/attachment/attachment/src/index.ts)
189
+ Source: [`packages/attachment/attachment/src/index.ts`](../../packages/attachment/attachment/src/index.ts)
139
190
  <!-- END GENERATED cordis-surface -->
@@ -18,7 +18,7 @@ type ImageMediaType = 'image/png' | 'image/jpeg' | 'image/webp' | 'image/gif'
18
18
  ```
19
19
 
20
20
  ```ts type-equiv
21
- /** Durable, serializable metadata for one immutable image object. */
21
+ /** Durable, serializable reference to one immutable normalized image. */
22
22
  interface ImageAttachmentRef {
23
23
  /** Opaque storage identifier; never a filesystem path or bearer URL. */
24
24
  attachmentId: AttachmentId
@@ -32,6 +32,14 @@ interface ImageAttachmentRef {
32
32
  height: number
33
33
  /** Optional display name stripped of local path information. */
34
34
  name?: string
35
+ /**
36
+ * Input dimensions after applying EXIF orientation and before normalization
37
+ * scaling. Present only when normalization reduced the image.
38
+ */
39
+ originalDimensions?: {
40
+ width: number
41
+ height: number
42
+ }
35
43
  }
36
44
  ```
37
45
 
@@ -48,6 +56,8 @@ interface ImageAttachmentLimits {
48
56
  }
49
57
  ```
50
58
 
59
+ 本地后端每条消息最多准入 20 张图片,源图编码数据总量不超过 200 MiB。单张源图不得超过 20 MiB、64,000,000 像素和单边 8192 像素。这些源文件限制先于独立的规范化阶段执行;该阶段默认把长边限制为 2048 像素,把编码数据限制为 4 MiB。
60
+
51
61
  引用记录固有尺寸和编码长度,使客户端无需先解码即可排布历史记录;每次权威读取仍会根据对象重新校验摘要、媒体签名、尺寸和元数据。
52
62
 
53
63
  ## 提交与经校验读取的数据
@@ -83,7 +93,39 @@ interface StoredImageAttachment {
83
93
  }
84
94
  ```
85
95
 
86
- `saveImage()` 校验字节并以原子方式提交一个对象,之后才返回其引用。`validateImage()` 执行相同的准入检查,但不持久化任何内容;批量调用方会在保存任何成员前通过它校验所有成员,因此校验拒绝不会留下部分对象。`admitEncodedImages()` 是面向 base64 上传的 wire 入口:强制执行规范 base64,随后把批量准入委托给 `saveImages()`,由后者负责张数与聚合字节上限以及先全量校验再保存的顺序。`readImage()` 接受来自已授权会话路径的引用,只在完整性校验通过后返回字节。该服务刻意不规定保留策略:恢复和 fork 后的会话可能共享对象,因此基于引用的垃圾回收会延期实现,而不是与任何一个会话的删除绑定。
96
+ ```ts type-equiv
97
+ /** Deterministic request-image policy selected by one exact model route. */
98
+ interface ImageRequestPolicy {
99
+ /** Maximum width multiplied by height after aspect-preserving projection. */
100
+ maxPixels: number
101
+ /** Encoded-byte cap before base64 expansion or Files API upload. */
102
+ maxBytes: number
103
+ }
104
+ ```
105
+
106
+ ```ts type-equiv
107
+ /** Cached request version derived from one provider-independent normalized attachment. */
108
+ interface RequestImageAttachment {
109
+ /** Cache and upload-index key over the attachment id, policy, and fixed encoder parameters. */
110
+ variantId: ImageVariantId
111
+ /** Durable normalized attachment from which this request version was derived. */
112
+ attachment: ImageAttachmentRef
113
+ /** Encoded request bytes. */
114
+ data: Uint8Array
115
+ mediaType: ImageMediaType
116
+ bytes: number
117
+ width: number
118
+ height: number
119
+ /** Provider-compatible sample depth proven after request encoding. */
120
+ depth: 'uchar'
121
+ /** Provider-compatible color space proven after request encoding. */
122
+ space: 'srgb'
123
+ /** Whether the encoded request version retains an alpha channel. */
124
+ hasAlpha: boolean
125
+ }
126
+ ```
127
+
128
+ `saveImage()` 准备并原子提交提供方无关的规范化附件,然后直接返回 `ImageAttachmentRef`。`saveImages()` 在发布批次前为每个成员各准备一次经过验证的附件,因此校验拒绝不会留下部分对象,发布也不会重复解码或选择质量。`admitEncodedImages()` 是面向 base64 上传的 wire 入口,把张数、聚合字节和有序批量准入交给 `saveImages()`。`readImage()` 校验来自已授权会话路径的规范化附件。`readImageRequest()` 按确切路由的像素和字节预算派生并缓存请求版本;新条目在发布前完整解码,缓存命中只做有界元数据探测。调用方需要有序批次时,对单数方法使用 `Promise.all`。本地实现按需编码首选候选、合并相同请求身份的并发任务、允许每个等待方单独取消、没有等待方时停止共享任务,并通过实例级限流器限制全部变换,默认同时执行两项。该服务不规定保留策略:恢复和 fork 后的会话可能共享对象,因此基于引用的垃圾回收会延期实现,不与单个会话的删除绑定。
87
129
 
88
130
  <!-- BEGIN GENERATED cordis-surface (gen-cordis-catalog.ts) — do not edit between markers -->
89
131
 
@@ -91,7 +133,7 @@ interface StoredImageAttachment {
91
133
 
92
134
  ## Cordis API
93
135
 
94
- Generated from source by `scripts/gen-cordis-catalog.ts` (verified fresh by `pnpm run verify-cordis-catalog` in doc-sync; regenerate with `pnpm run gen-cordis-catalog`) — this section is byte-identical in both language sides of the page. Signature blocks use a `ts cordis-catalog` fence and keep the original source JSDoc; dispatch modes are defined in the [primer](../cordis-primer.md#dispatch-modes), and the framework-inherited `ctx` API lives in [cordis-api/inherited.md](../cordis-api/inherited.md).
136
+ Generated from source by `scripts/gen-cordis-catalog.ts` (verified fresh by `pnpm run verify-cordis-catalog` in doc-sync; regenerate with `pnpm run gen-cordis-catalog`) — the language sides differ only in locale-specific paired document paths. Signature blocks use a `ts cordis-catalog` fence and keep the original source JSDoc; dispatch modes are defined in the [primer](../cordis-primer.zh.md#dispatch-modes), and the framework-inherited `ctx` API lives in [cordis-api/inherited.md](../cordis-api/inherited.md).
95
137
 
96
138
  <a id="ctxattachments--attachmentstore-abstract-seam"></a>
97
139
 
@@ -109,19 +151,19 @@ Immutable binary attachment service. Implementations validate bytes before publi
109
151
  abstract validateImage(input: SaveImageAttachment): Promise<void>
110
152
 
111
153
  /**
112
- * Validate one ordered image batch before committing any member.
113
- * Validation failures start no writes; storage failures return no partial
114
- * references, although already published content-addressed objects may stay
115
- * unreachable until a future retention policy collects them.
116
- * @param inputs - encoded images in their owning message order.
117
- * @returns durable references in the exact input order.
154
+ * Validate and durably commit one ordered image batch.
155
+ * @param inputs - encoded images in owning-message order.
156
+ * @returns durable normalized attachment references in the same order after every member succeeds.
118
157
  */
119
158
  async saveImages(inputs: readonly SaveImageAttachment[]): Promise<readonly ImageAttachmentRef[]>
120
159
 
121
160
  /**
122
161
  * Validate and durably commit one image before its owning session event is appended.
162
+ * The returned reference describes the persisted normalized image. When
163
+ * normalization reduces the raster, its `originalDimensions` records the
164
+ * orientation-applied input dimensions.
123
165
  * @param input - encoded bytes, declared media type, and optional display name.
124
- * @returns a durable content-addressed reference.
166
+ * @returns the durable content-addressed normalized image reference.
125
167
  */
126
168
  abstract saveImage(input: SaveImageAttachment): Promise<ImageAttachmentRef>
127
169
 
@@ -129,11 +171,20 @@ abstract saveImage(input: SaveImageAttachment): Promise<ImageAttachmentRef>
129
171
  * Read one image and verify that bytes still match the recorded reference.
130
172
  * @param ref - durable reference from the session log.
131
173
  * @param signal - optional cancellation for backend read and verification work.
132
- * @returns the verified bytes and canonical reference.
174
+ * @returns the verified bytes and normalized attachment reference.
133
175
  * @throws the signal reason when aborted, or a storage error when verification fails.
134
176
  */
135
177
  abstract readImage(ref: ImageAttachmentRef, signal?: AbortSignal): Promise<StoredImageAttachment>
178
+
179
+ /**
180
+ * Generate or read one deterministic model-request version from the stored normalized image.
181
+ * @param ref - durable provider-independent normalized attachment reference.
182
+ * @param policy - exact route pixel and encoded-byte budget.
183
+ * @param signal - optional cancellation.
184
+ * @returns request bytes and the cache/upload identity covering every transform input.
185
+ */
186
+ readImageRequest( ref: ImageAttachmentRef, policy: ImageRequestPolicy, signal?: AbortSignal, ): Promise<RequestImageAttachment>
136
187
  ```
137
188
 
138
- Source: [`packages/attachment/attachment/src/index.ts:33`](../../packages/attachment/attachment/src/index.ts)
189
+ Source: [`packages/attachment/attachment/src/index.ts`](../../packages/attachment/attachment/src/index.ts)
139
190
  <!-- END GENERATED cordis-surface -->