@avantf/dsh-mem 0.1.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 (65) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +140 -0
  3. package/lib/client.js +5901 -0
  4. package/lib/client.js.map +1 -0
  5. package/lib/dsh-build.json +7 -0
  6. package/lib/index.js +14329 -0
  7. package/lib/types/client/domains.d.ts +52 -0
  8. package/lib/types/client/domains.d.ts.map +1 -0
  9. package/lib/types/client/domains.js +25 -0
  10. package/lib/types/client/domains.js.map +1 -0
  11. package/lib/types/client/index.d.ts +35 -0
  12. package/lib/types/client/index.d.ts.map +1 -0
  13. package/lib/types/client/index.js +1351 -0
  14. package/lib/types/client/index.js.map +1 -0
  15. package/lib/types/client/ingest.d.ts +24 -0
  16. package/lib/types/client/ingest.d.ts.map +1 -0
  17. package/lib/types/client/ingest.js +30 -0
  18. package/lib/types/client/ingest.js.map +1 -0
  19. package/lib/types/client/paging.d.ts +30 -0
  20. package/lib/types/client/paging.d.ts.map +1 -0
  21. package/lib/types/client/paging.js +36 -0
  22. package/lib/types/client/paging.js.map +1 -0
  23. package/lib/types/client/summarize.d.ts +11 -0
  24. package/lib/types/client/summarize.d.ts.map +1 -0
  25. package/lib/types/client/summarize.js +79 -0
  26. package/lib/types/client/summarize.js.map +1 -0
  27. package/lib/types/envinit-bootstrap.d.ts +43 -0
  28. package/lib/types/envinit-bootstrap.js +323 -0
  29. package/lib/types/envinit.d.ts +145 -0
  30. package/lib/types/envinit.d.ts.map +1 -0
  31. package/lib/types/envinit.js +495 -0
  32. package/lib/types/envinit.js.map +1 -0
  33. package/lib/types/hints.d.ts +42 -0
  34. package/lib/types/hints.d.ts.map +1 -0
  35. package/lib/types/hints.js +54 -0
  36. package/lib/types/hints.js.map +1 -0
  37. package/lib/types/index.d.ts +74 -0
  38. package/lib/types/index.d.ts.map +1 -0
  39. package/lib/types/index.js +708 -0
  40. package/lib/types/index.js.map +1 -0
  41. package/lib/types/inject.d.ts +14 -0
  42. package/lib/types/inject.d.ts.map +1 -0
  43. package/lib/types/inject.js +14 -0
  44. package/lib/types/inject.js.map +1 -0
  45. package/lib/types/open.d.ts +27 -0
  46. package/lib/types/open.d.ts.map +1 -0
  47. package/lib/types/open.js +133 -0
  48. package/lib/types/open.js.map +1 -0
  49. package/lib/types/prompt.d.ts +49 -0
  50. package/lib/types/prompt.d.ts.map +1 -0
  51. package/lib/types/prompt.js +65 -0
  52. package/lib/types/prompt.js.map +1 -0
  53. package/lib/types/provision.d.ts +117 -0
  54. package/lib/types/provision.d.ts.map +1 -0
  55. package/lib/types/provision.js +233 -0
  56. package/lib/types/provision.js.map +1 -0
  57. package/lib/types/remote.d.ts +17 -0
  58. package/lib/types/remote.d.ts.map +1 -0
  59. package/lib/types/remote.js +233 -0
  60. package/lib/types/remote.js.map +1 -0
  61. package/lib/types/tool_schema.d.ts +40 -0
  62. package/lib/types/tool_schema.d.ts.map +1 -0
  63. package/lib/types/tool_schema.js +149 -0
  64. package/lib/types/tool_schema.js.map +1 -0
  65. package/package.json +109 -0
