@graphorin/core 0.5.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 (134) hide show
  1. package/CHANGELOG.md +27 -0
  2. package/LICENSE +21 -0
  3. package/README.md +70 -0
  4. package/dist/channels/channels.d.ts +156 -0
  5. package/dist/channels/channels.d.ts.map +1 -0
  6. package/dist/channels/channels.js +90 -0
  7. package/dist/channels/channels.js.map +1 -0
  8. package/dist/channels/directive.d.ts +34 -0
  9. package/dist/channels/directive.d.ts.map +1 -0
  10. package/dist/channels/directive.js +29 -0
  11. package/dist/channels/directive.js.map +1 -0
  12. package/dist/channels/dispatch.d.ts +26 -0
  13. package/dist/channels/dispatch.d.ts.map +1 -0
  14. package/dist/channels/dispatch.js +32 -0
  15. package/dist/channels/dispatch.js.map +1 -0
  16. package/dist/channels/index.d.ts +5 -0
  17. package/dist/channels/index.js +6 -0
  18. package/dist/channels/pause.d.ts +84 -0
  19. package/dist/channels/pause.d.ts.map +1 -0
  20. package/dist/channels/pause.js +90 -0
  21. package/dist/channels/pause.js.map +1 -0
  22. package/dist/contracts/auth-token-store.d.ts +45 -0
  23. package/dist/contracts/auth-token-store.d.ts.map +1 -0
  24. package/dist/contracts/checkpoint-store.d.ts +90 -0
  25. package/dist/contracts/checkpoint-store.d.ts.map +1 -0
  26. package/dist/contracts/embedder.d.ts +45 -0
  27. package/dist/contracts/embedder.d.ts.map +1 -0
  28. package/dist/contracts/eval-scorer.d.ts +46 -0
  29. package/dist/contracts/eval-scorer.d.ts.map +1 -0
  30. package/dist/contracts/index.d.ts +22 -0
  31. package/dist/contracts/index.js +6 -0
  32. package/dist/contracts/local-provider-trust.d.ts +36 -0
  33. package/dist/contracts/local-provider-trust.d.ts.map +1 -0
  34. package/dist/contracts/logger.d.ts +53 -0
  35. package/dist/contracts/logger.d.ts.map +1 -0
  36. package/dist/contracts/logger.js +21 -0
  37. package/dist/contracts/logger.js.map +1 -0
  38. package/dist/contracts/memory-store.d.ts +106 -0
  39. package/dist/contracts/memory-store.d.ts.map +1 -0
  40. package/dist/contracts/oauth-server-store.d.ts +81 -0
  41. package/dist/contracts/oauth-server-store.d.ts.map +1 -0
  42. package/dist/contracts/preferred-model.d.ts +60 -0
  43. package/dist/contracts/preferred-model.d.ts.map +1 -0
  44. package/dist/contracts/preferred-model.js +15 -0
  45. package/dist/contracts/preferred-model.js.map +1 -0
  46. package/dist/contracts/provider.d.ts +272 -0
  47. package/dist/contracts/provider.d.ts.map +1 -0
  48. package/dist/contracts/reasoning-retention.d.ts +53 -0
  49. package/dist/contracts/reasoning-retention.d.ts.map +1 -0
  50. package/dist/contracts/redaction-validator.d.ts +59 -0
  51. package/dist/contracts/redaction-validator.d.ts.map +1 -0
  52. package/dist/contracts/sandbox.d.ts +73 -0
  53. package/dist/contracts/sandbox.d.ts.map +1 -0
  54. package/dist/contracts/secret-ref.d.ts +26 -0
  55. package/dist/contracts/secret-ref.d.ts.map +1 -0
  56. package/dist/contracts/secret-value.d.ts +112 -0
  57. package/dist/contracts/secret-value.d.ts.map +1 -0
  58. package/dist/contracts/secret-value.js +24 -0
  59. package/dist/contracts/secret-value.js.map +1 -0
  60. package/dist/contracts/secrets-store.d.ts +87 -0
  61. package/dist/contracts/secrets-store.d.ts.map +1 -0
  62. package/dist/contracts/session-store.d.ts +142 -0
  63. package/dist/contracts/session-store.d.ts.map +1 -0
  64. package/dist/contracts/token-counter.d.ts +28 -0
  65. package/dist/contracts/token-counter.d.ts.map +1 -0
  66. package/dist/contracts/tool.d.ts +264 -0
  67. package/dist/contracts/tool.d.ts.map +1 -0
  68. package/dist/contracts/tracer.d.ts +84 -0
  69. package/dist/contracts/tracer.d.ts.map +1 -0
  70. package/dist/contracts/tracer.js +34 -0
  71. package/dist/contracts/tracer.js.map +1 -0
  72. package/dist/contracts/trigger-store.d.ts +43 -0
  73. package/dist/contracts/trigger-store.d.ts.map +1 -0
  74. package/dist/index.d.ts +59 -0
  75. package/dist/index.d.ts.map +1 -0
  76. package/dist/index.js +38 -0
  77. package/dist/index.js.map +1 -0
  78. package/dist/types/agent-event.d.ts +449 -0
  79. package/dist/types/agent-event.d.ts.map +1 -0
  80. package/dist/types/handoff.d.ts +112 -0
  81. package/dist/types/handoff.d.ts.map +1 -0
  82. package/dist/types/index.d.ts +13 -0
  83. package/dist/types/index.js +6 -0
  84. package/dist/types/memory.d.ts +354 -0
  85. package/dist/types/memory.d.ts.map +1 -0
  86. package/dist/types/message.d.ts +162 -0
  87. package/dist/types/message.d.ts.map +1 -0
  88. package/dist/types/run.d.ts +155 -0
  89. package/dist/types/run.d.ts.map +1 -0
  90. package/dist/types/run.js +31 -0
  91. package/dist/types/run.js.map +1 -0
  92. package/dist/types/sensitivity.d.ts +35 -0
  93. package/dist/types/sensitivity.d.ts.map +1 -0
  94. package/dist/types/sensitivity.js +29 -0
  95. package/dist/types/sensitivity.js.map +1 -0
  96. package/dist/types/session-scope.d.ts +22 -0
  97. package/dist/types/session-scope.d.ts.map +1 -0
  98. package/dist/types/stop-condition.d.ts +62 -0
  99. package/dist/types/stop-condition.d.ts.map +1 -0
  100. package/dist/types/stop-condition.js +81 -0
  101. package/dist/types/stop-condition.js.map +1 -0
  102. package/dist/types/tool-call.d.ts +27 -0
  103. package/dist/types/tool-call.d.ts.map +1 -0
  104. package/dist/types/tool.d.ts +260 -0
  105. package/dist/types/tool.d.ts.map +1 -0
  106. package/dist/types/usage.d.ts +82 -0
  107. package/dist/types/usage.d.ts.map +1 -0
  108. package/dist/types/usage.js +17 -0
  109. package/dist/types/usage.js.map +1 -0
  110. package/dist/types/workflow-event.d.ts +108 -0
  111. package/dist/types/workflow-event.d.ts.map +1 -0
  112. package/dist/utils/assert-never.d.ts +26 -0
  113. package/dist/utils/assert-never.d.ts.map +1 -0
  114. package/dist/utils/assert-never.js +29 -0
  115. package/dist/utils/assert-never.js.map +1 -0
  116. package/dist/utils/async-context.d.ts +37 -0
  117. package/dist/utils/async-context.d.ts.map +1 -0
  118. package/dist/utils/async-context.js +33 -0
  119. package/dist/utils/async-context.js.map +1 -0
  120. package/dist/utils/hash.d.ts +30 -0
  121. package/dist/utils/hash.d.ts.map +1 -0
  122. package/dist/utils/hash.js +102 -0
  123. package/dist/utils/hash.js.map +1 -0
  124. package/dist/utils/index.d.ts +6 -0
  125. package/dist/utils/index.js +7 -0
  126. package/dist/utils/streams.d.ts +59 -0
  127. package/dist/utils/streams.d.ts.map +1 -0
  128. package/dist/utils/streams.js +169 -0
  129. package/dist/utils/streams.js.map +1 -0
  130. package/dist/utils/validation.d.ts +67 -0
  131. package/dist/utils/validation.d.ts.map +1 -0
  132. package/dist/utils/validation.js +36 -0
  133. package/dist/utils/validation.js.map +1 -0
  134. package/package.json +82 -0
