@orkestrel/toolbox 0.0.12 → 0.0.13
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.
- package/README.md +1 -4
- package/dist/src/core/index.cjs +374 -274
- package/dist/src/core/index.cjs.map +1 -1
- package/dist/src/core/index.d.cts +815 -703
- package/dist/src/core/index.d.ts +815 -703
- package/dist/src/core/index.js +374 -274
- package/dist/src/core/index.js.map +1 -1
- package/dist/src/server/index.cjs +8 -5
- package/dist/src/server/index.cjs.map +1 -1
- package/dist/src/server/index.d.cts +22 -18
- package/dist/src/server/index.d.ts +22 -18
- package/dist/src/server/index.js +8 -5
- package/dist/src/server/index.js.map +1 -1
- package/package.json +22 -23
|
@@ -1,55 +1,55 @@
|
|
|
1
|
-
import { AgentInterface } from '@orkestrel/agent';
|
|
2
|
-
import { AgentRegistryInterface } from '@orkestrel/agent';
|
|
1
|
+
import type { AgentInterface } from '@orkestrel/agent';
|
|
2
|
+
import type { AgentRegistryInterface } from '@orkestrel/agent';
|
|
3
3
|
import { ArrayShape } from '@orkestrel/contract';
|
|
4
4
|
import { BooleanShape } from '@orkestrel/contract';
|
|
5
|
-
import { Condition } from '@orkestrel/database';
|
|
6
|
-
import { ConditionConnector } from '@orkestrel/database';
|
|
7
|
-
import { ContractInterface } from '@orkestrel/contract';
|
|
8
|
-
import { ContractShape } from '@orkestrel/contract';
|
|
9
|
-
import { ConversationStoreInterface } from '@orkestrel/agent';
|
|
10
|
-
import { DatabaseErrorCode } from '@orkestrel/database';
|
|
11
|
-
import { DatabaseInterface } from '@orkestrel/database';
|
|
12
|
-
import { DriverInterface } from '@orkestrel/database';
|
|
13
|
-
import { Include } from '@orkestrel/relation';
|
|
14
|
-
import { IndexMap } from '@orkestrel/database';
|
|
5
|
+
import type { Condition } from '@orkestrel/database';
|
|
6
|
+
import type { ConditionConnector } from '@orkestrel/database';
|
|
7
|
+
import type { ContractInterface } from '@orkestrel/contract';
|
|
8
|
+
import type { ContractShape } from '@orkestrel/contract';
|
|
9
|
+
import type { ConversationStoreInterface } from '@orkestrel/agent';
|
|
10
|
+
import type { DatabaseErrorCode } from '@orkestrel/database';
|
|
11
|
+
import type { DatabaseInterface } from '@orkestrel/database';
|
|
12
|
+
import type { DriverInterface } from '@orkestrel/database';
|
|
13
|
+
import type { Include } from '@orkestrel/relation';
|
|
14
|
+
import type { IndexMap } from '@orkestrel/database';
|
|
15
15
|
import { JSONShape } from '@orkestrel/contract';
|
|
16
|
-
import { KeyFunction } from '@orkestrel/database';
|
|
17
|
-
import { LifecycleStatus } from '@orkestrel/workflow';
|
|
16
|
+
import type { KeyFunction } from '@orkestrel/database';
|
|
17
|
+
import type { LifecycleStatus } from '@orkestrel/workflow';
|
|
18
18
|
import { LiteralShape } from '@orkestrel/contract';
|
|
19
|
-
import { ModelInterface } from '@orkestrel/relation';
|
|
19
|
+
import type { ModelInterface } from '@orkestrel/relation';
|
|
20
20
|
import { NumberShape } from '@orkestrel/contract';
|
|
21
21
|
import { ObjectShape } from '@orkestrel/contract';
|
|
22
22
|
import { OptionalShape } from '@orkestrel/contract';
|
|
23
|
-
import { OrderDirection } from '@orkestrel/database';
|
|
24
|
-
import { PrimaryMap } from '@orkestrel/database';
|
|
25
|
-
import { QueryInput } from '@orkestrel/database';
|
|
26
|
-
import { RelationErrorCode } from '@orkestrel/relation';
|
|
27
|
-
import { RelationManagerInterface } from '@orkestrel/relation';
|
|
23
|
+
import type { OrderDirection } from '@orkestrel/database';
|
|
24
|
+
import type { PrimaryMap } from '@orkestrel/database';
|
|
25
|
+
import type { QueryInput } from '@orkestrel/database';
|
|
26
|
+
import type { RelationErrorCode } from '@orkestrel/relation';
|
|
27
|
+
import type { RelationManagerInterface } from '@orkestrel/relation';
|
|
28
28
|
import { StringShape } from '@orkestrel/contract';
|
|
29
|
-
import { TableInterface } from '@orkestrel/database';
|
|
30
|
-
import { TableMap } from '@orkestrel/database';
|
|
31
|
-
import { TerminalManagerInterface } from '@orkestrel/terminal';
|
|
32
|
-
import { ToolInterface } from '@orkestrel/tool';
|
|
33
|
-
import { ToolManagerInterface } from '@orkestrel/tool';
|
|
29
|
+
import type { TableInterface } from '@orkestrel/database';
|
|
30
|
+
import type { TableMap } from '@orkestrel/database';
|
|
31
|
+
import type { TerminalManagerInterface } from '@orkestrel/terminal';
|
|
32
|
+
import type { ToolInterface } from '@orkestrel/tool';
|
|
33
|
+
import type { ToolManagerInterface } from '@orkestrel/tool';
|
|
34
34
|
import { UnionShape } from '@orkestrel/contract';
|
|
35
|
-
import { WorkflowDefinition } from '@orkestrel/workflow';
|
|
36
|
-
import { WorkflowFault } from '@orkestrel/workflow';
|
|
37
|
-
import { WorkflowFunction } from '@orkestrel/workflow';
|
|
38
|
-
import { WorkflowRegistry } from '@orkestrel/workflow';
|
|
39
|
-
import { WorkflowResult } from '@orkestrel/workflow';
|
|
40
|
-
import { WorkflowRunnerInterface } from '@orkestrel/workflow';
|
|
41
|
-
import { WorkflowStoreInterface } from '@orkestrel/workflow';
|
|
42
|
-
import { WorkspaceManagerInterface } from '@orkestrel/workspace';
|
|
43
|
-
import { WorkspaceStoreInterface } from '@orkestrel/workspace';
|
|
35
|
+
import type { WorkflowDefinition } from '@orkestrel/workflow';
|
|
36
|
+
import type { WorkflowFault } from '@orkestrel/workflow';
|
|
37
|
+
import type { WorkflowFunction } from '@orkestrel/workflow';
|
|
38
|
+
import type { WorkflowRegistry } from '@orkestrel/workflow';
|
|
39
|
+
import type { WorkflowResult } from '@orkestrel/workflow';
|
|
40
|
+
import type { WorkflowRunnerInterface } from '@orkestrel/workflow';
|
|
41
|
+
import type { WorkflowStoreInterface } from '@orkestrel/workflow';
|
|
42
|
+
import type { WorkspaceManagerInterface } from '@orkestrel/workspace';
|
|
43
|
+
import type { WorkspaceStoreInterface } from '@orkestrel/workspace';
|
|
44
44
|
|
|
45
45
|
/**
|
|
46
46
|
* Holds the maximum nesting depth a delegation chain (agent tool → sub-agent → agent tool → …) may
|
|
47
|
-
* reach — the bound {@link import('./factories.js').createAgentTool}'s depth/cycle guard
|
|
47
|
+
* reach, `8` — the bound {@link import('./factories.js').createAgentTool}'s depth/cycle guard
|
|
48
48
|
* enforces.
|
|
49
49
|
*
|
|
50
50
|
* @remarks
|
|
51
|
-
* Deliberately a
|
|
52
|
-
* sharing one reference):
|
|
51
|
+
* Deliberately a separate constant from {@link MAX_WORKFLOW_CHAIN} (rather than the guards
|
|
52
|
+
* sharing one reference): they bound different chains (workflow nesting against agent
|
|
53
53
|
* delegation) that happen to share a value today, and keeping this bound decoupled means a
|
|
54
54
|
* future change to one never silently shifts the other. Same numeric value by convention, not
|
|
55
55
|
* by shared reference.
|
|
@@ -63,17 +63,21 @@ export declare const AGENT_TOOL_DEPTH = 8;
|
|
|
63
63
|
export declare const AGENT_TOOL_DESCRIPTION: string;
|
|
64
64
|
|
|
65
65
|
/**
|
|
66
|
-
* Holds the name {@link import('./factories.js').createAgentTool} advertises by default
|
|
67
|
-
* model calls and the `ToolManagerInterface` (`@orkestrel/tool`) registers under.
|
|
66
|
+
* Holds the name {@link import('./factories.js').createAgentTool} advertises by default, `'agent'`
|
|
67
|
+
* — the key a model calls and the `ToolManagerInterface` (`@orkestrel/tool`) registers under.
|
|
68
68
|
*/
|
|
69
69
|
export declare const AGENT_TOOL_NAME = "agent";
|
|
70
70
|
|
|
71
71
|
/**
|
|
72
|
-
* Holds the lean {@link import('@orkestrel/tool').ToolInterface.summary}
|
|
73
|
-
*
|
|
74
|
-
*
|
|
75
|
-
* for the
|
|
76
|
-
*
|
|
72
|
+
* Holds the lean {@link import('@orkestrel/tool').ToolInterface.summary}
|
|
73
|
+
* {@link import('./factories.js').createAgentTool} advertises in place of
|
|
74
|
+
* {@link AGENT_TOOL_DESCRIPTION} — one sentence offering sub-agent delegation and pointing at
|
|
75
|
+
* `describe` for the optional overrides.
|
|
76
|
+
*
|
|
77
|
+
* @remarks
|
|
78
|
+
* A `ToolManagerInterface.definitions()` call (`@orkestrel/tool`) advertises
|
|
79
|
+
* `summary ?? description`, so this one-sentence text stands in for the full teaching description;
|
|
80
|
+
* the full text stays retrievable through {@link import('./factories.js').createDescribeTool}.
|
|
77
81
|
*/
|
|
78
82
|
export declare const AGENT_TOOL_SUMMARY = "Delegate a task to a sub-agent and return its result; each call runs one sub-agent turn to completion. Call describe('agent') for the optional provider/tools/system overrides.";
|
|
79
83
|
|
|
@@ -84,9 +88,9 @@ export declare type AgentFunction = WorkflowFunction & {
|
|
|
84
88
|
};
|
|
85
89
|
|
|
86
90
|
/**
|
|
87
|
-
* Represents the options for {@link import('./factories.js').createAgentFunction} — the
|
|
88
|
-
* wraps a live `AgentInterface` (`@orkestrel/agent`) as an {@link AgentFunction} with
|
|
89
|
-
* lineage metadata and optional nested-workflow composition.
|
|
91
|
+
* Represents the options for {@link import('./factories.js').createAgentFunction} — the opt-in
|
|
92
|
+
* adapter that wraps a live `AgentInterface` (`@orkestrel/agent`) as an {@link AgentFunction} with
|
|
93
|
+
* immutable lineage metadata and optional nested-workflow composition.
|
|
90
94
|
*
|
|
91
95
|
* @remarks
|
|
92
96
|
* All fields are optional. An empty lineage is resolved from the controller's root workflow when
|
|
@@ -109,14 +113,14 @@ export declare interface AgentFunctionOptions {
|
|
|
109
113
|
}
|
|
110
114
|
|
|
111
115
|
/**
|
|
112
|
-
* Represents the
|
|
113
|
-
* plus the minimal optional `AgentJobInput` (`@orkestrel/agent`) fields a caller may
|
|
114
|
-
* per-call.
|
|
116
|
+
* Represents the flat args {@link import('./factories.js').createAgentTool} accepts — a delegated
|
|
117
|
+
* `task` plus the minimal optional `AgentJobInput` (`@orkestrel/agent`) fields a caller may
|
|
118
|
+
* override per-call.
|
|
115
119
|
*
|
|
116
120
|
* @remarks
|
|
117
121
|
* `task` becomes the seed user message in the sub-agent's rehydrated conversation
|
|
118
122
|
* (`AgentJobInput.messages`). `provider` / `tools` / `system` shadow the tool's own
|
|
119
|
-
* {@link AgentToolOptions} defaults for this
|
|
123
|
+
* {@link AgentToolOptions} defaults for this one call when supplied.
|
|
120
124
|
*/
|
|
121
125
|
export declare interface AgentToolArguments {
|
|
122
126
|
readonly task: string;
|
|
@@ -132,12 +136,12 @@ export declare interface AgentToolArguments {
|
|
|
132
136
|
* @remarks
|
|
133
137
|
* - `name` / `description` — advertised tool overrides; default to
|
|
134
138
|
* {@link import('./constants.js').AGENT_TOOL_NAME} / {@link import('./constants.js').AGENT_TOOL_DESCRIPTION}.
|
|
135
|
-
* - `provider` — the
|
|
136
|
-
* that supplies its own `provider` overrides this. One of `provider` (here or per-call)
|
|
139
|
+
* - `provider` — the default registry provider key used when a call omits `provider`; a call
|
|
140
|
+
* that supplies its own `provider` overrides this. One of `provider` (here or per-call) must
|
|
137
141
|
* resolve, or the handler throws a typed `TOOL` {@link import('./errors.js').ToolboxError}.
|
|
138
|
-
* - `tools` — the
|
|
142
|
+
* - `tools` — the default registry tool-name list loaded into the delegated sub-agent; a
|
|
139
143
|
* per-call `tools` list overrides (never merges with) this default.
|
|
140
|
-
* - `system` — the
|
|
144
|
+
* - `system` — the default system prompt seeding the sub-agent's context; a per-call `system`
|
|
141
145
|
* overrides this.
|
|
142
146
|
* - `depth` — this invocation's nesting depth (default `0`); a delegated sub-agent that itself
|
|
143
147
|
* calls this tool again runs at `depth + 1`, bounded by
|
|
@@ -145,17 +149,17 @@ export declare interface AgentToolArguments {
|
|
|
145
149
|
* - `ancestry` — the sub-agent identifiers already in this delegation chain (default empty); a
|
|
146
150
|
* cycle (the resolved agent already present) is rejected with a typed `DEPTH`
|
|
147
151
|
* {@link import('./errors.js').ToolboxError}.
|
|
148
|
-
* - `store` — this package's
|
|
152
|
+
* - `store` — this package's addition: when supplied, the handler persists the delegated
|
|
149
153
|
* sub-agent's active conversation snapshot (`store.set(agent.context.conversations.active.snapshot())`)
|
|
150
|
-
*
|
|
154
|
+
* after `agent.generate()` settles successfully, before returning — one snapshot per delegation
|
|
151
155
|
* (each `registry.build` mints a fresh conversation id, so a shared store accumulates an
|
|
152
156
|
* audit log rather than colliding). Omitted ⇒ no persistence from this tool.
|
|
153
157
|
*
|
|
154
|
-
* Conversation persistence for a delegated sub-agent has
|
|
155
|
-
* together: this `store` slot persists
|
|
158
|
+
* Conversation persistence for a delegated sub-agent has independent seams, composable
|
|
159
|
+
* together: this `store` slot persists each delegation's conversation individually, and an
|
|
156
160
|
* `AgentRegistryInterface` built with `AgentRegistryOptions.store` (`@orkestrel/agent`) backs
|
|
157
|
-
*
|
|
158
|
-
* `ConversationManagerInterface` of its own. Neither is required
|
|
161
|
+
* every agent it builds — including ones built through this tool — with a store-backed
|
|
162
|
+
* `ConversationManagerInterface` of its own. Neither is required, and they compose.
|
|
159
163
|
*/
|
|
160
164
|
export declare interface AgentToolOptions {
|
|
161
165
|
readonly name?: string;
|
|
@@ -176,28 +180,36 @@ export declare interface AgentToolOptions {
|
|
|
176
180
|
* `task` is the only required field (a non-empty string); `provider` / `tools` / `system`
|
|
177
181
|
* are per-call overrides of the tool's own configured defaults.
|
|
178
182
|
*/
|
|
179
|
-
export declare const agentToolShape: ObjectShape<{
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
183
|
+
export declare const agentToolShape: ObjectShape< {
|
|
184
|
+
task: StringShape;
|
|
185
|
+
provider: OptionalShape<StringShape>;
|
|
186
|
+
tools: OptionalShape<ArrayShape<StringShape>>;
|
|
187
|
+
system: OptionalShape<StringShape>;
|
|
184
188
|
}, false>;
|
|
185
189
|
|
|
186
|
-
/**
|
|
190
|
+
/**
|
|
191
|
+
* Holds the protocol {@link import('./factories.js').createAnswerTool} advertises — the `pending`
|
|
192
|
+
* and `answer` operations and the `values` record an answer supplies, each with a worked example.
|
|
193
|
+
*/
|
|
187
194
|
export declare const ANSWER_TOOL_DESCRIPTION: string;
|
|
188
195
|
|
|
189
196
|
/**
|
|
190
|
-
* Holds the name {@link import('./factories.js').createAnswerTool} advertises by default
|
|
191
|
-
* model calls and the `ToolManagerInterface` (`@orkestrel/tool`) registers
|
|
197
|
+
* Holds the name {@link import('./factories.js').createAnswerTool} advertises by default,
|
|
198
|
+
* `'answer'` — the key a model calls and the `ToolManagerInterface` (`@orkestrel/tool`) registers
|
|
199
|
+
* under.
|
|
192
200
|
*/
|
|
193
201
|
export declare const ANSWER_TOOL_NAME = "answer";
|
|
194
202
|
|
|
195
203
|
/**
|
|
196
|
-
* Holds the lean {@link import('@orkestrel/tool').ToolInterface.summary}
|
|
197
|
-
*
|
|
198
|
-
*
|
|
199
|
-
*
|
|
200
|
-
*
|
|
204
|
+
* Holds the lean {@link import('@orkestrel/tool').ToolInterface.summary}
|
|
205
|
+
* {@link import('./factories.js').createAnswerTool} advertises in place of
|
|
206
|
+
* {@link ANSWER_TOOL_DESCRIPTION} — one sentence offering the pending listing and the answer call,
|
|
207
|
+
* and pointing at `describe` for the fields each takes.
|
|
208
|
+
*
|
|
209
|
+
* @remarks
|
|
210
|
+
* A `ToolManagerInterface.definitions()` call (`@orkestrel/tool`) advertises
|
|
211
|
+
* `summary ?? description`, so this one-sentence text stands in for the full teaching description;
|
|
212
|
+
* the full text stays retrievable through {@link import('./factories.js').createDescribeTool}.
|
|
201
213
|
*/
|
|
202
214
|
export declare const ANSWER_TOOL_SUMMARY = "List forms addressed to this terminal, or answer one by id with a values record. Call describe('answer') for the required fields.";
|
|
203
215
|
|
|
@@ -211,7 +223,7 @@ export declare const ANSWER_TOOL_SUMMARY = "List forms addressed to this termina
|
|
|
211
223
|
* handler calls — `pending` lists the forms addressed to `to`, `answer` resolves
|
|
212
224
|
* one by `id`. A failed `answer` (`TerminalAnswerError`) re-surfaces as a typed
|
|
213
225
|
* `ANSWER` {@link import('./errors.js').ToolboxError}.
|
|
214
|
-
* - `to` — the terminal identity this tool lists / answers prompts
|
|
226
|
+
* - `to` — the terminal identity this tool lists / answers prompts for.
|
|
215
227
|
* - `name` / `description` — advertised tool overrides; default to
|
|
216
228
|
* {@link import('./constants.js').ANSWER_TOOL_NAME} / {@link import('./constants.js').ANSWER_TOOL_DESCRIPTION}.
|
|
217
229
|
*/
|
|
@@ -231,20 +243,21 @@ export declare interface AnswerToolOptions {
|
|
|
231
243
|
* `values` is first bounded to exact JSON. The handler then narrows it with the originating Form
|
|
232
244
|
* package's `isFormValues` guard before the terminal manager applies it to the parked live form.
|
|
233
245
|
*/
|
|
234
|
-
export declare const answerToolShape: UnionShape<readonly [
|
|
235
|
-
|
|
236
|
-
}, false>, ObjectShape<{
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
246
|
+
export declare const answerToolShape: UnionShape<readonly [ObjectShape< {
|
|
247
|
+
operation: LiteralShape<readonly ["pending"]>;
|
|
248
|
+
}, false>, ObjectShape< {
|
|
249
|
+
operation: LiteralShape<readonly ["answer"]>;
|
|
250
|
+
id: StringShape;
|
|
251
|
+
values: JSONShape;
|
|
240
252
|
}, false>]>;
|
|
241
253
|
|
|
242
254
|
/**
|
|
243
|
-
* Represents the
|
|
255
|
+
* Represents the probe query and effective row limit {@link import('./helpers.js').clampQuery}
|
|
256
|
+
* returns.
|
|
244
257
|
*
|
|
245
258
|
* @remarks
|
|
246
259
|
* `limit` is the effective ceiling — `min(query?.limit ?? cap, cap)`, floored at `0`. `query`
|
|
247
|
-
* requests one row
|
|
260
|
+
* requests one row more than that, so a caller detects truncation from the returned row count
|
|
248
261
|
* without a separate `count` round trip.
|
|
249
262
|
*/
|
|
250
263
|
export declare interface ClampedQuery {
|
|
@@ -253,14 +266,14 @@ export declare interface ClampedQuery {
|
|
|
253
266
|
}
|
|
254
267
|
|
|
255
268
|
/**
|
|
256
|
-
* Clamps a `'records'` call's query to a row cap, and builds the
|
|
257
|
-
*
|
|
258
|
-
*
|
|
269
|
+
* Clamps a `'records'` call's query to a row cap, and builds the probe query the caller reads with
|
|
270
|
+
* — the pure leaf {@link import('./factories.js').createDatabaseTool}'s `'records'` operation uses
|
|
271
|
+
* to detect truncation without a separate `count` round trip.
|
|
259
272
|
*
|
|
260
273
|
* @remarks
|
|
261
274
|
* {@link resolveLimit} picks the effective limit, so a caller can never exceed the configured cap
|
|
262
275
|
* by supplying a larger `query.limit`, and can never drive it below `0`. The returned probe query
|
|
263
|
-
* requests
|
|
276
|
+
* requests one more row than the effective limit (`limit: effective + 1`) — if storage returns
|
|
264
277
|
* that many, the caller knows the true result was truncated (`rows.length > effective`) and slices
|
|
265
278
|
* back down to `effective` before returning.
|
|
266
279
|
*
|
|
@@ -276,7 +289,7 @@ export declare interface ClampedQuery {
|
|
|
276
289
|
*
|
|
277
290
|
* @param query - The live query to clamp (or `undefined`)
|
|
278
291
|
* @param cap - The row-count ceiling
|
|
279
|
-
* @returns The
|
|
292
|
+
* @returns The probe query (`limit` bumped by one) and the effective `limit`
|
|
280
293
|
*/
|
|
281
294
|
export declare function clampQuery(query: QueryInput | undefined, cap: number): ClampedQuery;
|
|
282
295
|
|
|
@@ -296,9 +309,9 @@ export declare type ColumnSpec = ColumnPrimitive | Readonly<{
|
|
|
296
309
|
}>;
|
|
297
310
|
|
|
298
311
|
/** Describes a {@link import('./types.js').ColumnSpec} — a bare {@link columnPrimitiveShape}, or `{ primitive, optional }`. */
|
|
299
|
-
export declare const columnSpecShape: UnionShape<readonly [
|
|
300
|
-
|
|
301
|
-
|
|
312
|
+
export declare const columnSpecShape: UnionShape<readonly [LiteralShape<readonly ["string", "integer", "number", "boolean"]>, ObjectShape< {
|
|
313
|
+
primitive: LiteralShape<readonly ["string", "integer", "number", "boolean"]>;
|
|
314
|
+
optional: OptionalShape<BooleanShape>;
|
|
302
315
|
}, false>]>;
|
|
303
316
|
|
|
304
317
|
/**
|
|
@@ -320,21 +333,21 @@ export declare function compileColumn(spec: ColumnSpec): ContractShape;
|
|
|
320
333
|
export declare function compileColumnPrimitive(primitive: ColumnPrimitive): ContractShape;
|
|
321
334
|
|
|
322
335
|
/**
|
|
323
|
-
* Completes a {@link WorkflowDraft} into a strict {@link WorkflowDefinition} — synthesizes
|
|
324
|
-
*
|
|
325
|
-
*
|
|
336
|
+
* Completes a {@link WorkflowDraft} into a strict {@link WorkflowDefinition} — synthesizes a
|
|
337
|
+
* missing `id` deterministically and positionally, and defaults a missing `name` to its resolved
|
|
338
|
+
* `id`.
|
|
326
339
|
*
|
|
327
340
|
* @remarks
|
|
328
341
|
* The positional id scheme is stable and human-legible: the workflow is `wf`, phase `i` is
|
|
329
342
|
* `phase-<i>`, and task `j` of that phase is `<phaseId>-task-<j>` (so a provided phase id flows
|
|
330
|
-
* into its tasks' synthesized ids). A
|
|
343
|
+
* into its tasks' synthesized ids). A provided `id` / `name` at any level is kept verbatim —
|
|
331
344
|
* synthesis touches only the omitted ones. A missing `name` defaults to the resolved `id` (never
|
|
332
|
-
* the other way round), so the result always
|
|
345
|
+
* the other way round), so the result always carries an `id` and a `name`. `behavior`, `description`, the per-phase
|
|
333
346
|
* `concurrency` / `bail`, the per-task `retries` / `timeout`, and the workflow `bail` carry over
|
|
334
347
|
* unchanged. The result is a complete {@link WorkflowDefinition}; the caller still validates it
|
|
335
|
-
* against the
|
|
348
|
+
* against the strict contract.
|
|
336
349
|
*
|
|
337
|
-
* @param draft - The draft workflow (id
|
|
350
|
+
* @param draft - The draft workflow (`id` and `name` optional at the workflow, phase, and task levels)
|
|
338
351
|
* @returns A complete {@link WorkflowDefinition} with every id/name filled
|
|
339
352
|
*/
|
|
340
353
|
export declare function completeDraft(draft: WorkflowDraft): WorkflowDefinition;
|
|
@@ -361,12 +374,15 @@ export declare function completePhaseDraft(phase: PhaseDraft, index: number): Wo
|
|
|
361
374
|
*/
|
|
362
375
|
export declare function completeTaskDraft(task: TaskDraft, phaseId: string, index: number): WorkflowDefinition['phases'][number]['tasks'][number];
|
|
363
376
|
|
|
364
|
-
/**
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
377
|
+
/**
|
|
378
|
+
* Describes one serialized where condition — `values` is always an array, even for a single-value
|
|
379
|
+
* operator.
|
|
380
|
+
*/
|
|
381
|
+
export declare const conditionShape: ObjectShape< {
|
|
382
|
+
column: StringShape;
|
|
383
|
+
operator: LiteralShape<readonly ["equals", "not", "above", "below", "from", "to", "between", "like", "glob", "starts", "ends", "any", "none", "absent", "present"]>;
|
|
384
|
+
values: ArrayShape<JSONShape>;
|
|
385
|
+
connector: OptionalShape<LiteralShape<readonly ["and", "or"]>>;
|
|
370
386
|
}, false>;
|
|
371
387
|
|
|
372
388
|
/**
|
|
@@ -408,8 +424,8 @@ export declare const conditionShape: ObjectShape<{
|
|
|
408
424
|
export declare function createAgentFunction(agent: AgentInterface, options?: AgentFunctionOptions): AgentFunction;
|
|
409
425
|
|
|
410
426
|
/**
|
|
411
|
-
* Builds an LLM-callable sub-agent delegation tool — resolves a live, seeded `AgentInterface`
|
|
412
|
-
* from `registry` and runs it to completion for
|
|
427
|
+
* Builds an LLM-callable sub-agent delegation tool — it resolves a live, seeded `AgentInterface`
|
|
428
|
+
* from `registry` and runs it to completion for one delegated `task`.
|
|
413
429
|
*
|
|
414
430
|
* @remarks
|
|
415
431
|
* The universal tool-handler contract: validates the call args against
|
|
@@ -417,10 +433,10 @@ export declare function createAgentFunction(agent: AgentInterface, options?: Age
|
|
|
417
433
|
* sub-agent's conversation as a single `user` message; `provider` / `tools` / `system` fall
|
|
418
434
|
* back to the tool's own {@link import('./types.js').AgentToolOptions} defaults), rehydrates the sub-agent through
|
|
419
435
|
* `registry.build`, runs it with `agent.generate()`, and returns the settled
|
|
420
|
-
* `AgentResult.content` string (the sub-agent's final text). A missing / unresolvable `provider`, or a malformed call,
|
|
436
|
+
* `AgentResult.content` string (the sub-agent's final text). A missing / unresolvable `provider`, or a malformed call, throws a typed `TOOL`
|
|
421
437
|
* {@link import('./errors.js').ToolboxError}; a delegation that would exceed
|
|
422
438
|
* {@link import('./constants.js').AGENT_TOOL_DEPTH}, or re-enter an already-delegated agent (a
|
|
423
|
-
* cycle),
|
|
439
|
+
* cycle), throws a typed `DEPTH` {@link import('./errors.js').ToolboxError}, each isolated
|
|
424
440
|
* by the `ToolManagerInterface` into the canonical tool result's top-level `error`.
|
|
425
441
|
*
|
|
426
442
|
* `AgentInterface` (`@orkestrel/agent`) exposes no teardown method — a bound sub-agent's
|
|
@@ -449,9 +465,8 @@ export declare function createAgentFunction(agent: AgentInterface, options?: Age
|
|
|
449
465
|
export declare function createAgentTool(registry: AgentRegistryInterface, options?: AgentToolOptions): ToolInterface;
|
|
450
466
|
|
|
451
467
|
/**
|
|
452
|
-
* Builds an LLM-callable answer tool — the
|
|
453
|
-
* addressed to {@link import('./types.js').AnswerToolOptions.to}, or answers one of
|
|
454
|
-
* them by id.
|
|
468
|
+
* Builds an LLM-callable answer tool — the answer side of the terminal seam. It lists the forms
|
|
469
|
+
* addressed to {@link import('./types.js').AnswerToolOptions.to}, or answers one of them by id.
|
|
455
470
|
*
|
|
456
471
|
* @remarks
|
|
457
472
|
* The universal tool-handler contract: validates the call args against
|
|
@@ -461,10 +476,10 @@ export declare function createAgentTool(registry: AgentRegistryInterface, option
|
|
|
461
476
|
* and applies it through
|
|
462
477
|
* `TerminalManagerInterface.answer` — a rejected / unknown / unresolvable outcome
|
|
463
478
|
* (`TerminalAnswerResult.error`) re-surfaces as a typed `ANSWER` `ToolboxError`; success returns
|
|
464
|
-
* `{ answered: id }`. `to` is
|
|
479
|
+
* `{ answered: id }`. `to` is fixed at construction
|
|
465
480
|
* ({@link import('./types.js').AnswerToolOptions.to}) — never read from the model-supplied args —
|
|
466
481
|
* so a model cannot spoof which terminal it is answering for. Concurrent answerers racing on one
|
|
467
|
-
* endpoint are
|
|
482
|
+
* endpoint are first-write-wins — a late answer to an already-settled form returns a typed
|
|
468
483
|
* `ANSWER` `ToolboxError` (surfaced as a 422 over HTTP).
|
|
469
484
|
*
|
|
470
485
|
* @param options - The live manager, the fixed `to` identity, and advertised overrides (see
|
|
@@ -511,7 +526,7 @@ export declare function createDatabaseDefinitionStore(driver?: DriverInterface):
|
|
|
511
526
|
* @remarks
|
|
512
527
|
* The universal tool-handler contract: validates the call args against
|
|
513
528
|
* {@link import('./shapers.js').databaseToolShape}, dispatches to the matching operation, and
|
|
514
|
-
*
|
|
529
|
+
* returns a plain result on success. A database is resolved lazily and cached for the tool's
|
|
515
530
|
* lifetime — `'create'` mints one from `tables` ({@link import('./compilers.js').expandTables}) and
|
|
516
531
|
* a registered `driver` key ({@link import('./types.js').DatabaseToolOptions.drivers}, default
|
|
517
532
|
* `{ memory: () => createMemoryDriver() }`); any other operation addressing an uncached id falls
|
|
@@ -536,7 +551,7 @@ export declare function createDatabaseDefinitionStore(driver?: DriverInterface):
|
|
|
536
551
|
* ({@link import('./helpers.js').inferDatabaseCode}); an `ToolboxError` thrown by this tool's own
|
|
537
552
|
* guards passes through unwrapped.
|
|
538
553
|
*
|
|
539
|
-
* A lazily re-minted database over the
|
|
554
|
+
* A lazily re-minted database over the default in-memory driver yields an empty database — only
|
|
540
555
|
* the {@link import('./types.js').DatabaseDefinition} schema persists in `store`, never rows;
|
|
541
556
|
* durable rows need a persistent driver factory registered in
|
|
542
557
|
* {@link import('./types.js').DatabaseToolOptions.drivers}. `'destroy'` closes whatever handle is
|
|
@@ -544,7 +559,7 @@ export declare function createDatabaseDefinitionStore(driver?: DriverInterface):
|
|
|
544
559
|
* {@link import('./types.js').DatabaseToolOptions.databases} handle — the embedder relinquishes
|
|
545
560
|
* that handle's lifecycle to this tool for any id it wires in. This tool assumes the
|
|
546
561
|
* single-writer, non-reentrant model `@orkestrel/database` itself assumes — concurrent calls
|
|
547
|
-
* against one id are
|
|
562
|
+
* against one id are not serialized by this tool. `'get'` is uncapped by
|
|
548
563
|
* {@link import('./types.js').DatabaseToolOptions.limit} (bounded only by the caller's `key` array
|
|
549
564
|
* size), unlike `'records'` / `'find'` / `'links'`.
|
|
550
565
|
*
|
|
@@ -566,9 +581,8 @@ export declare function createDatabaseDefinitionStore(driver?: DriverInterface):
|
|
|
566
581
|
export declare function createDatabaseTool(options?: DatabaseToolOptions): ToolInterface;
|
|
567
582
|
|
|
568
583
|
/**
|
|
569
|
-
* Builds an LLM-callable tool that returns the
|
|
570
|
-
* name — the counterpart to the lean `summary` the other tools in this package advertise
|
|
571
|
-
* (`AGENT_TOOL_SUMMARY` / `WORKFLOW_TOOL_SUMMARY` / `WORKSPACE_TOOL_SUMMARY`).
|
|
584
|
+
* Builds an LLM-callable tool that returns the full `description` of another registered tool by
|
|
585
|
+
* name — the counterpart to the lean `summary` the other tools in this package advertise.
|
|
572
586
|
*
|
|
573
587
|
* @remarks
|
|
574
588
|
* `ToolManagerInterface.definitions()` (`@orkestrel/tool`) advertises `tool.summary ??
|
|
@@ -579,8 +593,8 @@ export declare function createDatabaseTool(options?: DatabaseToolOptions): ToolI
|
|
|
579
593
|
* tool has no `description` of its own, then a placeholder when it has neither).
|
|
580
594
|
*
|
|
581
595
|
* The universal tool-handler contract: validates the call args against
|
|
582
|
-
* {@link import('./shapers.js').describeToolShape},
|
|
583
|
-
* success,
|
|
596
|
+
* {@link import('./shapers.js').describeToolShape}, returns the plain description string on
|
|
597
|
+
* success, throws a typed `TOOL` {@link import('./errors.js').ToolboxError} on a malformed call
|
|
584
598
|
* or an unknown tool name.
|
|
585
599
|
*
|
|
586
600
|
* @param tools - The `ToolManagerInterface` (`@orkestrel/tool`) whose registered tools this
|
|
@@ -602,36 +616,36 @@ export declare function createDatabaseTool(options?: DatabaseToolOptions): ToolI
|
|
|
602
616
|
export declare function createDescribeTool(tools: ToolManagerInterface): ToolInterface;
|
|
603
617
|
|
|
604
618
|
/**
|
|
605
|
-
* Wraps one
|
|
606
|
-
* `ToolInterface` — the endpoint half of the
|
|
607
|
-
* {@link createInferTool}, is a standalone inference utility).
|
|
619
|
+
* Wraps one concrete endpoint ({@link import('./types.js').EndpointDefinition}) as an LLM-callable
|
|
620
|
+
* `ToolInterface` — the endpoint half of the bridge from an existing API or database into an MCP
|
|
621
|
+
* tool (the other half, {@link createInferTool}, is a standalone inference utility).
|
|
608
622
|
*
|
|
609
623
|
* @remarks
|
|
610
|
-
* `parameters` is inferred
|
|
624
|
+
* `parameters` is inferred once at construction from `definition.samples` through
|
|
611
625
|
* `@orkestrel/contract`'s `samplesToSchema` (tuned by {@link import('./types.js').EndpointToolOptions}'s
|
|
612
626
|
* `format` / `enum`), wrapping a non-object root as `{ value: <schema> }` through `schemaToObject` —
|
|
613
|
-
* the
|
|
614
|
-
* ({@link import('./types.js').EndpointToolOptions.validate} `true`), the
|
|
615
|
-
* `@orkestrel/contract`'s `schemaToShape` compiles it
|
|
627
|
+
* the same object-rooted schema is both the advertised `parameters` and, by default
|
|
628
|
+
* ({@link import('./types.js').EndpointToolOptions.validate} `true`), the enforced contract:
|
|
629
|
+
* `@orkestrel/contract`'s `schemaToShape` compiles it once (through `createContract`) into a
|
|
616
630
|
* `ContractInterface` whose `.parse` runs on every call's `args` before `definition.execute` — a
|
|
617
|
-
*
|
|
631
|
+
* normalizing parse, not a strict type check: a scalar is coerced to its inferred type where the
|
|
618
632
|
* house parsers coerce (a number to/from a numeric string, a boolean from `'1'`/`'0'`/`'true'`/
|
|
619
|
-
* `'false'`/`1`/`0`), so `definition.execute` receives the
|
|
633
|
+
* `'false'`/`1`/`0`), so `definition.execute` receives the coerced value (for example `7` sent for a
|
|
620
634
|
* string slot arrives as `'7'`), not the raw call value. A call whose `args` fails to parse into
|
|
621
|
-
* a record — a required key missing, or a value not coercible to its slot's type —
|
|
635
|
+
* a record — a required key missing, or a value not coercible to its slot's type — throws a
|
|
622
636
|
* typed `TOOL` {@link import('./errors.js').ToolboxError} carrying the compiled contract's
|
|
623
637
|
* structured `explain` faults, and `definition.execute` is never called. `format` annotations are
|
|
624
|
-
*
|
|
638
|
+
* never asserted, and a key outside the closed inferred schema is silently dropped rather than
|
|
625
639
|
* rejected (see {@link import('./types.js').EndpointToolOptions.validate}). With
|
|
626
|
-
* `validate: false`, the tool's `execute`
|
|
627
|
-
* `definition.execute`
|
|
628
|
-
* definition's return flows back as the tool call's plain result; a throw
|
|
640
|
+
* `validate: false`, the tool's `execute` passes through the model-supplied `args` to
|
|
641
|
+
* `definition.execute` without re-validation — the raw-passthrough opt-out. Either way, the
|
|
642
|
+
* definition's return flows back as the tool call's plain result; a throw propagates uncaught,
|
|
629
643
|
* isolated by the `ToolManagerInterface` (`@orkestrel/tool`) into the canonical error envelope
|
|
630
644
|
* — never caught or re-wrapped here.
|
|
631
645
|
*
|
|
632
646
|
* @param definition - The endpoint's identity, non-empty samples, and local handler (see
|
|
633
647
|
* {@link import('./types.js').EndpointDefinition})
|
|
634
|
-
* @param options - Construction-time inference tuning
|
|
648
|
+
* @param options - Construction-time inference tuning and the validate opt-out (see
|
|
635
649
|
* {@link import('./types.js').EndpointToolOptions})
|
|
636
650
|
* @returns A `ToolInterface` named `definition.name`
|
|
637
651
|
*
|
|
@@ -670,44 +684,44 @@ export declare function createDescribeTool(tools: ToolManagerInterface): ToolInt
|
|
|
670
684
|
export declare function createEndpointTool(definition: EndpointDefinition, options?: EndpointToolOptions): ToolInterface;
|
|
671
685
|
|
|
672
686
|
/**
|
|
673
|
-
* Builds a standalone LLM-callable tool that infers a JSON Schema from example values — the
|
|
674
|
-
*
|
|
675
|
-
* {@link createEndpointTool}, wraps one
|
|
687
|
+
* Builds a standalone LLM-callable tool that infers a JSON Schema from example values — the utility
|
|
688
|
+
* half of the bridge from an existing API or database into an MCP tool (the other half,
|
|
689
|
+
* {@link createEndpointTool}, wraps one concrete endpoint).
|
|
676
690
|
*
|
|
677
691
|
* @remarks
|
|
678
692
|
* The universal tool-handler contract: validates the call args against
|
|
679
693
|
* {@link import('./shapers.js').inferToolShape} (`samples` non-empty, `format` / `enum` optional
|
|
680
694
|
* booleans, `candidates` an optional array), infers a schema through `@orkestrel/contract`'s
|
|
681
695
|
* `samplesToSchema`, wraps a non-object root as `{ value: <schema> }` through `schemaToObject` (mirrors
|
|
682
|
-
* the tool-parameters convention every other `create*Tool` factory advertises), and
|
|
696
|
+
* the tool-parameters convention every other `create*Tool` factory advertises), and returns the
|
|
683
697
|
* resulting parameters record. An empty `samples` array fails `inferToolShape`'s `min: 1` bound —
|
|
684
698
|
* `contract.parse` returns `undefined` and the handler throws a typed `TOOL`
|
|
685
699
|
* {@link import('./errors.js').ToolboxError}.
|
|
686
700
|
*
|
|
687
|
-
* When `candidates` is
|
|
688
|
-
* this array existed. When `candidates` is
|
|
689
|
-
* compiles a
|
|
690
|
-
* `schemaToShape`,
|
|
701
|
+
* When `candidates` is absent, the return is the bare parameters record — unchanged from before
|
|
702
|
+
* this array existed. When `candidates` is present (any array, including empty), the handler
|
|
703
|
+
* compiles a separate per-call contract from the raw inferred schema (through `@orkestrel/contract`'s
|
|
704
|
+
* `schemaToShape`, not the `schemaToObject`-wrapped parameters — a bare-value sample checks a
|
|
691
705
|
* bare-value candidate) and returns `{ parameters, checks }`, one check per candidate at the same
|
|
692
|
-
* index. Every entry has a
|
|
693
|
-
* when `valid` is `false`: `valid` is the
|
|
694
|
-
*
|
|
695
|
-
* string slot) — here a conformance report answers "does this value conform
|
|
696
|
-
* string slot is `valid: false`, full stop. `coercible` answers a
|
|
697
|
-
*
|
|
706
|
+
* index. Every entry has a uniform shape — `{ index, valid, coercible }`, with `faults` added only
|
|
707
|
+
* when `valid` is `false`: `valid` is the strict guard verdict (`checker.is(candidate)`), the
|
|
708
|
+
* opposite of {@link createEndpointTool}'s enforcement, which coerces (`7` becomes `'7'` for a
|
|
709
|
+
* string slot) — here a conformance report answers "does this value conform as-is": `7` against a
|
|
710
|
+
* string slot is `valid: false`, full stop. `coercible` answers a separate question — "would the
|
|
711
|
+
* normalizing parse accept this value", that is would {@link createEndpointTool}'s default enforcement
|
|
698
712
|
* admit it (`checker.parse(candidate) !== undefined`) — computed for every candidate regardless of
|
|
699
713
|
* `valid`; by the house parse/guard round-trip, a `valid: true` entry is
|
|
700
|
-
*
|
|
714
|
+
* always also `coercible: true`. `@orkestrel/contract`'s `explain` mirrors the normalizing
|
|
701
715
|
* `parse`'s leniency, not `is`'s strictness — so a strictly-invalid but coercible candidate (`7`
|
|
702
|
-
* against a string slot) yields `{ valid: false, coercible: true, faults: [] }`:
|
|
716
|
+
* against a string slot) yields `{ valid: false, coercible: true, faults: [] }`: empty faults, because
|
|
703
717
|
* the mismatch the normalizing parse would silently fix is not one `explain` reports. `faults`
|
|
704
|
-
* therefore only ever populates for a
|
|
718
|
+
* therefore only ever populates for a non-coercible mismatch — a wrong type the parse can't coerce
|
|
705
719
|
* (a boolean in a string slot), a missing required key, or an out-of-enum value — where
|
|
706
720
|
* `coercible: false`. `checker.is` / `.parse` / `.explain` are all total over JSON-safe input — a
|
|
707
|
-
* JSON-safe hostile candidate (a `__proto__`-carrying object, deeply nested data) reaches
|
|
708
|
-
* and yields a bounded, non-throwing per-candidate verdict; a
|
|
709
|
-
* throwing-getter `Proxy`) never reaches the checker at all — it fails the
|
|
710
|
-
* against {@link import('./shapers.js').inferToolShape} and rejects the
|
|
721
|
+
* JSON-safe hostile candidate (a `__proto__`-carrying object, deeply nested data) reaches each of them
|
|
722
|
+
* and yields a bounded, non-throwing per-candidate verdict; a non-JSON-safe candidate (for example a
|
|
723
|
+
* throwing-getter `Proxy`) never reaches the checker at all — it fails the outer `args` parse
|
|
724
|
+
* against {@link import('./shapers.js').inferToolShape} and rejects the whole call with the same
|
|
711
725
|
* `TOOL` {@link import('./errors.js').ToolboxError} a malformed `samples`/`format`/`enum` throws,
|
|
712
726
|
* with no per-candidate verdict produced.
|
|
713
727
|
*
|
|
@@ -750,8 +764,8 @@ export declare function createInferTool(options?: InferToolOptions): ToolInterfa
|
|
|
750
764
|
|
|
751
765
|
/**
|
|
752
766
|
* Creates the in-memory {@link DefinitionStoreInterface} — a process-lifetime `Map` of database
|
|
753
|
-
* definitions, the
|
|
754
|
-
*
|
|
767
|
+
* definitions, the default store the database and relation tools persist their `DatabaseDefinition`
|
|
768
|
+
* configs through.
|
|
755
769
|
*
|
|
756
770
|
* @returns A {@link DefinitionStoreInterface}
|
|
757
771
|
*
|
|
@@ -765,20 +779,23 @@ export declare function createInferTool(options?: InferToolOptions): ToolInterfa
|
|
|
765
779
|
export declare function createMemoryDefinitionStore(): DefinitionStoreInterface;
|
|
766
780
|
|
|
767
781
|
/**
|
|
768
|
-
* Builds an LLM-callable form tool — the
|
|
769
|
-
*
|
|
782
|
+
* Builds an LLM-callable form tool — the ask side of the terminal seam. It asks a multi-field form
|
|
783
|
+
* and blocks until the addressed terminal answers, returning the resolved values record.
|
|
770
784
|
*
|
|
771
785
|
* @remarks
|
|
772
786
|
* The universal tool-handler contract: validates the call args against
|
|
773
787
|
* {@link import('./shapers.js').promptToolShape}, parses the call's schema through
|
|
774
788
|
* `@orkestrel/form`, constructs the live form, and passes it to `TerminalManagerInterface.ask`.
|
|
775
|
-
* `from` is
|
|
789
|
+
* `from` is fixed at construction
|
|
776
790
|
* ({@link import('./types.js').PromptToolOptions.from}) — never read from the model-supplied
|
|
777
|
-
* args — so a model cannot spoof which terminal is asking. A form
|
|
791
|
+
* args — so a model cannot spoof which terminal is asking. A form cycle rejects with
|
|
778
792
|
* `TerminalError('DEADLOCK')`, re-surfaced as a typed `DEADLOCK`
|
|
779
793
|
* {@link import('./errors.js').ToolboxError}; an expired form re-surfaces as `EXPIRE`; an
|
|
780
794
|
* unknown `to` (or any other `TerminalError`) re-surfaces as `TOOL`, naming the unknown terminal
|
|
781
|
-
* and how many brokers the manager holds (`manager.count`).
|
|
795
|
+
* and how many brokers the manager holds (`manager.count`). A schema `parseForm` refuses — an
|
|
796
|
+
* unknown control, a duplicate field name, a `'select'` or `'checkbox'` field without usable
|
|
797
|
+
* `choices` — throws a typed `TOOL` error up front, so a malformed schema never parks as a form
|
|
798
|
+
* nobody can answer.
|
|
782
799
|
*
|
|
783
800
|
* @param options - The live manager, the fixed `from` identity, and advertised overrides (see
|
|
784
801
|
* {@link import('./types.js').PromptToolOptions})
|
|
@@ -809,14 +826,14 @@ export declare function createPromptTool(options: PromptToolOptions): ToolInterf
|
|
|
809
826
|
* The universal tool-handler contract: validates the call args against
|
|
810
827
|
* {@link import('./shapers.js').relationToolShape}, resolves the addressed
|
|
811
828
|
* {@link import('@orkestrel/relation').RelationManagerInterface} — an explicit `manager` field
|
|
812
|
-
* must match a key of {@link import('./types.js').RelationToolOptions.managers}, an
|
|
813
|
-
* resolves to the
|
|
829
|
+
* must match a key of {@link import('./types.js').RelationToolOptions.managers}, an omitted one
|
|
830
|
+
* resolves to the sole registered manager, either miss throwing a typed `TOOL`
|
|
814
831
|
* {@link import('./errors.js').ToolboxError}
|
|
815
832
|
* ({@link import('./helpers.js').resolveRelationManager}) — then resolves `model` against it
|
|
816
833
|
* ({@link import('./helpers.js').resolveRelationModel}, same typed-`TOOL`-on-miss shape), and
|
|
817
|
-
* dispatches to the matched operation,
|
|
834
|
+
* dispatches to the matched operation, returning a plain result on success.
|
|
818
835
|
*
|
|
819
|
-
* `'load'` / `'find'` expand the call's
|
|
836
|
+
* `'load'` / `'find'` expand the call's flat dot-path `include` list into a live
|
|
820
837
|
* `@orkestrel/relation` `Include` tree through {@link import('./helpers.js').expandInclude}, capped
|
|
821
838
|
* at {@link import('./types.js').RelationToolOptions.depth} (default
|
|
822
839
|
* {@link import('./constants.js').RELATION_TOOL_DEPTH}) — a path exceeding the cap, or carrying an
|
|
@@ -826,7 +843,7 @@ export declare function createPromptTool(options: PromptToolOptions): ToolInterf
|
|
|
826
843
|
* result to {@link import('./types.js').RelationToolOptions.limit} (default
|
|
827
844
|
* {@link import('./constants.js').RELATION_TOOL_LIMIT}), taken through
|
|
828
845
|
* {@link import('./helpers.js').resolveLimit} — `'find'` probes one row past the effective limit to
|
|
829
|
-
* report `truncated`; `'links'` (which has no upstream pagination) fetches the
|
|
846
|
+
* report `truncated`; `'links'` (which has no upstream pagination) fetches the full linked-key
|
|
830
847
|
* list and slices/truncates it the same way. `'link'` / `'unlink'` write / remove one `through` junction
|
|
831
848
|
* row.
|
|
832
849
|
*
|
|
@@ -851,8 +868,8 @@ export declare function createPromptTool(options: PromptToolOptions): ToolInterf
|
|
|
851
868
|
export declare function createRelationTool(options: RelationToolOptions): ToolInterface;
|
|
852
869
|
|
|
853
870
|
/**
|
|
854
|
-
* Wraps a registered tool as a {@link WorkflowFunction} (`@orkestrel/workflow`) — the
|
|
855
|
-
* adapter that lets a `function`-form task run a `@orkestrel/tool` tool
|
|
871
|
+
* Wraps a registered tool as a {@link WorkflowFunction} (`@orkestrel/workflow`) — the opt-in
|
|
872
|
+
* adapter that lets a `function`-form task run a `@orkestrel/tool` tool by name.
|
|
856
873
|
*
|
|
857
874
|
* @remarks
|
|
858
875
|
* Composes into a caller's `WorkflowOptions.functions` registry like any other behavior
|
|
@@ -882,7 +899,9 @@ export declare function createRelationTool(options: RelationToolOptions): ToolIn
|
|
|
882
899
|
export declare function createToolFunction(tools: ToolManagerInterface, name: string): WorkflowFunction;
|
|
883
900
|
|
|
884
901
|
/**
|
|
885
|
-
* Compiles the lenient workflow draft contract
|
|
902
|
+
* Compiles the lenient workflow draft contract {@link createWorkflowTool} parses an authored tree
|
|
903
|
+
* with — a `ContractInterface` over a {@link WorkflowDraft}, whose `id` and `name` are optional at
|
|
904
|
+
* the workflow, phase, and task levels.
|
|
886
905
|
*
|
|
887
906
|
* @returns The compiled {@link import('./types.js').WorkflowDraft} contract
|
|
888
907
|
*/
|
|
@@ -918,34 +937,33 @@ export declare function createWorkflowDraftContract(): ContractInterface<Workflo
|
|
|
918
937
|
export declare function createWorkflowFunctions(runner: WorkflowRunnerInterface, options?: WorkflowToolOptions): WorkflowRegistry;
|
|
919
938
|
|
|
920
939
|
/**
|
|
921
|
-
* Wraps a {@link WorkflowDefinition} as an LLM-callable tool — it
|
|
922
|
-
*
|
|
923
|
-
*
|
|
924
|
-
*
|
|
925
|
-
* named functions and native checkpoint store.
|
|
940
|
+
* Wraps a {@link WorkflowDefinition} as an LLM-callable tool — it advertises the flat authoring
|
|
941
|
+
* shape (`{ name?, steps: [{ name }] }`) as its `parameters`, and its handler completes the
|
|
942
|
+
* authored blob, validates it against the strict contract, and runs it through `runner`, forwarding
|
|
943
|
+
* the caller's optional named functions and native checkpoint store.
|
|
926
944
|
*
|
|
927
945
|
* @remarks
|
|
928
946
|
* A plain `ToolManagerInterface`-compatible tool (`@orkestrel/tool`), reproducing
|
|
929
947
|
* Toolbox's flat / draft / full authoring contract, strict soundness gate, and lineage guard.
|
|
930
|
-
* It is
|
|
948
|
+
* It is also the propagation carrier
|
|
931
949
|
* {@link createAgentFunction} binds onto a wrapped agent's `context.tools`: because a tool
|
|
932
950
|
* handler receives only the model-supplied `args`, the immutable lineage is closed over at bind
|
|
933
951
|
* time. The authored target is appended and its zero-based depth derived from workflow tags.
|
|
934
952
|
*
|
|
935
|
-
* **Widened authoring surface (additive — the canonical contract
|
|
936
|
-
* unchanged).** A 2B model reliably
|
|
937
|
-
*
|
|
938
|
-
* So the tool
|
|
953
|
+
* **Widened authoring surface (additive — the canonical contract and runner stay strict and
|
|
954
|
+
* unchanged).** A 2B model reliably calls the tool but cannot reliably emit the full nested
|
|
955
|
+
* {@link WorkflowDefinition}, whose every `id` and `name` is required across an all-or-nothing
|
|
956
|
+
* tree. So the tool accepts the authoring forms that follow and converges them on the same strict
|
|
939
957
|
* `createWorkflowContract` gate before running (soundness preserved):
|
|
940
|
-
* - the
|
|
958
|
+
* - the flat shape `{ name?, steps: [{ name }] }` — the advertised `parameters` (the simplest
|
|
941
959
|
* form, {@link import('./helpers.js').expandSteps}'d into one one-task phase per step);
|
|
942
|
-
* - a nested
|
|
960
|
+
* - a nested draft with any `id`/`name` omitted — {@link createWorkflowDraftContract}-parsed then
|
|
943
961
|
* {@link import('./helpers.js').completeDraft}'d (missing ids synthesized positionally);
|
|
944
962
|
* - the full nested {@link WorkflowDefinition} — the advanced escape-hatch, accepted as the draft
|
|
945
963
|
* super-set.
|
|
946
964
|
*
|
|
947
965
|
* The universal tool-handler contract: returns the plain run summary
|
|
948
|
-
* (`{ status, count, durable?, fault? }`) on success,
|
|
966
|
+
* (`{ status, count, durable?, fault? }`) on success, throws a typed `ToolboxError` on Toolbox
|
|
949
967
|
* boundary failures — malformed authored args (`TOOL`), or an over-deep / cyclic nested run
|
|
950
968
|
* (`DEPTH`) — and preserves genuine runner `WorkflowError`s. The `ToolManagerInterface` isolates every throw into the canonical tool result's
|
|
951
969
|
* top-level `error`, so nothing escapes the run. `options.lineage` is the propagation carrier
|
|
@@ -959,6 +977,34 @@ export declare function createWorkflowFunctions(runner: WorkflowRunnerInterface,
|
|
|
959
977
|
* @returns A `ToolInterface` (named {@link import('./constants.js').WORKFLOW_TOOL_NAME}) whose
|
|
960
978
|
* `parameters` advertise the flat authoring schema
|
|
961
979
|
*
|
|
980
|
+
* @example Authoring and running a workflow through the tool with a real ToolManager
|
|
981
|
+
* ```ts
|
|
982
|
+
* import { createWorkflowTool } from '@orkestrel/toolbox'
|
|
983
|
+
* import { createToolManager } from '@orkestrel/tool'
|
|
984
|
+
* import { createWorkflowRunner } from '@orkestrel/workflow'
|
|
985
|
+
* import type { WorkflowDefinition } from '@orkestrel/workflow'
|
|
986
|
+
*
|
|
987
|
+
* const definition: WorkflowDefinition = { id: 'release', name: 'Release', phases: [] }
|
|
988
|
+
* const runner = createWorkflowRunner()
|
|
989
|
+
* const functions = {
|
|
990
|
+
* compile: () => 'compiled',
|
|
991
|
+
* publish: () => 'published',
|
|
992
|
+
* }
|
|
993
|
+
* const tool = createWorkflowTool(definition, runner, { functions })
|
|
994
|
+
*
|
|
995
|
+
* const tools = createToolManager()
|
|
996
|
+
* tools.add(tool)
|
|
997
|
+
*
|
|
998
|
+
* // A small model authors the simple flat shape — no ids/names required.
|
|
999
|
+
* const result = await tools.execute({
|
|
1000
|
+
* id: 'call-1',
|
|
1001
|
+
* name: 'workflow',
|
|
1002
|
+
* arguments: { name: 'release', steps: [{ name: 'compile' }, { name: 'publish' }] },
|
|
1003
|
+
* })
|
|
1004
|
+
* if (!result.success) throw new Error(result.error)
|
|
1005
|
+
* result.value // { status: 'completed', count: 2 } — the single-level envelope; no nested { id, name, value }
|
|
1006
|
+
* ```
|
|
1007
|
+
*
|
|
962
1008
|
* @example
|
|
963
1009
|
* ```ts
|
|
964
1010
|
* import { createWorkflowTool } from '@src/core'
|
|
@@ -975,42 +1021,35 @@ export declare function createWorkflowFunctions(runner: WorkflowRunnerInterface,
|
|
|
975
1021
|
export declare function createWorkflowTool(definition: WorkflowDefinition, runner: WorkflowRunnerInterface, options?: WorkflowToolOptions): ToolInterface;
|
|
976
1022
|
|
|
977
1023
|
/**
|
|
978
|
-
* Builds an LLM-callable workspace-editing tool — it
|
|
979
|
-
*
|
|
980
|
-
*
|
|
981
|
-
*
|
|
982
|
-
* returning the plain result. A malformed operation throws this package's `ToolboxError`; a
|
|
983
|
-
* genuine workspace-domain failure propagates `@orkestrel/workspace`'s typed `WorkspaceError`.
|
|
984
|
-
* EITHER drives a caller-supplied {@link WorkspaceToolOptions.manager} directly, OR
|
|
985
|
-
* constructs a fresh `WorkspaceManagerInterface` (`@orkestrel/workspace`) over
|
|
986
|
-
* {@link import('./types.js').WorkspaceToolOptions.store} (through `@orkestrel/workspace`'s
|
|
987
|
-
* `createWorkspaceManager`); neither given constructs a manager backed by
|
|
988
|
-
* `@orkestrel/workspace`'s in-memory store default.
|
|
1024
|
+
* Builds an LLM-callable workspace-editing tool — it advertises the `operation`-discriminated union
|
|
1025
|
+
* ({@link import('./shapers.js').workspaceToolShape}) as its `parameters`, and its handler parses
|
|
1026
|
+
* the model-supplied args against that contract and dispatches the matched operation against the
|
|
1027
|
+
* manager's active workspace, returning the plain result.
|
|
989
1028
|
*
|
|
990
1029
|
* @remarks
|
|
991
|
-
*
|
|
1030
|
+
* Manager-driven: every edit / read op (read / list / has / search / replace / write / splice /
|
|
992
1031
|
* prepend / append / move / remove) targets `manager.active`, so the model edits whichever
|
|
993
1032
|
* workspace is active and a host can re-point it (`WorkspaceManagerInterface.switch`) between
|
|
994
|
-
* turns.
|
|
1033
|
+
* turns. The registry ops make the model self-sufficient: `workspaces` lists the registered
|
|
995
1034
|
* workspaces (each `{ id, files, active }`) so it can discover an id, and `switch` re-points the
|
|
996
1035
|
* active workspace by id (lenient — an unknown id is a no-op reporting `switched: false`, never a
|
|
997
1036
|
* throw).
|
|
998
1037
|
*
|
|
999
|
-
*
|
|
1000
|
-
* remove / replace) run when `manager.active` is `undefined`
|
|
1001
|
-
* workspace (`manager.add()`) so the model can start writing; a pure-
|
|
1002
|
-
* has / search) against no active workspace returns the
|
|
1038
|
+
* No-active rule (the ergonomic seam): a writing op (write / splice / prepend / append / move /
|
|
1039
|
+
* remove / replace) run when `manager.active` is `undefined` auto-creates and activates a default
|
|
1040
|
+
* workspace (`manager.add()`) so the model can start writing; a pure-read op (read / list /
|
|
1041
|
+
* has / search) against no active workspace returns the empty result (`undefined` / `[]` /
|
|
1003
1042
|
* `false`), never creating one and never throwing.
|
|
1004
1043
|
*
|
|
1005
1044
|
* The handler conforms to the universal tool-handler contract: it `contract.parse`s
|
|
1006
|
-
* the args,
|
|
1007
|
-
* operation), else `switch`es on `op.operation` and
|
|
1045
|
+
* the args, throws a `TOOL` `ToolboxError` when no operation arm matched (a malformed / unknown
|
|
1046
|
+
* operation), else `switch`es on `op.operation` and returns the plain result — letting a
|
|
1008
1047
|
* `WorkspaceError` raised by the live workspace (`MISSING` / `MODALITY` / `PATTERN` / `RANGE`)
|
|
1009
|
-
*
|
|
1048
|
+
* propagate uncaught. The range edit is the flat `'splice'` op: its flat caret integers are
|
|
1010
1049
|
* reassembled into a `Range` (`@orkestrel/workspace`) by `rangeOf` and fed to the workspace's
|
|
1011
1050
|
* ranged `write`.
|
|
1012
1051
|
*
|
|
1013
|
-
* @param options - `manager` (drive directly)
|
|
1052
|
+
* @param options - `manager` (drive directly) or `store` (build a manager over it); neither ⇒
|
|
1014
1053
|
* an in-memory-backed manager (see {@link import('./types.js').WorkspaceToolOptions})
|
|
1015
1054
|
* @returns A `ToolInterface` (named {@link import('./constants.js').WORKSPACE_TOOL_NAME} by default)
|
|
1016
1055
|
*
|
|
@@ -1028,44 +1067,54 @@ export declare function createWorkspaceTool(options?: WorkspaceToolOptions): Too
|
|
|
1028
1067
|
|
|
1029
1068
|
/**
|
|
1030
1069
|
* Holds the description {@link import('./factories.js').createDatabaseTool} advertises — a
|
|
1031
|
-
* multi-line guide that teaches a small model the operation list, the
|
|
1070
|
+
* multi-line guide that teaches a small model the operation list, the serialized query form, and
|
|
1032
1071
|
* the {@link import('./types.js').TableSpec} column DSL.
|
|
1033
1072
|
*
|
|
1034
1073
|
* @remarks
|
|
1035
|
-
* The query form is deliberately
|
|
1036
|
-
* `{ column, operator, values, connector? }` where `values` is
|
|
1074
|
+
* The query form is deliberately serialized (never fluent) — every condition is a flat object
|
|
1075
|
+
* `{ column, operator, values, connector? }` where `values` is always an array, even for a
|
|
1037
1076
|
* single-value operator (`{ column: 'age', operator: 'from', values: [18] }`), so a small model
|
|
1038
1077
|
* never has to chain method calls or guess whether a value is scalar or a list.
|
|
1039
1078
|
*/
|
|
1040
1079
|
export declare const DATABASE_TOOL_DESCRIPTION: string;
|
|
1041
1080
|
|
|
1042
|
-
/**
|
|
1081
|
+
/**
|
|
1082
|
+
* Holds the default cap on rows a `records` call returns when the caller omits `query.limit`,
|
|
1083
|
+
* `1000` — the database tool's default row ceiling.
|
|
1084
|
+
*/
|
|
1043
1085
|
export declare const DATABASE_TOOL_LIMIT = 1000;
|
|
1044
1086
|
|
|
1045
1087
|
/** Lists the runtime-frozen database-tool mutation names disabled by `DatabaseToolOptions.readonly`. */
|
|
1046
1088
|
export declare const DATABASE_TOOL_MUTATIONS: readonly string[];
|
|
1047
1089
|
|
|
1048
1090
|
/**
|
|
1049
|
-
* Holds the name {@link import('./factories.js').createDatabaseTool} advertises by default
|
|
1050
|
-
* a model calls and the `ToolManagerInterface` (`@orkestrel/tool`) registers
|
|
1091
|
+
* Holds the name {@link import('./factories.js').createDatabaseTool} advertises by default,
|
|
1092
|
+
* `'database'` — the key a model calls and the `ToolManagerInterface` (`@orkestrel/tool`) registers
|
|
1093
|
+
* under.
|
|
1051
1094
|
*/
|
|
1052
1095
|
export declare const DATABASE_TOOL_NAME = "database";
|
|
1053
1096
|
|
|
1054
1097
|
/**
|
|
1055
1098
|
* Holds the lean {@link import('@orkestrel/tool').ToolInterface.summary}
|
|
1056
1099
|
* {@link import('./factories.js').createDatabaseTool} advertises in place of
|
|
1057
|
-
* {@link DATABASE_TOOL_DESCRIPTION}
|
|
1100
|
+
* {@link DATABASE_TOOL_DESCRIPTION} — one sentence offering the `operation`-keyed database call and
|
|
1101
|
+
* pointing at `describe` for the operation list, the query form, and the column DSL.
|
|
1102
|
+
*
|
|
1103
|
+
* @remarks
|
|
1104
|
+
* A `ToolManagerInterface.definitions()` call (`@orkestrel/tool`) advertises
|
|
1105
|
+
* `summary ?? description`, so this one-sentence text stands in for the full teaching description;
|
|
1106
|
+
* the full text stays retrievable through {@link import('./factories.js').createDescribeTool}.
|
|
1058
1107
|
*/
|
|
1059
1108
|
export declare const DATABASE_TOOL_SUMMARY = "Create and query a database \u2014 one operation per call (create, tables, get, records, count, aggregate, add, set, update, remove, destroy), chosen by the 'operation' field. Call describe('database') for the full operation list, the query form, and the column DSL.";
|
|
1060
1109
|
|
|
1061
1110
|
/**
|
|
1062
|
-
* Represents one database's
|
|
1063
|
-
* `primary`, `indexes`, and `version` schema configuration.
|
|
1111
|
+
* Represents one database's config-only definition — an `id`, a `driver`, and a {@link TableSpec},
|
|
1112
|
+
* with optional `primary`, `indexes`, and `version` schema configuration.
|
|
1064
1113
|
*
|
|
1065
1114
|
* @remarks
|
|
1066
|
-
* A `DatabaseDefinition` is
|
|
1115
|
+
* A `DatabaseDefinition` is never a live handle — it is the durable, serializable config a
|
|
1067
1116
|
* {@link DefinitionStoreInterface} persists and a tool factory turns into a real
|
|
1068
|
-
* `@orkestrel/database` `DatabaseInterface` (through `createDatabase`
|
|
1117
|
+
* `@orkestrel/database` `DatabaseInterface` (through `createDatabase` and {@link import('./compilers.js').expandTables})
|
|
1069
1118
|
* on demand. `primary` maps table names to primary-key columns; `indexes` maps table names to
|
|
1070
1119
|
* index column groups; `version` opts a capable driver into open-time schema reconciliation.
|
|
1071
1120
|
*/
|
|
@@ -1078,7 +1127,7 @@ export declare interface DatabaseDefinition {
|
|
|
1078
1127
|
readonly version?: number;
|
|
1079
1128
|
}
|
|
1080
1129
|
|
|
1081
|
-
/** Represents one opaque persisted row — the shape a `TableInterface
|
|
1130
|
+
/** Represents one opaque persisted row — the shape a definition-row-backed `TableInterface` store reads/writes; `definition` is narrowed with {@link import('./validators.js').isDatabaseDefinition} on read. */
|
|
1082
1131
|
export declare interface DatabaseDefinitionRow {
|
|
1083
1132
|
readonly id: string;
|
|
1084
1133
|
readonly definition: unknown;
|
|
@@ -1086,25 +1135,25 @@ export declare interface DatabaseDefinitionRow {
|
|
|
1086
1135
|
|
|
1087
1136
|
/**
|
|
1088
1137
|
* Represents a {@link DefinitionStoreInterface} backed by one table of the `@orkestrel/database` layer — a
|
|
1089
|
-
* database's durable
|
|
1138
|
+
* database's durable config state is a row, so persistence reduces to keyed point-access
|
|
1090
1139
|
* (`get` / `set` / `delete`) over a {@link TableInterface}, the driver-pluggable twin of the
|
|
1091
1140
|
* plain-`Map` {@link import('./MemoryDefinitionStore.js').MemoryDefinitionStore}.
|
|
1092
1141
|
*
|
|
1093
1142
|
* @remarks
|
|
1094
1143
|
* The store is driver-agnostic: it holds a single {@link TableInterface} whose backend (memory,
|
|
1095
1144
|
* JSON, SQLite, IndexedDB) is chosen by whoever builds it (the factories), so a JSON / SQLite /
|
|
1096
|
-
* IndexedDB backend swaps in
|
|
1145
|
+
* IndexedDB backend swaps in without touching a consumer — the same seam as
|
|
1097
1146
|
* {@link import('./MemoryDefinitionStore.js').MemoryDefinitionStore}. The driver defaults to
|
|
1098
1147
|
* memory ({@link import('../factories.js').createDatabaseDefinitionStore} passes
|
|
1099
|
-
* `createMemoryDriver()`), so it
|
|
1148
|
+
* `createMemoryDriver()`), so it also works in memory out of the box; you opt into the durable
|
|
1100
1149
|
* plumbing by passing a JSON / SQLite / IndexedDB driver.
|
|
1101
1150
|
*
|
|
1102
|
-
* The {@link DatabaseDefinition} is stored as
|
|
1103
|
-
* `{ id; definition }` ({@link DatabaseDefinitionRow}). The definition is already a
|
|
1104
|
-
* self-contained, pure-JSON
|
|
1105
|
-
*
|
|
1151
|
+
* The {@link DatabaseDefinition} is stored as one opaque JSON column — the table is a row of
|
|
1152
|
+
* `{ id; definition }` ({@link DatabaseDefinitionRow}). The definition is already a complete,
|
|
1153
|
+
* self-contained, pure-JSON config payload (never a live handle), so storing it whole is lossless
|
|
1154
|
+
* and keeps the row type flat (`definition` reads back as `unknown`).
|
|
1106
1155
|
*
|
|
1107
|
-
* - **`set(definition)` upserts under the definition's
|
|
1156
|
+
* - **`set(definition)` upserts under the definition's own `id`** (no separate id param) — it
|
|
1108
1157
|
* writes the row `{ id: definition.id, definition }`.
|
|
1109
1158
|
* - **`get(id)` resolves the stored definition for an id**, narrowing the opaque JSON column back
|
|
1110
1159
|
* to a {@link DatabaseDefinition} ({@link import('../validators.js').isDatabaseDefinition} — the
|
|
@@ -1112,7 +1161,7 @@ export declare interface DatabaseDefinitionRow {
|
|
|
1112
1161
|
* or the stored blob is malformed.
|
|
1113
1162
|
* - **`delete(id)` drops a definition by id**; an absent id is a no-op (no throw).
|
|
1114
1163
|
*
|
|
1115
|
-
* The public surface is
|
|
1164
|
+
* The public surface is exactly `get` / `set` / `delete` — no extra members (the method
|
|
1116
1165
|
* bijection with {@link DefinitionStoreInterface}).
|
|
1117
1166
|
*
|
|
1118
1167
|
* @example
|
|
@@ -1144,30 +1193,29 @@ export declare class DatabaseDefinitionStore implements DefinitionStoreInterface
|
|
|
1144
1193
|
*/
|
|
1145
1194
|
get(id: string): Promise<DatabaseDefinition | undefined>;
|
|
1146
1195
|
/**
|
|
1147
|
-
* Inserts or replaces a definition under its
|
|
1196
|
+
* Inserts or replaces a definition under its own `id` — the written row is `{ id, definition }`.
|
|
1148
1197
|
*
|
|
1149
1198
|
* @param definition - The config to persist; its own `id` is the row key (no separate id param)
|
|
1150
|
-
* @returns A promise settling
|
|
1199
|
+
* @returns A promise settling after the row is written
|
|
1151
1200
|
*/
|
|
1152
1201
|
set(definition: DatabaseDefinition): Promise<void>;
|
|
1153
1202
|
/**
|
|
1154
1203
|
* Drops the definition stored under `id`.
|
|
1155
1204
|
*
|
|
1156
1205
|
* @param id - The database id to drop; an absent id is a no-op, never a throw
|
|
1157
|
-
* @returns A promise settling
|
|
1206
|
+
* @returns A promise settling after no row is stored under `id`
|
|
1158
1207
|
*/
|
|
1159
1208
|
delete(id: string): Promise<void>;
|
|
1160
1209
|
}
|
|
1161
1210
|
|
|
1162
1211
|
/**
|
|
1163
|
-
* Represents the
|
|
1164
|
-
* {@link import('./shapers.js').queryShape}, which
|
|
1165
|
-
*
|
|
1166
|
-
* {@link QueryInput}.
|
|
1212
|
+
* Represents the serialized wire query a database-tool call carries — the parsed form of
|
|
1213
|
+
* {@link import('./shapers.js').queryShape}, which {@link import('./helpers.js').normalizeQuery}
|
|
1214
|
+
* normalizes into a live `@orkestrel/database` `QueryInput`.
|
|
1167
1215
|
*
|
|
1168
1216
|
* @remarks
|
|
1169
|
-
* Every condition is
|
|
1170
|
-
* `connector` is optional because the
|
|
1217
|
+
* Every condition is flat and its `values` is always an array, even for a single-value operator.
|
|
1218
|
+
* `connector` is optional because the last condition joins nothing forward; `normalizeQuery` defaults an
|
|
1171
1219
|
* omitted one to `'and'`. `order` / `limit` / `offset` carry over to the live query unchanged.
|
|
1172
1220
|
*/
|
|
1173
1221
|
export declare interface DatabaseQueryInput {
|
|
@@ -1186,7 +1234,8 @@ export declare interface DatabaseQueryInput {
|
|
|
1186
1234
|
}
|
|
1187
1235
|
|
|
1188
1236
|
/**
|
|
1189
|
-
* Resolves database
|
|
1237
|
+
* Resolves a database definition into a cached live handle for a database tool, over the tool's
|
|
1238
|
+
* live handles, its stored definitions, its driver registry, and an optional key generator.
|
|
1190
1239
|
*
|
|
1191
1240
|
* @example
|
|
1192
1241
|
* ```ts
|
|
@@ -1237,7 +1286,8 @@ export declare class DatabaseResolver {
|
|
|
1237
1286
|
*/
|
|
1238
1287
|
delete(id: string): void;
|
|
1239
1288
|
/**
|
|
1240
|
-
* Resolves a cached
|
|
1289
|
+
* Resolves a live database by id — the cached handle when one exists, otherwise a database
|
|
1290
|
+
* constructed from its stored definition.
|
|
1241
1291
|
*
|
|
1242
1292
|
* @param id - Database definition id
|
|
1243
1293
|
* @returns The cached or newly constructed live database
|
|
@@ -1254,7 +1304,7 @@ export declare class DatabaseResolver {
|
|
|
1254
1304
|
* caller-constructed database it manages alongside store-backed ones); keyed by the id a
|
|
1255
1305
|
* call's `id` field addresses.
|
|
1256
1306
|
* - `store` — the {@link DefinitionStoreInterface} the `'create'` operation persists its
|
|
1257
|
-
* {@link DatabaseDefinition}
|
|
1307
|
+
* {@link DatabaseDefinition} config through, and `'destroy'` deletes from; also the source
|
|
1258
1308
|
* `'get'`/every other operation resolves an id from when it isn't already cached. Omitted means
|
|
1259
1309
|
* no persistence — a database created without a store lives only for the tool's lifetime.
|
|
1260
1310
|
* - `drivers` — registry of driver-name to `() => DriverInterface` factories a `'create'` call's
|
|
@@ -1291,9 +1341,8 @@ export declare interface DatabaseToolOptions {
|
|
|
1291
1341
|
|
|
1292
1342
|
/**
|
|
1293
1343
|
* Describes the shape of {@link import('./factories.js').createDatabaseTool}'s call arguments —
|
|
1294
|
-
* discriminated by `operation` into the
|
|
1295
|
-
* `'
|
|
1296
|
-
* `'remove'` / `'destroy'`).
|
|
1344
|
+
* discriminated by `operation` into the database operations `'create'`, `'tables'`, `'get'`,
|
|
1345
|
+
* `'records'`, `'count'`, `'aggregate'`, `'add'`, `'set'`, `'update'`, `'remove'`, and `'destroy'`.
|
|
1297
1346
|
*
|
|
1298
1347
|
* @remarks
|
|
1299
1348
|
* Every arm carries `id` (the database id). `'create'` carries `tables` (the
|
|
@@ -1301,120 +1350,123 @@ export declare interface DatabaseToolOptions {
|
|
|
1301
1350
|
* {@link import('./compilers.js').expandTables}); `'get'` / `'update'` / `'remove'` carry `key`
|
|
1302
1351
|
* (one key or an array of keys, positional); `'add'` / `'set'` carry `row` (one row or an array of
|
|
1303
1352
|
* rows); `'update'` also carries `changes` (a loose partial row); `'records'` / `'count'` /
|
|
1304
|
-
* `'aggregate'` carry an optional `query` (the
|
|
1353
|
+
* `'aggregate'` carry an optional `query` (the serialized form — `values` is always an array,
|
|
1305
1354
|
* even for a single-value operator, so a caller never chains method calls or guesses arity).
|
|
1306
1355
|
*/
|
|
1307
|
-
export declare const databaseToolShape: UnionShape<readonly [
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
|
|
1314
|
-
|
|
1315
|
-
|
|
1316
|
-
|
|
1317
|
-
|
|
1318
|
-
|
|
1319
|
-
|
|
1320
|
-
}, false>, ObjectShape<{
|
|
1321
|
-
|
|
1322
|
-
|
|
1323
|
-
}, false>, ObjectShape<{
|
|
1324
|
-
|
|
1325
|
-
|
|
1326
|
-
|
|
1327
|
-
|
|
1328
|
-
}, false>, ObjectShape<{
|
|
1329
|
-
|
|
1330
|
-
|
|
1331
|
-
|
|
1332
|
-
|
|
1333
|
-
|
|
1334
|
-
|
|
1335
|
-
|
|
1336
|
-
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
|
|
1341
|
-
|
|
1342
|
-
|
|
1343
|
-
|
|
1344
|
-
|
|
1345
|
-
|
|
1346
|
-
}, false>, ObjectShape<{
|
|
1347
|
-
|
|
1348
|
-
|
|
1349
|
-
|
|
1350
|
-
|
|
1351
|
-
|
|
1352
|
-
|
|
1353
|
-
|
|
1354
|
-
|
|
1355
|
-
|
|
1356
|
-
|
|
1357
|
-
|
|
1358
|
-
|
|
1359
|
-
|
|
1360
|
-
|
|
1361
|
-
|
|
1362
|
-
|
|
1363
|
-
|
|
1364
|
-
}, false>, ObjectShape<{
|
|
1365
|
-
|
|
1366
|
-
|
|
1367
|
-
|
|
1368
|
-
|
|
1369
|
-
|
|
1370
|
-
|
|
1371
|
-
|
|
1372
|
-
|
|
1373
|
-
|
|
1374
|
-
|
|
1375
|
-
|
|
1376
|
-
|
|
1377
|
-
|
|
1378
|
-
|
|
1379
|
-
|
|
1380
|
-
|
|
1381
|
-
|
|
1382
|
-
|
|
1383
|
-
|
|
1384
|
-
}, false>, ObjectShape<{
|
|
1385
|
-
|
|
1386
|
-
|
|
1387
|
-
|
|
1388
|
-
|
|
1389
|
-
}, false>, ObjectShape<{
|
|
1390
|
-
|
|
1391
|
-
|
|
1392
|
-
|
|
1393
|
-
|
|
1394
|
-
}, false>, ObjectShape<{
|
|
1395
|
-
|
|
1396
|
-
|
|
1397
|
-
|
|
1398
|
-
|
|
1399
|
-
|
|
1400
|
-
}, false>, ObjectShape<{
|
|
1401
|
-
|
|
1402
|
-
|
|
1403
|
-
|
|
1404
|
-
|
|
1405
|
-
}, false>, ObjectShape<{
|
|
1406
|
-
|
|
1407
|
-
|
|
1356
|
+
export declare const databaseToolShape: UnionShape<readonly [ObjectShape< {
|
|
1357
|
+
operation: LiteralShape<readonly ["create"]>;
|
|
1358
|
+
id: StringShape;
|
|
1359
|
+
tables: ObjectShape<Record<never, never>, ObjectShape< {
|
|
1360
|
+
columns: ObjectShape<Record<never, never>, UnionShape<readonly [LiteralShape<readonly ["string", "integer", "number", "boolean"]>, ObjectShape< {
|
|
1361
|
+
primitive: LiteralShape<readonly ["string", "integer", "number", "boolean"]>;
|
|
1362
|
+
optional: OptionalShape<BooleanShape>;
|
|
1363
|
+
}, false>]>>;
|
|
1364
|
+
}, false>>;
|
|
1365
|
+
driver: OptionalShape<StringShape>;
|
|
1366
|
+
primary: OptionalShape<ObjectShape<Record<never, never>, StringShape>>;
|
|
1367
|
+
indexes: OptionalShape<ObjectShape<Record<never, never>, ArrayShape<ArrayShape<StringShape>>>>;
|
|
1368
|
+
version: OptionalShape<NumberShape>;
|
|
1369
|
+
}, false>, ObjectShape< {
|
|
1370
|
+
operation: LiteralShape<readonly ["tables"]>;
|
|
1371
|
+
id: StringShape;
|
|
1372
|
+
}, false>, ObjectShape< {
|
|
1373
|
+
operation: LiteralShape<readonly ["get"]>;
|
|
1374
|
+
id: StringShape;
|
|
1375
|
+
table: StringShape;
|
|
1376
|
+
key: UnionShape<readonly [ArrayShape<UnionShape<readonly [StringShape, NumberShape]>>, StringShape, NumberShape]>;
|
|
1377
|
+
}, false>, ObjectShape< {
|
|
1378
|
+
operation: LiteralShape<readonly ["records"]>;
|
|
1379
|
+
id: StringShape;
|
|
1380
|
+
table: StringShape;
|
|
1381
|
+
query: OptionalShape<ObjectShape< {
|
|
1382
|
+
conditions: OptionalShape<ArrayShape<ObjectShape< {
|
|
1383
|
+
column: StringShape;
|
|
1384
|
+
operator: LiteralShape<readonly ["equals", "not", "above", "below", "from", "to", "between", "like", "glob", "starts", "ends", "any", "none", "absent", "present"]>;
|
|
1385
|
+
values: ArrayShape<JSONShape>;
|
|
1386
|
+
connector: OptionalShape<LiteralShape<readonly ["and", "or"]>>;
|
|
1387
|
+
}, false>>>;
|
|
1388
|
+
order: OptionalShape<ArrayShape<ObjectShape< {
|
|
1389
|
+
column: StringShape;
|
|
1390
|
+
direction: LiteralShape<readonly ["ascending", "descending"]>;
|
|
1391
|
+
}, false>>>;
|
|
1392
|
+
limit: OptionalShape<NumberShape>;
|
|
1393
|
+
offset: OptionalShape<NumberShape>;
|
|
1394
|
+
}, false>>;
|
|
1395
|
+
}, false>, ObjectShape< {
|
|
1396
|
+
operation: LiteralShape<readonly ["count"]>;
|
|
1397
|
+
id: StringShape;
|
|
1398
|
+
table: StringShape;
|
|
1399
|
+
query: OptionalShape<ObjectShape< {
|
|
1400
|
+
conditions: OptionalShape<ArrayShape<ObjectShape< {
|
|
1401
|
+
column: StringShape;
|
|
1402
|
+
operator: LiteralShape<readonly ["equals", "not", "above", "below", "from", "to", "between", "like", "glob", "starts", "ends", "any", "none", "absent", "present"]>;
|
|
1403
|
+
values: ArrayShape<JSONShape>;
|
|
1404
|
+
connector: OptionalShape<LiteralShape<readonly ["and", "or"]>>;
|
|
1405
|
+
}, false>>>;
|
|
1406
|
+
order: OptionalShape<ArrayShape<ObjectShape< {
|
|
1407
|
+
column: StringShape;
|
|
1408
|
+
direction: LiteralShape<readonly ["ascending", "descending"]>;
|
|
1409
|
+
}, false>>>;
|
|
1410
|
+
limit: OptionalShape<NumberShape>;
|
|
1411
|
+
offset: OptionalShape<NumberShape>;
|
|
1412
|
+
}, false>>;
|
|
1413
|
+
}, false>, ObjectShape< {
|
|
1414
|
+
operation: LiteralShape<readonly ["aggregate"]>;
|
|
1415
|
+
id: StringShape;
|
|
1416
|
+
table: StringShape;
|
|
1417
|
+
function: LiteralShape<readonly ["count", "sum", "average", "minimum", "maximum"]>;
|
|
1418
|
+
column: StringShape;
|
|
1419
|
+
query: OptionalShape<ObjectShape< {
|
|
1420
|
+
conditions: OptionalShape<ArrayShape<ObjectShape< {
|
|
1421
|
+
column: StringShape;
|
|
1422
|
+
operator: LiteralShape<readonly ["equals", "not", "above", "below", "from", "to", "between", "like", "glob", "starts", "ends", "any", "none", "absent", "present"]>;
|
|
1423
|
+
values: ArrayShape<JSONShape>;
|
|
1424
|
+
connector: OptionalShape<LiteralShape<readonly ["and", "or"]>>;
|
|
1425
|
+
}, false>>>;
|
|
1426
|
+
order: OptionalShape<ArrayShape<ObjectShape< {
|
|
1427
|
+
column: StringShape;
|
|
1428
|
+
direction: LiteralShape<readonly ["ascending", "descending"]>;
|
|
1429
|
+
}, false>>>;
|
|
1430
|
+
limit: OptionalShape<NumberShape>;
|
|
1431
|
+
offset: OptionalShape<NumberShape>;
|
|
1432
|
+
}, false>>;
|
|
1433
|
+
}, false>, ObjectShape< {
|
|
1434
|
+
operation: LiteralShape<readonly ["add"]>;
|
|
1435
|
+
id: StringShape;
|
|
1436
|
+
table: StringShape;
|
|
1437
|
+
row: UnionShape<readonly [ArrayShape<ObjectShape<Record<never, never>, JSONShape>>, ObjectShape<Record<never, never>, JSONShape>]>;
|
|
1438
|
+
}, false>, ObjectShape< {
|
|
1439
|
+
operation: LiteralShape<readonly ["set"]>;
|
|
1440
|
+
id: StringShape;
|
|
1441
|
+
table: StringShape;
|
|
1442
|
+
row: UnionShape<readonly [ArrayShape<ObjectShape<Record<never, never>, JSONShape>>, ObjectShape<Record<never, never>, JSONShape>]>;
|
|
1443
|
+
}, false>, ObjectShape< {
|
|
1444
|
+
operation: LiteralShape<readonly ["update"]>;
|
|
1445
|
+
id: StringShape;
|
|
1446
|
+
table: StringShape;
|
|
1447
|
+
key: UnionShape<readonly [ArrayShape<UnionShape<readonly [StringShape, NumberShape]>>, StringShape, NumberShape]>;
|
|
1448
|
+
changes: ObjectShape<Record<never, never>, JSONShape>;
|
|
1449
|
+
}, false>, ObjectShape< {
|
|
1450
|
+
operation: LiteralShape<readonly ["remove"]>;
|
|
1451
|
+
id: StringShape;
|
|
1452
|
+
table: StringShape;
|
|
1453
|
+
key: UnionShape<readonly [ArrayShape<UnionShape<readonly [StringShape, NumberShape]>>, StringShape, NumberShape]>;
|
|
1454
|
+
}, false>, ObjectShape< {
|
|
1455
|
+
operation: LiteralShape<readonly ["destroy"]>;
|
|
1456
|
+
id: StringShape;
|
|
1408
1457
|
}, false>]>;
|
|
1409
1458
|
|
|
1410
1459
|
/**
|
|
1411
|
-
* Represents the point-access persistence seam for {@link DatabaseDefinition} configs —
|
|
1412
|
-
*
|
|
1413
|
-
*
|
|
1460
|
+
* Represents the point-access persistence seam for {@link DatabaseDefinition} configs — the twin of
|
|
1461
|
+
* `@orkestrel/terminal`'s `TerminalStoreInterface`, storing a database's config-only blueprint
|
|
1462
|
+
* rather than a live handle. Every primitive is async; `delete` of an absent id is a no-op.
|
|
1414
1463
|
*/
|
|
1415
1464
|
export declare interface DefinitionStoreInterface {
|
|
1465
|
+
/** Resolves the persisted definition for `id`, or `undefined` when none is stored. */
|
|
1416
1466
|
get(id: string): Promise<DatabaseDefinition | undefined>;
|
|
1467
|
+
/** Inserts or replaces a definition under its own `id`, taking no separate id argument. */
|
|
1417
1468
|
set(definition: DatabaseDefinition): Promise<void>;
|
|
1469
|
+
/** Drops the definition for `id`, treating an absent id as a no-op that never throws. */
|
|
1418
1470
|
delete(id: string): Promise<void>;
|
|
1419
1471
|
}
|
|
1420
1472
|
|
|
@@ -1427,7 +1479,8 @@ export declare interface DefinitionStoreInterface {
|
|
|
1427
1479
|
export declare function deriveWorkflowDepth(lineage: WorkflowLineage): number;
|
|
1428
1480
|
|
|
1429
1481
|
/**
|
|
1430
|
-
* Holds the
|
|
1482
|
+
* Holds the description {@link import('./factories.js').createDescribeTool} advertises — the
|
|
1483
|
+
* registered tool `name` it requires, and the full description of that tool it returns.
|
|
1431
1484
|
*
|
|
1432
1485
|
* @remarks
|
|
1433
1486
|
* Deliberately short — unlike the workflow / workspace / agent tools, this one has no authoring
|
|
@@ -1436,8 +1489,9 @@ export declare function deriveWorkflowDepth(lineage: WorkflowLineage): number;
|
|
|
1436
1489
|
export declare const DESCRIBE_TOOL_DESCRIPTION = "Return the full description of a registered tool by its name. Required: name - the registered tool name (see another tool listing for available names).";
|
|
1437
1490
|
|
|
1438
1491
|
/**
|
|
1439
|
-
* Holds the name {@link import('./factories.js').createDescribeTool} advertises by default
|
|
1440
|
-
* model calls and the `ToolManagerInterface` (`@orkestrel/tool`) registers
|
|
1492
|
+
* Holds the name {@link import('./factories.js').createDescribeTool} advertises by default,
|
|
1493
|
+
* `'describe'` — the key a model calls and the `ToolManagerInterface` (`@orkestrel/tool`) registers
|
|
1494
|
+
* under.
|
|
1441
1495
|
*
|
|
1442
1496
|
* @remarks
|
|
1443
1497
|
* Pairs with the lean {@link AGENT_TOOL_SUMMARY} / {@link WORKFLOW_TOOL_SUMMARY} /
|
|
@@ -1455,8 +1509,8 @@ export declare const DESCRIBE_TOOL_NAME = "describe";
|
|
|
1455
1509
|
export declare const DESCRIBE_TOOL_SUMMARY = "Return the full description of a named registered tool.";
|
|
1456
1510
|
|
|
1457
1511
|
/**
|
|
1458
|
-
* Represents the
|
|
1459
|
-
* tool `name` whose full `description` a model wants back.
|
|
1512
|
+
* Represents the flat args {@link import('./factories.js').createDescribeTool} accepts — the
|
|
1513
|
+
* registered tool `name` whose full `description` a model wants back.
|
|
1460
1514
|
*
|
|
1461
1515
|
* @remarks
|
|
1462
1516
|
* `name` must match a tool registered on the {@link import('@orkestrel/tool').ToolManagerInterface}
|
|
@@ -1473,8 +1527,8 @@ export declare interface DescribeToolArguments {
|
|
|
1473
1527
|
* @remarks
|
|
1474
1528
|
* `name` is the only field (a non-empty string) — the registered tool name to look up.
|
|
1475
1529
|
*/
|
|
1476
|
-
export declare const describeToolShape: ObjectShape<{
|
|
1477
|
-
|
|
1530
|
+
export declare const describeToolShape: ObjectShape< {
|
|
1531
|
+
name: StringShape;
|
|
1478
1532
|
}, false>;
|
|
1479
1533
|
|
|
1480
1534
|
/**
|
|
@@ -1483,17 +1537,17 @@ export declare const describeToolShape: ObjectShape<{
|
|
|
1483
1537
|
* `parameters` are inferred from, and the local handler that runs a call.
|
|
1484
1538
|
*
|
|
1485
1539
|
* @remarks
|
|
1486
|
-
* `samples`
|
|
1487
|
-
* typed `TOOL` {@link import('./errors.js').ToolboxError} at
|
|
1488
|
-
*
|
|
1489
|
-
* `true`) `execute` receives the
|
|
1540
|
+
* `samples` must be non-empty — {@link import('./factories.js').createEndpointTool} throws a
|
|
1541
|
+
* typed `TOOL` {@link import('./errors.js').ToolboxError} at construction when it is empty,
|
|
1542
|
+
* because an empty sample set cannot infer a schema. By default ({@link EndpointToolOptions.validate}
|
|
1543
|
+
* `true`) `execute` receives the parsed, normalized args record — a copy of the model-supplied
|
|
1490
1544
|
* `args` with each scalar coerced to its inferred type (for example a number sent for a string slot
|
|
1491
1545
|
* arrives coerced to a string), checked against the same schema advertised as `parameters` — and
|
|
1492
1546
|
* a call with a missing required key or a non-coercible value never reaches `execute` at all (see
|
|
1493
1547
|
* {@link EndpointToolOptions.validate}). With
|
|
1494
|
-
* `validate: false`, `execute` receives the model-supplied `args`
|
|
1548
|
+
* `validate: false`, `execute` receives the model-supplied `args` verbatim (raw passthrough, never
|
|
1495
1549
|
* checked against the inferred schema). Either way `execute`'s return flows back as the tool
|
|
1496
|
-
* call's result; a throw
|
|
1550
|
+
* call's result; a throw propagates uncaught, isolated by the `ToolManagerInterface`
|
|
1497
1551
|
* (`@orkestrel/tool`) into the canonical error envelope. When `samples` are non-object values,
|
|
1498
1552
|
* the advertised schema wraps them under a single required `value` property, so `execute` receives
|
|
1499
1553
|
* an `args` record of the shape `{ value: ... }` — never the bare value.
|
|
@@ -1506,37 +1560,37 @@ export declare interface EndpointDefinition {
|
|
|
1506
1560
|
}
|
|
1507
1561
|
|
|
1508
1562
|
/**
|
|
1509
|
-
* Represents the handler {@link
|
|
1510
|
-
* `@orkestrel/tool`'s `ToolOptions.execute` signature
|
|
1511
|
-
* unknown>>` argument, same `Promise<unknown> | unknown` return) so
|
|
1563
|
+
* Represents the handler {@link EndpointDefinition.execute} implements — it mirrors
|
|
1564
|
+
* `@orkestrel/tool`'s `ToolOptions.execute` signature exactly (the same
|
|
1565
|
+
* `Readonly<Record<string, unknown>>` argument, the same `Promise<unknown> | unknown` return), so
|
|
1512
1566
|
* `execute: (args) => definition.execute(args)` typechecks with zero assertions in
|
|
1513
1567
|
* {@link import('./factories.js').createEndpointTool}.
|
|
1514
1568
|
*/
|
|
1515
1569
|
export declare type EndpointHandler = (args: Readonly<Record<string, unknown>>) => Promise<unknown> | unknown;
|
|
1516
1570
|
|
|
1517
1571
|
/**
|
|
1518
|
-
* Represents the construction-time tuning for {@link import('./factories.js').createEndpointTool} —
|
|
1519
|
-
* inferred `parameters` schema's `format`
|
|
1520
|
-
*
|
|
1572
|
+
* Represents the construction-time tuning for {@link import('./factories.js').createEndpointTool} —
|
|
1573
|
+
* the inferred `parameters` schema's `format` and `enum` constraints, and whether that same schema
|
|
1574
|
+
* is enforced at `execute` time.
|
|
1521
1575
|
*
|
|
1522
1576
|
* @remarks
|
|
1523
1577
|
* `format` / `enum` default to `false`, matching `@orkestrel/contract`'s own
|
|
1524
1578
|
* `ValueToSchemaOptions` defaults. `validate` defaults to `true`: the schema
|
|
1525
|
-
* `createEndpointTool` advertises as `parameters` (`samplesToSchema`
|
|
1526
|
-
* compiled
|
|
1527
|
-
* `ContractInterface` used to `parse` every call's `args` before `execute` runs — a
|
|
1528
|
-
* parse: a scalar value is
|
|
1579
|
+
* `createEndpointTool` advertises as `parameters` (`samplesToSchema` and `schemaToObject`) is
|
|
1580
|
+
* compiled once at construction (through `@orkestrel/contract`'s `schemaToShape`) into a
|
|
1581
|
+
* `ContractInterface` used to `parse` every call's `args` before `execute` runs — a normalizing
|
|
1582
|
+
* parse: a scalar value is coerced to its inferred type where the house parsers coerce (a number
|
|
1529
1583
|
* to/from a numeric string, a boolean from `'1'`/`'0'`/`'true'`/`'false'`/`1`/`0`), so `execute`
|
|
1530
|
-
* receives the
|
|
1584
|
+
* receives the coerced values (for example `7` sent for a string slot arrives at `execute` as `'7'`), not
|
|
1531
1585
|
* the raw call args. A call whose `args` fails to parse — a required key missing, or a value not
|
|
1532
|
-
* coercible to its slot's type —
|
|
1586
|
+
* coercible to its slot's type — throws a typed `TOOL` {@link import('./errors.js').ToolboxError}
|
|
1533
1587
|
* carrying the structured `explain` faults, and `execute` is never called. Beyond that coercion,
|
|
1534
|
-
* enforcement is
|
|
1535
|
-
* annotations (`email`, `date-time`, `uuid`, `uri`, ...) are
|
|
1588
|
+
* enforcement is structural — required keys, `enum` membership, and numeric bounds — `format`
|
|
1589
|
+
* annotations (`email`, `date-time`, `uuid`, `uri`, ...) are never asserted, mirroring
|
|
1536
1590
|
* `@orkestrel/contract`'s own widening-only law for `schemaToShape`: a `format: true`-tuned
|
|
1537
|
-
* endpoint still
|
|
1538
|
-
* the inferred (closed, `additionalProperties: false`) schema is
|
|
1539
|
-
*
|
|
1591
|
+
* endpoint still accepts a non-conforming string in a format-tagged slot. A key not present in
|
|
1592
|
+
* the inferred (closed, `additionalProperties: false`) schema is never a rejection either — it is
|
|
1593
|
+
* silently dropped before `execute` runs (the same leniency `@orkestrel/contract`'s own `parse`
|
|
1540
1594
|
* grants a closed object generally), so `execute` may see fewer keys than the caller sent. Set
|
|
1541
1595
|
* `validate: false` when the endpoint's own handler validates its arguments, or when `samples`
|
|
1542
1596
|
* under-describe the real contract and the normalizing coercion would corrupt a call: the tool's
|
|
@@ -1550,15 +1604,15 @@ export declare interface EndpointToolOptions {
|
|
|
1550
1604
|
}
|
|
1551
1605
|
|
|
1552
1606
|
/**
|
|
1553
|
-
* Expands the relation tool's
|
|
1607
|
+
* Expands the relation tool's flat dot-path `include` list into a live `@orkestrel/relation`
|
|
1554
1608
|
* {@link Include} tree — the pure leaf {@link import('./factories.js').createRelationTool} calls
|
|
1555
1609
|
* before a `'load'` / `'find'` call.
|
|
1556
1610
|
*
|
|
1557
1611
|
* @remarks
|
|
1558
1612
|
* Each path splits on `'.'` into a chain of relation names, deep-merged into one nested
|
|
1559
|
-
* `Include` object with a leaf `true`. A longer path
|
|
1613
|
+
* `Include` object with a leaf `true`. A longer path subsumes a shorter sibling's bare `true` —
|
|
1560
1614
|
* `'contacts'` followed by `'contacts.account'` yields `{ contacts: { account: true } }`, never
|
|
1561
|
-
* overwriting the deeper chain. An
|
|
1615
|
+
* overwriting the deeper chain. An empty segment (`''`, from a leading/trailing/doubled `.`) or a
|
|
1562
1616
|
* path whose segment count exceeds `depth` throws a typed `TOOL` {@link ToolboxError}.
|
|
1563
1617
|
*
|
|
1564
1618
|
* @param paths - The flat dot-path `include` list (or `undefined` — yields `{}`)
|
|
@@ -1577,18 +1631,18 @@ export declare function expandInclude(paths: readonly string[] | undefined, dept
|
|
|
1577
1631
|
|
|
1578
1632
|
/**
|
|
1579
1633
|
* Expands a flat {@link WorkflowSteps} blob into a strict {@link WorkflowDefinition} — each step
|
|
1580
|
-
* becomes a one-task phase,
|
|
1634
|
+
* becomes a one-task phase, in order.
|
|
1581
1635
|
*
|
|
1582
1636
|
* @remarks
|
|
1583
|
-
* The expansion of the tool's
|
|
1637
|
+
* The expansion of the tool's advertised surface: the deliberately-reduced flat form. Each
|
|
1584
1638
|
* {@link import('./types.js').WorkflowStep} maps to a phase holding exactly one task: the step's
|
|
1585
1639
|
* `name` becomes the task's `behavior` (the behavior-registry key). Ids/names are auto-filled
|
|
1586
1640
|
* positionally — it builds an ids-omitted {@link WorkflowDraft} and delegates to
|
|
1587
|
-
* {@link completeDraft}, so the
|
|
1641
|
+
* {@link completeDraft}, so the lenient surfaces share one synthesis path (step `i` → phase
|
|
1588
1642
|
* `phase-<i>`, its task `phase-<i>-task-0`). The optional `name` becomes both the workflow's
|
|
1589
1643
|
* deterministic id and its name, so named flat workflows retain distinct persistence keys;
|
|
1590
1644
|
* omission keeps the shared draft fallback `wf`. The result is a complete definition the caller
|
|
1591
|
-
* validates against the
|
|
1645
|
+
* validates against the strict contract before running.
|
|
1592
1646
|
*
|
|
1593
1647
|
* @param flat - The flat steps blob (`{ name?, steps: [{ name }] }`)
|
|
1594
1648
|
* @returns A complete {@link WorkflowDefinition} (one one-task phase per step)
|
|
@@ -1618,21 +1672,29 @@ export declare function extendLineage(lineage: WorkflowLineage, tag: string): Wo
|
|
|
1618
1672
|
/** Describes the flat dot-path relation include list, expanded through {@link import('./helpers.js').expandInclude}. */
|
|
1619
1673
|
export declare const includeShape: OptionalShape<ArrayShape<StringShape>>;
|
|
1620
1674
|
|
|
1621
|
-
/**
|
|
1675
|
+
/**
|
|
1676
|
+
* Holds the schema-inference protocol {@link import('./factories.js').createInferTool} advertises —
|
|
1677
|
+
* the required `samples`, the optional `format`, `enum`, and `candidates` arguments, and a worked
|
|
1678
|
+
* example of the bare return and of the `candidates`-wrapped return.
|
|
1679
|
+
*/
|
|
1622
1680
|
export declare const INFER_TOOL_DESCRIPTION: string;
|
|
1623
1681
|
|
|
1624
1682
|
/**
|
|
1625
|
-
* Holds the name {@link import('./factories.js').createInferTool} advertises by default
|
|
1626
|
-
* model calls and the `ToolManagerInterface` (`@orkestrel/tool`) registers under.
|
|
1683
|
+
* Holds the name {@link import('./factories.js').createInferTool} advertises by default, `'infer'`
|
|
1684
|
+
* — the key a model calls and the `ToolManagerInterface` (`@orkestrel/tool`) registers under.
|
|
1627
1685
|
*/
|
|
1628
1686
|
export declare const INFER_TOOL_NAME = "infer";
|
|
1629
1687
|
|
|
1630
1688
|
/**
|
|
1631
|
-
* Holds the lean {@link import('@orkestrel/tool').ToolInterface.summary}
|
|
1632
|
-
*
|
|
1633
|
-
*
|
|
1634
|
-
*
|
|
1635
|
-
*
|
|
1689
|
+
* Holds the lean {@link import('@orkestrel/tool').ToolInterface.summary}
|
|
1690
|
+
* {@link import('./factories.js').createInferTool} advertises in place of
|
|
1691
|
+
* {@link INFER_TOOL_DESCRIPTION} — one sentence offering schema inference from example values and
|
|
1692
|
+
* pointing at `describe` for the fields it takes.
|
|
1693
|
+
*
|
|
1694
|
+
* @remarks
|
|
1695
|
+
* A `ToolManagerInterface.definitions()` call (`@orkestrel/tool`) advertises
|
|
1696
|
+
* `summary ?? description`, so this one-sentence text stands in for the full teaching description;
|
|
1697
|
+
* the full text stays retrievable through {@link import('./factories.js').createDescribeTool}.
|
|
1636
1698
|
*/
|
|
1637
1699
|
export declare const INFER_TOOL_SUMMARY = "Infer a JSON Schema (as advertised tool parameters) from one or more example values. Call describe('infer') for the required fields.";
|
|
1638
1700
|
|
|
@@ -1676,9 +1738,9 @@ export declare function inferRelationCode(error: unknown): RelationErrorCode | u
|
|
|
1676
1738
|
export declare function inferTerminalCode(error: unknown): ToolboxErrorCode | undefined;
|
|
1677
1739
|
|
|
1678
1740
|
/**
|
|
1679
|
-
* Represents the options for {@link import('./factories.js').createInferTool} — advertised name
|
|
1680
|
-
* overrides only; `format`
|
|
1681
|
-
* {@link import('./shapers.js').inferToolShape}), not construction-time options,
|
|
1741
|
+
* Represents the options for {@link import('./factories.js').createInferTool} — advertised name and
|
|
1742
|
+
* description overrides only; `format` and `enum` are runtime call arguments (see
|
|
1743
|
+
* {@link import('./shapers.js').inferToolShape}), not construction-time options, because a model
|
|
1682
1744
|
* chooses them per call.
|
|
1683
1745
|
*/
|
|
1684
1746
|
export declare interface InferToolOptions {
|
|
@@ -1695,15 +1757,15 @@ export declare interface InferToolOptions {
|
|
|
1695
1757
|
* `samples` requires at least one element (`min: 1`) — an empty array parses to `undefined`,
|
|
1696
1758
|
* surfaced by the handler as a typed `TOOL` {@link import('./errors.js').ToolboxError}. When
|
|
1697
1759
|
* `candidates` is present (any array, including empty), the handler compiles a contract from the
|
|
1698
|
-
* freshly inferred schema and checks each candidate against it with a
|
|
1699
|
-
* coercion) — the opposite of {@link import('./factories.js').createEndpointTool}'s
|
|
1760
|
+
* freshly inferred schema and checks each candidate against it with a strict guard (`.is`, no
|
|
1761
|
+
* coercion) — the opposite of {@link import('./factories.js').createEndpointTool}'s normalizing
|
|
1700
1762
|
* `.parse` enforcement.
|
|
1701
1763
|
*/
|
|
1702
|
-
export declare const inferToolShape: ObjectShape<{
|
|
1703
|
-
|
|
1704
|
-
|
|
1705
|
-
|
|
1706
|
-
|
|
1764
|
+
export declare const inferToolShape: ObjectShape< {
|
|
1765
|
+
samples: ArrayShape<JSONShape>;
|
|
1766
|
+
format: OptionalShape<BooleanShape>;
|
|
1767
|
+
enum: OptionalShape<BooleanShape>;
|
|
1768
|
+
candidates: OptionalShape<ArrayShape<JSONShape>>;
|
|
1707
1769
|
}, false>;
|
|
1708
1770
|
|
|
1709
1771
|
/**
|
|
@@ -1731,7 +1793,7 @@ export declare function isColumnPrimitive(value: unknown): value is ColumnPrimit
|
|
|
1731
1793
|
export declare function isColumnSpec(value: unknown): value is ColumnSpec;
|
|
1732
1794
|
|
|
1733
1795
|
/**
|
|
1734
|
-
* Narrows an unknown value to a {@link DatabaseDefinition} — a non-empty `id`
|
|
1796
|
+
* Narrows an unknown value to a {@link DatabaseDefinition} — a non-empty `id` and `driver`, a
|
|
1735
1797
|
* `tables` record whose every value is `{ columns: record of valid ColumnSpec }`, plus optional
|
|
1736
1798
|
* `primary`, `indexes`, and finite `version` schema configuration. The boundary guard a
|
|
1737
1799
|
* {@link import('./types.js').DefinitionStoreInterface} applies to an untrusted persisted blob
|
|
@@ -1743,7 +1805,7 @@ export declare function isColumnSpec(value: unknown): value is ColumnSpec;
|
|
|
1743
1805
|
export declare function isDatabaseDefinition(value: unknown): value is DatabaseDefinition;
|
|
1744
1806
|
|
|
1745
1807
|
/**
|
|
1746
|
-
* Narrows an unknown caught value to
|
|
1808
|
+
* Narrows an unknown caught value to a {@link ToolboxError}.
|
|
1747
1809
|
*
|
|
1748
1810
|
* @param value - The value to test (typically a `catch` binding)
|
|
1749
1811
|
* @returns True if `value` is an {@link ToolboxError}; false otherwise
|
|
@@ -1769,14 +1831,18 @@ export declare function isToolboxError(value: unknown): value is ToolboxError;
|
|
|
1769
1831
|
*/
|
|
1770
1832
|
export declare function isWorkflowLineage(value: unknown): value is WorkflowLineage;
|
|
1771
1833
|
|
|
1772
|
-
/**
|
|
1773
|
-
|
|
1834
|
+
/**
|
|
1835
|
+
* Describes one key value for the database tool and the relation tool — a string or number; the
|
|
1836
|
+
* array form (multiple keys, positional) resolves first, so an array argument is read as many keys
|
|
1837
|
+
* rather than one.
|
|
1838
|
+
*/
|
|
1839
|
+
export declare const keyShape: UnionShape<readonly [ArrayShape<UnionShape<readonly [StringShape, NumberShape]>>, StringShape, NumberShape]>;
|
|
1774
1840
|
|
|
1775
1841
|
/** Describes which registered relation manager to address — omitted resolves to the sole registered manager. */
|
|
1776
1842
|
export declare const managerShape: OptionalShape<StringShape>;
|
|
1777
1843
|
|
|
1778
1844
|
/**
|
|
1779
|
-
* Holds the maximum nesting depth a workflow → agent → workflow chain may reach — the bound
|
|
1845
|
+
* Holds the maximum nesting depth a workflow → agent → workflow chain may reach, `8` — the bound
|
|
1780
1846
|
* {@link import('./factories.js').createAgentFunction} and
|
|
1781
1847
|
* {@link import('./factories.js').createWorkflowTool}'s depth/cycle guards enforce.
|
|
1782
1848
|
*
|
|
@@ -1789,7 +1855,7 @@ export declare const MAX_WORKFLOW_CHAIN = 8;
|
|
|
1789
1855
|
|
|
1790
1856
|
/**
|
|
1791
1857
|
* Represents the in-memory {@link DefinitionStoreInterface} — a process-lifetime `Map` of
|
|
1792
|
-
* {@link DatabaseDefinition}s keyed by database id, the
|
|
1858
|
+
* {@link DatabaseDefinition}s keyed by database id, the default store
|
|
1793
1859
|
* {@link import('../factories.js').createMemoryDefinitionStore} builds. It implements the same
|
|
1794
1860
|
* {@link DefinitionStoreInterface} contract as
|
|
1795
1861
|
* {@link import('./DatabaseDefinitionStore.js').DatabaseDefinitionStore}: this store copies on
|
|
@@ -1798,19 +1864,19 @@ export declare const MAX_WORKFLOW_CHAIN = 8;
|
|
|
1798
1864
|
*
|
|
1799
1865
|
* @remarks
|
|
1800
1866
|
* A plain `Map<string, DatabaseDefinition>` (the definition is already pure,
|
|
1801
|
-
* self-contained
|
|
1802
|
-
* structured-cloned on both write and read, keeping caller mutation outside the store. There is
|
|
1803
|
-
* idle-TTL and
|
|
1804
|
-
* backend (JSON / SQLite / IndexedDB) swaps in through the
|
|
1867
|
+
* self-contained config-only JSON, so no encoding is needed for the memory tier). Values are
|
|
1868
|
+
* structured-cloned on both write and read, keeping caller mutation outside the store. There is no
|
|
1869
|
+
* idle-TTL and no eviction: a persisted definition lives until an explicit `delete`. A durable
|
|
1870
|
+
* backend (JSON / SQLite / IndexedDB) swaps in through the same interface without touching a
|
|
1805
1871
|
* consumer — its driver-pluggable twin is
|
|
1806
1872
|
* {@link import('./DatabaseDefinitionStore.js').DatabaseDefinitionStore} (the definition as one
|
|
1807
1873
|
* opaque JSON column).
|
|
1808
1874
|
*
|
|
1809
1875
|
* - **`get` resolves the persisted definition for an id**, or `undefined` if none is stored.
|
|
1810
|
-
* - **`set` inserts / replaces under the definition's
|
|
1876
|
+
* - **`set` inserts / replaces under the definition's own `id`** (no separate id param).
|
|
1811
1877
|
* - **`delete` drops a definition by id**; an absent id is a no-op (no throw).
|
|
1812
1878
|
*
|
|
1813
|
-
* The public surface is
|
|
1879
|
+
* The public surface is exactly `get` / `set` / `delete` — no extra members (the method
|
|
1814
1880
|
* bijection with {@link DefinitionStoreInterface}).
|
|
1815
1881
|
*
|
|
1816
1882
|
* @example
|
|
@@ -1833,17 +1899,17 @@ export declare class MemoryDefinitionStore implements DefinitionStoreInterface {
|
|
|
1833
1899
|
*/
|
|
1834
1900
|
get(id: string): Promise<DatabaseDefinition | undefined>;
|
|
1835
1901
|
/**
|
|
1836
|
-
* Inserts or replaces a definition under its
|
|
1902
|
+
* Inserts or replaces a definition under its own `id`, copied into the backing `Map`.
|
|
1837
1903
|
*
|
|
1838
1904
|
* @param definition - The config to persist; its own `id` is the key (no separate id param)
|
|
1839
|
-
* @returns A promise settling
|
|
1905
|
+
* @returns A promise settling after the definition is stored
|
|
1840
1906
|
*/
|
|
1841
1907
|
set(definition: DatabaseDefinition): Promise<void>;
|
|
1842
1908
|
/**
|
|
1843
1909
|
* Drops the definition stored under `id`.
|
|
1844
1910
|
*
|
|
1845
1911
|
* @param id - The database id to drop; an absent id is a no-op, never a throw
|
|
1846
|
-
* @returns A promise settling
|
|
1912
|
+
* @returns A promise settling after no definition is stored under `id`
|
|
1847
1913
|
*/
|
|
1848
1914
|
delete(id: string): Promise<void>;
|
|
1849
1915
|
}
|
|
@@ -1858,11 +1924,11 @@ export declare function normalizeLineage(lineage?: WorkflowLineage): WorkflowLin
|
|
|
1858
1924
|
|
|
1859
1925
|
/**
|
|
1860
1926
|
* Returns the canonical live `@orkestrel/database` {@link QueryInput} for the database tool's
|
|
1861
|
-
* parsed
|
|
1927
|
+
* parsed serialized query — each condition's omitted `connector` defaults to `'and'`.
|
|
1862
1928
|
*
|
|
1863
1929
|
* @remarks
|
|
1864
1930
|
* The wire form ({@link import('./shapers.js').databaseToolShape}) lets a caller drop `connector`
|
|
1865
|
-
* on the last condition (it has nothing to join
|
|
1931
|
+
* on the last condition (it has nothing to join forward to); the compiled `Condition` a live
|
|
1866
1932
|
* `@orkestrel/database` table call accepts always carries one, so this fills the gap. `order` /
|
|
1867
1933
|
* `limit` / `offset` pass through unchanged. Pure and total.
|
|
1868
1934
|
*
|
|
@@ -1871,13 +1937,16 @@ export declare function normalizeLineage(lineage?: WorkflowLineage): WorkflowLin
|
|
|
1871
1937
|
*/
|
|
1872
1938
|
export declare function normalizeQuery(query: DatabaseQueryInput | undefined): QueryInput | undefined;
|
|
1873
1939
|
|
|
1874
|
-
/** Describes one sort term. */
|
|
1875
|
-
export declare const orderShape: ObjectShape<{
|
|
1876
|
-
|
|
1877
|
-
|
|
1940
|
+
/** Describes one sort term — a `column` to sort by and the `direction` to sort it in. */
|
|
1941
|
+
export declare const orderShape: ObjectShape< {
|
|
1942
|
+
column: StringShape;
|
|
1943
|
+
direction: LiteralShape<readonly ["ascending", "descending"]>;
|
|
1878
1944
|
}, false>;
|
|
1879
1945
|
|
|
1880
|
-
/**
|
|
1946
|
+
/**
|
|
1947
|
+
* Represents a draft phase — a `PhaseDefinition` (`@orkestrel/workflow`) with optional `id` and
|
|
1948
|
+
* `name` and {@link TaskDraft} tasks.
|
|
1949
|
+
*/
|
|
1881
1950
|
export declare interface PhaseDraft {
|
|
1882
1951
|
readonly id?: string;
|
|
1883
1952
|
readonly name?: string;
|
|
@@ -1885,45 +1954,53 @@ export declare interface PhaseDraft {
|
|
|
1885
1954
|
readonly tasks: readonly TaskDraft[];
|
|
1886
1955
|
/** Caps the tasks in flight at once (a resource throttle); omitted ⇒ unbounded. */
|
|
1887
1956
|
readonly concurrency?: number;
|
|
1888
|
-
/** Holds the per-phase failure-policy
|
|
1957
|
+
/** Holds the per-phase failure-policy override; omitted ⇒ inherits the workflow `bail`. */
|
|
1889
1958
|
readonly bail?: boolean;
|
|
1890
1959
|
}
|
|
1891
1960
|
|
|
1892
1961
|
/**
|
|
1893
|
-
* Describes the shape of a
|
|
1894
|
-
* `name` are
|
|
1895
|
-
*/
|
|
1896
|
-
export declare const phaseDraftShape: ObjectShape<{
|
|
1897
|
-
|
|
1898
|
-
|
|
1899
|
-
|
|
1900
|
-
|
|
1901
|
-
|
|
1902
|
-
|
|
1903
|
-
|
|
1904
|
-
|
|
1905
|
-
|
|
1906
|
-
|
|
1907
|
-
|
|
1908
|
-
|
|
1909
|
-
|
|
1962
|
+
* Describes the shape of a phase in a draft workflow — identical to a strict phase shape except
|
|
1963
|
+
* that `id` and `name` are optional and each task takes {@link taskDraftShape}.
|
|
1964
|
+
*/
|
|
1965
|
+
export declare const phaseDraftShape: ObjectShape< {
|
|
1966
|
+
id: OptionalShape<StringShape>;
|
|
1967
|
+
name: OptionalShape<StringShape>;
|
|
1968
|
+
description: OptionalShape<StringShape>;
|
|
1969
|
+
tasks: ArrayShape<ObjectShape< {
|
|
1970
|
+
id: OptionalShape<StringShape>;
|
|
1971
|
+
name: OptionalShape<StringShape>;
|
|
1972
|
+
description: OptionalShape<StringShape>;
|
|
1973
|
+
behavior: OptionalShape<StringShape>;
|
|
1974
|
+
retries: OptionalShape<NumberShape>;
|
|
1975
|
+
timeout: OptionalShape<NumberShape>;
|
|
1976
|
+
}, false>>;
|
|
1977
|
+
concurrency: OptionalShape<NumberShape>;
|
|
1978
|
+
bail: OptionalShape<LiteralShape<readonly [true, false]>>;
|
|
1910
1979
|
}, false>;
|
|
1911
1980
|
|
|
1912
|
-
/**
|
|
1981
|
+
/**
|
|
1982
|
+
* Holds the form protocol {@link import('./factories.js').createPromptTool} advertises — the
|
|
1983
|
+
* required `to` and `schema`, how a field declares its control and its rules, and a worked
|
|
1984
|
+
* example.
|
|
1985
|
+
*/
|
|
1913
1986
|
export declare const PROMPT_TOOL_DESCRIPTION: string;
|
|
1914
1987
|
|
|
1915
1988
|
/**
|
|
1916
|
-
* Holds the name {@link import('./factories.js').createPromptTool} advertises by default —
|
|
1917
|
-
* model calls and the `ToolManagerInterface` (`@orkestrel/tool`) registers under.
|
|
1989
|
+
* Holds the name {@link import('./factories.js').createPromptTool} advertises by default, `'ask'` —
|
|
1990
|
+
* the key a model calls and the `ToolManagerInterface` (`@orkestrel/tool`) registers under.
|
|
1918
1991
|
*/
|
|
1919
1992
|
export declare const PROMPT_TOOL_NAME = "ask";
|
|
1920
1993
|
|
|
1921
1994
|
/**
|
|
1922
|
-
* Holds the lean {@link import('@orkestrel/tool').ToolInterface.summary}
|
|
1923
|
-
*
|
|
1924
|
-
*
|
|
1925
|
-
*
|
|
1926
|
-
*
|
|
1995
|
+
* Holds the lean {@link import('@orkestrel/tool').ToolInterface.summary}
|
|
1996
|
+
* {@link import('./factories.js').createPromptTool} advertises in place of
|
|
1997
|
+
* {@link PROMPT_TOOL_DESCRIPTION} — one sentence offering the blocking multi-field ask and pointing
|
|
1998
|
+
* at `describe` for the schema.
|
|
1999
|
+
*
|
|
2000
|
+
* @remarks
|
|
2001
|
+
* A `ToolManagerInterface.definitions()` call (`@orkestrel/tool`) advertises
|
|
2002
|
+
* `summary ?? description`, so this one-sentence text stands in for the full teaching description;
|
|
2003
|
+
* the full text stays retrievable through {@link import('./factories.js').createDescribeTool}.
|
|
1927
2004
|
*/
|
|
1928
2005
|
export declare const PROMPT_TOOL_SUMMARY = "Ask another terminal a multi-field form and BLOCK until it answers; the call resolves with the values record. Call describe('ask') for the schema.";
|
|
1929
2006
|
|
|
@@ -1934,10 +2011,10 @@ export declare const PROMPT_TOOL_SUMMARY = "Ask another terminal a multi-field f
|
|
|
1934
2011
|
*
|
|
1935
2012
|
* @remarks
|
|
1936
2013
|
* - `manager` — the terminal manager whose `ask(from, to, form)` the tool's handler calls with a
|
|
1937
|
-
* live `@orkestrel/form` form;
|
|
2014
|
+
* live `@orkestrel/form` form; blocks the calling agent turn until the addressed terminal answers (or the ask
|
|
1938
2015
|
* rejects — a cycle throws `TerminalError('DEADLOCK')`, re-surfaced as a typed `DEADLOCK`
|
|
1939
2016
|
* {@link import('./errors.js').ToolboxError}; an expired prompt re-surfaces as `EXPIRE`).
|
|
1940
|
-
* - `from` — the terminal identity this tool asks
|
|
2017
|
+
* - `from` — the terminal identity this tool asks as; the model supplies the `to` target and the
|
|
1941
2018
|
* complete form schema per call.
|
|
1942
2019
|
* - `name` / `description` — advertised tool overrides; default to
|
|
1943
2020
|
* {@link import('./constants.js').PROMPT_TOOL_NAME} / {@link import('./constants.js').PROMPT_TOOL_DESCRIPTION}.
|
|
@@ -1957,63 +2034,80 @@ export declare interface PromptToolOptions {
|
|
|
1957
2034
|
* The contract first requires exact JSON. The handler then delegates schema parsing and semantic
|
|
1958
2035
|
* validation to `@orkestrel/form`'s `parseForm`, so Toolbox does not duplicate the form schema.
|
|
1959
2036
|
*/
|
|
1960
|
-
export declare const promptToolShape: ObjectShape<{
|
|
1961
|
-
|
|
1962
|
-
|
|
2037
|
+
export declare const promptToolShape: ObjectShape< {
|
|
2038
|
+
to: StringShape;
|
|
2039
|
+
schema: JSONShape;
|
|
1963
2040
|
}, false>;
|
|
1964
2041
|
|
|
1965
|
-
/** Describes the
|
|
1966
|
-
export declare const queryShape: ObjectShape<{
|
|
1967
|
-
|
|
1968
|
-
|
|
1969
|
-
|
|
1970
|
-
|
|
1971
|
-
|
|
1972
|
-
|
|
1973
|
-
|
|
1974
|
-
|
|
1975
|
-
|
|
1976
|
-
|
|
1977
|
-
|
|
1978
|
-
|
|
2042
|
+
/** Describes the serialized query form — conditions, order, and pagination. */
|
|
2043
|
+
export declare const queryShape: ObjectShape< {
|
|
2044
|
+
conditions: OptionalShape<ArrayShape<ObjectShape< {
|
|
2045
|
+
column: StringShape;
|
|
2046
|
+
operator: LiteralShape<readonly ["equals", "not", "above", "below", "from", "to", "between", "like", "glob", "starts", "ends", "any", "none", "absent", "present"]>;
|
|
2047
|
+
values: ArrayShape<JSONShape>;
|
|
2048
|
+
connector: OptionalShape<LiteralShape<readonly ["and", "or"]>>;
|
|
2049
|
+
}, false>>>;
|
|
2050
|
+
order: OptionalShape<ArrayShape<ObjectShape< {
|
|
2051
|
+
column: StringShape;
|
|
2052
|
+
direction: LiteralShape<readonly ["ascending", "descending"]>;
|
|
2053
|
+
}, false>>>;
|
|
2054
|
+
limit: OptionalShape<NumberShape>;
|
|
2055
|
+
offset: OptionalShape<NumberShape>;
|
|
1979
2056
|
}, false>;
|
|
1980
2057
|
|
|
1981
|
-
/**
|
|
2058
|
+
/**
|
|
2059
|
+
* Holds the default cap on how many `include` path segments deep a `load` or `find` call may
|
|
2060
|
+
* traverse, `3` — the relation tool's default include-depth ceiling.
|
|
2061
|
+
*/
|
|
1982
2062
|
export declare const RELATION_TOOL_DEPTH = 3;
|
|
1983
2063
|
|
|
1984
2064
|
/**
|
|
1985
|
-
* Holds the
|
|
1986
|
-
* the operation list and the flat dot-path `include`
|
|
2065
|
+
* Holds the description {@link import('./factories.js').createRelationTool} advertises — a
|
|
2066
|
+
* multi-line guide that teaches a small model the operation list and the flat dot-path `include`
|
|
2067
|
+
* syntax.
|
|
1987
2068
|
*
|
|
1988
2069
|
* @remarks
|
|
1989
|
-
* An include path is a
|
|
2070
|
+
* An include path is a flat dot-separated string (`'contacts.account'`), never a nested object —
|
|
1990
2071
|
* the same small-model ergonomic lever the other tools in this package use for flat args.
|
|
1991
2072
|
*/
|
|
1992
2073
|
export declare const RELATION_TOOL_DESCRIPTION: string;
|
|
1993
2074
|
|
|
1994
|
-
/**
|
|
2075
|
+
/**
|
|
2076
|
+
* Holds the default cap on rows a `find` or `links` call returns when the caller omits `limit`,
|
|
2077
|
+
* `1000` — the relation tool's default row ceiling.
|
|
2078
|
+
*/
|
|
1995
2079
|
export declare const RELATION_TOOL_LIMIT = 1000;
|
|
1996
2080
|
|
|
1997
2081
|
/**
|
|
1998
|
-
* Holds the name
|
|
1999
|
-
* `ToolManagerInterface` (`@orkestrel/tool`) registers
|
|
2082
|
+
* Holds the name {@link import('./factories.js').createRelationTool} advertises by default,
|
|
2083
|
+
* `'relation'` — the key a model calls and the `ToolManagerInterface` (`@orkestrel/tool`) registers
|
|
2084
|
+
* under.
|
|
2000
2085
|
*/
|
|
2001
2086
|
export declare const RELATION_TOOL_NAME = "relation";
|
|
2002
2087
|
|
|
2003
2088
|
/**
|
|
2004
|
-
* Holds the lean {@link import('@orkestrel/tool').ToolInterface.summary}
|
|
2005
|
-
* in place of
|
|
2089
|
+
* Holds the lean {@link import('@orkestrel/tool').ToolInterface.summary}
|
|
2090
|
+
* {@link import('./factories.js').createRelationTool} advertises in place of
|
|
2091
|
+
* {@link RELATION_TOOL_DESCRIPTION} — one sentence offering the `operation`-keyed relationship
|
|
2092
|
+
* traversal and pointing at `describe` for the include-path syntax.
|
|
2093
|
+
*
|
|
2094
|
+
* @remarks
|
|
2095
|
+
* A `ToolManagerInterface.definitions()` call (`@orkestrel/tool`) advertises
|
|
2096
|
+
* `summary ?? description`, so this one-sentence text stands in for the full teaching description;
|
|
2097
|
+
* the full text stays retrievable through {@link import('./factories.js').createDescribeTool}.
|
|
2006
2098
|
*/
|
|
2007
2099
|
export declare const RELATION_TOOL_SUMMARY = "Traverse and edit relationships between database rows \u2014 one operation per call (load, find, link, unlink, links), chosen by the 'operation' field. Call describe('relation') for the include-path syntax.";
|
|
2008
2100
|
|
|
2009
2101
|
/**
|
|
2010
|
-
* Represents the options for {@link import('./factories.js').createRelationTool}
|
|
2102
|
+
* Represents the options for {@link import('./factories.js').createRelationTool} — the required
|
|
2103
|
+
* live `RelationManagerInterface` registry a call addresses, the row cap, and the `include` depth
|
|
2104
|
+
* cap.
|
|
2011
2105
|
*
|
|
2012
2106
|
* @remarks
|
|
2013
2107
|
* - `managers` — the live `RelationManagerInterface` (`@orkestrel/relation`) registry a call's
|
|
2014
|
-
* optional `manager` field addresses by name;
|
|
2108
|
+
* optional `manager` field addresses by name; required (unlike the database tool's lazily
|
|
2015
2109
|
* resolved handles, a relation manager's relations are declared up front and cannot be minted
|
|
2016
|
-
* on demand from a tool call). A call that omits `manager` resolves to the
|
|
2110
|
+
* on demand from a tool call). A call that omits `manager` resolves to the sole registered
|
|
2017
2111
|
* manager when exactly one is registered, else throws a typed `TOOL`
|
|
2018
2112
|
* {@link import('./errors.js').ToolboxError} naming the registered manager keys.
|
|
2019
2113
|
* - `limit` — the row cap `'find'` / `'links'` enforce when a call's `limit` is omitted or
|
|
@@ -2034,49 +2128,49 @@ export declare interface RelationToolOptions {
|
|
|
2034
2128
|
|
|
2035
2129
|
/**
|
|
2036
2130
|
* Describes the shape of {@link import('./factories.js').createRelationTool}'s call arguments —
|
|
2037
|
-
* discriminated by `operation` into the
|
|
2038
|
-
* `'unlink'
|
|
2131
|
+
* discriminated by `operation` into the relation operations `'load'`, `'find'`, `'link'`,
|
|
2132
|
+
* `'unlink'`, and `'links'`.
|
|
2039
2133
|
*
|
|
2040
2134
|
* @remarks
|
|
2041
2135
|
* `'load'` fetches one or more rows (positional key/array) with `include` attached. `'find'`
|
|
2042
2136
|
* fetches rows (pagination / sort only) with `include` attached. `'link'` / `'unlink'` write /
|
|
2043
2137
|
* remove a `through` junction row; `'links'` lists a `through` relation's linked keys.
|
|
2044
2138
|
*/
|
|
2045
|
-
export declare const relationToolShape: UnionShape<readonly [
|
|
2046
|
-
|
|
2047
|
-
|
|
2048
|
-
|
|
2049
|
-
|
|
2050
|
-
|
|
2051
|
-
}, false>, ObjectShape<{
|
|
2052
|
-
|
|
2053
|
-
|
|
2054
|
-
|
|
2055
|
-
|
|
2056
|
-
|
|
2057
|
-
|
|
2058
|
-
|
|
2059
|
-
|
|
2060
|
-
}, false>, ObjectShape<{
|
|
2061
|
-
|
|
2062
|
-
|
|
2063
|
-
|
|
2064
|
-
|
|
2065
|
-
|
|
2066
|
-
|
|
2067
|
-
}, false>, ObjectShape<{
|
|
2068
|
-
|
|
2069
|
-
|
|
2070
|
-
|
|
2071
|
-
|
|
2072
|
-
|
|
2073
|
-
|
|
2074
|
-
}, false>, ObjectShape<{
|
|
2075
|
-
|
|
2076
|
-
|
|
2077
|
-
|
|
2078
|
-
|
|
2079
|
-
|
|
2139
|
+
export declare const relationToolShape: UnionShape<readonly [ObjectShape< {
|
|
2140
|
+
operation: LiteralShape<readonly ["load"]>;
|
|
2141
|
+
manager: OptionalShape<StringShape>;
|
|
2142
|
+
model: StringShape;
|
|
2143
|
+
key: UnionShape<readonly [ArrayShape<UnionShape<readonly [StringShape, NumberShape]>>, StringShape, NumberShape]>;
|
|
2144
|
+
include: OptionalShape<ArrayShape<StringShape>>;
|
|
2145
|
+
}, false>, ObjectShape< {
|
|
2146
|
+
operation: LiteralShape<readonly ["find"]>;
|
|
2147
|
+
manager: OptionalShape<StringShape>;
|
|
2148
|
+
model: StringShape;
|
|
2149
|
+
include: OptionalShape<ArrayShape<StringShape>>;
|
|
2150
|
+
limit: OptionalShape<NumberShape>;
|
|
2151
|
+
offset: OptionalShape<NumberShape>;
|
|
2152
|
+
sort: OptionalShape<StringShape>;
|
|
2153
|
+
direction: OptionalShape<LiteralShape<readonly ["ascending", "descending"]>>;
|
|
2154
|
+
}, false>, ObjectShape< {
|
|
2155
|
+
operation: LiteralShape<readonly ["link"]>;
|
|
2156
|
+
manager: OptionalShape<StringShape>;
|
|
2157
|
+
model: StringShape;
|
|
2158
|
+
key: UnionShape<readonly [StringShape, NumberShape]>;
|
|
2159
|
+
relation: StringShape;
|
|
2160
|
+
target: UnionShape<readonly [StringShape, NumberShape]>;
|
|
2161
|
+
}, false>, ObjectShape< {
|
|
2162
|
+
operation: LiteralShape<readonly ["unlink"]>;
|
|
2163
|
+
manager: OptionalShape<StringShape>;
|
|
2164
|
+
model: StringShape;
|
|
2165
|
+
key: UnionShape<readonly [StringShape, NumberShape]>;
|
|
2166
|
+
relation: StringShape;
|
|
2167
|
+
target: UnionShape<readonly [StringShape, NumberShape]>;
|
|
2168
|
+
}, false>, ObjectShape< {
|
|
2169
|
+
operation: LiteralShape<readonly ["links"]>;
|
|
2170
|
+
manager: OptionalShape<StringShape>;
|
|
2171
|
+
model: StringShape;
|
|
2172
|
+
key: UnionShape<readonly [StringShape, NumberShape]>;
|
|
2173
|
+
relation: StringShape;
|
|
2080
2174
|
}, false>]>;
|
|
2081
2175
|
|
|
2082
2176
|
/**
|
|
@@ -2110,7 +2204,7 @@ export declare function resolveLimit(requested: number | undefined, cap: number)
|
|
|
2110
2204
|
*
|
|
2111
2205
|
* @remarks
|
|
2112
2206
|
* An explicit `name` must match a key of `managers` (a miss throws a typed `TOOL`
|
|
2113
|
-
* {@link ToolboxError} naming the registered managers). An
|
|
2207
|
+
* {@link ToolboxError} naming the registered managers). An omitted `name` resolves to the sole
|
|
2114
2208
|
* registered manager when exactly one is registered, else throws the same typed error.
|
|
2115
2209
|
*
|
|
2116
2210
|
* @param managers - The tool's registered `RelationManagerInterface` map
|
|
@@ -2130,33 +2224,37 @@ export declare function resolveRelationManager(managers: Readonly<Record<string,
|
|
|
2130
2224
|
*/
|
|
2131
2225
|
export declare function resolveRelationModel(manager: RelationManagerInterface, name: string): ModelInterface;
|
|
2132
2226
|
|
|
2133
|
-
/** Describes a loose row — a flat object of column name to JSON value
|
|
2227
|
+
/** Describes a loose row — a flat object of column name to JSON value. */
|
|
2134
2228
|
export declare const rowShape: ObjectShape<Record<never, never>, JSONShape>;
|
|
2135
2229
|
|
|
2136
|
-
/**
|
|
2137
|
-
|
|
2230
|
+
/**
|
|
2231
|
+
* Describes one or many loose rows — the array form resolves first, so an array argument is read as
|
|
2232
|
+
* many rows rather than one.
|
|
2233
|
+
*/
|
|
2234
|
+
export declare const rowsShape: UnionShape<readonly [ArrayShape<ObjectShape<Record<never, never>, JSONShape>>, ObjectShape<Record<never, never>, JSONShape>]>;
|
|
2138
2235
|
|
|
2139
2236
|
/** Describes a single row key (not an array) — used by `'link'` / `'unlink'` / `'links'`, which address exactly one owning row. */
|
|
2140
|
-
export declare const singleKeyShape: UnionShape<readonly [
|
|
2237
|
+
export declare const singleKeyShape: UnionShape<readonly [StringShape, NumberShape]>;
|
|
2141
2238
|
|
|
2142
2239
|
/**
|
|
2143
|
-
* Describes the shape of
|
|
2240
|
+
* Describes the shape of one flat step — `{ name }` — the building block of
|
|
2241
|
+
* {@link workflowStepsShape}.
|
|
2144
2242
|
*
|
|
2145
2243
|
* @remarks
|
|
2146
|
-
* `name` is the
|
|
2244
|
+
* `name` is the registered behavior name the step runs (it becomes the task's `behavior`). The tool
|
|
2147
2245
|
* expands each step into a one-task phase, in order ({@link import('./helpers.js').expandSteps}).
|
|
2148
2246
|
*/
|
|
2149
|
-
export declare const stepShape: ObjectShape<{
|
|
2150
|
-
|
|
2247
|
+
export declare const stepShape: ObjectShape< {
|
|
2248
|
+
name: StringShape;
|
|
2151
2249
|
}, false>;
|
|
2152
2250
|
|
|
2153
2251
|
/**
|
|
2154
|
-
* Builds the plain success summary {@link import('./factories.js').createWorkflowTool} returns on
|
|
2155
|
-
*
|
|
2156
|
-
*
|
|
2252
|
+
* Builds the plain success summary {@link import('./factories.js').createWorkflowTool} returns on a
|
|
2253
|
+
* completed run — the universal tool-handler contract: return a plain value on success, appearing
|
|
2254
|
+
* identically over both the agent loop and MCP.
|
|
2157
2255
|
*
|
|
2158
2256
|
* @remarks
|
|
2159
|
-
* The summary is
|
|
2257
|
+
* The summary is lean: the workflow's terminal `status`, settled-task count, and exact optional
|
|
2160
2258
|
* native persistence outcome. It carries no synthetic `id` / `name`: a tool handler has no call
|
|
2161
2259
|
* id; the `ToolManagerInterface` (`@orkestrel/tool`) supplies the canonical envelope's identity.
|
|
2162
2260
|
*
|
|
@@ -2175,11 +2273,11 @@ export declare type TableSpec = Readonly<Record<string, Readonly<{
|
|
|
2175
2273
|
}>>>;
|
|
2176
2274
|
|
|
2177
2275
|
/** Describes a {@link import('./types.js').TableSpec} — table name to `{ columns }`, each column a {@link columnSpecShape}. */
|
|
2178
|
-
export declare const tableSpecShape: ObjectShape<Record<never, never>, ObjectShape<{
|
|
2179
|
-
|
|
2180
|
-
|
|
2181
|
-
|
|
2182
|
-
|
|
2276
|
+
export declare const tableSpecShape: ObjectShape<Record<never, never>, ObjectShape< {
|
|
2277
|
+
columns: ObjectShape<Record<never, never>, UnionShape<readonly [LiteralShape<readonly ["string", "integer", "number", "boolean"]>, ObjectShape< {
|
|
2278
|
+
primitive: LiteralShape<readonly ["string", "integer", "number", "boolean"]>;
|
|
2279
|
+
optional: OptionalShape<BooleanShape>;
|
|
2280
|
+
}, false>]>>;
|
|
2183
2281
|
}, false>>;
|
|
2184
2282
|
|
|
2185
2283
|
/**
|
|
@@ -2200,8 +2298,8 @@ export declare function tagAgent(name: string): string;
|
|
|
2200
2298
|
* Returns the ancestry identifier of a workflow in a run chain — `workflow:<id>`.
|
|
2201
2299
|
*
|
|
2202
2300
|
* @remarks
|
|
2203
|
-
* Namespacing keeps a workflow id and a {@link tagAgent} agent name in
|
|
2204
|
-
* collision, so re-entering a workflow
|
|
2301
|
+
* Namespacing keeps a workflow id and a {@link tagAgent} agent name in one set without
|
|
2302
|
+
* collision, so re-entering a workflow or an agent already in the chain is a single `includes`
|
|
2205
2303
|
* check.
|
|
2206
2304
|
*
|
|
2207
2305
|
* @param id - The workflow definition's `id`
|
|
@@ -2210,11 +2308,12 @@ export declare function tagAgent(name: string): string;
|
|
|
2210
2308
|
export declare function tagWorkflow(id: string): string;
|
|
2211
2309
|
|
|
2212
2310
|
/**
|
|
2213
|
-
* Represents a draft task — a `TaskDefinition` (`@orkestrel/workflow`) with
|
|
2311
|
+
* Represents a draft task — a `TaskDefinition` (`@orkestrel/workflow`) with optional `id` and
|
|
2312
|
+
* `name`.
|
|
2214
2313
|
*
|
|
2215
2314
|
* @remarks
|
|
2216
2315
|
* The tool synthesizes a missing `id` positionally and defaults a missing `name` to its `id`
|
|
2217
|
-
* ({@link import('./helpers.js').completeDraft}). A
|
|
2316
|
+
* ({@link import('./helpers.js').completeDraft}). A provided `id` / `name` is preserved verbatim
|
|
2218
2317
|
* (and must be non-empty — the draft contract's `minLength: 1`).
|
|
2219
2318
|
*/
|
|
2220
2319
|
export declare interface TaskDraft {
|
|
@@ -2230,16 +2329,16 @@ export declare interface TaskDraft {
|
|
|
2230
2329
|
}
|
|
2231
2330
|
|
|
2232
2331
|
/**
|
|
2233
|
-
* Describes the shape of a {@link import('./types.js').TaskDraft} — identical to a strict task
|
|
2234
|
-
*
|
|
2332
|
+
* Describes the shape of a {@link import('./types.js').TaskDraft} — identical to a strict task
|
|
2333
|
+
* shape except that `id` and `name` are optional.
|
|
2235
2334
|
*/
|
|
2236
|
-
export declare const taskDraftShape: ObjectShape<{
|
|
2237
|
-
|
|
2238
|
-
|
|
2239
|
-
|
|
2240
|
-
|
|
2241
|
-
|
|
2242
|
-
|
|
2335
|
+
export declare const taskDraftShape: ObjectShape< {
|
|
2336
|
+
id: OptionalShape<StringShape>;
|
|
2337
|
+
name: OptionalShape<StringShape>;
|
|
2338
|
+
description: OptionalShape<StringShape>;
|
|
2339
|
+
behavior: OptionalShape<StringShape>;
|
|
2340
|
+
retries: OptionalShape<NumberShape>;
|
|
2341
|
+
timeout: OptionalShape<NumberShape>;
|
|
2243
2342
|
}, false>;
|
|
2244
2343
|
|
|
2245
2344
|
/**
|
|
@@ -2302,48 +2401,52 @@ export declare type ToolboxErrorCode = 'TOOL' | 'DEPTH' | 'DEADLOCK' | 'EXPIRE'
|
|
|
2302
2401
|
export declare const WORKFLOW_TOOL_DESCRIPTION: string;
|
|
2303
2402
|
|
|
2304
2403
|
/**
|
|
2305
|
-
* Holds a complete
|
|
2306
|
-
* {@link import('./factories.js').createWorkflowTool}: `{ name, steps: [{ name }] }`.
|
|
2404
|
+
* Holds a complete flat authoring example — the primary way a small model authors a workflow
|
|
2405
|
+
* through {@link import('./factories.js').createWorkflowTool}: `{ name, steps: [{ name }] }`.
|
|
2307
2406
|
*
|
|
2308
2407
|
* @remarks
|
|
2309
2408
|
* Each step becomes a one-task phase, in
|
|
2310
|
-
* order; a step's `name` is a
|
|
2409
|
+
* order; a step's `name` is a registered behavior name (not a label) — the registry key its
|
|
2311
2410
|
* task's `behavior` resolves against. The tool expands this
|
|
2312
2411
|
* ({@link import('./helpers.js').expandSteps}) into a valid `WorkflowDefinition`
|
|
2313
|
-
* (`@orkestrel/workflow`). It is embedded
|
|
2412
|
+
* (`@orkestrel/workflow`). It is embedded verbatim in {@link WORKFLOW_TOOL_DESCRIPTION}.
|
|
2314
2413
|
*/
|
|
2315
2414
|
export declare const WORKFLOW_TOOL_FLAT_EXAMPLE: WorkflowSteps;
|
|
2316
2415
|
|
|
2317
2416
|
/**
|
|
2318
|
-
* Holds the name {@link import('./factories.js').createWorkflowTool} advertises by default
|
|
2319
|
-
* model calls and the `ToolManagerInterface` (`@orkestrel/tool`) registers
|
|
2320
|
-
* {@link import('./factories.js').createAgentFunction} binds the
|
|
2321
|
-
* under onto a wrapped agent's `context.tools`.
|
|
2417
|
+
* Holds the name {@link import('./factories.js').createWorkflowTool} advertises by default,
|
|
2418
|
+
* `'workflow'` — the key a model calls and the `ToolManagerInterface` (`@orkestrel/tool`) registers
|
|
2419
|
+
* under, and the name {@link import('./factories.js').createAgentFunction} binds the
|
|
2420
|
+
* depth/cycle-aware workflow tool under onto a wrapped agent's `context.tools`.
|
|
2322
2421
|
*
|
|
2323
2422
|
* @remarks
|
|
2324
2423
|
* The propagation seam's well-known key: when
|
|
2325
2424
|
* `createAgentFunction`'s `runner` option is supplied, it adds a `createWorkflowTool`-built tool
|
|
2326
|
-
* under this name to the agent's `context.tools`, so it can author
|
|
2425
|
+
* under this name to the agent's `context.tools`, so it can author and run a nested workflow
|
|
2327
2426
|
* (bounded by {@link MAX_WORKFLOW_CHAIN}).
|
|
2328
2427
|
*/
|
|
2329
2428
|
export declare const WORKFLOW_TOOL_NAME = "workflow";
|
|
2330
2429
|
|
|
2331
2430
|
/**
|
|
2332
|
-
* Holds a minimal
|
|
2333
|
-
* the flat shape: a full `WorkflowDefinition` (`@orkestrel/workflow`).
|
|
2431
|
+
* Holds a minimal nested authoring example — the advanced escape-hatch form a model can use instead
|
|
2432
|
+
* of the flat shape: a full `WorkflowDefinition` (`@orkestrel/workflow`).
|
|
2334
2433
|
*
|
|
2335
2434
|
* @remarks
|
|
2336
|
-
* The full
|
|
2337
|
-
* {@link WORKFLOW_TOOL_DESCRIPTION} as the advanced alternative. It is embedded
|
|
2435
|
+
* The full nested form, documented in
|
|
2436
|
+
* {@link WORKFLOW_TOOL_DESCRIPTION} as the advanced alternative. It is embedded verbatim.
|
|
2338
2437
|
*/
|
|
2339
2438
|
export declare const WORKFLOW_TOOL_NESTED_EXAMPLE: WorkflowDefinition;
|
|
2340
2439
|
|
|
2341
2440
|
/**
|
|
2342
|
-
* Holds the lean {@link import('@orkestrel/tool').ToolInterface.summary}
|
|
2343
|
-
*
|
|
2344
|
-
*
|
|
2345
|
-
* for the
|
|
2346
|
-
*
|
|
2441
|
+
* Holds the lean {@link import('@orkestrel/tool').ToolInterface.summary}
|
|
2442
|
+
* {@link import('./factories.js').createWorkflowTool} advertises in place of
|
|
2443
|
+
* {@link WORKFLOW_TOOL_DESCRIPTION} — one sentence offering multi-phase authoring and pointing at
|
|
2444
|
+
* `describe` for the authoring schema and its examples.
|
|
2445
|
+
*
|
|
2446
|
+
* @remarks
|
|
2447
|
+
* A `ToolManagerInterface.definitions()` call (`@orkestrel/tool`) advertises
|
|
2448
|
+
* `summary ?? description`, so this one-sentence text stands in for the full teaching description;
|
|
2449
|
+
* the full text stays retrievable through {@link import('./factories.js').createDescribeTool}.
|
|
2347
2450
|
*/
|
|
2348
2451
|
export declare const WORKFLOW_TOOL_SUMMARY = "Author and run a multi-phase workflow in one call \u2014 phases run in sequence, tasks within a phase run concurrently. Call describe('workflow') for the full authoring schema and examples.";
|
|
2349
2452
|
|
|
@@ -2351,8 +2454,8 @@ export declare const WORKFLOW_TOOL_SUMMARY = "Author and run a multi-phase workf
|
|
|
2351
2454
|
export declare type WorkflowAgents = Readonly<Record<string, AgentInterface>>;
|
|
2352
2455
|
|
|
2353
2456
|
/**
|
|
2354
|
-
* Represents a draft workflow — a `WorkflowDefinition` (`@orkestrel/workflow`) with
|
|
2355
|
-
*
|
|
2457
|
+
* Represents a draft workflow — a `WorkflowDefinition` (`@orkestrel/workflow`) with optional `id`
|
|
2458
|
+
* and `name` at the workflow, phase, and task levels.
|
|
2356
2459
|
*
|
|
2357
2460
|
* @remarks
|
|
2358
2461
|
* The lenient authoring form {@link import('./factories.js').createWorkflowDraftContract}
|
|
@@ -2370,49 +2473,52 @@ export declare interface WorkflowDraft {
|
|
|
2370
2473
|
}
|
|
2371
2474
|
|
|
2372
2475
|
/**
|
|
2373
|
-
* Describes the shape of a
|
|
2374
|
-
* are
|
|
2375
|
-
* identity
|
|
2476
|
+
* Describes the shape of a draft workflow — identical to a strict workflow shape except that `id`
|
|
2477
|
+
* and `name` are optional at the workflow, phase, and task levels, so a small model can omit every
|
|
2478
|
+
* identity string and let the tool synthesize them positionally.
|
|
2376
2479
|
*
|
|
2377
2480
|
* @remarks
|
|
2378
2481
|
* The lenient counterpart {@link import('./factories.js').createWorkflowDraftContract} compiles.
|
|
2379
2482
|
* `behavior` stays optional like the strict form; omission is the deliberate JSON `null` no-op. A
|
|
2380
2483
|
* provided `id` / `name` still has `minLength: 1` (so
|
|
2381
|
-
* an explicitly-empty `id: ''` is
|
|
2484
|
+
* an explicitly-empty `id: ''` is rejected, not auto-filled). After
|
|
2382
2485
|
* {@link import('./helpers.js').completeDraft} fills the missing ids/names, the result is
|
|
2383
|
-
* validated against the
|
|
2486
|
+
* validated against the strict `createWorkflowContract` (`@orkestrel/workflow`) gate before
|
|
2384
2487
|
* running.
|
|
2385
2488
|
*/
|
|
2386
|
-
export declare const workflowDraftShape: ObjectShape<{
|
|
2387
|
-
|
|
2388
|
-
|
|
2389
|
-
|
|
2390
|
-
|
|
2391
|
-
|
|
2392
|
-
|
|
2393
|
-
|
|
2394
|
-
|
|
2395
|
-
|
|
2396
|
-
|
|
2397
|
-
|
|
2398
|
-
|
|
2399
|
-
|
|
2400
|
-
|
|
2401
|
-
|
|
2402
|
-
|
|
2403
|
-
|
|
2404
|
-
|
|
2405
|
-
|
|
2489
|
+
export declare const workflowDraftShape: ObjectShape< {
|
|
2490
|
+
id: OptionalShape<StringShape>;
|
|
2491
|
+
name: OptionalShape<StringShape>;
|
|
2492
|
+
description: OptionalShape<StringShape>;
|
|
2493
|
+
phases: ArrayShape<ObjectShape< {
|
|
2494
|
+
id: OptionalShape<StringShape>;
|
|
2495
|
+
name: OptionalShape<StringShape>;
|
|
2496
|
+
description: OptionalShape<StringShape>;
|
|
2497
|
+
tasks: ArrayShape<ObjectShape< {
|
|
2498
|
+
id: OptionalShape<StringShape>;
|
|
2499
|
+
name: OptionalShape<StringShape>;
|
|
2500
|
+
description: OptionalShape<StringShape>;
|
|
2501
|
+
behavior: OptionalShape<StringShape>;
|
|
2502
|
+
retries: OptionalShape<NumberShape>;
|
|
2503
|
+
timeout: OptionalShape<NumberShape>;
|
|
2504
|
+
}, false>>;
|
|
2505
|
+
concurrency: OptionalShape<NumberShape>;
|
|
2506
|
+
bail: OptionalShape<LiteralShape<readonly [true, false]>>;
|
|
2507
|
+
}, false>>;
|
|
2508
|
+
bail: OptionalShape<LiteralShape<readonly [true, false]>>;
|
|
2406
2509
|
}, false>;
|
|
2407
2510
|
|
|
2408
|
-
/**
|
|
2511
|
+
/**
|
|
2512
|
+
* Represents one immutable workflow/agent call chain — strictly alternating tags, each unique,
|
|
2513
|
+
* beginning with a workflow tag.
|
|
2514
|
+
*/
|
|
2409
2515
|
export declare type WorkflowLineage = readonly string[];
|
|
2410
2516
|
|
|
2411
2517
|
/**
|
|
2412
2518
|
* Represents one flat step — `{ name }` — the building block of a {@link WorkflowSteps} blob.
|
|
2413
2519
|
*
|
|
2414
2520
|
* @remarks
|
|
2415
|
-
* `name` is the
|
|
2521
|
+
* `name` is the registered behavior name the step runs (it becomes the task's `behavior`, not a
|
|
2416
2522
|
* human label) — resolved against a workflow-level functions registry at construction.
|
|
2417
2523
|
*/
|
|
2418
2524
|
export declare interface WorkflowStep {
|
|
@@ -2421,13 +2527,13 @@ export declare interface WorkflowStep {
|
|
|
2421
2527
|
}
|
|
2422
2528
|
|
|
2423
2529
|
/**
|
|
2424
|
-
* Represents the
|
|
2425
|
-
* `{ name?, steps }` — the simplest surface a small model can fill.
|
|
2530
|
+
* Represents the flat authoring blob {@link import('./factories.js').createWorkflowTool} advertises
|
|
2531
|
+
* — `{ name?, steps }` — the simplest surface a small model can fill.
|
|
2426
2532
|
*
|
|
2427
2533
|
* @remarks
|
|
2428
2534
|
* Each {@link WorkflowStep} becomes a one-task phase, in order
|
|
2429
2535
|
* ({@link import('./helpers.js').expandSteps}); `name` is the optional workflow name and
|
|
2430
|
-
* deterministic persistence id (
|
|
2536
|
+
* deterministic persistence id (each defaults to `wf` when omitted).
|
|
2431
2537
|
*/
|
|
2432
2538
|
export declare interface WorkflowSteps {
|
|
2433
2539
|
readonly name?: string;
|
|
@@ -2435,23 +2541,24 @@ export declare interface WorkflowSteps {
|
|
|
2435
2541
|
}
|
|
2436
2542
|
|
|
2437
2543
|
/**
|
|
2438
|
-
* Describes the
|
|
2439
|
-
* `parameters` — the simplest surface a small model can fill:
|
|
2544
|
+
* Describes the flat authoring shape {@link import('./factories.js').createWorkflowTool} advertises
|
|
2545
|
+
* as its `parameters` — the simplest surface a small model can fill:
|
|
2546
|
+
* `{ name?, steps: [{ name }] }`.
|
|
2440
2547
|
*
|
|
2441
2548
|
* @remarks
|
|
2442
2549
|
* A deliberately-reduced surface: a flat ordered list of steps, each a `{ name }`. The tool
|
|
2443
|
-
*
|
|
2550
|
+
* expands it ({@link import('./helpers.js').expandSteps}) into a full
|
|
2444
2551
|
* {@link import('./types.js').WorkflowDefinition} — one one-task phase per step, in order —
|
|
2445
|
-
* then validates against the
|
|
2446
|
-
* full nested form is
|
|
2447
|
-
* documented as the advanced escape-hatch in the tool's description — but
|
|
2552
|
+
* then validates against the strict `createWorkflowContract` (`@orkestrel/workflow`) gate. The
|
|
2553
|
+
* full nested form is still accepted by the tool (it branches on the args' shape) and is
|
|
2554
|
+
* documented as the advanced escape-hatch in the tool's description — but this is what
|
|
2448
2555
|
* `parameters` advertises.
|
|
2449
2556
|
*/
|
|
2450
|
-
export declare const workflowStepsShape: ObjectShape<{
|
|
2451
|
-
|
|
2452
|
-
|
|
2453
|
-
|
|
2454
|
-
|
|
2557
|
+
export declare const workflowStepsShape: ObjectShape< {
|
|
2558
|
+
name: OptionalShape<StringShape>;
|
|
2559
|
+
steps: ArrayShape<ObjectShape< {
|
|
2560
|
+
name: StringShape;
|
|
2561
|
+
}, false>>;
|
|
2455
2562
|
}, false>;
|
|
2456
2563
|
|
|
2457
2564
|
/**
|
|
@@ -2496,8 +2603,8 @@ export declare interface WorkflowToolResult {
|
|
|
2496
2603
|
export declare const WORKSPACE_TOOL_DESCRIPTION: string;
|
|
2497
2604
|
|
|
2498
2605
|
/**
|
|
2499
|
-
* Holds a valid {@link import('./types.js').WorkspaceOperation} object — the canonical example
|
|
2500
|
-
*
|
|
2606
|
+
* Holds a valid {@link import('./types.js').WorkspaceOperation} object — the canonical example
|
|
2607
|
+
* embedded verbatim in {@link WORKSPACE_TOOL_DESCRIPTION}.
|
|
2501
2608
|
*
|
|
2502
2609
|
* @remarks
|
|
2503
2610
|
* A `'write'` op (the most common authoring
|
|
@@ -2507,56 +2614,61 @@ export declare const WORKSPACE_TOOL_DESCRIPTION: string;
|
|
|
2507
2614
|
export declare const WORKSPACE_TOOL_EXAMPLE: WorkspaceOperation;
|
|
2508
2615
|
|
|
2509
2616
|
/**
|
|
2510
|
-
* Holds the name {@link import('./factories.js').createWorkspaceTool} advertises by default
|
|
2511
|
-
* model calls and the `ToolManagerInterface` (`@orkestrel/tool`)
|
|
2617
|
+
* Holds the name {@link import('./factories.js').createWorkspaceTool} advertises by default,
|
|
2618
|
+
* `'workspace'` — the key a model calls and the `ToolManagerInterface` (`@orkestrel/tool`)
|
|
2619
|
+
* registers under.
|
|
2512
2620
|
*/
|
|
2513
2621
|
export declare const WORKSPACE_TOOL_NAME = "workspace";
|
|
2514
2622
|
|
|
2515
2623
|
/**
|
|
2516
|
-
* Holds the lean {@link import('@orkestrel/tool').ToolInterface.summary}
|
|
2517
|
-
*
|
|
2518
|
-
*
|
|
2519
|
-
*
|
|
2520
|
-
*
|
|
2624
|
+
* Holds the lean {@link import('@orkestrel/tool').ToolInterface.summary}
|
|
2625
|
+
* {@link import('./factories.js').createWorkspaceTool} advertises in place of
|
|
2626
|
+
* {@link WORKSPACE_TOOL_DESCRIPTION} — one sentence offering the `operation`-keyed file editing and
|
|
2627
|
+
* pointing at `describe` for the operation list and its fields.
|
|
2628
|
+
*
|
|
2629
|
+
* @remarks
|
|
2630
|
+
* A `ToolManagerInterface.definitions()` call (`@orkestrel/tool`) advertises
|
|
2631
|
+
* `summary ?? description`, so this one-sentence text stands in for the full teaching description;
|
|
2632
|
+
* the full text stays retrievable through {@link import('./factories.js').createDescribeTool}.
|
|
2521
2633
|
*/
|
|
2522
2634
|
export declare const WORKSPACE_TOOL_SUMMARY = "Read and edit files in a workspace \u2014 one operation per call (read, write, list, search, replace, splice, move, remove, plus workspace switching), chosen by the 'operation' field. Call describe('workspace') for the full operation list and fields.";
|
|
2523
2635
|
|
|
2524
2636
|
/**
|
|
2525
|
-
* Represents one operation an agent invokes through
|
|
2526
|
-
*
|
|
2527
|
-
* discriminated by the `operation` literal (a
|
|
2528
|
-
* being performed —
|
|
2637
|
+
* Represents one operation an agent invokes through
|
|
2638
|
+
* {@link import('./factories.js').createWorkspaceTool} — a flat, descriptive tagged union over the
|
|
2639
|
+
* workspace edit, read, and navigation actions, discriminated by the `operation` literal (a
|
|
2640
|
+
* discriminant is named for its axis — the action being performed — never `kind`).
|
|
2529
2641
|
*
|
|
2530
2642
|
* @remarks
|
|
2531
|
-
* This is the
|
|
2643
|
+
* This is the source of truth the tool contract is typed to
|
|
2532
2644
|
* ({@link import('./shapers.js').workspaceToolShape} compiles to a structurally-identical guard /
|
|
2533
|
-
* parser / JSON Schema). Every field is
|
|
2534
|
-
* lever: a range edit is the
|
|
2645
|
+
* parser / JSON Schema). Every field is flat (no nested objects) — the small-model ergonomic
|
|
2646
|
+
* lever: a range edit is the flat integers of the `'splice'` arm (`fromLine` /
|
|
2535
2647
|
* `fromColumn` / `toLine` / `toColumn`), reassembled into a 1-based `Range`
|
|
2536
2648
|
* (`@orkestrel/workspace`)
|
|
2537
|
-
* by `rangeOf`, never a nested `{ start, end }`. Each
|
|
2538
|
-
* `WorkspaceInterface` call against the manager's
|
|
2649
|
+
* by `rangeOf`, never a nested `{ start, end }`. Each edit / read arm maps onto exactly one
|
|
2650
|
+
* `WorkspaceInterface` call against the manager's active workspace; the registry arms
|
|
2539
2651
|
* (`switch` / `workspaces`) drive the {@link WorkspaceManagerInterface} pointer instead —
|
|
2540
|
-
* `workspaces`
|
|
2652
|
+
* `workspaces` lists the workspaces the model can move between, and `switch` re-points which one
|
|
2541
2653
|
* the edit / read arms target.
|
|
2542
2654
|
*/
|
|
2543
2655
|
export declare type WorkspaceOperation =
|
|
2544
|
-
/** Reads a whole text file's text by `path` from the
|
|
2656
|
+
/** Reads a whole text file's text by `path` from the active workspace (a binary / absent path — or no active workspace — yields no content). */
|
|
2545
2657
|
{
|
|
2546
2658
|
readonly operation: 'read';
|
|
2547
2659
|
readonly path: string;
|
|
2548
2660
|
}
|
|
2549
|
-
/** Lists every file in the
|
|
2661
|
+
/** Lists every file in the active workspace (path / state / size / lines / kind summaries); `[]` when no workspace is active. */
|
|
2550
2662
|
| {
|
|
2551
2663
|
readonly operation: 'list';
|
|
2552
2664
|
}
|
|
2553
|
-
/** Reports whether a file exists at `path` in the
|
|
2665
|
+
/** Reports whether a file exists at `path` in the active workspace (`false` when no workspace is active). */
|
|
2554
2666
|
| {
|
|
2555
2667
|
readonly operation: 'has';
|
|
2556
2668
|
readonly path: string;
|
|
2557
2669
|
}
|
|
2558
2670
|
/**
|
|
2559
|
-
* Scans every text file for `query`, returning each hit (path
|
|
2671
|
+
* Scans every text file for `query`, returning each hit (the path, the 1-based line and column, and the line).
|
|
2560
2672
|
*
|
|
2561
2673
|
* @remarks
|
|
2562
2674
|
* `regex` treats `query` as a regular-expression source (default `false` — a literal substring);
|
|
@@ -2592,10 +2704,10 @@ export declare type WorkspaceOperation =
|
|
|
2592
2704
|
}
|
|
2593
2705
|
/**
|
|
2594
2706
|
* Splices `content` into an existing text file, replacing the 1-based range
|
|
2595
|
-
* `(fromLine, fromColumn)` (
|
|
2707
|
+
* `(fromLine, fromColumn)` (inclusive) → `(toLine, toColumn)` (exclusive).
|
|
2596
2708
|
*
|
|
2597
2709
|
* @remarks
|
|
2598
|
-
* The
|
|
2710
|
+
* The flat range edit — the four positive-integer caret components reassemble into a `Range`
|
|
2599
2711
|
* (`@orkestrel/workspace`) through `rangeOf`. An empty span (`from === to`) inserts; a span past
|
|
2600
2712
|
* the end is clamped. An inverted / sub-1 range throws `RANGE`; a binary target throws
|
|
2601
2713
|
* `MODALITY`; a missing target throws `MISSING`.
|
|
@@ -2636,25 +2748,25 @@ export declare type WorkspaceOperation =
|
|
|
2636
2748
|
| {
|
|
2637
2749
|
readonly operation: 'workspaces';
|
|
2638
2750
|
}
|
|
2639
|
-
/** Re-points the manager's
|
|
2751
|
+
/** Re-points the manager's active workspace to the one with `id` (an unknown `id` is a lenient no-op). The edit / read arms target the active workspace from then on. */
|
|
2640
2752
|
| {
|
|
2641
2753
|
readonly operation: 'switch';
|
|
2642
2754
|
readonly id: string;
|
|
2643
2755
|
};
|
|
2644
2756
|
|
|
2645
2757
|
/**
|
|
2646
|
-
* Represents the options for {@link import('./factories.js').createWorkspaceTool} —
|
|
2647
|
-
* {@link WorkspaceManagerInterface} to drive directly,
|
|
2648
|
-
* tool constructs a fresh manager over; neither given
|
|
2649
|
-
* `@orkestrel/workspace`'s in-memory store.
|
|
2758
|
+
* Represents the options for {@link import('./factories.js').createWorkspaceTool} — either a
|
|
2759
|
+
* caller-built {@link WorkspaceManagerInterface} to drive directly, or a
|
|
2760
|
+
* {@link WorkspaceStoreInterface} the tool constructs a fresh manager over; neither given
|
|
2761
|
+
* constructs a manager over `@orkestrel/workspace`'s in-memory store.
|
|
2650
2762
|
*
|
|
2651
2763
|
* @remarks
|
|
2652
|
-
* - `manager` — drive
|
|
2653
|
-
* operation targets). Takes priority over `store` when
|
|
2764
|
+
* - `manager` — drive this manager directly (its `active` workspace is what every edit / read
|
|
2765
|
+
* operation targets). Takes priority over `store` when the caller supplies `manager` and `store`.
|
|
2654
2766
|
* - `store` — construct a manager over this durable {@link WorkspaceStoreInterface} (through
|
|
2655
2767
|
* `@orkestrel/workspace`'s `createWorkspaceManager`) — used only when `manager` is omitted.
|
|
2656
2768
|
* The store only backs the manager's own `open` / `save` operations: the tool's edits are
|
|
2657
|
-
*
|
|
2769
|
+
* not auto-persisted — durability requires an explicit caller `save` on the manager
|
|
2658
2770
|
* (unlike the workflow tool's `store`, which is forwarded into native run-wide checkpoints).
|
|
2659
2771
|
* - `name` / `description` — advertised tool overrides; default to
|
|
2660
2772
|
* {@link import('./constants.js').WORKSPACE_TOOL_NAME} / {@link import('./constants.js').WORKSPACE_TOOL_DESCRIPTION}.
|
|
@@ -2670,71 +2782,71 @@ export declare interface WorkspaceToolOptions {
|
|
|
2670
2782
|
* Describes the shape of a {@link import('./types.js').WorkspaceOperation} — a descriptive tagged union
|
|
2671
2783
|
* over the workspace edit, read, and navigation operations, discriminated by the `operation`
|
|
2672
2784
|
* literal (never a bare `kind`). Each variant leads with its `operation`
|
|
2673
|
-
* discriminant then its
|
|
2785
|
+
* discriminant then its flat fields, every field through `stringShape` / `optionalShape` /
|
|
2674
2786
|
* `integerShape({ min: 1 })` / `booleanShape`, each carrying a strong field-level `description`.
|
|
2675
2787
|
*
|
|
2676
2788
|
* @remarks
|
|
2677
|
-
* The union compiles to an `anyOf` JSON Schema
|
|
2789
|
+
* The union compiles to an `anyOf` JSON Schema, a `unionOf` guard, and a first-match parser
|
|
2678
2790
|
* automatically ({@link import('./factories.js').createWorkspaceTool} types the result to the
|
|
2679
|
-
* hand-written {@link import('./types.js').WorkspaceOperation}). `limit` and the
|
|
2680
|
-
* caret components are
|
|
2681
|
-
* are `optionalShape(booleanShape(...))`. The
|
|
2791
|
+
* hand-written {@link import('./types.js').WorkspaceOperation}). `limit` and the `'splice'`
|
|
2792
|
+
* caret components are positive integers (`integerShape({ min: 1 })`); `regex` / `sensitive`
|
|
2793
|
+
* are `optionalShape(booleanShape(...))`. The registry arms — `workspaces` (list the
|
|
2682
2794
|
* workspaces the model can move between) and `switch` (re-point the active one by `id`) — let a
|
|
2683
|
-
* model
|
|
2684
|
-
*/
|
|
2685
|
-
export declare const workspaceToolShape: UnionShape<readonly [
|
|
2686
|
-
|
|
2687
|
-
|
|
2688
|
-
}, false>, ObjectShape<{
|
|
2689
|
-
|
|
2690
|
-
}, false>, ObjectShape<{
|
|
2691
|
-
|
|
2692
|
-
|
|
2693
|
-
}, false>, ObjectShape<{
|
|
2694
|
-
|
|
2695
|
-
|
|
2696
|
-
|
|
2697
|
-
|
|
2698
|
-
|
|
2699
|
-
}, false>, ObjectShape<{
|
|
2700
|
-
|
|
2701
|
-
|
|
2702
|
-
|
|
2703
|
-
|
|
2704
|
-
|
|
2705
|
-
|
|
2706
|
-
}, false>, ObjectShape<{
|
|
2707
|
-
|
|
2708
|
-
|
|
2709
|
-
|
|
2710
|
-
}, false>, ObjectShape<{
|
|
2711
|
-
|
|
2712
|
-
|
|
2713
|
-
|
|
2714
|
-
|
|
2715
|
-
|
|
2716
|
-
|
|
2717
|
-
|
|
2718
|
-
}, false>, ObjectShape<{
|
|
2719
|
-
|
|
2720
|
-
|
|
2721
|
-
|
|
2722
|
-
}, false>, ObjectShape<{
|
|
2723
|
-
|
|
2724
|
-
|
|
2725
|
-
|
|
2726
|
-
}, false>, ObjectShape<{
|
|
2727
|
-
|
|
2728
|
-
|
|
2729
|
-
|
|
2730
|
-
}, false>, ObjectShape<{
|
|
2731
|
-
|
|
2732
|
-
|
|
2733
|
-
}, false>, ObjectShape<{
|
|
2734
|
-
|
|
2735
|
-
}, false>, ObjectShape<{
|
|
2736
|
-
|
|
2737
|
-
|
|
2795
|
+
* model discover then choose which workspace the edit / read arms target.
|
|
2796
|
+
*/
|
|
2797
|
+
export declare const workspaceToolShape: UnionShape<readonly [ObjectShape< {
|
|
2798
|
+
operation: LiteralShape<readonly ["read"]>;
|
|
2799
|
+
path: StringShape;
|
|
2800
|
+
}, false>, ObjectShape< {
|
|
2801
|
+
operation: LiteralShape<readonly ["list"]>;
|
|
2802
|
+
}, false>, ObjectShape< {
|
|
2803
|
+
operation: LiteralShape<readonly ["has"]>;
|
|
2804
|
+
path: StringShape;
|
|
2805
|
+
}, false>, ObjectShape< {
|
|
2806
|
+
operation: LiteralShape<readonly ["search"]>;
|
|
2807
|
+
query: StringShape;
|
|
2808
|
+
regex: OptionalShape<BooleanShape>;
|
|
2809
|
+
sensitive: OptionalShape<BooleanShape>;
|
|
2810
|
+
limit: OptionalShape<NumberShape>;
|
|
2811
|
+
}, false>, ObjectShape< {
|
|
2812
|
+
operation: LiteralShape<readonly ["replace"]>;
|
|
2813
|
+
query: StringShape;
|
|
2814
|
+
replacement: StringShape;
|
|
2815
|
+
regex: OptionalShape<BooleanShape>;
|
|
2816
|
+
sensitive: OptionalShape<BooleanShape>;
|
|
2817
|
+
limit: OptionalShape<NumberShape>;
|
|
2818
|
+
}, false>, ObjectShape< {
|
|
2819
|
+
operation: LiteralShape<readonly ["write"]>;
|
|
2820
|
+
path: StringShape;
|
|
2821
|
+
content: StringShape;
|
|
2822
|
+
}, false>, ObjectShape< {
|
|
2823
|
+
operation: LiteralShape<readonly ["splice"]>;
|
|
2824
|
+
path: StringShape;
|
|
2825
|
+
content: StringShape;
|
|
2826
|
+
fromLine: NumberShape;
|
|
2827
|
+
fromColumn: NumberShape;
|
|
2828
|
+
toLine: NumberShape;
|
|
2829
|
+
toColumn: NumberShape;
|
|
2830
|
+
}, false>, ObjectShape< {
|
|
2831
|
+
operation: LiteralShape<readonly ["prepend"]>;
|
|
2832
|
+
path: StringShape;
|
|
2833
|
+
content: StringShape;
|
|
2834
|
+
}, false>, ObjectShape< {
|
|
2835
|
+
operation: LiteralShape<readonly ["append"]>;
|
|
2836
|
+
path: StringShape;
|
|
2837
|
+
content: StringShape;
|
|
2838
|
+
}, false>, ObjectShape< {
|
|
2839
|
+
operation: LiteralShape<readonly ["move"]>;
|
|
2840
|
+
from: StringShape;
|
|
2841
|
+
to: StringShape;
|
|
2842
|
+
}, false>, ObjectShape< {
|
|
2843
|
+
operation: LiteralShape<readonly ["remove"]>;
|
|
2844
|
+
path: StringShape;
|
|
2845
|
+
}, false>, ObjectShape< {
|
|
2846
|
+
operation: LiteralShape<readonly ["workspaces"]>;
|
|
2847
|
+
}, false>, ObjectShape< {
|
|
2848
|
+
operation: LiteralShape<readonly ["switch"]>;
|
|
2849
|
+
id: StringShape;
|
|
2738
2850
|
}, false>]>;
|
|
2739
2851
|
|
|
2740
2852
|
export { }
|