@noetic-tools/types 3.6.0 → 3.7.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/dist/errors/noetic-config-error.d.ts +12 -2
- package/dist/errors/noetic-config-error.js +15 -2
- package/dist/errors/noetic-error.js +2 -0
- package/dist/schemas/workflow.d.ts +12 -0
- package/dist/schemas/workflow.js +7 -0
- package/dist/types/error.d.ts +11 -0
- package/dist/types/runtime.d.ts +3 -1
- package/package.json +1 -1
|
@@ -22,8 +22,8 @@ export declare class NoeticConfigError extends Error {
|
|
|
22
22
|
readonly code: string;
|
|
23
23
|
/** Complete sentence describing what the user should do next. */
|
|
24
24
|
readonly hint: string;
|
|
25
|
-
/** Link to the
|
|
26
|
-
readonly docsUrl
|
|
25
|
+
/** Link to the docs explaining this code; defaults to its section of the error reference. */
|
|
26
|
+
readonly docsUrl: string;
|
|
27
27
|
constructor(opts: {
|
|
28
28
|
code: string;
|
|
29
29
|
message: string;
|
|
@@ -31,6 +31,16 @@ export declare class NoeticConfigError extends Error {
|
|
|
31
31
|
docsUrl?: string;
|
|
32
32
|
});
|
|
33
33
|
}
|
|
34
|
+
/**
|
|
35
|
+
* @public
|
|
36
|
+
* The error reference section for a config error `code`. Each code has a
|
|
37
|
+
* heading of its own name on that page, and the docs site slugs headings to
|
|
38
|
+
* lower case, so the code in lower case is the anchor.
|
|
39
|
+
*
|
|
40
|
+
* @param code - A `NoeticConfigError` code, e.g. `'MISSING_API_KEY'`.
|
|
41
|
+
* @returns The URL of the code's section, e.g. `…/errors#missing_api_key`.
|
|
42
|
+
*/
|
|
43
|
+
export declare function configErrorDocsUrl(code: string): string;
|
|
34
44
|
/**
|
|
35
45
|
* @public
|
|
36
46
|
* Type guard for `NoeticConfigError`.
|
|
@@ -22,16 +22,29 @@ export class NoeticConfigError extends Error {
|
|
|
22
22
|
code;
|
|
23
23
|
/** Complete sentence describing what the user should do next. */
|
|
24
24
|
hint;
|
|
25
|
-
/** Link to the
|
|
25
|
+
/** Link to the docs explaining this code; defaults to its section of the error reference. */
|
|
26
26
|
docsUrl;
|
|
27
27
|
constructor(opts) {
|
|
28
28
|
super(opts.message);
|
|
29
29
|
this.name = 'NoeticConfigError';
|
|
30
30
|
this.code = opts.code;
|
|
31
31
|
this.hint = opts.hint;
|
|
32
|
-
this.docsUrl = opts.docsUrl;
|
|
32
|
+
this.docsUrl = opts.docsUrl ?? configErrorDocsUrl(opts.code);
|
|
33
33
|
}
|
|
34
34
|
}
|
|
35
|
+
const ERROR_REFERENCE_URL = 'https://noetic.tools/docs/framework/errors';
|
|
36
|
+
/**
|
|
37
|
+
* @public
|
|
38
|
+
* The error reference section for a config error `code`. Each code has a
|
|
39
|
+
* heading of its own name on that page, and the docs site slugs headings to
|
|
40
|
+
* lower case, so the code in lower case is the anchor.
|
|
41
|
+
*
|
|
42
|
+
* @param code - A `NoeticConfigError` code, e.g. `'MISSING_API_KEY'`.
|
|
43
|
+
* @returns The URL of the code's section, e.g. `…/errors#missing_api_key`.
|
|
44
|
+
*/
|
|
45
|
+
export function configErrorDocsUrl(code) {
|
|
46
|
+
return `${ERROR_REFERENCE_URL}#${code.toLowerCase()}`;
|
|
47
|
+
}
|
|
35
48
|
/**
|
|
36
49
|
* @public
|
|
37
50
|
* Type guard for `NoeticConfigError`.
|
|
@@ -51,6 +51,8 @@ function formatMessage(error) {
|
|
|
51
51
|
return `Model rate limited at step '${error.stepId}'${error.retryAfter ? ` (retry after ${error.retryAfter}ms)` : ''}`;
|
|
52
52
|
case 'fork_partial':
|
|
53
53
|
return `Fork '${error.stepId}' partial failure: ${error.succeeded.length} succeeded, ${error.failed.length} failed`;
|
|
54
|
+
case 'spawn_summary_failed':
|
|
55
|
+
return `Spawn '${error.stepId}' summary failed: ${error.summaryCause.message}`;
|
|
54
56
|
case 'channel_timeout':
|
|
55
57
|
return `Channel '${error.channelName}' timed out after ${error.timeout}ms`;
|
|
56
58
|
case 'channel_closed':
|
|
@@ -181,6 +181,16 @@ declare const AcpSessionPolicySchema: z.ZodObject<{
|
|
|
181
181
|
}>>;
|
|
182
182
|
load: z.ZodOptional<z.ZodString>;
|
|
183
183
|
}, z.core.$strip>;
|
|
184
|
+
/**
|
|
185
|
+
* @public
|
|
186
|
+
* Which part of a node's input names the work it does, so a resumed run replays the
|
|
187
|
+
* node by content rather than by position. `true` keys on the whole input. `from`
|
|
188
|
+
* keys on those top-level properties of the input parsed as a JSON object — the same
|
|
189
|
+
* lookup an `inParallel` node's `over` does. See spec 26 § Replay keys.
|
|
190
|
+
*/
|
|
191
|
+
export type WorkflowReplayKey = true | {
|
|
192
|
+
from: string[];
|
|
193
|
+
};
|
|
184
194
|
interface WorkflowNodeBase {
|
|
185
195
|
id: string;
|
|
186
196
|
/**
|
|
@@ -188,6 +198,8 @@ interface WorkflowNodeBase {
|
|
|
188
198
|
* `false` makes the node run again on every resume. See spec 23a § Identity.
|
|
189
199
|
*/
|
|
190
200
|
durable?: boolean;
|
|
201
|
+
/** Replay this node by its input instead of its position. Ignored when `durable` is `false`. */
|
|
202
|
+
replayKey?: WorkflowReplayKey;
|
|
191
203
|
}
|
|
192
204
|
/**
|
|
193
205
|
* A reference to a streaming `OutputCodec` for a `callModel` node's structured
|
package/dist/schemas/workflow.js
CHANGED
|
@@ -209,9 +209,16 @@ const AcpSessionPolicySchema = z.object({
|
|
|
209
209
|
//#endregion
|
|
210
210
|
//#region Workflow Node Schema
|
|
211
211
|
const WorkflowNodeRef = z.lazy(() => WorkflowNodeSchema);
|
|
212
|
+
const WorkflowReplayKeySchema = z.union([
|
|
213
|
+
z.literal(true),
|
|
214
|
+
z.object({
|
|
215
|
+
from: z.array(z.string().min(1)).min(1),
|
|
216
|
+
}),
|
|
217
|
+
]);
|
|
212
218
|
const SHARED_FIELDS = {
|
|
213
219
|
id: z.string().min(1),
|
|
214
220
|
durable: z.boolean().optional(),
|
|
221
|
+
replayKey: WorkflowReplayKeySchema.optional(),
|
|
215
222
|
};
|
|
216
223
|
const OutputCodecRefSchema = z.object({
|
|
217
224
|
codec: z.literal('openui'),
|
package/dist/types/error.d.ts
CHANGED
|
@@ -32,6 +32,17 @@ export type NoeticError = {
|
|
|
32
32
|
stepId: string;
|
|
33
33
|
error: NoeticError;
|
|
34
34
|
}>;
|
|
35
|
+
} | {
|
|
36
|
+
/**
|
|
37
|
+
* A spawn's child succeeded but a context layer's `onReturn` hook (for
|
|
38
|
+
* example a summarizer) failed. The runtime does not throw this: the
|
|
39
|
+
* spawn returns `childOutput` and reports this error as a layer
|
|
40
|
+
* diagnostic and a span event, so the child's work is never discarded.
|
|
41
|
+
*/
|
|
42
|
+
kind: 'spawn_summary_failed';
|
|
43
|
+
stepId: string;
|
|
44
|
+
childOutput: unknown;
|
|
45
|
+
summaryCause: Error;
|
|
35
46
|
} | {
|
|
36
47
|
kind: 'channel_timeout';
|
|
37
48
|
channelName: string;
|
package/dist/types/runtime.d.ts
CHANGED
|
@@ -319,7 +319,9 @@ export interface AgentHarnessContract<TParams extends Record<string, unknown> =
|
|
|
319
319
|
disposeLayers(layers: ContextLayer[], ctx: Context): Promise<void>;
|
|
320
320
|
checkpoint(ctx: Context): Promise<void>;
|
|
321
321
|
/**
|
|
322
|
-
* Rebuild a `Context` from a persisted snapshot
|
|
322
|
+
* Rebuild a `Context` from a persisted snapshot, or from the step-completion
|
|
323
|
+
* ledger alone when no snapshot was saved (recorded steps replay, the rest run
|
|
324
|
+
* fresh). Resolves `null` when neither is recorded. `opts` carries the wiring
|
|
323
325
|
* the host attached when it created the original context — without it a
|
|
324
326
|
* decorated context is silently replaced by a bare one on resume.
|
|
325
327
|
*/
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@noetic-tools/types",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.7.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Foundational type contracts and primitives shared across the Noetic framework (items, LLM config, adapters, steering, errors).",
|
|
6
6
|
"license": "Apache-2.0",
|