@niscorp/cortex 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/DESIGN.md +695 -0
- package/LICENSE +202 -0
- package/README.md +291 -0
- package/dist/index.cjs +1288 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +450 -0
- package/dist/index.d.ts +450 -0
- package/dist/index.js +1270 -0
- package/dist/index.js.map +1 -0
- package/package.json +57 -0
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,450 @@
|
|
|
1
|
+
import { z, ZodType } from 'zod';
|
|
2
|
+
import * as _niscorp_signal from '@niscorp/signal';
|
|
3
|
+
import { StepRequest, StepResult, StreamOptions, StepStreamEvent, CountInput, SignalDescription, Message, StepToolDescriptor } from '@niscorp/signal';
|
|
4
|
+
export { Message } from '@niscorp/signal';
|
|
5
|
+
|
|
6
|
+
type SignalClient = {
|
|
7
|
+
step: (request: StepRequest) => Promise<StepResult>;
|
|
8
|
+
stepStream: (request: StepRequest, options?: StreamOptions) => AsyncIterable<StepStreamEvent>;
|
|
9
|
+
count: (input: CountInput) => Promise<number>;
|
|
10
|
+
describe: () => SignalDescription;
|
|
11
|
+
};
|
|
12
|
+
type Envelope<TData> = {
|
|
13
|
+
response?: string;
|
|
14
|
+
data: TData;
|
|
15
|
+
reasoning?: string;
|
|
16
|
+
};
|
|
17
|
+
type Usage = {
|
|
18
|
+
inputTokens: number;
|
|
19
|
+
outputTokens: number;
|
|
20
|
+
totalTokens: number;
|
|
21
|
+
reported: boolean;
|
|
22
|
+
};
|
|
23
|
+
type OutputStrategy = _niscorp_signal.OutputTransport;
|
|
24
|
+
type RunMeta = {
|
|
25
|
+
usage: Usage;
|
|
26
|
+
strategy: OutputStrategy;
|
|
27
|
+
steps: number;
|
|
28
|
+
outputRetries: number;
|
|
29
|
+
elapsedMs: number;
|
|
30
|
+
};
|
|
31
|
+
type StopReason = 'steps' | 'tokens' | 'duration' | 'output_retries' | 'repeated_calls' | 'custom';
|
|
32
|
+
type ErrorCode = 'model_call_failed' | 'output_invalid' | 'stopped' | 'aborted' | 'unknown';
|
|
33
|
+
type CortexError = {
|
|
34
|
+
code: ErrorCode;
|
|
35
|
+
message: string;
|
|
36
|
+
runId: string;
|
|
37
|
+
agentPath: ReadonlyArray<string>;
|
|
38
|
+
stop?: StopReason;
|
|
39
|
+
lastOutput?: unknown;
|
|
40
|
+
cause?: unknown;
|
|
41
|
+
};
|
|
42
|
+
type RunResult<TData> = {
|
|
43
|
+
ok: true;
|
|
44
|
+
output: Envelope<TData>;
|
|
45
|
+
meta: RunMeta;
|
|
46
|
+
} | {
|
|
47
|
+
ok: false;
|
|
48
|
+
error: CortexError;
|
|
49
|
+
meta: RunMeta;
|
|
50
|
+
};
|
|
51
|
+
type ToolObservation = {
|
|
52
|
+
kind: 'result';
|
|
53
|
+
callId: string;
|
|
54
|
+
toolId: string;
|
|
55
|
+
args: unknown;
|
|
56
|
+
result: unknown;
|
|
57
|
+
durationMs: number;
|
|
58
|
+
} | {
|
|
59
|
+
kind: 'error';
|
|
60
|
+
callId: string;
|
|
61
|
+
toolId: string;
|
|
62
|
+
args: unknown;
|
|
63
|
+
error: string;
|
|
64
|
+
durationMs: number;
|
|
65
|
+
} | {
|
|
66
|
+
kind: 'denied';
|
|
67
|
+
callId: string;
|
|
68
|
+
toolId: string;
|
|
69
|
+
args: unknown;
|
|
70
|
+
reason: string;
|
|
71
|
+
} | {
|
|
72
|
+
kind: 'unknown-tool';
|
|
73
|
+
callId: string;
|
|
74
|
+
toolId: string;
|
|
75
|
+
args: unknown;
|
|
76
|
+
};
|
|
77
|
+
type Unsubscribe = () => void;
|
|
78
|
+
|
|
79
|
+
declare const ToolRiskLevelSchema: z.ZodEnum<{
|
|
80
|
+
low: "low";
|
|
81
|
+
medium: "medium";
|
|
82
|
+
high: "high";
|
|
83
|
+
}>;
|
|
84
|
+
type ToolRiskLevel = z.infer<typeof ToolRiskLevelSchema>;
|
|
85
|
+
declare const ToolConfigSchema: z.ZodObject<{
|
|
86
|
+
id: z.ZodString;
|
|
87
|
+
name: z.ZodString;
|
|
88
|
+
description: z.ZodString;
|
|
89
|
+
category: z.ZodOptional<z.ZodString>;
|
|
90
|
+
riskLevel: z.ZodOptional<z.ZodEnum<{
|
|
91
|
+
low: "low";
|
|
92
|
+
medium: "medium";
|
|
93
|
+
high: "high";
|
|
94
|
+
}>>;
|
|
95
|
+
timeoutMs: z.ZodOptional<z.ZodNumber>;
|
|
96
|
+
}, z.core.$strict>;
|
|
97
|
+
type ToolConfigInput = z.input<typeof ToolConfigSchema>;
|
|
98
|
+
type ToolConfigParsed = z.infer<typeof ToolConfigSchema>;
|
|
99
|
+
|
|
100
|
+
type ApprovalRequest = {
|
|
101
|
+
id: string;
|
|
102
|
+
toolId: string;
|
|
103
|
+
callId: string;
|
|
104
|
+
args: unknown;
|
|
105
|
+
reason: string;
|
|
106
|
+
};
|
|
107
|
+
type CortexEventBase = {
|
|
108
|
+
runId: string;
|
|
109
|
+
agentPath: ReadonlyArray<string>;
|
|
110
|
+
seq: number;
|
|
111
|
+
ts: number;
|
|
112
|
+
};
|
|
113
|
+
type CortexEventBody = {
|
|
114
|
+
type: 'run-start';
|
|
115
|
+
input: unknown;
|
|
116
|
+
} | {
|
|
117
|
+
type: 'step-start';
|
|
118
|
+
step: number;
|
|
119
|
+
} | {
|
|
120
|
+
type: 'model-delta';
|
|
121
|
+
text: string;
|
|
122
|
+
channel: 'text' | 'reasoning';
|
|
123
|
+
} | {
|
|
124
|
+
type: 'tool-start';
|
|
125
|
+
call: {
|
|
126
|
+
id: string;
|
|
127
|
+
toolId: string;
|
|
128
|
+
args: unknown;
|
|
129
|
+
};
|
|
130
|
+
} | {
|
|
131
|
+
type: 'tool-end';
|
|
132
|
+
observation: ToolObservation;
|
|
133
|
+
} | {
|
|
134
|
+
type: 'approval-required';
|
|
135
|
+
approval: ApprovalRequest;
|
|
136
|
+
} | {
|
|
137
|
+
type: 'output-delta';
|
|
138
|
+
text: string;
|
|
139
|
+
} | {
|
|
140
|
+
type: 'output-partial';
|
|
141
|
+
output: unknown;
|
|
142
|
+
} | {
|
|
143
|
+
type: 'retry';
|
|
144
|
+
kind: 'output' | 'termination' | 'provider';
|
|
145
|
+
attempt: number;
|
|
146
|
+
issues: string;
|
|
147
|
+
} | {
|
|
148
|
+
type: 'run-end';
|
|
149
|
+
result: RunResult<unknown>;
|
|
150
|
+
meta: RunMeta;
|
|
151
|
+
};
|
|
152
|
+
type CortexEvent = CortexEventBase & CortexEventBody;
|
|
153
|
+
|
|
154
|
+
type ToolContext = {
|
|
155
|
+
runId: string;
|
|
156
|
+
agentId: string;
|
|
157
|
+
agentPath: ReadonlyArray<string>;
|
|
158
|
+
signal: AbortSignal;
|
|
159
|
+
forward: (event: CortexEvent) => void;
|
|
160
|
+
};
|
|
161
|
+
type ToolConfig<TInput = unknown, TOutput = unknown> = ToolConfigInput & {
|
|
162
|
+
input: ZodType<TInput>;
|
|
163
|
+
output?: ZodType<TOutput>;
|
|
164
|
+
guide?: string | string[] | (() => string | string[]);
|
|
165
|
+
execute: (input: TInput, context: ToolContext) => Promise<TOutput> | TOutput;
|
|
166
|
+
};
|
|
167
|
+
type ToolDefinition = {
|
|
168
|
+
readonly toolId: string;
|
|
169
|
+
readonly config: ToolConfigParsed & {
|
|
170
|
+
input: ZodType;
|
|
171
|
+
output?: ZodType;
|
|
172
|
+
guide?: string | string[] | (() => string | string[]);
|
|
173
|
+
execute: (input: unknown, context: ToolContext) => unknown;
|
|
174
|
+
};
|
|
175
|
+
};
|
|
176
|
+
declare const defineTool: <TInput, TOutput>(config: ToolConfig<TInput, TOutput>) => ToolDefinition;
|
|
177
|
+
|
|
178
|
+
type RunInput = string | Message[] | unknown;
|
|
179
|
+
type AgentInfo = {
|
|
180
|
+
id: string;
|
|
181
|
+
description?: string;
|
|
182
|
+
};
|
|
183
|
+
type ProducerArgs<TDeps> = {
|
|
184
|
+
deps: TDeps;
|
|
185
|
+
input: RunInput;
|
|
186
|
+
agent: AgentInfo;
|
|
187
|
+
};
|
|
188
|
+
type ContextEntry = string | string[] | Message[];
|
|
189
|
+
type Producer<TDeps = undefined> = (args: ProducerArgs<TDeps>) => ContextEntry | Promise<ContextEntry>;
|
|
190
|
+
declare const inputMessages: (input: RunInput) => Message[];
|
|
191
|
+
declare const toolGuidesMessage: (tools: ReadonlyArray<ToolDefinition>) => Message[];
|
|
192
|
+
declare const estimateTokens: (messages: ReadonlyArray<Message>) => number;
|
|
193
|
+
|
|
194
|
+
type ToolCallInfo = {
|
|
195
|
+
id: string;
|
|
196
|
+
toolId: string;
|
|
197
|
+
args: unknown;
|
|
198
|
+
riskLevel?: ToolRiskLevel;
|
|
199
|
+
};
|
|
200
|
+
type RunCtx<TDeps> = {
|
|
201
|
+
runId: string;
|
|
202
|
+
agentId: string;
|
|
203
|
+
agentPath: ReadonlyArray<string>;
|
|
204
|
+
deps: TDeps;
|
|
205
|
+
step: number;
|
|
206
|
+
usage: Usage;
|
|
207
|
+
signal: AbortSignal;
|
|
208
|
+
};
|
|
209
|
+
type GateDecision = {
|
|
210
|
+
allow: true;
|
|
211
|
+
args?: unknown;
|
|
212
|
+
} | {
|
|
213
|
+
deny: string;
|
|
214
|
+
} | {
|
|
215
|
+
ask: {
|
|
216
|
+
reason: string;
|
|
217
|
+
};
|
|
218
|
+
};
|
|
219
|
+
type ToolGate<TDeps = unknown> = (call: ToolCallInfo, ctx: RunCtx<TDeps>) => GateDecision | Promise<GateDecision>;
|
|
220
|
+
type ToolResultHook<TDeps = unknown> = (observation: ToolObservation, ctx: RunCtx<TDeps>) => {
|
|
221
|
+
result?: unknown;
|
|
222
|
+
} | void | Promise<{
|
|
223
|
+
result?: unknown;
|
|
224
|
+
} | void>;
|
|
225
|
+
type PrepareStepInfo<TDeps> = {
|
|
226
|
+
step: number;
|
|
227
|
+
messages: ReadonlyArray<Message>;
|
|
228
|
+
usage: Usage;
|
|
229
|
+
tools: ReadonlyArray<string>;
|
|
230
|
+
deps: TDeps;
|
|
231
|
+
};
|
|
232
|
+
type PrepareStepResult = {
|
|
233
|
+
activeTools?: ReadonlyArray<string>;
|
|
234
|
+
toolChoice?: StepRequest['toolChoice'];
|
|
235
|
+
inject?: Message[];
|
|
236
|
+
llm?: SignalClient;
|
|
237
|
+
};
|
|
238
|
+
type PrepareStep<TDeps = unknown> = (info: PrepareStepInfo<TDeps>) => PrepareStepResult | void | Promise<PrepareStepResult | void>;
|
|
239
|
+
type RunProgress = {
|
|
240
|
+
steps: number;
|
|
241
|
+
usage: Usage;
|
|
242
|
+
elapsedMs: number;
|
|
243
|
+
outputRetries: number;
|
|
244
|
+
repeatedCalls: number;
|
|
245
|
+
};
|
|
246
|
+
type StopVerdict = {
|
|
247
|
+
stop: StopReason;
|
|
248
|
+
message: string;
|
|
249
|
+
} | null;
|
|
250
|
+
type StopCondition = (progress: RunProgress) => StopVerdict;
|
|
251
|
+
|
|
252
|
+
type ToolPolicy = {
|
|
253
|
+
tools?: {
|
|
254
|
+
allow?: ReadonlyArray<string>;
|
|
255
|
+
deny?: ReadonlyArray<string>;
|
|
256
|
+
requireApproval?: ReadonlyArray<string>;
|
|
257
|
+
maxRiskLevel?: ToolRiskLevel;
|
|
258
|
+
};
|
|
259
|
+
approvalTimeoutMs?: number;
|
|
260
|
+
};
|
|
261
|
+
declare const policyGate: (policy: ToolPolicy) => ToolGate<unknown>;
|
|
262
|
+
|
|
263
|
+
type NormalizedCall = {
|
|
264
|
+
id: string;
|
|
265
|
+
toolId: string;
|
|
266
|
+
args: unknown;
|
|
267
|
+
};
|
|
268
|
+
type PendingApproval = {
|
|
269
|
+
approvalId: string;
|
|
270
|
+
call: NormalizedCall;
|
|
271
|
+
remaining: NormalizedCall[];
|
|
272
|
+
reason: string;
|
|
273
|
+
};
|
|
274
|
+
type OutputValidator<TData> = (output: Envelope<TData>) => {
|
|
275
|
+
ok: true;
|
|
276
|
+
} | {
|
|
277
|
+
retry: string;
|
|
278
|
+
} | Promise<{
|
|
279
|
+
ok: true;
|
|
280
|
+
} | {
|
|
281
|
+
retry: string;
|
|
282
|
+
}>;
|
|
283
|
+
|
|
284
|
+
type ResponseMode = 'required' | 'optional';
|
|
285
|
+
|
|
286
|
+
type RunOptions<TDeps> = {
|
|
287
|
+
llm?: SignalClient;
|
|
288
|
+
tools?: ReadonlyArray<ToolDefinition>;
|
|
289
|
+
producers?: ReadonlyArray<ContextEntry | Producer<TDeps>>;
|
|
290
|
+
gates?: ReadonlyArray<ToolGate<TDeps>>;
|
|
291
|
+
onToolResult?: ReadonlyArray<ToolResultHook<TDeps>>;
|
|
292
|
+
signal?: AbortSignal;
|
|
293
|
+
onEvent?: (event: CortexEvent) => void;
|
|
294
|
+
agentPath?: ReadonlyArray<string>;
|
|
295
|
+
} & (undefined extends TDeps ? {
|
|
296
|
+
deps?: TDeps;
|
|
297
|
+
} : {
|
|
298
|
+
deps: TDeps;
|
|
299
|
+
});
|
|
300
|
+
type RunSnapshot = {
|
|
301
|
+
version: 1;
|
|
302
|
+
runId: string;
|
|
303
|
+
agentId: string;
|
|
304
|
+
input: RunInput;
|
|
305
|
+
messages: Message[];
|
|
306
|
+
steps: number;
|
|
307
|
+
usage: Usage;
|
|
308
|
+
outputRetries: number;
|
|
309
|
+
elapsedMs: number;
|
|
310
|
+
pending?: PendingApproval;
|
|
311
|
+
};
|
|
312
|
+
type RunHandle<TData> = {
|
|
313
|
+
runId: string;
|
|
314
|
+
agentPath: ReadonlyArray<string>;
|
|
315
|
+
events: AsyncIterable<CortexEvent>;
|
|
316
|
+
onEvent: (listener: (event: CortexEvent) => void) => Unsubscribe;
|
|
317
|
+
result: Promise<RunResult<TData>>;
|
|
318
|
+
approve: (approvalId: string, options?: {
|
|
319
|
+
args?: unknown;
|
|
320
|
+
}) => void;
|
|
321
|
+
deny: (approvalId: string, reason?: string) => void;
|
|
322
|
+
snapshot: () => RunSnapshot;
|
|
323
|
+
abort: (reason?: string) => void;
|
|
324
|
+
};
|
|
325
|
+
declare const resumeRun: <TData, TDeps>(definition: AgentDefinition<TData, TDeps>, snapshot: RunSnapshot, ...args: undefined extends TDeps ? [options?: RunOptions<TDeps>] : [options: RunOptions<TDeps>]) => RunHandle<TData>;
|
|
326
|
+
|
|
327
|
+
type ResolvedPreview = {
|
|
328
|
+
strategy: OutputStrategy;
|
|
329
|
+
respondDetail?: 'full' | 'loose' | 'permissive';
|
|
330
|
+
messages: Message[];
|
|
331
|
+
tools: StepToolDescriptor[];
|
|
332
|
+
estimatedTokens: number;
|
|
333
|
+
};
|
|
334
|
+
|
|
335
|
+
type OutputConfig<TData> = {
|
|
336
|
+
schema?: ZodType<TData>;
|
|
337
|
+
response?: ResponseMode;
|
|
338
|
+
strategy?: 'auto' | OutputStrategy;
|
|
339
|
+
forceTool?: boolean;
|
|
340
|
+
doc?: 'auto' | 'off' | string;
|
|
341
|
+
validate?: OutputValidator<TData>;
|
|
342
|
+
};
|
|
343
|
+
type AgentConfig<TData, TDeps> = {
|
|
344
|
+
id: string;
|
|
345
|
+
description?: string;
|
|
346
|
+
llm?: SignalClient;
|
|
347
|
+
transport?: 'stream' | 'step';
|
|
348
|
+
instructions: string | ((args: ProducerArgs<TDeps>) => string);
|
|
349
|
+
context?: ReadonlyArray<ContextEntry | Producer<TDeps>>;
|
|
350
|
+
tools?: ReadonlyArray<ToolDefinition>;
|
|
351
|
+
output?: OutputConfig<TData>;
|
|
352
|
+
toolGates?: ReadonlyArray<ToolGate<TDeps>>;
|
|
353
|
+
onToolResult?: ReadonlyArray<ToolResultHook<TDeps>>;
|
|
354
|
+
prepareStep?: PrepareStep<TDeps>;
|
|
355
|
+
stopWhen?: ReadonlyArray<StopCondition>;
|
|
356
|
+
policy?: ToolPolicy;
|
|
357
|
+
};
|
|
358
|
+
type RunArgs<TDeps> = undefined extends TDeps ? [options?: RunOptions<TDeps>] : [options: RunOptions<TDeps>];
|
|
359
|
+
type AgentDefinition<TData = undefined, TDeps = undefined> = {
|
|
360
|
+
readonly agentId: string;
|
|
361
|
+
readonly config: AgentConfig<TData, TDeps>;
|
|
362
|
+
run: (input: RunInput, ...args: RunArgs<TDeps>) => RunHandle<TData>;
|
|
363
|
+
preview: (input: RunInput, ...args: RunArgs<TDeps>) => Promise<ResolvedPreview>;
|
|
364
|
+
};
|
|
365
|
+
declare const defineAgent: <TData = undefined, TDeps = undefined>(config: AgentConfig<TData, TDeps>) => AgentDefinition<TData, TDeps>;
|
|
366
|
+
|
|
367
|
+
type ErasedRunOptions = {
|
|
368
|
+
deps?: unknown;
|
|
369
|
+
llm?: SignalClient;
|
|
370
|
+
tools?: ReadonlyArray<ToolDefinition>;
|
|
371
|
+
gates?: ReadonlyArray<ToolGate<unknown>>;
|
|
372
|
+
signal?: AbortSignal;
|
|
373
|
+
onEvent?: (event: CortexEvent) => void;
|
|
374
|
+
agentPath?: ReadonlyArray<string>;
|
|
375
|
+
};
|
|
376
|
+
type ErasedAgent<TData = unknown> = {
|
|
377
|
+
agentId: string;
|
|
378
|
+
config: {
|
|
379
|
+
description?: string;
|
|
380
|
+
llm?: SignalClient;
|
|
381
|
+
};
|
|
382
|
+
run: (input: RunInput, options?: ErasedRunOptions) => RunHandle<TData>;
|
|
383
|
+
preview: (input: RunInput, options?: ErasedRunOptions) => Promise<ResolvedPreview>;
|
|
384
|
+
};
|
|
385
|
+
type RunTap = (run: RunHandle<unknown>) => void;
|
|
386
|
+
|
|
387
|
+
type ManifoldConfig = {
|
|
388
|
+
llm?: SignalClient;
|
|
389
|
+
gates?: ReadonlyArray<ToolGate<unknown>>;
|
|
390
|
+
onRun?: RunTap;
|
|
391
|
+
};
|
|
392
|
+
type Registrable = {
|
|
393
|
+
agentId: string;
|
|
394
|
+
} | {
|
|
395
|
+
toolId: string;
|
|
396
|
+
};
|
|
397
|
+
type ManifoldAsToolOptions = {
|
|
398
|
+
id?: string;
|
|
399
|
+
description?: string;
|
|
400
|
+
llm?: SignalClient;
|
|
401
|
+
timeoutMs?: number;
|
|
402
|
+
deps?: unknown;
|
|
403
|
+
select?: (output: Envelope<unknown>) => unknown;
|
|
404
|
+
};
|
|
405
|
+
type Manifold = {
|
|
406
|
+
register: (...definitions: ReadonlyArray<Registrable>) => void;
|
|
407
|
+
run: <TData = unknown>(agentId: string, input: RunInput, options?: ErasedRunOptions) => RunHandle<TData>;
|
|
408
|
+
preview: (agentId: string, input: RunInput, options?: ErasedRunOptions) => Promise<ResolvedPreview>;
|
|
409
|
+
asTool: (agentId: string, options?: ManifoldAsToolOptions) => ToolDefinition;
|
|
410
|
+
agent: (agentId: string) => ErasedAgent;
|
|
411
|
+
tool: (toolId: string) => ToolDefinition;
|
|
412
|
+
agents: () => ReadonlyArray<ErasedAgent>;
|
|
413
|
+
tools: () => ReadonlyArray<ToolDefinition>;
|
|
414
|
+
};
|
|
415
|
+
declare const createManifold: (config?: ManifoldConfig) => Manifold;
|
|
416
|
+
|
|
417
|
+
type AsToolOptions<TData, TDeps> = {
|
|
418
|
+
id?: string;
|
|
419
|
+
description?: string;
|
|
420
|
+
llm?: SignalClient;
|
|
421
|
+
timeoutMs?: number;
|
|
422
|
+
select?: (output: Envelope<TData>) => unknown;
|
|
423
|
+
} & (undefined extends TDeps ? {
|
|
424
|
+
deps?: TDeps;
|
|
425
|
+
} : {
|
|
426
|
+
deps: TDeps;
|
|
427
|
+
});
|
|
428
|
+
declare const asTool: <TData, TDeps>(agent: AgentDefinition<TData, TDeps>, ...args: undefined extends TDeps ? [options?: AsToolOptions<TData, TDeps>] : [options: AsToolOptions<TData, TDeps>]) => ToolDefinition;
|
|
429
|
+
|
|
430
|
+
type SchemaIssue = {
|
|
431
|
+
code?: string;
|
|
432
|
+
path: PropertyKey[];
|
|
433
|
+
message: string;
|
|
434
|
+
errors?: SchemaIssue[][];
|
|
435
|
+
};
|
|
436
|
+
declare const flattenSchemaIssues: (issues: SchemaIssue[], prefix?: PropertyKey[]) => SchemaIssue[];
|
|
437
|
+
|
|
438
|
+
type SchemaDocOptions = {
|
|
439
|
+
title?: string;
|
|
440
|
+
};
|
|
441
|
+
declare const schemaDoc: (schema: ZodType, options?: SchemaDocOptions) => string;
|
|
442
|
+
|
|
443
|
+
declare const stepCount: (max: number) => StopCondition;
|
|
444
|
+
declare const tokens: (max: number) => StopCondition;
|
|
445
|
+
declare const duration: (value: number | string) => StopCondition;
|
|
446
|
+
declare const outputRetries: (max: number) => StopCondition;
|
|
447
|
+
declare const repeatedCalls: (max: number) => StopCondition;
|
|
448
|
+
declare const DEFAULT_STOP_CONDITIONS: ReadonlyArray<StopCondition>;
|
|
449
|
+
|
|
450
|
+
export { type AgentConfig, type AgentDefinition, type AgentInfo, type ApprovalRequest, type AsToolOptions, type ContextEntry, type CortexError, type CortexEvent, type CortexEventBody, DEFAULT_STOP_CONDITIONS, type Envelope, type ErasedAgent, type ErasedRunOptions, type ErrorCode, type GateDecision, type Manifold, type ManifoldAsToolOptions, type ManifoldConfig, type OutputConfig, type OutputStrategy, type OutputValidator, type PrepareStep, type PrepareStepInfo, type PrepareStepResult, type Producer, type ProducerArgs, type Registrable, type ResolvedPreview, type ResponseMode, type RunArgs, type RunCtx, type RunHandle, type RunInput, type RunMeta, type RunOptions, type RunProgress, type RunResult, type RunSnapshot, type SchemaIssue, type SignalClient, type StopCondition, type StopReason, type StopVerdict, type ToolCallInfo, type ToolConfig, type ToolContext, type ToolDefinition, type ToolGate, type ToolObservation, type ToolPolicy, type ToolResultHook, type Unsubscribe, type Usage, asTool, createManifold, defineAgent, defineTool, duration, estimateTokens, flattenSchemaIssues, inputMessages, outputRetries, policyGate, repeatedCalls, resumeRun, schemaDoc, stepCount, tokens, toolGuidesMessage };
|