@hachej/boring-agent 0.1.80 → 0.1.81
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/{chunk-N4ES6PVX.js → chunk-24VL7G32.js} +9 -2
- package/dist/{chunk-BNZIE26N.js → chunk-2AVRA73A.js} +1 -1
- package/dist/{chunk-UJQXCOHR.js → chunk-3RSYCAHO.js} +1 -1
- package/dist/{chunk-URRIDA6O.js → chunk-I7JNWIYM.js} +41 -17
- package/dist/{chunk-CUF7ELFO.js → chunk-S2HYQYJP.js} +1 -1
- package/dist/{chunk-CCNXYCD5.js → chunk-YV6D7GCQ.js} +7 -0
- package/dist/core/index.d.ts +3 -3
- package/dist/core/index.js +2 -2
- package/dist/{createHarness-EEA63XRC.js → createHarness-4VZW2XEV.js} +2 -2
- package/dist/front/index.d.ts +1 -1
- package/dist/front/index.js +2 -2
- package/dist/{harness-BZW5Jiy3.d.ts → harness-If4r1n-K.d.ts} +1 -1
- package/dist/{piChatEvent-CpoTZau1.d.ts → piChatEvent-DtqYMcID.d.ts} +10 -1
- package/dist/server/index.d.ts +13 -5
- package/dist/server/index.js +8 -6
- package/dist/server/worker/index.js +6 -6
- package/dist/shared/index.d.ts +267 -7
- package/dist/shared/index.js +169 -3
- package/dist/{workspaceAgentDispatcher-Wi6NIh2G.d.ts → workspaceAgentDispatcher-BbNd3y7u.d.ts} +3 -3
- package/package.json +2 -2
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
} from "./chunk-AQBXNPMD.js";
|
|
5
5
|
import {
|
|
6
6
|
ErrorCode
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-YV6D7GCQ.js";
|
|
8
8
|
|
|
9
9
|
// src/server/harness/pi-coding-agent/createHarness.ts
|
|
10
10
|
import { AsyncLocalStorage } from "async_hooks";
|
|
@@ -1201,7 +1201,14 @@ function readApiKeyEnv(candidates) {
|
|
|
1201
1201
|
function buildOpenAICompatibleProviderConfig(opts) {
|
|
1202
1202
|
return {
|
|
1203
1203
|
baseUrl: opts.baseUrl,
|
|
1204
|
-
|
|
1204
|
+
// pi-coding-agent's resolveConfigValue (packages/agent's pinned
|
|
1205
|
+
// @mariozechner/pi-coding-agent@0.75.5) resolves a provider apiKey by
|
|
1206
|
+
// looking up `process.env[config]` directly — it does NOT strip a `$`
|
|
1207
|
+
// prefix. A `$`-prefixed value (e.g. "$INFOMANIAK_API_TOKEN") misses the
|
|
1208
|
+
// env lookup and falls back to sending the literal string as the Bearer
|
|
1209
|
+
// token, causing provider 401s. The supported syntax is the bare env var
|
|
1210
|
+
// name.
|
|
1211
|
+
apiKey: opts.apiKeyEnv,
|
|
1205
1212
|
api: "openai-completions",
|
|
1206
1213
|
models: opts.models.map((model) => ({
|
|
1207
1214
|
id: model.id,
|
|
@@ -9,10 +9,10 @@ import {
|
|
|
9
9
|
validateAgentDefinition,
|
|
10
10
|
validateAgentDeployment,
|
|
11
11
|
validateTool
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-S2HYQYJP.js";
|
|
13
13
|
import {
|
|
14
14
|
createAgentRuntimeBridge
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-2AVRA73A.js";
|
|
16
16
|
import {
|
|
17
17
|
sessionStreamPath
|
|
18
18
|
} from "./chunk-WSQ5QNIY.js";
|
|
@@ -27,7 +27,7 @@ import {
|
|
|
27
27
|
StopReceiptSchema,
|
|
28
28
|
extractToolUiMetadata,
|
|
29
29
|
sanitizeToolUiMetadata2 as sanitizeToolUiMetadata
|
|
30
|
-
} from "./chunk-
|
|
30
|
+
} from "./chunk-3RSYCAHO.js";
|
|
31
31
|
import {
|
|
32
32
|
createLogger,
|
|
33
33
|
createPiCodingAgentHarness,
|
|
@@ -38,7 +38,7 @@ import {
|
|
|
38
38
|
registerConfiguredModelProviders,
|
|
39
39
|
setEnvDefault,
|
|
40
40
|
withPiHarnessDefaults
|
|
41
|
-
} from "./chunk-
|
|
41
|
+
} from "./chunk-24VL7G32.js";
|
|
42
42
|
import {
|
|
43
43
|
safeCapture
|
|
44
44
|
} from "./chunk-AQBXNPMD.js";
|
|
@@ -46,7 +46,7 @@ import {
|
|
|
46
46
|
AgentDefinitionErrorCode,
|
|
47
47
|
AgentDeploymentErrorCode,
|
|
48
48
|
ErrorCode
|
|
49
|
-
} from "./chunk-
|
|
49
|
+
} from "./chunk-YV6D7GCQ.js";
|
|
50
50
|
|
|
51
51
|
// src/server/sandbox/direct/createDirectSandbox.ts
|
|
52
52
|
import { spawn } from "child_process";
|
|
@@ -8457,7 +8457,7 @@ function createAgentRuntimeBridge2(config, options = {}) {
|
|
|
8457
8457
|
});
|
|
8458
8458
|
}
|
|
8459
8459
|
async function createRuntime(config, options) {
|
|
8460
|
-
const harnessFactory = config.harnessFactory ?? (await import("./createHarness-
|
|
8460
|
+
const harnessFactory = config.harnessFactory ?? (await import("./createHarness-4VZW2XEV.js")).createPiCodingAgentHarness;
|
|
8461
8461
|
const harnessInput = {
|
|
8462
8462
|
tools: config.tools ?? [],
|
|
8463
8463
|
cwd: config.workdir ?? DEFAULT_WORKDIR,
|
|
@@ -8717,6 +8717,22 @@ var AuthorizedAgentDeploymentBindingSchema = z.object({
|
|
|
8717
8717
|
workspaceCompositionDigest: Sha256DigestSchema
|
|
8718
8718
|
});
|
|
8719
8719
|
var RESOLVED_AGENT_DIGEST_DOMAIN = "boring-agent/resolved-agent:v1";
|
|
8720
|
+
var ResolvedAgentDigestInputSchema = z.object({
|
|
8721
|
+
workspaceId: OpaqueRefSchema,
|
|
8722
|
+
defaultDeploymentId: OpaqueRefSchema,
|
|
8723
|
+
workspaceCompositionDigest: Sha256DigestSchema,
|
|
8724
|
+
definitionDigest: Sha256DigestSchema,
|
|
8725
|
+
deploymentDigest: Sha256DigestSchema
|
|
8726
|
+
}).strict();
|
|
8727
|
+
async function createResolvedAgentDigest(input) {
|
|
8728
|
+
const parsed = ResolvedAgentDigestInputSchema.safeParse(input);
|
|
8729
|
+
if (!parsed.success) {
|
|
8730
|
+
const field = parsed.error.issues[0]?.path[0];
|
|
8731
|
+
const digestField = typeof field === "string" ? field : "workspaceId";
|
|
8732
|
+
throw invalidDeployment(digestField, `${digestField} is invalid`);
|
|
8733
|
+
}
|
|
8734
|
+
return createAgentAssetDigest(JSON.stringify({ domain: RESOLVED_AGENT_DIGEST_DOMAIN, ...parsed.data }));
|
|
8735
|
+
}
|
|
8720
8736
|
function invalidDefinition(field, message) {
|
|
8721
8737
|
return new AgentDefinitionValidationError({
|
|
8722
8738
|
code: AgentDefinitionErrorCode.enum.AGENT_DEFINITION_INVALID,
|
|
@@ -8791,14 +8807,13 @@ async function resolveAgentDeployment(bundle, deployment, authorizedBinding) {
|
|
|
8791
8807
|
"instructionsRef must name an included verified asset"
|
|
8792
8808
|
);
|
|
8793
8809
|
}
|
|
8794
|
-
const resolvedDigest = await
|
|
8795
|
-
domain: RESOLVED_AGENT_DIGEST_DOMAIN,
|
|
8810
|
+
const resolvedDigest = await createResolvedAgentDigest({
|
|
8796
8811
|
workspaceId: binding.workspaceId,
|
|
8797
8812
|
defaultDeploymentId: binding.defaultDeploymentId,
|
|
8798
8813
|
workspaceCompositionDigest: binding.workspaceCompositionDigest,
|
|
8799
8814
|
definitionDigest,
|
|
8800
8815
|
deploymentDigest
|
|
8801
|
-
})
|
|
8816
|
+
});
|
|
8802
8817
|
const workspace = Object.freeze({
|
|
8803
8818
|
workspaceId: binding.workspaceId,
|
|
8804
8819
|
defaultDeploymentId: binding.defaultDeploymentId,
|
|
@@ -11723,7 +11738,9 @@ function pathForWorkspaceEditor(workspaceRoot, filePath) {
|
|
|
11723
11738
|
function skillsRoutes(app, opts, done) {
|
|
11724
11739
|
const cached = /* @__PURE__ */ new Map();
|
|
11725
11740
|
async function resolveSkillsForRequest(request, refresh = false) {
|
|
11726
|
-
const
|
|
11741
|
+
const workspace = opts.getWorkspace ? await opts.getWorkspace(request) : opts.workspace;
|
|
11742
|
+
if (!workspace) throw new Error("skills route requires workspace or getWorkspace");
|
|
11743
|
+
const workspaceRoot = workspace.root;
|
|
11727
11744
|
const additionalSkillPaths = opts.getAdditionalSkillPaths ? await opts.getAdditionalSkillPaths(request) : opts.additionalSkillPaths;
|
|
11728
11745
|
const piPackages = opts.getPiPackages ? await opts.getPiPackages(request) : opts.piPackages;
|
|
11729
11746
|
const noSkills = (opts.getNoSkills ? await opts.getNoSkills(request) : opts.noSkills) ?? withPiHarnessDefaults().noSkills;
|
|
@@ -12598,8 +12615,8 @@ function requirePath(value, reply) {
|
|
|
12598
12615
|
}
|
|
12599
12616
|
function gitRoutes(app, opts, done) {
|
|
12600
12617
|
async function resolveWorkspaceRoot(request) {
|
|
12601
|
-
|
|
12602
|
-
return
|
|
12618
|
+
const workspace = opts.getWorkspace ? await opts.getWorkspace(request) : opts.workspace;
|
|
12619
|
+
return workspace === void 0 ? void 0 : getNodeWorkspaceHostRoot(workspace);
|
|
12603
12620
|
}
|
|
12604
12621
|
app.get("/api/v1/git/file-url", async (request, reply) => {
|
|
12605
12622
|
const query = request.query;
|
|
@@ -13038,6 +13055,8 @@ async function createWorkspaceAgentAppProfile(opts, sessionId, resolvedMode, app
|
|
|
13038
13055
|
requestId: request.id
|
|
13039
13056
|
});
|
|
13040
13057
|
} : void 0;
|
|
13058
|
+
const gitStorageRoot = getOptionalRuntimeBundleStorageRoot(runtimeBundle);
|
|
13059
|
+
const gitWorkspace = gitStorageRoot === void 0 ? runtimeBundle.workspace : createNodeWorkspace(gitStorageRoot);
|
|
13041
13060
|
return {
|
|
13042
13061
|
runtimeMode: resolvedMode,
|
|
13043
13062
|
capabilities: { tools: toolNames(tools) },
|
|
@@ -13061,12 +13080,12 @@ async function createWorkspaceAgentAppProfile(opts, sessionId, resolvedMode, app
|
|
|
13061
13080
|
// File search shares the same bound implementation as the model tool.
|
|
13062
13081
|
search: { fileSearch: runtimeBundle.fileSearch },
|
|
13063
13082
|
// Git metadata resolves against host storage, not a sandbox-internal cwd.
|
|
13064
|
-
git: {
|
|
13083
|
+
git: { workspace: gitWorkspace }
|
|
13065
13084
|
},
|
|
13066
13085
|
chat: { service: agentRuntime.service },
|
|
13067
13086
|
systemPrompt: { harness },
|
|
13068
13087
|
skills: {
|
|
13069
|
-
workspaceRoot,
|
|
13088
|
+
workspace: createNodeWorkspace(workspaceRoot),
|
|
13070
13089
|
additionalSkillPaths: runtimePi.additionalSkillPaths,
|
|
13071
13090
|
piPackages: runtimePi.packages,
|
|
13072
13091
|
noSkills: runtimePi.noSkills,
|
|
@@ -14331,7 +14350,11 @@ var registerAgentRoutes = async (app, opts) => {
|
|
|
14331
14350
|
getFileSearch: async (request) => (await getBindingForRequest(request)).runtimeBundle.fileSearch
|
|
14332
14351
|
});
|
|
14333
14352
|
await app.register(gitRoutes, {
|
|
14334
|
-
|
|
14353
|
+
getWorkspace: async (request) => {
|
|
14354
|
+
const runtimeBundle = (await getBindingForRequest(request)).runtimeBundle;
|
|
14355
|
+
const storageRoot = getOptionalRuntimeBundleStorageRoot(runtimeBundle);
|
|
14356
|
+
return storageRoot === void 0 ? runtimeBundle.workspace : createNodeWorkspace(storageRoot);
|
|
14357
|
+
}
|
|
14335
14358
|
});
|
|
14336
14359
|
await app.register(piChatRoutes, {
|
|
14337
14360
|
getService: async (request) => {
|
|
@@ -14347,7 +14370,7 @@ var registerAgentRoutes = async (app, opts) => {
|
|
|
14347
14370
|
filterModels: opts.filterModels
|
|
14348
14371
|
});
|
|
14349
14372
|
await app.register(skillsRoutes, {
|
|
14350
|
-
workspaceRoot,
|
|
14373
|
+
workspace: staticBinding ? createNodeWorkspace(workspaceRoot) : void 0,
|
|
14351
14374
|
additionalSkillPaths: [
|
|
14352
14375
|
...staticBinding?.runtimeProvisioning?.skillPaths ?? [],
|
|
14353
14376
|
...opts.pi?.additionalSkillPaths ?? []
|
|
@@ -14356,7 +14379,7 @@ var registerAgentRoutes = async (app, opts) => {
|
|
|
14356
14379
|
// Undefined is fine: skillsRoutes resolves it through the canonical
|
|
14357
14380
|
// harness policy (withPiHarnessDefaults), same as the factory above.
|
|
14358
14381
|
noSkills: opts.pi?.noSkills,
|
|
14359
|
-
|
|
14382
|
+
getWorkspace: staticBinding ? void 0 : async (request) => createNodeWorkspace((await getSkillsScopeForRequest(request)).root),
|
|
14360
14383
|
getAdditionalSkillPaths: staticBinding && !hasRuntimeProvisioningInput ? void 0 : async (request) => {
|
|
14361
14384
|
const scope = await getSkillsScopeForRequest(request);
|
|
14362
14385
|
if (!hasRuntimeProvisioningInput) return scope.pi.additionalSkillPaths;
|
|
@@ -14488,6 +14511,7 @@ export {
|
|
|
14488
14511
|
createAgent,
|
|
14489
14512
|
AgentDirectoryCompilerError,
|
|
14490
14513
|
compileAgentDirectory,
|
|
14514
|
+
createResolvedAgentDigest,
|
|
14491
14515
|
resolveAgentDeployment,
|
|
14492
14516
|
MANAGED_AGENT_MCP_ORIGIN_SURFACE,
|
|
14493
14517
|
MANAGED_AGENT_MCP_DELIVERY_RULE,
|
|
@@ -85,6 +85,12 @@ var AgentDeploymentErrorCode = z.enum([
|
|
|
85
85
|
"AGENT_DEPLOYMENT_INVALID",
|
|
86
86
|
"AGENT_DEPLOYMENT_UNSUPPORTED_FIELD"
|
|
87
87
|
]);
|
|
88
|
+
var AgentConsumptionErrorCode = z.enum([
|
|
89
|
+
"AGENT_CONSUMPTION_INVALID_TRANSITION",
|
|
90
|
+
"AGENT_CONSUMPTION_CYCLE_DETECTED",
|
|
91
|
+
"AGENT_CONSUMPTION_DEPTH_EXCEEDED",
|
|
92
|
+
"AGENT_CONSUMPTION_SCHEMA_MISMATCH"
|
|
93
|
+
]);
|
|
88
94
|
var ApiErrorPayloadSchema = z.object({
|
|
89
95
|
code: ErrorCode,
|
|
90
96
|
message: z.string().min(1),
|
|
@@ -105,6 +111,7 @@ export {
|
|
|
105
111
|
ERROR_CODES,
|
|
106
112
|
AgentDefinitionErrorCode,
|
|
107
113
|
AgentDeploymentErrorCode,
|
|
114
|
+
AgentConsumptionErrorCode,
|
|
108
115
|
ApiErrorPayloadSchema,
|
|
109
116
|
ApiErrorResponseSchema,
|
|
110
117
|
ErrorLogFieldsSchema
|
package/dist/core/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { A as AgentHarness, a as AgentReadiness, b as Agent } from '../harness-
|
|
2
|
-
export { c as AGENT_NOT_IMPLEMENTED_UNTIL_T1, d as AgentActor, e as AgentCoreHarness, f as AgentCoreHarnessFactory, g as AgentCorePromptInput, h as AgentCoreSessionAdapter, i as AgentCoreSessionSnapshot, j as AgentEvent, k as AgentMessageContent, l as AgentMessagePart, m as AgentNotImplementedError, n as AgentReadinessStatus, o as AgentResolveInputResponse, p as AgentSendInput, q as AgentStartReceipt, r as AgentStreamOptions } from '../harness-
|
|
3
|
-
import { S as SessionListOptions, a as SessionSummary, C as ChatModelSelection, P as PiChatSnapshot, b as PiChatEvent, c as PromptPayload, d as PromptReceipt, F as FollowUpPayload, e as FollowUpReceipt, Q as QueueClearPayload, f as QueueClearReceipt, I as InterruptPayload, g as CommandReceipt, h as StopPayload, i as StopReceipt, j as SessionStore } from '../piChatEvent-
|
|
1
|
+
import { A as AgentHarness, a as AgentReadiness, b as Agent } from '../harness-If4r1n-K.js';
|
|
2
|
+
export { c as AGENT_NOT_IMPLEMENTED_UNTIL_T1, d as AgentActor, e as AgentCoreHarness, f as AgentCoreHarnessFactory, g as AgentCorePromptInput, h as AgentCoreSessionAdapter, i as AgentCoreSessionSnapshot, j as AgentEvent, k as AgentMessageContent, l as AgentMessagePart, m as AgentNotImplementedError, n as AgentReadinessStatus, o as AgentResolveInputResponse, p as AgentSendInput, q as AgentStartReceipt, r as AgentStreamOptions } from '../harness-If4r1n-K.js';
|
|
3
|
+
import { S as SessionListOptions, a as SessionSummary, C as ChatModelSelection, P as PiChatSnapshot, b as PiChatEvent, c as PromptPayload, d as PromptReceipt, F as FollowUpPayload, e as FollowUpReceipt, Q as QueueClearPayload, f as QueueClearReceipt, I as InterruptPayload, g as CommandReceipt, h as StopPayload, i as StopReceipt, j as SessionStore } from '../piChatEvent-DtqYMcID.js';
|
|
4
4
|
import '@mariozechner/pi-coding-agent';
|
|
5
5
|
import 'zod';
|
|
6
6
|
|
package/dist/core/index.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import {
|
|
2
2
|
createAgent
|
|
3
|
-
} from "../chunk-
|
|
3
|
+
} from "../chunk-2AVRA73A.js";
|
|
4
4
|
import {
|
|
5
5
|
AGENT_NOT_IMPLEMENTED_UNTIL_T1,
|
|
6
6
|
AgentNotImplementedError
|
|
7
7
|
} from "../chunk-WSQ5QNIY.js";
|
|
8
|
-
import "../chunk-
|
|
8
|
+
import "../chunk-YV6D7GCQ.js";
|
|
9
9
|
export {
|
|
10
10
|
AGENT_NOT_IMPLEMENTED_UNTIL_T1,
|
|
11
11
|
AgentNotImplementedError,
|
|
@@ -4,9 +4,9 @@ import {
|
|
|
4
4
|
deriveSourcePlugin,
|
|
5
5
|
mergePiPackageSources,
|
|
6
6
|
withPiHarnessDefaults
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-24VL7G32.js";
|
|
8
8
|
import "./chunk-AQBXNPMD.js";
|
|
9
|
-
import "./chunk-
|
|
9
|
+
import "./chunk-YV6D7GCQ.js";
|
|
10
10
|
export {
|
|
11
11
|
createPiCodingAgentHarness,
|
|
12
12
|
createResourceSettingsManager,
|
package/dist/front/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as react from 'react';
|
|
2
2
|
import { ComponentProps, HTMLAttributes, FormEvent, ReactNode, ComponentType } from 'react';
|
|
3
3
|
import { FileUIPart, ChatStatus, UIMessage } from 'ai';
|
|
4
|
-
import { T as ToolUiMetadata, B as BoringChatPart, k as BoringChatMessage, l as PiChatStatus, m as QueuedUserMessage, n as ChatError, b as PiChatEvent, c as PromptPayload, d as PromptReceipt, F as FollowUpPayload, e as FollowUpReceipt, Q as QueueClearPayload, f as QueueClearReceipt, I as InterruptPayload, g as CommandReceipt, h as StopPayload, i as StopReceipt, a as SessionSummary } from '../piChatEvent-
|
|
4
|
+
import { T as ToolUiMetadata, B as BoringChatPart, k as BoringChatMessage, l as PiChatStatus, m as QueuedUserMessage, n as ChatError, b as PiChatEvent, c as PromptPayload, d as PromptReceipt, F as FollowUpPayload, e as FollowUpReceipt, Q as QueueClearPayload, f as QueueClearReceipt, I as InterruptPayload, g as CommandReceipt, h as StopPayload, i as StopReceipt, a as SessionSummary } from '../piChatEvent-DtqYMcID.js';
|
|
5
5
|
import { InputGroupAddon, InputGroupButton, InputGroupTextarea, Button, Collapsible, CollapsibleContent, CollapsibleTrigger } from '@hachej/boring-ui-kit';
|
|
6
6
|
import { Streamdown } from 'streamdown';
|
|
7
7
|
import { StickToBottom } from 'use-stick-to-bottom';
|
package/dist/front/index.js
CHANGED
|
@@ -12,10 +12,10 @@ import {
|
|
|
12
12
|
StopReceiptSchema,
|
|
13
13
|
extractToolUiMetadata,
|
|
14
14
|
sanitizeToolUiMetadata
|
|
15
|
-
} from "../chunk-
|
|
15
|
+
} from "../chunk-3RSYCAHO.js";
|
|
16
16
|
import {
|
|
17
17
|
ErrorCode
|
|
18
|
-
} from "../chunk-
|
|
18
|
+
} from "../chunk-YV6D7GCQ.js";
|
|
19
19
|
import {
|
|
20
20
|
DebugDrawer,
|
|
21
21
|
cn,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { o as SessionCtx, b as PiChatEvent, j as SessionStore } from './piChatEvent-
|
|
1
|
+
import { o as SessionCtx, b as PiChatEvent, j as SessionStore } from './piChatEvent-DtqYMcID.js';
|
|
2
2
|
import { AgentSessionEvent, PromptOptions } from '@mariozechner/pi-coding-agent';
|
|
3
3
|
|
|
4
4
|
interface TelemetrySink {
|
|
@@ -100,6 +100,15 @@ declare const AgentDefinitionErrorCode: z.ZodEnum<["AGENT_DEFINITION_INVALID", "
|
|
|
100
100
|
type AgentDefinitionErrorCode = z.infer<typeof AgentDefinitionErrorCode>;
|
|
101
101
|
declare const AgentDeploymentErrorCode: z.ZodEnum<["AGENT_DEPLOYMENT_INVALID", "AGENT_DEPLOYMENT_UNSUPPORTED_FIELD"]>;
|
|
102
102
|
type AgentDeploymentErrorCode = z.infer<typeof AgentDeploymentErrorCode>;
|
|
103
|
+
/**
|
|
104
|
+
* Refusal codes for the agent-consumption contract (AC1, Decision 22,
|
|
105
|
+
* issue #636). Scoped like {@link AgentDeploymentErrorCode} — canonical,
|
|
106
|
+
* but intentionally outside the public {@link ErrorCode} / {@link
|
|
107
|
+
* ERROR_CODES} registry (and `docs/ERROR_CODES.md`) until a runtime
|
|
108
|
+
* dispatcher actually surfaces these over an API boundary.
|
|
109
|
+
*/
|
|
110
|
+
declare const AgentConsumptionErrorCode: z.ZodEnum<["AGENT_CONSUMPTION_INVALID_TRANSITION", "AGENT_CONSUMPTION_CYCLE_DETECTED", "AGENT_CONSUMPTION_DEPTH_EXCEEDED", "AGENT_CONSUMPTION_SCHEMA_MISMATCH"]>;
|
|
111
|
+
type AgentConsumptionErrorCode = z.infer<typeof AgentConsumptionErrorCode>;
|
|
103
112
|
declare const ApiErrorPayloadSchema: z.ZodObject<{
|
|
104
113
|
code: z.ZodEnum<["UNAUTHORIZED", "MISSING_API_KEY", "INVALID_API_KEY", "OIDC_REFRESH_FAILED", "VERCEL_AUTH_FAILED", "CONFIG_INVALID", "PATH_ESCAPE", "PATH_ABSOLUTE", "PATH_NULL_BYTE", "PATH_SYMLINK_ESCAPE", "PATH_NOT_FOUND", "PATH_NOT_WRITABLE", "WORKSPACE_UNINITIALIZED", "WORKSPACE_NOT_READY", "AGENT_RUNTIME_NOT_READY", "AGENT_BINDING_DISPOSED", "AGENT_CONTROL_RECEIPT_INVALID", "RUNTIME_PROVISIONING_FAILED", "RUNTIME_PROVISIONING_LOCKED", "BWRAP_UNAVAILABLE", "BWRAP_TIMEOUT", "OUTPUT_TRUNCATED", "SANDBOX_NOT_READY", "SANDBOX_EXPIRED", "VERCEL_API_ERROR", "REMOTE_WORKER_TIMEOUT", "REMOTE_WORKER_STREAM_CLOSED", "CIRCUIT_OPEN", "ABORTED", "PAYMENT_REQUIRED", "MODEL_BUDGET_EXCEEDED", "METERING_UNSUPPORTED_COMMAND", "SESSION_NOT_FOUND", "SESSION_LOCKED", "STREAM_BUFFER_EVICTED", "CURSOR_OUT_OF_RANGE", "BRIDGE_COMMAND_INVALID", "TOOL_NOT_FOUND", "TOOL_INVALID_INPUT", "TOOL_EXECUTION_ERROR", "MCP_AGENT_ARTIFACT_INVALID", "MCP_AGENT_ARTIFACT_TOO_LARGE", "MCP_AGENT_ARTIFACT_UNAVAILABLE", "PLUGIN_LOAD_FAILED", "PLUGIN_NAME_COLLISION", "PLUGIN_RUNTIME_REVISION_MISMATCH", "PLUGIN_RUNTIME_PRIVATE_FILE", "PLUGIN_RUNTIME_UNSAFE_IMPORT", "PLUGIN_RUNTIME_TRANSFORM_FAILED", "RUNTIME_PLUGIN_NOT_FOUND", "RUNTIME_PLUGIN_ROUTE_NOT_FOUND", "RUNTIME_PLUGIN_HANDLER_FAILED", "RUNTIME_PLUGIN_LOAD_FAILED", "RUNTIME_PLUGIN_RESPONSE_UNSUPPORTED", "PROVISIONING_LAYOUT_FAILED", "PROVISIONING_SKILLS_FAILED", "PROVISIONING_TEMPLATES_FAILED", "PROVISIONING_NODE_PREFLIGHT_FAILED", "PROVISIONING_NPM_INSTALL_FAILED", "PROVISIONING_UV_BOOTSTRAP_FAILED", "PROVISIONING_UV_INSTALL_FAILED", "PROVISIONING_ARTIFACT_FAILED", "ERR_NOT_IMPLEMENTED_UNTIL_T1", "INTERNAL_ERROR"]>;
|
|
105
114
|
message: z.ZodString;
|
|
@@ -355,4 +364,4 @@ interface PiChatHeartbeatFrame {
|
|
|
355
364
|
}
|
|
356
365
|
type PiChatStreamFrame = PiChatEvent | PiChatHeartbeatFrame;
|
|
357
366
|
|
|
358
|
-
export {
|
|
367
|
+
export { AgentConsumptionErrorCode as A, type BoringChatPart as B, type ChatModelSelection as C, type InterruptReceipt as D, ErrorCode as E, type FollowUpPayload as F, type PiChatHeartbeatFrame as G, type PiChatStreamFrame as H, type InterruptPayload as I, type SessionDetail as J, type ThinkingLevel as K, extractToolUiMetadata as L, isToolUiMetadata as M, type PiChatSnapshot as P, type QueueClearPayload as Q, type SessionListOptions as S, type ToolUiMetadata as T, type SessionSummary as a, type PiChatEvent as b, type PromptPayload as c, type PromptReceipt as d, type FollowUpReceipt as e, type QueueClearReceipt as f, type CommandReceipt as g, type StopPayload as h, type StopReceipt as i, type SessionStore as j, type BoringChatMessage as k, type PiChatStatus as l, type QueuedUserMessage as m, type ChatError as n, type SessionCtx as o, AgentDefinitionErrorCode as p, AgentDeploymentErrorCode as q, type ApiErrorPayload as r, ApiErrorPayloadSchema as s, type ApiErrorResponse as t, ApiErrorResponseSchema as u, type ChatAttachmentPayload as v, type ChatSubmitPayload as w, ERROR_CODES as x, type ErrorLogFields as y, ErrorLogFieldsSchema as z };
|
package/dist/server/index.d.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { W as WorkspaceRuntimeContext, S as Sandbox, a as Workspace, E as ExecOptions, b as ExecResult, c as WorkspaceChangeEvent } from '../sandbox-DthfJaOB.js';
|
|
2
2
|
import { R as RemoteWorkerWorkspaceOp, a as RemoteWorkerWorkspaceResult, b as RemoteWorkerExecRequest } from '../protocol-B_OQKfbI.js';
|
|
3
3
|
export { B as BwrapResourceLimits, C as CreateBwrapSandboxOptions, c as REMOTE_WORKER_PROVIDER, d as REMOTE_WORKER_RUNTIME_CWD, e as RemoteWorkerErrorPayload, f as RemoteWorkerExecResponse, g as RemoteWorkerFsEventEnvelope, W as WORKER_INTERNAL_TOKEN_HEADER, h as WORKER_REQUEST_ID_HEADER, i as WORKER_WORKSPACE_ID_HEADER, j as createBwrapSandbox } from '../protocol-B_OQKfbI.js';
|
|
4
|
-
import { S as SandboxHandleStore, a as SandboxHandleRecord, F as FileSearch, C as CompiledAgentBundle, b as Sha256Digest, A as AgentDeployment, P as PluginRestartWarning, W as WorkspaceAgentDispatcherContext, c as WorkspaceAgentDispatcher } from '../workspaceAgentDispatcher-
|
|
4
|
+
import { S as SandboxHandleStore, a as SandboxHandleRecord, F as FileSearch, C as CompiledAgentBundle, b as Sha256Digest, A as AgentDeployment, P as PluginRestartWarning, W as WorkspaceAgentDispatcherContext, c as WorkspaceAgentDispatcher } from '../workspaceAgentDispatcher-BbNd3y7u.js';
|
|
5
5
|
import { Sandbox as Sandbox$1 } from '@vercel/sandbox';
|
|
6
|
-
import { T as TelemetrySink, s as ToolReadinessRequirement, t as AgentConfig, b as Agent, d as AgentActor, j as AgentEvent, u as AgentTool, v as AgentHarnessFactory } from '../harness-
|
|
7
|
-
export { w as AgentHarnessFactoryInput } from '../harness-
|
|
6
|
+
import { T as TelemetrySink, s as ToolReadinessRequirement, t as AgentConfig, b as Agent, d as AgentActor, j as AgentEvent, u as AgentTool, v as AgentHarnessFactory } from '../harness-If4r1n-K.js';
|
|
7
|
+
export { w as AgentHarnessFactoryInput } from '../harness-If4r1n-K.js';
|
|
8
8
|
import { FastifyInstance, FastifyRequest, FastifyPluginAsync } from 'fastify';
|
|
9
|
-
import { E as ErrorCode, o as SessionCtx, C as ChatModelSelection } from '../piChatEvent-
|
|
9
|
+
import { E as ErrorCode, o as SessionCtx, C as ChatModelSelection } from '../piChatEvent-DtqYMcID.js';
|
|
10
10
|
import { IncomingMessage, ServerResponse } from 'node:http';
|
|
11
11
|
import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
12
12
|
import { PackageSource, ExtensionFactory, SettingsManager } from '@mariozechner/pi-coding-agent';
|
|
@@ -708,6 +708,14 @@ declare class AgentDirectoryCompilerError extends Error {
|
|
|
708
708
|
}
|
|
709
709
|
declare function compileAgentDirectory(directory: string): Promise<CompiledAgentBundle>;
|
|
710
710
|
|
|
711
|
+
interface ResolvedAgentDigestInput {
|
|
712
|
+
readonly workspaceId: string;
|
|
713
|
+
readonly defaultDeploymentId: string;
|
|
714
|
+
readonly workspaceCompositionDigest: Sha256Digest;
|
|
715
|
+
readonly definitionDigest: Sha256Digest;
|
|
716
|
+
readonly deploymentDigest: Sha256Digest;
|
|
717
|
+
}
|
|
718
|
+
declare function createResolvedAgentDigest(input: ResolvedAgentDigestInput): Promise<Sha256Digest>;
|
|
711
719
|
interface ResolvedAgent {
|
|
712
720
|
readonly workspace: Readonly<{
|
|
713
721
|
workspaceId: string;
|
|
@@ -1375,4 +1383,4 @@ interface Logger {
|
|
|
1375
1383
|
}
|
|
1376
1384
|
declare function createLogger(prefix: string): Logger;
|
|
1377
1385
|
|
|
1378
|
-
export { AgentConfig, AgentDirectoryCompilerError, type AgentDirectoryCompilerErrorCode, type AgentDirectoryCompilerPublicErrorCode, AgentHarnessFactory, type AgentMeteringSink, type BoringAgentRuntimePaths, type BuiltinRuntimeModeId, type CreateAgentAppOptions, type CreateVercelProvisioningAdapterOptions, type DeploymentSnapshotProvider, type DeploymentSnapshotRecipe, type DeploymentSnapshotResult, type DeploymentSnapshotStatus, FileHandleStore, type LogFields, type Logger, MANAGED_AGENT_MCP_DELIVERY_RULE, MANAGED_AGENT_MCP_ORIGIN_SURFACE, type ManagedAgentArtifact, type ManagedAgentArtifactCandidate, type ManagedAgentArtifactRef, type ManagedAgentBoundRunnerWorkspace, type ManagedAgentCollectArtifactsInput, type ManagedAgentDelegateInput, type ManagedAgentDelegateProgress, type ManagedAgentDelegateRequestContext, type ManagedAgentDelegateResult, type ManagedAgentDelegateRunInput, type ManagedAgentDelegateRunner, type ManagedAgentDelegateStatus, type ManagedAgentDelegateStatusResult, ManagedAgentMcpDelegateController, type ManagedAgentMcpDelegateOptions, ManagedAgentMcpError, type ManagedAgentMcpHttpHandlerOptions, type ManagedAgentMcpServerOptions, type ManagedAgentSafeError, type ManagedAgentWorkspaceResolutionInput, type MeteringErrorLogger, type MeteringReleaseInput, type MeteringReleaseReason, type MeteringReservationResult, type MeteringReserveInput, type MeteringRunKind, type MeteringRunScope, type MeteringRunStatus, type MeteringSettleInput, type MeteringUsage, type MeteringUsageInput, type ModeContext, PI_PACKAGE_RESOURCE_FILTERS, type PiExtensionFactory, type PiHarnessOptions, type PiPackageSource, type PluginSkillSource, type ProvisionRuntimeWorkspaceOptions, type ProvisionWorkspaceRuntimeOptions, type ProvisioningArtifactRequest, type RegisterAgentRoutesOptions, RemoteWorkerClient, RemoteWorkerClientError, type RemoteWorkerClientOptions, RemoteWorkerExecRequest, type RemoteWorkerModeAdapterOptions, RemoteWorkerWorkspaceOp, RemoteWorkerWorkspaceResult, type ResolvedAgent, type RuntimeBundle, type RuntimeEnvContribution, type RuntimeEnvContributionContext, type RuntimeFilesystemBinding, type RuntimeFilesystemBindingOperations, type RuntimeModeAdapter, type RuntimeModeId, type RuntimeNodePackageSpec$1 as RuntimeNodePackageSpec, type RuntimeProvisioningContribution$1 as RuntimeProvisioningContribution, type RuntimePythonSpec$1 as RuntimePythonSpec, type RuntimeTemplateContribution$1 as RuntimeTemplateContribution, type RuntimeWorkspaceProvisioningResult, type SnapshotBakeOptions, type SnapshotBakeResult, UV_SETUP_COMMANDS, VERCEL_PROVISIONING_CACHE_ROOT, VERCEL_SANDBOX_WORKSPACE_ROOT, UV_SETUP_COMMANDS as VERCEL_UV_SETUP_COMMANDS, type VercelBakeClient, type VercelBakeSandbox, type VercelDeploymentSnapshotOptions, type WorkspaceAgentDispatcherBinding, type WorkspaceAgentDispatcherResolveOptions, type WorkspaceAgentDispatcherResolver, type WorkspaceProvisioningAdapter, type WorkspaceProvisioningExecResult, type WorkspaceProvisioningResult, applyCspHeaders, autoDetectMode, bakeSnapshotIfNeeded, buildDeploymentSnapshotRecipe, buildPackageHash, buildSnapshotRecipeHash, compactPiPackages, compileAgentDirectory, constantTimeTokenEqual, createAgent, createAgentApp, createDirectSandbox, createLogger, createManagedAgentMcpDelegateController, createManagedAgentMcpHttpHandler, createManagedAgentMcpServer, createNodeWorkspace, createRemoteWorkerModeAdapter, createRemoteWorkerSandbox, createRemoteWorkerWorkspace, createResourceSettingsManager, createVercelDeploymentSnapshotProvider, createVercelProvisioningAdapter, createVercelSandboxWorkspace, decodeBytesFromWorker, encodeBytesForWorker, fileRoutes, getBoringAgentPathEntries, getBoringAgentRuntimeEnv, getBoringAgentRuntimePaths, hasBwrap, mergePiPackageSources, normalizeMeteringUsage, piPackageSourceKey, prepareDeploymentSnapshot, prepareVercelDeploymentSnapshot, provisionRuntimeWorkspace, provisionWorkspaceRuntime, registerAgentRoutes, resolveAgentDeployment, resolveMode, resolveSandboxHandle };
|
|
1386
|
+
export { AgentConfig, AgentDirectoryCompilerError, type AgentDirectoryCompilerErrorCode, type AgentDirectoryCompilerPublicErrorCode, AgentHarnessFactory, type AgentMeteringSink, type BoringAgentRuntimePaths, type BuiltinRuntimeModeId, type CreateAgentAppOptions, type CreateVercelProvisioningAdapterOptions, type DeploymentSnapshotProvider, type DeploymentSnapshotRecipe, type DeploymentSnapshotResult, type DeploymentSnapshotStatus, FileHandleStore, type LogFields, type Logger, MANAGED_AGENT_MCP_DELIVERY_RULE, MANAGED_AGENT_MCP_ORIGIN_SURFACE, type ManagedAgentArtifact, type ManagedAgentArtifactCandidate, type ManagedAgentArtifactRef, type ManagedAgentBoundRunnerWorkspace, type ManagedAgentCollectArtifactsInput, type ManagedAgentDelegateInput, type ManagedAgentDelegateProgress, type ManagedAgentDelegateRequestContext, type ManagedAgentDelegateResult, type ManagedAgentDelegateRunInput, type ManagedAgentDelegateRunner, type ManagedAgentDelegateStatus, type ManagedAgentDelegateStatusResult, ManagedAgentMcpDelegateController, type ManagedAgentMcpDelegateOptions, ManagedAgentMcpError, type ManagedAgentMcpHttpHandlerOptions, type ManagedAgentMcpServerOptions, type ManagedAgentSafeError, type ManagedAgentWorkspaceResolutionInput, type MeteringErrorLogger, type MeteringReleaseInput, type MeteringReleaseReason, type MeteringReservationResult, type MeteringReserveInput, type MeteringRunKind, type MeteringRunScope, type MeteringRunStatus, type MeteringSettleInput, type MeteringUsage, type MeteringUsageInput, type ModeContext, PI_PACKAGE_RESOURCE_FILTERS, type PiExtensionFactory, type PiHarnessOptions, type PiPackageSource, type PluginSkillSource, type ProvisionRuntimeWorkspaceOptions, type ProvisionWorkspaceRuntimeOptions, type ProvisioningArtifactRequest, type RegisterAgentRoutesOptions, RemoteWorkerClient, RemoteWorkerClientError, type RemoteWorkerClientOptions, RemoteWorkerExecRequest, type RemoteWorkerModeAdapterOptions, RemoteWorkerWorkspaceOp, RemoteWorkerWorkspaceResult, type ResolvedAgent, type ResolvedAgentDigestInput, type RuntimeBundle, type RuntimeEnvContribution, type RuntimeEnvContributionContext, type RuntimeFilesystemBinding, type RuntimeFilesystemBindingOperations, type RuntimeModeAdapter, type RuntimeModeId, type RuntimeNodePackageSpec$1 as RuntimeNodePackageSpec, type RuntimeProvisioningContribution$1 as RuntimeProvisioningContribution, type RuntimePythonSpec$1 as RuntimePythonSpec, type RuntimeTemplateContribution$1 as RuntimeTemplateContribution, type RuntimeWorkspaceProvisioningResult, type SnapshotBakeOptions, type SnapshotBakeResult, UV_SETUP_COMMANDS, VERCEL_PROVISIONING_CACHE_ROOT, VERCEL_SANDBOX_WORKSPACE_ROOT, UV_SETUP_COMMANDS as VERCEL_UV_SETUP_COMMANDS, type VercelBakeClient, type VercelBakeSandbox, type VercelDeploymentSnapshotOptions, type WorkspaceAgentDispatcherBinding, type WorkspaceAgentDispatcherResolveOptions, type WorkspaceAgentDispatcherResolver, type WorkspaceProvisioningAdapter, type WorkspaceProvisioningExecResult, type WorkspaceProvisioningResult, applyCspHeaders, autoDetectMode, bakeSnapshotIfNeeded, buildDeploymentSnapshotRecipe, buildPackageHash, buildSnapshotRecipeHash, compactPiPackages, compileAgentDirectory, constantTimeTokenEqual, createAgent, createAgentApp, createDirectSandbox, createLogger, createManagedAgentMcpDelegateController, createManagedAgentMcpHttpHandler, createManagedAgentMcpServer, createNodeWorkspace, createRemoteWorkerModeAdapter, createRemoteWorkerSandbox, createRemoteWorkerWorkspace, createResolvedAgentDigest, createResourceSettingsManager, createVercelDeploymentSnapshotProvider, createVercelProvisioningAdapter, createVercelSandboxWorkspace, decodeBytesFromWorker, encodeBytesForWorker, fileRoutes, getBoringAgentPathEntries, getBoringAgentRuntimeEnv, getBoringAgentRuntimePaths, hasBwrap, mergePiPackageSources, normalizeMeteringUsage, piPackageSourceKey, prepareDeploymentSnapshot, prepareVercelDeploymentSnapshot, provisionRuntimeWorkspace, provisionWorkspaceRuntime, registerAgentRoutes, resolveAgentDeployment, resolveMode, resolveSandboxHandle };
|
package/dist/server/index.js
CHANGED
|
@@ -34,6 +34,7 @@ import {
|
|
|
34
34
|
createRemoteWorkerModeAdapter,
|
|
35
35
|
createRemoteWorkerSandbox,
|
|
36
36
|
createRemoteWorkerWorkspace,
|
|
37
|
+
createResolvedAgentDigest,
|
|
37
38
|
createVercelDeploymentSnapshotProvider,
|
|
38
39
|
createVercelProvisioningAdapter,
|
|
39
40
|
createVercelSandboxWorkspace,
|
|
@@ -53,11 +54,11 @@ import {
|
|
|
53
54
|
resolveAgentDeployment,
|
|
54
55
|
resolveMode,
|
|
55
56
|
resolveSandboxHandle
|
|
56
|
-
} from "../chunk-
|
|
57
|
-
import "../chunk-
|
|
58
|
-
import "../chunk-
|
|
57
|
+
} from "../chunk-I7JNWIYM.js";
|
|
58
|
+
import "../chunk-S2HYQYJP.js";
|
|
59
|
+
import "../chunk-2AVRA73A.js";
|
|
59
60
|
import "../chunk-WSQ5QNIY.js";
|
|
60
|
-
import "../chunk-
|
|
61
|
+
import "../chunk-3RSYCAHO.js";
|
|
61
62
|
import {
|
|
62
63
|
PI_PACKAGE_RESOURCE_FILTERS,
|
|
63
64
|
compactPiPackages,
|
|
@@ -65,9 +66,9 @@ import {
|
|
|
65
66
|
createResourceSettingsManager,
|
|
66
67
|
mergePiPackageSources,
|
|
67
68
|
piPackageSourceKey
|
|
68
|
-
} from "../chunk-
|
|
69
|
+
} from "../chunk-24VL7G32.js";
|
|
69
70
|
import "../chunk-AQBXNPMD.js";
|
|
70
|
-
import "../chunk-
|
|
71
|
+
import "../chunk-YV6D7GCQ.js";
|
|
71
72
|
export {
|
|
72
73
|
AgentDirectoryCompilerError,
|
|
73
74
|
FileHandleStore,
|
|
@@ -108,6 +109,7 @@ export {
|
|
|
108
109
|
createRemoteWorkerModeAdapter,
|
|
109
110
|
createRemoteWorkerSandbox,
|
|
110
111
|
createRemoteWorkerWorkspace,
|
|
112
|
+
createResolvedAgentDigest,
|
|
111
113
|
createResourceSettingsManager,
|
|
112
114
|
createVercelDeploymentSnapshotProvider,
|
|
113
115
|
createVercelProvisioningAdapter,
|
|
@@ -4,14 +4,14 @@ import {
|
|
|
4
4
|
constantTimeTokenEqual,
|
|
5
5
|
createBwrapSandbox,
|
|
6
6
|
createNodeWorkspace
|
|
7
|
-
} from "../../chunk-
|
|
8
|
-
import "../../chunk-
|
|
9
|
-
import "../../chunk-
|
|
7
|
+
} from "../../chunk-I7JNWIYM.js";
|
|
8
|
+
import "../../chunk-S2HYQYJP.js";
|
|
9
|
+
import "../../chunk-2AVRA73A.js";
|
|
10
10
|
import "../../chunk-WSQ5QNIY.js";
|
|
11
|
-
import "../../chunk-
|
|
12
|
-
import "../../chunk-
|
|
11
|
+
import "../../chunk-3RSYCAHO.js";
|
|
12
|
+
import "../../chunk-24VL7G32.js";
|
|
13
13
|
import "../../chunk-AQBXNPMD.js";
|
|
14
|
-
import "../../chunk-
|
|
14
|
+
import "../../chunk-YV6D7GCQ.js";
|
|
15
15
|
|
|
16
16
|
// src/server/worker/index.ts
|
|
17
17
|
import Fastify from "fastify";
|
package/dist/shared/index.d.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { u as AgentTool } from '../harness-
|
|
2
|
-
export { c as AGENT_NOT_IMPLEMENTED_UNTIL_T1, b as Agent, d as AgentActor, e as AgentCoreHarness, f as AgentCoreHarnessFactory, g as AgentCorePromptInput, h as AgentCoreSessionAdapter, i as AgentCoreSessionSnapshot, j as AgentEvent, A as AgentHarness, k as AgentMessageContent, l as AgentMessagePart, m as AgentNotImplementedError, a as AgentReadiness, n as AgentReadinessStatus, o as AgentResolveInputResponse, x as AgentRuntimeAdapter, p as AgentSendInput, q as AgentStartReceipt, r as AgentStreamOptions, t as CoreAgentConfig, J as JSONSchema, M as MessageAttachment, R as RunContext, S as SendMessageInput, y as TelemetryEvent, T as TelemetrySink, z as ToolExecContext, B as ToolResult, C as noopTelemetry, D as safeCapture, E as sessionStreamPath } from '../harness-
|
|
3
|
-
import { F as FileSearch } from '../workspaceAgentDispatcher-
|
|
4
|
-
export {
|
|
1
|
+
import { u as AgentTool } from '../harness-If4r1n-K.js';
|
|
2
|
+
export { c as AGENT_NOT_IMPLEMENTED_UNTIL_T1, b as Agent, d as AgentActor, e as AgentCoreHarness, f as AgentCoreHarnessFactory, g as AgentCorePromptInput, h as AgentCoreSessionAdapter, i as AgentCoreSessionSnapshot, j as AgentEvent, A as AgentHarness, k as AgentMessageContent, l as AgentMessagePart, m as AgentNotImplementedError, a as AgentReadiness, n as AgentReadinessStatus, o as AgentResolveInputResponse, x as AgentRuntimeAdapter, p as AgentSendInput, q as AgentStartReceipt, r as AgentStreamOptions, t as CoreAgentConfig, J as JSONSchema, M as MessageAttachment, R as RunContext, S as SendMessageInput, y as TelemetryEvent, T as TelemetrySink, z as ToolExecContext, B as ToolResult, C as noopTelemetry, D as safeCapture, E as sessionStreamPath } from '../harness-If4r1n-K.js';
|
|
3
|
+
import { F as FileSearch, d as AgentSchemaIssue, e as AgentSchemaValidationResult } from '../workspaceAgentDispatcher-BbNd3y7u.js';
|
|
4
|
+
export { f as AgentDefinition, g as AgentDefinitionDigestAsset, h as AgentDefinitionReference, i as AgentDefinitionValidationError, A as AgentDeployment, j as AgentDeploymentValidationError, k as CommandNotifyPayload, C as CompiledAgentBundle, l as CompiledAgentDefinition, O as OpaqueRefSchema, a as SandboxHandleRecord, S as SandboxHandleStore, b as Sha256Digest, m as Sha256DigestSchema, n as WORKSPACE_AGENT_PLUGINS_RELOADED_EVENT, o as WORKSPACE_COMMAND_NOTIFY_EVENT, c as WorkspaceAgentDispatcher, W as WorkspaceAgentDispatcherContext, p as WorkspaceAgentDispatcherSendInput, q as createAgentAssetDigest, r as createAgentDefinitionDigest, s as createAgentDeploymentDigest, v as validateAgentDefinition, t as validateAgentDeployment } from '../workspaceAgentDispatcher-BbNd3y7u.js';
|
|
5
5
|
import { a as Workspace, S as Sandbox } from '../sandbox-DthfJaOB.js';
|
|
6
6
|
export { e as Entry, E as ExecOptions, b as ExecResult, I as IsolatedCodeInput, f as IsolatedCodeOutput, g as SandboxCapability, d as Stat, W as WorkspaceRuntimeContext } from '../sandbox-DthfJaOB.js';
|
|
7
|
-
import { B as BoringChatPart, T as ToolUiMetadata } from '../piChatEvent-
|
|
8
|
-
export {
|
|
7
|
+
import { B as BoringChatPart, T as ToolUiMetadata, A as AgentConsumptionErrorCode } from '../piChatEvent-DtqYMcID.js';
|
|
8
|
+
export { p as AgentDefinitionErrorCode, q as AgentDeploymentErrorCode, r as ApiErrorPayload, s as ApiErrorPayloadSchema, t as ApiErrorResponse, u as ApiErrorResponseSchema, k as BoringChatMessage, v as ChatAttachmentPayload, n as ChatError, C as ChatModelSelection, w as ChatSubmitPayload, g as CommandReceipt, x as ERROR_CODES, E as ErrorCode, y as ErrorLogFields, z as ErrorLogFieldsSchema, F as FollowUpPayload, e as FollowUpReceipt, I as InterruptPayload, D as InterruptReceipt, b as PiChatEvent, G as PiChatHeartbeatFrame, P as PiChatSnapshot, l as PiChatStatus, H as PiChatStreamFrame, c as PromptPayload, d as PromptReceipt, Q as QueueClearPayload, f as QueueClearReceipt, m as QueuedUserMessage, o as SessionCtx, J as SessionDetail, j as SessionStore, a as SessionSummary, h as StopPayload, i as StopReceipt, K as ThinkingLevel, L as extractToolUiMetadata, M as isToolUiMetadata } from '../piChatEvent-DtqYMcID.js';
|
|
9
9
|
import { z } from 'zod';
|
|
10
10
|
import '@mariozechner/pi-coding-agent';
|
|
11
11
|
|
|
@@ -1573,4 +1573,264 @@ declare const PI_AGENT_RUNTIME_CAPABILITIES: AgentRuntimeCapabilities;
|
|
|
1573
1573
|
|
|
1574
1574
|
declare function validateTool(tool: unknown): AgentTool | null;
|
|
1575
1575
|
|
|
1576
|
-
|
|
1576
|
+
declare const TASK_STATES: readonly ["submitted", "working", "input-required", "completed", "failed", "canceled", "rejected"];
|
|
1577
|
+
type TaskState = (typeof TASK_STATES)[number];
|
|
1578
|
+
declare const TaskStateSchema: z.ZodEnum<["submitted", "working", "input-required", "completed", "failed", "canceled", "rejected"]>;
|
|
1579
|
+
declare function isValidTaskTransition(from: TaskState, to: TaskState): boolean;
|
|
1580
|
+
/** Throws {@link AgentConsumptionValidationError} (AGENT_CONSUMPTION_INVALID_TRANSITION) when illegal. */
|
|
1581
|
+
declare function assertValidTransition(from: TaskState, to: TaskState): void;
|
|
1582
|
+
/** The originating user + workspace a task is scoped to (audit: who asked). */
|
|
1583
|
+
interface PrincipalRef {
|
|
1584
|
+
userId: string;
|
|
1585
|
+
workspaceId: string;
|
|
1586
|
+
}
|
|
1587
|
+
declare const PrincipalRefSchema: z.ZodObject<{
|
|
1588
|
+
userId: z.ZodString;
|
|
1589
|
+
workspaceId: z.ZodString;
|
|
1590
|
+
}, "strict", z.ZodTypeAny, {
|
|
1591
|
+
workspaceId: string;
|
|
1592
|
+
userId: string;
|
|
1593
|
+
}, {
|
|
1594
|
+
workspaceId: string;
|
|
1595
|
+
userId: string;
|
|
1596
|
+
}>;
|
|
1597
|
+
/** An acting agent identity, recorded as `actor` for audit/provenance (who did it). */
|
|
1598
|
+
interface AgentRef {
|
|
1599
|
+
agentId: string;
|
|
1600
|
+
deploymentId?: string;
|
|
1601
|
+
}
|
|
1602
|
+
declare const AgentRefSchema: z.ZodObject<{
|
|
1603
|
+
agentId: z.ZodString;
|
|
1604
|
+
deploymentId: z.ZodOptional<z.ZodString>;
|
|
1605
|
+
}, "strict", z.ZodTypeAny, {
|
|
1606
|
+
agentId: string;
|
|
1607
|
+
deploymentId?: string | undefined;
|
|
1608
|
+
}, {
|
|
1609
|
+
agentId: string;
|
|
1610
|
+
deploymentId?: string | undefined;
|
|
1611
|
+
}>;
|
|
1612
|
+
declare function agentRefEquals(a: AgentRef, b: AgentRef): boolean;
|
|
1613
|
+
/** A reference to an artifact produced by a task (bytes live elsewhere; this is the pointer). */
|
|
1614
|
+
interface ArtifactRef {
|
|
1615
|
+
artifactId: string;
|
|
1616
|
+
name?: string;
|
|
1617
|
+
mimeType: string;
|
|
1618
|
+
uri: string;
|
|
1619
|
+
}
|
|
1620
|
+
declare const ArtifactRefSchema: z.ZodObject<{
|
|
1621
|
+
artifactId: z.ZodString;
|
|
1622
|
+
name: z.ZodOptional<z.ZodString>;
|
|
1623
|
+
mimeType: z.ZodString;
|
|
1624
|
+
uri: z.ZodString;
|
|
1625
|
+
}, "strict", z.ZodTypeAny, {
|
|
1626
|
+
artifactId: string;
|
|
1627
|
+
mimeType: string;
|
|
1628
|
+
uri: string;
|
|
1629
|
+
name?: string | undefined;
|
|
1630
|
+
}, {
|
|
1631
|
+
artifactId: string;
|
|
1632
|
+
mimeType: string;
|
|
1633
|
+
uri: string;
|
|
1634
|
+
name?: string | undefined;
|
|
1635
|
+
}>;
|
|
1636
|
+
interface TextPart {
|
|
1637
|
+
type: 'text';
|
|
1638
|
+
text: string;
|
|
1639
|
+
}
|
|
1640
|
+
interface FilePart {
|
|
1641
|
+
type: 'file';
|
|
1642
|
+
file: ArtifactRef;
|
|
1643
|
+
}
|
|
1644
|
+
interface DataPart {
|
|
1645
|
+
type: 'data';
|
|
1646
|
+
mimeType: string;
|
|
1647
|
+
data?: unknown;
|
|
1648
|
+
}
|
|
1649
|
+
type Part = TextPart | FilePart | DataPart;
|
|
1650
|
+
declare const PartSchema: z.ZodType<Part, z.ZodTypeDef, unknown>;
|
|
1651
|
+
interface AgentMessage {
|
|
1652
|
+
role: 'consumer' | 'agent';
|
|
1653
|
+
parts: Part[];
|
|
1654
|
+
ts: string;
|
|
1655
|
+
}
|
|
1656
|
+
declare const AgentMessageSchema: z.ZodObject<{
|
|
1657
|
+
role: z.ZodEnum<["consumer", "agent"]>;
|
|
1658
|
+
parts: z.ZodArray<z.ZodType<Part, z.ZodTypeDef, unknown>, "many">;
|
|
1659
|
+
ts: z.ZodString;
|
|
1660
|
+
}, "strict", z.ZodTypeAny, {
|
|
1661
|
+
role: "consumer" | "agent";
|
|
1662
|
+
parts: Part[];
|
|
1663
|
+
ts: string;
|
|
1664
|
+
}, {
|
|
1665
|
+
role: "consumer" | "agent";
|
|
1666
|
+
parts: unknown[];
|
|
1667
|
+
ts: string;
|
|
1668
|
+
}>;
|
|
1669
|
+
interface AgentTask {
|
|
1670
|
+
id: string;
|
|
1671
|
+
contextId: string;
|
|
1672
|
+
state: TaskState;
|
|
1673
|
+
messages: AgentMessage[];
|
|
1674
|
+
artifacts: ArtifactRef[];
|
|
1675
|
+
/** Originating user + workspace this task is scoped to. */
|
|
1676
|
+
principal: PrincipalRef;
|
|
1677
|
+
/** Acting agent, recorded for audit/provenance. Absent for a human-driven task. */
|
|
1678
|
+
actor?: AgentRef;
|
|
1679
|
+
schemaVersion: '1';
|
|
1680
|
+
createdAt: string;
|
|
1681
|
+
updatedAt: string;
|
|
1682
|
+
}
|
|
1683
|
+
declare const AgentTaskSchema: z.ZodObject<{
|
|
1684
|
+
id: z.ZodString;
|
|
1685
|
+
contextId: z.ZodString;
|
|
1686
|
+
state: z.ZodEnum<["submitted", "working", "input-required", "completed", "failed", "canceled", "rejected"]>;
|
|
1687
|
+
messages: z.ZodArray<z.ZodObject<{
|
|
1688
|
+
role: z.ZodEnum<["consumer", "agent"]>;
|
|
1689
|
+
parts: z.ZodArray<z.ZodType<Part, z.ZodTypeDef, unknown>, "many">;
|
|
1690
|
+
ts: z.ZodString;
|
|
1691
|
+
}, "strict", z.ZodTypeAny, {
|
|
1692
|
+
role: "consumer" | "agent";
|
|
1693
|
+
parts: Part[];
|
|
1694
|
+
ts: string;
|
|
1695
|
+
}, {
|
|
1696
|
+
role: "consumer" | "agent";
|
|
1697
|
+
parts: unknown[];
|
|
1698
|
+
ts: string;
|
|
1699
|
+
}>, "many">;
|
|
1700
|
+
artifacts: z.ZodArray<z.ZodObject<{
|
|
1701
|
+
artifactId: z.ZodString;
|
|
1702
|
+
name: z.ZodOptional<z.ZodString>;
|
|
1703
|
+
mimeType: z.ZodString;
|
|
1704
|
+
uri: z.ZodString;
|
|
1705
|
+
}, "strict", z.ZodTypeAny, {
|
|
1706
|
+
artifactId: string;
|
|
1707
|
+
mimeType: string;
|
|
1708
|
+
uri: string;
|
|
1709
|
+
name?: string | undefined;
|
|
1710
|
+
}, {
|
|
1711
|
+
artifactId: string;
|
|
1712
|
+
mimeType: string;
|
|
1713
|
+
uri: string;
|
|
1714
|
+
name?: string | undefined;
|
|
1715
|
+
}>, "many">;
|
|
1716
|
+
principal: z.ZodObject<{
|
|
1717
|
+
userId: z.ZodString;
|
|
1718
|
+
workspaceId: z.ZodString;
|
|
1719
|
+
}, "strict", z.ZodTypeAny, {
|
|
1720
|
+
workspaceId: string;
|
|
1721
|
+
userId: string;
|
|
1722
|
+
}, {
|
|
1723
|
+
workspaceId: string;
|
|
1724
|
+
userId: string;
|
|
1725
|
+
}>;
|
|
1726
|
+
actor: z.ZodOptional<z.ZodObject<{
|
|
1727
|
+
agentId: z.ZodString;
|
|
1728
|
+
deploymentId: z.ZodOptional<z.ZodString>;
|
|
1729
|
+
}, "strict", z.ZodTypeAny, {
|
|
1730
|
+
agentId: string;
|
|
1731
|
+
deploymentId?: string | undefined;
|
|
1732
|
+
}, {
|
|
1733
|
+
agentId: string;
|
|
1734
|
+
deploymentId?: string | undefined;
|
|
1735
|
+
}>>;
|
|
1736
|
+
schemaVersion: z.ZodLiteral<"1">;
|
|
1737
|
+
createdAt: z.ZodString;
|
|
1738
|
+
updatedAt: z.ZodString;
|
|
1739
|
+
}, "strict", z.ZodTypeAny, {
|
|
1740
|
+
id: string;
|
|
1741
|
+
state: "submitted" | "failed" | "working" | "input-required" | "completed" | "canceled" | "rejected";
|
|
1742
|
+
createdAt: string;
|
|
1743
|
+
messages: {
|
|
1744
|
+
role: "consumer" | "agent";
|
|
1745
|
+
parts: Part[];
|
|
1746
|
+
ts: string;
|
|
1747
|
+
}[];
|
|
1748
|
+
schemaVersion: "1";
|
|
1749
|
+
contextId: string;
|
|
1750
|
+
artifacts: {
|
|
1751
|
+
artifactId: string;
|
|
1752
|
+
mimeType: string;
|
|
1753
|
+
uri: string;
|
|
1754
|
+
name?: string | undefined;
|
|
1755
|
+
}[];
|
|
1756
|
+
principal: {
|
|
1757
|
+
workspaceId: string;
|
|
1758
|
+
userId: string;
|
|
1759
|
+
};
|
|
1760
|
+
updatedAt: string;
|
|
1761
|
+
actor?: {
|
|
1762
|
+
agentId: string;
|
|
1763
|
+
deploymentId?: string | undefined;
|
|
1764
|
+
} | undefined;
|
|
1765
|
+
}, {
|
|
1766
|
+
id: string;
|
|
1767
|
+
state: "submitted" | "failed" | "working" | "input-required" | "completed" | "canceled" | "rejected";
|
|
1768
|
+
createdAt: string;
|
|
1769
|
+
messages: {
|
|
1770
|
+
role: "consumer" | "agent";
|
|
1771
|
+
parts: unknown[];
|
|
1772
|
+
ts: string;
|
|
1773
|
+
}[];
|
|
1774
|
+
schemaVersion: "1";
|
|
1775
|
+
contextId: string;
|
|
1776
|
+
artifacts: {
|
|
1777
|
+
artifactId: string;
|
|
1778
|
+
mimeType: string;
|
|
1779
|
+
uri: string;
|
|
1780
|
+
name?: string | undefined;
|
|
1781
|
+
}[];
|
|
1782
|
+
principal: {
|
|
1783
|
+
workspaceId: string;
|
|
1784
|
+
userId: string;
|
|
1785
|
+
};
|
|
1786
|
+
updatedAt: string;
|
|
1787
|
+
actor?: {
|
|
1788
|
+
agentId: string;
|
|
1789
|
+
deploymentId?: string | undefined;
|
|
1790
|
+
} | undefined;
|
|
1791
|
+
}>;
|
|
1792
|
+
declare function validateAgentTask(raw: unknown): AgentSchemaValidationResult<AgentTask, AgentConsumptionErrorCode>;
|
|
1793
|
+
declare class AgentConsumptionValidationError extends Error {
|
|
1794
|
+
readonly code: "CONFIG_INVALID";
|
|
1795
|
+
readonly field: string;
|
|
1796
|
+
readonly validationCode: AgentConsumptionErrorCode;
|
|
1797
|
+
constructor(issue: AgentSchemaIssue<AgentConsumptionErrorCode>);
|
|
1798
|
+
}
|
|
1799
|
+
/**
|
|
1800
|
+
* Configurable guard values. Deliberately NOT frozen as constants here —
|
|
1801
|
+
* per Decision 22 / the AC1 guardrail, concrete numbers (suggested: depth 3,
|
|
1802
|
+
* 24h input-required timeout) are ratified in the AC1 consumer-backed spec,
|
|
1803
|
+
* not in the contracts layer.
|
|
1804
|
+
*/
|
|
1805
|
+
interface ConsumptionGuards {
|
|
1806
|
+
/** Max delegation chain length before a further hop is refused. */
|
|
1807
|
+
maxDepth: number;
|
|
1808
|
+
/** How long a task may sit in `input-required` before it is canceled. */
|
|
1809
|
+
inputRequiredTimeoutMs: number;
|
|
1810
|
+
}
|
|
1811
|
+
declare const ConsumptionGuardsSchema: z.ZodObject<{
|
|
1812
|
+
maxDepth: z.ZodNumber;
|
|
1813
|
+
inputRequiredTimeoutMs: z.ZodNumber;
|
|
1814
|
+
}, "strict", z.ZodTypeAny, {
|
|
1815
|
+
maxDepth: number;
|
|
1816
|
+
inputRequiredTimeoutMs: number;
|
|
1817
|
+
}, {
|
|
1818
|
+
maxDepth: number;
|
|
1819
|
+
inputRequiredTimeoutMs: number;
|
|
1820
|
+
}>;
|
|
1821
|
+
declare function validateConsumptionGuards(raw: unknown): AgentSchemaValidationResult<ConsumptionGuards, AgentConsumptionErrorCode>;
|
|
1822
|
+
/**
|
|
1823
|
+
* True when appending `next` to `chain` would revisit an agent (deployment)
|
|
1824
|
+
* already present in the delegation chain — including the same-pair
|
|
1825
|
+
* oscillation case (A -> B -> A), which is caught because A already
|
|
1826
|
+
* appears in the chain by the time B considers delegating back to it.
|
|
1827
|
+
*/
|
|
1828
|
+
declare function detectConsumptionCycle(chain: readonly AgentRef[], next: AgentRef): boolean;
|
|
1829
|
+
/** Throws {@link AgentConsumptionValidationError} (AGENT_CONSUMPTION_CYCLE_DETECTED) when a cycle is detected. */
|
|
1830
|
+
declare function assertNoConsumptionCycle(chain: readonly AgentRef[], next: AgentRef): void;
|
|
1831
|
+
/** True when the chain has room for one more hop under `guards.maxDepth`. */
|
|
1832
|
+
declare function isWithinConsumptionDepth(chain: readonly AgentRef[], guards: ConsumptionGuards): boolean;
|
|
1833
|
+
/** Throws {@link AgentConsumptionValidationError} (AGENT_CONSUMPTION_DEPTH_EXCEEDED) when the depth guard is exceeded. */
|
|
1834
|
+
declare function assertWithinConsumptionDepth(chain: readonly AgentRef[], guards: ConsumptionGuards): void;
|
|
1835
|
+
|
|
1836
|
+
export { type AgentConfig, AgentConsumptionErrorCode, AgentConsumptionValidationError, type AgentEnv, type AgentMessage, AgentMessageSchema, type AgentRef, AgentRefSchema, type AgentRuntimeCapabilities, AgentSchemaIssue, AgentSchemaValidationResult, type AgentTask, AgentTaskSchema, AgentTool, type ArtifactRef, ArtifactRefSchema, BoringChatMessageSchema, BoringChatPart, BoringChatPartSchema, type CatalogDeps, ChatAttachmentPayloadSchema, ChatErrorSchema, ChatModelSelectionSchema, CommandReceiptSchema, ConfigSchema, type ConsumptionGuards, ConsumptionGuardsSchema, DEFAULT_AGENT_RUNTIME_CAPABILITIES, type DataPart, EnvSchema, type FilePart, FileSearch, FollowUpPayloadSchema, FollowUpReceiptSchema, InterruptPayloadSchema, PI_AGENT_RUNTIME_CAPABILITIES, type Part, PartSchema, PiChatEventSchema, PiChatHeartbeatFrameSchema, PiChatSnapshotSchema, PiChatStatusSchema, PiChatStreamFrameSchema, type PrincipalRef, PrincipalRefSchema, PromptPayloadSchema, PromptReceiptSchema, QueueClearPayloadSchema, QueueClearReceiptSchema, QueuedUserMessageSchema, type RuntimeModeId, RuntimeModeSchema, Sandbox, StopPayloadSchema, StopReceiptSchema, TASK_STATES, type TaskState, TaskStateSchema, type TextPart, ThinkingLevelSchema, type ToolCatalog, ToolUiMetadata, ToolUiMetadataSchema, Workspace, agentRefEquals, assertNoConsumptionCycle, assertValidTransition, assertWithinConsumptionDepth, detectConsumptionCycle, isValidTaskTransition, isWithinConsumptionDepth, sanitizeToolUiMetadata, validateAgentTask, validateConfig, validateConsumptionGuards, validateTool };
|
package/dist/shared/index.js
CHANGED
|
@@ -9,7 +9,7 @@ import {
|
|
|
9
9
|
validateAgentDefinition,
|
|
10
10
|
validateAgentDeployment,
|
|
11
11
|
validateTool
|
|
12
|
-
} from "../chunk-
|
|
12
|
+
} from "../chunk-S2HYQYJP.js";
|
|
13
13
|
import {
|
|
14
14
|
AGENT_NOT_IMPLEMENTED_UNTIL_T1,
|
|
15
15
|
AgentNotImplementedError,
|
|
@@ -46,12 +46,13 @@ import {
|
|
|
46
46
|
extractToolUiMetadata,
|
|
47
47
|
isToolUiMetadata,
|
|
48
48
|
sanitizeToolUiMetadata2 as sanitizeToolUiMetadata
|
|
49
|
-
} from "../chunk-
|
|
49
|
+
} from "../chunk-3RSYCAHO.js";
|
|
50
50
|
import {
|
|
51
51
|
noopTelemetry,
|
|
52
52
|
safeCapture
|
|
53
53
|
} from "../chunk-AQBXNPMD.js";
|
|
54
54
|
import {
|
|
55
|
+
AgentConsumptionErrorCode,
|
|
55
56
|
AgentDefinitionErrorCode,
|
|
56
57
|
AgentDeploymentErrorCode,
|
|
57
58
|
ApiErrorPayloadSchema,
|
|
@@ -59,7 +60,7 @@ import {
|
|
|
59
60
|
ERROR_CODES,
|
|
60
61
|
ErrorCode,
|
|
61
62
|
ErrorLogFieldsSchema
|
|
62
|
-
} from "../chunk-
|
|
63
|
+
} from "../chunk-YV6D7GCQ.js";
|
|
63
64
|
|
|
64
65
|
// src/shared/config-schema.ts
|
|
65
66
|
import { z } from "zod";
|
|
@@ -124,15 +125,166 @@ var PI_AGENT_RUNTIME_CAPABILITIES = {
|
|
|
124
125
|
nativeFollowUp: true,
|
|
125
126
|
aiSdkOwnsHistory: false
|
|
126
127
|
};
|
|
128
|
+
|
|
129
|
+
// src/shared/agent-consumption.ts
|
|
130
|
+
import { z as z2 } from "zod";
|
|
131
|
+
var nonEmptyString = z2.string().min(1);
|
|
132
|
+
var TASK_STATES = [
|
|
133
|
+
"submitted",
|
|
134
|
+
"working",
|
|
135
|
+
"input-required",
|
|
136
|
+
"completed",
|
|
137
|
+
"failed",
|
|
138
|
+
"canceled",
|
|
139
|
+
"rejected"
|
|
140
|
+
];
|
|
141
|
+
var TaskStateSchema = z2.enum(TASK_STATES);
|
|
142
|
+
var TASK_TRANSITIONS = {
|
|
143
|
+
submitted: ["working", "rejected", "canceled"],
|
|
144
|
+
working: ["input-required", "completed", "failed", "canceled", "rejected"],
|
|
145
|
+
"input-required": ["working", "canceled"],
|
|
146
|
+
completed: [],
|
|
147
|
+
failed: [],
|
|
148
|
+
canceled: [],
|
|
149
|
+
rejected: []
|
|
150
|
+
};
|
|
151
|
+
function isValidTaskTransition(from, to) {
|
|
152
|
+
return TASK_TRANSITIONS[from].includes(to);
|
|
153
|
+
}
|
|
154
|
+
function assertValidTransition(from, to) {
|
|
155
|
+
if (!isValidTaskTransition(from, to)) {
|
|
156
|
+
throw new AgentConsumptionValidationError({
|
|
157
|
+
code: AgentConsumptionErrorCode.enum.AGENT_CONSUMPTION_INVALID_TRANSITION,
|
|
158
|
+
field: "state",
|
|
159
|
+
message: `invalid task state transition: '${from}' -> '${to}'`
|
|
160
|
+
});
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
var PrincipalRefSchema = z2.object({
|
|
164
|
+
userId: nonEmptyString,
|
|
165
|
+
workspaceId: nonEmptyString
|
|
166
|
+
}).strict();
|
|
167
|
+
var AgentRefSchema = z2.object({
|
|
168
|
+
agentId: nonEmptyString,
|
|
169
|
+
deploymentId: nonEmptyString.optional()
|
|
170
|
+
}).strict();
|
|
171
|
+
function agentRefEquals(a, b) {
|
|
172
|
+
return a.agentId === b.agentId && (a.deploymentId ?? null) === (b.deploymentId ?? null);
|
|
173
|
+
}
|
|
174
|
+
var ArtifactRefSchema = z2.object({
|
|
175
|
+
artifactId: nonEmptyString,
|
|
176
|
+
name: z2.string().optional(),
|
|
177
|
+
mimeType: nonEmptyString,
|
|
178
|
+
uri: nonEmptyString
|
|
179
|
+
}).strict();
|
|
180
|
+
var PartSchema = z2.discriminatedUnion("type", [
|
|
181
|
+
z2.object({ type: z2.literal("text"), text: z2.string() }).strict(),
|
|
182
|
+
z2.object({ type: z2.literal("file"), file: ArtifactRefSchema }).strict(),
|
|
183
|
+
z2.object({ type: z2.literal("data"), mimeType: nonEmptyString, data: z2.unknown() }).strict()
|
|
184
|
+
]);
|
|
185
|
+
var AgentMessageSchema = z2.object({
|
|
186
|
+
role: z2.enum(["consumer", "agent"]),
|
|
187
|
+
parts: z2.array(PartSchema),
|
|
188
|
+
ts: nonEmptyString
|
|
189
|
+
}).strict();
|
|
190
|
+
var AgentTaskSchema = z2.object({
|
|
191
|
+
id: nonEmptyString,
|
|
192
|
+
contextId: nonEmptyString,
|
|
193
|
+
state: TaskStateSchema,
|
|
194
|
+
messages: z2.array(AgentMessageSchema),
|
|
195
|
+
artifacts: z2.array(ArtifactRefSchema),
|
|
196
|
+
principal: PrincipalRefSchema,
|
|
197
|
+
actor: AgentRefSchema.optional(),
|
|
198
|
+
schemaVersion: z2.literal("1"),
|
|
199
|
+
createdAt: nonEmptyString,
|
|
200
|
+
updatedAt: nonEmptyString
|
|
201
|
+
}).strict();
|
|
202
|
+
function formatIssuePath(path) {
|
|
203
|
+
if (path.length === 0) return "<root>";
|
|
204
|
+
return path.reduce(
|
|
205
|
+
(result, part) => typeof part === "number" ? `${result}[${part}]` : result.length === 0 ? String(part) : `${result}.${String(part)}`,
|
|
206
|
+
""
|
|
207
|
+
);
|
|
208
|
+
}
|
|
209
|
+
function schemaMismatchIssues(issues) {
|
|
210
|
+
return issues.map((issue) => {
|
|
211
|
+
const field = formatIssuePath(issue.path);
|
|
212
|
+
return {
|
|
213
|
+
code: AgentConsumptionErrorCode.enum.AGENT_CONSUMPTION_SCHEMA_MISMATCH,
|
|
214
|
+
field,
|
|
215
|
+
message: field === "<root>" ? issue.message : `${field} ${issue.message}`
|
|
216
|
+
};
|
|
217
|
+
});
|
|
218
|
+
}
|
|
219
|
+
function validateAgentTask(raw) {
|
|
220
|
+
const result = AgentTaskSchema.safeParse(raw);
|
|
221
|
+
if (!result.success) {
|
|
222
|
+
return { valid: false, issues: schemaMismatchIssues(result.error.issues) };
|
|
223
|
+
}
|
|
224
|
+
return { valid: true, value: result.data };
|
|
225
|
+
}
|
|
226
|
+
var AgentConsumptionValidationError = class extends Error {
|
|
227
|
+
code = ErrorCode.enum.CONFIG_INVALID;
|
|
228
|
+
field;
|
|
229
|
+
validationCode;
|
|
230
|
+
constructor(issue) {
|
|
231
|
+
super(issue.message);
|
|
232
|
+
this.name = "AgentConsumptionValidationError";
|
|
233
|
+
this.field = issue.field;
|
|
234
|
+
this.validationCode = issue.code;
|
|
235
|
+
}
|
|
236
|
+
};
|
|
237
|
+
var ConsumptionGuardsSchema = z2.object({
|
|
238
|
+
maxDepth: z2.number().int().positive(),
|
|
239
|
+
inputRequiredTimeoutMs: z2.number().int().positive()
|
|
240
|
+
}).strict();
|
|
241
|
+
function validateConsumptionGuards(raw) {
|
|
242
|
+
const result = ConsumptionGuardsSchema.safeParse(raw);
|
|
243
|
+
if (!result.success) {
|
|
244
|
+
return { valid: false, issues: schemaMismatchIssues(result.error.issues) };
|
|
245
|
+
}
|
|
246
|
+
return { valid: true, value: result.data };
|
|
247
|
+
}
|
|
248
|
+
function detectConsumptionCycle(chain, next) {
|
|
249
|
+
return chain.some((ref) => agentRefEquals(ref, next));
|
|
250
|
+
}
|
|
251
|
+
function assertNoConsumptionCycle(chain, next) {
|
|
252
|
+
if (detectConsumptionCycle(chain, next)) {
|
|
253
|
+
const label = next.deploymentId ? `${next.agentId}@${next.deploymentId}` : next.agentId;
|
|
254
|
+
throw new AgentConsumptionValidationError({
|
|
255
|
+
code: AgentConsumptionErrorCode.enum.AGENT_CONSUMPTION_CYCLE_DETECTED,
|
|
256
|
+
field: "actor",
|
|
257
|
+
message: `consumption cycle detected: agent '${label}' already present in the delegation chain`
|
|
258
|
+
});
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
function isWithinConsumptionDepth(chain, guards) {
|
|
262
|
+
return chain.length < guards.maxDepth;
|
|
263
|
+
}
|
|
264
|
+
function assertWithinConsumptionDepth(chain, guards) {
|
|
265
|
+
if (!isWithinConsumptionDepth(chain, guards)) {
|
|
266
|
+
throw new AgentConsumptionValidationError({
|
|
267
|
+
code: AgentConsumptionErrorCode.enum.AGENT_CONSUMPTION_DEPTH_EXCEEDED,
|
|
268
|
+
field: "depth",
|
|
269
|
+
message: `consumption depth exceeded: chain length ${chain.length} >= max depth ${guards.maxDepth}`
|
|
270
|
+
});
|
|
271
|
+
}
|
|
272
|
+
}
|
|
127
273
|
export {
|
|
128
274
|
AGENT_NOT_IMPLEMENTED_UNTIL_T1,
|
|
275
|
+
AgentConsumptionErrorCode,
|
|
276
|
+
AgentConsumptionValidationError,
|
|
129
277
|
AgentDefinitionErrorCode,
|
|
130
278
|
AgentDefinitionValidationError,
|
|
131
279
|
AgentDeploymentErrorCode,
|
|
132
280
|
AgentDeploymentValidationError,
|
|
281
|
+
AgentMessageSchema,
|
|
133
282
|
AgentNotImplementedError,
|
|
283
|
+
AgentRefSchema,
|
|
284
|
+
AgentTaskSchema,
|
|
134
285
|
ApiErrorPayloadSchema,
|
|
135
286
|
ApiErrorResponseSchema,
|
|
287
|
+
ArtifactRefSchema,
|
|
136
288
|
BoringChatMessageSchema,
|
|
137
289
|
BoringChatPartSchema,
|
|
138
290
|
ChatAttachmentPayloadSchema,
|
|
@@ -140,6 +292,7 @@ export {
|
|
|
140
292
|
ChatModelSelectionSchema,
|
|
141
293
|
CommandReceiptSchema,
|
|
142
294
|
ConfigSchema,
|
|
295
|
+
ConsumptionGuardsSchema,
|
|
143
296
|
DEFAULT_AGENT_RUNTIME_CAPABILITIES,
|
|
144
297
|
ERROR_CODES,
|
|
145
298
|
EnvSchema,
|
|
@@ -150,11 +303,13 @@ export {
|
|
|
150
303
|
InterruptPayloadSchema,
|
|
151
304
|
OpaqueRefSchema,
|
|
152
305
|
PI_AGENT_RUNTIME_CAPABILITIES,
|
|
306
|
+
PartSchema,
|
|
153
307
|
PiChatEventSchema,
|
|
154
308
|
PiChatHeartbeatFrameSchema,
|
|
155
309
|
PiChatSnapshotSchema,
|
|
156
310
|
PiChatStatusSchema,
|
|
157
311
|
PiChatStreamFrameSchema,
|
|
312
|
+
PrincipalRefSchema,
|
|
158
313
|
PromptPayloadSchema,
|
|
159
314
|
PromptReceiptSchema,
|
|
160
315
|
QueueClearPayloadSchema,
|
|
@@ -164,21 +319,32 @@ export {
|
|
|
164
319
|
Sha256DigestSchema,
|
|
165
320
|
StopPayloadSchema,
|
|
166
321
|
StopReceiptSchema,
|
|
322
|
+
TASK_STATES,
|
|
323
|
+
TaskStateSchema,
|
|
167
324
|
ThinkingLevelSchema,
|
|
168
325
|
ToolUiMetadataSchema,
|
|
169
326
|
WORKSPACE_AGENT_PLUGINS_RELOADED_EVENT,
|
|
170
327
|
WORKSPACE_COMMAND_NOTIFY_EVENT,
|
|
328
|
+
agentRefEquals,
|
|
329
|
+
assertNoConsumptionCycle,
|
|
330
|
+
assertValidTransition,
|
|
331
|
+
assertWithinConsumptionDepth,
|
|
171
332
|
createAgentAssetDigest,
|
|
172
333
|
createAgentDefinitionDigest,
|
|
173
334
|
createAgentDeploymentDigest,
|
|
335
|
+
detectConsumptionCycle,
|
|
174
336
|
extractToolUiMetadata,
|
|
175
337
|
isToolUiMetadata,
|
|
338
|
+
isValidTaskTransition,
|
|
339
|
+
isWithinConsumptionDepth,
|
|
176
340
|
noopTelemetry,
|
|
177
341
|
safeCapture,
|
|
178
342
|
sanitizeToolUiMetadata,
|
|
179
343
|
sessionStreamPath,
|
|
180
344
|
validateAgentDefinition,
|
|
181
345
|
validateAgentDeployment,
|
|
346
|
+
validateAgentTask,
|
|
182
347
|
validateConfig,
|
|
348
|
+
validateConsumptionGuards,
|
|
183
349
|
validateTool
|
|
184
350
|
};
|
package/dist/{workspaceAgentDispatcher-Wi6NIh2G.d.ts → workspaceAgentDispatcher-BbNd3y7u.d.ts}
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
import {
|
|
3
|
-
import { p as AgentSendInput, j as AgentEvent } from './harness-
|
|
2
|
+
import { p as AgentDefinitionErrorCode, q as AgentDeploymentErrorCode, D as InterruptReceipt, i as StopReceipt } from './piChatEvent-DtqYMcID.js';
|
|
3
|
+
import { p as AgentSendInput, j as AgentEvent } from './harness-If4r1n-K.js';
|
|
4
4
|
|
|
5
5
|
interface SandboxHandleRecord {
|
|
6
6
|
workspaceId: string;
|
|
@@ -146,4 +146,4 @@ interface WorkspaceAgentDispatcher {
|
|
|
146
146
|
stop(sessionId: string): Promise<StopReceipt>;
|
|
147
147
|
}
|
|
148
148
|
|
|
149
|
-
export { type AgentDeployment as A, type CompiledAgentBundle as C, type FileSearch as F, OpaqueRefSchema as O, type PluginRestartWarning as P, type SandboxHandleStore as S, type WorkspaceAgentDispatcherContext as W, type SandboxHandleRecord as a, type Sha256Digest as b, type WorkspaceAgentDispatcher as c, type
|
|
149
|
+
export { type AgentDeployment as A, type CompiledAgentBundle as C, type FileSearch as F, OpaqueRefSchema as O, type PluginRestartWarning as P, type SandboxHandleStore as S, type WorkspaceAgentDispatcherContext as W, type SandboxHandleRecord as a, type Sha256Digest as b, type WorkspaceAgentDispatcher as c, type AgentSchemaIssue as d, type AgentSchemaValidationResult as e, type AgentDefinition as f, type AgentDefinitionDigestAsset as g, type AgentDefinitionReference as h, AgentDefinitionValidationError as i, AgentDeploymentValidationError as j, type CommandNotifyPayload as k, type CompiledAgentDefinition as l, Sha256DigestSchema as m, WORKSPACE_AGENT_PLUGINS_RELOADED_EVENT as n, WORKSPACE_COMMAND_NOTIFY_EVENT as o, type WorkspaceAgentDispatcherSendInput as p, createAgentAssetDigest as q, createAgentDefinitionDigest as r, createAgentDeploymentDigest as s, validateAgentDeployment as t, validateAgentDefinition as v };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hachej/boring-agent",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.81",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"description": "Pane-embeddable coding agent. Ships direct/local/vercel-sandbox execution modes behind one interface.",
|
|
@@ -84,7 +84,7 @@
|
|
|
84
84
|
"use-stick-to-bottom": "^1.1.6",
|
|
85
85
|
"yaml": "^2.9.0",
|
|
86
86
|
"zod": "^3.25.76",
|
|
87
|
-
"@hachej/boring-ui-kit": "0.1.
|
|
87
|
+
"@hachej/boring-ui-kit": "0.1.81"
|
|
88
88
|
},
|
|
89
89
|
"devDependencies": {
|
|
90
90
|
"@antithesishq/bombadil": "0.6.1",
|