@wrenai/genbi 0.0.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/LICENSE +201 -0
- package/README.md +141 -0
- package/bin/genbi.mjs +31 -0
- package/dist/assets/echarts-LTFC-ysd.js +40 -0
- package/dist/assets/index-Bo--QMUN.js +441 -0
- package/dist/assets/index-Xs4q7pNo.css +1 -0
- package/dist/index.html +14 -0
- package/dist/wrenai_logo.png +0 -0
- package/dist/wrenai_logo_white.png +0 -0
- package/dist-server/harness/auth/detect.d.ts +18 -0
- package/dist-server/harness/auth/detect.js +37 -0
- package/dist-server/harness/auth/index.d.ts +4 -0
- package/dist-server/harness/auth/index.js +2 -0
- package/dist-server/harness/auth/probe.d.ts +18 -0
- package/dist-server/harness/auth/probe.js +52 -0
- package/dist-server/harness/auth/types.d.ts +42 -0
- package/dist-server/harness/auth/types.js +9 -0
- package/dist-server/harness/bundle/loader.d.ts +32 -0
- package/dist-server/harness/bundle/loader.js +43 -0
- package/dist-server/harness/bundle/schema.d.ts +199 -0
- package/dist-server/harness/bundle/schema.js +127 -0
- package/dist-server/harness/bundle/version.d.ts +10 -0
- package/dist-server/harness/bundle/version.js +43 -0
- package/dist-server/harness/capability/gate.d.ts +6 -0
- package/dist-server/harness/capability/gate.js +29 -0
- package/dist-server/harness/capability/registry.d.ts +6 -0
- package/dist-server/harness/capability/registry.js +17 -0
- package/dist-server/harness/cli-args.d.ts +123 -0
- package/dist-server/harness/cli-args.js +247 -0
- package/dist-server/harness/cli.d.ts +2 -0
- package/dist-server/harness/cli.js +151 -0
- package/dist-server/harness/compile/cache.d.ts +23 -0
- package/dist-server/harness/compile/cache.js +109 -0
- package/dist-server/harness/compile/compose-profile.d.ts +34 -0
- package/dist-server/harness/compile/compose-profile.js +95 -0
- package/dist-server/harness/compile/errors.d.ts +22 -0
- package/dist-server/harness/compile/errors.js +41 -0
- package/dist-server/harness/compile/fingerprint.d.ts +22 -0
- package/dist-server/harness/compile/fingerprint.js +84 -0
- package/dist-server/harness/compile/index.d.ts +8 -0
- package/dist-server/harness/compile/index.js +7 -0
- package/dist-server/harness/compile/pipeline.d.ts +66 -0
- package/dist-server/harness/compile/pipeline.js +176 -0
- package/dist-server/harness/compile/resolve-binary.d.ts +55 -0
- package/dist-server/harness/compile/resolve-binary.js +133 -0
- package/dist-server/harness/compile/types.d.ts +107 -0
- package/dist-server/harness/compile/types.js +1 -0
- package/dist-server/harness/compile/warble-identity.d.ts +12 -0
- package/dist-server/harness/compile/warble-identity.js +33 -0
- package/dist-server/harness/compliance/gate.d.ts +35 -0
- package/dist-server/harness/compliance/gate.js +48 -0
- package/dist-server/harness/compliance/index.d.ts +2 -0
- package/dist-server/harness/compliance/index.js +1 -0
- package/dist-server/harness/compliance/types.d.ts +16 -0
- package/dist-server/harness/compliance/types.js +1 -0
- package/dist-server/harness/events/emitter.d.ts +34 -0
- package/dist-server/harness/events/emitter.js +25 -0
- package/dist-server/harness/events/index.d.ts +4 -0
- package/dist-server/harness/events/index.js +2 -0
- package/dist-server/harness/events/sse.d.ts +20 -0
- package/dist-server/harness/events/sse.js +48 -0
- package/dist-server/harness/events/types.d.ts +131 -0
- package/dist-server/harness/events/types.js +1 -0
- package/dist-server/harness/exec/errors.d.ts +16 -0
- package/dist-server/harness/exec/errors.js +29 -0
- package/dist-server/harness/exec/index.d.ts +5 -0
- package/dist-server/harness/exec/index.js +2 -0
- package/dist-server/harness/exec/local.d.ts +32 -0
- package/dist-server/harness/exec/local.js +134 -0
- package/dist-server/harness/exec/policy.d.ts +12 -0
- package/dist-server/harness/exec/policy.js +1 -0
- package/dist-server/harness/exec/types.d.ts +63 -0
- package/dist-server/harness/exec/types.js +1 -0
- package/dist-server/harness/guardrails/index.d.ts +2 -0
- package/dist-server/harness/guardrails/index.js +1 -0
- package/dist-server/harness/guardrails/policy.d.ts +45 -0
- package/dist-server/harness/guardrails/policy.js +57 -0
- package/dist-server/harness/index.d.ts +37 -0
- package/dist-server/harness/index.js +19 -0
- package/dist-server/harness/loop/errors.d.ts +53 -0
- package/dist-server/harness/loop/errors.js +72 -0
- package/dist-server/harness/loop/executor.d.ts +123 -0
- package/dist-server/harness/loop/executor.js +380 -0
- package/dist-server/harness/loop/guard.d.ts +16 -0
- package/dist-server/harness/loop/guard.js +1 -0
- package/dist-server/harness/loop/index.d.ts +5 -0
- package/dist-server/harness/loop/index.js +3 -0
- package/dist-server/harness/native-producer/index.d.ts +109 -0
- package/dist-server/harness/native-producer/index.js +302 -0
- package/dist-server/harness/npm-package-resolve.d.ts +28 -0
- package/dist-server/harness/npm-package-resolve.js +47 -0
- package/dist-server/harness/providers/adapters/anthropic.d.ts +7 -0
- package/dist-server/harness/providers/adapters/anthropic.js +6 -0
- package/dist-server/harness/providers/adapters/mock.d.ts +4 -0
- package/dist-server/harness/providers/adapters/mock.js +5 -0
- package/dist-server/harness/providers/adapters/openai-compatible.d.ts +10 -0
- package/dist-server/harness/providers/adapters/openai-compatible.js +10 -0
- package/dist-server/harness/providers/binding.d.ts +23 -0
- package/dist-server/harness/providers/binding.js +13 -0
- package/dist-server/harness/providers/errors.d.ts +6 -0
- package/dist-server/harness/providers/errors.js +12 -0
- package/dist-server/harness/providers/index.d.ts +18 -0
- package/dist-server/harness/providers/index.js +22 -0
- package/dist-server/harness/providers/registry.d.ts +16 -0
- package/dist-server/harness/providers/registry.js +24 -0
- package/dist-server/harness/render/envelope.d.ts +145 -0
- package/dist-server/harness/render/envelope.js +428 -0
- package/dist-server/harness/render/errors.d.ts +33 -0
- package/dist-server/harness/render/errors.js +46 -0
- package/dist-server/harness/render/index.d.ts +5 -0
- package/dist-server/harness/render/index.js +3 -0
- package/dist-server/harness/render/validate.d.ts +13 -0
- package/dist-server/harness/render/validate.js +88 -0
- package/dist-server/harness/route/adapter-spec.d.ts +40 -0
- package/dist-server/harness/route/adapter-spec.js +61 -0
- package/dist-server/harness/route/agent-sdk-cli.d.ts +30 -0
- package/dist-server/harness/route/agent-sdk-cli.js +86 -0
- package/dist-server/harness/route/agent-sdk-manifest.d.ts +31 -0
- package/dist-server/harness/route/agent-sdk-manifest.js +56 -0
- package/dist-server/harness/route/artifact-content.d.ts +53 -0
- package/dist-server/harness/route/artifact-content.js +83 -0
- package/dist-server/harness/route/chat-event-mapper.d.ts +95 -0
- package/dist-server/harness/route/chat-event-mapper.js +164 -0
- package/dist-server/harness/route/codex-ask-events.d.ts +25 -0
- package/dist-server/harness/route/codex-ask-events.js +395 -0
- package/dist-server/harness/route/codex-ask.d.ts +15 -0
- package/dist-server/harness/route/codex-ask.js +242 -0
- package/dist-server/harness/route/codex-local-cli.d.ts +20 -0
- package/dist-server/harness/route/codex-local-cli.js +78 -0
- package/dist-server/harness/route/codex-local-manifest.d.ts +22 -0
- package/dist-server/harness/route/codex-local-manifest.js +180 -0
- package/dist-server/harness/route/describe.d.ts +54 -0
- package/dist-server/harness/route/describe.js +84 -0
- package/dist-server/harness/route/dispatched.d.ts +138 -0
- package/dist-server/harness/route/dispatched.js +339 -0
- package/dist-server/harness/route/in-process.d.ts +43 -0
- package/dist-server/harness/route/in-process.js +106 -0
- package/dist-server/harness/route/index.d.ts +19 -0
- package/dist-server/harness/route/index.js +12 -0
- package/dist-server/harness/route/profile-source.d.ts +37 -0
- package/dist-server/harness/route/profile-source.js +76 -0
- package/dist-server/harness/route/route.d.ts +33 -0
- package/dist-server/harness/route/route.js +114 -0
- package/dist-server/harness/route/tier-binding.d.ts +36 -0
- package/dist-server/harness/route/tier-binding.js +63 -0
- package/dist-server/harness/route/types.d.ts +286 -0
- package/dist-server/harness/route/types.js +1 -0
- package/dist-server/harness/session/errors.d.ts +4 -0
- package/dist-server/harness/session/errors.js +7 -0
- package/dist-server/harness/session/gate.d.ts +11 -0
- package/dist-server/harness/session/gate.js +13 -0
- package/dist-server/harness/session/index.d.ts +5 -0
- package/dist-server/harness/session/index.js +3 -0
- package/dist-server/harness/session/run.d.ts +60 -0
- package/dist-server/harness/session/run.js +333 -0
- package/dist-server/harness/session/types.d.ts +29 -0
- package/dist-server/harness/session/types.js +1 -0
- package/dist-server/harness/setup/codex-events.d.ts +12 -0
- package/dist-server/harness/setup/codex-events.js +108 -0
- package/dist-server/harness/setup/runner.d.ts +497 -0
- package/dist-server/harness/setup/runner.js +1314 -0
- package/dist-server/harness/tools/errors.d.ts +107 -0
- package/dist-server/harness/tools/errors.js +141 -0
- package/dist-server/harness/tools/index.d.ts +13 -0
- package/dist-server/harness/tools/index.js +8 -0
- package/dist-server/harness/tools/mcp.d.ts +26 -0
- package/dist-server/harness/tools/mcp.js +15 -0
- package/dist-server/harness/tools/native.d.ts +179 -0
- package/dist-server/harness/tools/native.js +322 -0
- package/dist-server/harness/tools/parse.d.ts +14 -0
- package/dist-server/harness/tools/parse.js +18 -0
- package/dist-server/harness/tools/resolve-wren-binary.d.ts +12 -0
- package/dist-server/harness/tools/resolve-wren-binary.js +21 -0
- package/dist-server/harness/tools/resolve.d.ts +51 -0
- package/dist-server/harness/tools/resolve.js +79 -0
- package/dist-server/harness/tools/setup-native.d.ts +84 -0
- package/dist-server/harness/tools/setup-native.js +353 -0
- package/dist-server/harness/tools/wiring.d.ts +10 -0
- package/dist-server/harness/tools/wiring.js +16 -0
- package/dist-server/providers/setup.provider.yaml +31 -0
- package/dist-server/providers/wren.provider.yaml +33 -0
- package/dist-server/server/adopt.d.ts +87 -0
- package/dist-server/server/adopt.js +263 -0
- package/dist-server/server/app.d.ts +6 -0
- package/dist-server/server/app.js +2521 -0
- package/dist-server/server/auth-choice.d.ts +16 -0
- package/dist-server/server/auth-choice.js +36 -0
- package/dist-server/server/bin.d.ts +2 -0
- package/dist-server/server/bin.js +601 -0
- package/dist-server/server/bootstrap-project-binding.d.ts +31 -0
- package/dist-server/server/bootstrap-project-binding.js +71 -0
- package/dist-server/server/clarify.d.ts +10 -0
- package/dist-server/server/clarify.js +17 -0
- package/dist-server/server/codex-setup-mcp.d.ts +2 -0
- package/dist-server/server/codex-setup-mcp.js +147 -0
- package/dist-server/server/compose.d.ts +89 -0
- package/dist-server/server/compose.js +271 -0
- package/dist-server/server/conn-config.d.ts +30 -0
- package/dist-server/server/conn-config.js +253 -0
- package/dist-server/server/context-files.d.ts +12 -0
- package/dist-server/server/context-files.js +117 -0
- package/dist-server/server/context-map.d.ts +30 -0
- package/dist-server/server/context-map.js +95 -0
- package/dist-server/server/context-source.d.ts +68 -0
- package/dist-server/server/context-source.js +85 -0
- package/dist-server/server/db.d.ts +862 -0
- package/dist-server/server/db.js +1839 -0
- package/dist-server/server/enrichment-runner.d.ts +184 -0
- package/dist-server/server/enrichment-runner.js +213 -0
- package/dist-server/server/enrichment-verify.d.ts +73 -0
- package/dist-server/server/enrichment-verify.js +290 -0
- package/dist-server/server/enrichment.d.ts +232 -0
- package/dist-server/server/enrichment.js +199 -0
- package/dist-server/server/env-detect.d.ts +8 -0
- package/dist-server/server/env-detect.js +17 -0
- package/dist-server/server/env-field-hints.d.ts +46 -0
- package/dist-server/server/env-field-hints.js +48 -0
- package/dist-server/server/fold.d.ts +133 -0
- package/dist-server/server/fold.js +407 -0
- package/dist-server/server/harness-profile-sources.d.ts +3 -0
- package/dist-server/server/harness-profile-sources.js +24 -0
- package/dist-server/server/harness.d.ts +19 -0
- package/dist-server/server/harness.js +439 -0
- package/dist-server/server/impact.d.ts +18 -0
- package/dist-server/server/impact.js +85 -0
- package/dist-server/server/interactive-terminal.d.ts +175 -0
- package/dist-server/server/interactive-terminal.js +336 -0
- package/dist-server/server/native-artifacts.d.ts +1004 -0
- package/dist-server/server/native-artifacts.js +564 -0
- package/dist-server/server/native-dispatch-registry.d.ts +42 -0
- package/dist-server/server/native-dispatch-registry.js +45 -0
- package/dist-server/server/native-producer-fence.d.ts +14 -0
- package/dist-server/server/native-producer-fence.js +48 -0
- package/dist-server/server/native-session-resume.d.ts +6 -0
- package/dist-server/server/native-session-resume.js +103 -0
- package/dist-server/server/native-session-workspace.d.ts +40 -0
- package/dist-server/server/native-session-workspace.js +175 -0
- package/dist-server/server/native-sessions.d.ts +374 -0
- package/dist-server/server/native-sessions.js +1517 -0
- package/dist-server/server/native-wren-runtime.d.ts +20 -0
- package/dist-server/server/native-wren-runtime.js +259 -0
- package/dist-server/server/node-pty-host.d.ts +31 -0
- package/dist-server/server/node-pty-host.js +100 -0
- package/dist-server/server/route-intent.d.ts +40 -0
- package/dist-server/server/route-intent.js +23 -0
- package/dist-server/server/runtime-binding.d.ts +52 -0
- package/dist-server/server/runtime-binding.js +258 -0
- package/dist-server/server/source-catalog.d.ts +84 -0
- package/dist-server/server/source-catalog.js +221 -0
- package/dist-server/server/source-driver.d.ts +35 -0
- package/dist-server/server/source-driver.js +124 -0
- package/dist-server/server/spa.d.ts +2 -0
- package/dist-server/server/spa.js +51 -0
- package/dist-server/server/subscription-model-catalog.d.ts +27 -0
- package/dist-server/server/subscription-model-catalog.js +203 -0
- package/dist-server/server/turn.d.ts +249 -0
- package/dist-server/server/turn.js +1074 -0
- package/dist-server/server/wire-types.d.ts +799 -0
- package/dist-server/server/wire-types.js +1 -0
- package/dist-server/server/wren-home.d.ts +19 -0
- package/dist-server/server/wren-home.js +33 -0
- package/dist-server/server/wren-profiles.d.ts +43 -0
- package/dist-server/server/wren-profiles.js +123 -0
- package/package.json +93 -0
- package/profiles/genbi-default/context/binding.yml +9 -0
- package/profiles/genbi-default/ir.golden.json +506 -0
- package/profiles/genbi-default/profile.yml +16 -0
- package/profiles/genbi-enrich-context/components/apply_enrichment/component.yml +42 -0
- package/profiles/genbi-enrich-context/components/draft_enrichment/component.yml +30 -0
- package/profiles/genbi-enrich-context/components/draft_enrichment/steps/draft.md +34 -0
- package/profiles/genbi-enrich-context/components/inspect_context/component.yml +32 -0
- package/profiles/genbi-enrich-context/components/inspect_context/steps/inspect.md +13 -0
- package/profiles/genbi-enrich-context/context/binding.yml +4 -0
- package/profiles/genbi-enrich-context/ir.golden.json +302 -0
- package/profiles/genbi-enrich-context/profile.yml +15 -0
- package/profiles/genbi-monitor/context/binding.yml +7 -0
- package/profiles/genbi-monitor/ir.golden.json +188 -0
- package/profiles/genbi-monitor/profile.yml +27 -0
- package/profiles/genbi-setup/components/build_context/component.yml +44 -0
- package/profiles/genbi-setup/components/build_context/steps/build.md +14 -0
- package/profiles/genbi-setup/components/connect_source/component.yml +51 -0
- package/profiles/genbi-setup/components/connect_source/steps/connect.md +23 -0
- package/profiles/genbi-setup/context/binding.yml +8 -0
- package/profiles/genbi-setup/ir.golden.json +140 -0
- package/profiles/genbi-setup/profile.yml +18 -0
- package/profiles/genbi-setup/raw/schema.json +5 -0
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
const READ_ONLY_ENFORCEMENT = "read_only";
|
|
2
|
+
const SCOPED_WRITE_ENFORCEMENT = "scoped_write";
|
|
3
|
+
const ROW_LIMIT_GUARDRAIL = "row_limit";
|
|
4
|
+
const STATEMENT_TIMEOUT_GUARDRAIL = "statement_timeout";
|
|
5
|
+
const DRILL_DEPTH_LIMIT_GUARDRAIL = "drill_depth_limit";
|
|
6
|
+
/**
|
|
7
|
+
* Maps an agent's `guardrails` to the harness's enforcement seams: a locked
|
|
8
|
+
* `read_only` guardrail sets `readOnly`; a locked `scoped_write` guardrail
|
|
9
|
+
* (with a `scope`) sets `artifactWriteScope`; `threshold_limit` / `generic`
|
|
10
|
+
* guardrails are matched by guardrail *key* (not just `enforcement`, since
|
|
11
|
+
* `row_limit` and `drill_depth_limit` share the `threshold_limit`
|
|
12
|
+
* enforcement kind) onto named numeric limits.
|
|
13
|
+
*
|
|
14
|
+
* `read_only_execution` and a locked `scoped_write` guardrail coexisting
|
|
15
|
+
* (`generate_dashboard`, `explain_change` in the golden bundle) is not a
|
|
16
|
+
* contradiction: the former restricts *data access* (no write-capable
|
|
17
|
+
* SQL/tool becomes active), the latter grants a narrow, separate permission
|
|
18
|
+
* to write the rendered *output artifact* inside `scope`. This is exactly
|
|
19
|
+
* why the two fields are independent here rather than one overriding the
|
|
20
|
+
* other — `LocalExecutionEnv.writeFile` (`harness/exec/local.ts`) reflects this
|
|
21
|
+
* directly, consulting only `artifactWriteScope`, never `readOnly`.
|
|
22
|
+
*/
|
|
23
|
+
export function deriveEnforcement(agent) {
|
|
24
|
+
let readOnly = false;
|
|
25
|
+
let artifactWriteScope;
|
|
26
|
+
let rowLimit;
|
|
27
|
+
let statementTimeoutSec;
|
|
28
|
+
let drillDepthLimit;
|
|
29
|
+
for (const [key, guardrail] of Object.entries(agent.guardrails)) {
|
|
30
|
+
if (guardrail.enforcement === READ_ONLY_ENFORCEMENT && guardrail.locked) {
|
|
31
|
+
readOnly = true;
|
|
32
|
+
continue;
|
|
33
|
+
}
|
|
34
|
+
if (guardrail.enforcement === SCOPED_WRITE_ENFORCEMENT && guardrail.locked && guardrail.scope !== undefined) {
|
|
35
|
+
artifactWriteScope = guardrail.scope;
|
|
36
|
+
continue;
|
|
37
|
+
}
|
|
38
|
+
if (guardrail.threshold === undefined)
|
|
39
|
+
continue;
|
|
40
|
+
if (key === ROW_LIMIT_GUARDRAIL) {
|
|
41
|
+
rowLimit = guardrail.threshold;
|
|
42
|
+
}
|
|
43
|
+
else if (key === STATEMENT_TIMEOUT_GUARDRAIL) {
|
|
44
|
+
statementTimeoutSec = guardrail.threshold;
|
|
45
|
+
}
|
|
46
|
+
else if (key === DRILL_DEPTH_LIMIT_GUARDRAIL) {
|
|
47
|
+
drillDepthLimit = guardrail.threshold;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
return {
|
|
51
|
+
readOnly,
|
|
52
|
+
...(artifactWriteScope !== undefined ? { artifactWriteScope } : {}),
|
|
53
|
+
...(rowLimit !== undefined ? { rowLimit } : {}),
|
|
54
|
+
...(statementTimeoutSec !== undefined ? { statementTimeoutSec } : {}),
|
|
55
|
+
...(drillDepthLimit !== undefined ? { drillDepthLimit } : {}),
|
|
56
|
+
};
|
|
57
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
export { loadBundle, loadBundleWithProvenance, BundleValidationError } from "./bundle/loader.js";
|
|
2
|
+
export type { BundleProvenance } from "./bundle/loader.js";
|
|
3
|
+
export { bundleFormatVersion } from "./bundle/schema.js";
|
|
4
|
+
export { assertCompat, BundleCompatError, HARNESS_SUPPORT } from "./bundle/version.js";
|
|
5
|
+
export type { HarnessSupport } from "./bundle/version.js";
|
|
6
|
+
export type { Agent, Bundle, Capability, Guardrail, OutputSchema, Step, StepGuard, StepRealization, Tool, } from "./bundle/schema.js";
|
|
7
|
+
export { createDefaultCapabilityRegistry, createRegistry, DEFAULT_CAPABILITIES, } from "./capability/registry.js";
|
|
8
|
+
export type { CapabilityRegistry } from "./capability/registry.js";
|
|
9
|
+
export { assertCapabilities, CapabilityGateError } from "./capability/gate.js";
|
|
10
|
+
export { ANTHROPIC_ADAPTER_ID, createAnthropicAdapter, createDefaultProviderRegistry, createMockAdapter, createOpenAICompatibleAdapter, createProviderRegistry, MOCK_ADAPTER_ID, OPENAI_COMPATIBLE_ADAPTER_ID, resolveStepModel, resolveTierModel, UnknownAdapterError, UnknownTierError, } from "./providers/index.js";
|
|
11
|
+
export type { AdapterFactory, AdapterSpec, AnthropicAdapterConfig, MockAdapterConfig, OpenAICompatibleAdapterConfig, ProviderRegistry, TierBinding, } from "./providers/index.js";
|
|
12
|
+
export { AgentScopeError, executeAgent, InvalidRepairFoldError, passthroughGuardEvaluator, RepairExhaustedError, } from "./loop/index.js";
|
|
13
|
+
export type { DataflowArtifacts, ExecuteAgentContext, GuardEvaluator, StepGuardContext, ToolCallOutcome, ToolCallOutcomeListener, } from "./loop/index.js";
|
|
14
|
+
export { createAgentEventEmitter, MalformedSseFrameError, parseAgentEvent, serializeAgentEvent, } from "./events/index.js";
|
|
15
|
+
export type { AgentEvent, AgentEventBase, AgentEventEmitter, AgentEventInput, AgentEventKind, AnswerAgentEvent, ArtifactAgentEvent, ArtifactKind, ErrorAgentEvent, RefusalAgentEvent, RunFinishEvent, RunStartEvent, StepFinishEvent, StepStartEvent, StepTrace, TokenEvent, ToolCallEvent, ToolResultEvent, TraceStep, } from "./events/index.js";
|
|
16
|
+
export { BUILD_DASHBOARD_TOOL_NAME, connectMcpServer, createDefaultNativeToolRegistry, createNativeToolRegistry, createWrenNativeToolRegistry, createWrenQueryTool, createWriteArtifactTool, McpServerNotConfiguredError, McpToolNotExposedError, parseToolSource, resolveTools, UnknownNativeToolError, UnsupportedToolSourceError, withResolvedTools, WREN_QUERY_TOOL_NAME, WrenQueryExecutionError, WRITE_ARTIFACT_TOOL_NAME, } from "./tools/index.js";
|
|
17
|
+
export type { McpServerConfig, McpServerConfigMap, NativeToolFactory, NativeToolRegistry, ParsedToolSource, ResolvedTools, ResolveToolsContext, WrenNativeToolOptions, WrenQueryResult, WrenQueryToolOptions, } from "./tools/index.js";
|
|
18
|
+
export { deriveEnforcement } from "./guardrails/index.js";
|
|
19
|
+
export type { EnforcementPolicy } from "./guardrails/index.js";
|
|
20
|
+
export { EgressNotAllowedError, PathTraversalError, ReadOnlyViolationError, WriteScopeNotGrantedError, createLocalExecutionEnv, } from "./exec/index.js";
|
|
21
|
+
export type { ExecCommand, ExecMode, ExecResult, ExecutionEnv, ExecutionPolicy, FetchRequest, FetchResponse, LocalExecutionEnvOptions, } from "./exec/index.js";
|
|
22
|
+
export { collectJsonSchemaErrors, EnvelopeParseError, EnvelopeSchemaError, extractEnvelopeFromText, NoRenderTierError, renderEnvelope, } from "./render/index.js";
|
|
23
|
+
export type { JsonSchemaDocument, RenderEnvelope, RenderEnvelopeContext } from "./render/index.js";
|
|
24
|
+
export { findLockedGatedCheck, runAgent, UnknownAgentError } from "./session/index.js";
|
|
25
|
+
export type { AnswerResult, RefusalResult, RunAgentContext, RunAgentResult } from "./session/index.js";
|
|
26
|
+
export { createDefaultLoginProbe, detectAndPick, toAuthChoice } from "./auth/index.js";
|
|
27
|
+
export type { ApiKeyAuthChoice, AuthChoice, AuthOption, GatewayAuthChoice, LocalAuthChoice, LoginProbe, SubscriptionAuthChoice, } from "./auth/index.js";
|
|
28
|
+
export { compileProfile, compileRawProfile, composeUserProfile, createFileSystemCompileCache, createInMemoryCompileCache, extractContextBindingPath, hashDirectory, InvalidProfileShapeError, resolveHubDir, resolveWarbleBinary, runWarble, rewriteContextBindingProject, WarbleBinaryNotFoundError, WarbleCommandFailedError, } from "./compile/index.js";
|
|
29
|
+
export type { CompileCache, CompileCacheEntry, CompileCacheKey, CompileMode, CompileProfileOptions, CompileProfileResult, CompileRawProfileOptions, } from "./compile/index.js";
|
|
30
|
+
export { AgentSdkCliNotFoundError, buildAgentSdkChatArgs, buildAgentSdkManifestArgs, buildCodexAskArgs, buildHybridTierBinding, buildUniformTierBinding, DEFAULT_LOCAL_ENDPOINT, DEFAULT_LOCAL_MODEL, deriveAdapterSpec, describeBundle, DispatchedSessionError, resolveAgentSdkCli, resolveArtifactContent, resolveArtifactsDir, resolveDefaultEnrichIrPath, resolveDefaultProfileSource, resolveDefaultSetupIrPath, route, runAgentSdkManifest, runInProcessDefault, runDispatchedDefault, runCodexAskDefault, } from "./route/index.js";
|
|
31
|
+
export type { AgentSdkChatCommand, AgentSdkManifestCommand, ArtifactContentDto, ArtifactContentUnavailableReason, BuildAgentSdkChatArgsOptions, BuildAgentSdkManifestArgsOptions, DeriveAdapterSpecOptions, DescribeBundleOptions, InProcessExecutor, InProcessOptions, CodexAskExecutor, CodexAskOptions, CodexAskResult, DispatchedExecutor, DispatchedOptions, DispatchedResult, ResolvedCli, RouteOptions, RouteResult, } from "./route/index.js";
|
|
32
|
+
export { ComplianceError, enforceCompliance, SUBSCRIPTION_TOS_WARNING } from "./compliance/index.js";
|
|
33
|
+
export { BUILD_CONTEXT_AGENT_ID, CONNECT_SOURCE_AGENT_ID, DEFAULT_SETUP_MAX_TURNS, CodexSetupRunner, contextLifecycleIdentityFingerprint, InProcessSetupRunner, DispatchedSetupRunner, parseSetupTerminal, recordedContextLifecyclePrefix, selectSetupRunnerForAuth, } from "./setup/runner.js";
|
|
34
|
+
export type { CodexSetupRunnerOptions, InProcessSetupRunnerOptions, DispatchedSetupRunnerOptions, SetupStepRunner, SetupRunnerSet, SetupStepRunOptions, SetupStepRunResult, SetupTerminalContext, SetupTerminalResult, SetupTerminalStatus, ContextLifecyclePrefix, } from "./setup/runner.js";
|
|
35
|
+
export type { ComplianceResult, Deployment } from "./compliance/index.js";
|
|
36
|
+
export { NATIVE_PRODUCER_VERSION, createNativeProducerCassette, createRouteNativeProducer, nativeProducerCassetteKey, produceNoninteractiveNative, replayNoninteractiveNative, } from "./native-producer/index.js";
|
|
37
|
+
export type { NativeProducerArtifactReference, NativeProducerCassette, NativeProducerDispatch, NativeProducerDispatchInput, NativeProducerDispatchResult, NativeProducerErrorCode, NativeProducerFailure, NativeProducerHostFence, NativeProducerLifecycle, NativeProducerLifecycleState, NativeProducerOptions, NativeProducerRequest, NativeProducerResponse, NativeProducerScope, NativeProducerSuccess, NativeProducerVendor, } from "./native-producer/index.js";
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export { loadBundle, loadBundleWithProvenance, BundleValidationError } from "./bundle/loader.js";
|
|
2
|
+
export { bundleFormatVersion } from "./bundle/schema.js";
|
|
3
|
+
export { assertCompat, BundleCompatError, HARNESS_SUPPORT } from "./bundle/version.js";
|
|
4
|
+
export { createDefaultCapabilityRegistry, createRegistry, DEFAULT_CAPABILITIES, } from "./capability/registry.js";
|
|
5
|
+
export { assertCapabilities, CapabilityGateError } from "./capability/gate.js";
|
|
6
|
+
export { ANTHROPIC_ADAPTER_ID, createAnthropicAdapter, createDefaultProviderRegistry, createMockAdapter, createOpenAICompatibleAdapter, createProviderRegistry, MOCK_ADAPTER_ID, OPENAI_COMPATIBLE_ADAPTER_ID, resolveStepModel, resolveTierModel, UnknownAdapterError, UnknownTierError, } from "./providers/index.js";
|
|
7
|
+
export { AgentScopeError, executeAgent, InvalidRepairFoldError, passthroughGuardEvaluator, RepairExhaustedError, } from "./loop/index.js";
|
|
8
|
+
export { createAgentEventEmitter, MalformedSseFrameError, parseAgentEvent, serializeAgentEvent, } from "./events/index.js";
|
|
9
|
+
export { BUILD_DASHBOARD_TOOL_NAME, connectMcpServer, createDefaultNativeToolRegistry, createNativeToolRegistry, createWrenNativeToolRegistry, createWrenQueryTool, createWriteArtifactTool, McpServerNotConfiguredError, McpToolNotExposedError, parseToolSource, resolveTools, UnknownNativeToolError, UnsupportedToolSourceError, withResolvedTools, WREN_QUERY_TOOL_NAME, WrenQueryExecutionError, WRITE_ARTIFACT_TOOL_NAME, } from "./tools/index.js";
|
|
10
|
+
export { deriveEnforcement } from "./guardrails/index.js";
|
|
11
|
+
export { EgressNotAllowedError, PathTraversalError, ReadOnlyViolationError, WriteScopeNotGrantedError, createLocalExecutionEnv, } from "./exec/index.js";
|
|
12
|
+
export { collectJsonSchemaErrors, EnvelopeParseError, EnvelopeSchemaError, extractEnvelopeFromText, NoRenderTierError, renderEnvelope, } from "./render/index.js";
|
|
13
|
+
export { findLockedGatedCheck, runAgent, UnknownAgentError } from "./session/index.js";
|
|
14
|
+
export { createDefaultLoginProbe, detectAndPick, toAuthChoice } from "./auth/index.js";
|
|
15
|
+
export { compileProfile, compileRawProfile, composeUserProfile, createFileSystemCompileCache, createInMemoryCompileCache, extractContextBindingPath, hashDirectory, InvalidProfileShapeError, resolveHubDir, resolveWarbleBinary, runWarble, rewriteContextBindingProject, WarbleBinaryNotFoundError, WarbleCommandFailedError, } from "./compile/index.js";
|
|
16
|
+
export { AgentSdkCliNotFoundError, buildAgentSdkChatArgs, buildAgentSdkManifestArgs, buildCodexAskArgs, buildHybridTierBinding, buildUniformTierBinding, DEFAULT_LOCAL_ENDPOINT, DEFAULT_LOCAL_MODEL, deriveAdapterSpec, describeBundle, DispatchedSessionError, resolveAgentSdkCli, resolveArtifactContent, resolveArtifactsDir, resolveDefaultEnrichIrPath, resolveDefaultProfileSource, resolveDefaultSetupIrPath, route, runAgentSdkManifest, runInProcessDefault, runDispatchedDefault, runCodexAskDefault, } from "./route/index.js";
|
|
17
|
+
export { ComplianceError, enforceCompliance, SUBSCRIPTION_TOS_WARNING } from "./compliance/index.js";
|
|
18
|
+
export { BUILD_CONTEXT_AGENT_ID, CONNECT_SOURCE_AGENT_ID, DEFAULT_SETUP_MAX_TURNS, CodexSetupRunner, contextLifecycleIdentityFingerprint, InProcessSetupRunner, DispatchedSetupRunner, parseSetupTerminal, recordedContextLifecyclePrefix, selectSetupRunnerForAuth, } from "./setup/runner.js";
|
|
19
|
+
export { NATIVE_PRODUCER_VERSION, createNativeProducerCassette, createRouteNativeProducer, nativeProducerCassetteKey, produceNoninteractiveNative, replayNoninteractiveNative, } from "./native-producer/index.js";
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Thrown when an agent falls outside the v1 execution scope. v1 only
|
|
3
|
+
* executes `analytical` / `one_shot` / `none` agents — anything else
|
|
4
|
+
* (mutating components, scheduled/event triggers, assertion/mutation
|
|
5
|
+
* outcomes) is a later milestone's concern, not this executor's.
|
|
6
|
+
*/
|
|
7
|
+
export declare class AgentScopeError extends Error {
|
|
8
|
+
constructor(agentId: string, componentType: string, trigger: string, outcome: string);
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Thrown when a `repair_fold` step's shape doesn't match the fold-into-loop
|
|
12
|
+
* error-recovery mechanism's closed contract: its `when` guard must be
|
|
13
|
+
* `on_failure` targeting the same step named by `realization.fold_into`,
|
|
14
|
+
* that target must exist among the agent's other steps, at most one
|
|
15
|
+
* repair_fold may bind to a given target, and the target must itself be a
|
|
16
|
+
* tools-bearing step (this mechanism only ever detects failure via a tool-error content
|
|
17
|
+
* part, so a fold onto a no-tools step can never fire).
|
|
18
|
+
*/
|
|
19
|
+
export declare class InvalidRepairFoldError extends Error {
|
|
20
|
+
constructor(stepName: string, reason: string);
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Thrown when a repair_fold's `max_attempts` budget is exhausted and the
|
|
24
|
+
* folded-into step's tool loop is still seeing a tool-execution error. The
|
|
25
|
+
* fold-into-loop mechanism never retries silently or infinitely (it is bounded,
|
|
26
|
+
* with a hard exhaustion guarantee) — exhaustion is a loud failure, since the golden
|
|
27
|
+
* `answer_query` shape declares no `fallback`.
|
|
28
|
+
*/
|
|
29
|
+
export declare class RepairExhaustedError extends Error {
|
|
30
|
+
constructor(targetStep: string, repairStep: string, maxAttempts: number);
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Thrown when a step's `ToolLoopAgent` turn is cut off by its configured step
|
|
34
|
+
* budget (`ExecuteAgentContext.maxSteps`) before the model finished on its
|
|
35
|
+
* own. `ToolLoopAgent` itself does not throw in this case — hitting its
|
|
36
|
+
* `stopWhen` condition (`isStepCount(maxSteps)`) makes `generate()` return
|
|
37
|
+
* normally with whatever partial text/tool results happened to exist at that
|
|
38
|
+
* point, indistinguishable at the SDK layer from a clean finish unless the
|
|
39
|
+
* caller checks `finishReason` itself. This executor treats that silent
|
|
40
|
+
* cutoff as a loud, distinguishable failure instead of quietly storing the
|
|
41
|
+
* partial text as if the step had completed normally — mirroring
|
|
42
|
+
* {@link RepairExhaustedError}'s "exhaustion is never a silent swallow" stance.
|
|
43
|
+
*
|
|
44
|
+
* Only ever thrown when `maxSteps` was explicitly configured (never for a
|
|
45
|
+
* caller that leaves it unset, e.g. the Ask path) — see
|
|
46
|
+
* `ExecuteAgentContext.maxSteps`'s own doc comment.
|
|
47
|
+
*/
|
|
48
|
+
export declare class StepBudgetExhaustedError extends Error {
|
|
49
|
+
readonly stepId: string;
|
|
50
|
+
readonly maxSteps: number;
|
|
51
|
+
readonly stepsCompleted: number;
|
|
52
|
+
constructor(stepId: string, maxSteps: number, stepsCompleted: number);
|
|
53
|
+
}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Thrown when an agent falls outside the v1 execution scope. v1 only
|
|
3
|
+
* executes `analytical` / `one_shot` / `none` agents — anything else
|
|
4
|
+
* (mutating components, scheduled/event triggers, assertion/mutation
|
|
5
|
+
* outcomes) is a later milestone's concern, not this executor's.
|
|
6
|
+
*/
|
|
7
|
+
export class AgentScopeError extends Error {
|
|
8
|
+
constructor(agentId, componentType, trigger, outcome) {
|
|
9
|
+
super(`agent "${agentId}" is out of v1 scope for executeAgent: ` +
|
|
10
|
+
`component_type="${componentType}", trigger="${trigger}", outcome="${outcome}" ` +
|
|
11
|
+
`(v1 only supports component_type="analytical", trigger="one_shot", outcome="none")`);
|
|
12
|
+
this.name = "AgentScopeError";
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Thrown when a `repair_fold` step's shape doesn't match the fold-into-loop
|
|
17
|
+
* error-recovery mechanism's closed contract: its `when` guard must be
|
|
18
|
+
* `on_failure` targeting the same step named by `realization.fold_into`,
|
|
19
|
+
* that target must exist among the agent's other steps, at most one
|
|
20
|
+
* repair_fold may bind to a given target, and the target must itself be a
|
|
21
|
+
* tools-bearing step (this mechanism only ever detects failure via a tool-error content
|
|
22
|
+
* part, so a fold onto a no-tools step can never fire).
|
|
23
|
+
*/
|
|
24
|
+
export class InvalidRepairFoldError extends Error {
|
|
25
|
+
constructor(stepName, reason) {
|
|
26
|
+
super(`repair_fold step "${stepName}" is not a valid repair fold: ${reason}`);
|
|
27
|
+
this.name = "InvalidRepairFoldError";
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Thrown when a repair_fold's `max_attempts` budget is exhausted and the
|
|
32
|
+
* folded-into step's tool loop is still seeing a tool-execution error. The
|
|
33
|
+
* fold-into-loop mechanism never retries silently or infinitely (it is bounded,
|
|
34
|
+
* with a hard exhaustion guarantee) — exhaustion is a loud failure, since the golden
|
|
35
|
+
* `answer_query` shape declares no `fallback`.
|
|
36
|
+
*/
|
|
37
|
+
export class RepairExhaustedError extends Error {
|
|
38
|
+
constructor(targetStep, repairStep, maxAttempts) {
|
|
39
|
+
super(`step "${targetStep}" exhausted its repair budget: repair_fold step "${repairStep}" ` +
|
|
40
|
+
`allows at most ${maxAttempts} attempt(s), but a tool call still failed after that many repair turns`);
|
|
41
|
+
this.name = "RepairExhaustedError";
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Thrown when a step's `ToolLoopAgent` turn is cut off by its configured step
|
|
46
|
+
* budget (`ExecuteAgentContext.maxSteps`) before the model finished on its
|
|
47
|
+
* own. `ToolLoopAgent` itself does not throw in this case — hitting its
|
|
48
|
+
* `stopWhen` condition (`isStepCount(maxSteps)`) makes `generate()` return
|
|
49
|
+
* normally with whatever partial text/tool results happened to exist at that
|
|
50
|
+
* point, indistinguishable at the SDK layer from a clean finish unless the
|
|
51
|
+
* caller checks `finishReason` itself. This executor treats that silent
|
|
52
|
+
* cutoff as a loud, distinguishable failure instead of quietly storing the
|
|
53
|
+
* partial text as if the step had completed normally — mirroring
|
|
54
|
+
* {@link RepairExhaustedError}'s "exhaustion is never a silent swallow" stance.
|
|
55
|
+
*
|
|
56
|
+
* Only ever thrown when `maxSteps` was explicitly configured (never for a
|
|
57
|
+
* caller that leaves it unset, e.g. the Ask path) — see
|
|
58
|
+
* `ExecuteAgentContext.maxSteps`'s own doc comment.
|
|
59
|
+
*/
|
|
60
|
+
export class StepBudgetExhaustedError extends Error {
|
|
61
|
+
stepId;
|
|
62
|
+
maxSteps;
|
|
63
|
+
stepsCompleted;
|
|
64
|
+
constructor(stepId, maxSteps, stepsCompleted) {
|
|
65
|
+
super(`step "${stepId}" exhausted its step budget (${maxSteps} tool-loop steps) before finishing — ` +
|
|
66
|
+
`${stepsCompleted} other step(s) had already produced their artifact`);
|
|
67
|
+
this.stepId = stepId;
|
|
68
|
+
this.maxSteps = maxSteps;
|
|
69
|
+
this.stepsCompleted = stepsCompleted;
|
|
70
|
+
this.name = "StepBudgetExhaustedError";
|
|
71
|
+
}
|
|
72
|
+
}
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
import { type ToolSet } from "ai";
|
|
2
|
+
import type { Agent } from "../bundle/schema.js";
|
|
3
|
+
import type { AgentEventInput } from "../events/index.js";
|
|
4
|
+
import type { ProviderRegistry, TierBinding } from "../providers/index.js";
|
|
5
|
+
import { type GuardEvaluator } from "./guard.js";
|
|
6
|
+
/** Dataflow artifact state: artifact name -> the value its producing step returned. */
|
|
7
|
+
export type DataflowArtifacts = ReadonlyMap<string, unknown>;
|
|
8
|
+
/**
|
|
9
|
+
* This tool-call-outcome observer seam, widened for the live-event layer: fired for every tool call that
|
|
10
|
+
* completes inside a `ToolLoopAgent` turn (`runToolLoopStep`/
|
|
11
|
+
* `runToolLoopStepWithRepair`), once per `tool-result` (`"success"`) or
|
|
12
|
+
* `tool-error` (`"error"`) content part across every step of the turn.
|
|
13
|
+
* `input`/`callId` are sourced straight off that content part (both AI SDK
|
|
14
|
+
* v7 `tool-result` and `tool-error` parts already carry `input` themselves
|
|
15
|
+
* — no cross-referencing a separate `tool-call` part is needed).
|
|
16
|
+
* `runAgent`'s deterministic `gated_check` gate (`harness/session/run.ts`)
|
|
17
|
+
* consumes `tool`/`outcome` to track whether a data-access tool call ever
|
|
18
|
+
* genuinely succeeded, independent of the model's own self-attested
|
|
19
|
+
* `verified` claim; the same firings also feed the FLOOR `StepTrace`.
|
|
20
|
+
*/
|
|
21
|
+
export interface ToolCallOutcome {
|
|
22
|
+
readonly tool: string;
|
|
23
|
+
readonly outcome: "success" | "error";
|
|
24
|
+
readonly callId?: string;
|
|
25
|
+
readonly input?: unknown;
|
|
26
|
+
/**
|
|
27
|
+
* The tool's structured return value (AI SDK v7 `tool-result` part's
|
|
28
|
+
* `output`), present only on `"success"`. Carried so a consumer can build
|
|
29
|
+
* a deterministic render envelope straight from a data-access tool's real
|
|
30
|
+
* result (e.g. the `query` tool's `{columns, rows}`) instead of relying on
|
|
31
|
+
* the step model to re-emit that structure as text — see `runAgent`.
|
|
32
|
+
*/
|
|
33
|
+
readonly output?: unknown;
|
|
34
|
+
/**
|
|
35
|
+
* The tool-error part's derived human message ({@link describeError}),
|
|
36
|
+
* present only on `"error"`. Carried so a consumer (e.g. `runAgent`'s
|
|
37
|
+
* `TraceStep` enrichment) can surface *why* a failed tool call failed —
|
|
38
|
+
* e.g. the SQL-repair retry's `query` steps — without re-deriving it from
|
|
39
|
+
* a raw `unknown` error value itself.
|
|
40
|
+
*/
|
|
41
|
+
readonly error?: string;
|
|
42
|
+
}
|
|
43
|
+
export type ToolCallOutcomeListener = (outcome: ToolCallOutcome) => void;
|
|
44
|
+
export interface ExecuteAgentContext {
|
|
45
|
+
/** Tier -> adapter binding; resolves each step's model. */
|
|
46
|
+
readonly binding: TierBinding;
|
|
47
|
+
readonly registry: ProviderRegistry;
|
|
48
|
+
/**
|
|
49
|
+
* Tool set injected by the caller. This executor does not resolve `agent.tools[]`
|
|
50
|
+
* from the bundle itself (that native + `mcp:wren/*` resolution happens earlier) — the caller
|
|
51
|
+
* hands the executor an already-realized AI SDK tool set (or `{}` for a
|
|
52
|
+
* no-tools run).
|
|
53
|
+
*/
|
|
54
|
+
readonly tools: ToolSet;
|
|
55
|
+
/** The user's question, threaded into every step's rendered prompt. */
|
|
56
|
+
readonly userInput: string;
|
|
57
|
+
/** Guard-eval seam for step-level repair/guard behavior. Defaults to an always-true pass-through. */
|
|
58
|
+
readonly evaluateGuard?: GuardEvaluator;
|
|
59
|
+
/**
|
|
60
|
+
* Per-step `ToolLoopAgent` step budget (an `isStepCount(maxSteps)` stop
|
|
61
|
+
* condition). Optional and unset by default, in which case every
|
|
62
|
+
* tools-bearing step falls back to `ToolLoopAgent`'s own SDK default of 20
|
|
63
|
+
* steps (`ai`'s `ToolLoopAgent.prepareCall()`: `stopWhen: this.settings.stopWhen
|
|
64
|
+
* ?? isStepCount(20)`) — that default applied silently to every caller of
|
|
65
|
+
* this executor even before this field existed; it just had no name. Only
|
|
66
|
+
* `InProcessSetupRunner` sets this today (to `DEFAULT_SETUP_MAX_TURNS`,
|
|
67
|
+
* `harness/setup/runner.ts`) — `runAgent`'s Ask-turn path
|
|
68
|
+
* (`harness/session/run.ts`) never sets it, so its behavior (the SDK's own
|
|
69
|
+
* 20-step default) is unchanged by this field's existence. When a
|
|
70
|
+
* tools-bearing step's turn is cut off by this budget before the model
|
|
71
|
+
* finished on its own, `executeAgent` throws {@link StepBudgetExhaustedError}
|
|
72
|
+
* instead of silently storing the turn's partial text as if it had
|
|
73
|
+
* completed normally — see that error's own doc comment.
|
|
74
|
+
*/
|
|
75
|
+
readonly maxSteps?: number;
|
|
76
|
+
/** Optional observer for every tool call's success/error outcome. See {@link ToolCallOutcomeListener}. */
|
|
77
|
+
readonly onToolCallOutcome?: ToolCallOutcomeListener;
|
|
78
|
+
/**
|
|
79
|
+
* Live-event layer: optional sink for `step.*`/`tool.*`/`artifact`
|
|
80
|
+
* events as `executeAgent` produces them. Typed as `AgentEventInput`
|
|
81
|
+
* (no `runId`/`seq`) rather than the contract's literal `(e: AgentEvent)
|
|
82
|
+
* => void` — `runAgent` is the natural single owner of that run-level
|
|
83
|
+
* bookkeeping (via `createAgentEventEmitter`); `executeAgent`'s job is
|
|
84
|
+
* only to describe *what happened* at step/tool granularity. `runAgent`
|
|
85
|
+
* passes its emitter's `emit` method down as this field's value. Emitted
|
|
86
|
+
* events always carry `depth: 0` and no `parent` — in-process (this
|
|
87
|
+
* executor) has no sub-agent/Task mechanism, so nesting is structurally
|
|
88
|
+
* unavailable here.
|
|
89
|
+
*/
|
|
90
|
+
readonly onEvent?: (event: AgentEventInput) => void;
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* Runs an agent's `steps[]` over a dataflow artifact state (option (b)):
|
|
94
|
+
* a step becomes runnable once every artifact it `consumes` is present, and
|
|
95
|
+
* on completion it stores its `produces` artifact. Step order is *derived*
|
|
96
|
+
* from consumes/produces satisfaction, not from the array's emergent index.
|
|
97
|
+
*
|
|
98
|
+
* Tool granularity is agent-level in the bundle, not per-step: if the agent
|
|
99
|
+
* declares `tools`, every (non-repair_fold) step runs as a `ToolLoopAgent`
|
|
100
|
+
* turn with the injected tool set (tool calls are emergent — a given step
|
|
101
|
+
* may make zero); otherwise every step is a single `generateText` call.
|
|
102
|
+
* A future milestone may refine this to scope tools per step.
|
|
103
|
+
*
|
|
104
|
+
* `realization.kind: "repair_fold"` steps are recognized but never run as
|
|
105
|
+
* independent top-level steps — instead each one folds into its
|
|
106
|
+
* `fold_into` target's tool-loop as a bounded error-recovery turn: when the
|
|
107
|
+
* target step's most recent turn surfaces a tool-execution error, the next
|
|
108
|
+
* turn's model and instructions swap to the repair step's, bounded by
|
|
109
|
+
* `max_attempts`. The DAG stays acyclic — this is a loop-internal retry, not
|
|
110
|
+
* a dataflow back-edge — and exhaustion is a loud failure
|
|
111
|
+
* ({@link RepairExhaustedError}), never a silent swallow or infinite retry.
|
|
112
|
+
*
|
|
113
|
+
* Returns the final dataflow artifact state — not a render envelope
|
|
114
|
+
* (the two-stage structured-output envelope is built in `harness/render/`).
|
|
115
|
+
*/
|
|
116
|
+
export declare function executeAgent(agent: Agent, ctx: ExecuteAgentContext): Promise<DataflowArtifacts>;
|
|
117
|
+
/**
|
|
118
|
+
* Best-effort, bounded-length human summary of a tool's `output`, for
|
|
119
|
+
* `ToolResultEvent.summary`. Exported so `harness/session/run.ts` can build a
|
|
120
|
+
* `TraceStep.detail` for a successful outcome from the same seam, without
|
|
121
|
+
* duplicating the truncation logic.
|
|
122
|
+
*/
|
|
123
|
+
export declare function summarizeToolOutput(output: unknown): string | undefined;
|