@@ -0,0 +1,74 @@
1
+ /**
2
+ * @avantf/dsh-mem — DSH native Cordis host plugin (standard plugin form).
3
+ *
4
+ * Built inside the DSH harness workspace (its `@deepseek-ai/dsh-tools` /
5
+ * `@deepseek-ai/dsh-typert-protocol` deps resolve there). It does NOT use the
6
+ * dynamic-package `harness` builtin — model tools register via
7
+ * `ctx.tools.register(defineTool(...))` and the client↔host bridge is a
8
+ * `TypertRemoteService`, so a normal DSH profile plugin can run it.
9
+ *
10
+ * Tool inputs are declared explicitly for the model: the contract's zod unions
11
+ * are flattened into DSH ParameterSchemaSpec with per-field `description`,
12
+ * array `items`, enums and integer types, and every call is re-validated with
13
+ * the contract schema before dispatch so a bad call returns a structured error
14
+ * instead of a raw runtime exception.
15
+ */
16
+ import type { Context } from '@deepseek-ai/cordis';
17
+ import z from '@deepseek-ai/schemastery';
18
+ import { TypertRemoteService } from '@deepseek-ai/dsh-typert-protocol';
19
+ import { type AvantfRuntime } from '@avantf/mem';
20
+ import { type RemoteEnvelope } from '@avantf/mem-contract';
21
+ export declare const name = "avantf-mem";
22
+ export { inject } from './inject.js';
23
+ export { KNOWLEDGE_PROMPT_SECTION, MEMORY_PROMPT_SECTION } from './prompt.js';
24
+ export interface Config {
25
+ mode?: 'cordis' | 'mcp';
26
+ dataHome?: string;
27
+ }
28
+ export declare const Config: z<Config>;
29
+ type WireArgs = Record<string, unknown>;
30
+ /**
31
+ * Pass-through gateway mirroring the five agent tools. Every payload is
32
+ * re-validated with the contract zod union before dispatch (same guarantee the
33
+ * tools give the model), and results are wrapped in the contract's
34
+ * `{ok:true,value}` / `{ok:false,error,violations}` RemoteEnvelope the client decodes.
35
+ */
36
+ export declare class AvantfMemGateway extends TypertRemoteService {
37
+ private readonly rt;
38
+ constructor(ctx: Context, rt: AvantfRuntime);
39
+ private call;
40
+ remember(args: WireArgs): Promise<RemoteEnvelope<unknown>>;
41
+ recall(args: WireArgs): Promise<RemoteEnvelope<unknown>>;
42
+ admin(args: WireArgs): Promise<RemoteEnvelope<unknown>>;
43
+ kb(args: WireArgs): Promise<RemoteEnvelope<unknown>>;
44
+ query(args: WireArgs): Promise<RemoteEnvelope<unknown>>;
45
+ /**
46
+ * UI-only: what IS this string? Answered against the ingestion boundary, so the UI can label the
47
+ * input and pick the right `kb_manage` action (URL → fetch, file → ingest, directory → import,
48
+ * text → ingest the string itself, missing → refuse and say why).
49
+ */
50
+ classifySource(args: WireArgs): Promise<RemoteEnvelope<unknown>>;
51
+ /** UI-only: one directory listing for the 选择 picker (same boundary as ingestion). */
52
+ browseDir(args: WireArgs): Promise<RemoteEnvelope<unknown>>;
53
+ /**
54
+ * UI-only: the 知识页 domain picker's options — the configured `knowledge.domains` allowlist
55
+ * together with the domains the library already holds — plus whether the allowlist is active
56
+ * (non-empty). The host is the only side that knows either half.
57
+ */
58
+ kbDomains(_args: WireArgs): Promise<RemoteEnvelope<unknown>>;
59
+ /**
60
+ * UI-only: add one 知识域 to the store config's `domains` allowlist AND to the live set, so the
61
+ * 知识 tab's 「+」 works without a restart. No agent tool mirrors this on purpose — the model must
62
+ * stay bounded by the configured list, while the user can widen it.
63
+ */
64
+ kbAddDomain(args: WireArgs): Promise<RemoteEnvelope<unknown>>;
65
+ /**
66
+ * UI-only: hand one managed document file — or the directory that holds it — to the user's
67
+ * editor. No agent tool mirrors this, so it carries its own envelope instead of going through
68
+ * `dispatchToolKey`; the path is resolved from `doc_id` here, so nothing the client sends is
69
+ * trusted.
70
+ */
71
+ openDoc(args: WireArgs): Promise<RemoteEnvelope<unknown>>;
72
+ }
73
+ export declare function apply(ctx: Context, config: Config): Promise<void>;
74
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AACH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAA;AAOlD,OAAO,CAAC,MAAM,0BAA0B,CAAA;AAExC,OAAO,EAAE,mBAAmB,EAAU,MAAM,kCAAkC,CAAA;AAE9E,OAAO,EAOL,KAAK,aAAa,EAEnB,MAAM,aAAa,CAAA;AACpB,OAAO,EAcL,KAAK,cAAc,EAIpB,MAAM,sBAAsB,CAAA;AAiB7B,eAAO,MAAM,IAAI,eAAe,CAAA;AAChC,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAA;AAGpC,OAAO,EAAE,wBAAwB,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAA;AAE7E,MAAM,WAAW,MAAM;IACrB,IAAI,CAAC,EAAE,QAAQ,GAAG,KAAK,CAAA;IACvB,QAAQ,CAAC,EAAE,MAAM,CAAA;CAClB;AACD,eAAO,MAAM,MAAM,EAAE,CAAC,CAAC,MAAM,CAO3B,CAAA;AAkDF,KAAK,QAAQ,GAAG,MAAM,CAAC,MAAM,EAAE,OAA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