@@ -0,0 +1,90 @@
1
+ import { AsyncLocalStorage } from "node:async_hooks";
2
+
3
+ //#region src/channels/pause.ts
4
+ /**
5
+ * Brand attached to the signal thrown by `pause(value)` so that the
6
+ * workflow runtime can recognise it across realms (Worker threads,
7
+ * sandboxes, …) without `instanceof`.
8
+ *
9
+ * @stable
10
+ */
11
+ const PAUSE_SIGNAL_BRAND = Symbol.for("graphorin.PauseSignal");
12
+ /**
13
+ * Thrown by `pause(value)` from inside a workflow node. The runtime
14
+ * catches it, persists state with a pending pause, and suspends the
15
+ * thread until `Workflow.resume(threadId, directive)` is called.
16
+ *
17
+ * Application code should never construct or catch this directly —
18
+ * always go through `pause(...)`.
19
+ *
20
+ * @stable
21
+ */
22
+ var PauseSignal = class extends Error {
23
+ [PAUSE_SIGNAL_BRAND] = true;
24
+ value;
25
+ constructor(value) {
26
+ super("graphorin: workflow paused");
27
+ this.name = "PauseSignal";
28
+ this.value = value;
29
+ }
30
+ };
31
+ const pauseResumeStorage = new AsyncLocalStorage();
32
+ /**
33
+ * Run `fn` inside a scope where successive `pause(...)` calls return the
34
+ * supplied `values` in order instead of throwing a fresh
35
+ * {@link PauseSignal} (WF-2: a node body re-executes from the top on
36
+ * every resume, so earlier pauses must replay their already-delivered
37
+ * values and only the FIRST unsatisfied `pause()` suspends again). An
38
+ * empty `values` array behaves exactly like no scope — every `pause()`
39
+ * suspends — which is what a static-gate resume needs so a programmatic
40
+ * `pause()` inside the node is never silently satisfied.
41
+ *
42
+ * This helper is the contract between the runtime and `pause(...)`.
43
+ * Consumers of `pause(...)` never call it directly — only the workflow
44
+ * engine wires it up around the resumed node body.
45
+ *
46
+ * @internal
47
+ */
48
+ function runWithPauseResume(values, fn) {
49
+ const scope = {
50
+ values,
51
+ cursor: 0
52
+ };
53
+ return pauseResumeStorage.run(scope, async () => fn());
54
+ }
55
+ /**
56
+ * Programmatically suspend the current workflow node. The `value` is
57
+ * surfaced to callers via the `WorkflowSuspendedEvent.value` field; the
58
+ * eventual `Directive({ resume })` is delivered as the return value of
59
+ * this call once the runtime resumes the thread.
60
+ *
61
+ * Implementation note: when the call is made outside a runtime-managed
62
+ * resume scope, `pause(...)` throws a fresh {@link PauseSignal} so the
63
+ * engine can catch it, persist state, and suspend. When the runtime
64
+ * later resumes the node body, it wraps the second invocation in
65
+ * {@link runWithPauseResume}, which causes the same `pause(...)` call to
66
+ * return the operator-supplied resume value instead of throwing.
67
+ *
68
+ * @stable
69
+ */
70
+ function pause(value) {
71
+ const scope = pauseResumeStorage.getStore();
72
+ if (scope !== void 0 && scope.cursor < scope.values.length) {
73
+ const next = scope.values[scope.cursor];
74
+ scope.cursor += 1;
75
+ return next;
76
+ }
77
+ throw new PauseSignal(value);
78
+ }
79
+ /**
80
+ * Cross-realm safe type guard for `PauseSignal`.
81
+ *
82
+ * @stable
83
+ */
84
+ function isPauseSignal(err) {
85
+ return typeof err === "object" && err !== null && err[PAUSE_SIGNAL_BRAND] === true;
86
+ }
87
+
88
+ //#endregion
89
+ export { PAUSE_SIGNAL_BRAND, PauseSignal, isPauseSignal, pause, runWithPauseResume };
90
+ //# sourceMappingURL=pause.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pause.js","names":["PAUSE_SIGNAL_BRAND: unique symbol","scope: PauseResumeScope"],"sources":["../../src/channels/pause.ts"],"sourcesContent":["import { AsyncLocalStorage } from 'node:async_hooks';\n\n/**\n * Brand attached to the signal thrown by `pause(value)` so that the\n * workflow runtime can recognise it across realms (Worker threads,\n * sandboxes, …) without `instanceof`.\n *\n * @stable\n */\nexport const PAUSE_SIGNAL_BRAND: unique symbol = Symbol.for('graphorin.PauseSignal');\n\n/**\n * Thrown by `pause(value)` from inside a workflow node. The runtime\n * catches it, persists state with a pending pause, and suspends the\n * thread until `Workflow.resume(threadId, directive)` is called.\n *\n * Application code should never construct or catch this directly —\n * always go through `pause(...)`.\n *\n * @stable\n */\nexport class PauseSignal<TValue = unknown> extends Error {\n readonly [PAUSE_SIGNAL_BRAND]: true = true;\n readonly value: TValue;\n\n constructor(value: TValue) {\n super('graphorin: workflow paused');\n this.name = 'PauseSignal';\n this.value = value;\n }\n}\n\n/**\n * Resume-injection scope set by the workflow runtime around the second\n * (and later) invocations of a paused node body. When the scope is\n * present, `pause(...)` consults it to decide whether to throw a fresh\n * {@link PauseSignal} or return the injected value the runtime supplied\n * via `Workflow.resume(threadId, new Directive({ resume }))`.\n *\n * This is the storage mechanism that gives `pause()` its symmetric\n * pair semantics (`pause` ↔ `resume`) without forcing every node body\n * to be re-architected as a state machine.\n *\n * @internal\n */\nexport interface PauseResumeScope {\n /** Ordered resume values replayed to successive `pause()` calls (WF-2). */\n readonly values: ReadonlyArray<unknown>;\n cursor: number;\n}\n\nconst pauseResumeStorage = new AsyncLocalStorage<PauseResumeScope>();\n\n/**\n * Run `fn` inside a scope where successive `pause(...)` calls return the\n * supplied `values` in order instead of throwing a fresh\n * {@link PauseSignal} (WF-2: a node body re-executes from the top on\n * every resume, so earlier pauses must replay their already-delivered\n * values and only the FIRST unsatisfied `pause()` suspends again). An\n * empty `values` array behaves exactly like no scope — every `pause()`\n * suspends — which is what a static-gate resume needs so a programmatic\n * `pause()` inside the node is never silently satisfied.\n *\n * This helper is the contract between the runtime and `pause(...)`.\n * Consumers of `pause(...)` never call it directly — only the workflow\n * engine wires it up around the resumed node body.\n *\n * @internal\n */\nexport function runWithPauseResume<R>(\n values: ReadonlyArray<unknown>,\n fn: () => R | Promise<R>,\n): Promise<R> {\n const scope: PauseResumeScope = { values, cursor: 0 };\n return pauseResumeStorage.run(scope, async () => fn());\n}\n\n/**\n * Programmatically suspend the current workflow node. The `value` is\n * surfaced to callers via the `WorkflowSuspendedEvent.value` field; the\n * eventual `Directive({ resume })` is delivered as the return value of\n * this call once the runtime resumes the thread.\n *\n * Implementation note: when the call is made outside a runtime-managed\n * resume scope, `pause(...)` throws a fresh {@link PauseSignal} so the\n * engine can catch it, persist state, and suspend. When the runtime\n * later resumes the node body, it wraps the second invocation in\n * {@link runWithPauseResume}, which causes the same `pause(...)` call to\n * return the operator-supplied resume value instead of throwing.\n *\n * @stable\n */\nexport function pause<TValue, TResume = unknown>(value: TValue): TResume {\n const scope = pauseResumeStorage.getStore();\n if (scope !== undefined && scope.cursor < scope.values.length) {\n const next = scope.values[scope.cursor];\n scope.cursor += 1;\n return next as TResume;\n }\n throw new PauseSignal<TValue>(value);\n}\n\n/**\n * Cross-realm safe type guard for `PauseSignal`.\n *\n * @stable\n */\nexport function isPauseSignal(err: unknown): err is PauseSignal {\n return (\n typeof err === 'object' &&\n err !== null &&\n (err as Record<symbol, unknown>)[PAUSE_SIGNAL_BRAND] === true\n );\n}\n"],"mappings":";;;;;;;;;;AASA,MAAaA,qBAAoC,OAAO,IAAI,wBAAwB;;;;;;;;;;;AAYpF,IAAa,cAAb,cAAmD,MAAM;CACvD,CAAU,sBAA4B;CACtC,AAAS;CAET,YAAY,OAAe;AACzB,QAAM,6BAA6B;AACnC,OAAK,OAAO;AACZ,OAAK,QAAQ;;;AAuBjB,MAAM,qBAAqB,IAAI,mBAAqC;;;;;;;;;;;;;;;;;AAkBpE,SAAgB,mBACd,QACA,IACY;CACZ,MAAMC,QAA0B;EAAE;EAAQ,QAAQ;EAAG;AACrD,QAAO,mBAAmB,IAAI,OAAO,YAAY,IAAI,CAAC;;;;;;;;;;;;;;;;;AAkBxD,SAAgB,MAAiC,OAAwB;CACvE,MAAM,QAAQ,mBAAmB,UAAU;AAC3C,KAAI,UAAU,UAAa,MAAM,SAAS,MAAM,OAAO,QAAQ;EAC7D,MAAM,OAAO,MAAM,OAAO,MAAM;AAChC,QAAM,UAAU;AAChB,SAAO;;AAET,OAAM,IAAI,YAAoB,MAAM;;;;;;;AAQtC,SAAgB,cAAc,KAAkC;AAC9D,QACE,OAAO,QAAQ,YACf,QAAQ,QACP,IAAgC,wBAAwB"}
@@ -0,0 +1,45 @@
1
+ //#region src/contracts/auth-token-store.d.ts
2
+ /**
3
+ * Persisted server auth token record. Holds a per-token HMAC hash + scope
4
+ * grammar; raw tokens are never persisted (the runtime carries them via
5
+ * `SecretValue`).
6
+ *
7
+ * @stable
8
+ */
9
+ interface AuthTokenRecord {
10
+ /** Stable identifier (the public part of the token, before the secret). */
11
+ readonly id: string;
12
+ /** HMAC-SHA256 of the secret part, peppered. Hex-encoded. */
13
+ readonly hashHex: string;
14
+ /** Optional human-readable label rendered in CLI listings. */
15
+ readonly label?: string;
16
+ /** Scope grammar — opaque strings of the form `<resource>:<action>[:<id-or-glob>]`. */
17
+ readonly scopes: ReadonlyArray<string>;
18
+ readonly createdAt: string;
19
+ readonly expiresAt?: string;
20
+ readonly revokedAt?: string;
21
+ readonly lastUsedAt?: string;
22
+ }
23
+ /**
24
+ * Pluggable storage for server auth tokens. The default implementation
25
+ * lives in `@graphorin/store-sqlite` (`auth_tokens` table). The server
26
+ * package implements `verifyToken(...)` on top of this contract.
27
+ *
28
+ * @stable
29
+ */
30
+ interface AuthTokenStore {
31
+ put(record: AuthTokenRecord): Promise<void>;
32
+ get(id: string): Promise<AuthTokenRecord | null>;
33
+ list(): Promise<ReadonlyArray<AuthTokenRecord>>;
34
+ revoke(id: string, revokedAt: string): Promise<void>;
35
+ recordUse(id: string, usedAt: string): Promise<void>;
36
+ /**
37
+ * Indexed lookup by HMAC hash (SPL-19). When present, the verifier
38
+ * uses it on cache-miss instead of walking `list()` — O(1) instead of
39
+ * an O(n) full-table scan per verification.
40
+ */
41
+ getByHash?(hashHex: string): Promise<AuthTokenRecord | null>;
42
+ }
43
+ //#endregion
44
+ export { AuthTokenRecord, AuthTokenStore };
45
+ //# sourceMappingURL=auth-token-store.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"auth-token-store.d.ts","names":[],"sources":["../../src/contracts/auth-token-store.ts"],"sourcesContent":[],"mappings":";;AAOA;AAsBA;;;;;AAGgC,UAzBf,eAAA,CAyBe;EAAd;EAAR,SAAA,EAAA,EAAA,MAAA;EAC+B;EACA,SAAA,OAAA,EAAA,MAAA;EAMF;EAAR,SAAA,KAAA,CAAA,EAAA,MAAA;EAAO;mBAzBnB;;;;;;;;;;;;;UAcF,cAAA;cACH,kBAAkB;mBACb,QAAQ;UACjB,QAAQ,cAAc;yCACS;yCACA;;;;;;+BAMV,QAAQ"}
@@ -0,0 +1,90 @@
1
+ //#region src/contracts/checkpoint-store.d.ts
2
+ /**
3
+ * Opaque identifier for a single workflow checkpoint. Treated as a string
4
+ * by every consumer so adapters can pick whatever encoding they prefer
5
+ * (ULID, UUID, snowflake-like, …).
6
+ *
7
+ * @stable
8
+ */
9
+ type CheckpointId = string;
10
+ /**
11
+ * Serialized snapshot of workflow state, written after every execution
12
+ * step.
13
+ *
14
+ * @stable
15
+ */
16
+ interface Checkpoint {
17
+ readonly id: CheckpointId;
18
+ readonly threadId: string;
19
+ readonly namespace: string;
20
+ readonly parentId?: CheckpointId;
21
+ /** Serialized state blob — adapter-specific encoding (JSON / superjson / …). */
22
+ readonly state: unknown;
23
+ /** Per-channel monotonic versions used by the workflow scheduler. */
24
+ readonly channelVersions: Readonly<Record<string, number>>;
25
+ readonly stepNumber: number;
26
+ readonly createdAt: string;
27
+ }
28
+ /**
29
+ * Metadata associated with a checkpoint write. Adapters store this in a
30
+ * sidecar table for efficient listing.
31
+ *
32
+ * @stable
33
+ */
34
+ interface CheckpointMetadata {
35
+ readonly source: 'sync' | 'async' | 'exit';
36
+ readonly status: 'running' | 'suspended' | 'completed' | 'failed' | 'aborted';
37
+ readonly nodeName?: string;
38
+ readonly tags?: ReadonlyArray<string>;
39
+ }
40
+ /**
41
+ * A checkpoint paired with its sidecar metadata. Returned by
42
+ * `CheckpointStore.getTuple(...)` and the `list(...)` iterator.
43
+ *
44
+ * @stable
45
+ */
46
+ interface CheckpointTuple {
47
+ readonly checkpoint: Checkpoint;
48
+ readonly metadata: CheckpointMetadata;
49
+ readonly pendingWrites?: ReadonlyArray<PendingWrite>;
50
+ }
51
+ /**
52
+ * Per-task pending write. Captured when a task in an execution step
53
+ * succeeds while a sibling task fails: the next resume attempt skips the
54
+ * already-completed work.
55
+ *
56
+ * @stable
57
+ */
58
+ interface PendingWrite {
59
+ readonly taskId: string;
60
+ readonly index: number;
61
+ readonly channel: string;
62
+ /** Serialized value blob — adapter-specific encoding. */
63
+ readonly value: unknown;
64
+ }
65
+ /**
66
+ * Optional listing range for `CheckpointStore.list(...)`.
67
+ *
68
+ * @stable
69
+ */
70
+ interface ListOptions {
71
+ readonly limit?: number;
72
+ readonly before?: CheckpointId;
73
+ readonly status?: CheckpointMetadata['status'];
74
+ }
75
+ /**
76
+ * Pluggable checkpoint storage interface. The default implementation
77
+ * lives in `@graphorin/store-sqlite`.
78
+ *
79
+ * @stable
80
+ */
81
+ interface CheckpointStore {
82
+ put(threadId: string, namespace: string, checkpoint: Checkpoint, metadata: CheckpointMetadata): Promise<CheckpointId>;
83
+ putWrites(threadId: string, namespace: string, checkpointId: CheckpointId, writes: ReadonlyArray<PendingWrite>, taskId: string): Promise<void>;
84
+ getTuple(threadId: string, namespace: string, checkpointId?: CheckpointId): Promise<CheckpointTuple | null>;
85
+ list(threadId: string, namespace: string, opts?: ListOptions): AsyncIterable<CheckpointTuple>;
86
+ deleteThread(threadId: string): Promise<void>;
87
+ }
88
+ //#endregion
89
+ export { Checkpoint, CheckpointId, CheckpointMetadata, CheckpointStore, CheckpointTuple, ListOptions, PendingWrite };
90
+ //# sourceMappingURL=checkpoint-store.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"checkpoint-store.d.ts","names":[],"sources":["../../src/contracts/checkpoint-store.ts"],"sourcesContent":[],"mappings":";;AAOA;AAQA;;;;;AAQoC,KAhBxB,YAAA,GAgBwB,MAAA;AAWpC;AAaA;;;;;AAGwC,UAnCvB,UAAA,CAmCuB;EAUvB,SAAA,EAAA,EA5CF,YA4Cc;EAaZ,SAAA,QAAW,EAAA,MAAA;EAYX,SAAA,SAAe,EAAA,MAAA;EAIhB,SAAA,QAAA,CAAA,EAtEM,YAsEN;EACF;EACD,SAAA,KAAA,EAAA,OAAA;EAAR;EAKa,SAAA,eAAA,EAzEU,QAyEV,CAzEmB,MAyEnB,CAAA,MAAA,EAAA,MAAA,CAAA,CAAA;EACQ,SAAA,UAAA,EAAA,MAAA;EAAd,SAAA,SAAA,EAAA,MAAA;;;;;;;;AAYsB,UA3EjB,kBAAA,CA2EiB;EAAO,SAAA,MAAA,EAAA,MAAA,GAAA,OAAA,GAAA,MAAA;;;kBAvEvB;;;;;;;;UASD,eAAA;uBACM;qBACF;2BACM,cAAc;;;;;;;;;UAUxB,YAAA;;;;;;;;;;;;UAaA,WAAA;;oBAEG;oBACA;;;;;;;;UASH,eAAA;uDAID,sBACF,qBACT,QAAQ;+DAKK,sBACN,cAAc,gCAErB;+DAKc,eACd,QAAQ;mDAEsC,cAAc,cAAc;kCAE7C"}
@@ -0,0 +1,45 @@
1
+ //#region src/contracts/embedder.d.ts
2
+ /**
3
+ * Pluggable embedding provider. Implementations live in the embedder
4
+ * adapter packages (`@graphorin/embedder-transformersjs` (default),
5
+ * `@graphorin/embedder-ollama`, …).
6
+ *
7
+ * Each embedder advertises its model `id`, output `dim`, and a stable
8
+ * `configHash` used by the multi-table per-embedder vec0 layout in the
9
+ * default SQLite store: facts indexed under embedder A and facts indexed
10
+ * under embedder B live in separate vec0 tables; the `configHash` is the
11
+ * lookup key.
12
+ *
13
+ * @stable
14
+ */
15
+ interface EmbedderProvider {
16
+ /** Stable identifier (e.g. `'transformersjs:Xenova/multilingual-e5-base'`). */
17
+ id(): string;
18
+ /** Output dimensionality of the embedding vectors. */
19
+ dim(): number;
20
+ /** Stable hash of the embedder's configuration (model + revision + opts). */
21
+ configHash(): string;
22
+ /** Compute embeddings for a batch of texts. Returns one vector per text. */
23
+ embed(texts: ReadonlyArray<string>, opts?: EmbedOptions): Promise<ReadonlyArray<Float32Array>>;
24
+ }
25
+ /**
26
+ * Per-call options for `EmbedderProvider.embed(...)`.
27
+ *
28
+ * @stable
29
+ */
30
+ interface EmbedOptions {
31
+ readonly signal?: AbortSignal;
32
+ /** Optional per-call request id forwarded to the trace span. */
33
+ readonly requestId?: string;
34
+ /**
35
+ * Asymmetric retrieval role of the input (PS-10). Embedders for models that
36
+ * require asymmetric prefixes — the E5 family's `query:` / `passage:` — apply
37
+ * the matching prefix; embedders for symmetric models ignore it. Memory tiers
38
+ * pass `'query'` when embedding a search query and `'passage'` when embedding
39
+ * content for storage.
40
+ */
41
+ readonly taskType?: 'query' | 'passage';
42
+ }
43
+ //#endregion
44
+ export { EmbedOptions, EmbedderProvider };
45
+ //# sourceMappingURL=embedder.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"embedder.d.ts","names":[],"sources":["../../src/contracts/embedder.ts"],"sourcesContent":[],"mappings":";;AAaA;;;;;;;AAgBA;;;;;UAhBiB,gBAAA;;;;;;;;eAQF,8BAA8B,eAAe,QAAQ,cAAc;;;;;;;UAQjE,YAAA;oBACG"}
@@ -0,0 +1,46 @@
1
+ //#region src/contracts/eval-scorer.d.ts
2
+ /**
3
+ * Pluggable evaluation scorer. Generic over the input / output types
4
+ * carried by the eval dataset. Concrete implementations live in the
5
+ * separate `@graphorin/evals` package (post-MVP); the interface lives
6
+ * here so that:
7
+ *
8
+ * - The minimal inline runner shipped with `@graphorin/observability` can
9
+ * type-check against it.
10
+ * - Custom application-level scorers can be defined without taking an
11
+ * evals dependency.
12
+ *
13
+ * @stable
14
+ */
15
+ interface EvalScorer<TInput = unknown, TOutput = unknown> {
16
+ readonly id: string;
17
+ readonly description?: string;
18
+ score(sample: EvalSample<TInput, TOutput>): Promise<EvalScore>;
19
+ }
20
+ /**
21
+ * A single sample from an eval dataset.
22
+ *
23
+ * @stable
24
+ */
25
+ interface EvalSample<TInput = unknown, TOutput = unknown> {
26
+ readonly id: string;
27
+ readonly input: TInput;
28
+ readonly expected?: TOutput;
29
+ readonly actual: TOutput;
30
+ readonly metadata?: Readonly<Record<string, unknown>>;
31
+ }
32
+ /**
33
+ * Result of `EvalScorer.score(...)`. `value` is normalized to `[0, 1]`
34
+ * by convention; raw scores can be carried in `details`.
35
+ *
36
+ * @stable
37
+ */
38
+ interface EvalScore {
39
+ readonly value: number;
40
+ readonly pass?: boolean;
41
+ readonly rationale?: string;
42
+ readonly details?: Readonly<Record<string, unknown>>;
43
+ }
44
+ //#endregion
45
+ export { EvalSample, EvalScore, EvalScorer };
46
+ //# sourceMappingURL=eval-scorer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"eval-scorer.d.ts","names":[],"sources":["../../src/contracts/eval-scorer.ts"],"sourcesContent":[],"mappings":";;AAaA;;;;;;;AAWA;;;;;AAKsB,UAhBL,UAgBK,CAAA,SAAA,OAAA,EAAA,UAAA,OAAA,CAAA,CAAA;EAAQ,SAAA,EAAA,EAAA,MAAA;EASb,SAAA,WAAS,CAAA,EAAA,MAII;gBA1Bd,WAAW,QAAQ,WAAW,QAAQ;;;;;;;UAQrC;;kBAEC;sBACI;mBACH;sBACG,SAAS;;;;;;;;UASd,SAAA;;;;qBAII,SAAS"}
@@ -0,0 +1,22 @@
1
+ import { AuthTokenRecord, AuthTokenStore } from "./auth-token-store.js";
2
+ import { Checkpoint, CheckpointId, CheckpointMetadata, CheckpointStore, CheckpointTuple, ListOptions, PendingWrite } from "./checkpoint-store.js";
3
+ import { EmbedOptions, EmbedderProvider } from "./embedder.js";
4
+ import { EvalSample, EvalScore, EvalScorer } from "./eval-scorer.js";
5
+ import { LocalProviderTrust, OllamaTrust } from "./local-provider-trust.js";
6
+ import { LogFields, LogLevel, Logger, NOOP_LOGGER } from "./logger.js";
7
+ import { EpisodicMemoryStore, MemoryStore, MessageRef, ProceduralMemoryStore, SemanticMemoryStore, SessionListOptions, SessionMemoryStore, SessionMessageWithMetadata, SharedMemoryStore, WorkingMemoryStore } from "./memory-store.js";
8
+ import { OAuthServerRecord, OAuthServerStore } from "./oauth-server-store.js";
9
+ import { MODEL_HINTS, ModelHint, ModelSpec, ProviderLike } from "./preferred-model.js";
10
+ import { ReasoningContract, ReasoningRetention } from "./reasoning-retention.js";
11
+ import { ComposeProviderMiddleware, FinishReason, OutputSpec, Provider, ProviderCapabilities, ProviderError, ProviderErrorKind, ProviderEvent, ProviderMiddleware, ProviderRequest, ProviderRequestMetadata, ProviderResponse, ResponseMetadata, ToolChoice, ToolDefinition, ToolDefinitionExample } from "./provider.js";
12
+ import { RedactionInput, RedactionOutput, RedactionValidator } from "./redaction-validator.js";
13
+ import { Sandbox, SandboxCode, SandboxResult, SandboxRunOptions } from "./sandbox.js";
14
+ import { SecretRef } from "./secret-ref.js";
15
+ import { NODEJS_INSPECT_CUSTOM, SECRET_VALUE_BRAND, SecretValue, SecretValueOptions, SecretValueStatic } from "./secret-value.js";
16
+ import { SecretMetadata, SecretResolver, SecretResolverContext, SecretsSetOptions, SecretsStore } from "./secrets-store.js";
17
+ import { AgentRegistryEntry, SessionAuditEntry, SessionMetadata, SessionStore, SessionStoreExt, SessionWorkflowRun } from "./session-store.js";
18
+ import { TokenCounter } from "./token-counter.js";
19
+ import { AISpan, NOOP_TRACER, SpanAttributeValue, SpanAttributes, SpanStatus, SpanType, StartSpanOptions, Tracer } from "./tracer.js";
20
+ import { ResolvedTool, Tool, ToolExample, ToolExecutionContext, ToolReturn, ToolSecretsAccessor } from "./tool.js";
21
+ import { TriggerState, TriggerStore } from "./trigger-store.js";
22
+ export { type AISpan, type AgentRegistryEntry, type AuthTokenRecord, type AuthTokenStore, type Checkpoint, type CheckpointId, type CheckpointMetadata, type CheckpointStore, type CheckpointTuple, type ComposeProviderMiddleware, type EmbedOptions, type EmbedderProvider, type EpisodicMemoryStore, type EvalSample, type EvalScore, type EvalScorer, type FinishReason, type ListOptions, type LocalProviderTrust, type LogFields, type LogLevel, type Logger, MODEL_HINTS, type MemoryStore, type MessageRef, type ModelHint, type ModelSpec, NODEJS_INSPECT_CUSTOM, NOOP_LOGGER, NOOP_TRACER, type OAuthServerRecord, type OAuthServerStore, type OllamaTrust, type OutputSpec, type PendingWrite, type ProceduralMemoryStore, type Provider, type ProviderCapabilities, type ProviderError, type ProviderErrorKind, type ProviderEvent, type ProviderLike, type ProviderMiddleware, type ProviderRequest, type ProviderRequestMetadata, type ProviderResponse, type ReasoningContract, type ReasoningRetention, type RedactionInput, type RedactionOutput, type RedactionValidator, type ResolvedTool, type ResponseMetadata, SECRET_VALUE_BRAND, type Sandbox, type SandboxCode, type SandboxResult, type SandboxRunOptions, type SecretMetadata, type SecretRef, type SecretResolver, type SecretResolverContext, type SecretValue, type SecretValueOptions, type SecretValueStatic, type SecretsSetOptions, type SecretsStore, type SemanticMemoryStore, type SessionAuditEntry, type SessionListOptions, type SessionMemoryStore, type SessionMessageWithMetadata, type SessionMetadata, type SessionStore, type SessionStoreExt, type SessionWorkflowRun, type SharedMemoryStore, type SpanAttributeValue, type SpanAttributes, type SpanStatus, type SpanType, type StartSpanOptions, type TokenCounter, type Tool, type ToolChoice, type ToolDefinition, type ToolDefinitionExample, type ToolExample, type ToolExecutionContext, type ToolReturn, type ToolSecretsAccessor, type Tracer, type TriggerState, type TriggerStore, type WorkingMemoryStore };
@@ -0,0 +1,6 @@
1
+ import { NOOP_LOGGER } from "./logger.js";
2
+ import { MODEL_HINTS } from "./preferred-model.js";
3
+ import { NODEJS_INSPECT_CUSTOM, SECRET_VALUE_BRAND } from "./secret-value.js";
4
+ import { NOOP_TRACER } from "./tracer.js";
5
+
6
+ export { MODEL_HINTS, NODEJS_INSPECT_CUSTOM, NOOP_LOGGER, NOOP_TRACER, SECRET_VALUE_BRAND };
@@ -0,0 +1,36 @@
1
+ //#region src/contracts/local-provider-trust.d.ts
2
+ /**
3
+ * Trust class assigned to a local-LLM provider based on the
4
+ * configured `baseUrl`. The classifier dispatcher lives in
5
+ * `@graphorin/provider/trust/classify-local-provider.ts`; the literal
6
+ * union is hoisted here so consumers (security policy, observability,
7
+ * prompt redaction) can type-check against it without depending on
8
+ * `@graphorin/provider`.
9
+ *
10
+ * Tier semantics:
11
+ *
12
+ * - `'loopback'` — `localhost` / `127.0.0.0/8` / `::1` /
13
+ * `unix:///path` (or any in-process adapter that has no `baseUrl`).
14
+ * Same trust boundary as the host process.
15
+ * - `'private'` — RFC 1918 (`10/8`, `172.16/12`,
16
+ * `192.168/16`); RFC 6598 CGNAT (`100.64/10`); link-local
17
+ * (`169.254/16`, `fe80::/10`); `*.local` / `*.lan` / `*.internal` /
18
+ * `*.home.arpa`.
19
+ * - `'public-tls'` — public IP / hostname AND `https://`.
20
+ * - `'public-cleartext'` — public IP / hostname AND `http://`. Adapters
21
+ * refuse to start unless explicitly overridden.
22
+ *
23
+ * @stable
24
+ */
25
+ type LocalProviderTrust = 'loopback' | 'private' | 'public-tls' | 'public-cleartext';
26
+ /**
27
+ * Legacy alias preserved for downstream packages that still import the
28
+ * Ollama-specific name. Removed in v0.2 per the legacy-sugar
29
+ * deprecation policy.
30
+ *
31
+ * @deprecated Use {@link LocalProviderTrust} instead. Removed in v0.2.
32
+ */
33
+ type OllamaTrust = LocalProviderTrust;
34
+ //#endregion
35
+ export { LocalProviderTrust, OllamaTrust };
36
+ //# sourceMappingURL=local-provider-trust.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"local-provider-trust.d.ts","names":[],"sources":["../../src/contracts/local-provider-trust.ts"],"sourcesContent":[],"mappings":";;AAuBA;AASA;;;;;;;;;;;;;;;;;;;;;KATY,kBAAA;;;;;;;;KASA,WAAA,GAAc"}
@@ -0,0 +1,53 @@
1
+ //#region src/contracts/logger.d.ts
2
+ /**
3
+ * Severity levels supported by the project logger. Mirrors the canonical
4
+ * `trace < debug < info < warn < error` hierarchy used by every common
5
+ * structured logger.
6
+ *
7
+ * @stable
8
+ */
9
+ type LogLevel = 'trace' | 'debug' | 'info' | 'warn' | 'error';
10
+ /**
11
+ * Free-form structured fields that accompany a log record. Values must be
12
+ * JSON-serializable; concrete loggers redact `SecretValue` and other
13
+ * sensitive shapes per the framework's redaction policy.
14
+ *
15
+ * @stable
16
+ */
17
+ type LogFields = Readonly<Record<string, unknown>>;
18
+ /**
19
+ * Pluggable logger contract consumed by every `@graphorin/*` runtime
20
+ * package. The concrete implementation lives in `@graphorin/observability`
21
+ * — declaring the interface here keeps level-zero packages free of an
22
+ * observability dependency.
23
+ *
24
+ * Loggers are intentionally **structured** and **side-effect-free** in the
25
+ * type contract: the `info(msg, fields?)` signature is a hint, not a
26
+ * mandate to actually emit anything. Implementations may sample, drop, or
27
+ * batch.
28
+ *
29
+ * @stable
30
+ */
31
+ interface Logger {
32
+ trace(message: string, fields?: LogFields): void;
33
+ debug(message: string, fields?: LogFields): void;
34
+ info(message: string, fields?: LogFields): void;
35
+ warn(message: string, fields?: LogFields): void;
36
+ error(message: string, fields?: LogFields): void;
37
+ /**
38
+ * Return a child logger with `fields` merged into every record's
39
+ * structured payload. Useful for binding `runId` / `sessionId` /
40
+ * `agentId` once at the top of a request.
41
+ */
42
+ child(fields: LogFields): Logger;
43
+ }
44
+ /**
45
+ * Minimal no-op logger. Useful as a typed default when downstream code
46
+ * needs a non-null `Logger` without taking the observability dependency.
47
+ *
48
+ * @stable
49
+ */
50
+ declare const NOOP_LOGGER: Logger;
51
+ //#endregion
52
+ export { LogFields, LogLevel, Logger, NOOP_LOGGER };
53
+ //# sourceMappingURL=logger.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"logger.d.ts","names":[],"sources":["../../src/contracts/logger.ts"],"sourcesContent":[],"mappings":";;AAOA;AASA;AAeA;;;;AAIiC,KA5BrB,QAAA,GA4BqB,OAAA,GAAA,OAAA,GAAA,MAAA,GAAA,MAAA,GAAA,OAAA;;;;;AAgBjC;;;KAnCY,SAAA,GAAY,SAAS;;;;;;;;;;;;;;UAehB,MAAA;kCACiB;kCACA;iCACD;iCACA;kCACC;;;;;;gBAMlB,YAAY;;;;;;;;cASf,aAAa"}
@@ -0,0 +1,21 @@
1
+ //#region src/contracts/logger.ts
2
+ /**
3
+ * Minimal no-op logger. Useful as a typed default when downstream code
4
+ * needs a non-null `Logger` without taking the observability dependency.
5
+ *
6
+ * @stable
7
+ */
8
+ const NOOP_LOGGER = {
9
+ trace() {},
10
+ debug() {},
11
+ info() {},
12
+ warn() {},
13
+ error() {},
14
+ child() {
15
+ return NOOP_LOGGER;
16
+ }
17
+ };
18
+
19
+ //#endregion
20
+ export { NOOP_LOGGER };
21
+ //# sourceMappingURL=logger.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"logger.js","names":["NOOP_LOGGER: Logger"],"sources":["../../src/contracts/logger.ts"],"sourcesContent":["/**\n * Severity levels supported by the project logger. Mirrors the canonical\n * `trace < debug < info < warn < error` hierarchy used by every common\n * structured logger.\n *\n * @stable\n */\nexport type LogLevel = 'trace' | 'debug' | 'info' | 'warn' | 'error';\n\n/**\n * Free-form structured fields that accompany a log record. Values must be\n * JSON-serializable; concrete loggers redact `SecretValue` and other\n * sensitive shapes per the framework's redaction policy.\n *\n * @stable\n */\nexport type LogFields = Readonly<Record<string, unknown>>;\n\n/**\n * Pluggable logger contract consumed by every `@graphorin/*` runtime\n * package. The concrete implementation lives in `@graphorin/observability`\n * — declaring the interface here keeps level-zero packages free of an\n * observability dependency.\n *\n * Loggers are intentionally **structured** and **side-effect-free** in the\n * type contract: the `info(msg, fields?)` signature is a hint, not a\n * mandate to actually emit anything. Implementations may sample, drop, or\n * batch.\n *\n * @stable\n */\nexport interface Logger {\n trace(message: string, fields?: LogFields): void;\n debug(message: string, fields?: LogFields): void;\n info(message: string, fields?: LogFields): void;\n warn(message: string, fields?: LogFields): void;\n error(message: string, fields?: LogFields): void;\n /**\n * Return a child logger with `fields` merged into every record's\n * structured payload. Useful for binding `runId` / `sessionId` /\n * `agentId` once at the top of a request.\n */\n child(fields: LogFields): Logger;\n}\n\n/**\n * Minimal no-op logger. Useful as a typed default when downstream code\n * needs a non-null `Logger` without taking the observability dependency.\n *\n * @stable\n */\nexport const NOOP_LOGGER: Logger = {\n trace(): void {},\n debug(): void {},\n info(): void {},\n warn(): void {},\n error(): void {},\n child(): Logger {\n return NOOP_LOGGER;\n },\n};\n"],"mappings":";;;;;;;AAmDA,MAAaA,cAAsB;CACjC,QAAc;CACd,QAAc;CACd,OAAa;CACb,OAAa;CACb,QAAc;CACd,QAAgB;AACd,SAAO;;CAEV"}
@@ -0,0 +1,106 @@
1
+ import { Block, Episode, Fact, MemoryHit, MemoryRecord, MemorySearchOptions, Rule } from "../types/memory.js";
2
+ import { Message } from "../types/message.js";
3
+ import { SessionScope } from "../types/session-scope.js";
4
+
5
+ //#region src/contracts/memory-store.d.ts
6
+
7
+ /**
8
+ * Persistent storage interface for the six memory tiers. Implementations
9
+ * live in the storage adapter packages (`@graphorin/store-sqlite` is the
10
+ * default).
11
+ *
12
+ * Sub-namespaces map 1:1 to the six tiers so each implementation can
13
+ * pick its own physical layout (one big table, six tables, mixed) while
14
+ * preserving append-only semantics — soft-delete only.
15
+ *
16
+ * @stable
17
+ */
18
+ interface MemoryStore {
19
+ readonly working: WorkingMemoryStore;
20
+ readonly session: SessionMemoryStore;
21
+ readonly episodic: EpisodicMemoryStore;
22
+ readonly semantic: SemanticMemoryStore;
23
+ readonly procedural: ProceduralMemoryStore;
24
+ readonly shared: SharedMemoryStore;
25
+ /** Initialize / migrate the underlying storage. Idempotent. */
26
+ init(): Promise<void>;
27
+ /** Cleanly close any underlying handles. Idempotent. */
28
+ close(): Promise<void>;
29
+ }
30
+ /** @stable */
31
+ interface WorkingMemoryStore {
32
+ list(scope: SessionScope): Promise<ReadonlyArray<Block>>;
33
+ get(scope: SessionScope, label: string): Promise<Block | null>;
34
+ upsert(scope: SessionScope, block: Block): Promise<void>;
35
+ delete(scope: SessionScope, label: string, reason?: string): Promise<void>;
36
+ }
37
+ /**
38
+ * Reference returned by `SessionMemoryStore.push(...)`. Carries the
39
+ * persisted message id and a sequence number for ordering.
40
+ *
41
+ * @stable
42
+ */
43
+ interface MessageRef {
44
+ readonly messageId: string;
45
+ readonly sequence: number;
46
+ readonly persistedAt: string;
47
+ }
48
+ /**
49
+ * A stored message paired with its persisted identity (RP-5). The {@link Message}
50
+ * type itself carries no id / timestamp; these come from the store row, so an
51
+ * exporter can preserve message identity + chronology across a round-trip.
52
+ *
53
+ * @stable
54
+ */
55
+ interface SessionMessageWithMetadata {
56
+ readonly message: Message;
57
+ readonly messageId: string;
58
+ readonly sequence: number;
59
+ readonly createdAt: string;
60
+ }
61
+ /** @stable */
62
+ interface SessionMemoryStore {
63
+ push(scope: SessionScope, message: Message): Promise<MessageRef>;
64
+ list(scope: SessionScope, opts?: SessionListOptions): Promise<ReadonlyArray<Message>>;
65
+ /**
66
+ * List messages with their persisted identity (RP-5). Optional: stores that
67
+ * don't implement it fall back to `list` + fabricated ids on the export path.
68
+ */
69
+ listWithMetadata?(scope: SessionScope, opts?: SessionListOptions): Promise<ReadonlyArray<SessionMessageWithMetadata>>;
70
+ search(scope: SessionScope, query: string, opts?: MemorySearchOptions): Promise<ReadonlyArray<MemoryHit>>;
71
+ }
72
+ /** @stable */
73
+ interface SessionListOptions {
74
+ readonly lastN?: number;
75
+ readonly sinceMessageId?: string;
76
+ readonly agentId?: string;
77
+ readonly role?: 'system' | 'user' | 'assistant' | 'tool';
78
+ }
79
+ /** @stable */
80
+ interface EpisodicMemoryStore {
81
+ put(episode: Episode): Promise<void>;
82
+ search(scope: SessionScope, opts: MemorySearchOptions): Promise<ReadonlyArray<MemoryHit<Episode>>>;
83
+ get(id: string): Promise<Episode | null>;
84
+ }
85
+ /** @stable */
86
+ interface SemanticMemoryStore {
87
+ remember(fact: Fact): Promise<void>;
88
+ search(scope: SessionScope, opts: MemorySearchOptions): Promise<ReadonlyArray<MemoryHit<Fact>>>;
89
+ supersede(oldId: string, newFact: Fact, reason?: string): Promise<void>;
90
+ forget(id: string, reason?: string): Promise<void>;
91
+ }
92
+ /** @stable */
93
+ interface ProceduralMemoryStore {
94
+ add(rule: Rule): Promise<void>;
95
+ list(scope: SessionScope): Promise<ReadonlyArray<Rule>>;
96
+ remove(id: string, reason?: string): Promise<void>;
97
+ }
98
+ /** @stable */
99
+ interface SharedMemoryStore {
100
+ attach(recordId: string, agentId: string): Promise<void>;
101
+ detach(recordId: string, agentId: string): Promise<void>;
102
+ listFor(agentId: string): Promise<ReadonlyArray<MemoryRecord>>;
103
+ }
104
+ //#endregion
105
+ export { EpisodicMemoryStore, MemoryStore, MessageRef, ProceduralMemoryStore, SemanticMemoryStore, SessionListOptions, SessionMemoryStore, SessionMessageWithMetadata, SharedMemoryStore, WorkingMemoryStore };
106
+ //# sourceMappingURL=memory-store.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"memory-store.d.ts","names":[],"sources":["../../src/contracts/memory-store.ts"],"sourcesContent":[],"mappings":"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"}