@pasko70/pibo 1.16.6 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/agent-runtime/auth.js +28 -0
- package/dist/agent-runtime/capabilities.js +221 -0
- package/dist/agent-runtime/context-build.js +313 -0
- package/dist/agent-runtime/contract.js +45 -0
- package/dist/agent-runtime/errors.js +57 -0
- package/dist/agent-runtime/events.js +1 -0
- package/dist/agent-runtime/history.js +1 -0
- package/dist/agent-runtime/profile-validation.js +109 -0
- package/dist/agent-runtime/registry.js +608 -0
- package/dist/agent-runtime/resource-files.js +87 -0
- package/dist/agent-runtime/resource-service.js +635 -0
- package/dist/agent-runtime/resources.js +1 -0
- package/dist/agent-runtime/routed-session.js +931 -0
- package/dist/agent-runtime/testing/contract.js +51 -0
- package/dist/agent-runtime/testing/fake-adapter.js +192 -0
- package/dist/agent-runtime/types.js +3 -0
- package/dist/agent-runtimes/codex-native/adapter.js +905 -0
- package/dist/agent-runtimes/codex-native/auth.js +476 -0
- package/dist/agent-runtimes/codex-native/client.js +734 -0
- package/dist/agent-runtimes/codex-native/config.js +152 -0
- package/dist/agent-runtimes/codex-native/history.js +283 -0
- package/dist/agent-runtimes/codex-native/mcp-stdio-launcher.js +89 -0
- package/dist/agent-runtimes/codex-native/models.js +581 -0
- package/dist/agent-runtimes/codex-native/process.js +459 -0
- package/dist/agent-runtimes/codex-native/protocol-types.js +1 -0
- package/dist/agent-runtimes/codex-native/protocol-version.js +7 -0
- package/dist/agent-runtimes/codex-native/redaction.js +31 -0
- package/dist/agent-runtimes/codex-native/requests.js +378 -0
- package/dist/agent-runtimes/codex-native/resource-delivery.js +445 -0
- package/dist/agent-runtimes/codex-native/thread.js +388 -0
- package/dist/agent-runtimes/codex-native/turn.js +849 -0
- package/dist/agent-runtimes/pi/adapter.js +653 -0
- package/dist/agent-runtimes/pi/auth.js +455 -0
- package/dist/agent-runtimes/pi/history.js +640 -0
- package/dist/agent-runtimes/pi/model-catalog.js +87 -0
- package/dist/agent-runtimes/pi/routed-session.js +1464 -0
- package/dist/agent-runtimes/pi/runtime.js +534 -0
- package/dist/agent-runtimes/pi/tool-compiler.js +69 -0
- package/dist/apps/chat/agent-profiles.js +40 -23
- package/dist/apps/chat/agent-store.js +111 -64
- package/dist/apps/chat/chat-api-routes.js +1 -1
- package/dist/apps/chat/chat-request-normalizers.js +47 -0
- package/dist/apps/chat/data/chat-data-mappers.js +25 -9
- package/dist/apps/chat/data/history-query-service.js +108 -0
- package/dist/apps/chat/data/session-query-service.js +24 -3
- package/dist/apps/chat/data/timeline-query-service.js +3 -3
- package/dist/apps/chat/model-catalog.js +1 -55
- package/dist/apps/chat/provider-auth-actions.js +171 -23
- package/dist/apps/chat/stream.js +12 -0
- package/dist/apps/chat/trace-v2.js +1 -0
- package/dist/apps/chat/trace.js +126 -415
- package/dist/apps/chat/web-app.js +582 -157
- package/dist/apps/chat-ui/assets/{dist-BTLtT_Vf.js → dist-9v2ZXT6V.js} +1 -1
- package/dist/apps/chat-ui/assets/{dist-CMk1aPug.js → dist-B1LVAytl.js} +1 -1
- package/dist/apps/chat-ui/assets/{dist-CcwA_IWN.js → dist-C6LPDFXU.js} +1 -1
- package/dist/apps/chat-ui/assets/{dist-DKOthbxr.js → dist-DVtXxfHc.js} +1 -1
- package/dist/apps/chat-ui/assets/{dist-ls2I6BIw.js → dist-DW4Qrfbd.js} +1 -1
- package/dist/apps/chat-ui/assets/{dist-D1rAtRWs.js → dist-DmbsHdMC.js} +1 -1
- package/dist/apps/chat-ui/assets/{dist-C1JQRskW.js → dist-DyvwuSFO.js} +1 -1
- package/dist/apps/chat-ui/assets/{dist-DfpaylQ-.js → dist-I26VB0QO.js} +1 -1
- package/dist/apps/chat-ui/assets/{dist-D10bTFD5.js → dist-RtHbJRPV.js} +1 -1
- package/dist/apps/chat-ui/assets/{dist-5KpmmBBZ.js → dist-sZgJkWZb.js} +1 -1
- package/dist/apps/chat-ui/assets/index-BPbNvcZe.css +1 -0
- package/dist/apps/chat-ui/assets/index-CIOf2uL2.js +237 -0
- package/dist/apps/chat-ui/index.html +2 -2
- package/dist/apps/chat-vscode-web/assets/index-1ivRyjFs.js +41 -0
- package/dist/apps/chat-vscode-web/index.html +1 -1
- package/dist/apps/vscode-artifacts/latest.vsix +0 -0
- package/dist/apps/vscode-artifacts/pibo-vscode-ext-2.0.0.vsix +0 -0
- package/dist/auth/login-actions.js +5 -251
- package/dist/cli-session/localSessionSource.js +8 -1
- package/dist/core/context-build.js +124 -20
- package/dist/core/default-profile.js +8 -0
- package/dist/core/profiles.js +30 -3
- package/dist/core/routed-session.js +5 -1446
- package/dist/core/runtime.js +5 -561
- package/dist/core/session-router.js +637 -83
- package/dist/data/cli.js +20 -3
- package/dist/data/schema.js +104 -1
- package/dist/data/session-store.js +24 -1
- package/dist/debug/events.js +25 -10
- package/dist/debug/failures.js +23 -3
- package/dist/debug/index.js +24 -6
- package/dist/debug/messages.js +87 -7
- package/dist/debug/persisted-payloads.js +31 -0
- package/dist/debug/pty.js +7 -6
- package/dist/debug/runtime-binding.js +29 -0
- package/dist/debug/session.js +137 -0
- package/dist/debug/summary.js +12 -0
- package/dist/debug/telemetry.js +28 -0
- package/dist/debug/tools.js +12 -2
- package/dist/debug/trace.js +154 -76
- package/dist/gateway/server.js +87 -2
- package/dist/gateway/tool.js +5 -5
- package/dist/index.js +21 -2
- package/dist/loops/tools.js +13 -12
- package/dist/mcp/agent-context.js +13 -4
- package/dist/mcp/client.js +10 -6
- package/dist/mcp/config.js +5 -2
- package/dist/mcp/runtime-session.js +166 -0
- package/dist/plugins/builtin.js +191 -53
- package/dist/plugins/codex-native.js +29 -0
- package/dist/plugins/registry.js +66 -2
- package/dist/runs/tools.js +26 -25
- package/dist/session-ui/terminalRows.js +2 -2
- package/dist/sessions/pibo-data-store.js +125 -16
- package/dist/sessions/runtime-binding.js +107 -0
- package/dist/sessions/sqlite-store.js +239 -18
- package/dist/sessions/store.js +86 -7
- package/dist/shared/trace-engine.js +18 -9
- package/dist/shared/trace-event-projection.js +29 -11
- package/dist/shared/{trace-transcript.js → trace-history.js} +193 -195
- package/dist/shared/trace-order.js +9 -4
- package/dist/shared/trace-page-merge.js +1 -1
- package/dist/signals/projector.js +20 -2
- package/dist/signals/registry.js +11 -0
- package/dist/subagents/tool.js +8 -6
- package/dist/tools/codex-browser.js +20 -19
- package/dist/tools/codex-compat.js +10 -9
- package/dist/tools/codex-image-generation.js +8 -6
- package/dist/tools/contract.js +45 -0
- package/dist/tools/credential-registry.js +182 -0
- package/dist/tools/mcp-bridge.js +511 -0
- package/dist/tools/payload-writer.js +17 -0
- package/dist/tools/runtime/tool.js +10 -9
- package/dist/tools/schema.js +9 -0
- package/dist/tools/session-service.js +193 -0
- package/dist/tools/session-tool-set.js +85 -0
- package/dist/web-annotations/tools.js +17 -16
- package/docs/README.md +11 -0
- package/package.json +3 -2
- package/skills/builtin/pibo-agent-runtime-adapter/SKILL.md +183 -0
- package/skills/builtin/pibo-agent-runtime-adapter/evals/README.md +10 -0
- package/skills/builtin/pibo-agent-runtime-adapter/evals/evals.json +45 -0
- package/skills/builtin/pibo-agent-runtime-adapter/evals/fixtures/orion-full-harness.md +60 -0
- package/skills/builtin/pibo-agent-runtime-adapter/evals/fixtures/relay-partial-harness.md +52 -0
- package/skills/builtin/pibo-agent-runtime-adapter/references/capabilities-and-designer.md +194 -0
- package/skills/builtin/pibo-agent-runtime-adapter/references/history-debug-and-security.md +213 -0
- package/skills/builtin/pibo-agent-runtime-adapter/references/interfaces-and-registration.md +214 -0
- package/skills/builtin/pibo-agent-runtime-adapter/references/lifecycle-bindings-and-events.md +193 -0
- package/skills/builtin/pibo-agent-runtime-adapter/references/portable-delivery-and-native-behavior.md +226 -0
- package/skills/builtin/pibo-agent-runtime-adapter/references/testing-migration-and-validation.md +256 -0
- package/dist/apps/chat-ui/assets/index-C2YI0xfw.js +0 -237
- package/dist/apps/chat-ui/assets/index-E0RmuCkY.css +0 -1
- package/dist/apps/chat-vscode-web/assets/index-D-tSsXLG.js +0 -41
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
export const AGENT_RUNTIME_AUTH_METHOD_IDS = ["device_code", "browser_oauth", "api_key"];
|
|
2
|
+
export const AGENT_RUNTIME_AUTH_COMPLETION_MODES = ["immediate", "explicit", "notification"];
|
|
3
|
+
export function redactAgentRuntimeAuthText(value, maxLength = 1_000) {
|
|
4
|
+
return value
|
|
5
|
+
.replace(/Bearer\s+\S+/gi, "Bearer [redacted]")
|
|
6
|
+
.replace(/\b(?:sk|pk|ghp|github_pat|pibo)[-_][A-Za-z0-9_-]{8,}\b/g, "[redacted]")
|
|
7
|
+
.replace(/\beyJ[A-Za-z0-9_-]{10,}\.[A-Za-z0-9_-]{10,}\.[A-Za-z0-9_-]{10,}\b/g, "[redacted]")
|
|
8
|
+
.replace(/\b(access[_-]?token|refresh[_-]?token|id[_-]?token|api[_-]?key|token|secret|password|account[_-]?id)\b(\s*["']?\s*[:=]\s*["']?)([^\s"'&,}]+)/gi, "$1$2[redacted]")
|
|
9
|
+
.replace(/\b[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,}\b/gi, "[redacted account]")
|
|
10
|
+
.replace(/`(?:\/|[A-Za-z]:[\\/])[^`\r\n]+`/g, "`[redacted path]`")
|
|
11
|
+
.replace(/\bfile:\/\/\/?[^\s"'`,)]+/gi, "file://[redacted path]")
|
|
12
|
+
.slice(0, maxLength);
|
|
13
|
+
}
|
|
14
|
+
export function isConfiguredAgentRuntimeAuthState(state) {
|
|
15
|
+
return state === "connected" || state === "partial";
|
|
16
|
+
}
|
|
17
|
+
export function aggregateAgentRuntimeAuthState(providers, supported) {
|
|
18
|
+
if (!supported)
|
|
19
|
+
return "unsupported";
|
|
20
|
+
if (providers.length === 0)
|
|
21
|
+
return "failed";
|
|
22
|
+
const states = new Set(providers.map((provider) => provider.state));
|
|
23
|
+
if (states.size === 1)
|
|
24
|
+
return providers[0].state;
|
|
25
|
+
if (states.has("pending"))
|
|
26
|
+
return "pending";
|
|
27
|
+
return "partial";
|
|
28
|
+
}
|
|
@@ -0,0 +1,221 @@
|
|
|
1
|
+
import { AGENT_RUNTIME_AUTH_COMPLETION_MODES, AGENT_RUNTIME_AUTH_METHOD_IDS, } from "./auth.js";
|
|
2
|
+
const BOOLEAN_CAPABILITY_PATHS = [
|
|
3
|
+
"lifecycle.persistent",
|
|
4
|
+
"lifecycle.lazyBinding",
|
|
5
|
+
"lifecycle.resume",
|
|
6
|
+
"lifecycle.attach",
|
|
7
|
+
"lifecycle.listNativeSessions",
|
|
8
|
+
"lifecycle.fork",
|
|
9
|
+
"lifecycle.clone",
|
|
10
|
+
"lifecycle.tree",
|
|
11
|
+
"input.text",
|
|
12
|
+
"input.images",
|
|
13
|
+
"input.audio",
|
|
14
|
+
"input.steering",
|
|
15
|
+
"input.structuredOutput",
|
|
16
|
+
"output.assistantDeltas",
|
|
17
|
+
"output.reasoning",
|
|
18
|
+
"output.toolEvents",
|
|
19
|
+
"output.usage",
|
|
20
|
+
"output.plans",
|
|
21
|
+
"output.diffs",
|
|
22
|
+
"output.rawNativeEvents",
|
|
23
|
+
"mcp.statusInspection",
|
|
24
|
+
"auth.status",
|
|
25
|
+
"auth.cancel",
|
|
26
|
+
"auth.logout",
|
|
27
|
+
"models.catalog",
|
|
28
|
+
"models.switchInSession",
|
|
29
|
+
"reasoning.supported",
|
|
30
|
+
"approvals.supported",
|
|
31
|
+
"approvals.structuredUserInput",
|
|
32
|
+
"maintenance.compaction",
|
|
33
|
+
"maintenance.contextUsage",
|
|
34
|
+
"maintenance.history",
|
|
35
|
+
"maintenance.health",
|
|
36
|
+
];
|
|
37
|
+
const DELIVERY_CAPABILITY_PATHS = [
|
|
38
|
+
"tools.piboManaged",
|
|
39
|
+
"tools.nativeToolInspection",
|
|
40
|
+
"tools.nativeToolYielding",
|
|
41
|
+
"mcp.externalServers",
|
|
42
|
+
"skills",
|
|
43
|
+
"context",
|
|
44
|
+
];
|
|
45
|
+
function readPath(value, path) {
|
|
46
|
+
let current = value;
|
|
47
|
+
for (const segment of path.split(".")) {
|
|
48
|
+
if (!current || typeof current !== "object" || Array.isArray(current))
|
|
49
|
+
return undefined;
|
|
50
|
+
current = current[segment];
|
|
51
|
+
}
|
|
52
|
+
return current;
|
|
53
|
+
}
|
|
54
|
+
function validateDelivery(path, value, errors) {
|
|
55
|
+
if (!value || typeof value !== "object" || Array.isArray(value)) {
|
|
56
|
+
errors.push(`${path} must be a capability-delivery object`);
|
|
57
|
+
return;
|
|
58
|
+
}
|
|
59
|
+
const delivery = value;
|
|
60
|
+
const support = delivery.support;
|
|
61
|
+
if (!["unsupported", "native", "direct", "mcp", "materialized", "degraded"].includes(String(support))) {
|
|
62
|
+
errors.push(`${path}.support is invalid`);
|
|
63
|
+
return;
|
|
64
|
+
}
|
|
65
|
+
if ((support === "unsupported" || support === "degraded") && (typeof delivery.reason !== "string" || !delivery.reason.trim())) {
|
|
66
|
+
errors.push(`${path}.reason must explain ${support} support`);
|
|
67
|
+
}
|
|
68
|
+
if (support === "degraded" && (typeof delivery.mode !== "string" || !delivery.mode.trim())) {
|
|
69
|
+
errors.push(`${path}.mode is required for degraded support`);
|
|
70
|
+
}
|
|
71
|
+
if (support === "mcp") {
|
|
72
|
+
const transports = delivery.transports;
|
|
73
|
+
if (!Array.isArray(transports) || transports.length === 0 || transports.some((item) => item !== "streamable-http" && item !== "stdio")) {
|
|
74
|
+
errors.push(`${path}.transports must contain supported MCP transports`);
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
if (support === "materialized") {
|
|
78
|
+
const modes = delivery.modes;
|
|
79
|
+
if (!Array.isArray(modes) || modes.length === 0 || modes.some((item) => typeof item !== "string" || !item.trim())) {
|
|
80
|
+
errors.push(`${path}.modes must contain at least one non-empty mode`);
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
export function validateAgentRuntimeCapabilities(value) {
|
|
85
|
+
const errors = [];
|
|
86
|
+
for (const path of BOOLEAN_CAPABILITY_PATHS) {
|
|
87
|
+
if (typeof readPath(value, path) !== "boolean")
|
|
88
|
+
errors.push(`${path} must be boolean`);
|
|
89
|
+
}
|
|
90
|
+
for (const path of DELIVERY_CAPABILITY_PATHS)
|
|
91
|
+
validateDelivery(path, readPath(value, path), errors);
|
|
92
|
+
const persistent = readPath(value, "lifecycle.persistent");
|
|
93
|
+
for (const path of ["lifecycle.resume", "lifecycle.attach"]) {
|
|
94
|
+
if (readPath(value, path) === true && persistent !== true)
|
|
95
|
+
errors.push(`${path} requires lifecycle.persistent`);
|
|
96
|
+
}
|
|
97
|
+
const reasoningSupported = readPath(value, "reasoning.supported");
|
|
98
|
+
const reasoningValues = readPath(value, "reasoning.values");
|
|
99
|
+
if (reasoningValues !== undefined) {
|
|
100
|
+
if (!Array.isArray(reasoningValues) || reasoningValues.some((item) => typeof item !== "string" || !item.trim())) {
|
|
101
|
+
errors.push("reasoning.values must be an array of non-empty strings");
|
|
102
|
+
}
|
|
103
|
+
else if (new Set(reasoningValues).size !== reasoningValues.length) {
|
|
104
|
+
errors.push("reasoning.values must not contain duplicates");
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
if (reasoningSupported === false && Array.isArray(reasoningValues) && reasoningValues.length > 0) {
|
|
108
|
+
errors.push("reasoning.values must be omitted or empty when reasoning is unsupported");
|
|
109
|
+
}
|
|
110
|
+
const authMethods = readPath(value, "auth.methods");
|
|
111
|
+
if (!Array.isArray(authMethods)) {
|
|
112
|
+
errors.push("auth.methods must be an array");
|
|
113
|
+
}
|
|
114
|
+
else {
|
|
115
|
+
const seen = new Set();
|
|
116
|
+
for (const [index, method] of authMethods.entries()) {
|
|
117
|
+
if (!method || typeof method !== "object" || Array.isArray(method)) {
|
|
118
|
+
errors.push(`auth.methods[${index}] must be an auth-method object`);
|
|
119
|
+
continue;
|
|
120
|
+
}
|
|
121
|
+
const record = method;
|
|
122
|
+
if (!AGENT_RUNTIME_AUTH_METHOD_IDS.includes(record.id)) {
|
|
123
|
+
errors.push(`auth.methods[${index}].id is invalid`);
|
|
124
|
+
}
|
|
125
|
+
else if (seen.has(String(record.id))) {
|
|
126
|
+
errors.push(`auth.methods contains duplicate method "${String(record.id)}"`);
|
|
127
|
+
}
|
|
128
|
+
else {
|
|
129
|
+
seen.add(String(record.id));
|
|
130
|
+
}
|
|
131
|
+
if (!AGENT_RUNTIME_AUTH_COMPLETION_MODES.includes(record.completion)) {
|
|
132
|
+
errors.push(`auth.methods[${index}].completion is invalid`);
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
const authScope = readPath(value, "auth.credentialScope");
|
|
137
|
+
if (authScope !== "runtime-instance" && authScope !== "adapter-shared") {
|
|
138
|
+
errors.push("auth.credentialScope must be runtime-instance or adapter-shared");
|
|
139
|
+
}
|
|
140
|
+
const authStatus = readPath(value, "auth.status");
|
|
141
|
+
if (Array.isArray(authMethods) && authMethods.length > 0 && authStatus !== true) {
|
|
142
|
+
errors.push("auth.methods requires auth.status");
|
|
143
|
+
}
|
|
144
|
+
if ((readPath(value, "auth.cancel") === true || readPath(value, "auth.logout") === true) && authStatus !== true) {
|
|
145
|
+
errors.push("auth.cancel and auth.logout require auth.status");
|
|
146
|
+
}
|
|
147
|
+
const optionsSchema = readPath(value, "models.optionsSchema");
|
|
148
|
+
if (optionsSchema !== undefined && (!optionsSchema || typeof optionsSchema !== "object" || Array.isArray(optionsSchema))) {
|
|
149
|
+
errors.push("models.optionsSchema must be a JSON Schema object");
|
|
150
|
+
}
|
|
151
|
+
return errors;
|
|
152
|
+
}
|
|
153
|
+
export function unsupportedAgentRuntimeCapability(reason) {
|
|
154
|
+
return { support: "unsupported", reason };
|
|
155
|
+
}
|
|
156
|
+
export function createMinimalAgentRuntimeCapabilities() {
|
|
157
|
+
const unavailable = unsupportedAgentRuntimeCapability("This runtime adapter does not provide this capability.");
|
|
158
|
+
return {
|
|
159
|
+
lifecycle: {
|
|
160
|
+
persistent: false,
|
|
161
|
+
lazyBinding: false,
|
|
162
|
+
resume: false,
|
|
163
|
+
attach: false,
|
|
164
|
+
listNativeSessions: false,
|
|
165
|
+
fork: false,
|
|
166
|
+
clone: false,
|
|
167
|
+
tree: false,
|
|
168
|
+
},
|
|
169
|
+
input: {
|
|
170
|
+
text: true,
|
|
171
|
+
images: false,
|
|
172
|
+
audio: false,
|
|
173
|
+
steering: false,
|
|
174
|
+
structuredOutput: false,
|
|
175
|
+
},
|
|
176
|
+
output: {
|
|
177
|
+
assistantDeltas: true,
|
|
178
|
+
reasoning: false,
|
|
179
|
+
toolEvents: false,
|
|
180
|
+
usage: false,
|
|
181
|
+
plans: false,
|
|
182
|
+
diffs: false,
|
|
183
|
+
rawNativeEvents: false,
|
|
184
|
+
},
|
|
185
|
+
tools: {
|
|
186
|
+
piboManaged: unavailable,
|
|
187
|
+
nativeToolInspection: unavailable,
|
|
188
|
+
nativeToolYielding: unavailable,
|
|
189
|
+
},
|
|
190
|
+
mcp: {
|
|
191
|
+
externalServers: unavailable,
|
|
192
|
+
statusInspection: false,
|
|
193
|
+
},
|
|
194
|
+
skills: unavailable,
|
|
195
|
+
context: unavailable,
|
|
196
|
+
auth: {
|
|
197
|
+
status: false,
|
|
198
|
+
methods: [],
|
|
199
|
+
cancel: false,
|
|
200
|
+
logout: false,
|
|
201
|
+
credentialScope: "runtime-instance",
|
|
202
|
+
},
|
|
203
|
+
models: {
|
|
204
|
+
catalog: false,
|
|
205
|
+
switchInSession: false,
|
|
206
|
+
},
|
|
207
|
+
reasoning: {
|
|
208
|
+
supported: false,
|
|
209
|
+
},
|
|
210
|
+
approvals: {
|
|
211
|
+
supported: false,
|
|
212
|
+
structuredUserInput: false,
|
|
213
|
+
},
|
|
214
|
+
maintenance: {
|
|
215
|
+
compaction: false,
|
|
216
|
+
contextUsage: false,
|
|
217
|
+
history: false,
|
|
218
|
+
health: true,
|
|
219
|
+
},
|
|
220
|
+
};
|
|
221
|
+
}
|
|
@@ -0,0 +1,313 @@
|
|
|
1
|
+
import { InitialSessionContext } from "../core/profiles.js";
|
|
2
|
+
export function profileWithRuntimeInstance(profile, runtimeInstanceId) {
|
|
3
|
+
if (profile.runtimeInstanceId === runtimeInstanceId)
|
|
4
|
+
return profile;
|
|
5
|
+
return new InitialSessionContext({
|
|
6
|
+
profileName: profile.profileName,
|
|
7
|
+
runtimeInstanceId,
|
|
8
|
+
runtimeOptions: profile.runtimeOptions,
|
|
9
|
+
sessionId: profile.sessionId,
|
|
10
|
+
parentSessionId: profile.parentSessionId,
|
|
11
|
+
model: profile.model,
|
|
12
|
+
mainModel: profile.mainModel,
|
|
13
|
+
subagentModel: profile.subagentModel,
|
|
14
|
+
thinkingLevel: profile.thinkingLevel,
|
|
15
|
+
mainThinkingLevel: profile.mainThinkingLevel,
|
|
16
|
+
subagentThinkingLevel: profile.subagentThinkingLevel,
|
|
17
|
+
fast: profile.fast,
|
|
18
|
+
mainFast: profile.mainFast,
|
|
19
|
+
subagentFast: profile.subagentFast,
|
|
20
|
+
skills: profile.skills,
|
|
21
|
+
tools: profile.tools,
|
|
22
|
+
subagents: profile.subagents,
|
|
23
|
+
mcpServers: profile.mcpServers,
|
|
24
|
+
piPackages: profile.piPackages,
|
|
25
|
+
contextFiles: profile.contextFiles,
|
|
26
|
+
builtinTools: profile.builtinTools,
|
|
27
|
+
builtinToolNames: profile.builtinToolNames,
|
|
28
|
+
autoContextFiles: profile.autoContextFiles,
|
|
29
|
+
toolPackages: profile.toolPackages,
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
export function uniqueRuntimeDiagnostics(diagnostics) {
|
|
33
|
+
const seen = new Set();
|
|
34
|
+
return diagnostics.filter((diagnostic) => {
|
|
35
|
+
const key = `${diagnostic.severity}:${diagnostic.code}:${diagnostic.message}:${diagnostic.path ?? ""}`;
|
|
36
|
+
if (seen.has(key))
|
|
37
|
+
return false;
|
|
38
|
+
seen.add(key);
|
|
39
|
+
return true;
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
export function buildPortableRuntimeContextSnapshot(input) {
|
|
43
|
+
const profile = input.profile;
|
|
44
|
+
const nodes = [];
|
|
45
|
+
const addNode = (node) => nodes.push({ ...node, order: nodes.length });
|
|
46
|
+
addNode({
|
|
47
|
+
id: "runtime",
|
|
48
|
+
kind: "metadata",
|
|
49
|
+
title: "Agent Runtime",
|
|
50
|
+
source: "runtime",
|
|
51
|
+
state: input.runtime.available ? "active" : "error",
|
|
52
|
+
badges: [input.runtime.adapterId.toUpperCase(), input.runtime.available ? "AVAILABLE" : "UNAVAILABLE"],
|
|
53
|
+
metadata: {
|
|
54
|
+
runtimeInstanceId: input.runtime.runtimeInstanceId,
|
|
55
|
+
adapterId: input.runtime.adapterId,
|
|
56
|
+
transport: input.runtime.transport,
|
|
57
|
+
bindingState: input.runtime.bindingState,
|
|
58
|
+
protocol: input.runtime.protocol?.name,
|
|
59
|
+
runtimeOptionKeys: Object.keys(profile.runtimeOptions),
|
|
60
|
+
},
|
|
61
|
+
payloadJson: input.runtime.capabilities,
|
|
62
|
+
});
|
|
63
|
+
addRuntimeContributionGroup(nodes, "tools", "Pibo Tools and Subagents", [
|
|
64
|
+
...profile.tools.filter((tool) => tool.enabled !== false).map((tool) => tool.name),
|
|
65
|
+
...profile.subagents.filter((subagent) => subagent.enabled !== false).map((subagent) => `subagent:${subagent.name} -> ${subagent.targetProfile}`),
|
|
66
|
+
...(profile.toolPackages.goalControl !== false ? ["package:pibo-goal-control"] : []),
|
|
67
|
+
...(profile.toolPackages.runControl === true ? ["package:pibo-run-control"] : []),
|
|
68
|
+
], input.runtime.capabilities.tools.piboManaged);
|
|
69
|
+
addNativeToolInspectionNode(nodes, input.runtime.capabilities.tools.nativeToolInspection);
|
|
70
|
+
if (profile.toolPackages.runControl === true) {
|
|
71
|
+
addNativeToolYieldingNode(nodes, input.runtime.capabilities.tools.nativeToolYielding);
|
|
72
|
+
}
|
|
73
|
+
if (input.resources) {
|
|
74
|
+
addRuntimeResourceGroup(nodes, "skills", "Skills", "skill", input.resources.skills.map((skill) => ({
|
|
75
|
+
id: skill.contributionId,
|
|
76
|
+
title: skill.name,
|
|
77
|
+
source: skill.kind === "builtin" ? "library" : skill.kind === "user" ? "custom" : "plugin",
|
|
78
|
+
path: skill.materializedPath ?? skill.sourcePath,
|
|
79
|
+
metadata: { kind: skill.kind },
|
|
80
|
+
})), input.resources);
|
|
81
|
+
addRuntimeResourceGroup(nodes, "context", "Context", "context_file", input.resources.context.map((contribution) => ({
|
|
82
|
+
id: contribution.id,
|
|
83
|
+
title: contribution.label,
|
|
84
|
+
source: contribution.source === "pibo-product" ? "pibo"
|
|
85
|
+
: contribution.source === "generated" ? "generated"
|
|
86
|
+
: contribution.source,
|
|
87
|
+
path: contribution.materializedPath ?? contribution.path ?? contribution.sourcePath,
|
|
88
|
+
bytes: contribution.byteSize,
|
|
89
|
+
metadata: { kind: contribution.kind, intent: contribution.intent, required: contribution.required },
|
|
90
|
+
})), input.resources);
|
|
91
|
+
addRuntimeResourceGroup(nodes, "mcp", "External MCP Servers", "runtime_extension", input.resources.mcpServers.map((server) => ({
|
|
92
|
+
id: server.contributionId,
|
|
93
|
+
title: server.name,
|
|
94
|
+
source: "profile",
|
|
95
|
+
metadata: {
|
|
96
|
+
transport: server.transport,
|
|
97
|
+
connectionStatus: server.status,
|
|
98
|
+
toolNames: server.tools.map((tool) => tool.name),
|
|
99
|
+
resourceUris: server.resources.map((resource) => resource.uri),
|
|
100
|
+
resourceTemplates: server.resourceTemplates.map((resource) => resource.uriTemplate),
|
|
101
|
+
secretEnvironmentKeys: server.secretEnvironmentKeys,
|
|
102
|
+
},
|
|
103
|
+
})), input.resources);
|
|
104
|
+
}
|
|
105
|
+
else {
|
|
106
|
+
addRuntimeContributionGroup(nodes, "skills", "Skills", profile.skills.filter((skill) => skill.enabled !== false).map((skill) => skill.name), input.runtime.capabilities.skills);
|
|
107
|
+
addRuntimeContributionGroup(nodes, "context", "Context", [
|
|
108
|
+
...(profile.autoContextFiles ? ["automatic:AGENTS.md/CLAUDE.md"] : []),
|
|
109
|
+
...profile.contextFiles.filter((file) => file.enabled !== false).map((file) => file.key ?? file.path),
|
|
110
|
+
], input.runtime.capabilities.context);
|
|
111
|
+
addRuntimeContributionGroup(nodes, "mcp", "External MCP Servers", [...profile.mcpServers], input.runtime.capabilities.mcp.externalServers);
|
|
112
|
+
}
|
|
113
|
+
if (profile.piPackages.some((pkg) => pkg.enabled !== false)) {
|
|
114
|
+
addNode({
|
|
115
|
+
id: "adapter-packages",
|
|
116
|
+
kind: "runtime_extension",
|
|
117
|
+
title: "Adapter Packages",
|
|
118
|
+
source: "profile",
|
|
119
|
+
state: input.runtime.adapterId === "pi" ? "active" : "warning",
|
|
120
|
+
badges: ["PI PACKAGES"],
|
|
121
|
+
notes: input.runtime.adapterId === "pi" ? undefined : ["Pi packages are adapter-specific and require explicit support from the selected runtime."],
|
|
122
|
+
metadata: { packages: profile.piPackages.filter((pkg) => pkg.enabled !== false).map((pkg) => pkg.id) },
|
|
123
|
+
});
|
|
124
|
+
}
|
|
125
|
+
addNode({
|
|
126
|
+
id: "model-options",
|
|
127
|
+
kind: "metadata",
|
|
128
|
+
title: "Model and Runtime Options",
|
|
129
|
+
source: "profile",
|
|
130
|
+
state: "active",
|
|
131
|
+
metadata: {
|
|
132
|
+
activeModel: input.activeModel,
|
|
133
|
+
mainModel: profile.mainModel,
|
|
134
|
+
subagentModel: profile.subagentModel,
|
|
135
|
+
mainThinkingLevel: profile.mainThinkingLevel ?? profile.thinkingLevel,
|
|
136
|
+
subagentThinkingLevel: profile.subagentThinkingLevel ?? profile.thinkingLevel,
|
|
137
|
+
mainFast: profile.mainFast ?? profile.fast,
|
|
138
|
+
subagentFast: profile.subagentFast ?? profile.fast,
|
|
139
|
+
builtinTools: profile.builtinTools,
|
|
140
|
+
builtinToolNames: profile.builtinToolNames,
|
|
141
|
+
},
|
|
142
|
+
});
|
|
143
|
+
for (const [index, diagnostic] of input.runtime.diagnostics.entries()) {
|
|
144
|
+
addNode({
|
|
145
|
+
id: `runtime-diagnostic-${index}`,
|
|
146
|
+
kind: "diagnostic",
|
|
147
|
+
title: diagnostic.code,
|
|
148
|
+
source: "runtime",
|
|
149
|
+
state: diagnostic.severity === "error" ? "error" : diagnostic.severity === "warning" ? "warning" : "active",
|
|
150
|
+
badges: [diagnostic.severity.toUpperCase()],
|
|
151
|
+
hydratedText: diagnostic.message,
|
|
152
|
+
metadata: diagnostic.path ? { path: diagnostic.path } : undefined,
|
|
153
|
+
});
|
|
154
|
+
}
|
|
155
|
+
for (const [index, diagnostic] of (input.resources?.diagnostics ?? []).entries()) {
|
|
156
|
+
addNode({
|
|
157
|
+
id: `resource-diagnostic-${index}`,
|
|
158
|
+
kind: "diagnostic",
|
|
159
|
+
title: diagnostic.code,
|
|
160
|
+
source: "runtime",
|
|
161
|
+
state: diagnostic.severity === "error" ? "error" : diagnostic.severity === "warning" ? "warning" : "active",
|
|
162
|
+
badges: [diagnostic.severity.toUpperCase(), "RESOURCE"],
|
|
163
|
+
hydratedText: diagnostic.message,
|
|
164
|
+
metadata: diagnostic.contributionId ? { contributionId: diagnostic.contributionId } : undefined,
|
|
165
|
+
});
|
|
166
|
+
}
|
|
167
|
+
const resourceDiagnostics = input.resources?.diagnostics ?? [];
|
|
168
|
+
const warnings = input.runtime.diagnostics.filter((diagnostic) => diagnostic.severity === "warning").length
|
|
169
|
+
+ resourceDiagnostics.filter((diagnostic) => diagnostic.severity === "warning").length;
|
|
170
|
+
const errors = input.runtime.diagnostics.filter((diagnostic) => diagnostic.severity === "error").length
|
|
171
|
+
+ resourceDiagnostics.filter((diagnostic) => diagnostic.severity === "error").length;
|
|
172
|
+
return {
|
|
173
|
+
version: 1,
|
|
174
|
+
generatedAt: new Date().toISOString(),
|
|
175
|
+
profileName: profile.profileName,
|
|
176
|
+
piboSessionId: input.piboSessionId,
|
|
177
|
+
piboRoomId: input.piboRoomId,
|
|
178
|
+
cwd: input.cwd,
|
|
179
|
+
activeModel: input.activeModel,
|
|
180
|
+
runtime: input.runtime,
|
|
181
|
+
summary: {
|
|
182
|
+
topLevelNodes: nodes.length,
|
|
183
|
+
totalNodes: nodes.reduce((count, node) => count + 1 + (node.children?.length ?? 0), 0),
|
|
184
|
+
estimatedTokens: 0,
|
|
185
|
+
warnings,
|
|
186
|
+
errors,
|
|
187
|
+
},
|
|
188
|
+
nodes,
|
|
189
|
+
diagnostics: [
|
|
190
|
+
...input.runtime.diagnostics.map((diagnostic) => ({ type: diagnostic.severity, message: diagnostic.message })),
|
|
191
|
+
...resourceDiagnostics.map((diagnostic) => ({ type: diagnostic.severity, message: diagnostic.message })),
|
|
192
|
+
],
|
|
193
|
+
};
|
|
194
|
+
}
|
|
195
|
+
function addNativeToolInspectionNode(nodes, delivery) {
|
|
196
|
+
const supported = delivery.support !== "unsupported";
|
|
197
|
+
const mode = runtimeDeliveryMode(delivery);
|
|
198
|
+
const reason = delivery.support === "unsupported" || delivery.support === "degraded" ? delivery.reason : undefined;
|
|
199
|
+
nodes.push({
|
|
200
|
+
id: "tools/native-inspection",
|
|
201
|
+
order: nodes.length,
|
|
202
|
+
kind: "runtime_extension",
|
|
203
|
+
title: "Harness-Native Tool Inspection",
|
|
204
|
+
source: "runtime",
|
|
205
|
+
state: supported ? delivery.support === "degraded" ? "warning" : "active" : "warning",
|
|
206
|
+
badges: [mode.toUpperCase()],
|
|
207
|
+
metadata: { deliveryMode: mode },
|
|
208
|
+
notes: [
|
|
209
|
+
"Harness-native tools remain owned and executed by the selected runtime.",
|
|
210
|
+
...(reason ? [reason] : []),
|
|
211
|
+
],
|
|
212
|
+
});
|
|
213
|
+
}
|
|
214
|
+
function addNativeToolYieldingNode(nodes, delivery) {
|
|
215
|
+
const supported = delivery.support !== "unsupported";
|
|
216
|
+
const mode = runtimeDeliveryMode(delivery);
|
|
217
|
+
const reason = delivery.support === "unsupported" || delivery.support === "degraded" ? delivery.reason : undefined;
|
|
218
|
+
nodes.push({
|
|
219
|
+
id: "tools/native-yielding",
|
|
220
|
+
order: nodes.length,
|
|
221
|
+
kind: "runtime_extension",
|
|
222
|
+
title: "Private Harness-Native Tool Yielding",
|
|
223
|
+
source: "runtime",
|
|
224
|
+
state: supported ? delivery.support === "degraded" ? "warning" : "active" : "warning",
|
|
225
|
+
badges: [mode.toUpperCase()],
|
|
226
|
+
metadata: { deliveryMode: mode, piboManagedToolYieldingUnaffected: true },
|
|
227
|
+
notes: [
|
|
228
|
+
"pibo_run_start can always wrap selected Pibo-managed tools when Pibo tool delivery is supported.",
|
|
229
|
+
...(reason ? [reason] : []),
|
|
230
|
+
],
|
|
231
|
+
});
|
|
232
|
+
}
|
|
233
|
+
function addRuntimeResourceGroup(nodes, id, title, kind, items, resources) {
|
|
234
|
+
const reports = new Map(resources.delivery.map((report) => [report.contributionId, report]));
|
|
235
|
+
const children = items.map((item, index) => {
|
|
236
|
+
const report = reports.get(item.id);
|
|
237
|
+
const status = report?.status ?? "failed";
|
|
238
|
+
return {
|
|
239
|
+
id: `${id}/${index}`,
|
|
240
|
+
parentId: id,
|
|
241
|
+
order: index,
|
|
242
|
+
kind,
|
|
243
|
+
title: item.title,
|
|
244
|
+
source: item.source ?? "profile",
|
|
245
|
+
state: status === "failed" || status === "unsupported"
|
|
246
|
+
? "error"
|
|
247
|
+
: status === "degraded"
|
|
248
|
+
? "warning"
|
|
249
|
+
: "active",
|
|
250
|
+
badges: [status.toUpperCase(), ...(report ? [report.mode.toUpperCase(), report.fidelity.toUpperCase()] : [])],
|
|
251
|
+
...(item.path ? { path: item.path } : {}),
|
|
252
|
+
...(item.bytes !== undefined ? { bytes: item.bytes } : {}),
|
|
253
|
+
metadata: {
|
|
254
|
+
...item.metadata,
|
|
255
|
+
contributionId: item.id,
|
|
256
|
+
deliveryStatus: status,
|
|
257
|
+
deliveryMode: report?.mode,
|
|
258
|
+
fidelity: report?.fidelity,
|
|
259
|
+
target: report?.target,
|
|
260
|
+
},
|
|
261
|
+
notes: report?.diagnostic ? [report.diagnostic] : undefined,
|
|
262
|
+
};
|
|
263
|
+
});
|
|
264
|
+
const hasError = children.some((child) => child.state === "error");
|
|
265
|
+
const hasWarning = children.some((child) => child.state === "warning");
|
|
266
|
+
nodes.push({
|
|
267
|
+
id,
|
|
268
|
+
order: nodes.length,
|
|
269
|
+
kind: id === "skills" ? "skills" : id === "context" ? "context_files" : "runtime_extension",
|
|
270
|
+
title,
|
|
271
|
+
source: "profile",
|
|
272
|
+
state: hasError ? "error" : hasWarning ? "warning" : children.length > 0 ? "active" : "disabled",
|
|
273
|
+
badges: [hasError ? "FAILED" : hasWarning ? "DEGRADED" : children.length > 0 ? "DELIVERED" : "EMPTY"],
|
|
274
|
+
metadata: { selectedCount: children.length, sessionGeneration: resources.sessionGeneration },
|
|
275
|
+
children,
|
|
276
|
+
});
|
|
277
|
+
}
|
|
278
|
+
function addRuntimeContributionGroup(nodes, id, title, items, delivery) {
|
|
279
|
+
const state = delivery.support === "unsupported" ? "error" : delivery.support === "degraded" ? "warning" : items.length > 0 ? "active" : "disabled";
|
|
280
|
+
const reason = delivery.support === "unsupported" || delivery.support === "degraded" ? delivery.reason : undefined;
|
|
281
|
+
const mode = runtimeDeliveryMode(delivery);
|
|
282
|
+
nodes.push({
|
|
283
|
+
id,
|
|
284
|
+
order: nodes.length,
|
|
285
|
+
kind: id === "tools" ? "tool_surface" : id === "skills" ? "skills" : id === "context" ? "context_files" : "runtime_extension",
|
|
286
|
+
title,
|
|
287
|
+
source: "profile",
|
|
288
|
+
state,
|
|
289
|
+
badges: [mode.toUpperCase()],
|
|
290
|
+
metadata: { deliveryMode: mode, selectedCount: items.length },
|
|
291
|
+
notes: reason ? [reason] : undefined,
|
|
292
|
+
children: items.map((item, index) => ({
|
|
293
|
+
id: `${id}/${index}`,
|
|
294
|
+
parentId: id,
|
|
295
|
+
order: index,
|
|
296
|
+
kind: id === "tools" ? "tool" : id === "skills" ? "skill" : id === "context" ? "context_file" : "runtime_extension",
|
|
297
|
+
title: item,
|
|
298
|
+
source: "profile",
|
|
299
|
+
state: delivery.support === "unsupported" ? "error" : delivery.support === "degraded" ? "warning" : "active",
|
|
300
|
+
badges: [mode.toUpperCase()],
|
|
301
|
+
notes: reason ? [reason] : undefined,
|
|
302
|
+
})),
|
|
303
|
+
});
|
|
304
|
+
}
|
|
305
|
+
function runtimeDeliveryMode(delivery) {
|
|
306
|
+
if (delivery.support === "mcp")
|
|
307
|
+
return `mcp:${delivery.transports.join(",")}`;
|
|
308
|
+
if (delivery.support === "materialized")
|
|
309
|
+
return `materialized:${delivery.modes.join(",")}`;
|
|
310
|
+
if (delivery.support === "degraded")
|
|
311
|
+
return `degraded:${delivery.mode}`;
|
|
312
|
+
return delivery.support;
|
|
313
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { AgentRuntimeContractError } from "./errors.js";
|
|
2
|
+
export function validateAgentRuntimeSessionContract(session) {
|
|
3
|
+
const errors = [];
|
|
4
|
+
const capabilities = session.capabilities;
|
|
5
|
+
const controls = session.controls;
|
|
6
|
+
const requireMethod = (enabled, path, method) => {
|
|
7
|
+
if (enabled && typeof controls?.[method] !== "function") {
|
|
8
|
+
errors.push(`${path} requires controls.${String(method)}()`);
|
|
9
|
+
}
|
|
10
|
+
};
|
|
11
|
+
if (capabilities.input.steering && typeof session.steer !== "function") {
|
|
12
|
+
errors.push("input.steering requires session.steer()");
|
|
13
|
+
}
|
|
14
|
+
requireMethod(capabilities.lifecycle.listNativeSessions, "lifecycle.listNativeSessions", "listSessions");
|
|
15
|
+
requireMethod(capabilities.lifecycle.fork, "lifecycle.fork", "forkSession");
|
|
16
|
+
requireMethod(capabilities.lifecycle.clone, "lifecycle.clone", "cloneSession");
|
|
17
|
+
requireMethod(capabilities.lifecycle.tree, "lifecycle.tree", "getSessionTree");
|
|
18
|
+
requireMethod(capabilities.lifecycle.tree, "lifecycle.tree", "navigateSessionTree");
|
|
19
|
+
requireMethod(capabilities.models.switchInSession, "models.switchInSession", "setModel");
|
|
20
|
+
requireMethod(capabilities.reasoning.supported, "reasoning.supported", "getReasoning");
|
|
21
|
+
requireMethod(capabilities.reasoning.supported, "reasoning.supported", "setReasoning");
|
|
22
|
+
requireMethod(capabilities.approvals.supported, "approvals.supported", "respondToApproval");
|
|
23
|
+
requireMethod(capabilities.approvals.structuredUserInput, "approvals.structuredUserInput", "respondToUserInput");
|
|
24
|
+
requireMethod(capabilities.maintenance.compaction, "maintenance.compaction", "compact");
|
|
25
|
+
const binding = session.getBinding();
|
|
26
|
+
if (binding.adapterId !== session.adapterId) {
|
|
27
|
+
errors.push(`binding.adapterId "${binding.adapterId}" does not match session.adapterId "${session.adapterId}"`);
|
|
28
|
+
}
|
|
29
|
+
if (binding.runtimeInstanceId !== session.runtimeInstanceId) {
|
|
30
|
+
errors.push(`binding.runtimeInstanceId "${binding.runtimeInstanceId}" does not match session.runtimeInstanceId "${session.runtimeInstanceId}"`);
|
|
31
|
+
}
|
|
32
|
+
if (binding.state === "bound" && !binding.nativeSessionId) {
|
|
33
|
+
errors.push("a bound session requires binding.nativeSessionId");
|
|
34
|
+
}
|
|
35
|
+
if (binding.state === "unbound" && binding.nativeSessionId) {
|
|
36
|
+
errors.push("an unbound session must not expose binding.nativeSessionId");
|
|
37
|
+
}
|
|
38
|
+
return errors;
|
|
39
|
+
}
|
|
40
|
+
export function assertAgentRuntimeSessionContract(session) {
|
|
41
|
+
const errors = validateAgentRuntimeSessionContract(session);
|
|
42
|
+
if (errors.length > 0) {
|
|
43
|
+
throw new AgentRuntimeContractError(session.runtimeInstanceId, `Agent runtime session contract failed: ${errors.join("; ")}`);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
export class AgentRuntimeRegistrationError extends Error {
|
|
2
|
+
constructor(message, options) {
|
|
3
|
+
super(message, options);
|
|
4
|
+
this.name = "AgentRuntimeRegistrationError";
|
|
5
|
+
}
|
|
6
|
+
}
|
|
7
|
+
export class AgentRuntimeContractError extends Error {
|
|
8
|
+
runtimeInstanceId;
|
|
9
|
+
constructor(runtimeInstanceId, message, options) {
|
|
10
|
+
super(message, options);
|
|
11
|
+
this.runtimeInstanceId = runtimeInstanceId;
|
|
12
|
+
this.name = "AgentRuntimeContractError";
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
export class AgentRuntimeUnavailableError extends Error {
|
|
16
|
+
runtimeInstanceId;
|
|
17
|
+
constructor(runtimeInstanceId, message = `Agent runtime instance "${runtimeInstanceId}" is unavailable.`, options) {
|
|
18
|
+
super(message, options);
|
|
19
|
+
this.runtimeInstanceId = runtimeInstanceId;
|
|
20
|
+
this.name = "AgentRuntimeUnavailableError";
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
export class AgentRuntimeCapabilityUnavailableError extends Error {
|
|
24
|
+
capability;
|
|
25
|
+
runtimeInstanceId;
|
|
26
|
+
constructor(capability, runtimeInstanceId, reason, options) {
|
|
27
|
+
super(reason
|
|
28
|
+
?? (runtimeInstanceId
|
|
29
|
+
? `Agent runtime instance "${runtimeInstanceId}" does not support ${capability}.`
|
|
30
|
+
: `The active agent runtime does not support ${capability}.`), options);
|
|
31
|
+
this.capability = capability;
|
|
32
|
+
this.runtimeInstanceId = runtimeInstanceId;
|
|
33
|
+
this.name = "AgentRuntimeCapabilityUnavailableError";
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
export class AgentRuntimeAuthError extends Error {
|
|
37
|
+
code;
|
|
38
|
+
retryable;
|
|
39
|
+
constructor(code, message, retryable = false, options) {
|
|
40
|
+
super(message, options);
|
|
41
|
+
this.code = code;
|
|
42
|
+
this.retryable = retryable;
|
|
43
|
+
this.name = "AgentRuntimeAuthError";
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
export class AgentRuntimeBindingMissingError extends Error {
|
|
47
|
+
piboSessionId;
|
|
48
|
+
runtimeInstanceId;
|
|
49
|
+
nativeSessionId;
|
|
50
|
+
constructor(piboSessionId, runtimeInstanceId, nativeSessionId, options) {
|
|
51
|
+
super(`The native session${nativeSessionId ? ` "${nativeSessionId}"` : ""} for Pibo session "${piboSessionId}" is missing from runtime instance "${runtimeInstanceId}".`, options);
|
|
52
|
+
this.piboSessionId = piboSessionId;
|
|
53
|
+
this.runtimeInstanceId = runtimeInstanceId;
|
|
54
|
+
this.nativeSessionId = nativeSessionId;
|
|
55
|
+
this.name = "AgentRuntimeBindingMissingError";
|
|
56
|
+
}
|
|
57
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|