@agenteer/stdlib 1.0.0-rc.1
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 +98 -0
- package/dist/.tsbuildinfo +1 -0
- package/dist/context/context_curator.d.ts +115 -0
- package/dist/context/context_curator.d.ts.map +1 -0
- package/dist/context/context_curator.js +132 -0
- package/dist/context/context_curator.js.map +1 -0
- package/dist/humans/approval_gate.d.ts +82 -0
- package/dist/humans/approval_gate.d.ts.map +1 -0
- package/dist/humans/approval_gate.js +76 -0
- package/dist/humans/approval_gate.js.map +1 -0
- package/dist/humans/ask_user.d.ts +79 -0
- package/dist/humans/ask_user.d.ts.map +1 -0
- package/dist/humans/ask_user.js +101 -0
- package/dist/humans/ask_user.js.map +1 -0
- package/dist/index.d.ts +49 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +93 -0
- package/dist/index.js.map +1 -0
- package/dist/meta/cross_check.d.ts +96 -0
- package/dist/meta/cross_check.d.ts.map +1 -0
- package/dist/meta/cross_check.js +165 -0
- package/dist/meta/cross_check.js.map +1 -0
- package/dist/meta/judge_with_stripped_ctx.d.ts +75 -0
- package/dist/meta/judge_with_stripped_ctx.d.ts.map +1 -0
- package/dist/meta/judge_with_stripped_ctx.js +151 -0
- package/dist/meta/judge_with_stripped_ctx.js.map +1 -0
- package/dist/meta/parallel_fanout.d.ts +83 -0
- package/dist/meta/parallel_fanout.d.ts.map +1 -0
- package/dist/meta/parallel_fanout.js +120 -0
- package/dist/meta/parallel_fanout.js.map +1 -0
- package/dist/meta/repair_loop.d.ts +90 -0
- package/dist/meta/repair_loop.d.ts.map +1 -0
- package/dist/meta/repair_loop.js +230 -0
- package/dist/meta/repair_loop.js.map +1 -0
- package/dist/planner/default_planner.d.ts +88 -0
- package/dist/planner/default_planner.d.ts.map +1 -0
- package/dist/planner/default_planner.js +156 -0
- package/dist/planner/default_planner.js.map +1 -0
- package/dist/primitives/file_read.d.ts +60 -0
- package/dist/primitives/file_read.d.ts.map +1 -0
- package/dist/primitives/file_read.js +68 -0
- package/dist/primitives/file_read.js.map +1 -0
- package/dist/primitives/file_write.d.ts +60 -0
- package/dist/primitives/file_write.d.ts.map +1 -0
- package/dist/primitives/file_write.js +66 -0
- package/dist/primitives/file_write.js.map +1 -0
- package/dist/primitives/llm_call.d.ts +85 -0
- package/dist/primitives/llm_call.d.ts.map +1 -0
- package/dist/primitives/llm_call.js +99 -0
- package/dist/primitives/llm_call.js.map +1 -0
- package/dist/primitives/shell_exec.d.ts +66 -0
- package/dist/primitives/shell_exec.d.ts.map +1 -0
- package/dist/primitives/shell_exec.js +106 -0
- package/dist/primitives/shell_exec.js.map +1 -0
- package/dist/primitives/tool_call.d.ts +62 -0
- package/dist/primitives/tool_call.d.ts.map +1 -0
- package/dist/primitives/tool_call.js +69 -0
- package/dist/primitives/tool_call.js.map +1 -0
- package/dist/shared/capture.d.ts +34 -0
- package/dist/shared/capture.d.ts.map +1 -0
- package/dist/shared/capture.js +124 -0
- package/dist/shared/capture.js.map +1 -0
- package/dist/shared/ctx.d.ts +14 -0
- package/dist/shared/ctx.d.ts.map +1 -0
- package/dist/shared/ctx.js +48 -0
- package/dist/shared/ctx.js.map +1 -0
- package/dist/shared/index.d.ts +4 -0
- package/dist/shared/index.d.ts.map +1 -0
- package/dist/shared/index.js +4 -0
- package/dist/shared/index.js.map +1 -0
- package/dist/shared/validator.d.ts +47 -0
- package/dist/shared/validator.d.ts.map +1 -0
- package/dist/shared/validator.js +41 -0
- package/dist/shared/validator.js.map +1 -0
- package/dist/validators/compile.d.ts +83 -0
- package/dist/validators/compile.d.ts.map +1 -0
- package/dist/validators/compile.js +126 -0
- package/dist/validators/compile.js.map +1 -0
- package/dist/validators/json_schema_validate.d.ts +72 -0
- package/dist/validators/json_schema_validate.d.ts.map +1 -0
- package/dist/validators/json_schema_validate.js +85 -0
- package/dist/validators/json_schema_validate.js.map +1 -0
- package/dist/validators/regex_check.d.ts +64 -0
- package/dist/validators/regex_check.d.ts.map +1 -0
- package/dist/validators/regex_check.js +85 -0
- package/dist/validators/regex_check.js.map +1 -0
- package/dist/validators/test_run.d.ts +74 -0
- package/dist/validators/test_run.d.ts.map +1 -0
- package/dist/validators/test_run.js +149 -0
- package/dist/validators/test_run.js.map +1 -0
- package/dist/validators/typecheck.d.ts +61 -0
- package/dist/validators/typecheck.d.ts.map +1 -0
- package/dist/validators/typecheck.js +89 -0
- package/dist/validators/typecheck.js.map +1 -0
- package/package.json +61 -0
- package/src/context/context_curator.ts +154 -0
- package/src/humans/approval_gate.ts +101 -0
- package/src/humans/ask_user.ts +137 -0
- package/src/index.ts +149 -0
- package/src/meta/cross_check.ts +219 -0
- package/src/meta/judge_with_stripped_ctx.ts +171 -0
- package/src/meta/parallel_fanout.ts +142 -0
- package/src/meta/repair_loop.ts +267 -0
- package/src/planner/default_planner.ts +182 -0
- package/src/primitives/file_read.ts +82 -0
- package/src/primitives/file_write.ts +80 -0
- package/src/primitives/llm_call.ts +113 -0
- package/src/primitives/shell_exec.ts +122 -0
- package/src/primitives/tool_call.ts +84 -0
- package/src/shared/capture.ts +155 -0
- package/src/shared/ctx.ts +45 -0
- package/src/shared/index.ts +17 -0
- package/src/shared/validator.ts +51 -0
- package/src/validators/compile.ts +175 -0
- package/src/validators/json_schema_validate.ts +103 -0
- package/src/validators/regex_check.ts +107 -0
- package/src/validators/test_run.ts +199 -0
- package/src/validators/typecheck.ts +121 -0
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `@agenteer/node-approval-gate` — human yes/no gate (sub-plan 03 §16).
|
|
3
|
+
*
|
|
4
|
+
* M4 scope (Q3-C decision): ship this, defer `ask_user` to M5 where the
|
|
5
|
+
* CLI can prompt a real user. The approval_gate is deterministic given
|
|
6
|
+
* its recorded decision, so tests can inject an `ApprovalResolver` that
|
|
7
|
+
* returns a canned answer. Session resume wires a real CLI prompt in M5.
|
|
8
|
+
*
|
|
9
|
+
* When the resolver is absent, the node returns `NeedsUser` with a
|
|
10
|
+
* prompt — that's the production-pause-for-CLI path.
|
|
11
|
+
*/
|
|
12
|
+
import { z } from "zod";
|
|
13
|
+
import { makeManifest, } from "@agenteer/core";
|
|
14
|
+
const MANIFEST = makeManifest({
|
|
15
|
+
id: "@agenteer/node-approval-gate",
|
|
16
|
+
name: "approval_gate",
|
|
17
|
+
description: "Yes/no gate. When an ApprovalResolver is injected, resolves synchronously (tests + replay); otherwise returns NeedsUser.",
|
|
18
|
+
determinism: "deterministic",
|
|
19
|
+
tags: ["human"],
|
|
20
|
+
});
|
|
21
|
+
const InputSchema = z.object({
|
|
22
|
+
prompt: z.string().min(1),
|
|
23
|
+
/**
|
|
24
|
+
* Deterministic marker — when `decision` is present, the gate echoes
|
|
25
|
+
* it immediately without asking. Enables replay of a recorded session.
|
|
26
|
+
*/
|
|
27
|
+
decision: z.enum(["approve", "deny"]).optional(),
|
|
28
|
+
/** Opaque id the resolver / CLI uses to look up the canned answer. */
|
|
29
|
+
decision_id: z.string().optional(),
|
|
30
|
+
});
|
|
31
|
+
const OutputSchema = z.object({
|
|
32
|
+
decision: z.enum(["approve", "deny"]),
|
|
33
|
+
/** Echo of the prompt for audit. */
|
|
34
|
+
prompt: z.string(),
|
|
35
|
+
source: z.enum(["recorded", "resolver", "user"]),
|
|
36
|
+
});
|
|
37
|
+
export function approvalGateFactory(resolver) {
|
|
38
|
+
return () => ({
|
|
39
|
+
manifest: MANIFEST,
|
|
40
|
+
inputSchema: InputSchema,
|
|
41
|
+
outputSchema: OutputSchema,
|
|
42
|
+
ctx: [],
|
|
43
|
+
model: null,
|
|
44
|
+
async execute(input) {
|
|
45
|
+
const i = input.original;
|
|
46
|
+
if (i.decision !== undefined) {
|
|
47
|
+
return {
|
|
48
|
+
kind: "output",
|
|
49
|
+
value: { decision: i.decision, prompt: i.prompt, source: "recorded" },
|
|
50
|
+
evidence: { verdict: i.decision === "approve" ? "pass" : "fail" },
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
if (resolver) {
|
|
54
|
+
const ans = resolver.resolve({
|
|
55
|
+
prompt: i.prompt,
|
|
56
|
+
...(i.decision_id !== undefined ? { decision_id: i.decision_id } : {}),
|
|
57
|
+
});
|
|
58
|
+
if (ans !== null) {
|
|
59
|
+
return {
|
|
60
|
+
kind: "output",
|
|
61
|
+
value: { decision: ans, prompt: i.prompt, source: "resolver" },
|
|
62
|
+
evidence: { verdict: ans === "approve" ? "pass" : "fail" },
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
return {
|
|
67
|
+
kind: "needs_user",
|
|
68
|
+
prompt: i.prompt,
|
|
69
|
+
schema: OutputSchema,
|
|
70
|
+
resume_hint: i.decision_id ?? "approval_gate",
|
|
71
|
+
};
|
|
72
|
+
},
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
export const approvalGateManifest = MANIFEST;
|
|
76
|
+
//# sourceMappingURL=approval_gate.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"approval_gate.js","sourceRoot":"","sources":["../../src/humans/approval_gate.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EACL,YAAY,GAKb,MAAM,gBAAgB,CAAC;AAExB,MAAM,QAAQ,GAAiB,YAAY,CAAC;IAC1C,EAAE,EAAE,8BAA8B;IAClC,IAAI,EAAE,eAAe;IACrB,WAAW,EACT,0HAA0H;IAC5H,WAAW,EAAE,eAAe;IAC5B,IAAI,EAAE,CAAC,OAAO,CAAC;CAChB,CAAC,CAAC;AAEH,MAAM,WAAW,GAAG,CAAC,CAAC,MAAM,CAAC;IAC3B,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;IACzB;;;OAGG;IACH,QAAQ,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,SAAS,EAAE,MAAM,CAAC,CAAC,C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CAAC,CAAC,EAAE,WAAW,EAAE,CAAC,CAAC,WAAW,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;iBACvE,CAAC,CAAC;gBACH,IAAI,GAAG,KAAK,IAAI,EAAE,CAAC;oBACjB,OAAO;wBACL,IAAI,EAAE,QAAQ;wBACd,KAAK,EAAE,EAAE,QAAQ,EAAE,GAAG,EAAE,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,MAAM,EAAE,UAAU,EAAE;wBAC9D,QAAQ,EAAE,EAAE,OAAO,EAAE,GAAG,KAAK,SAAS,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,EAAE;qBAC3D,CAAC;gBACJ,CAAC;YACH,CAAC;YAED,OAAO;gBACL,IAAI,EAAE,YAAY;gBAClB,MAAM,EAAE,CAAC,CAAC,MAAM;gBAChB,MAAM,EAAE,YAAY;gBACpB,WAAW,EAAE,CAAC,CAAC,WAAW,IAAI,eAAe;aAC9C,CAAC;QACJ,CAAC;KACF,CAAC,CAAC;AACL,CAAC;AAED,MAAM,CAAC,MAAM,oBAAoB,GAAG,QAAQ,CAAC"}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `@agenteer/node-ask-user` — freeform user prompt (sub-plan 03 §16, M5).
|
|
3
|
+
*
|
|
4
|
+
* M5 scope (Q3-C follow-through from M4): now that session resume + CLI
|
|
5
|
+
* ship together, we can pair `approval_gate`'s yes/no with `ask_user`'s
|
|
6
|
+
* freeform answer. Both share the same resolver model — a pre-recorded
|
|
7
|
+
* answer wins, else a resolver answers synchronously, else `NeedsUser`.
|
|
8
|
+
*
|
|
9
|
+
* The schema for the answer is caller-provided. Tests and production can
|
|
10
|
+
* validate the string with a Zod schema passed at factory time.
|
|
11
|
+
*/
|
|
12
|
+
import { z, type ZodType } from "zod";
|
|
13
|
+
import { type Node } from "@agenteer/core";
|
|
14
|
+
declare const InputSchema: z.ZodObject<{
|
|
15
|
+
prompt: z.ZodString;
|
|
16
|
+
answer: z.ZodOptional<z.ZodUnknown>;
|
|
17
|
+
question_id: z.ZodOptional<z.ZodString>;
|
|
18
|
+
}, z.core.$strip>;
|
|
19
|
+
type Input = z.input<typeof InputSchema>;
|
|
20
|
+
export interface AskUserResolver {
|
|
21
|
+
/**
|
|
22
|
+
* Return the recorded answer for this prompt, or `null` to fall
|
|
23
|
+
* through to NeedsUser. Implementations typically bind to a session
|
|
24
|
+
* state; see `recordedAnswerResolver` from `@agenteer/core/session`.
|
|
25
|
+
*/
|
|
26
|
+
resolve(opts: {
|
|
27
|
+
prompt: string;
|
|
28
|
+
question_id?: string;
|
|
29
|
+
}): unknown | null;
|
|
30
|
+
}
|
|
31
|
+
export interface AskUserFactoryOptions<T = string> {
|
|
32
|
+
resolver?: AskUserResolver;
|
|
33
|
+
/** Zod schema to validate any resolved/recorded answer. Defaults to string. */
|
|
34
|
+
answerSchema?: ZodType<T>;
|
|
35
|
+
}
|
|
36
|
+
export declare function askUserFactory<T = string>(options?: AskUserFactoryOptions<T>): () => Node<Input, {
|
|
37
|
+
answer: T;
|
|
38
|
+
prompt: string;
|
|
39
|
+
source: "recorded" | "resolver" | "user";
|
|
40
|
+
}>;
|
|
41
|
+
export declare const askUserManifest: {
|
|
42
|
+
manifest_version: 1;
|
|
43
|
+
id: string;
|
|
44
|
+
version: string;
|
|
45
|
+
name: string;
|
|
46
|
+
description: string;
|
|
47
|
+
required_actions: string[];
|
|
48
|
+
required_capabilities: {
|
|
49
|
+
tool_use: boolean;
|
|
50
|
+
vision: boolean;
|
|
51
|
+
structured_output: "any" | "native" | "text_parse";
|
|
52
|
+
min_context_tokens?: number | undefined;
|
|
53
|
+
};
|
|
54
|
+
dynamic_actions: boolean;
|
|
55
|
+
side_effects: {
|
|
56
|
+
writes_fs: boolean;
|
|
57
|
+
network: boolean;
|
|
58
|
+
mutates_ctx: boolean;
|
|
59
|
+
emits_ctx_variants: string[];
|
|
60
|
+
reads_ctx_variants: string[];
|
|
61
|
+
};
|
|
62
|
+
determinism: "deterministic" | "stochastic";
|
|
63
|
+
tags: string[];
|
|
64
|
+
author: string;
|
|
65
|
+
license: string;
|
|
66
|
+
input_schema?: unknown;
|
|
67
|
+
output_schema?: unknown;
|
|
68
|
+
dynamic_action_spec?: string | undefined;
|
|
69
|
+
homepage?: string | undefined;
|
|
70
|
+
repository?: string | undefined;
|
|
71
|
+
planner_hints?: {
|
|
72
|
+
cost_tier?: "cheap" | "medium" | "expensive" | undefined;
|
|
73
|
+
latency_tier?: "medium" | "fast" | "slow" | undefined;
|
|
74
|
+
typical_use?: string | undefined;
|
|
75
|
+
} | undefined;
|
|
76
|
+
sha256?: string | undefined;
|
|
77
|
+
};
|
|
78
|
+
export {};
|
|
79
|
+
//# sourceMappingURL=ask_user.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ask_user.d.ts","sourceRoot":"","sources":["../../src/humans/ask_user.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EAAE,CAAC,EAAE,KAAK,OAAO,EAAE,MAAM,KAAK,CAAC;AACtC,OAAO,EAEL,KAAK,IAAI,EAIV,MAAM,gBAAgB,CAAC;AAWxB,QAAA,MAAM,WAAW;;;;iBASf,CAAC;AAEH,KAAK,KAAK,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,WAAW,CAAC,CAAC;AAEzC,MAAM,WAAW,eAAe;IAC9B;;;;OAIG;IACH,OAAO,CAAC,IAAI,EAAE;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,WAAW,CAAC,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,GAAG,IAAI,CAAC;CACzE;AAED,MAAM,WAAW,qBAAqB,CAAC,CAAC,GAAG,MAAM;IAC/C,QAAQ,CAAC,EAAE,eAAe,CAAC;IAC3B,+EAA+E;IAC/E,YAAY,CAAC,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC;CAC3B;AAED,wBAAgB,cAAc,CAAC,CAAC,GAAG,MAAM,EACvC,OAAO,GAAE,qBAAqB,CAAC,CAAC,CAAM,GACrC,MAAM,IAAI,CAAC,KAAK,EAAE;IAAE,MAAM,EAAE,CAAC,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,UAAU,GAAG,UAAU,GAAG,MAAM,CAAA;CAAE,CAAC,CAiE5F;AAED,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAAW,CAAC"}
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `@agenteer/node-ask-user` — freeform user prompt (sub-plan 03 §16, M5).
|
|
3
|
+
*
|
|
4
|
+
* M5 scope (Q3-C follow-through from M4): now that session resume + CLI
|
|
5
|
+
* ship together, we can pair `approval_gate`'s yes/no with `ask_user`'s
|
|
6
|
+
* freeform answer. Both share the same resolver model — a pre-recorded
|
|
7
|
+
* answer wins, else a resolver answers synchronously, else `NeedsUser`.
|
|
8
|
+
*
|
|
9
|
+
* The schema for the answer is caller-provided. Tests and production can
|
|
10
|
+
* validate the string with a Zod schema passed at factory time.
|
|
11
|
+
*/
|
|
12
|
+
import { z } from "zod";
|
|
13
|
+
import { makeManifest, } from "@agenteer/core";
|
|
14
|
+
const MANIFEST = makeManifest({
|
|
15
|
+
id: "@agenteer/node-ask-user",
|
|
16
|
+
name: "ask_user",
|
|
17
|
+
description: "Freeform user prompt. Recorded answer → resolver → NeedsUser fallback. Schema validates answers.",
|
|
18
|
+
determinism: "deterministic",
|
|
19
|
+
tags: ["human"],
|
|
20
|
+
});
|
|
21
|
+
const InputSchema = z.object({
|
|
22
|
+
prompt: z.string().min(1),
|
|
23
|
+
/** Deterministic marker — echo back the recorded answer without asking. */
|
|
24
|
+
answer: z.unknown().optional(),
|
|
25
|
+
/**
|
|
26
|
+
* Opaque identifier used to match a resolver / CLI answer. If absent,
|
|
27
|
+
* the NodeResult's resume_hint defaults to `ask_user:<prompt-slug>`.
|
|
28
|
+
*/
|
|
29
|
+
question_id: z.string().optional(),
|
|
30
|
+
});
|
|
31
|
+
export function askUserFactory(options = {}) {
|
|
32
|
+
const answerSchema = (options.answerSchema ?? z.string());
|
|
33
|
+
const OutputSchema = z.object({
|
|
34
|
+
answer: answerSchema,
|
|
35
|
+
prompt: z.string(),
|
|
36
|
+
source: z.enum(["recorded", "resolver", "user"]),
|
|
37
|
+
});
|
|
38
|
+
return () => ({
|
|
39
|
+
manifest: MANIFEST,
|
|
40
|
+
inputSchema: InputSchema,
|
|
41
|
+
outputSchema: OutputSchema,
|
|
42
|
+
ctx: [],
|
|
43
|
+
model: null,
|
|
44
|
+
async execute(input) {
|
|
45
|
+
const i = input.original;
|
|
46
|
+
const resumeHint = i.question_id ?? slugHint(i.prompt);
|
|
47
|
+
if (i.answer !== undefined) {
|
|
48
|
+
const parsed = answerSchema.safeParse(i.answer);
|
|
49
|
+
if (!parsed.success) {
|
|
50
|
+
return {
|
|
51
|
+
kind: "failed",
|
|
52
|
+
reason: `recorded_answer_schema_violation: ${parsed.error.message}`,
|
|
53
|
+
retryable: false,
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
return {
|
|
57
|
+
kind: "output",
|
|
58
|
+
value: { answer: parsed.data, prompt: i.prompt, source: "recorded" },
|
|
59
|
+
evidence: { verdict: "pass" },
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
if (options.resolver) {
|
|
63
|
+
const raw = options.resolver.resolve({
|
|
64
|
+
prompt: i.prompt,
|
|
65
|
+
...(i.question_id !== undefined ? { question_id: i.question_id } : {}),
|
|
66
|
+
});
|
|
67
|
+
if (raw !== null && raw !== undefined) {
|
|
68
|
+
const parsed = answerSchema.safeParse(raw);
|
|
69
|
+
if (!parsed.success) {
|
|
70
|
+
return {
|
|
71
|
+
kind: "failed",
|
|
72
|
+
reason: `resolver_answer_schema_violation: ${parsed.error.message}`,
|
|
73
|
+
retryable: false,
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
return {
|
|
77
|
+
kind: "output",
|
|
78
|
+
value: { answer: parsed.data, prompt: i.prompt, source: "resolver" },
|
|
79
|
+
evidence: { verdict: "pass" },
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
return {
|
|
84
|
+
kind: "needs_user",
|
|
85
|
+
prompt: i.prompt,
|
|
86
|
+
schema: answerSchema,
|
|
87
|
+
resume_hint: resumeHint,
|
|
88
|
+
};
|
|
89
|
+
},
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
export const askUserManifest = MANIFEST;
|
|
93
|
+
function slugHint(prompt) {
|
|
94
|
+
const slug = prompt
|
|
95
|
+
.toLowerCase()
|
|
96
|
+
.replace(/[^a-z0-9]+/g, "_")
|
|
97
|
+
.replace(/^_|_$/g, "")
|
|
98
|
+
.slice(0, 40);
|
|
99
|
+
return `ask_user:${slug || "prompt"}`;
|
|
100
|
+
}
|
|
101
|
+
//# sourceMappingURL=ask_user.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ask_user.js","sourceRoot":"","sources":["../../src/humans/ask_user.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EAAE,CAAC,EAAgB,MAAM,KAAK,CAAC;AACtC,OAAO,EACL,YAAY,GAKb,MAAM,gBAAgB,CAAC;AAExB,MAAM,QAAQ,GAAiB,YAAY,CAAC;IAC1C,EAAE,EAAE,yBAAyB;IAC7B,IAAI,EAAE,UAAU;IAChB,WAAW,EACT,kGAAkG;IACpG,WAAW,EAAE,eAAe;IAC5B,IAAI,EAAE,CAAC,OAAO,CAAC;CAChB,CAAC,CAAC;AAEH,MAAM,WAAW,GAAG,CAAC,CAAC,MAAM,CAAC;IAC3B,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;IACzB,2EAA2E;IAC3E,MAAM,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,QAAQ,EAAE;IAC9B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AAExC,SAAS,QAAQ,CAAC,MAAc;IAC9B,MAAM,IAAI,GAAG,MAAM;SAChB,WAAW,EAAE;SACb,OAAO,CAAC,aAAa,EAAE,GAAG,CAAC;SAC3B,OAAO,CAAC,QAAQ,EAAE,EAAE,CAAC;SACrB,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;IAChB,OAAO,YAAY,IAAI,IAAI,QAAQ,EAAE,CAAC;AACxC,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @agenteer/stdlib — v1 standard library (M5 adds ask_user: 19 nodes).
|
|
3
|
+
*
|
|
4
|
+
* Primitives (5): file_read, file_write, shell_exec, llm_call, tool_call
|
|
5
|
+
* Validators (5): compile, test_run, regex_check, typecheck, json_schema_validate
|
|
6
|
+
* Meta (4): parallel_fanout, cross_check, judge_with_stripped_ctx, repair_loop
|
|
7
|
+
* Humans (2): approval_gate, ask_user (M5)
|
|
8
|
+
* Planner (1): default_planner
|
|
9
|
+
* Context (1): context_curator
|
|
10
|
+
*
|
|
11
|
+
* `registerStdlib` registers M2-shape nodes (file_read/write/shell_exec/
|
|
12
|
+
* json_schema_validate/llm_call). Nodes with external dependencies
|
|
13
|
+
* (provider/resolver/tool registry) are exported as factories for the
|
|
14
|
+
* caller to wire and register individually.
|
|
15
|
+
*/
|
|
16
|
+
import type { NodeRegistry } from "@agenteer/core";
|
|
17
|
+
import { fileReadFactory, fileReadManifest } from "./primitives/file_read.js";
|
|
18
|
+
import { fileWriteFactory, fileWriteManifest } from "./primitives/file_write.js";
|
|
19
|
+
import { shellExecFactory, shellExecManifest } from "./primitives/shell_exec.js";
|
|
20
|
+
import { llmCallFactory, llmCallManifest } from "./primitives/llm_call.js";
|
|
21
|
+
import { toolCallFactory, toolCallManifest } from "./primitives/tool_call.js";
|
|
22
|
+
import { jsonSchemaValidateFactory, jsonSchemaValidateManifest } from "./validators/json_schema_validate.js";
|
|
23
|
+
import { regexCheckFactory, regexCheckManifest } from "./validators/regex_check.js";
|
|
24
|
+
import { compileFactory, compileManifest } from "./validators/compile.js";
|
|
25
|
+
import { testRunFactory, testRunManifest } from "./validators/test_run.js";
|
|
26
|
+
import { typecheckFactory, typecheckManifest } from "./validators/typecheck.js";
|
|
27
|
+
import { parallelFanoutFactory, parallelFanoutManifest } from "./meta/parallel_fanout.js";
|
|
28
|
+
import { crossCheckFactory, crossCheckManifest } from "./meta/cross_check.js";
|
|
29
|
+
import { judgeWithStrippedCtxFactory, judgeWithStrippedCtxManifest } from "./meta/judge_with_stripped_ctx.js";
|
|
30
|
+
import { repairLoopFactory, repairLoopManifest } from "./meta/repair_loop.js";
|
|
31
|
+
import { contextCuratorFactory, contextCuratorManifest } from "./context/context_curator.js";
|
|
32
|
+
import { approvalGateFactory, approvalGateManifest } from "./humans/approval_gate.js";
|
|
33
|
+
import { askUserFactory, askUserManifest } from "./humans/ask_user.js";
|
|
34
|
+
import { defaultPlannerFactory, defaultPlannerManifest } from "./planner/default_planner.js";
|
|
35
|
+
export { fileReadFactory, fileReadManifest, fileWriteFactory, fileWriteManifest, shellExecFactory, shellExecManifest, llmCallFactory, llmCallManifest, toolCallFactory, toolCallManifest, jsonSchemaValidateFactory, jsonSchemaValidateManifest, regexCheckFactory, regexCheckManifest, compileFactory, compileManifest, testRunFactory, testRunManifest, typecheckFactory, typecheckManifest, parallelFanoutFactory, parallelFanoutManifest, crossCheckFactory, crossCheckManifest, judgeWithStrippedCtxFactory, judgeWithStrippedCtxManifest, repairLoopFactory, repairLoopManifest, contextCuratorFactory, contextCuratorManifest, approvalGateFactory, approvalGateManifest, askUserFactory, askUserManifest, defaultPlannerFactory, defaultPlannerManifest, };
|
|
36
|
+
export type { CompileAdapter } from "./validators/compile.js";
|
|
37
|
+
export type { TestAdapter, TestReport } from "./validators/test_run.js";
|
|
38
|
+
export type { ApprovalResolver } from "./humans/approval_gate.js";
|
|
39
|
+
export type { AskUserResolver, AskUserFactoryOptions } from "./humans/ask_user.js";
|
|
40
|
+
export type { ProviderResolver } from "./meta/cross_check.js";
|
|
41
|
+
export * from "./shared/index.js";
|
|
42
|
+
/**
|
|
43
|
+
* Register M4 nodes that have zero external wiring. Nodes that need a
|
|
44
|
+
* provider resolver, tool registry, approval resolver, or response
|
|
45
|
+
* schema are exported as factories — wire and register them yourself.
|
|
46
|
+
*/
|
|
47
|
+
export declare function registerStdlib(registry: NodeRegistry): void;
|
|
48
|
+
export declare const STDLIB_MANIFEST_IDS: readonly [string, string, string, string, string, string, string, string, string, string, string, string, string, string, string, string, string, string];
|
|
49
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAGnD,OAAO,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAC9E,OAAO,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AACjF,OAAO,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AACjF,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAC3E,OAAO,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAG9E,OAAO,EACL,yBAAyB,EACzB,0BAA0B,EAC3B,MAAM,sCAAsC,CAAC;AAC9C,OAAO,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,MAAM,6BAA6B,CAAC;AACpF,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAC1E,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAC3E,OAAO,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,MAAM,2BAA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C;AAClE,YAAY,EAAE,eAAe,EAAE,qBAAqB,EAAE,MAAM,sBAAsB,CAAC;AACnF,YAAY,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAC9D,cAAc,mBAAmB,CAAC;AAElC;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,QAAQ,EAAE,YAAY,GAAG,IAAI,CAsB3D;AAED,eAAO,MAAM,mBAAmB,2JAmBtB,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @agenteer/stdlib — v1 standard library (M5 adds ask_user: 19 nodes).
|
|
3
|
+
*
|
|
4
|
+
* Primitives (5): file_read, file_write, shell_exec, llm_call, tool_call
|
|
5
|
+
* Validators (5): compile, test_run, regex_check, typecheck, json_schema_validate
|
|
6
|
+
* Meta (4): parallel_fanout, cross_check, judge_with_stripped_ctx, repair_loop
|
|
7
|
+
* Humans (2): approval_gate, ask_user (M5)
|
|
8
|
+
* Planner (1): default_planner
|
|
9
|
+
* Context (1): context_curator
|
|
10
|
+
*
|
|
11
|
+
* `registerStdlib` registers M2-shape nodes (file_read/write/shell_exec/
|
|
12
|
+
* json_schema_validate/llm_call). Nodes with external dependencies
|
|
13
|
+
* (provider/resolver/tool registry) are exported as factories for the
|
|
14
|
+
* caller to wire and register individually.
|
|
15
|
+
*/
|
|
16
|
+
// Primitives
|
|
17
|
+
import { fileReadFactory, fileReadManifest } from "./primitives/file_read.js";
|
|
18
|
+
import { fileWriteFactory, fileWriteManifest } from "./primitives/file_write.js";
|
|
19
|
+
import { shellExecFactory, shellExecManifest } from "./primitives/shell_exec.js";
|
|
20
|
+
import { llmCallFactory, llmCallManifest } from "./primitives/llm_call.js";
|
|
21
|
+
import { toolCallFactory, toolCallManifest } from "./primitives/tool_call.js";
|
|
22
|
+
// Validators
|
|
23
|
+
import { jsonSchemaValidateFactory, jsonSchemaValidateManifest, } from "./validators/json_schema_validate.js";
|
|
24
|
+
import { regexCheckFactory, regexCheckManifest } from "./validators/regex_check.js";
|
|
25
|
+
import { compileFactory, compileManifest } from "./validators/compile.js";
|
|
26
|
+
import { testRunFactory, testRunManifest } from "./validators/test_run.js";
|
|
27
|
+
import { typecheckFactory, typecheckManifest } from "./validators/typecheck.js";
|
|
28
|
+
// Meta
|
|
29
|
+
import { parallelFanoutFactory, parallelFanoutManifest } from "./meta/parallel_fanout.js";
|
|
30
|
+
import { crossCheckFactory, crossCheckManifest } from "./meta/cross_check.js";
|
|
31
|
+
import { judgeWithStrippedCtxFactory, judgeWithStrippedCtxManifest, } from "./meta/judge_with_stripped_ctx.js";
|
|
32
|
+
import { repairLoopFactory, repairLoopManifest } from "./meta/repair_loop.js";
|
|
33
|
+
// Context, humans, planner
|
|
34
|
+
import { contextCuratorFactory, contextCuratorManifest } from "./context/context_curator.js";
|
|
35
|
+
import { approvalGateFactory, approvalGateManifest } from "./humans/approval_gate.js";
|
|
36
|
+
import { askUserFactory, askUserManifest } from "./humans/ask_user.js";
|
|
37
|
+
import { defaultPlannerFactory, defaultPlannerManifest } from "./planner/default_planner.js";
|
|
38
|
+
export {
|
|
39
|
+
// Primitives
|
|
40
|
+
fileReadFactory, fileReadManifest, fileWriteFactory, fileWriteManifest, shellExecFactory, shellExecManifest, llmCallFactory, llmCallManifest, toolCallFactory, toolCallManifest,
|
|
41
|
+
// Validators
|
|
42
|
+
jsonSchemaValidateFactory, jsonSchemaValidateManifest, regexCheckFactory, regexCheckManifest, compileFactory, compileManifest, testRunFactory, testRunManifest, typecheckFactory, typecheckManifest,
|
|
43
|
+
// Meta
|
|
44
|
+
parallelFanoutFactory, parallelFanoutManifest, crossCheckFactory, crossCheckManifest, judgeWithStrippedCtxFactory, judgeWithStrippedCtxManifest, repairLoopFactory, repairLoopManifest,
|
|
45
|
+
// Context / humans / planner
|
|
46
|
+
contextCuratorFactory, contextCuratorManifest, approvalGateFactory, approvalGateManifest, askUserFactory, askUserManifest, defaultPlannerFactory, defaultPlannerManifest, };
|
|
47
|
+
export * from "./shared/index.js";
|
|
48
|
+
/**
|
|
49
|
+
* Register M4 nodes that have zero external wiring. Nodes that need a
|
|
50
|
+
* provider resolver, tool registry, approval resolver, or response
|
|
51
|
+
* schema are exported as factories — wire and register them yourself.
|
|
52
|
+
*/
|
|
53
|
+
export function registerStdlib(registry) {
|
|
54
|
+
// Primitives (except tool_call / llm_call which need wiring)
|
|
55
|
+
registry.register(fileReadManifest, fileReadFactory);
|
|
56
|
+
registry.register(fileWriteManifest, fileWriteFactory);
|
|
57
|
+
registry.register(shellExecManifest, shellExecFactory);
|
|
58
|
+
registry.register(toolCallManifest, toolCallFactory);
|
|
59
|
+
// Validators
|
|
60
|
+
registry.register(jsonSchemaValidateManifest, jsonSchemaValidateFactory);
|
|
61
|
+
registry.register(regexCheckManifest, regexCheckFactory);
|
|
62
|
+
registry.register(compileManifest, compileFactory);
|
|
63
|
+
registry.register(testRunManifest, testRunFactory);
|
|
64
|
+
registry.register(typecheckManifest, typecheckFactory);
|
|
65
|
+
// Meta (parallel_fanout/judge/repair_loop are self-contained)
|
|
66
|
+
registry.register(parallelFanoutManifest, parallelFanoutFactory);
|
|
67
|
+
registry.register(judgeWithStrippedCtxManifest, judgeWithStrippedCtxFactory);
|
|
68
|
+
registry.register(repairLoopManifest, repairLoopFactory);
|
|
69
|
+
// Context + planner
|
|
70
|
+
registry.register(contextCuratorManifest, contextCuratorFactory);
|
|
71
|
+
registry.register(defaultPlannerManifest, defaultPlannerFactory);
|
|
72
|
+
}
|
|
73
|
+
export const STDLIB_MANIFEST_IDS = [
|
|
74
|
+
fileReadManifest.id,
|
|
75
|
+
fileWriteManifest.id,
|
|
76
|
+
shellExecManifest.id,
|
|
77
|
+
llmCallManifest.id,
|
|
78
|
+
toolCallManifest.id,
|
|
79
|
+
jsonSchemaValidateManifest.id,
|
|
80
|
+
regexCheckManifest.id,
|
|
81
|
+
compileManifest.id,
|
|
82
|
+
testRunManifest.id,
|
|
83
|
+
typecheckManifest.id,
|
|
84
|
+
parallelFanoutManifest.id,
|
|
85
|
+
crossCheckManifest.id,
|
|
86
|
+
judgeWithStrippedCtxManifest.id,
|
|
87
|
+
repairLoopManifest.id,
|
|
88
|
+
contextCuratorManifest.id,
|
|
89
|
+
approvalGateManifest.id,
|
|
90
|
+
askUserManifest.id,
|
|
91
|
+
defaultPlannerManifest.id,
|
|
92
|
+
];
|
|
93
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAIH,aAAa;AACb,OAAO,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAC9E,OAAO,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AACjF,OAAO,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AACjF,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAC3E,OAAO,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAE9E,aAAa;AACb,OAAO,EACL,yBAAyB,EACzB,0BAA0B,GAC3B,MAAM,sCAAsC,CAAC;AAC9C,OAAO,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,MAAM,6BAA6B,CAAC;AACpF,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAC1E,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAC3E,OAAO,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAEhF,OAAO;AACP,OAAO,EAAE,qBAAqB,EAAE,sBAAsB,EAAE,MAAM,2BAA2B,CAAC;AAC1F,OAAO,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAC9E,OAAO,EAC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AC,EAAE;IACzB,oBAAoB,CAAC,EAAE;IACvB,eAAe,CAAC,EAAE;IAClB,sBAAsB,CAAC,EAAE;CACjB,CAAC"}
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `@agenteer/node-cross-check` — meta-node over `trust.CrossCheckEngine`
|
|
3
|
+
* (sub-plan 03 §11, sub-plan 04 §4.1).
|
|
4
|
+
*
|
|
5
|
+
* Three disagreement policies per master plan's ratified resolution:
|
|
6
|
+
* - `fail` → return `Failed("cross_check_disagreement", retryable: true)`.
|
|
7
|
+
* - `return_both` → return `Output({ primary, secondary, disagreement_keys })`.
|
|
8
|
+
* - `replace_me_with_judge` → return `ReplaceMe(judge_node)` so a
|
|
9
|
+
* different node decides.
|
|
10
|
+
*
|
|
11
|
+
* Retry-on-disagreement uses `ReplaceMe` (sub-plan 00 §7); the engine
|
|
12
|
+
* itself runs one pass.
|
|
13
|
+
*/
|
|
14
|
+
import { z } from "zod";
|
|
15
|
+
import { type Node } from "@agenteer/core";
|
|
16
|
+
import { ComparatorRegistry, type CrossCheckPolicy, type ProviderLike } from "@agenteer/trust";
|
|
17
|
+
declare const InputSchema: z.ZodObject<{
|
|
18
|
+
systemPrompt: z.ZodString;
|
|
19
|
+
userPrompt: z.ZodString;
|
|
20
|
+
schemaName: z.ZodString;
|
|
21
|
+
primary_model: z.ZodString;
|
|
22
|
+
secondary_model: z.ZodOptional<z.ZodString>;
|
|
23
|
+
on_disagreement: z.ZodDefault<z.ZodEnum<{
|
|
24
|
+
fail: "fail";
|
|
25
|
+
return_both: "return_both";
|
|
26
|
+
replace_me_with_judge: "replace_me_with_judge";
|
|
27
|
+
}>>;
|
|
28
|
+
judge_manifest_id: z.ZodOptional<z.ZodString>;
|
|
29
|
+
temperature: z.ZodOptional<z.ZodNumber>;
|
|
30
|
+
}, z.core.$strip>;
|
|
31
|
+
declare const OutputSchema: z.ZodObject<{
|
|
32
|
+
outcome: z.ZodEnum<{
|
|
33
|
+
agreement: "agreement";
|
|
34
|
+
disagreement: "disagreement";
|
|
35
|
+
missing_secondary_skip: "missing_secondary_skip";
|
|
36
|
+
missing_secondary_fallback_disagreement: "missing_secondary_fallback_disagreement";
|
|
37
|
+
}>;
|
|
38
|
+
value: z.ZodOptional<z.ZodUnknown>;
|
|
39
|
+
primary: z.ZodOptional<z.ZodUnknown>;
|
|
40
|
+
secondary: z.ZodOptional<z.ZodUnknown>;
|
|
41
|
+
disagreement_keys: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
42
|
+
fingerprint: z.ZodOptional<z.ZodString>;
|
|
43
|
+
}, z.core.$strip>;
|
|
44
|
+
type Input = z.input<typeof InputSchema>;
|
|
45
|
+
type Output = z.infer<typeof OutputSchema>;
|
|
46
|
+
/**
|
|
47
|
+
* Factory takes a resolver that maps model ids → ProviderLike instances.
|
|
48
|
+
* Typical wiring: workflows register their provider adapters once and
|
|
49
|
+
* hand a resolver to the factory.
|
|
50
|
+
*/
|
|
51
|
+
export interface ProviderResolver {
|
|
52
|
+
resolve(model_id: string): ProviderLike | null;
|
|
53
|
+
}
|
|
54
|
+
export declare function crossCheckFactory(resolver: ProviderResolver, opts?: {
|
|
55
|
+
policy?: Partial<CrossCheckPolicy>;
|
|
56
|
+
comparators?: ComparatorRegistry;
|
|
57
|
+
}): () => Node<Input, Output>;
|
|
58
|
+
export declare const crossCheckManifest: {
|
|
59
|
+
manifest_version: 1;
|
|
60
|
+
id: string;
|
|
61
|
+
version: string;
|
|
62
|
+
name: string;
|
|
63
|
+
description: string;
|
|
64
|
+
required_actions: string[];
|
|
65
|
+
required_capabilities: {
|
|
66
|
+
tool_use: boolean;
|
|
67
|
+
vision: boolean;
|
|
68
|
+
structured_output: "any" | "native" | "text_parse";
|
|
69
|
+
min_context_tokens?: number | undefined;
|
|
70
|
+
};
|
|
71
|
+
dynamic_actions: boolean;
|
|
72
|
+
side_effects: {
|
|
73
|
+
writes_fs: boolean;
|
|
74
|
+
network: boolean;
|
|
75
|
+
mutates_ctx: boolean;
|
|
76
|
+
emits_ctx_variants: string[];
|
|
77
|
+
reads_ctx_variants: string[];
|
|
78
|
+
};
|
|
79
|
+
determinism: "deterministic" | "stochastic";
|
|
80
|
+
tags: string[];
|
|
81
|
+
author: string;
|
|
82
|
+
license: string;
|
|
83
|
+
input_schema?: unknown;
|
|
84
|
+
output_schema?: unknown;
|
|
85
|
+
dynamic_action_spec?: string | undefined;
|
|
86
|
+
homepage?: string | undefined;
|
|
87
|
+
repository?: string | undefined;
|
|
88
|
+
planner_hints?: {
|
|
89
|
+
cost_tier?: "cheap" | "medium" | "expensive" | undefined;
|
|
90
|
+
latency_tier?: "medium" | "fast" | "slow" | undefined;
|
|
91
|
+
typical_use?: string | undefined;
|
|
92
|
+
} | undefined;
|
|
93
|
+
sha256?: string | undefined;
|
|
94
|
+
};
|
|
95
|
+
export {};
|
|
96
|
+
//# sourceMappingURL=cross_check.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cross_check.d.ts","sourceRoot":"","sources":["../../src/meta/cross_check.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAEL,KAAK,IAAI,EAKV,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAEL,kBAAkB,EAIlB,KAAK,gBAAgB,EACrB,KAAK,YAAY,EAClB,MAAM,iBAAiB,CAAC;AAqBzB,QAAA,MAAM,WAAW;;;;;;;;;;;;;iBAiBf,CAAC;AAEH,QAAA,MAAM,YAAY;;;;;;;;;;;;iBAYhB,CAAC;AAEH,KAAK,KAAK,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,WAAW,CAAC,CAAC;AACzC,KAAK,MAAM,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,YAAY,CAAC,CAAC;AAE3C;;;;GAIG;AACH,MAAM,WAAW,gBAAgB;IAC/B,OAAO,CAAC,QAAQ,EAAE,MAAM,GAAG,YAAY,GAAG,IAAI,CAAC;CAChD;AAED,wBAAgB,iBAAiB,CAC/B,QAAQ,EAAE,gBAAgB,EAC1B,IAAI,GAAE;IAAE,MAAM,CAAC,EAAE,OAAO,CAAC,gBAAgB,CAAC,CAAC;IAAC,WAAW,CAAC,EAAE,kBAAkB,CAAA;CAAO,GAClF,MAAM,IAAI,CAAC,KAAK,EAAE,MAAM,CAAC,CA6C3B;AAED,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAAW,CAAC"}
|