@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,264 @@
1
+ import { Logger } from "./logger.js";
2
+ import { Sensitivity } from "../types/sensitivity.js";
3
+ import { MessageContent } from "../types/message.js";
4
+ import { ModelHint, ModelSpec } from "./preferred-model.js";
5
+ import { SecretValue } from "./secret-value.js";
6
+ import { Tracer } from "./tracer.js";
7
+ import { ContentChunk, InboundSanitizationPolicy, MemoryGuardTier, SandboxPolicy, SideEffectClass, ToolSource, ToolTrustClass, TruncationStrategy } from "../types/tool.js";
8
+ import { RunContext } from "../types/run.js";
9
+ import { ZodLikeSchema } from "../utils/validation.js";
10
+
11
+ //#region src/contracts/tool.d.ts
12
+
13
+ /**
14
+ * Pluggable function call exposed to an LLM. Concrete `Tool` instances
15
+ * are produced by the `tool({...})` factory in `@graphorin/tools` and
16
+ * by the MCP / Skills loaders. The interface lives in core because every
17
+ * package above the persistence layer (agent runtime, workflow engine,
18
+ * server, sessions, observability, …) carries `Tool[]` references on
19
+ * its public surface.
20
+ *
21
+ * The interface is intentionally minimal — extension fields covered by
22
+ * later phases (per-tool `secretsAllowed` ACL, inbound sanitization
23
+ * policy, result truncation strategy, streaming hint, …) are added
24
+ * **additively** by their owning packages so that v0.1 consumers can
25
+ * type their tool list against `Tool<...>` today without having to
26
+ * worry about future fields.
27
+ *
28
+ * @stable
29
+ */
30
+ interface Tool<TInput = unknown, TOutput = unknown, TDeps = unknown> {
31
+ readonly name: string;
32
+ readonly description: string;
33
+ readonly inputSchema: ZodLikeSchema<TInput>;
34
+ readonly outputSchema?: ZodLikeSchema<TOutput>;
35
+ /**
36
+ * Either a static boolean or a predicate consulted at runtime against
37
+ * the realized input. `true` means the runtime suspends the run with a
38
+ * `tool.approval.requested` event before the tool executes.
39
+ */
40
+ readonly needsApproval?: boolean | ((input: TInput, ctx: ToolExecutionContext<TDeps>) => boolean | Promise<boolean>);
41
+ /**
42
+ * Sandbox isolation level. Defaults are picked by
43
+ * `@graphorin/security`. ADVISORY in the default agent build (AG-18):
44
+ * inline `config.tools` closures cannot be serialised out-of-process,
45
+ * so the resolved policy is surfaced on the `tool.execute` span /
46
+ * audit but the tool runs in-process. Real isolation applies to
47
+ * module-loadable (skill / MCP) tools.
48
+ */
49
+ readonly sandboxPolicy?: SandboxPolicy;
50
+ /** Free-form labels surfaced to operators and to the model. */
51
+ readonly tags?: ReadonlyArray<string>;
52
+ /**
53
+ * Sequential execution mode hints. Tools tagged `'sequential'` are
54
+ * never executed in parallel with each other; the executor serializes
55
+ * them inside the per-step batch.
56
+ *
57
+ * @default `'parallel'`
58
+ */
59
+ readonly executionMode?: 'parallel' | 'sequential';
60
+ /**
61
+ * Per-tool secrets ACL. Tool execution is wrapped in a scope where
62
+ * `ctx.secrets.require(...)` only resolves keys present here.
63
+ * Empty / undefined means the tool may not request any secret.
64
+ */
65
+ readonly secretsAllowed?: ReadonlyArray<string>;
66
+ /**
67
+ * Sensitivity ceiling of the tool's input + output payload. Used by
68
+ * the redaction validator to decide whether the result may flow to a
69
+ * given sink (provider / exporter).
70
+ */
71
+ readonly sensitivity?: Sensitivity;
72
+ /**
73
+ * Memory-modification guard tier (DEC-153). ACTIVE when the agent is
74
+ * created with `memory` wired (SDF-1): the runtime binds a scope-aware
75
+ * region reader over working memory and the executor snapshots/verifies
76
+ * the region around guarded calls. Without `memory` the guard is
77
+ * skipped and the agent emits a one-time WARN.
78
+ */
79
+ readonly memoryGuardTier?: MemoryGuardTier;
80
+ /** Inbound prompt-injection sanitization policy. */
81
+ readonly inboundSanitization?: InboundSanitizationPolicy;
82
+ /**
83
+ * When `true`, an inbound-sanitization hit returns `ToolError({ kind:
84
+ * 'inbound_sanitization_blocked' })` instead of forwarding the
85
+ * (sanitized) result. Intended for regulated deployments.
86
+ *
87
+ * @default `false`
88
+ */
89
+ readonly failClosed?: boolean;
90
+ /**
91
+ * Defer the tool from the per-step catalogue until the model invokes
92
+ * the built-in `tool_search` to look it up. Tools with deferred
93
+ * loading are not advertised to the model on every step, which keeps
94
+ * the input-token cost bounded for installations with dozens of
95
+ * MCP-derived tools.
96
+ *
97
+ * @default `false`
98
+ */
99
+ readonly defer_loading?: boolean;
100
+ /**
101
+ * Maximum number of tokens the assembled tool result may carry into
102
+ * the conversation history. `0` disables the cap (logs a one-time
103
+ * WARN at registration). Counted against text-shaped output and
104
+ * text-shaped `contentParts` entries; non-text parts pass through.
105
+ *
106
+ * @default `16384`
107
+ */
108
+ readonly maxResultTokens?: number;
109
+ /** Truncation strategy applied when `maxResultTokens` is exceeded. */
110
+ readonly truncationStrategy?: TruncationStrategy;
111
+ /**
112
+ * Worked examples shown to the model alongside the tool's
113
+ * description. Bounded `[1, 5]` — overflow emits a one-time WARN at
114
+ * registration. Each example's `input` and `output` is validated
115
+ * against the tool's `inputSchema` / `outputSchema`.
116
+ */
117
+ readonly examples?: ReadonlyArray<ToolExample<TInput, TOutput>>;
118
+ /**
119
+ * Render examples eagerly (every step) regardless of
120
+ * `defer_loading`. When undefined the runtime applies the auto-rule:
121
+ * `defer_loading: true` ⇒ `false`; `defer_loading: false` ⇒ `true`;
122
+ * neither ⇒ `undefined` (the agent runtime decides at assembly time).
123
+ */
124
+ readonly examplesEagerlyRendered?: boolean;
125
+ /**
126
+ * REQUIRED side-effect classification. v0.1 transition mode emits a
127
+ * one-time WARN per tool name on missing classification and applies
128
+ * the conservative deferred default `'side-effecting'`; v0.2 may
129
+ * promote the WARN to a registration error.
130
+ */
131
+ readonly sideEffectClass?: SideEffectClass;
132
+ /**
133
+ * Optional callback returning a deterministic dedup key per
134
+ * `(input, ctx)` tuple. REQUIRED-by-WARN for `'side-effecting'` /
135
+ * `'external-stateful'` tools. The framework does not validate
136
+ * determinism — that is the operator's contract.
137
+ */
138
+ readonly idempotencyKey?: (input: TInput, ctx: ToolExecutionContext<TDeps>) => string | Promise<string>;
139
+ /**
140
+ * Opt-in flag for streaming-tool execution. The `?: true` typing
141
+ * rejects `streamingHint: false` on purpose — absence is the
142
+ * canonical "non-streaming" signal preserving v0.1 behaviour. When
143
+ * `true`, `Tool.execute(...)` may call `ctx.streamContent(...)` /
144
+ * `ctx.reportProgress(...)` and may return `Promise<void>`.
145
+ */
146
+ readonly streamingHint?: true;
147
+ /**
148
+ * Per-tool author-time model hint. Either a cost-tier vocabulary
149
+ * literal (`'fast' | 'balanced' | 'smart'`) OR an explicit
150
+ * `ModelSpec` that always wins over the agent-side tier mapping.
151
+ */
152
+ readonly preferredModel?: ModelHint | ModelSpec;
153
+ /**
154
+ * Execute the tool. Concrete implementations may return either a raw
155
+ * `TOutput` or a `ToolReturn<TOutput>` envelope when extra content
156
+ * parts (images, files, …) need to be appended to the conversation.
157
+ * Streaming-hint tools may also return `void` once the per-chunk
158
+ * buffer has been populated.
159
+ */
160
+ execute(input: TInput, ctx: ToolExecutionContext<TDeps>): Promise<TOutput | ToolReturn<TOutput> | undefined>;
161
+ }
162
+ /**
163
+ * Worked example for a `Tool`. Type-parameterized on the same generics
164
+ * as `Tool`, so a `ToolExample` for `Tool<{ q: string }, { hits: T[] }>`
165
+ * cannot specify an `input` shape that does not match.
166
+ *
167
+ * @stable
168
+ */
169
+ interface ToolExample<TInput = unknown, TOutput = unknown> {
170
+ readonly input: TInput;
171
+ readonly output: TOutput | ToolReturn<TOutput>;
172
+ readonly comment?: string;
173
+ }
174
+ /**
175
+ * Resolved record returned by the `ToolRegistry` getter. Carries every
176
+ * non-public registration-time field downstream layers consume
177
+ * (sanitization, audit, retrieval, side-effect classification,
178
+ * collision resolution, …) so consumers do not have to recompute it.
179
+ *
180
+ * @stable
181
+ */
182
+ interface ResolvedTool<TInput = unknown, TOutput = unknown, TDeps = unknown> extends Tool<TInput, TOutput, TDeps> {
183
+ readonly __trustClass: ToolTrustClass;
184
+ readonly __source: ToolSource;
185
+ readonly __effectiveDeferLoading: boolean;
186
+ readonly __sideEffectClass: SideEffectClass;
187
+ readonly __hasIdempotencyKey: boolean;
188
+ readonly __streamingHint: boolean;
189
+ readonly __exampleCount: number;
190
+ readonly __preferredModel?: ModelHint | ModelSpec;
191
+ }
192
+ /**
193
+ * Optional return envelope: pairs a typed `output` (passed to the model)
194
+ * with extra `contentParts` that are appended verbatim to the
195
+ * conversation (images, files, audio, …).
196
+ *
197
+ * @stable
198
+ */
199
+ interface ToolReturn<TOutput = unknown> {
200
+ readonly output: TOutput;
201
+ readonly contentParts?: ReadonlyArray<MessageContent>;
202
+ }
203
+ /**
204
+ * Per-call execution context handed to `Tool.execute(...)`. Carries the
205
+ * stable `toolCallId`, the parent `RunContext`, an `AbortSignal` tied to
206
+ * the surrounding agent run, structured tracer / logger handles, the
207
+ * streaming progress / content emitters, and a per-call secrets accessor
208
+ * scoped to the tool's `secretsAllowed` ACL.
209
+ *
210
+ * @stable
211
+ */
212
+ interface ToolExecutionContext<TDeps = unknown> {
213
+ readonly toolCallId: string;
214
+ readonly runContext: RunContext<TDeps>;
215
+ readonly signal: AbortSignal;
216
+ readonly tracer: Tracer;
217
+ readonly logger: Logger;
218
+ /**
219
+ * Per-call secrets accessor. The accessor enforces the tool's
220
+ * `secretsAllowed` ACL — calling `require(...)` for a key that is
221
+ * not on the allowlist throws `SecretAccessDeniedError`.
222
+ */
223
+ readonly secrets: ToolSecretsAccessor;
224
+ /**
225
+ * Emit a progress event to subscribers of `agent.stream(...)`. No-op
226
+ * on tools without `streamingHint: true` AND on aborted streams. The
227
+ * counter pair `(current, total?)` is consumer-rendered as a
228
+ * percentage when both fields are present.
229
+ */
230
+ reportProgress(current: number, total?: number, message?: string): void;
231
+ /**
232
+ * Emit one chunk of content. Concatenated into the tool's assembled
233
+ * `output` per the buffer-becomes-output discipline. No-op on tools
234
+ * without `streamingHint: true` AND on aborted streams.
235
+ */
236
+ streamContent(chunk: ContentChunk): void;
237
+ }
238
+ /**
239
+ * Per-call secrets accessor surface. Implemented by the executor; the
240
+ * tool author calls `require(...)` to obtain a `SecretValue` wrapper.
241
+ *
242
+ * The accessor is intentionally narrow — the ACL enforcement happens
243
+ * inside `require(...)`, so the tool author never accidentally
244
+ * unwraps a secret outside the tool's permitted set.
245
+ *
246
+ * @stable
247
+ */
248
+ interface ToolSecretsAccessor {
249
+ /**
250
+ * Resolve a secret by key. Throws `SecretAccessDeniedError` if the
251
+ * key is not in the tool's `secretsAllowed` allowlist; throws
252
+ * `SecretRequiredError` (or returns `null` when `optional: true`)
253
+ * if the key resolves to no value.
254
+ */
255
+ require(key: string, options?: {
256
+ readonly optional?: false;
257
+ }): Promise<SecretValue>;
258
+ require(key: string, options: {
259
+ readonly optional: true;
260
+ }): Promise<SecretValue | null>;
261
+ }
262
+ //#endregion
263
+ export { ResolvedTool, Tool, ToolExample, ToolExecutionContext, ToolReturn, ToolSecretsAccessor };
264
+ //# sourceMappingURL=tool.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tool.d.ts","names":[],"sources":["../../src/contracts/tool.ts"],"sourcesContent":[],"mappings":";;;;;;;;;;;;;;;;AAkCA;;;;;;;;;;;;;AAmD6B,UAnDZ,IAmDY,CAAA,SAAA,OAAA,EAAA,UAAA,OAAA,EAAA,QAAA,OAAA,CAAA,CAAA;EAEI,SAAA,IAAA,EAAA,MAAA;EA6BD,SAAA,WAAA,EAAA,MAAA;EAOgB,SAAA,WAAA,EAtFxB,aAsFwB,CAtFV,MAsFU,CAAA;EAAQ,SAAA,YAAA,CAAA,EArF9B,aAqF8B,CArFhB,OAqFgB,CAAA;EAApB;;;;;EAuB3B,SAAA,aAAA,CAAA,EAAA,OAAA,GAAA,CAAA,CAAA,KAAA,EApGM,MAoGN,EAAA,GAAA,EApGmB,oBAoGnB,CApGwC,KAoGxC,CAAA,EAAA,GAAA,OAAA,GApG6D,OAoG7D,CAAA,OAAA,CAAA,CAAA;EACO;;;;;;;;EAyBO,SAAA,aAAA,CAAA,EArHI,aAqHJ;EAAlB;EAAO,SAAA,IAAA,CAAA,EAnHM,aAmHN,CAAA,MAAA,CAAA;EAUK;;;;;;AAcjB;EACe,SAAA,aAAA,CAAA,EAAA,UAAA,GAAA,YAAA;EAAQ;;;;;EAQO,SAAA,cAAA,CAAA,EAtIF,aAsIE,CAAA,MAAA,CAAA;EAAY;;;AAU1C;;EAEwC,SAAA,WAAA,CAAA,EAlJC,WAkJD;EAAd;;AAY1B;;;;;EAKmB,SAAA,eAAA,CAAA,EArJU,eAqJV;EAMC;EAaG,SAAA,mBAAA,CAAA,EAtKU,yBAsKV;EAAY;AAanC;;;;;;;;;;;;;;;;;;;;;;;;;;;gCAtJgC;;;;;;;sBAOV,cAAc,YAAY,QAAQ;;;;;;;;;;;;;;6BAc3B;;;;;;;oCAQlB,aACF,qBAAqB,oBACd;;;;;;;;;;;;;;4BAcY,YAAY;;;;;;;;iBAS7B,aACF,qBAAqB,SACzB,QAAQ,UAAU,WAAW;;;;;;;;;UAUjB;kBACC;mBACC,UAAU,WAAW;;;;;;;;;;;UAYvB,2EACP,KAAK,QAAQ,SAAS;yBACP;qBACJ;;8BAES;;;;8BAIA,YAAY;;;;;;;;;UAUzB;mBACE;0BACO,cAAc;;;;;;;;;;;UAYvB;;uBAEM,WAAW;mBACf;mBACA;mBACA;;;;;;oBAMC;;;;;;;;;;;;;uBAaG;;;;;;;;;;;;UAaN,mBAAA;;;;;;;;;MAUZ,QAV+B,WAAA;;;MAc/B,QAJO,WAAA"}
@@ -0,0 +1,84 @@
1
+ //#region src/contracts/tracer.d.ts
2
+ /**
3
+ * Discriminator union for typed observability spans.
4
+ *
5
+ * The list mirrors the span taxonomy documented for the observability
6
+ * layer; concrete implementations live in `@graphorin/observability`.
7
+ *
8
+ * @stable
9
+ */
10
+ type SpanType = 'agent.run' | 'agent.step' | 'agent.handoff' | 'agent.suspend' | 'agent.resume' | 'provider.generate' | 'provider.stream' | 'tool.execute' | 'tool.approval' | 'memory.read.working' | 'memory.read.session' | 'memory.read.episodic' | 'memory.read.semantic' | 'memory.read.procedural' | 'memory.read.shared' | 'memory.write.working' | 'memory.write.session' | 'memory.write.episodic' | 'memory.write.semantic' | 'memory.write.procedural' | 'memory.write.shared' | 'memory.search.working' | 'memory.search.session' | 'memory.search.episodic' | 'memory.search.semantic' | 'memory.search.procedural' | 'memory.search.shared' | 'memory.consolidate.light' | 'memory.consolidate.standard' | 'memory.consolidate.deep' | 'memory.consolidate.reflect' | 'memory.search.insight' | 'memory.read.insight' | 'memory.write.insight' | 'memory.conflict' | 'memory.embed' | 'workflow.run' | 'workflow.step' | 'workflow.task' | 'workflow.checkpoint' | 'skill.activate' | 'skill.load' | 'mcp.connect' | 'mcp.call' | 'mcp.list-tools';
11
+ /**
12
+ * Status of a finished span. Mirrors the OTel status convention with
13
+ * `'ok' | 'error'` short forms instead of the verbose tristate.
14
+ *
15
+ * @stable
16
+ */
17
+ type SpanStatus = 'ok' | 'error' | 'cancelled';
18
+ /**
19
+ * Free-form attributes attached to a span.
20
+ *
21
+ * @stable
22
+ */
23
+ type SpanAttributes = Readonly<Record<string, SpanAttributeValue>>;
24
+ /** @stable */
25
+ type SpanAttributeValue = string | number | boolean | null | ReadonlyArray<string> | ReadonlyArray<number> | ReadonlyArray<boolean>;
26
+ /**
27
+ * Typed span. Generic over `SpanType` so consumers can specialize a
28
+ * function on a particular span kind without losing the discriminator.
29
+ *
30
+ * @stable
31
+ */
32
+ interface AISpan<T extends SpanType = SpanType> {
33
+ readonly type: T;
34
+ readonly id: string;
35
+ readonly traceId: string;
36
+ readonly parentId?: string;
37
+ /** Add or replace attributes. Repeated calls are merged (last write wins). */
38
+ setAttributes(attrs: SpanAttributes): void;
39
+ /** Append a span event (attribute-bearing time-stamped marker). */
40
+ addEvent(name: string, attrs?: SpanAttributes): void;
41
+ /** Record an exception. Multiple calls are kept in the span event log. */
42
+ recordException(err: unknown): void;
43
+ /** Set the terminal status. */
44
+ setStatus(status: SpanStatus, message?: string): void;
45
+ /** End the span. Idempotent. */
46
+ end(): void;
47
+ }
48
+ /**
49
+ * Span constructor parameters.
50
+ *
51
+ * @stable
52
+ */
53
+ interface StartSpanOptions<T extends SpanType = SpanType> {
54
+ readonly type: T;
55
+ readonly attrs?: SpanAttributes;
56
+ readonly parent?: AISpan;
57
+ }
58
+ /**
59
+ * Pluggable tracer. Implementations live in `@graphorin/observability`.
60
+ * The interface intentionally mirrors a subset of the OTel API so that
61
+ * adapter code is a thin pass-through.
62
+ *
63
+ * @stable
64
+ */
65
+ interface Tracer {
66
+ startSpan<T extends SpanType>(opts: StartSpanOptions<T>): AISpan<T>;
67
+ /**
68
+ * Convenience wrapper: start a span, run `fn` inside, and call
69
+ * `setStatus('ok' | 'error')` + `end()` based on the outcome.
70
+ */
71
+ span<T extends SpanType, R>(opts: StartSpanOptions<T>, fn: (span: AISpan<T>) => R | Promise<R>): Promise<R>;
72
+ /** Force-flush any pending spans. */
73
+ shutdown(): Promise<void>;
74
+ }
75
+ /**
76
+ * Minimal no-op tracer. Useful as a typed default when downstream code
77
+ * needs a non-null `Tracer` without taking the observability dependency.
78
+ *
79
+ * @stable
80
+ */
81
+ declare const NOOP_TRACER: Tracer;
82
+ //#endregion
83
+ export { AISpan, NOOP_TRACER, SpanAttributeValue, SpanAttributes, SpanStatus, SpanType, StartSpanOptions, Tracer };
84
+ //# sourceMappingURL=tracer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tracer.d.ts","names":[],"sources":["../../src/contracts/tracer.ts"],"sourcesContent":[],"mappings":";;AAQA;AAqDA;AAOA;;;;;AAGY,KA/DA,QAAA,GA+DA,WAAkB,GAAA,YAAA,GAAA,eAAA,GAAA,eAAA,GAAA,cAAA,GAAA,mBAAA,GAAA,iBAAA,GAAA,cAAA,GAAA,eAAA,GAAA,qBAAA,GAAA,qBAAA,GAAA,sBAAA,GAAA,sBAAA,GAAA,wBAAA,GAAA,oBAAA,GAAA,sBAAA,GAAA,sBAAA,GAAA,uBAAA,GAAA,uBAAA,GAAA,yBAAA,GAAA,qBAAA,GAAA,uBAAA,GAAA,uBAAA,GAAA,wBAAA,GAAA,wBAAA,GAAA,0BAAA,GAAA,sBAAA,GAAA,0BAAA,GAAA,6BAAA,GAAA,yBAAA,GAAA,4BAAA,GAAA,uBAAA,GAAA,qBAAA,GAAA,sBAAA,GAAA,iBAAA,GAAA,cAAA,GAAA,cAAA,GAAA,eAAA,GAAA,eAAA,GAAA,qBAAA,GAAA,gBAAA,GAAA,YAAA,GAAA,aAAA,GAAA,UAAA,GAAA,gBAAA;;;;;AAe9B;;AAA6C,KAzBjC,UAAA,GAyBiC,IAAA,GAAA,OAAA,GAAA,WAAA;;;;;;AAsB5B,KAxCL,cAAA,GAAiB,QAwCI,CAxCK,MAwCL,CAAA,MAAA,EAxCoB,kBAwCpB,CAAA,CAAA;;AAAsB,KArC3C,kBAAA,GAqC2C,MAAA,GAAA,MAAA,GAAA,OAAA,GAAA,IAAA,GAhCnD,aAgCmD,CAAA,MAAA,CAAA,GA/BnD,aA+BmD,CAAA,MAAA,CAAA,GA9BnD,aA8BmD,CAAA,OAAA,CAAA;;;;;AAavD;;AACuD,UApCtC,MAoCsC,CAAA,UApCrB,QAoCqB,GApCV,QAoCU,CAAA,CAAA;EAAjB,SAAA,IAAA,EAnCrB,CAmCqB;EAA6B,SAAA,EAAA,EAAA,MAAA;EAAP,SAAA,OAAA,EAAA,MAAA;EAK3C,SAAA,QAAA,CAAA,EAAA,MAAA;EACU;EAAjB,aAAA,CAAA,KAAA,EApCa,cAoCb,CAAA,EAAA,IAAA;EACY;EAAP,QAAA,CAAA,IAAA,EAAA,MAAA,EAAA,KAAA,CAAA,EAnCkB,cAmClB,CAAA,EAAA,IAAA;EAAc;EAAY,eAAA,CAAA,GAAA,EAAA,OAAA,CAAA,EAAA,IAAA;EAAR;EACpB,SAAA,CAAA,MAAA,EAhCO,UAgCP,EAAA,OAAA,CAAA,EAAA,MAAA,CAAA,EAAA,IAAA;EAAR;EAES,GAAA,EAAA,EAAA,IAAA;;AASd;;;;;UAjCiB,2BAA2B,WAAW;iBACtC;mBACE;oBACC;;;;;;;;;UAUH,MAAA;sBACK,gBAAgB,iBAAiB,KAAK,OAAO;;;;;iBAKlD,mBACP,iBAAiB,eACZ,OAAO,OAAO,IAAI,QAAQ,KACpC,QAAQ;;cAEC;;;;;;;;cASD,aAAa"}
@@ -0,0 +1,34 @@
1
+ //#region src/contracts/tracer.ts
2
+ /**
3
+ * Minimal no-op tracer. Useful as a typed default when downstream code
4
+ * needs a non-null `Tracer` without taking the observability dependency.
5
+ *
6
+ * @stable
7
+ */
8
+ const NOOP_TRACER = {
9
+ startSpan(opts) {
10
+ return {
11
+ type: opts.type,
12
+ id: "",
13
+ traceId: "",
14
+ setAttributes() {},
15
+ addEvent() {},
16
+ recordException() {},
17
+ setStatus() {},
18
+ end() {}
19
+ };
20
+ },
21
+ async span(opts, fn) {
22
+ const span = this.startSpan(opts);
23
+ try {
24
+ return await fn(span);
25
+ } finally {
26
+ span.end();
27
+ }
28
+ },
29
+ async shutdown() {}
30
+ };
31
+
32
+ //#endregion
33
+ export { NOOP_TRACER };
34
+ //# sourceMappingURL=tracer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tracer.js","names":["NOOP_TRACER: Tracer"],"sources":["../../src/contracts/tracer.ts"],"sourcesContent":["/**\n * Discriminator union for typed observability spans.\n *\n * The list mirrors the span taxonomy documented for the observability\n * layer; concrete implementations live in `@graphorin/observability`.\n *\n * @stable\n */\nexport type SpanType =\n | 'agent.run'\n | 'agent.step'\n | 'agent.handoff'\n | 'agent.suspend'\n | 'agent.resume'\n | 'provider.generate'\n | 'provider.stream'\n | 'tool.execute'\n | 'tool.approval'\n | 'memory.read.working'\n | 'memory.read.session'\n | 'memory.read.episodic'\n | 'memory.read.semantic'\n | 'memory.read.procedural'\n | 'memory.read.shared'\n | 'memory.write.working'\n | 'memory.write.session'\n | 'memory.write.episodic'\n | 'memory.write.semantic'\n | 'memory.write.procedural'\n | 'memory.write.shared'\n | 'memory.search.working'\n | 'memory.search.session'\n | 'memory.search.episodic'\n | 'memory.search.semantic'\n | 'memory.search.procedural'\n | 'memory.search.shared'\n | 'memory.consolidate.light'\n | 'memory.consolidate.standard'\n | 'memory.consolidate.deep'\n | 'memory.consolidate.reflect'\n | 'memory.search.insight'\n | 'memory.read.insight'\n | 'memory.write.insight'\n | 'memory.conflict'\n | 'memory.embed'\n | 'workflow.run'\n | 'workflow.step'\n | 'workflow.task'\n | 'workflow.checkpoint'\n | 'skill.activate'\n | 'skill.load'\n | 'mcp.connect'\n | 'mcp.call'\n | 'mcp.list-tools';\n\n/**\n * Status of a finished span. Mirrors the OTel status convention with\n * `'ok' | 'error'` short forms instead of the verbose tristate.\n *\n * @stable\n */\nexport type SpanStatus = 'ok' | 'error' | 'cancelled';\n\n/**\n * Free-form attributes attached to a span.\n *\n * @stable\n */\nexport type SpanAttributes = Readonly<Record<string, SpanAttributeValue>>;\n\n/** @stable */\nexport type SpanAttributeValue =\n | string\n | number\n | boolean\n | null\n | ReadonlyArray<string>\n | ReadonlyArray<number>\n | ReadonlyArray<boolean>;\n\n/**\n * Typed span. Generic over `SpanType` so consumers can specialize a\n * function on a particular span kind without losing the discriminator.\n *\n * @stable\n */\nexport interface AISpan<T extends SpanType = SpanType> {\n readonly type: T;\n readonly id: string;\n readonly traceId: string;\n readonly parentId?: string;\n /** Add or replace attributes. Repeated calls are merged (last write wins). */\n setAttributes(attrs: SpanAttributes): void;\n /** Append a span event (attribute-bearing time-stamped marker). */\n addEvent(name: string, attrs?: SpanAttributes): void;\n /** Record an exception. Multiple calls are kept in the span event log. */\n recordException(err: unknown): void;\n /** Set the terminal status. */\n setStatus(status: SpanStatus, message?: string): void;\n /** End the span. Idempotent. */\n end(): void;\n}\n\n/**\n * Span constructor parameters.\n *\n * @stable\n */\nexport interface StartSpanOptions<T extends SpanType = SpanType> {\n readonly type: T;\n readonly attrs?: SpanAttributes;\n readonly parent?: AISpan;\n}\n\n/**\n * Pluggable tracer. Implementations live in `@graphorin/observability`.\n * The interface intentionally mirrors a subset of the OTel API so that\n * adapter code is a thin pass-through.\n *\n * @stable\n */\nexport interface Tracer {\n startSpan<T extends SpanType>(opts: StartSpanOptions<T>): AISpan<T>;\n /**\n * Convenience wrapper: start a span, run `fn` inside, and call\n * `setStatus('ok' | 'error')` + `end()` based on the outcome.\n */\n span<T extends SpanType, R>(\n opts: StartSpanOptions<T>,\n fn: (span: AISpan<T>) => R | Promise<R>,\n ): Promise<R>;\n /** Force-flush any pending spans. */\n shutdown(): Promise<void>;\n}\n\n/**\n * Minimal no-op tracer. Useful as a typed default when downstream code\n * needs a non-null `Tracer` without taking the observability dependency.\n *\n * @stable\n */\nexport const NOOP_TRACER: Tracer = {\n startSpan<T extends SpanType>(opts: StartSpanOptions<T>): AISpan<T> {\n const span: AISpan<T> = {\n type: opts.type,\n id: '',\n traceId: '',\n setAttributes(): void {},\n addEvent(): void {},\n recordException(): void {},\n setStatus(): void {},\n end(): void {},\n };\n return span;\n },\n async span<T extends SpanType, R>(\n opts: StartSpanOptions<T>,\n fn: (span: AISpan<T>) => R | Promise<R>,\n ): Promise<R> {\n const span = this.startSpan(opts);\n try {\n return await fn(span);\n } finally {\n span.end();\n }\n },\n async shutdown(): Promise<void> {},\n};\n"],"mappings":";;;;;;;AA6IA,MAAaA,cAAsB;CACjC,UAA8B,MAAsC;AAWlE,SAVwB;GACtB,MAAM,KAAK;GACX,IAAI;GACJ,SAAS;GACT,gBAAsB;GACtB,WAAiB;GACjB,kBAAwB;GACxB,YAAkB;GAClB,MAAY;GACb;;CAGH,MAAM,KACJ,MACA,IACY;EACZ,MAAM,OAAO,KAAK,UAAU,KAAK;AACjC,MAAI;AACF,UAAO,MAAM,GAAG,KAAK;YACb;AACR,QAAK,KAAK;;;CAGd,MAAM,WAA0B;CACjC"}
@@ -0,0 +1,43 @@
1
+ //#region src/contracts/trigger-store.d.ts
2
+ /**
3
+ * Persisted trigger state row. Lives in the `trigger_state` table per
4
+ * the durable-trigger contract: library and server modes share a single
5
+ * code path.
6
+ *
7
+ * @stable
8
+ */
9
+ interface TriggerState {
10
+ readonly id: string;
11
+ readonly kind: 'cron' | 'interval' | 'idle' | 'event';
12
+ readonly spec: string;
13
+ readonly callbackRef: string;
14
+ /** ISO-8601 of the next scheduled fire. */
15
+ readonly nextFireAt?: string;
16
+ /** ISO-8601 of the most recent fire. */
17
+ readonly lastFiredAt?: string;
18
+ /** Number of consecutive missed fires. */
19
+ readonly missedFires: number;
20
+ readonly disabled: boolean;
21
+ readonly catchupPolicy: 'none' | 'last' | 'all';
22
+ readonly maxCatchupRuns: number;
23
+ readonly catchupWindowMs: number;
24
+ readonly tags?: ReadonlyArray<string>;
25
+ readonly createdAt: string;
26
+ readonly updatedAt?: string;
27
+ }
28
+ /**
29
+ * Pluggable persistent storage for triggers. Default impl lives in
30
+ * `@graphorin/store-sqlite`.
31
+ *
32
+ * @stable
33
+ */
34
+ interface TriggerStore {
35
+ upsert(state: TriggerState): Promise<void>;
36
+ get(id: string): Promise<TriggerState | null>;
37
+ list(): Promise<ReadonlyArray<TriggerState>>;
38
+ remove(id: string): Promise<void>;
39
+ recordFire(id: string, firedAt: string, nextFireAt?: string): Promise<void>;
40
+ }
41
+ //#endregion
42
+ export { TriggerState, TriggerStore };
43
+ //# sourceMappingURL=trigger-store.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"trigger-store.d.ts","names":[],"sources":["../../src/contracts/trigger-store.ts"],"sourcesContent":[],"mappings":";;AAOA;AA0BA;;;;;AAGgC,UA7Bf,YAAA,CA6Be;EAAd,SAAA,EAAA,EAAA,MAAA;EAAR,SAAA,IAAA,EAAA,MAAA,GAAA,UAAA,GAAA,MAAA,GAAA,OAAA;EACY,SAAA,IAAA,EAAA,MAAA;EAC0C,SAAA,WAAA,EAAA,MAAA;EAAO;;;;;;;;;;kBAhBrD;;;;;;;;;;UAWD,YAAA;gBACD,eAAe;mBACZ,QAAQ;UACjB,QAAQ,cAAc;sBACV;gEAC0C"}
@@ -0,0 +1,59 @@
1
+ import { AnyValue, Barrier, Channel, ChannelKind, Ephemeral, LatestValue, ListAggregate, Reducer, Stream, anyValue, barrier, ephemeral, latestValue, listAggregate, reducer, stream } from "./channels/channels.js";
2
+ import { Directive, DirectiveOptions } from "./channels/directive.js";
3
+ import { Dispatch, dispatch } from "./channels/dispatch.js";
4
+ import { PAUSE_SIGNAL_BRAND, PauseResumeScope, PauseSignal, isPauseSignal, pause, runWithPauseResume } from "./channels/pause.js";
5
+ import { AuthTokenRecord, AuthTokenStore } from "./contracts/auth-token-store.js";
6
+ import { Checkpoint, CheckpointId, CheckpointMetadata, CheckpointStore, CheckpointTuple, ListOptions, PendingWrite } from "./contracts/checkpoint-store.js";
7
+ import { EmbedOptions, EmbedderProvider } from "./contracts/embedder.js";
8
+ import { EvalSample, EvalScore, EvalScorer } from "./contracts/eval-scorer.js";
9
+ import { LocalProviderTrust, OllamaTrust } from "./contracts/local-provider-trust.js";
10
+ import { LogFields, LogLevel, Logger, NOOP_LOGGER } from "./contracts/logger.js";
11
+ import { SENSITIVITY_ORDER, Sensitivity, acceptsSensitivity } from "./types/sensitivity.js";
12
+ import { Block, EntityRole, Episode, Fact, GraphEntity, Insight, MemoryHit, MemoryKind, MemoryMetadata, MemoryProvenance, MemoryRecord, MemorySearchOptions, MemoryStatus, Rule } from "./types/memory.js";
13
+ import { ToolCall } from "./types/tool-call.js";
14
+ import { AssistantMessage, AudioContent, FileContent, ImageContent, Message, MessageContent, MessageRole, ReasoningContent, ReasoningContentMeta, SystemMessage, TextContent, ToolMessage, UserMessage } from "./types/message.js";
15
+ import { SessionScope } from "./types/session-scope.js";
16
+ import { EpisodicMemoryStore, MemoryStore, MessageRef, ProceduralMemoryStore, SemanticMemoryStore, SessionListOptions, SessionMemoryStore, SessionMessageWithMetadata, SharedMemoryStore, WorkingMemoryStore } from "./contracts/memory-store.js";
17
+ import { OAuthServerRecord, OAuthServerStore } from "./contracts/oauth-server-store.js";
18
+ import { MODEL_HINTS, ModelHint, ModelSpec, ProviderLike } from "./contracts/preferred-model.js";
19
+ import { Cost, ModelUsage, Usage, UsageAccumulator, UsageSnapshot, zeroUsage } from "./types/usage.js";
20
+ import { ReasoningContract, ReasoningRetention } from "./contracts/reasoning-retention.js";
21
+ import { ComposeProviderMiddleware, FinishReason, OutputSpec, Provider, ProviderCapabilities, ProviderError, ProviderErrorKind, ProviderEvent, ProviderMiddleware, ProviderRequest, ProviderRequestMetadata, ProviderResponse, ResponseMetadata, ToolChoice, ToolDefinition, ToolDefinitionExample } from "./contracts/provider.js";
22
+ import { RedactionInput, RedactionOutput, RedactionValidator } from "./contracts/redaction-validator.js";
23
+ import { Sandbox, SandboxCode, SandboxResult, SandboxRunOptions } from "./contracts/sandbox.js";
24
+ import { SecretRef } from "./contracts/secret-ref.js";
25
+ import { NODEJS_INSPECT_CUSTOM, SECRET_VALUE_BRAND, SecretValue, SecretValueOptions, SecretValueStatic } from "./contracts/secret-value.js";
26
+ import { SecretMetadata, SecretResolver, SecretResolverContext, SecretsSetOptions, SecretsStore } from "./contracts/secrets-store.js";
27
+ import { Handoff, HandoffFilter, HandoffInputFilterDescriptor, HandoffRecord, HandoffSecretsInheritance } from "./types/handoff.js";
28
+ import { AgentRegistryEntry, SessionAuditEntry, SessionMetadata, SessionStore, SessionStoreExt, SessionWorkflowRun } from "./contracts/session-store.js";
29
+ import { TokenCounter } from "./contracts/token-counter.js";
30
+ import { AISpan, NOOP_TRACER, SpanAttributeValue, SpanAttributes, SpanStatus, SpanType, StartSpanOptions, Tracer } from "./contracts/tracer.js";
31
+ import { CompletedToolCall, ContentChunk, InboundSanitizationPolicy, MemoryGuardTier, ResultHandle, SandboxPolicy, SideEffectClass, ToolApproval, ToolError, ToolErrorKind, ToolOutcome, ToolResult, ToolSource, ToolTrustClass, TruncationStrategy } from "./types/tool.js";
32
+ import { RunContext, RunError, RunState, RunStateUsageByModel, RunStatus, RunStep, RunTaintSummary, flattenUsageByModel } from "./types/run.js";
33
+ import { ValidationResult, ZodLikeError, ZodLikeSafeParseResult, ZodLikeSchema, validate, validateOrThrow } from "./utils/validation.js";
34
+ import { ResolvedTool, Tool, ToolExample, ToolExecutionContext, ToolReturn, ToolSecretsAccessor } from "./contracts/tool.js";
35
+ import { TriggerState, TriggerStore } from "./contracts/trigger-store.js";
36
+ import { AgentCancellingEvent, AgentEndEvent, AgentErrorEvent, AgentEvaluatorConvergedEvent, AgentEvaluatorIterationEvent, AgentEvent, AgentFanOutMergedEvent, AgentFanOutSpawnedEvent, AgentFollowUpQueuedEvent, AgentLateralLeakDetectedEvent, AgentModelFellbackEvent, AgentProgressReadEvent, AgentProgressWrittenEvent, AgentResult, AgentStartEvent, AgentSteeredEvent, ContextCompactedEvent, FanOutChildMetadata, GuardrailTrippedEvent, HandoffEvent, LateralLeakVector, ProgressArtifactRef, ReasoningDeltaEvent, StepEndEvent, StepStartEvent, TextCompleteEvent, TextDeltaEvent, ToolApprovalDeniedEvent, ToolApprovalGrantedEvent, ToolApprovalRequestedEvent, ToolCallDeltaEvent, ToolCallEndEvent, ToolCallStartEvent, ToolExecuteEndEvent, ToolExecuteErrorEvent, ToolExecutePartialEvent, ToolExecuteProgressEvent, ToolExecuteStartEvent } from "./types/agent-event.js";
37
+ import { StopCondition, and, hasToolCall, isStepCount, isTerminal, not, or } from "./types/stop-condition.js";
38
+ import { WorkflowChannelUpdateEvent, WorkflowCheckpointWrittenEvent, WorkflowCustomEvent, WorkflowEndEvent, WorkflowErrorEvent, WorkflowEvent, WorkflowResumedEvent, WorkflowStartEvent, WorkflowStepEndEvent, WorkflowStepStartEvent, WorkflowSuspendedEvent, WorkflowTaskEndEvent, WorkflowTaskStartEvent } from "./types/workflow-event.js";
39
+ import { assertNever } from "./utils/assert-never.js";
40
+ import { AsyncContext, createAsyncContext } from "./utils/async-context.js";
41
+ import { md5, xxhash } from "./utils/hash.js";
42
+ import { collect, filter, mapStream, merge, take, takeWhile, withSignal } from "./utils/streams.js";
43
+
44
+ //#region src/index.d.ts
45
+ /**
46
+ * @graphorin/core — types, contracts, and utilities for the Graphorin
47
+ * framework. Dependency-free root package every other `@graphorin/*`
48
+ * package depends on.
49
+ *
50
+ * The full documentation lives in the package `README.md` and the
51
+ * sub-module barrels (`./types`, `./contracts`, `./utils`, `./channels`).
52
+ *
53
+ * @packageDocumentation
54
+ */
55
+ /** Canonical version constant. Mirrors the `package.json` version. */
56
+ declare const VERSION = "0.5.0";
57
+ //#endregion
58
+ export { AISpan, AgentCancellingEvent, AgentEndEvent, AgentErrorEvent, AgentEvaluatorConvergedEvent, AgentEvaluatorIterationEvent, AgentEvent, AgentFanOutMergedEvent, AgentFanOutSpawnedEvent, AgentFollowUpQueuedEvent, AgentLateralLeakDetectedEvent, AgentModelFellbackEvent, AgentProgressReadEvent, AgentProgressWrittenEvent, AgentRegistryEntry, AgentResult, AgentStartEvent, AgentSteeredEvent, AnyValue, AssistantMessage, AsyncContext, AudioContent, AuthTokenRecord, AuthTokenStore, Barrier, Block, Channel, ChannelKind, Checkpoint, CheckpointId, CheckpointMetadata, CheckpointStore, CheckpointTuple, CompletedToolCall, ComposeProviderMiddleware, ContentChunk, ContextCompactedEvent, Cost, Directive, DirectiveOptions, Dispatch, EmbedOptions, EmbedderProvider, EntityRole, Ephemeral, Episode, EpisodicMemoryStore, EvalSample, EvalScore, EvalScorer, Fact, FanOutChildMetadata, FileContent, FinishReason, GraphEntity, GuardrailTrippedEvent, Handoff, HandoffEvent, HandoffFilter, HandoffInputFilterDescriptor, HandoffRecord, HandoffSecretsInheritance, ImageContent, InboundSanitizationPolicy, Insight, LateralLeakVector, LatestValue, ListAggregate, ListOptions, LocalProviderTrust, LogFields, LogLevel, Logger, MODEL_HINTS, MemoryGuardTier, MemoryHit, MemoryKind, MemoryMetadata, MemoryProvenance, MemoryRecord, MemorySearchOptions, MemoryStatus, MemoryStore, Message, MessageContent, MessageRef, MessageRole, ModelHint, ModelSpec, ModelUsage, NODEJS_INSPECT_CUSTOM, NOOP_LOGGER, NOOP_TRACER, OAuthServerRecord, OAuthServerStore, OllamaTrust, OutputSpec, PAUSE_SIGNAL_BRAND, PauseResumeScope, PauseSignal, PendingWrite, ProceduralMemoryStore, ProgressArtifactRef, Provider, ProviderCapabilities, ProviderError, ProviderErrorKind, ProviderEvent, ProviderLike, ProviderMiddleware, ProviderRequest, ProviderRequestMetadata, ProviderResponse, ReasoningContent, ReasoningContentMeta, ReasoningContract, ReasoningDeltaEvent, ReasoningRetention, RedactionInput, RedactionOutput, RedactionValidator, Reducer, ResolvedTool, ResponseMetadata, ResultHandle, Rule, RunContext, RunError, RunState, RunStateUsageByModel, RunStatus, RunStep, RunTaintSummary, SECRET_VALUE_BRAND, SENSITIVITY_ORDER, Sandbox, SandboxCode, SandboxPolicy, SandboxResult, SandboxRunOptions, SecretMetadata, SecretRef, SecretResolver, SecretResolverContext, SecretValue, SecretValueOptions, SecretValueStatic, SecretsSetOptions, SecretsStore, SemanticMemoryStore, Sensitivity, SessionAuditEntry, SessionListOptions, SessionMemoryStore, SessionMessageWithMetadata, SessionMetadata, SessionScope, SessionStore, SessionStoreExt, SessionWorkflowRun, SharedMemoryStore, SideEffectClass, SpanAttributeValue, SpanAttributes, SpanStatus, SpanType, StartSpanOptions, StepEndEvent, StepStartEvent, StopCondition, Stream, SystemMessage, TextCompleteEvent, TextContent, TextDeltaEvent, TokenCounter, Tool, ToolApproval, ToolApprovalDeniedEvent, ToolApprovalGrantedEvent, ToolApprovalRequestedEvent, ToolCall, ToolCallDeltaEvent, ToolCallEndEvent, ToolCallStartEvent, ToolChoice, ToolDefinition, ToolDefinitionExample, ToolError, ToolErrorKind, ToolExample, ToolExecuteEndEvent, ToolExecuteErrorEvent, ToolExecutePartialEvent, ToolExecuteProgressEvent, ToolExecuteStartEvent, ToolExecutionContext, ToolMessage, ToolOutcome, ToolResult, ToolReturn, ToolSecretsAccessor, ToolSource, ToolTrustClass, Tracer, TriggerState, TriggerStore, TruncationStrategy, Usage, UsageAccumulator, UsageSnapshot, UserMessage, VERSION, ValidationResult, WorkflowChannelUpdateEvent, WorkflowCheckpointWrittenEvent, WorkflowCustomEvent, WorkflowEndEvent, WorkflowErrorEvent, WorkflowEvent, WorkflowResumedEvent, WorkflowStartEvent, WorkflowStepEndEvent, WorkflowStepStartEvent, WorkflowSuspendedEvent, WorkflowTaskEndEvent, WorkflowTaskStartEvent, WorkingMemoryStore, ZodLikeError, ZodLikeSafeParseResult, ZodLikeSchema, acceptsSensitivity, and, anyValue, assertNever, barrier, collect, createAsyncContext, dispatch, ephemeral, filter, flattenUsageByModel, hasToolCall, isPauseSignal, isStepCount, isTerminal, latestValue, listAggregate, mapStream, md5, merge, not, or, pause, reducer, runWithPauseResume, stream, take, takeWhile, validate, validateOrThrow, withSignal, xxhash, zeroUsage };
59
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","names":[],"sources":["../src/index.ts"],"sourcesContent":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cAYa,OAAA"}
package/dist/index.js ADDED
@@ -0,0 +1,38 @@
1
+ import { anyValue, barrier, ephemeral, latestValue, listAggregate, reducer, stream } from "./channels/channels.js";
2
+ import { Directive } from "./channels/directive.js";
3
+ import { Dispatch, dispatch } from "./channels/dispatch.js";
4
+ import { PAUSE_SIGNAL_BRAND, PauseSignal, isPauseSignal, pause, runWithPauseResume } from "./channels/pause.js";
5
+ import "./channels/index.js";
6
+ import { NOOP_LOGGER } from "./contracts/logger.js";
7
+ import { MODEL_HINTS } from "./contracts/preferred-model.js";
8
+ import { NODEJS_INSPECT_CUSTOM, SECRET_VALUE_BRAND } from "./contracts/secret-value.js";
9
+ import { NOOP_TRACER } from "./contracts/tracer.js";
10
+ import "./contracts/index.js";
11
+ import { flattenUsageByModel } from "./types/run.js";
12
+ import { SENSITIVITY_ORDER, acceptsSensitivity } from "./types/sensitivity.js";
13
+ import { and, hasToolCall, isStepCount, isTerminal, not, or } from "./types/stop-condition.js";
14
+ import { zeroUsage } from "./types/usage.js";
15
+ import { assertNever } from "./utils/assert-never.js";
16
+ import { createAsyncContext } from "./utils/async-context.js";
17
+ import { md5, xxhash } from "./utils/hash.js";
18
+ import { collect, filter, mapStream, merge, take, takeWhile, withSignal } from "./utils/streams.js";
19
+ import { validate, validateOrThrow } from "./utils/validation.js";
20
+ import "./utils/index.js";
21
+
22
+ //#region src/index.ts
23
+ /**
24
+ * @graphorin/core — types, contracts, and utilities for the Graphorin
25
+ * framework. Dependency-free root package every other `@graphorin/*`
26
+ * package depends on.
27
+ *
28
+ * The full documentation lives in the package `README.md` and the
29
+ * sub-module barrels (`./types`, `./contracts`, `./utils`, `./channels`).
30
+ *
31
+ * @packageDocumentation
32
+ */
33
+ /** Canonical version constant. Mirrors the `package.json` version. */
34
+ const VERSION = "0.5.0";
35
+
36
+ //#endregion
37
+ export { Directive, Dispatch, MODEL_HINTS, NODEJS_INSPECT_CUSTOM, NOOP_LOGGER, NOOP_TRACER, PAUSE_SIGNAL_BRAND, PauseSignal, SECRET_VALUE_BRAND, SENSITIVITY_ORDER, VERSION, acceptsSensitivity, and, anyValue, assertNever, barrier, collect, createAsyncContext, dispatch, ephemeral, filter, flattenUsageByModel, hasToolCall, isPauseSignal, isStepCount, isTerminal, latestValue, listAggregate, mapStream, md5, merge, not, or, pause, reducer, runWithPauseResume, stream, take, takeWhile, validate, validateOrThrow, withSignal, xxhash, zeroUsage };
38
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","names":[],"sources":["../src/index.ts"],"sourcesContent":["/**\n * @graphorin/core — types, contracts, and utilities for the Graphorin\n * framework. Dependency-free root package every other `@graphorin/*`\n * package depends on.\n *\n * The full documentation lives in the package `README.md` and the\n * sub-module barrels (`./types`, `./contracts`, `./utils`, `./channels`).\n *\n * @packageDocumentation\n */\n\n/** Canonical version constant. Mirrors the `package.json` version. */\nexport const VERSION = '0.5.0';\n\nexport * from './channels/index.js';\nexport * from './contracts/index.js';\nexport * from './types/index.js';\nexport * from './utils/index.js';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAYA,MAAa,UAAU"}