@paybond/kit 0.10.0 → 0.11.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/completion-presets/catalog.json +1187 -0
- package/completion-presets/catalog.sha256 +1 -0
- package/dev/trace-ui/dashboard.html +617 -0
- package/dist/agent/adapter.d.ts +51 -0
- package/dist/agent/adapter.js +66 -0
- package/dist/agent/attach-bundle.d.ts +37 -0
- package/dist/agent/attach-bundle.js +118 -0
- package/dist/agent/authorization-cache.d.ts +22 -0
- package/dist/agent/authorization-cache.js +36 -0
- package/dist/agent/deferred-tools.d.ts +11 -0
- package/dist/agent/deferred-tools.js +62 -0
- package/dist/agent/discover.d.ts +41 -0
- package/dist/agent/discover.js +147 -0
- package/dist/agent/evidence.d.ts +9 -0
- package/dist/agent/evidence.js +28 -0
- package/dist/agent/facade.d.ts +48 -0
- package/dist/agent/facade.js +112 -0
- package/dist/agent/gateway-trace-reporter.d.ts +28 -0
- package/dist/agent/gateway-trace-reporter.js +49 -0
- package/dist/agent/generic-runner.d.ts +14 -0
- package/dist/agent/generic-runner.js +49 -0
- package/dist/agent/generic-sandbox-demo.d.ts +36 -0
- package/dist/agent/generic-sandbox-demo.js +82 -0
- package/dist/agent/guarded-agent.d.ts +49 -0
- package/dist/agent/guarded-agent.js +100 -0
- package/dist/agent/index.d.ts +13 -0
- package/dist/agent/index.js +13 -0
- package/dist/agent/instrument.d.ts +156 -0
- package/dist/agent/instrument.js +442 -0
- package/dist/agent/interceptor.d.ts +24 -0
- package/dist/agent/interceptor.js +440 -0
- package/dist/agent/lazy-context-tools.d.ts +15 -0
- package/dist/agent/lazy-context-tools.js +81 -0
- package/dist/agent/registry-file.d.ts +39 -0
- package/dist/agent/registry-file.js +219 -0
- package/dist/agent/registry.d.ts +37 -0
- package/dist/agent/registry.js +128 -0
- package/dist/agent/run.d.ts +124 -0
- package/dist/agent/run.js +301 -0
- package/dist/agent/types.d.ts +318 -0
- package/dist/agent/types.js +42 -0
- package/dist/agent-recognition.d.ts +72 -0
- package/dist/agent-recognition.js +165 -0
- package/dist/bincode-wire.d.ts +18 -0
- package/dist/bincode-wire.js +93 -0
- package/dist/claude-agents/config.d.ts +21 -0
- package/dist/claude-agents/config.js +145 -0
- package/dist/claude-agents/index.d.ts +2 -0
- package/dist/claude-agents/index.js +2 -0
- package/dist/claude-agents/sandbox-demo.d.ts +30 -0
- package/dist/claude-agents/sandbox-demo.js +91 -0
- package/dist/cli/agent/env-quote.d.ts +1 -0
- package/dist/cli/agent/env-quote.js +6 -0
- package/dist/cli/agent/env-write.d.ts +8 -0
- package/dist/cli/agent/env-write.js +47 -0
- package/dist/cli/agent/paybond.d.ts +16 -0
- package/dist/cli/agent/paybond.js +55 -0
- package/dist/cli/agent/policy-file.d.ts +29 -0
- package/dist/cli/agent/policy-file.js +61 -0
- package/dist/cli/agent/production-evidence.d.ts +24 -0
- package/dist/cli/agent/production-evidence.js +98 -0
- package/dist/cli/agent/run-store.d.ts +30 -0
- package/dist/cli/agent/run-store.js +42 -0
- package/dist/cli/agent/run-trace-store.d.ts +39 -0
- package/dist/cli/agent/run-trace-store.js +143 -0
- package/dist/cli/agent-run-trace-table.d.ts +9 -0
- package/dist/cli/agent-run-trace-table.js +24 -0
- package/dist/cli/agent-sandbox-smoke-checklist.d.ts +9 -0
- package/dist/cli/agent-sandbox-smoke-checklist.js +50 -0
- package/dist/cli/command-spec.d.ts +1 -0
- package/dist/cli/command-spec.js +286 -5
- package/dist/cli/commands/agent.d.ts +16 -0
- package/dist/cli/commands/agent.js +1135 -0
- package/dist/cli/commands/dev.d.ts +7 -0
- package/dist/cli/commands/dev.js +348 -0
- package/dist/cli/commands/discovery.js +3 -3
- package/dist/cli/commands/policy.d.ts +13 -0
- package/dist/cli/commands/policy.js +769 -0
- package/dist/cli/commands/setup.d.ts +3 -0
- package/dist/cli/commands/setup.js +124 -8
- package/dist/cli/commands/workflows.js +9 -4
- package/dist/cli/config.d.ts +2 -0
- package/dist/cli/config.js +4 -2
- package/dist/cli/context.js +2 -1
- package/dist/cli/credentials.js +2 -2
- package/dist/cli/doctor-agent-middleware.d.ts +5 -0
- package/dist/cli/doctor-agent-middleware.js +49 -0
- package/dist/cli/globals.d.ts +1 -0
- package/dist/cli/globals.js +11 -1
- package/dist/cli/help.d.ts +1 -1
- package/dist/cli/help.js +35 -3
- package/dist/cli/mcp-install.js +2 -2
- package/dist/cli/mcp-policy.d.ts +3 -0
- package/dist/cli/mcp-policy.js +19 -13
- package/dist/cli/mcp-verify-config.js +9 -11
- package/dist/cli/redact.js +29 -8
- package/dist/cli/router.js +105 -2
- package/dist/cli/smoke-deep-links.d.ts +15 -0
- package/dist/cli/smoke-deep-links.js +63 -0
- package/dist/cli/telemetry.d.ts +17 -0
- package/dist/cli/telemetry.js +94 -0
- package/dist/completion-catalog-digest.d.ts +2 -0
- package/dist/completion-catalog-digest.js +2 -0
- package/dist/completion-catalog-integrity.d.ts +2 -0
- package/dist/completion-catalog-integrity.js +17 -0
- package/dist/completion-catalog.d.ts +49 -0
- package/dist/completion-catalog.js +62 -0
- package/dist/completion-contract-digest.d.ts +37 -0
- package/dist/completion-contract-digest.js +73 -0
- package/dist/completion-forbidden-fields.d.ts +5 -0
- package/dist/completion-forbidden-fields.js +26 -0
- package/dist/completion-init.d.ts +8 -0
- package/dist/completion-init.js +334 -0
- package/dist/completion-resolve.d.ts +21 -0
- package/dist/completion-resolve.js +86 -0
- package/dist/completion-validate-evidence.d.ts +24 -0
- package/dist/completion-validate-evidence.js +145 -0
- package/dist/dev/offline-gateway.d.ts +24 -0
- package/dist/dev/offline-gateway.js +102 -0
- package/dist/dev/trace-buffer.d.ts +61 -0
- package/dist/dev/trace-buffer.js +330 -0
- package/dist/dev/trace-security-headers.d.ts +11 -0
- package/dist/dev/trace-security-headers.js +16 -0
- package/dist/dev/trace-server.d.ts +8 -0
- package/dist/dev/trace-server.js +38 -0
- package/dist/dev/trace-ui.d.ts +4 -0
- package/dist/dev/trace-ui.js +25 -0
- package/dist/dev/wiremock-up.d.ts +15 -0
- package/dist/dev/wiremock-up.js +118 -0
- package/dist/doctor-completion.d.ts +17 -0
- package/dist/doctor-completion.js +428 -0
- package/dist/gateway-url.d.ts +7 -0
- package/dist/gateway-url.js +69 -0
- package/dist/index.d.ts +119 -2
- package/dist/index.js +267 -6
- package/dist/init.js +374 -57
- package/dist/langgraph/awrap-tool-call.d.ts +25 -0
- package/dist/langgraph/awrap-tool-call.js +81 -0
- package/dist/langgraph/config.d.ts +13 -0
- package/dist/langgraph/config.js +11 -0
- package/dist/langgraph/index.d.ts +4 -0
- package/dist/langgraph/index.js +4 -0
- package/dist/langgraph/sandbox-demo.d.ts +40 -0
- package/dist/langgraph/sandbox-demo.js +96 -0
- package/dist/langgraph/tool-node.d.ts +10 -0
- package/dist/langgraph/tool-node.js +38 -0
- package/dist/login.js +7 -0
- package/dist/mcp/index.d.ts +1 -0
- package/dist/mcp/index.js +1 -0
- package/dist/mcp/tool-surface.d.ts +25 -0
- package/dist/mcp/tool-surface.js +17 -0
- package/dist/mcp-capability-token-cache.d.ts +24 -0
- package/dist/mcp-capability-token-cache.js +101 -0
- package/dist/mcp-evidence-policy.d.ts +48 -0
- package/dist/mcp-evidence-policy.js +117 -0
- package/dist/mcp-policy-reload.d.ts +79 -0
- package/dist/mcp-policy-reload.js +200 -0
- package/dist/mcp-sep2828-evidence.d.ts +36 -0
- package/dist/mcp-sep2828-evidence.js +65 -0
- package/dist/mcp-server.d.ts +6 -0
- package/dist/mcp-server.js +224 -44
- package/dist/openai-agents/index.d.ts +40 -0
- package/dist/openai-agents/index.js +151 -0
- package/dist/openai-agents/sandbox-demo.d.ts +34 -0
- package/dist/openai-agents/sandbox-demo.js +118 -0
- package/dist/payee-evidence.js +2 -29
- package/dist/policy/catalog.d.ts +31 -0
- package/dist/policy/catalog.js +48 -0
- package/dist/policy/compose-utils.d.ts +3 -0
- package/dist/policy/compose-utils.js +4 -0
- package/dist/policy/compose.d.ts +20 -0
- package/dist/policy/compose.js +240 -0
- package/dist/policy/digest.d.ts +7 -0
- package/dist/policy/digest.js +75 -0
- package/dist/policy/domain.d.ts +15 -0
- package/dist/policy/domain.js +28 -0
- package/dist/policy/guardrail-spec.d.ts +17 -0
- package/dist/policy/guardrail-spec.js +140 -0
- package/dist/policy/guardrails.d.ts +48 -0
- package/dist/policy/guardrails.js +72 -0
- package/dist/policy/index.d.ts +21 -0
- package/dist/policy/index.js +21 -0
- package/dist/policy/init.d.ts +102 -0
- package/dist/policy/init.js +351 -0
- package/dist/policy/intent-spec.d.ts +52 -0
- package/dist/policy/intent-spec.js +176 -0
- package/dist/policy/json-path.d.ts +4 -0
- package/dist/policy/json-path.js +23 -0
- package/dist/policy/layers-io.d.ts +7 -0
- package/dist/policy/layers-io.js +28 -0
- package/dist/policy/load-effective.d.ts +22 -0
- package/dist/policy/load-effective.js +77 -0
- package/dist/policy/load.d.ts +85 -0
- package/dist/policy/load.js +164 -0
- package/dist/policy/merge.d.ts +29 -0
- package/dist/policy/merge.js +297 -0
- package/dist/policy/parse-text.d.ts +2 -0
- package/dist/policy/parse-text.js +126 -0
- package/dist/policy/policy-api.d.ts +45 -0
- package/dist/policy/policy-api.js +61 -0
- package/dist/policy/presets.d.ts +19 -0
- package/dist/policy/presets.js +66 -0
- package/dist/policy/registry.d.ts +7 -0
- package/dist/policy/registry.js +33 -0
- package/dist/policy/reload.d.ts +86 -0
- package/dist/policy/reload.js +233 -0
- package/dist/policy/render-yaml.d.ts +3 -0
- package/dist/policy/render-yaml.js +69 -0
- package/dist/policy/sandbox-bootstrap.d.ts +19 -0
- package/dist/policy/sandbox-bootstrap.js +66 -0
- package/dist/policy/schema.d.ts +204 -0
- package/dist/policy/schema.js +255 -0
- package/dist/policy/snapshot.d.ts +33 -0
- package/dist/policy/snapshot.js +23 -0
- package/dist/policy/validate-remote.d.ts +43 -0
- package/dist/policy/validate-remote.js +104 -0
- package/dist/policy/validate.d.ts +36 -0
- package/dist/policy/validate.js +150 -0
- package/dist/policy/watcher.d.ts +29 -0
- package/dist/policy/watcher.js +112 -0
- package/dist/principal-intent.d.ts +52 -0
- package/dist/principal-intent.js +193 -37
- package/dist/project-init.d.ts +34 -0
- package/dist/project-init.js +898 -0
- package/dist/sep2828-signature.d.ts +10 -0
- package/dist/sep2828-signature.js +134 -0
- package/dist/solutions/api.d.ts +22 -0
- package/dist/solutions/api.js +40 -0
- package/dist/solutions/catalog.d.ts +34 -0
- package/dist/solutions/catalog.js +129 -0
- package/dist/solutions/index.d.ts +2 -0
- package/dist/solutions/index.js +2 -0
- package/dist/template-init.d.ts +54 -0
- package/dist/template-init.js +203 -0
- package/dist/vercel-ai/config.d.ts +15 -0
- package/dist/vercel-ai/config.js +13 -0
- package/dist/vercel-ai/index.d.ts +4 -0
- package/dist/vercel-ai/index.js +4 -0
- package/dist/vercel-ai/sandbox-demo.d.ts +44 -0
- package/dist/vercel-ai/sandbox-demo.js +153 -0
- package/dist/vercel-ai/tool-approval.d.ts +16 -0
- package/dist/vercel-ai/tool-approval.js +41 -0
- package/dist/vercel-ai/wrap-tools.d.ts +9 -0
- package/dist/vercel-ai/wrap-tools.js +40 -0
- package/dist/x402-receipt-evidence.d.ts +29 -0
- package/dist/x402-receipt-evidence.js +97 -0
- package/dist/x402-receipt-signature.d.ts +12 -0
- package/dist/x402-receipt-signature.js +211 -0
- package/package.json +75 -3
- package/solutions/aws.json +17 -0
- package/solutions/saas.json +17 -0
- package/solutions/shopping.json +17 -0
- package/solutions/travel.json +18 -0
- package/templates/manifest.json +169 -0
- package/templates/openai-shopping-agent/.env.example +3 -0
- package/templates/openai-shopping-agent/.github/workflows/smoke.yml +20 -0
- package/templates/openai-shopping-agent/LICENSE +201 -0
- package/templates/openai-shopping-agent/README.md +29 -0
- package/templates/openai-shopping-agent/package.json +22 -0
- package/templates/openai-shopping-agent/paybond.policy.yaml +22 -0
- package/templates/openai-shopping-agent/src/index.ts +22 -0
- package/templates/openai-shopping-agent/src/paybond.config.ts +51 -0
- package/templates/openai-shopping-agent/tsconfig.json +13 -0
- package/templates/paybond-aws-operator/.env.example +3 -0
- package/templates/paybond-aws-operator/.github/workflows/smoke.yml +20 -0
- package/templates/paybond-aws-operator/LICENSE +201 -0
- package/templates/paybond-aws-operator/README.md +29 -0
- package/templates/paybond-aws-operator/package.json +20 -0
- package/templates/paybond-aws-operator/paybond.policy.yaml +22 -0
- package/templates/paybond-aws-operator/src/index.ts +54 -0
- package/templates/paybond-aws-operator/src/paybond.config.ts +51 -0
- package/templates/paybond-aws-operator/tsconfig.json +13 -0
- package/templates/paybond-claude-agents-demo/.env.example +3 -0
- package/templates/paybond-claude-agents-demo/.github/workflows/smoke.yml +20 -0
- package/templates/paybond-claude-agents-demo/LICENSE +201 -0
- package/templates/paybond-claude-agents-demo/README.md +29 -0
- package/templates/paybond-claude-agents-demo/package.json +22 -0
- package/templates/paybond-claude-agents-demo/paybond.policy.yaml +22 -0
- package/templates/paybond-claude-agents-demo/src/index.ts +22 -0
- package/templates/paybond-claude-agents-demo/src/paybond.config.ts +51 -0
- package/templates/paybond-claude-agents-demo/tsconfig.json +13 -0
- package/templates/paybond-invoice-agent/.env.example +3 -0
- package/templates/paybond-invoice-agent/.github/workflows/smoke.yml +19 -0
- package/templates/paybond-invoice-agent/LICENSE +201 -0
- package/templates/paybond-invoice-agent/README.md +29 -0
- package/templates/paybond-invoice-agent/app.py +27 -0
- package/templates/paybond-invoice-agent/package.json +6 -0
- package/templates/paybond-invoice-agent/paybond.policy.yaml +22 -0
- package/templates/paybond-invoice-agent/paybond_config.py +45 -0
- package/templates/paybond-invoice-agent/requirements.txt +2 -0
- package/templates/paybond-mcp-coding-agent/.env.example +3 -0
- package/templates/paybond-mcp-coding-agent/.github/workflows/smoke.yml +20 -0
- package/templates/paybond-mcp-coding-agent/LICENSE +201 -0
- package/templates/paybond-mcp-coding-agent/README.md +39 -0
- package/templates/paybond-mcp-coding-agent/package.json +20 -0
- package/templates/paybond-mcp-coding-agent/paybond.policy.yaml +25 -0
- package/templates/paybond-mcp-coding-agent/src/index.ts +40 -0
- package/templates/paybond-mcp-coding-agent/src/paybond.config.ts +51 -0
- package/templates/paybond-mcp-coding-agent/tsconfig.json +13 -0
- package/templates/paybond-openai-agents-demo/.env.example +3 -0
- package/templates/paybond-openai-agents-demo/.github/workflows/smoke.yml +20 -0
- package/templates/paybond-openai-agents-demo/LICENSE +201 -0
- package/templates/paybond-openai-agents-demo/README.md +29 -0
- package/templates/paybond-openai-agents-demo/package.json +22 -0
- package/templates/paybond-openai-agents-demo/paybond.policy.yaml +22 -0
- package/templates/paybond-openai-agents-demo/src/index.ts +22 -0
- package/templates/paybond-openai-agents-demo/src/paybond.config.ts +51 -0
- package/templates/paybond-openai-agents-demo/tsconfig.json +13 -0
- package/templates/paybond-procurement-agent/.env.example +3 -0
- package/templates/paybond-procurement-agent/.github/workflows/smoke.yml +20 -0
- package/templates/paybond-procurement-agent/LICENSE +201 -0
- package/templates/paybond-procurement-agent/README.md +29 -0
- package/templates/paybond-procurement-agent/package.json +20 -0
- package/templates/paybond-procurement-agent/paybond.policy.yaml +25 -0
- package/templates/paybond-procurement-agent/src/index.ts +54 -0
- package/templates/paybond-procurement-agent/src/paybond.config.ts +51 -0
- package/templates/paybond-procurement-agent/tsconfig.json +13 -0
- package/templates/paybond-travel-agent/.env.example +3 -0
- package/templates/paybond-travel-agent/.github/workflows/smoke.yml +20 -0
- package/templates/paybond-travel-agent/LICENSE +201 -0
- package/templates/paybond-travel-agent/README.md +29 -0
- package/templates/paybond-travel-agent/package.json +23 -0
- package/templates/paybond-travel-agent/paybond.policy.yaml +22 -0
- package/templates/paybond-travel-agent/src/index.ts +22 -0
- package/templates/paybond-travel-agent/src/paybond.config.ts +51 -0
- package/templates/paybond-travel-agent/tsconfig.json +13 -0
- package/templates/paybond-vercel-shopping-agent/.env.example +3 -0
- package/templates/paybond-vercel-shopping-agent/.github/workflows/smoke.yml +20 -0
- package/templates/paybond-vercel-shopping-agent/LICENSE +201 -0
- package/templates/paybond-vercel-shopping-agent/README.md +29 -0
- package/templates/paybond-vercel-shopping-agent/package.json +22 -0
- package/templates/paybond-vercel-shopping-agent/paybond.policy.yaml +22 -0
- package/templates/paybond-vercel-shopping-agent/src/index.ts +22 -0
- package/templates/paybond-vercel-shopping-agent/src/paybond.config.ts +51 -0
- package/templates/paybond-vercel-shopping-agent/tsconfig.json +13 -0
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
import { createPaybondClaudeAgentsConfig } from "../claude-agents/index.js";
|
|
2
|
+
import { createPaybondOpenAIAgentsConfig } from "../openai-agents/index.js";
|
|
3
|
+
import { isKnownPolicyPresetId, resolvePolicyPresetPath } from "../policy/presets.js";
|
|
4
|
+
import { createPaybondVercelAgentConfig } from "../vercel-ai/config.js";
|
|
5
|
+
import { createPaybondGenericAgentConfig, createPaybondGenericInputGuard, } from "./generic-runner.js";
|
|
6
|
+
import { instrumentPaybondAgent, PaybondInstrumentRuntime, } from "./instrument.js";
|
|
7
|
+
const POLICY_PATH_PATTERN = /[/\\]|\.ya?ml$|\.json$/i;
|
|
8
|
+
/**
|
|
9
|
+
* Resolve a policy preset id (for example `travel`) or pass through file paths and in-memory documents.
|
|
10
|
+
*/
|
|
11
|
+
export function resolveAgentPolicySource(policy) {
|
|
12
|
+
if (typeof policy !== "string") {
|
|
13
|
+
return policy;
|
|
14
|
+
}
|
|
15
|
+
const trimmed = policy.trim();
|
|
16
|
+
if (!trimmed) {
|
|
17
|
+
throw new Error("policy must be a non-empty preset id or file path");
|
|
18
|
+
}
|
|
19
|
+
if (POLICY_PATH_PATTERN.test(trimmed)) {
|
|
20
|
+
return trimmed;
|
|
21
|
+
}
|
|
22
|
+
if (isKnownPolicyPresetId(trimmed)) {
|
|
23
|
+
return resolvePolicyPresetPath(trimmed);
|
|
24
|
+
}
|
|
25
|
+
return trimmed;
|
|
26
|
+
}
|
|
27
|
+
/** Normalize {@link CreateGuardedAgentResult} into the quickstart `{ run, tools, hooks, policy }` shape. */
|
|
28
|
+
export function toPaybondAgentResult(result) {
|
|
29
|
+
const hooks = {};
|
|
30
|
+
switch (result.framework) {
|
|
31
|
+
case "generic":
|
|
32
|
+
hooks.inputGuard = createPaybondGenericInputGuard(result.run);
|
|
33
|
+
break;
|
|
34
|
+
case "vercel-ai":
|
|
35
|
+
if (result.toolApproval) {
|
|
36
|
+
hooks.toolApproval = result.toolApproval;
|
|
37
|
+
}
|
|
38
|
+
break;
|
|
39
|
+
case "langgraph":
|
|
40
|
+
if (result.awrapToolCall) {
|
|
41
|
+
hooks.awrapToolCall = result.awrapToolCall;
|
|
42
|
+
}
|
|
43
|
+
if (result.createToolNode) {
|
|
44
|
+
hooks.createToolNode = result.createToolNode;
|
|
45
|
+
}
|
|
46
|
+
break;
|
|
47
|
+
case "openai-agents":
|
|
48
|
+
if (result.runConfig) {
|
|
49
|
+
hooks.runConfig = result.runConfig;
|
|
50
|
+
}
|
|
51
|
+
if (result.openAIAgentsAdapter) {
|
|
52
|
+
hooks.openAIAgentsAdapter = result.openAIAgentsAdapter;
|
|
53
|
+
}
|
|
54
|
+
break;
|
|
55
|
+
case "claude-agents":
|
|
56
|
+
if (result.claudeAgentsConfig) {
|
|
57
|
+
hooks.mcpServer = result.claudeAgentsConfig.mcpServer;
|
|
58
|
+
hooks.allowedTools = result.claudeAgentsConfig.allowedTools;
|
|
59
|
+
}
|
|
60
|
+
break;
|
|
61
|
+
default: {
|
|
62
|
+
const exhaustive = result.framework;
|
|
63
|
+
throw new Error(`unsupported guarded agent framework: ${String(exhaustive)}`);
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
return {
|
|
67
|
+
run: result.run,
|
|
68
|
+
tools: result.agentTools,
|
|
69
|
+
hooks,
|
|
70
|
+
policy: result.policy,
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
/** Opinionated quickstart: resolve named presets, then delegate to {@link instrumentPaybondAgent}. */
|
|
74
|
+
export async function createPaybondAgent(paybond, input) {
|
|
75
|
+
const policy = typeof input.policy === "string" ? resolveAgentPolicySource(input.policy) : input.policy;
|
|
76
|
+
const result = await instrumentPaybondAgent(paybond, {
|
|
77
|
+
...input,
|
|
78
|
+
policy,
|
|
79
|
+
sandbox: input.context || input.attach ? false : (input.sandbox ?? true),
|
|
80
|
+
attach: input.attach,
|
|
81
|
+
context: input.context,
|
|
82
|
+
});
|
|
83
|
+
if (!(result instanceof PaybondInstrumentRuntime)) {
|
|
84
|
+
throw new Error("paybond.agent() requires sandbox bootstrap or an explicit context");
|
|
85
|
+
}
|
|
86
|
+
return {
|
|
87
|
+
run: result.run,
|
|
88
|
+
tools: result.tools,
|
|
89
|
+
hooks: result.hooks,
|
|
90
|
+
policy: result.policy,
|
|
91
|
+
};
|
|
92
|
+
}
|
|
93
|
+
/** Wrap tools for an existing bound run without reloading policy. */
|
|
94
|
+
export function wrapPaybondTools(run, tools, options) {
|
|
95
|
+
const framework = options?.framework ?? "generic";
|
|
96
|
+
switch (framework) {
|
|
97
|
+
case "generic":
|
|
98
|
+
return createPaybondGenericAgentConfig(run, tools).tools;
|
|
99
|
+
case "vercel-ai":
|
|
100
|
+
return createPaybondVercelAgentConfig(run, tools).tools;
|
|
101
|
+
case "openai-agents":
|
|
102
|
+
return createPaybondOpenAIAgentsConfig(run, tools).tools;
|
|
103
|
+
case "claude-agents":
|
|
104
|
+
return createPaybondClaudeAgentsConfig(run, tools).agentTools;
|
|
105
|
+
case "langgraph":
|
|
106
|
+
throw new Error('framework "langgraph" does not wrap tools in place; use instrument() or createPaybondLangGraphHooks(run)');
|
|
107
|
+
default: {
|
|
108
|
+
const exhaustive = framework;
|
|
109
|
+
throw new Error(`unsupported framework for wrapTools: ${String(exhaustive)}`);
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { PaybondTraceEvent } from "../agent/types.js";
|
|
2
|
+
export type AgentRunUpsertInput = Readonly<{
|
|
3
|
+
intentId: string;
|
|
4
|
+
operation?: string;
|
|
5
|
+
sandbox?: boolean;
|
|
6
|
+
allowedTools?: readonly string[];
|
|
7
|
+
completionPreset?: string;
|
|
8
|
+
}>;
|
|
9
|
+
type GatewayJsonWriter = (method: "PUT" | "POST", path: string, body: Record<string, unknown>) => Promise<unknown>;
|
|
10
|
+
/**
|
|
11
|
+
* Fire-and-forget Gateway trace reporter for console observability.
|
|
12
|
+
* Failures are swallowed so middleware execution is never blocked on telemetry.
|
|
13
|
+
*/
|
|
14
|
+
export declare class GatewayAgentRunTraceReporter {
|
|
15
|
+
private readonly writeJSON;
|
|
16
|
+
private readonly runId;
|
|
17
|
+
private readonly pending;
|
|
18
|
+
private registered;
|
|
19
|
+
constructor(writeJSON: GatewayJsonWriter, runId: string);
|
|
20
|
+
/** Register run metadata once per bind (idempotent server-side upsert). */
|
|
21
|
+
registerRun(input: AgentRunUpsertInput): void;
|
|
22
|
+
/** Append one middleware trace event to the Gateway run timeline. */
|
|
23
|
+
reportEvent(event: PaybondTraceEvent): void;
|
|
24
|
+
createSink(input: AgentRunUpsertInput): (event: PaybondTraceEvent) => void;
|
|
25
|
+
/** Await in-flight Gateway writes (CLI shutdown hooks). */
|
|
26
|
+
flush(): Promise<void>;
|
|
27
|
+
}
|
|
28
|
+
export {};
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Fire-and-forget Gateway trace reporter for console observability.
|
|
3
|
+
* Failures are swallowed so middleware execution is never blocked on telemetry.
|
|
4
|
+
*/
|
|
5
|
+
export class GatewayAgentRunTraceReporter {
|
|
6
|
+
writeJSON;
|
|
7
|
+
runId;
|
|
8
|
+
pending = [];
|
|
9
|
+
registered = false;
|
|
10
|
+
constructor(writeJSON, runId) {
|
|
11
|
+
this.writeJSON = writeJSON;
|
|
12
|
+
this.runId = runId;
|
|
13
|
+
}
|
|
14
|
+
/** Register run metadata once per bind (idempotent server-side upsert). */
|
|
15
|
+
registerRun(input) {
|
|
16
|
+
if (this.registered) {
|
|
17
|
+
return;
|
|
18
|
+
}
|
|
19
|
+
this.registered = true;
|
|
20
|
+
const body = {
|
|
21
|
+
intent_id: input.intentId,
|
|
22
|
+
operation: input.operation ?? "",
|
|
23
|
+
sandbox: input.sandbox ?? false,
|
|
24
|
+
allowed_tools: [...(input.allowedTools ?? [])],
|
|
25
|
+
completion_preset: input.completionPreset ?? "",
|
|
26
|
+
};
|
|
27
|
+
this.pending.push(this.writeJSON("PUT", `/v1/agent-runs/${encodeURIComponent(this.runId)}`, body)
|
|
28
|
+
.then(() => undefined)
|
|
29
|
+
.catch(() => undefined));
|
|
30
|
+
}
|
|
31
|
+
/** Append one middleware trace event to the Gateway run timeline. */
|
|
32
|
+
reportEvent(event) {
|
|
33
|
+
this.pending.push(this.writeJSON("POST", `/v1/agent-runs/${encodeURIComponent(this.runId)}/trace-events`, {
|
|
34
|
+
events: [event],
|
|
35
|
+
})
|
|
36
|
+
.then(() => undefined)
|
|
37
|
+
.catch(() => undefined));
|
|
38
|
+
}
|
|
39
|
+
createSink(input) {
|
|
40
|
+
this.registerRun(input);
|
|
41
|
+
return (event) => {
|
|
42
|
+
this.reportEvent(event);
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
/** Await in-flight Gateway writes (CLI shutdown hooks). */
|
|
46
|
+
async flush() {
|
|
47
|
+
await Promise.all(this.pending.splice(0));
|
|
48
|
+
}
|
|
49
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { type PaybondGenericWrappedToolDefinition, type PaybondToolInputGuardAdapter } from "./adapter.js";
|
|
2
|
+
import type { PaybondAgentRun } from "./run.js";
|
|
3
|
+
/** Wrapped generic tools plus authorize-only pre-checks for unknown frameworks. */
|
|
4
|
+
export type PaybondGenericAgentConfig = {
|
|
5
|
+
tools: PaybondGenericWrappedToolDefinition[];
|
|
6
|
+
inputGuard: PaybondToolInputGuardAdapter;
|
|
7
|
+
};
|
|
8
|
+
/** Authorize-only dry run before side-effecting tool execution (framework-neutral). */
|
|
9
|
+
export declare function createPaybondGenericInputGuard(run: PaybondAgentRun): PaybondToolInputGuardAdapter;
|
|
10
|
+
/**
|
|
11
|
+
* Recommended default when the agent framework is unknown: wrap `{ name, execute }`
|
|
12
|
+
* tools with full middleware and expose an authorize-only input guard.
|
|
13
|
+
*/
|
|
14
|
+
export declare function createPaybondGenericAgentConfig(run: PaybondAgentRun, tools: unknown): PaybondGenericAgentConfig;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { createGenericToolExecutor, createToolInputGuardAdapter, } from "./adapter.js";
|
|
2
|
+
function isGenericToolDefinition(value) {
|
|
3
|
+
if (typeof value !== "object" || value === null) {
|
|
4
|
+
return false;
|
|
5
|
+
}
|
|
6
|
+
const record = value;
|
|
7
|
+
return (typeof record.name === "string" &&
|
|
8
|
+
record.name.trim().length > 0 &&
|
|
9
|
+
typeof record.execute === "function");
|
|
10
|
+
}
|
|
11
|
+
function normalizeGenericTools(tools) {
|
|
12
|
+
if (Array.isArray(tools)) {
|
|
13
|
+
for (const tool of tools) {
|
|
14
|
+
if (!isGenericToolDefinition(tool)) {
|
|
15
|
+
throw new TypeError("each generic tool must have a non-empty name and an execute function");
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
return tools;
|
|
19
|
+
}
|
|
20
|
+
if (typeof tools === "object" && tools !== null) {
|
|
21
|
+
return Object.entries(tools).map(([name, tool]) => {
|
|
22
|
+
if (typeof tool === "function") {
|
|
23
|
+
return { name, execute: tool };
|
|
24
|
+
}
|
|
25
|
+
if (typeof tool === "object" && tool !== null && "execute" in tool) {
|
|
26
|
+
const record = tool;
|
|
27
|
+
const resolvedName = record.name?.trim() || name;
|
|
28
|
+
return { ...record, name: resolvedName };
|
|
29
|
+
}
|
|
30
|
+
throw new TypeError("generic framework tools must be an array of { name, execute } or a record of executors");
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
throw new TypeError("generic framework tools must be an array or record");
|
|
34
|
+
}
|
|
35
|
+
/** Authorize-only dry run before side-effecting tool execution (framework-neutral). */
|
|
36
|
+
export function createPaybondGenericInputGuard(run) {
|
|
37
|
+
return createToolInputGuardAdapter(run);
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Recommended default when the agent framework is unknown: wrap `{ name, execute }`
|
|
41
|
+
* tools with full middleware and expose an authorize-only input guard.
|
|
42
|
+
*/
|
|
43
|
+
export function createPaybondGenericAgentConfig(run, tools) {
|
|
44
|
+
const normalized = normalizeGenericTools(tools);
|
|
45
|
+
return {
|
|
46
|
+
tools: createGenericToolExecutor().wrapTools(run, normalized),
|
|
47
|
+
inputGuard: createPaybondGenericInputGuard(run),
|
|
48
|
+
};
|
|
49
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import type { Paybond } from "../index.js";
|
|
2
|
+
export type RunGenericSandboxDemoInput = {
|
|
3
|
+
paybond: Paybond;
|
|
4
|
+
operation?: string;
|
|
5
|
+
requestedSpendCents?: number;
|
|
6
|
+
evidencePreset?: string;
|
|
7
|
+
toolCallId?: string;
|
|
8
|
+
};
|
|
9
|
+
export type RunGenericSandboxDemoResult = {
|
|
10
|
+
bind: {
|
|
11
|
+
run_id: string;
|
|
12
|
+
tenant_id: string;
|
|
13
|
+
intent_id: string;
|
|
14
|
+
capability_token: string;
|
|
15
|
+
operation: string;
|
|
16
|
+
sandbox_lifecycle_status?: string;
|
|
17
|
+
};
|
|
18
|
+
authorization: {
|
|
19
|
+
allow: boolean;
|
|
20
|
+
audit_id?: string;
|
|
21
|
+
decision_id?: string;
|
|
22
|
+
};
|
|
23
|
+
execute: {
|
|
24
|
+
tool_result?: unknown;
|
|
25
|
+
evidence?: {
|
|
26
|
+
submitted: boolean;
|
|
27
|
+
sandbox_lifecycle_status?: string;
|
|
28
|
+
predicate_passed?: boolean | null;
|
|
29
|
+
};
|
|
30
|
+
};
|
|
31
|
+
};
|
|
32
|
+
/**
|
|
33
|
+
* No-LLM agent-agnostic sandbox demo: `createPaybondGenericAgentConfig` +
|
|
34
|
+
* wrapped execute + auto-evidence.
|
|
35
|
+
*/
|
|
36
|
+
export declare function runGenericSandboxDemo(input: RunGenericSandboxDemoInput): Promise<RunGenericSandboxDemoResult>;
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import { createPaybondGenericAgentConfig } from "./generic-runner.js";
|
|
2
|
+
import { createPaybondToolRegistry } from "./registry.js";
|
|
3
|
+
async function executePaidTool(args) {
|
|
4
|
+
return { status: "completed", cost_cents: args.estimatedPriceCents };
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* No-LLM agent-agnostic sandbox demo: `createPaybondGenericAgentConfig` +
|
|
8
|
+
* wrapped execute + auto-evidence.
|
|
9
|
+
*/
|
|
10
|
+
export async function runGenericSandboxDemo(input) {
|
|
11
|
+
const operation = (input.operation ?? "paid-tool").trim();
|
|
12
|
+
const requestedSpendCents = input.requestedSpendCents ?? 100;
|
|
13
|
+
const evidencePreset = (input.evidencePreset ?? "cost_and_completion").trim();
|
|
14
|
+
const toolCallId = (input.toolCallId ?? "generic-demo-1").trim();
|
|
15
|
+
const registry = createPaybondToolRegistry({
|
|
16
|
+
defaultDeny: true,
|
|
17
|
+
sideEffecting: {
|
|
18
|
+
[operation]: {
|
|
19
|
+
operation,
|
|
20
|
+
evidencePreset,
|
|
21
|
+
spendCents: (args) => typeof args === "object" &&
|
|
22
|
+
args !== null &&
|
|
23
|
+
"estimatedPriceCents" in args &&
|
|
24
|
+
typeof args.estimatedPriceCents === "number"
|
|
25
|
+
? args.estimatedPriceCents
|
|
26
|
+
: requestedSpendCents,
|
|
27
|
+
evidenceMapper: (result) => {
|
|
28
|
+
const payload = result;
|
|
29
|
+
return {
|
|
30
|
+
status: payload.status,
|
|
31
|
+
cost_cents: payload.cost_cents,
|
|
32
|
+
};
|
|
33
|
+
},
|
|
34
|
+
},
|
|
35
|
+
},
|
|
36
|
+
});
|
|
37
|
+
const run = await input.paybond.agentRun.bind({
|
|
38
|
+
bootstrap: {
|
|
39
|
+
kind: "sandbox",
|
|
40
|
+
operation,
|
|
41
|
+
requestedSpendCents,
|
|
42
|
+
completionPreset: evidencePreset,
|
|
43
|
+
},
|
|
44
|
+
registry,
|
|
45
|
+
});
|
|
46
|
+
const config = createPaybondGenericAgentConfig(run, [
|
|
47
|
+
{ name: operation, execute: executePaidTool },
|
|
48
|
+
]);
|
|
49
|
+
const wrapped = config.tools.find((tool) => tool.name === operation);
|
|
50
|
+
if (!wrapped) {
|
|
51
|
+
throw new Error(`generic sandbox demo missing wrapped tool ${operation}`);
|
|
52
|
+
}
|
|
53
|
+
const wrappedResult = await wrapped.execute({
|
|
54
|
+
toolName: operation,
|
|
55
|
+
toolCallId,
|
|
56
|
+
arguments: { estimatedPriceCents: requestedSpendCents },
|
|
57
|
+
});
|
|
58
|
+
const sandboxStatus = run.binding.sandbox?.sandboxLifecycleStatus;
|
|
59
|
+
return {
|
|
60
|
+
bind: {
|
|
61
|
+
run_id: run.runId,
|
|
62
|
+
tenant_id: run.tenantId,
|
|
63
|
+
intent_id: run.intentId,
|
|
64
|
+
capability_token: run.capabilityToken,
|
|
65
|
+
operation,
|
|
66
|
+
sandbox_lifecycle_status: sandboxStatus,
|
|
67
|
+
},
|
|
68
|
+
authorization: {
|
|
69
|
+
allow: true,
|
|
70
|
+
audit_id: wrappedResult.authorization?.auditId,
|
|
71
|
+
decision_id: wrappedResult.authorization?.decisionId,
|
|
72
|
+
},
|
|
73
|
+
execute: {
|
|
74
|
+
tool_result: wrappedResult.toolResult,
|
|
75
|
+
evidence: {
|
|
76
|
+
submitted: wrappedResult.evidence?.submitted ?? false,
|
|
77
|
+
sandbox_lifecycle_status: sandboxStatus,
|
|
78
|
+
predicate_passed: wrappedResult.evidence?.predicatePassed ?? null,
|
|
79
|
+
},
|
|
80
|
+
},
|
|
81
|
+
};
|
|
82
|
+
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import type { ToolNodeOptions } from "@langchain/langgraph/prebuilt";
|
|
2
|
+
import { createOpenAIAgentsAdapter, type PaybondOpenAIAgentsAdapterOptions } from "../openai-agents/index.js";
|
|
3
|
+
import { PaybondPolicy, type PaybondPolicyLoadSource } from "../policy/load.js";
|
|
4
|
+
import type { PaybondPolicySandboxBootstrapOptions } from "../policy/sandbox-bootstrap.js";
|
|
5
|
+
import type { PolicyValidatorOptions } from "../policy/validate.js";
|
|
6
|
+
import { paybondVercelToolApproval } from "../vercel-ai/tool-approval.js";
|
|
7
|
+
import { type PaybondLangGraphAwrapToolCall } from "../langgraph/awrap-tool-call.js";
|
|
8
|
+
import { paybondToolNode } from "../langgraph/tool-node.js";
|
|
9
|
+
import { type ClaudeAgentsConfig } from "../claude-agents/index.js";
|
|
10
|
+
import type { PaybondToolRegistry } from "./registry.js";
|
|
11
|
+
import type { PaybondAgentRunHost } from "./run.js";
|
|
12
|
+
import { PaybondAgentRun } from "./run.js";
|
|
13
|
+
import type { PaybondRunBindingAttachInput } from "./types.js";
|
|
14
|
+
export type GuardedAgentFramework = "generic" | "openai-agents" | "vercel-ai" | "langgraph" | "claude-agents";
|
|
15
|
+
export type CreateGuardedAgentInput<TTools = unknown> = {
|
|
16
|
+
policy: PaybondPolicyLoadSource | PaybondPolicy;
|
|
17
|
+
/** Agent-agnostic wrapping when omitted. Pass a framework only when SDK-specific hooks are required. */
|
|
18
|
+
framework?: GuardedAgentFramework;
|
|
19
|
+
tools: TTools;
|
|
20
|
+
/** Sandbox bootstrap options; ignored when `attach` is set. */
|
|
21
|
+
bootstrap?: PaybondPolicySandboxBootstrapOptions;
|
|
22
|
+
attach?: PaybondRunBindingAttachInput;
|
|
23
|
+
runId?: string;
|
|
24
|
+
traceSink?: import("./types.js").PaybondTraceSink;
|
|
25
|
+
/** @deprecated Use {@link CreateGuardedAgentInput.traceSink}. */
|
|
26
|
+
onTrace?: import("./types.js").PaybondTraceSink;
|
|
27
|
+
validatePolicy?: boolean | PolicyValidatorOptions;
|
|
28
|
+
openAIAgentsOptions?: PaybondOpenAIAgentsAdapterOptions;
|
|
29
|
+
};
|
|
30
|
+
export type CreateGuardedAgentResultBase = {
|
|
31
|
+
run: PaybondAgentRun;
|
|
32
|
+
policy: PaybondPolicy;
|
|
33
|
+
registry: PaybondToolRegistry;
|
|
34
|
+
framework: GuardedAgentFramework;
|
|
35
|
+
agentTools: unknown;
|
|
36
|
+
toolApproval?: ReturnType<typeof paybondVercelToolApproval>;
|
|
37
|
+
awrapToolCall?: PaybondLangGraphAwrapToolCall;
|
|
38
|
+
createToolNode?: (tools: Parameters<typeof paybondToolNode>[0], options?: ToolNodeOptions) => ReturnType<typeof paybondToolNode>;
|
|
39
|
+
openAIAgentsAdapter?: ReturnType<typeof createOpenAIAgentsAdapter>;
|
|
40
|
+
runConfig?: ReturnType<typeof createOpenAIAgentsAdapter>["runConfig"];
|
|
41
|
+
claudeAgentsConfig?: ClaudeAgentsConfig;
|
|
42
|
+
};
|
|
43
|
+
export type CreateGuardedAgentResult<TTools = unknown> = CreateGuardedAgentResultBase & {
|
|
44
|
+
agentTools: TTools;
|
|
45
|
+
};
|
|
46
|
+
/** Policy-driven agent factory: load policy, bind a run, and wire framework tools. */
|
|
47
|
+
export declare function createGuardedAgent<TTools>(paybond: PaybondAgentRunHost, input: CreateGuardedAgentInput<TTools>): Promise<CreateGuardedAgentResult<TTools>>;
|
|
48
|
+
/** Alias for {@link createGuardedAgent} matching facade runner naming. */
|
|
49
|
+
export declare const createGuardedAgentRunner: typeof createGuardedAgent;
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import { createOpenAIAgentsAdapter, createPaybondOpenAIAgentsConfig, } from "../openai-agents/index.js";
|
|
2
|
+
import { PaybondPolicy } from "../policy/load.js";
|
|
3
|
+
import { createPaybondVercelAgentConfig } from "../vercel-ai/config.js";
|
|
4
|
+
import { createPaybondLangGraphHooks } from "../langgraph/config.js";
|
|
5
|
+
import { createPaybondClaudeAgentsConfig, } from "../claude-agents/index.js";
|
|
6
|
+
import { createPaybondGenericAgentConfig, } from "./generic-runner.js";
|
|
7
|
+
import { PaybondAgentRun } from "./run.js";
|
|
8
|
+
async function resolvePolicy(source) {
|
|
9
|
+
if (source instanceof PaybondPolicy) {
|
|
10
|
+
return source;
|
|
11
|
+
}
|
|
12
|
+
return PaybondPolicy.load(source);
|
|
13
|
+
}
|
|
14
|
+
async function maybeValidatePolicy(policy, validatePolicy) {
|
|
15
|
+
if (!validatePolicy) {
|
|
16
|
+
return;
|
|
17
|
+
}
|
|
18
|
+
const options = validatePolicy === true ? undefined : validatePolicy;
|
|
19
|
+
const result = await policy.validate(options);
|
|
20
|
+
if (!result.valid) {
|
|
21
|
+
const messages = result.errors.map((entry) => entry.message).join("; ");
|
|
22
|
+
throw new Error(`policy validation failed: ${messages}`);
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
async function bindGuardedRun(paybond, policy, input) {
|
|
26
|
+
const registry = policy.toToolRegistry();
|
|
27
|
+
const bindInput = {
|
|
28
|
+
registry,
|
|
29
|
+
runId: input.runId,
|
|
30
|
+
traceSink: input.traceSink,
|
|
31
|
+
onTrace: input.onTrace,
|
|
32
|
+
};
|
|
33
|
+
if (input.attach) {
|
|
34
|
+
bindInput.attach = input.attach;
|
|
35
|
+
}
|
|
36
|
+
else {
|
|
37
|
+
bindInput.bootstrap = policy.sandboxBootstrap(input.bootstrap ?? {});
|
|
38
|
+
}
|
|
39
|
+
return PaybondAgentRun.bind(paybond, bindInput);
|
|
40
|
+
}
|
|
41
|
+
/** Policy-driven agent factory: load policy, bind a run, and wire framework tools. */
|
|
42
|
+
export async function createGuardedAgent(paybond, input) {
|
|
43
|
+
const policy = await resolvePolicy(input.policy);
|
|
44
|
+
await maybeValidatePolicy(policy, input.validatePolicy);
|
|
45
|
+
const registry = policy.toToolRegistry();
|
|
46
|
+
const run = await bindGuardedRun(paybond, policy, input);
|
|
47
|
+
const base = { run, policy, registry };
|
|
48
|
+
const framework = input.framework ?? "generic";
|
|
49
|
+
switch (framework) {
|
|
50
|
+
case "generic": {
|
|
51
|
+
const config = createPaybondGenericAgentConfig(run, input.tools);
|
|
52
|
+
return { ...base, framework: "generic", agentTools: config.tools };
|
|
53
|
+
}
|
|
54
|
+
case "vercel-ai": {
|
|
55
|
+
const config = createPaybondVercelAgentConfig(run, input.tools);
|
|
56
|
+
return {
|
|
57
|
+
...base,
|
|
58
|
+
framework: "vercel-ai",
|
|
59
|
+
agentTools: config.tools,
|
|
60
|
+
toolApproval: config.toolApproval,
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
case "openai-agents": {
|
|
64
|
+
const config = createPaybondOpenAIAgentsConfig(run, input.tools, input.openAIAgentsOptions);
|
|
65
|
+
const adapter = createOpenAIAgentsAdapter(run, input.openAIAgentsOptions);
|
|
66
|
+
return {
|
|
67
|
+
...base,
|
|
68
|
+
framework: "openai-agents",
|
|
69
|
+
agentTools: config.tools,
|
|
70
|
+
openAIAgentsAdapter: adapter,
|
|
71
|
+
runConfig: config.runConfig,
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
case "langgraph": {
|
|
75
|
+
const hooks = createPaybondLangGraphHooks(run);
|
|
76
|
+
return {
|
|
77
|
+
...base,
|
|
78
|
+
framework: "langgraph",
|
|
79
|
+
agentTools: input.tools,
|
|
80
|
+
awrapToolCall: hooks.awrapToolCall,
|
|
81
|
+
createToolNode: hooks.createToolNode,
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
case "claude-agents": {
|
|
85
|
+
const claudeAgentsConfig = createPaybondClaudeAgentsConfig(run, input.tools);
|
|
86
|
+
return {
|
|
87
|
+
...base,
|
|
88
|
+
framework: "claude-agents",
|
|
89
|
+
agentTools: claudeAgentsConfig.agentTools,
|
|
90
|
+
claudeAgentsConfig,
|
|
91
|
+
};
|
|
92
|
+
}
|
|
93
|
+
default: {
|
|
94
|
+
const exhaustive = framework;
|
|
95
|
+
throw new Error(`unsupported guarded agent framework: ${String(exhaustive)}`);
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
/** Alias for {@link createGuardedAgent} matching facade runner naming. */
|
|
100
|
+
export const createGuardedAgentRunner = createGuardedAgent;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export { createGuardedAgent, createGuardedAgentRunner, type CreateGuardedAgentInput, type CreateGuardedAgentResult, type CreateGuardedAgentResultBase, type GuardedAgentFramework, } from "./guarded-agent.js";
|
|
2
|
+
export { createPaybondAgent, resolveAgentPolicySource, toPaybondAgentResult, wrapPaybondTools, type PaybondAgentHooks, type PaybondAgentInput, type PaybondAgentResult, type PaybondInstrumentInput, type PaybondWrapToolsOptions, } from "./facade.js";
|
|
3
|
+
export { PaybondInstrumentBuilder, PaybondInstrumented, PaybondInstrumentRuntime, PaybondLazyContextError, PaybondUnboundContextError, discoverPolicyFromAgent, discoverToolNames, discoverToolsFromAgent, inlinePolicyToDocument, instrumentPaybondAgent, instrumentPaybondClaudeAgents, instrumentPaybondLangGraph, instrumentPaybondMCP, instrumentPaybondOpenAI, instrumentPaybondVercel, isInlinePolicy, isInstrumentableAgentObject, readPaybondAgentInstrumentation, type PaybondAgentInstrumentation, type PaybondInlinePolicy, type PaybondInstrumentAgentOptions, type PaybondInstrumentAttachInput, type PaybondInstrumentBinding, type PaybondInstrumentContext, type PaybondInstrumentContextInput, type PaybondInstrumentContextProvider, } from "./instrument.js";
|
|
4
|
+
export { formatPaybondAttachEnvSnippet, openPaybondAttachBundle, PAYBOND_ATTACH_BUNDLE_ENV, PAYBOND_ATTACH_BUNDLE_PREFIX, PAYBOND_ATTACH_INTENT_ID_ENV, PAYBOND_CAPABILITY_TOKEN_ENV, productionEvidenceFromAttachBundle, resolveAttachContextFromEnv, sealPaybondAttachBundle, type PaybondAttachBundlePayloadV1, type PaybondAttachEnvRecord, } from "./attach-bundle.js";
|
|
5
|
+
export { createPaybondGenericAgentConfig, createPaybondGenericInputGuard, type PaybondGenericAgentConfig, } from "./generic-runner.js";
|
|
6
|
+
export { runGenericSandboxDemo, type RunGenericSandboxDemoInput, type RunGenericSandboxDemoResult, } from "./generic-sandbox-demo.js";
|
|
7
|
+
export { PaybondFrameworkAdapter, createGenericToolExecutor, createToolInputGuardAdapter, paybondGenericToolExecutorAdapter, paybondToolInputGuardAdapter, type PaybondGenericToolCall, type PaybondGenericToolDefinition, type PaybondGenericWrappedToolDefinition, type PaybondToolInputGuardAdapter, } from "./adapter.js";
|
|
8
|
+
export { buildAutoEvidencePayload, type BuiltAutoEvidence } from "./evidence.js";
|
|
9
|
+
export { PaybondToolInterceptor } from "./interceptor.js";
|
|
10
|
+
export { PaybondToolRegistry, createPaybondToolRegistry, } from "./registry.js";
|
|
11
|
+
export { PaybondAgentRun, PaybondAgentRunFacade, type PaybondAgentRunHost, } from "./run.js";
|
|
12
|
+
export { agentRegistryDocumentToConfig, buildSmokeRegistry, loadAgentRegistryFile, parseAgentRegistryText, validateAgentRegistryDocument, type AgentRegistryFileDocument, type AgentRegistryValidationResult, } from "./registry-file.js";
|
|
13
|
+
export { PaybondAgentRunBindError, PaybondAutoEvidenceError, PaybondAutoEvidenceSubmitError, PaybondEvidenceSubmitError, PaybondToolRegistryValidationError, PaybondUnregisteredSideEffectingToolError, type PaybondAgentRunBindInput, type PaybondAuthorizeToolCallInput, type PaybondEvidenceMapper, type PaybondInterceptEvidenceResult, type PaybondInterceptWrapExecuteInput, type PaybondInterceptWrapExecuteResult, type PaybondRunBinding, type PaybondRunBindingAttachInput, type PaybondRunBindingSandboxBootstrapInput, type PaybondRunProductionEvidenceCredentials, type PaybondRunGuard, type PaybondSideEffectingToolEntry, type PaybondSideEffectingToolPolicy, type PaybondSpendResolver, type PaybondToolCallContext, type PaybondToolInputGuardAllowDecision, type PaybondToolInputGuardApprovalRequiredDecision, type PaybondToolInputGuardDecision, type PaybondToolInputGuardDenyDecision, type PaybondToolRegistryConfig, type PaybondToolResolution, type PaybondTraceEvent, type PaybondTraceSink, } from "./types.js";
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export { createGuardedAgent, createGuardedAgentRunner, } from "./guarded-agent.js";
|
|
2
|
+
export { createPaybondAgent, resolveAgentPolicySource, toPaybondAgentResult, wrapPaybondTools, } from "./facade.js";
|
|
3
|
+
export { PaybondInstrumentBuilder, PaybondInstrumented, PaybondInstrumentRuntime, PaybondLazyContextError, PaybondUnboundContextError, discoverPolicyFromAgent, discoverToolNames, discoverToolsFromAgent, inlinePolicyToDocument, instrumentPaybondAgent, instrumentPaybondClaudeAgents, instrumentPaybondLangGraph, instrumentPaybondMCP, instrumentPaybondOpenAI, instrumentPaybondVercel, isInlinePolicy, isInstrumentableAgentObject, readPaybondAgentInstrumentation, } from "./instrument.js";
|
|
4
|
+
export { formatPaybondAttachEnvSnippet, openPaybondAttachBundle, PAYBOND_ATTACH_BUNDLE_ENV, PAYBOND_ATTACH_BUNDLE_PREFIX, PAYBOND_ATTACH_INTENT_ID_ENV, PAYBOND_CAPABILITY_TOKEN_ENV, productionEvidenceFromAttachBundle, resolveAttachContextFromEnv, sealPaybondAttachBundle, } from "./attach-bundle.js";
|
|
5
|
+
export { createPaybondGenericAgentConfig, createPaybondGenericInputGuard, } from "./generic-runner.js";
|
|
6
|
+
export { runGenericSandboxDemo, } from "./generic-sandbox-demo.js";
|
|
7
|
+
export { createGenericToolExecutor, createToolInputGuardAdapter, paybondGenericToolExecutorAdapter, paybondToolInputGuardAdapter, } from "./adapter.js";
|
|
8
|
+
export { buildAutoEvidencePayload } from "./evidence.js";
|
|
9
|
+
export { PaybondToolInterceptor } from "./interceptor.js";
|
|
10
|
+
export { PaybondToolRegistry, createPaybondToolRegistry, } from "./registry.js";
|
|
11
|
+
export { PaybondAgentRun, PaybondAgentRunFacade, } from "./run.js";
|
|
12
|
+
export { agentRegistryDocumentToConfig, buildSmokeRegistry, loadAgentRegistryFile, parseAgentRegistryText, validateAgentRegistryDocument, } from "./registry-file.js";
|
|
13
|
+
export { PaybondAgentRunBindError, PaybondAutoEvidenceError, PaybondAutoEvidenceSubmitError, PaybondEvidenceSubmitError, PaybondToolRegistryValidationError, PaybondUnregisteredSideEffectingToolError, } from "./types.js";
|