@hachej/boring-agent 0.1.83 → 0.1.85
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-DC3S7SZG.js → chunk-6O5ADR57.js} +1 -1
- package/dist/{chunk-PG2WOJ22.js → chunk-HDIRWHJB.js} +5 -1
- package/dist/{chunk-7V3E6KHX.js → chunk-HY7EERLW.js} +279 -30
- package/dist/{chunk-TNN3LPXE.js → chunk-LYBTHR7J.js} +68 -3
- package/dist/{chunk-WODTQBXR.js → chunk-YONTHCD7.js} +108 -2
- package/dist/{chunk-5NAN3TAR.js → chunk-ZUDWQAAB.js} +1 -1
- package/dist/core/index.d.ts +7 -51
- package/dist/core/index.js +10 -4
- package/dist/{createHarness-TGBJZISM.js → createHarness-MJ5GEL6J.js} +2 -2
- package/dist/front/index.d.ts +1 -1
- package/dist/front/index.js +2 -2
- package/dist/{harness-C53mjCcq.d.ts → harness-RhGbdGWY.d.ts} +1 -1
- package/dist/{piChatEvent-3pFPXYPx.d.ts → piChatEvent-CUTKRaZD.d.ts} +15 -15
- package/dist/piChatSessionService-iBtx32ya.d.ts +67 -0
- package/dist/server/index.d.ts +47 -5
- package/dist/server/index.js +12 -8
- package/dist/server/worker/index.js +6 -6
- package/dist/shared/index.d.ts +86 -38
- package/dist/shared/index.js +96 -5
- package/dist/workspaceAgentDispatcher-Dv0DocrE.d.ts +314 -0
- package/docs/ERROR_CODES.md +2 -0
- package/package.json +2 -2
- package/dist/workspaceAgentDispatcher-p4tlVvbM.d.ts +0 -151
package/dist/shared/index.js
CHANGED
|
@@ -1,17 +1,24 @@
|
|
|
1
1
|
import {
|
|
2
2
|
AgentDefinitionValidationError,
|
|
3
3
|
AgentDeploymentValidationError,
|
|
4
|
+
InMemoryShareEntryStore,
|
|
4
5
|
OpaqueRefSchema,
|
|
6
|
+
OpaqueShareLocatorIdSchema,
|
|
5
7
|
SchemaValidationError,
|
|
6
8
|
Sha256DigestSchema,
|
|
9
|
+
ShareEntryErrorCode,
|
|
10
|
+
ShareEntryProvenanceSchema,
|
|
11
|
+
ShareEntryV1Schema,
|
|
12
|
+
ShareEntryValidationError,
|
|
7
13
|
createAgentAssetDigest,
|
|
8
14
|
createAgentDefinitionDigest,
|
|
9
15
|
createAgentDeploymentDigest,
|
|
10
16
|
formatPath,
|
|
17
|
+
resolveShareEntry,
|
|
11
18
|
validateAgentDefinition,
|
|
12
19
|
validateAgentDeployment,
|
|
13
20
|
validateTool
|
|
14
|
-
} from "../chunk-
|
|
21
|
+
} from "../chunk-YONTHCD7.js";
|
|
15
22
|
import {
|
|
16
23
|
AGENT_NOT_IMPLEMENTED_UNTIL_T1,
|
|
17
24
|
AgentNotImplementedError,
|
|
@@ -48,7 +55,7 @@ import {
|
|
|
48
55
|
extractToolUiMetadata,
|
|
49
56
|
isToolUiMetadata,
|
|
50
57
|
sanitizeToolUiMetadata2 as sanitizeToolUiMetadata
|
|
51
|
-
} from "../chunk-
|
|
58
|
+
} from "../chunk-6O5ADR57.js";
|
|
52
59
|
import {
|
|
53
60
|
noopTelemetry,
|
|
54
61
|
safeCapture
|
|
@@ -62,7 +69,7 @@ import {
|
|
|
62
69
|
ERROR_CODES,
|
|
63
70
|
ErrorCode,
|
|
64
71
|
ErrorLogFieldsSchema
|
|
65
|
-
} from "../chunk-
|
|
72
|
+
} from "../chunk-HDIRWHJB.js";
|
|
66
73
|
|
|
67
74
|
// src/shared/config-schema.ts
|
|
68
75
|
import { z } from "zod";
|
|
@@ -131,6 +138,10 @@ var PI_AGENT_RUNTIME_CAPABILITIES = {
|
|
|
131
138
|
// src/shared/agent-consumption.ts
|
|
132
139
|
import { z as z2 } from "zod";
|
|
133
140
|
var nonEmptyString = z2.string().min(1);
|
|
141
|
+
function isOpaqueLocatorId(value) {
|
|
142
|
+
return value.trim() === value && !/[\0-\x1f\x7f]/.test(value) && !value.includes("/") && !value.includes("\\") && !value.includes(":") && value !== "." && value !== "..";
|
|
143
|
+
}
|
|
144
|
+
var OpaqueLocatorIdSchema = z2.string().min(1, "must be a non-empty opaque id").max(256, "must be at most 256 characters").refine(isOpaqueLocatorId, 'must be an opaque platform-owned id (no path separators, scheme, or "..")');
|
|
134
145
|
var TASK_STATES = [
|
|
135
146
|
"submitted",
|
|
136
147
|
"working",
|
|
@@ -173,11 +184,19 @@ var AgentRefSchema = z2.object({
|
|
|
173
184
|
function agentRefEquals(a, b) {
|
|
174
185
|
return a.agentId === b.agentId && (a.deploymentId ?? null) === (b.deploymentId ?? null);
|
|
175
186
|
}
|
|
187
|
+
var ARTIFACT_LOCATOR_KINDS = ["workspace-file"];
|
|
188
|
+
var WorkspaceFileLocatorSchema = z2.object({
|
|
189
|
+
kind: z2.literal("workspace-file"),
|
|
190
|
+
workspaceId: OpaqueLocatorIdSchema,
|
|
191
|
+
fileId: OpaqueLocatorIdSchema,
|
|
192
|
+
digest: Sha256DigestSchema
|
|
193
|
+
}).strict();
|
|
194
|
+
var ArtifactLocatorSchema = z2.discriminatedUnion("kind", [WorkspaceFileLocatorSchema]);
|
|
176
195
|
var ArtifactRefSchema = z2.object({
|
|
177
196
|
artifactId: nonEmptyString,
|
|
178
197
|
name: z2.string().optional(),
|
|
179
198
|
mimeType: nonEmptyString,
|
|
180
|
-
|
|
199
|
+
locator: ArtifactLocatorSchema
|
|
181
200
|
}).strict();
|
|
182
201
|
var PartSchema = z2.discriminatedUnion("type", [
|
|
183
202
|
z2.object({ type: z2.literal("text"), text: z2.string() }).strict(),
|
|
@@ -189,6 +208,7 @@ var AgentMessageSchema = z2.object({
|
|
|
189
208
|
parts: z2.array(PartSchema),
|
|
190
209
|
ts: nonEmptyString
|
|
191
210
|
}).strict();
|
|
211
|
+
var AGENT_TASK_SCHEMA_VERSION = "2";
|
|
192
212
|
var AgentTaskSchema = z2.object({
|
|
193
213
|
id: nonEmptyString,
|
|
194
214
|
contextId: nonEmptyString,
|
|
@@ -197,7 +217,7 @@ var AgentTaskSchema = z2.object({
|
|
|
197
217
|
artifacts: z2.array(ArtifactRefSchema),
|
|
198
218
|
principal: PrincipalRefSchema,
|
|
199
219
|
actor: AgentRefSchema.optional(),
|
|
200
|
-
schemaVersion: z2.literal(
|
|
220
|
+
schemaVersion: z2.literal(AGENT_TASK_SCHEMA_VERSION),
|
|
201
221
|
createdAt: nonEmptyString,
|
|
202
222
|
updatedAt: nonEmptyString
|
|
203
223
|
}).strict();
|
|
@@ -224,6 +244,65 @@ var AgentConsumptionValidationError = class extends SchemaValidationError {
|
|
|
224
244
|
this.name = "AgentConsumptionValidationError";
|
|
225
245
|
}
|
|
226
246
|
};
|
|
247
|
+
var LegacyArtifactRefSchema = z2.object({
|
|
248
|
+
artifactId: nonEmptyString,
|
|
249
|
+
name: z2.string().optional(),
|
|
250
|
+
mimeType: nonEmptyString,
|
|
251
|
+
uri: nonEmptyString
|
|
252
|
+
}).strict();
|
|
253
|
+
var LegacyPartSchema = z2.discriminatedUnion("type", [
|
|
254
|
+
z2.object({ type: z2.literal("text"), text: z2.string() }).strict(),
|
|
255
|
+
z2.object({ type: z2.literal("file"), file: LegacyArtifactRefSchema }).strict(),
|
|
256
|
+
z2.object({ type: z2.literal("data"), mimeType: nonEmptyString, data: z2.unknown() }).strict()
|
|
257
|
+
]);
|
|
258
|
+
var LegacyAgentMessageSchema = z2.object({
|
|
259
|
+
role: z2.enum(["consumer", "agent"]),
|
|
260
|
+
parts: z2.array(LegacyPartSchema),
|
|
261
|
+
ts: nonEmptyString
|
|
262
|
+
}).strict();
|
|
263
|
+
var LegacyAgentTaskSchema = z2.object({
|
|
264
|
+
id: nonEmptyString,
|
|
265
|
+
contextId: nonEmptyString,
|
|
266
|
+
state: TaskStateSchema,
|
|
267
|
+
messages: z2.array(LegacyAgentMessageSchema),
|
|
268
|
+
artifacts: z2.array(LegacyArtifactRefSchema),
|
|
269
|
+
principal: PrincipalRefSchema,
|
|
270
|
+
actor: AgentRefSchema.optional(),
|
|
271
|
+
schemaVersion: z2.literal("1"),
|
|
272
|
+
createdAt: nonEmptyString,
|
|
273
|
+
updatedAt: nonEmptyString
|
|
274
|
+
}).strict();
|
|
275
|
+
function collectLegacyArtifactUris(raw) {
|
|
276
|
+
const uris = [];
|
|
277
|
+
for (const artifact of raw.artifacts) uris.push(artifact.uri);
|
|
278
|
+
for (const message of raw.messages) {
|
|
279
|
+
for (const part of message.parts) {
|
|
280
|
+
if (part.type === "file") uris.push(part.file.uri);
|
|
281
|
+
}
|
|
282
|
+
}
|
|
283
|
+
return uris;
|
|
284
|
+
}
|
|
285
|
+
function parseAgentTaskEdgeCompat(raw) {
|
|
286
|
+
const v2 = AgentTaskSchema.safeParse(raw);
|
|
287
|
+
if (v2.success) return { valid: true, value: v2.data };
|
|
288
|
+
const legacy = LegacyAgentTaskSchema.safeParse(raw);
|
|
289
|
+
if (legacy.success) {
|
|
290
|
+
const uris = collectLegacyArtifactUris(legacy.data);
|
|
291
|
+
const issues = uris.length > 0 ? uris.map((uri, index) => ({
|
|
292
|
+
code: AgentConsumptionErrorCode.enum.AGENT_CONSUMPTION_LEGACY_ARTIFACT_REJECTED,
|
|
293
|
+
field: `artifacts[${index}].uri`,
|
|
294
|
+
message: `schemaVersion '1' artifact uri '${uri}' has no typed ArtifactLocator translation and is refused before any storage/network effect`
|
|
295
|
+
})) : [
|
|
296
|
+
{
|
|
297
|
+
code: AgentConsumptionErrorCode.enum.AGENT_CONSUMPTION_LEGACY_ARTIFACT_REJECTED,
|
|
298
|
+
field: "schemaVersion",
|
|
299
|
+
message: "schemaVersion '1' is no longer accepted; publish schemaVersion '2' with a typed ArtifactLocator"
|
|
300
|
+
}
|
|
301
|
+
];
|
|
302
|
+
return { valid: false, issues };
|
|
303
|
+
}
|
|
304
|
+
return { valid: false, issues: schemaMismatchIssues(v2.error.issues) };
|
|
305
|
+
}
|
|
227
306
|
var ConsumptionGuardsSchema = z2.object({
|
|
228
307
|
maxDepth: z2.number().int().positive(),
|
|
229
308
|
inputRequiredTimeoutMs: z2.number().int().positive()
|
|
@@ -262,6 +341,8 @@ function assertWithinConsumptionDepth(chain, guards) {
|
|
|
262
341
|
}
|
|
263
342
|
export {
|
|
264
343
|
AGENT_NOT_IMPLEMENTED_UNTIL_T1,
|
|
344
|
+
AGENT_TASK_SCHEMA_VERSION,
|
|
345
|
+
ARTIFACT_LOCATOR_KINDS,
|
|
265
346
|
AgentConsumptionErrorCode,
|
|
266
347
|
AgentConsumptionValidationError,
|
|
267
348
|
AgentDefinitionErrorCode,
|
|
@@ -274,6 +355,7 @@ export {
|
|
|
274
355
|
AgentTaskSchema,
|
|
275
356
|
ApiErrorPayloadSchema,
|
|
276
357
|
ApiErrorResponseSchema,
|
|
358
|
+
ArtifactLocatorSchema,
|
|
277
359
|
ArtifactRefSchema,
|
|
278
360
|
BoringChatMessageSchema,
|
|
279
361
|
BoringChatPartSchema,
|
|
@@ -290,8 +372,10 @@ export {
|
|
|
290
372
|
ErrorLogFieldsSchema,
|
|
291
373
|
FollowUpPayloadSchema,
|
|
292
374
|
FollowUpReceiptSchema,
|
|
375
|
+
InMemoryShareEntryStore,
|
|
293
376
|
InterruptPayloadSchema,
|
|
294
377
|
OpaqueRefSchema,
|
|
378
|
+
OpaqueShareLocatorIdSchema,
|
|
295
379
|
PI_AGENT_RUNTIME_CAPABILITIES,
|
|
296
380
|
PartSchema,
|
|
297
381
|
PiChatEventSchema,
|
|
@@ -307,6 +391,10 @@ export {
|
|
|
307
391
|
QueuedUserMessageSchema,
|
|
308
392
|
RuntimeModeSchema,
|
|
309
393
|
Sha256DigestSchema,
|
|
394
|
+
ShareEntryErrorCode,
|
|
395
|
+
ShareEntryProvenanceSchema,
|
|
396
|
+
ShareEntryV1Schema,
|
|
397
|
+
ShareEntryValidationError,
|
|
310
398
|
StopPayloadSchema,
|
|
311
399
|
StopReceiptSchema,
|
|
312
400
|
TASK_STATES,
|
|
@@ -315,6 +403,7 @@ export {
|
|
|
315
403
|
ToolUiMetadataSchema,
|
|
316
404
|
WORKSPACE_AGENT_PLUGINS_RELOADED_EVENT,
|
|
317
405
|
WORKSPACE_COMMAND_NOTIFY_EVENT,
|
|
406
|
+
WorkspaceFileLocatorSchema,
|
|
318
407
|
agentRefEquals,
|
|
319
408
|
assertNoConsumptionCycle,
|
|
320
409
|
assertValidTransition,
|
|
@@ -328,6 +417,8 @@ export {
|
|
|
328
417
|
isValidTaskTransition,
|
|
329
418
|
isWithinConsumptionDepth,
|
|
330
419
|
noopTelemetry,
|
|
420
|
+
parseAgentTaskEdgeCompat,
|
|
421
|
+
resolveShareEntry,
|
|
331
422
|
safeCapture,
|
|
332
423
|
sanitizeToolUiMetadata,
|
|
333
424
|
sessionStreamPath,
|
|
@@ -0,0 +1,314 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { p as AgentDefinitionErrorCode, q as AgentDeploymentErrorCode, D as InterruptReceipt, j as StopReceipt } from './piChatEvent-CUTKRaZD.js';
|
|
3
|
+
import { a as Workspace } from './sandbox-DthfJaOB.js';
|
|
4
|
+
import { p as AgentSendInput, j as AgentEvent } from './harness-RhGbdGWY.js';
|
|
5
|
+
|
|
6
|
+
interface SandboxHandleRecord {
|
|
7
|
+
workspaceId: string;
|
|
8
|
+
sandboxId: string;
|
|
9
|
+
snapshotId?: string;
|
|
10
|
+
createdAt: string;
|
|
11
|
+
lastUsedAt: string;
|
|
12
|
+
}
|
|
13
|
+
interface SandboxHandleStore {
|
|
14
|
+
get(workspaceId: string): Promise<SandboxHandleRecord | null>;
|
|
15
|
+
put(record: SandboxHandleRecord): Promise<void>;
|
|
16
|
+
delete(workspaceId: string): Promise<void>;
|
|
17
|
+
list(): Promise<SandboxHandleRecord[]>;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
interface FileSearch {
|
|
21
|
+
search(glob: string, limit?: number): Promise<string[]>;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
type Sha256Digest = `sha256:${string}`;
|
|
25
|
+
|
|
26
|
+
interface AgentSchemaIssue<Code extends string> {
|
|
27
|
+
code: Code;
|
|
28
|
+
field: string;
|
|
29
|
+
message: string;
|
|
30
|
+
}
|
|
31
|
+
type AgentSchemaValidationResult<T, Code extends string> = {
|
|
32
|
+
valid: true;
|
|
33
|
+
value: T;
|
|
34
|
+
} | {
|
|
35
|
+
valid: false;
|
|
36
|
+
issues: AgentSchemaIssue<Code>[];
|
|
37
|
+
};
|
|
38
|
+
declare abstract class SchemaValidationError<Code extends string> extends Error {
|
|
39
|
+
readonly code: "CONFIG_INVALID";
|
|
40
|
+
readonly field: string;
|
|
41
|
+
readonly validationCode: Code;
|
|
42
|
+
constructor(issue: AgentSchemaIssue<Code>);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
interface AgentDefinition {
|
|
46
|
+
schemaVersion: 1;
|
|
47
|
+
definitionId: string;
|
|
48
|
+
version: string;
|
|
49
|
+
label?: string;
|
|
50
|
+
instructionsRef: string;
|
|
51
|
+
capabilityRequirements?: string[];
|
|
52
|
+
toolRefs?: string[];
|
|
53
|
+
skillRefs?: string[];
|
|
54
|
+
mcpServerRefs?: string[];
|
|
55
|
+
}
|
|
56
|
+
interface AgentDefinitionReference {
|
|
57
|
+
definitionId: string;
|
|
58
|
+
version: string;
|
|
59
|
+
digest: Sha256Digest;
|
|
60
|
+
}
|
|
61
|
+
interface AgentDeployment {
|
|
62
|
+
deploymentId: string;
|
|
63
|
+
version: string;
|
|
64
|
+
agentId: string;
|
|
65
|
+
definition: AgentDefinitionReference;
|
|
66
|
+
}
|
|
67
|
+
interface AgentDefinitionDigestAsset {
|
|
68
|
+
path: string;
|
|
69
|
+
digest: Sha256Digest;
|
|
70
|
+
content: string;
|
|
71
|
+
}
|
|
72
|
+
type CompiledAgentDefinition = {
|
|
73
|
+
readonly [Key in keyof AgentDefinition]: AgentDefinition[Key] extends readonly string[] | undefined ? readonly string[] | undefined : AgentDefinition[Key];
|
|
74
|
+
};
|
|
75
|
+
interface CompiledAgentBundle {
|
|
76
|
+
readonly definition: CompiledAgentDefinition;
|
|
77
|
+
readonly definitionDigest: Sha256Digest;
|
|
78
|
+
readonly assets: readonly Readonly<AgentDefinitionDigestAsset>[];
|
|
79
|
+
}
|
|
80
|
+
declare const OpaqueRefSchema: z.ZodEffects<z.ZodString, string, string>;
|
|
81
|
+
declare const Sha256DigestSchema: z.ZodEffects<z.ZodString, `sha256:${string}`, string>;
|
|
82
|
+
declare function validateAgentDefinition(raw: unknown): AgentSchemaValidationResult<AgentDefinition, AgentDefinitionErrorCode>;
|
|
83
|
+
declare function validateAgentDeployment(raw: unknown): AgentSchemaValidationResult<AgentDeployment, AgentDeploymentErrorCode>;
|
|
84
|
+
declare function createAgentAssetDigest(content: string): Promise<Sha256Digest>;
|
|
85
|
+
declare class AgentDefinitionValidationError extends SchemaValidationError<AgentDefinitionErrorCode> {
|
|
86
|
+
constructor(issue: AgentSchemaIssue<AgentDefinitionErrorCode>);
|
|
87
|
+
}
|
|
88
|
+
declare class AgentDeploymentValidationError extends SchemaValidationError<AgentDeploymentErrorCode> {
|
|
89
|
+
constructor(issue: AgentSchemaIssue<AgentDeploymentErrorCode>);
|
|
90
|
+
}
|
|
91
|
+
declare function createAgentDefinitionDigest(input: {
|
|
92
|
+
definition: CompiledAgentDefinition;
|
|
93
|
+
assets: readonly AgentDefinitionDigestAsset[];
|
|
94
|
+
}): Promise<Sha256Digest>;
|
|
95
|
+
declare function createAgentDeploymentDigest(deployment: AgentDeployment): Promise<Sha256Digest>;
|
|
96
|
+
|
|
97
|
+
declare const OpaqueShareLocatorIdSchema: z.ZodEffects<z.ZodString, string, string>;
|
|
98
|
+
interface ShareEntryProvenance {
|
|
99
|
+
producerPrincipalRef: string;
|
|
100
|
+
createdAt: string;
|
|
101
|
+
}
|
|
102
|
+
declare const ShareEntryProvenanceSchema: z.ZodObject<{
|
|
103
|
+
producerPrincipalRef: z.ZodString;
|
|
104
|
+
createdAt: z.ZodString;
|
|
105
|
+
}, "strict", z.ZodTypeAny, {
|
|
106
|
+
createdAt: string;
|
|
107
|
+
producerPrincipalRef: string;
|
|
108
|
+
}, {
|
|
109
|
+
createdAt: string;
|
|
110
|
+
producerPrincipalRef: string;
|
|
111
|
+
}>;
|
|
112
|
+
/**
|
|
113
|
+
* Lane W same-workspace share entry (AR1-001-SPEC.md §3.1): a live reference
|
|
114
|
+
* to a file in the SAME workspace the consumer already belongs to. No blob
|
|
115
|
+
* capture — nothing crosses a workspace boundary. `path` is SERVER-INTERNAL
|
|
116
|
+
* and MUST NOT be emitted in any URL/API/audit surface a later bead builds.
|
|
117
|
+
*/
|
|
118
|
+
interface ShareEntryV1 {
|
|
119
|
+
schemaVersion: 1;
|
|
120
|
+
id: string;
|
|
121
|
+
workspaceId: string;
|
|
122
|
+
/** SERVER-INTERNAL live path; never emitted in URL/API/audit. */
|
|
123
|
+
path: string;
|
|
124
|
+
provenance: ShareEntryProvenance;
|
|
125
|
+
}
|
|
126
|
+
declare const ShareEntryV1Schema: z.ZodObject<{
|
|
127
|
+
schemaVersion: z.ZodLiteral<1>;
|
|
128
|
+
id: z.ZodEffects<z.ZodString, string, string>;
|
|
129
|
+
workspaceId: z.ZodEffects<z.ZodString, string, string>;
|
|
130
|
+
path: z.ZodString;
|
|
131
|
+
provenance: z.ZodObject<{
|
|
132
|
+
producerPrincipalRef: z.ZodString;
|
|
133
|
+
createdAt: z.ZodString;
|
|
134
|
+
}, "strict", z.ZodTypeAny, {
|
|
135
|
+
createdAt: string;
|
|
136
|
+
producerPrincipalRef: string;
|
|
137
|
+
}, {
|
|
138
|
+
createdAt: string;
|
|
139
|
+
producerPrincipalRef: string;
|
|
140
|
+
}>;
|
|
141
|
+
}, "strict", z.ZodTypeAny, {
|
|
142
|
+
path: string;
|
|
143
|
+
id: string;
|
|
144
|
+
workspaceId: string;
|
|
145
|
+
schemaVersion: 1;
|
|
146
|
+
provenance: {
|
|
147
|
+
createdAt: string;
|
|
148
|
+
producerPrincipalRef: string;
|
|
149
|
+
};
|
|
150
|
+
}, {
|
|
151
|
+
path: string;
|
|
152
|
+
id: string;
|
|
153
|
+
workspaceId: string;
|
|
154
|
+
schemaVersion: 1;
|
|
155
|
+
provenance: {
|
|
156
|
+
createdAt: string;
|
|
157
|
+
producerPrincipalRef: string;
|
|
158
|
+
};
|
|
159
|
+
}>;
|
|
160
|
+
/**
|
|
161
|
+
* Refusal codes for Lane W share resolution (AR1-001-SPEC.md §3.3/§5).
|
|
162
|
+
* Graduated into the public {@link ErrorCode}/`ERROR_CODES` registry (and
|
|
163
|
+
* `docs/ERROR_CODES.md`) by AR1-003, the first runtime route
|
|
164
|
+
* (`GET /a/:id`, `server/http/routes/deepLink.ts`) that surfaces these over
|
|
165
|
+
* an API boundary — following the same registry precedent used for
|
|
166
|
+
* `MCP_AGENT_ARTIFACT_*` (graduated when `managedAgentDelegate.ts` started
|
|
167
|
+
* surfacing them). These are the ONLY two AR1-specific codes for Lane W:
|
|
168
|
+
* "Access denial is the existing generic membership denial, not an AR1
|
|
169
|
+
* code" (spec §3.3) — this module does not invent a third.
|
|
170
|
+
*/
|
|
171
|
+
declare const ShareEntryErrorCode: z.ZodEnum<["AR1_SHARE_NOT_FOUND", "AR1_SHARE_TOMBSTONED"]>;
|
|
172
|
+
type ShareEntryErrorCode = z.infer<typeof ShareEntryErrorCode>;
|
|
173
|
+
/**
|
|
174
|
+
* Input-validation failures for {@link ShareEntryStore.create}. Deliberately
|
|
175
|
+
* NOT an `AR1_*` code (the spec's §5 table names exactly two Lane W codes for
|
|
176
|
+
* resolution outcomes; this reuses the existing generic `CONFIG_INVALID`
|
|
177
|
+
* taxonomy for malformed create-input, the same way `SchemaValidationError`
|
|
178
|
+
* subclasses elsewhere in this package do).
|
|
179
|
+
*/
|
|
180
|
+
declare const ShareEntryValidationCode: z.ZodEnum<["SHARE_ENTRY_INPUT_INVALID"]>;
|
|
181
|
+
type ShareEntryValidationCode = z.infer<typeof ShareEntryValidationCode>;
|
|
182
|
+
declare class ShareEntryValidationError extends Error {
|
|
183
|
+
readonly code: "CONFIG_INVALID";
|
|
184
|
+
readonly field: string;
|
|
185
|
+
constructor(issue: AgentSchemaIssue<ShareEntryValidationCode>);
|
|
186
|
+
}
|
|
187
|
+
interface CreateShareEntryInput {
|
|
188
|
+
workspaceId: string;
|
|
189
|
+
/** SERVER-INTERNAL live path. Never persist/return this in a public surface. */
|
|
190
|
+
path: string;
|
|
191
|
+
provenance: {
|
|
192
|
+
producerPrincipalRef: string;
|
|
193
|
+
/** Defaults to the store's creation time when omitted. */
|
|
194
|
+
createdAt?: string;
|
|
195
|
+
};
|
|
196
|
+
}
|
|
197
|
+
interface ShareEntryStore {
|
|
198
|
+
/** Validates `input`, mints a fresh opaque `id`, and persists the entry. */
|
|
199
|
+
create(input: CreateShareEntryInput): Promise<ShareEntryV1>;
|
|
200
|
+
get(id: string): Promise<ShareEntryV1 | null>;
|
|
201
|
+
delete(id: string): Promise<void>;
|
|
202
|
+
/** Lists entries scoped to one workspace (never leaks across workspaces). */
|
|
203
|
+
list(workspaceId: string): Promise<ShareEntryV1[]>;
|
|
204
|
+
}
|
|
205
|
+
/**
|
|
206
|
+
* In-memory reference implementation. Lane W has no durability requirement
|
|
207
|
+
* beyond "the repo's existing persistence seam" named by this bead (a simple
|
|
208
|
+
* keyed-record store, mirroring `SandboxHandleStore`/`SessionStore` in this
|
|
209
|
+
* same package) — a durable adapter is a swap-in behind the same interface
|
|
210
|
+
* when a later bead needs one; this store does not invent a new store
|
|
211
|
+
* technology.
|
|
212
|
+
*/
|
|
213
|
+
declare class InMemoryShareEntryStore implements ShareEntryStore {
|
|
214
|
+
private readonly entries;
|
|
215
|
+
create(input: CreateShareEntryInput): Promise<ShareEntryV1>;
|
|
216
|
+
get(id: string): Promise<ShareEntryV1 | null>;
|
|
217
|
+
delete(id: string): Promise<void>;
|
|
218
|
+
list(workspaceId: string): Promise<ShareEntryV1[]>;
|
|
219
|
+
}
|
|
220
|
+
/** Redacted, path-free projection of a tombstoned entry (spec §3.3/§1: no path in any error surface). */
|
|
221
|
+
interface ShareEntryTombstone {
|
|
222
|
+
id: string;
|
|
223
|
+
workspaceId: string;
|
|
224
|
+
provenance: ShareEntryProvenance;
|
|
225
|
+
}
|
|
226
|
+
type ShareEntryResolution = {
|
|
227
|
+
status: 'ok';
|
|
228
|
+
entry: ShareEntryV1;
|
|
229
|
+
} | {
|
|
230
|
+
status: 'not_found';
|
|
231
|
+
code: typeof ShareEntryErrorCode.enum.AR1_SHARE_NOT_FOUND;
|
|
232
|
+
} | {
|
|
233
|
+
status: 'tombstoned';
|
|
234
|
+
code: typeof ShareEntryErrorCode.enum.AR1_SHARE_TOMBSTONED;
|
|
235
|
+
tombstone: ShareEntryTombstone;
|
|
236
|
+
};
|
|
237
|
+
/**
|
|
238
|
+
* Resolves a share entry against the CURRENT state of the workspace file
|
|
239
|
+
* (live-reference semantics, spec §3.2 — deliberately not a snapshot). The
|
|
240
|
+
* caller must already have resolved and authorized `workspace` for
|
|
241
|
+
* `entry.workspaceId`; this function performs no membership check itself
|
|
242
|
+
* (spec §3.3: "Access denial is the existing generic membership denial, not
|
|
243
|
+
* an AR1 code").
|
|
244
|
+
*
|
|
245
|
+
* - No such entry -> `not_found` (`AR1_SHARE_NOT_FOUND`).
|
|
246
|
+
* - Entry exists but the target file is gone -> `tombstoned`
|
|
247
|
+
* (`AR1_SHARE_TOMBSTONED`), carrying provenance + last-known metadata and
|
|
248
|
+
* NEVER the path (never a bare 404, never source state).
|
|
249
|
+
* - Entry exists and the target file stats successfully -> `ok`, with the
|
|
250
|
+
* full (server-internal) entry for the caller to act on.
|
|
251
|
+
*
|
|
252
|
+
* Any `workspace.stat` rejection (not just a "does not exist" error) is
|
|
253
|
+
* treated as "target gone" — the spec's fail-safe is to render a tombstone,
|
|
254
|
+
* never a bare 404; a later bead may narrow this to distinguish stat
|
|
255
|
+
* failure causes if that proves necessary.
|
|
256
|
+
*/
|
|
257
|
+
declare function resolveShareEntry(store: ShareEntryStore, id: string, workspace: Workspace): Promise<ShareEntryResolution>;
|
|
258
|
+
|
|
259
|
+
/**
|
|
260
|
+
* Browser CustomEvent name dispatched on `window` after the workspace's
|
|
261
|
+
* agent-plugin hot reload subscriber commits a registry change (load,
|
|
262
|
+
* unload, or error).
|
|
263
|
+
*
|
|
264
|
+
* Declared in `@hachej/boring-agent` (not `@hachej/boring-workspace`)
|
|
265
|
+
* so the agent's ChatPanel — which listens for this event to refresh
|
|
266
|
+
* its slash-command palette / banner state — can import it without
|
|
267
|
+
* creating a workspace → agent → workspace cycle. Workspace's
|
|
268
|
+
* `useAgentPluginHotReload` imports the same constant.
|
|
269
|
+
*/
|
|
270
|
+
declare const WORKSPACE_AGENT_PLUGINS_RELOADED_EVENT = "boring-ui:agent-plugins-reloaded";
|
|
271
|
+
/**
|
|
272
|
+
* One per plugin that loaded successfully but whose server-side surfaces
|
|
273
|
+
* (Fastify routes / agent tools) still hold pre-reload code. Shared
|
|
274
|
+
* between the agent's /reload HTTP route + the ChatPanel banner so the
|
|
275
|
+
* agent layer has ONE declaration of this wire shape. Mirrors what the
|
|
276
|
+
* workspace's `collectRestartWarnings()` emits (workspace owns the
|
|
277
|
+
* canonical `PluginRestartWarning` type; we redeclare here only because
|
|
278
|
+
* the agent layer must not depend on workspace).
|
|
279
|
+
*/
|
|
280
|
+
interface PluginRestartWarning {
|
|
281
|
+
id: string;
|
|
282
|
+
surfaces: string[];
|
|
283
|
+
message: string;
|
|
284
|
+
}
|
|
285
|
+
/**
|
|
286
|
+
* Browser CustomEvent name dispatched on `window` when a `showNotification`
|
|
287
|
+
* UI command arrives from the server (e.g. from a plugin slash command that
|
|
288
|
+
* calls `notify()`). `PiChatPanel` listens for this to show the
|
|
289
|
+
* `CommandRunStatus` banner above the composer.
|
|
290
|
+
*/
|
|
291
|
+
declare const WORKSPACE_COMMAND_NOTIFY_EVENT = "boring-ui:command-notify";
|
|
292
|
+
/**
|
|
293
|
+
* Payload carried by `WORKSPACE_COMMAND_NOTIFY_EVENT`. Maps directly to
|
|
294
|
+
* what `uiCommandDispatcher` extracts from the `showNotification` command.
|
|
295
|
+
*/
|
|
296
|
+
interface CommandNotifyPayload {
|
|
297
|
+
message: string;
|
|
298
|
+
tone: 'success' | 'error' | 'info' | 'warn';
|
|
299
|
+
/** Name of the command that triggered the notification (without leading slash). */
|
|
300
|
+
command?: string;
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
interface WorkspaceAgentDispatcherContext {
|
|
304
|
+
workspaceId: string;
|
|
305
|
+
userId: string;
|
|
306
|
+
}
|
|
307
|
+
type WorkspaceAgentDispatcherSendInput = Omit<AgentSendInput, 'ctx'>;
|
|
308
|
+
interface WorkspaceAgentDispatcher {
|
|
309
|
+
send(input: WorkspaceAgentDispatcherSendInput): AsyncIterable<AgentEvent>;
|
|
310
|
+
interrupt(sessionId: string): Promise<InterruptReceipt>;
|
|
311
|
+
stop(sessionId: string): Promise<StopReceipt>;
|
|
312
|
+
}
|
|
313
|
+
|
|
314
|
+
export { type AgentDeployment as A, WORKSPACE_COMMAND_NOTIFY_EVENT as B, type CompiledAgentBundle as C, type WorkspaceAgentDispatcherSendInput as D, createAgentAssetDigest as E, type FileSearch as F, createAgentDefinitionDigest as G, createAgentDeploymentDigest as H, InMemoryShareEntryStore as I, resolveShareEntry as J, validateAgentDefinition as K, validateAgentDeployment as L, OpaqueRefSchema as O, type PluginRestartWarning as P, type SandboxHandleStore as S, type WorkspaceAgentDispatcherContext as W, type SandboxHandleRecord as a, type Sha256Digest as b, type ShareEntryStore as c, type WorkspaceAgentDispatcher as d, SchemaValidationError as e, type AgentSchemaIssue as f, type AgentSchemaValidationResult as g, type AgentDefinition as h, type AgentDefinitionDigestAsset as i, type AgentDefinitionReference as j, AgentDefinitionValidationError as k, AgentDeploymentValidationError as l, type CommandNotifyPayload as m, type CompiledAgentDefinition as n, type CreateShareEntryInput as o, OpaqueShareLocatorIdSchema as p, Sha256DigestSchema as q, ShareEntryErrorCode as r, type ShareEntryProvenance as s, ShareEntryProvenanceSchema as t, type ShareEntryResolution as u, type ShareEntryTombstone as v, type ShareEntryV1 as w, ShareEntryV1Schema as x, ShareEntryValidationError as y, WORKSPACE_AGENT_PLUGINS_RELOADED_EVENT as z };
|
package/docs/ERROR_CODES.md
CHANGED
|
@@ -86,6 +86,8 @@ All API failures must use the response envelope:
|
|
|
86
86
|
| `PROVISIONING_ARTIFACT_FAILED` | Runtime-mode adapter failed to prepare/upload install artifact | 500 | retry | error | stable (public API) |
|
|
87
87
|
| `ERR_NOT_IMPLEMENTED_UNTIL_T1` | Headless core method exists but the durable T1 implementation has not landed yet | 501 | retry-after-upgrade | warn | stable (public API) |
|
|
88
88
|
| `INTERNAL_ERROR` | Catch-all internal failure | 500 | report-bug | error | internal (may change) |
|
|
89
|
+
| `AR1_SHARE_NOT_FOUND` | `GET /a/:id` deep link: no such Lane W share entry, or the entry belongs to a workspace the requester is not authorized/scoped to (identical response either way — no existence oracle) | 404 | user-fix | warn | stable (public API) |
|
|
90
|
+
| `AR1_SHARE_TOMBSTONED` | `GET /a/:id` deep link: share entry exists but its target file is gone; response renders provenance + last-known metadata, never a bare 404 | 200 | user-fix | warn | stable (public API) |
|
|
89
91
|
|
|
90
92
|
## Readiness error details
|
|
91
93
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hachej/boring-agent",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.85",
|
|
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.85"
|
|
88
88
|
},
|
|
89
89
|
"devDependencies": {
|
|
90
90
|
"@antithesishq/bombadil": "0.6.1",
|