@avantf/dsh-mem 0.3.1 → 0.4.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.
Files changed (144) hide show
  1. package/README.md +89 -28
  2. package/cordis.patch.yml +17 -0
  3. package/lib/client.js +155 -14
  4. package/lib/engine/mem/config/config_files.d.ts +26 -0
  5. package/lib/engine/mem/config/domains.d.ts +20 -0
  6. package/lib/engine/mem/config/loader.d.ts +35 -0
  7. package/lib/engine/mem/config/paths.d.ts +53 -0
  8. package/lib/engine/mem/db/chunk.d.ts +26 -0
  9. package/lib/engine/mem/db/conn.d.ts +13 -0
  10. package/lib/engine/mem/db/dao/chunks.d.ts +150 -0
  11. package/lib/engine/mem/db/dao/contradictions.d.ts +98 -0
  12. package/lib/engine/mem/db/dao/documents.d.ts +51 -0
  13. package/lib/engine/mem/db/dao/entities.d.ts +67 -0
  14. package/lib/engine/mem/db/dao/facts.d.ts +472 -0
  15. package/lib/engine/mem/db/dao/stats.d.ts +14 -0
  16. package/lib/engine/mem/db/dao/triples.d.ts +80 -0
  17. package/lib/engine/mem/db/hash.d.ts +2 -0
  18. package/lib/engine/mem/db/knowledge.d.ts +17 -0
  19. package/lib/engine/mem/db/migrations.d.ts +71 -0
  20. package/lib/engine/mem/db/port.d.ts +57 -0
  21. package/lib/engine/mem/db/schema.d.ts +26 -0
  22. package/lib/engine/mem/db/sqlite.d.ts +89 -0
  23. package/lib/engine/mem/db/store.d.ts +35 -0
  24. package/lib/engine/mem/db/tokenizer.d.ts +61 -0
  25. package/lib/engine/mem/db/vectors.d.ts +50 -0
  26. package/lib/engine/mem/dispatch.d.ts +51 -0
  27. package/lib/engine/mem/entities/extract.d.ts +84 -0
  28. package/lib/engine/mem/eval/loader.d.ts +19 -0
  29. package/lib/engine/mem/eval/metrics.d.ts +25 -0
  30. package/lib/engine/mem/eval/runner.d.ts +10 -0
  31. package/lib/engine/mem/eval/write_metrics.d.ts +88 -0
  32. package/lib/engine/mem/git.d.ts +73 -0
  33. package/lib/engine/mem/hrr/algebra.d.ts +30 -0
  34. package/lib/engine/mem/hrr/atoms.d.ts +22 -0
  35. package/lib/engine/mem/hrr/encode.d.ts +32 -0
  36. package/lib/engine/mem/hrr/index.d.ts +3 -0
  37. package/lib/engine/mem/index.d.ts +27 -0
  38. package/lib/engine/mem/lifecycle/contradiction.d.ts +156 -0
  39. package/lib/engine/mem/lifecycle/index.d.ts +5 -0
  40. package/lib/engine/mem/lifecycle/maintenance.d.ts +48 -0
  41. package/lib/engine/mem/lifecycle/presence.d.ts +29 -0
  42. package/lib/engine/mem/lifecycle/tick.d.ts +43 -0
  43. package/lib/engine/mem/lifecycle/trust.d.ts +90 -0
  44. package/lib/engine/mem/modelBootstrap.d.ts +207 -0
  45. package/lib/engine/mem/router.d.ts +51 -0
  46. package/lib/engine/mem/runtime.d.ts +232 -0
  47. package/lib/engine/mem/store/common.d.ts +82 -0
  48. package/lib/engine/mem/store/doc_files.d.ts +125 -0
  49. package/lib/engine/mem/store/document_text.d.ts +47 -0
  50. package/lib/engine/mem/store/floors.d.ts +191 -0
  51. package/lib/engine/mem/store/hybrid.d.ts +232 -0
  52. package/lib/engine/mem/store/ingest_guard.d.ts +25 -0
  53. package/lib/engine/mem/store/knowledge.d.ts +483 -0
  54. package/lib/engine/mem/store/lexical.d.ts +67 -0
  55. package/lib/engine/mem/store/memory.d.ts +543 -0
  56. package/lib/engine/mem/store/source_picker.d.ts +43 -0
  57. package/lib/engine/mem-contract/config.d.ts +129 -0
  58. package/lib/engine/mem-contract/env.d.ts +31 -0
  59. package/lib/engine/mem-contract/family.d.ts +25 -0
  60. package/lib/engine/mem-contract/index.d.ts +8 -0
  61. package/lib/engine/mem-contract/log.d.ts +29 -0
  62. package/lib/engine/mem-contract/remote.d.ts +80 -0
  63. package/lib/engine/mem-contract/text.d.ts +92 -0
  64. package/lib/engine/mem-contract/tools.d.ts +284 -0
  65. package/lib/engine/mem-contract/types.d.ts +615 -0
  66. package/lib/engine/mem-retrieval/adapters/auto_vstore.d.ts +47 -0
  67. package/lib/engine/mem-retrieval/adapters/hnswlib.d.ts +174 -0
  68. package/lib/engine/mem-retrieval/adapters/local_bge.d.ts +121 -0
  69. package/lib/engine/mem-retrieval/adapters/local_numpy.d.ts +28 -0
  70. package/lib/engine/mem-retrieval/adapters/local_reranker.d.ts +52 -0
  71. package/lib/engine/mem-retrieval/adapters/none_reranker.d.ts +10 -0
  72. package/lib/engine/mem-retrieval/adapters/warm_gate.d.ts +46 -0
  73. package/lib/engine/mem-retrieval/budget.d.ts +30 -0
  74. package/lib/engine/mem-retrieval/fusion.d.ts +53 -0
  75. package/lib/engine/mem-retrieval/index.d.ts +14 -0
  76. package/lib/engine/mem-retrieval/interfaces.d.ts +82 -0
  77. package/lib/engine/mem-retrieval/log.d.ts +11 -0
  78. package/lib/engine/mem-retrieval/registry.d.ts +23 -0
  79. package/lib/engine/mem-retrieval/rerank.d.ts +13 -0
  80. package/lib/engine/mem-retrieval/stats.d.ts +64 -0
  81. package/lib/engine/mem-retrieval/text_budget.d.ts +52 -0
  82. package/lib/index.js +1773 -473
  83. package/lib/interface-version.json +2 -2
  84. package/lib/types/client/domains.d.ts +5 -4
  85. package/lib/types/client/domains.d.ts.map +1 -1
  86. package/lib/types/client/index.d.ts.map +1 -1
  87. package/lib/types/client/ingest.d.ts +1 -1
  88. package/lib/types/client/wire.d.ts +36 -0
  89. package/lib/types/client/wire.d.ts.map +1 -0
  90. package/lib/types/envinit-bootstrap.d.ts +3 -2
  91. package/lib/types/envinit.d.ts +2 -19
  92. package/lib/types/envinit.d.ts.map +1 -1
  93. package/lib/types/hints.d.ts +1 -1
  94. package/lib/types/index.d.ts +8 -3
  95. package/lib/types/index.d.ts.map +1 -1
  96. package/lib/types/open.d.ts +61 -11
  97. package/lib/types/open.d.ts.map +1 -1
  98. package/lib/types/prompt.d.ts +19 -1
  99. package/lib/types/prompt.d.ts.map +1 -1
  100. package/lib/types/provision.d.ts +1 -1
  101. package/lib/types/provision.d.ts.map +1 -1
  102. package/lib/types/reconcile.d.ts +64 -0
  103. package/lib/types/reconcile.d.ts.map +1 -0
  104. package/lib/types/remote.d.ts +53 -0
  105. package/lib/types/remote.d.ts.map +1 -1
  106. package/lib/types/render.d.ts +35 -0
  107. package/lib/types/render.d.ts.map +1 -0
  108. package/lib/types/tool_schema.d.ts +3 -13
  109. package/lib/types/tool_schema.d.ts.map +1 -1
  110. package/package.json +24 -15
  111. package/lib/client.js.map +0 -1
  112. package/lib/types/client/domains.js +0 -25
  113. package/lib/types/client/domains.js.map +0 -1
  114. package/lib/types/client/index.js +0 -1371
  115. package/lib/types/client/index.js.map +0 -1
  116. package/lib/types/client/ingest.js +0 -30
  117. package/lib/types/client/ingest.js.map +0 -1
  118. package/lib/types/client/paging.js +0 -36
  119. package/lib/types/client/paging.js.map +0 -1
  120. package/lib/types/client/summarize.js +0 -79
  121. package/lib/types/client/summarize.js.map +0 -1
  122. package/lib/types/data_home.js +0 -26
  123. package/lib/types/data_home.js.map +0 -1
  124. package/lib/types/envinit-bootstrap.js +0 -333
  125. package/lib/types/envinit.js +0 -402
  126. package/lib/types/envinit.js.map +0 -1
  127. package/lib/types/hints.js +0 -53
  128. package/lib/types/hints.js.map +0 -1
  129. package/lib/types/index.js +0 -755
  130. package/lib/types/index.js.map +0 -1
  131. package/lib/types/inject.js +0 -14
  132. package/lib/types/inject.js.map +0 -1
  133. package/lib/types/interface_gate.js +0 -84
  134. package/lib/types/interface_gate.js.map +0 -1
  135. package/lib/types/open.js +0 -133
  136. package/lib/types/open.js.map +0 -1
  137. package/lib/types/prompt.js +0 -148
  138. package/lib/types/prompt.js.map +0 -1
  139. package/lib/types/provision.js +0 -177
  140. package/lib/types/provision.js.map +0 -1
  141. package/lib/types/remote.js +0 -247
  142. package/lib/types/remote.js.map +0 -1
  143. package/lib/types/tool_schema.js +0 -149
  144. package/lib/types/tool_schema.js.map +0 -1
@@ -1,247 +0,0 @@
1
- /**
2
- * Hand-written Typert wire faces for the `avantfMem` Remote namespace.
3
- *
4
- * DSH packages normally ship generator-produced faces (`typert.host.js` /
5
- * `typert.remote-client.js`), but the Typert generator runs only inside the
6
- * harness workspace. Both faces are therefore hand-written here, following the
7
- * generator's exact conventions: zod v4 strict codecs, one `args` object
8
- * parameter per method, `<pkg>#<namespace>/<method>` invocation ids, and a host
9
- * contribution registered through `ctx.typert.register()` (the documented
10
- * path for hand-written wire schemas, see `@deepseek-ai/dsh-typert-loader`).
11
- *
12
- * The five methods mirror the five agent tools (remember/recall/admin/kb/query)
13
- * so the 记忆/知识 tabs can do full CRUD + KB management. Args carry the merged
14
- * optional field set of the contract's action unions; the HOST re-validates
15
- * every payload with the contract zod schema before dispatch, so the wire face
16
- * only needs to guarantee JSON shape sanity. Five methods have no tool behind
17
- * them — `openDoc` (the 知识 tab's 「编辑」/「打开目录」 buttons), `classifySource`
18
- * and `browseDir` (its source input and 选择 picker), `kbDomains` (its domain
19
- * dropdown) and `kbAddDomain` (its 「+」 next to that dropdown).
20
- *
21
- * The host half consumes `hostContribution`; the client half mounts
22
- * `clientContribution` via `ctx.remote.$mount()`.
23
- */
24
- import { z } from 'zod';
25
- const PACKAGE = '@avantf/dsh-mem';
26
- const NAMESPACE = 'avantfMem';
27
- const endpointId = (method) => `${PACKAGE}#${NAMESPACE}/${method}`;
28
- const fieldSymbol = (method, field) => `${PACKAGE}#${NAMESPACE}/${method}:${field}`;
29
- const resultSymbol = (method) => fieldSymbol(method, 'result');
30
- /**
31
- * zod v4 strict codec envelope the Typert boundary validates with.
32
- *
33
- * Carries BOTH members on purpose: the host's validator moved from `codec.schema.parse` (0.1.5) to
34
- * `codec.create()` (0.1.6), and each generation checks only its own. One shape therefore serves
35
- * either host.
36
- *
37
- * Kept LOCAL — a two-line mirror of the base kit's `strictCodec`, not a runtime call — on purpose:
38
- * the Remote face is built at module load and must exist even when the base cannot be loaded at all,
39
- * so its construction may not depend on a runtime `import()` of the base. This is the "mirrors a
40
- * convention, so changing it takes a plugin release" side of the rule in the root AGENTS.md; the
41
- * shared, fixable-by-a-base-release code lives in `@avantf/dsh-plugin-base`'s kit.
42
- */
43
- function strict(schema, typeSymbol) {
44
- return { mode: 'strict', typeSymbol, schema, create: () => schema };
45
- }
46
- /** One JSON wire parameter; optional parameters accept a missing wire field. */
47
- function parameter(method, name, schema, acceptsUndefined) {
48
- return {
49
- name,
50
- wire: name,
51
- source: 'json',
52
- codec: strict(schema, fieldSymbol(method, name)),
53
- ...(acceptsUndefined === undefined ? {} : { acceptsUndefined }),
54
- };
55
- }
56
- const text = z.string();
57
- // Optional wire fields are written as `X.optional()`, NOT `z.union([z.undefined(), X])`. The two
58
- // accept the same payloads, but the union is invisible to the HOST's JSON-Schema projector:
59
- // `z.toJSONSchema()` throws "Undefined cannot be represented in JSON Schema" over it, and the
60
- // startup compatibility gate projects the REAL wire face through that host method — so the union
61
- // form made a healthy host read as an incompatible one. `.optional()` projects to a non-required
62
- // property, which is exactly what these fields are.
63
- const count = z.number().int().optional();
64
- const optionalText = z.string().optional();
65
- const bool = z.boolean().optional();
66
- const textArray = z.array(z.string()).optional();
67
- /** One direct Remote method carrying a single `args` object parameter. */
68
- function direct(method, args) {
69
- return {
70
- id: endpointId(method),
71
- service: NAMESPACE,
72
- namespace: NAMESPACE,
73
- method,
74
- invocation: { kind: 'direct' },
75
- parameters: [parameter(method, 'args', args)],
76
- // The runtime's result shapes vary by store backend and evolve fast;
77
- // keep the boundary tolerant (`z.any()` never rejects a host reply).
78
- result: strict(z.any(), resultSymbol(method)),
79
- };
80
- }
81
- export const descriptors = [
82
- // remember: add/update/remove/helpful/unhelpful (action defaults to 'add' host-side)
83
- direct('remember', z.object({
84
- action: optionalText.optional(),
85
- content: optionalText.optional(),
86
- fact_id: count.optional(),
87
- category: optionalText.optional(),
88
- ttl_days: count.optional(),
89
- reason: optionalText.optional(),
90
- })),
91
- // recall: search/ask/chain/probe/reason/related/contradict (defaults to 'search')
92
- direct('recall', z.object({
93
- action: optionalText.optional(),
94
- query: optionalText.optional(),
95
- entity: optionalText.optional(),
96
- entities: textArray.optional(),
97
- subj: optionalText.optional(),
98
- pred: optionalText.optional(),
99
- obj: optionalText.optional(),
100
- second_pred: optionalText.optional(),
101
- category: optionalText.optional(),
102
- limit: count.optional(),
103
- max_tokens: count.optional(),
104
- })),
105
- // admin: stats/list/detail/archive/restore/vectors_*/contradict_*/maintenance (defaults to 'list')
106
- //
107
- // Every field the client sends must be declared here: a strict codec PARSES the args before they
108
- // go out (harness `api/gateway` `parseInput`), and a zod object drops unknown keys — a missing
109
- // field is not an error, it is a silently emptied request that then fails contract validation
110
- // host-side. That is exactly how the three 矛盾裁决 buttons shipped broken: `contradiction_id`,
111
- // `resolution` and `loser_fact_id` were never declared, so only `{action}` reached the host.
112
- // `test/remote_wire.spec.ts` pins the invariant that actually generalises — declared ⊇ the
113
- // contract union's fields — because "declared ⊇ what the client source sends" has blind spots a
114
- // wrapper function (`kbCall(label, args)`) or a conditional spread hides.
115
- direct('admin', z.object({
116
- action: optionalText.optional(),
117
- fact_id: count.optional(),
118
- category: optionalText.optional(),
119
- status: optionalText.optional(),
120
- limit: count.optional(),
121
- offset: count.optional(),
122
- reason: optionalText.optional(),
123
- dry_run: bool.optional(),
124
- contradiction_id: count.optional(),
125
- resolution: optionalText.optional(),
126
- loser_fact_id: count.optional(),
127
- })),
128
- // kb: ingest/import/list/detail/remove/reindex/sync (action REQUIRED — no safe default)
129
- //
130
- // `overwrite` is a field of THIS face only: the UI's 入库 form sends it after the user confirms
131
- // the collision dialog, and the CLI after `--overwrite`. It is deliberately NOT a field of
132
- // `KB_ADD_TOOL.input`, so the add-only mode cannot leak into the model's view.
133
- //
134
- // `adopt` is the 知识 tab's 「认领文件」 button: sync one document whose frontmatter was destroyed
135
- // by a whole-file overwrite, accepting the store's guess about which row it belongs to. It was
136
- // missing from this face, so the button sent `{action:'sync', doc_id}` and reported
137
- // 「认领完成:0 篇」 — the fourth field to ship silently undeclared.
138
- direct('kb', z.object({
139
- action: optionalText.optional(),
140
- text: optionalText.optional(),
141
- source_uri: optionalText.optional(),
142
- domain: optionalText.optional(),
143
- source: optionalText.optional(),
144
- title: optionalText.optional(),
145
- paths: textArray.optional(),
146
- doc_id: count.optional(),
147
- limit: count.optional(),
148
- offset: count.optional(),
149
- dry_run: bool.optional(),
150
- overwrite: bool.optional(),
151
- adopt: bool.optional(),
152
- })),
153
- // query: cross-store retrieval
154
- direct('query', z.object({
155
- query: text,
156
- kind: optionalText.optional(),
157
- domain: optionalText.optional(),
158
- source: optionalText.optional(),
159
- limit: count.optional(),
160
- max_tokens: count.optional(),
161
- })),
162
- // classifySource / browseDir: UI-only. The 知识 tab has ONE source input, so the host has to say
163
- // what a string IS (URL / file / directory / missing / pasted text) and let the user browse for a
164
- // path — a browser can check `^https?://` and nothing else, and only the host may stat a path.
165
- direct('classifySource', z.object({ text: optionalText.optional() })),
166
- direct('browseDir', z.object({ path: optionalText.optional() })),
167
- // kbDomains: UI-only. The 知识 tab's domain control is a picker, and the two halves of its option
168
- // list — the configured `knowledge.domains` allowlist and the domains already in the library —
169
- // live host-side, so the client asks for the union instead of guessing it.
170
- direct('kbDomains', z.object({})),
171
- // kbAddDomain: UI-only (no agent tool mirrors it, deliberately — an autonomous writer is where
172
- // domain sprawl would come from). Appends the name to the store config's `domains` allowlist and
173
- // to the live set, and answers with the new catalog so the picker can select it.
174
- direct('kbAddDomain', z.object({ domain: text })),
175
- // openDoc: UI-only (no agent tool mirrors it) — hand one managed document file, or the
176
- // directory holding it, to the user's editor. The host resolves the path from `doc_id`, so the
177
- // client never supplies a path the host would have to trust.
178
- direct('openDoc', z.object({
179
- doc_id: count,
180
- target: optionalText.optional(),
181
- })),
182
- ];
183
- /** Client face: mounted by the client half through `ctx.remote.$mount()`. */
184
- export const clientContribution = {
185
- package: PACKAGE,
186
- descriptors,
187
- };
188
- /** The zod schema a strict codec carries, whichever generation's codec type is in play. */
189
- function codecSchema(codec) {
190
- // Our own `strict()` always puts `schema` on the value, so this is the local schema even when the
191
- // HOST's `TypertCodec` no longer names that member (0.1.7 removed it from the type; the value a
192
- // plugin builds still carries it, which is exactly what keeps 0.1.5 hosts validating).
193
- return codec.schema;
194
- }
195
- /** Declare one registered wire schema: the factory 0.1.6+ calls, plus the schema 0.1.5 reads. */
196
- function declared(name, schema) {
197
- return { name, schema, create: () => schema };
198
- }
199
- /**
200
- * Host face: registered by the host half through `ctx.typert.register()`.
201
- *
202
- * The schema values are named `z.ZodType` — this package's own zod — not the registry's field type,
203
- * for two reasons. There are two PHYSICALLY different zod copies in play (the workspace catalog's and
204
- * the one inside the installed harness build), so no imported field type can be both correct and
205
- * stable; and the registry's field type is generation-specific (`TypertSchema['schema']` in 0.1.5,
206
- * `TypertSchemaFactory['create']`'s return in 0.1.6+, the name gone in 0.1.7), so naming it is what
207
- * broke this file's compilation on 0.1.7. The two copies are structurally identical, which is why the
208
- * declared entries stay assignable to whichever entry type the installed host declares.
209
- */
210
- export const hostContribution = {
211
- package: PACKAGE,
212
- face: 'host',
213
- schemas: descriptors.flatMap((descriptor) => [
214
- ...descriptor.parameters.map(parameter => declared(`${descriptor.method}${parameter.name}`, codecSchema(parameter.codec))),
215
- declared(`${descriptor.method}Result`, codecSchema(descriptor.result)),
216
- ]),
217
- model: {
218
- services: [
219
- {
220
- key: 'avantfMemory',
221
- exportName: 'avantfMemory',
222
- description: 'avantf-mem runtime facade: memory store, knowledge store, ingestion, lifecycle, cross-retrieval router',
223
- summary: 'avantf-mem engine runtime',
224
- tags: [],
225
- members: [],
226
- types: [],
227
- },
228
- {
229
- key: NAMESPACE,
230
- exportName: NAMESPACE,
231
- description: 'Client Remote namespace: remember / recall / admin / kb / query over the avantf-mem stores',
232
- summary: 'avantf-mem client remote',
233
- tags: [],
234
- members: descriptors.map(descriptor => ({
235
- kind: 'method',
236
- name: descriptor.method,
237
- signature: '(args: object) => Promise<unknown>',
238
- })),
239
- types: [],
240
- },
241
- ],
242
- events: [],
243
- objects: [],
244
- },
245
- invocations: descriptors,
246
- };
247
- //# sourceMappingURL=remote.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"remote.js","sourceRoot":"","sources":["../../src/remote.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAYvB,MAAM,OAAO,GAAG,iBAAiB,CAAA;AACjC,MAAM,SAAS,GAAG,WAAW,CAAA;AAE7B,MAAM,UAAU,GAAG,CAAC,MAAc,EAAU,EAAE,CAAC,GAAG,OAAO,IAAI,SAAS,IAAI,MAAM,EAAE,CAAA;AAClF,MAAM,WAAW,GAAG,CAAC,MAAc,EAAE,KAAa,EAAU,EAAE,CAAC,GAAG,OAAO,IAAI,SAAS,IAAI,MAAM,IAAI,KAAK,EAAE,CAAA;AAC3G,MAAM,YAAY,GAAG,CAAC,MAAc,EAAU,EAAE,CAAC,WAAW,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAA;AAE9E;;;;;;;;;;;;GAYG;AACH,SAAS,MAAM,CAAC,MAAiB,EAAE,UAAkB;IAMnD,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,EAAE,CAAC,MAAM,EAAE,CAAA;AACrE,CAAC;AAED,gFAAgF;AAChF,SAAS,SAAS,CAChB,MAAc,EACd,IAAY,EACZ,MAAiB,EACjB,gBAAuB;IAEvB,OAAO;QACL,IAAI;QACJ,IAAI,EAAE,IAAI;QACV,MAAM,EAAE,MAAM;QACd,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,WAAW,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;QAChD,GAAG,CAAC,gBAAgB,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,gBAAgB,EAAE,CAAC;KAChE,CAAA;AACH,CAAC;AAED,MAAM,IAAI,GAAG,CAAC,CAAC,MAAM,EAAE,CAAA;AACvB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,CAAC,OAAO,CAAC,CAAC,UAAU,EAAoB,EAAE,CAAC;QAC7D,GAAG,UAAU,CAAC,UAAU,CAAC,GAAG,CAAC,SAAS,CAAC,EAAE,CAAC,QAAQ,CAChD,GAAG,UAAU,CAAC,MAAM,GAAG,SAAS,CAAC,IAAI,EAAE,EACvC,WAAW,CAAE,SAAS,CAAC,KAAkD,CAAC,CAC3E,CAAC;QACF,QAAQ,CACN,GAAG,UAAU,CAAC,MAAM,QAAQ,EAC5B,WAAW,CAAE,UAAU,CAAC,MAAmD,CAAC,CAC7E;KACF,CAAC;IACF,KAAK,EAAE;QACL,QAAQ,EAAE;YACR;gBACE,GAAG,EAAE,cAAc;gBACnB,UAAU,EAAE,cAAc;gBAC1B,WAAW,EAAE,wGAAwG;gBACrH,OAAO,EAAE,2BAA2B;gBACpC,IAAI,EAAE,EAAE;gBACR,OAAO,EAAE,EAAE;gBACX,KAAK,EAAE,EAAE;aACV;YACD;gBACE,GAAG,EAAE,SAAS;gBACd,UAAU,EAAE,SAAS;gBACrB,WAAW,EAAE,4FAA4F;gBACzG,OAAO,EAAE,0BAA0B;gBACnC,IAAI,EAAE,EAAE;gBACR,OAAO,EAAE,WAAW,CAAC,GAAG,CAAC,UAAU,CAAC,EAAE,CAAC,CAAC;oBACtC,IAAI,EAAE,QAAQ;oBACd,IAAI,EAAE,UAAU,CAAC,MAAM;oBACvB,SAAS,EAAE,oCAAoC;iBAChD,CAAC,CAAC;gBACH,KAAK,EAAE,EAAE;aACV;SACF;QACD,MAAM,EAAE,EAAE;QACV,OAAO,EAAE,EAAE;KACZ;IACD,WAAW,EAAE,WAAW;CACzB,CAAA"}
@@ -1,149 +0,0 @@
1
- /**
2
- * zod → DSH parameter schema derivation for the agent tools.
3
- *
4
- * Deliberately free of `@deepseek-ai/*` imports: everything it needs — the contract's tool
5
- * specs, hence the zod schemas — comes from `@avantf/mem-contract`, so this module can be read
6
- * and exercised without a harness checkout or an installed `dsh`.
7
- *
8
- * Two things keep this honest across a zod upgrade. First, the field-level mapping goes through
9
- * zod's OWN converter (`z.toJSONSchema`, the same one the contract's MCP derivation uses)
10
- * instead of reading `typeName`/`checks`/`shape` by hand, so there is one mechanism and not two
11
- * hand-rolled ones. Second, only the union/object structure is read off the internals
12
- * (`def.options` / `def.shape` / a literal's `def.values`) — and a wrong internal read degrades
13
- * SILENTLY: every field would flatten to `{type:'string'}` and no type error would appear, which
14
- * is why the derived shape is asserted by the test suite rather than eyeballed.
15
- */
16
- import { z } from 'zod';
17
- import { mergedFieldDescription } from '@avantf/mem-contract';
18
- export function zodDef(schema) {
19
- return schema?.def ?? {};
20
- }
21
- /**
22
- * One field as JSON Schema, or `undefined` when `schema` is not a zod schema at all.
23
- *
24
- * `io: 'input'` matches how these schemas are actually used (arguments coming IN), and
25
- * `unrepresentable: 'any'` turns a future unrepresentable schema into a permissive object
26
- * instead of a throw at import time.
27
- */
28
- function jsonSchemaOf(schema) {
29
- if (typeof schema?.safeParse !== 'function')
30
- return undefined;
31
- try {
32
- return z.toJSONSchema(schema, { io: 'input', unrepresentable: 'any' });
33
- }
34
- catch {
35
- return undefined;
36
- }
37
- }
38
- /** Nearest `description` on a schema (wrappers included — the converter already unwrapped them). */
39
- export function schemaDescription(schema) {
40
- const description = jsonSchemaOf(schema)?.['description'];
41
- return typeof description === 'string' && description.length > 0 ? description : undefined;
42
- }
43
- /** JSON Schema → DSH parameter spec. Recurses on `items`, which is itself JSON Schema. */
44
- function jsonToSpec(js) {
45
- const type = js['type'];
46
- let spec;
47
- if (type === 'integer')
48
- spec = { type: 'integer' };
49
- else if (type === 'number')
50
- spec = { type: 'number' };
51
- else if (type === 'boolean')
52
- spec = { type: 'boolean' };
53
- else if (type === 'array')
54
- spec = { type: 'array', items: jsonToSpec(js['items'] ?? {}) };
55
- else if (type === 'object')
56
- spec = { type: 'object' };
57
- else if (Array.isArray(js['enum']))
58
- spec = { type: 'string', enum: js['enum'].map(String) };
59
- // A string literal arrives as `const`, not `enum`: keep the old shape (`enum: [value]`).
60
- else if (typeof js['const'] === 'string')
61
- spec = { type: 'string', enum: [js['const']] };
62
- else if (typeof js['const'] === 'number')
63
- spec = { type: 'number' };
64
- else if (typeof js['const'] === 'boolean')
65
- spec = { type: 'boolean' };
66
- else
67
- spec = { type: 'string' };
68
- const description = js['description'];
69
- return typeof description === 'string' && description.length > 0 ? { ...spec, description } : spec;
70
- }
71
- export function zodToSpec(schema) {
72
- return jsonToSpec(jsonSchemaOf(schema) ?? {});
73
- }
74
- /** Materialize one zod object branch's fields, or undefined for a non-object. */
75
- export function branchShape(schema) {
76
- return zodDef(schema).shape;
77
- }
78
- /**
79
- * Flatten a tool input schema into DSH's implicit parameter map. A discriminated
80
- * union contributes one required `action` enum plus the merged field set (fields
81
- * stay optional at the schema level because requiredness differs per action; the
82
- * per-action requirement is stated in each field's description and enforced by
83
- * `spec.input` validation before dispatch). A plain object marks its own required
84
- * fields directly.
85
- *
86
- * The merged descriptions come from the contract's {@link mergedFieldDescription}, the SAME
87
- * function `toolInputJsonSchema` uses for the MCP surface. Taking each field's first branch
88
- * verbatim is what made the two model-facing surfaces disagree: `mem_admin`'s `fact_id` said
89
- * "action=detail 时必填" on this surface while the MCP schema said
90
- * "【detail/archive/restore/pin/unpin 必填】" — so a model calling `archive` without it had to
91
- * learn the requirement from a `violations` retry. Both surfaces now read the same merged
92
- * descriptions, which is what keeps them in agreement field for field.
93
- */
94
- export function flattenToolSpec(spec) {
95
- const input = spec.input;
96
- const def = zodDef(input);
97
- const properties = {};
98
- let actions = [];
99
- if (Array.isArray(def.options)) {
100
- // The union's fields are declared one branch at a time, so a field's real action set is the
101
- // union over the branches that require it — collected here, applied below.
102
- const requiredIn = new Map();
103
- for (const branch of def.options) {
104
- const shape = branchShape(branch);
105
- if (shape === undefined)
106
- continue;
107
- const actionSchema = shape['action'];
108
- const literal = actionSchema === undefined ? undefined : zodDef(actionSchema).values?.[0];
109
- const action = typeof literal === 'string' ? literal : undefined;
110
- if (action !== undefined && !actions.includes(action))
111
- actions = [...actions, action];
112
- for (const [key, fieldSchema] of Object.entries(shape)) {
113
- if (key === 'action')
114
- continue;
115
- if (properties[key] === undefined)
116
- properties[key] = zodToSpec(fieldSchema);
117
- if (action === undefined)
118
- continue;
119
- const optional = fieldSchema.isOptional?.() ?? false;
120
- if (!optional)
121
- requiredIn.set(key, [...(requiredIn.get(key) ?? []), action]);
122
- }
123
- }
124
- for (const [key, paramSpec] of Object.entries(properties)) {
125
- const description = mergedFieldDescription(paramSpec.description, requiredIn.get(key) ?? []);
126
- properties[key] = description === undefined ? paramSpec : { ...paramSpec, description };
127
- }
128
- }
129
- else {
130
- const shape = branchShape(input);
131
- if (shape !== undefined) {
132
- for (const [key, fieldSchema] of Object.entries(shape)) {
133
- const paramSpec = zodToSpec(fieldSchema);
134
- const optional = fieldSchema.isOptional?.() ?? false;
135
- properties[key] = optional ? paramSpec : { ...paramSpec, required: true };
136
- }
137
- }
138
- }
139
- if (actions.length > 0) {
140
- properties['action'] = {
141
- type: 'string',
142
- required: true,
143
- enum: actions,
144
- description: `要执行的操作,取值:${actions.join(' | ')}。每个操作需要哪些字段见各字段说明。`,
145
- };
146
- }
147
- return properties;
148
- }
149
- //# sourceMappingURL=tool_schema.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"tool_schema.js","sourceRoot":"","sources":["../../src/tool_schema.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AACH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AACvB,OAAO,EAAE,sBAAsB,EAAiB,MAAM,sBAAsB,CAAA;AAmB5E,MAAM,UAAU,MAAM,CAAC,MAAe;IACpC,OAAQ,MAAuC,EAAE,GAAG,IAAI,EAAE,CAAA;AAC5D,CAAC;AAED;;;;;;GAMG;AACH,SAAS,YAAY,CAAC,MAAe;IACnC,IAAI,OAAQ,MAA8C,EAAE,SAAS,KAAK,UAAU;QAAE,OAAO,SAAS,CAAA;IACtG,IAAI,CAAC;QACH,OAAO,CA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