@hachej/boring-agent 0.1.105 → 0.1.108

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.
Files changed (34) hide show
  1. package/dist/{chunk-K25PK5EC.js → chunk-3JFPS2O6.js} +1 -0
  2. package/dist/{chunk-JNEKOVMJ.js → chunk-6OANSUEI.js} +1 -1
  3. package/dist/{chunk-4IQ4HHBG.js → chunk-7XAOVFSN.js} +7 -0
  4. package/dist/{chunk-F2OJI2LX.js → chunk-GS4ADE34.js} +863 -358
  5. package/dist/{chunk-LFN45QDZ.js → chunk-KDXIXVF6.js} +5076 -3640
  6. package/dist/{chunk-6DRHERVK.js → chunk-MVKXLMH3.js} +44 -2
  7. package/dist/chunk-YTUZFKB3.js +78 -0
  8. package/dist/core/index.d.ts +5 -5
  9. package/dist/core/index.js +2 -2
  10. package/dist/{createHarness-GMBZZPTN.js → createHarness-AHWSC36D.js} +3 -3
  11. package/dist/{errors-DH7C01Pm.d.ts → errors-CEU4iujR.d.ts} +59 -4
  12. package/dist/{file-search-qcD5zItr.d.ts → file-search-BGUHnW9o.d.ts} +3 -3
  13. package/dist/front/index.d.ts +36 -7
  14. package/dist/front/index.js +1491 -727
  15. package/dist/front/styles.css +57 -0
  16. package/dist/{harness-Dcd08yKr.d.ts → harness-Ct0e4RWc.d.ts} +6 -3
  17. package/dist/{lease-DffrPrQn.d.ts → lease-nASWv2tU.d.ts} +1 -1
  18. package/dist/{piChatEvent-iNSXiFQq.d.ts → piChatEvent-BUWIzw5l.d.ts} +67 -36
  19. package/dist/{piChatSessionService-DQSQ_kWZ.d.ts → piChatSessionService-nvroRAVk.d.ts} +13 -11
  20. package/dist/server/agent-host/testing/gatewayConformance.d.ts +6 -5
  21. package/dist/server/agent-host/testing/gatewayConformance.js +57 -8
  22. package/dist/server/index.d.ts +167 -212
  23. package/dist/server/index.js +13 -9
  24. package/dist/server/worker/index.js +7 -7
  25. package/dist/shared/index.d.ts +34 -28
  26. package/dist/shared/index.js +8 -8
  27. package/dist/{types-BTsdaAQ2.d.ts → types-B7-PN5jV.d.ts} +47 -14
  28. package/docs/AGENT_GATEWAY_V0.md +40 -2
  29. package/docs/ERROR_CODES.md +1 -0
  30. package/docs/README.md +1 -0
  31. package/docs/SESSION_IDENTITY.md +91 -0
  32. package/docs/tools.md +4 -0
  33. package/package.json +11 -10
  34. package/dist/chunk-WSQ5QNIY.js +0 -18
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  ErrorCode
3
- } from "./chunk-K25PK5EC.js";
3
+ } from "./chunk-3JFPS2O6.js";
4
4
 
5
5
  // src/shared/tool-ui.ts
6
6
  function isRecord(value) {
@@ -38,6 +38,9 @@ var AgentGatewayErrorCode = {
38
38
  AGENT_TYPE_UNKNOWN: "AGENT_TYPE_UNKNOWN",
39
39
  AGENT_SESSION_NOT_FOUND: "AGENT_SESSION_NOT_FOUND",
40
40
  AGENT_SCOPE_DENIED: "AGENT_SCOPE_DENIED",
41
+ AGENT_ENTITLEMENT_REQUIRED: "AGENT_ENTITLEMENT_REQUIRED",
42
+ AGENT_ACCESS_FORBIDDEN: "AGENT_ACCESS_FORBIDDEN",
43
+ AGENT_ACCESS_POLICY_UNAVAILABLE: "AGENT_ACCESS_POLICY_UNAVAILABLE",
41
44
  AGENT_SESSION_REPLAY_GAP: "AGENT_SESSION_REPLAY_GAP",
42
45
  AGENT_SESSION_CURSOR_AHEAD: "AGENT_SESSION_CURSOR_AHEAD",
43
46
  AGENT_SESSION_CURSOR_EXPIRED: "AGENT_SESSION_CURSOR_EXPIRED",
@@ -54,6 +57,9 @@ var AGENT_GATEWAY_ERROR_CODES = [
54
57
  AgentGatewayErrorCode.AGENT_TYPE_UNKNOWN,
55
58
  AgentGatewayErrorCode.AGENT_SESSION_NOT_FOUND,
56
59
  AgentGatewayErrorCode.AGENT_SCOPE_DENIED,
60
+ AgentGatewayErrorCode.AGENT_ENTITLEMENT_REQUIRED,
61
+ AgentGatewayErrorCode.AGENT_ACCESS_FORBIDDEN,
62
+ AgentGatewayErrorCode.AGENT_ACCESS_POLICY_UNAVAILABLE,
57
63
  AgentGatewayErrorCode.AGENT_SESSION_REPLAY_GAP,
58
64
  AgentGatewayErrorCode.AGENT_SESSION_CURSOR_AHEAD,
59
65
  AgentGatewayErrorCode.AGENT_SESSION_CURSOR_EXPIRED,
@@ -292,7 +298,9 @@ var QueueClearPayloadSchema = z.preprocess(
292
298
  clientSeq: z.number().int().nonnegative().optional()
293
299
  }).strict()
294
300
  );
295
- var InterruptPayloadSchema = z.object({}).strict();
301
+ var InterruptPayloadSchema = z.object({
302
+ queueAction: z.enum(["hold", "resume"]).optional()
303
+ }).strict();
296
304
  var StopPayloadSchema = z.object({}).strict();
297
305
  var CommandReceiptSchema = z.object({
298
306
  accepted: z.literal(true),
@@ -316,6 +324,38 @@ var StopReceiptSchema = CommandReceiptSchema.extend({
316
324
  clearedQueue: z.array(QueuedUserMessageSchema)
317
325
  });
318
326
 
327
+ // src/shared/chat/modelContextError.ts
328
+ var MODEL_CONTEXT_RECOVERY_MESSAGE = "This conversation exceeded the model context window. Compact the conversation and retry, or start a new chat with less context.";
329
+ var CONTEXT_WINDOW_ERROR_PATTERN = /context[_ ]length[_ ]exceeded|exceeds the context window|input exceeds the context window/i;
330
+ function errorMessage(value) {
331
+ if (value instanceof Error) return value.message;
332
+ if (typeof value === "string") return value;
333
+ if (typeof value !== "object" || value === null) return void 0;
334
+ const record = value;
335
+ if (typeof record.code === "string" && CONTEXT_WINDOW_ERROR_PATTERN.test(record.code)) return record.code;
336
+ if (typeof record.message === "string") return record.message;
337
+ return errorMessage(record.error);
338
+ }
339
+ function isModelContextWindowError(value) {
340
+ const message = errorMessage(value);
341
+ return message !== void 0 && CONTEXT_WINDOW_ERROR_PATTERN.test(message);
342
+ }
343
+ function chatErrorFromUnknown(value, fallbackMessage) {
344
+ if (isModelContextWindowError(value)) {
345
+ return {
346
+ code: ErrorCode.enum.MODEL_CONTEXT_WINDOW_EXCEEDED,
347
+ message: MODEL_CONTEXT_RECOVERY_MESSAGE,
348
+ retryable: true
349
+ };
350
+ }
351
+ const message = errorMessage(value);
352
+ return {
353
+ code: ErrorCode.enum.INTERNAL_ERROR,
354
+ message: message || fallbackMessage,
355
+ retryable: false
356
+ };
357
+ }
358
+
319
359
  export {
320
360
  isToolUiMetadata,
321
361
  sanitizeToolUiMetadata,
@@ -325,6 +365,8 @@ export {
325
365
  AgentGatewayErrorCode,
326
366
  AGENT_GATEWAY_ERROR_CODES,
327
367
  AgentGatewayError,
368
+ isModelContextWindowError,
369
+ chatErrorFromUnknown,
328
370
  ToolUiMetadataSchema,
329
371
  sanitizeToolUiMetadata2,
330
372
  ChatErrorSchema,
@@ -0,0 +1,78 @@
1
+ // src/shared/events.ts
2
+ var AGENT_NOT_IMPLEMENTED_UNTIL_T1 = "ERR_NOT_IMPLEMENTED_UNTIL_T1";
3
+ var SESSION_STREAM_PREFIX = "sessions/";
4
+ var V1_QUARANTINE_STREAM_PREFIX = "quarantine/v1/";
5
+ function sessionStreamPath(identity) {
6
+ assertIdentitySegment("workspaceScopeId", identity?.workspaceScopeId);
7
+ assertIdentitySegment("sessionId", identity?.sessionId);
8
+ return `${SESSION_STREAM_PREFIX}${encodeIdentitySegment(identity.workspaceScopeId)}/${encodeIdentitySegment(identity.sessionId)}`;
9
+ }
10
+ function parseSessionStreamPath(path) {
11
+ if (typeof path !== "string" || !path.startsWith(SESSION_STREAM_PREFIX)) return null;
12
+ const segments = path.slice(SESSION_STREAM_PREFIX.length).split("/");
13
+ if (segments.length !== 2) return null;
14
+ const workspaceScopeId = decodeIdentitySegment(segments[0] ?? "");
15
+ const sessionId = decodeIdentitySegment(segments[1] ?? "");
16
+ if (workspaceScopeId === null || sessionId === null) return null;
17
+ return { workspaceScopeId, sessionId };
18
+ }
19
+ function quarantineV1EventStreamPath(oldPath) {
20
+ return `${V1_QUARANTINE_STREAM_PREFIX}${encodeIdentitySegment(oldPath)}`;
21
+ }
22
+ function quarantineV1EventStreamRowidPath(rowid) {
23
+ if (!Number.isSafeInteger(rowid) || rowid <= 0) {
24
+ throw new TypeError("Legacy event stream rowid must be a positive safe integer.");
25
+ }
26
+ return `${V1_QUARANTINE_STREAM_PREFIX}rowid-${rowid}`;
27
+ }
28
+ function assertIdentitySegment(name, value) {
29
+ if (typeof value !== "string" || value.length === 0) {
30
+ throw new TypeError(`Session stream ${name} must be a non-empty string.`);
31
+ }
32
+ if (!isWellFormedUnicode(value)) {
33
+ throw new TypeError(`Session stream ${name} must contain well-formed Unicode.`);
34
+ }
35
+ }
36
+ function isWellFormedUnicode(value) {
37
+ for (let index = 0; index < value.length; index += 1) {
38
+ const code = value.charCodeAt(index);
39
+ if (code >= 55296 && code <= 56319) {
40
+ const next = value.charCodeAt(index + 1);
41
+ if (!(next >= 56320 && next <= 57343)) return false;
42
+ index += 1;
43
+ } else if (code >= 56320 && code <= 57343) {
44
+ return false;
45
+ }
46
+ }
47
+ return true;
48
+ }
49
+ function encodeIdentitySegment(value) {
50
+ return encodeURIComponent(value).replace(/[!'()*~]/g, (character) => `%${character.charCodeAt(0).toString(16).toUpperCase()}`);
51
+ }
52
+ function decodeIdentitySegment(value) {
53
+ if (value.length === 0) return null;
54
+ try {
55
+ const decoded = decodeURIComponent(value);
56
+ if (decoded.length === 0 || encodeIdentitySegment(decoded) !== value) return null;
57
+ return decoded;
58
+ } catch {
59
+ return null;
60
+ }
61
+ }
62
+ var AgentNotImplementedError = class extends Error {
63
+ code = AGENT_NOT_IMPLEMENTED_UNTIL_T1;
64
+ constructor(message = "This agent capability is not implemented until T1.") {
65
+ super(message);
66
+ this.name = "AgentNotImplementedError";
67
+ }
68
+ };
69
+
70
+ export {
71
+ AGENT_NOT_IMPLEMENTED_UNTIL_T1,
72
+ SESSION_STREAM_PREFIX,
73
+ sessionStreamPath,
74
+ parseSessionStreamPath,
75
+ quarantineV1EventStreamPath,
76
+ quarantineV1EventStreamRowidPath,
77
+ AgentNotImplementedError
78
+ };
@@ -1,8 +1,8 @@
1
- import { A as AgentHarness, a as AgentReadiness, b as Agent } from '../harness-Dcd08yKr.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-Dcd08yKr.js';
3
- import { S as SessionStore } from '../piChatEvent-iNSXiFQq.js';
4
- import { A as AgentCoreSessionService, a as AgentEffectAdmission } from '../piChatSessionService-DQSQ_kWZ.js';
5
- export { b as AGENT_EFFECT_METHODS, c as AgentEffectAdmissionError, P as PiChatEventStreamResult, d as PiChatEventStreamSubscription, e as PiChatEventSubscriber, f as PiChatReplayRangeError, g as PiChatSessionService, h as PiSessionCreateInit, i as PiSessionRequestContext, w as withAgentEffectAdmission } from '../piChatSessionService-DQSQ_kWZ.js';
1
+ import { A as AgentHarness, a as AgentReadiness, b as Agent } from '../harness-Ct0e4RWc.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-Ct0e4RWc.js';
3
+ import { S as SessionStore } from '../piChatEvent-BUWIzw5l.js';
4
+ import { A as AgentCoreSessionService, a as AgentEffectAdmission } from '../piChatSessionService-nvroRAVk.js';
5
+ export { b as AGENT_EFFECT_METHODS, c as AgentEffectAdmissionError, P as PiChatEventStreamResult, d as PiChatEventStreamSubscription, e as PiChatEventSubscriber, f as PiChatReplayRangeError, g as PiChatSessionService, h as PiSessionCreateInit, i as PiSessionRequestContext, w as withAgentEffectAdmission } from '../piChatSessionService-nvroRAVk.js';
6
6
  import '@mariozechner/pi-coding-agent';
7
7
  import 'zod';
8
8
 
@@ -1,10 +1,10 @@
1
1
  import {
2
2
  AGENT_NOT_IMPLEMENTED_UNTIL_T1,
3
3
  AgentNotImplementedError
4
- } from "../chunk-WSQ5QNIY.js";
4
+ } from "../chunk-YTUZFKB3.js";
5
5
  import {
6
6
  ErrorCode
7
- } from "../chunk-K25PK5EC.js";
7
+ } from "../chunk-3JFPS2O6.js";
8
8
 
9
9
  // src/core/piChatSessionService.ts
10
10
  var AgentEffectAdmissionError = class extends Error {
@@ -5,9 +5,9 @@ import {
5
5
  mergePiPackageSources,
6
6
  projectSkillResourceLocations,
7
7
  withPiHarnessDefaults
8
- } from "./chunk-F2OJI2LX.js";
9
- import "./chunk-4IQ4HHBG.js";
10
- import "./chunk-K25PK5EC.js";
8
+ } from "./chunk-GS4ADE34.js";
9
+ import "./chunk-7XAOVFSN.js";
10
+ import "./chunk-3JFPS2O6.js";
11
11
  export {
12
12
  createPiCodingAgentHarness,
13
13
  createResourceSettingsManager,
@@ -1,4 +1,4 @@
1
- import { c as PiChatEvent, C as ChatModelSelection, T as ThinkingLevel, l as ChatAttachmentPayload, m as QueuedUserMessage, P as PiChatSnapshot } from './piChatEvent-iNSXiFQq.js';
1
+ import { d as PiChatEvent, l as SessionArchiveFilter, C as ChatModelSelection, T as ThinkingLevel, m as ChatAttachmentPayload, n as QueuedUserMessage, c as PiChatSnapshot } from './piChatEvent-BUWIzw5l.js';
2
2
 
3
3
  /** Placement-independent event envelope. `seq` is the only replay cursor. */
4
4
  interface AgentSessionEvent {
@@ -35,6 +35,33 @@ interface AuthorizedAgentScope {
35
35
  interface AgentScopeVerifier {
36
36
  verify(scope: AuthorizedAgentScope): Promise<VerifiedAgentScopeClaim>;
37
37
  }
38
+ /**
39
+ * Product-owned access decision for one deployed Agent in one verified scope.
40
+ * The Host consumes this decision before session lookup, runtime binding, or
41
+ * effects. A host without a resolver preserves the legacy all-deployed policy.
42
+ */
43
+ type AgentAccessDecision = {
44
+ readonly state: 'allowed';
45
+ readonly seatId?: string;
46
+ } | {
47
+ readonly state: 'not-available';
48
+ readonly reason: 'not-deployed' | 'not-seated';
49
+ } | {
50
+ readonly state: 'entitlement-denied';
51
+ readonly seatId: string;
52
+ readonly denial: 'subscription-required' | 'forbidden';
53
+ } | {
54
+ readonly state: 'policy-unavailable';
55
+ readonly retryAfterSeconds?: number;
56
+ };
57
+ type AgentAccessOperation = 'catalog' | 'session.list' | 'session.read' | 'session.create' | 'session.mutate' | 'runtime.bind' | 'runtime.effect' | 'stream.event';
58
+ interface ResolveAgentAccessInput {
59
+ readonly authorizedScope: AuthorizedAgentScope;
60
+ readonly verifiedClaim: VerifiedAgentScopeClaim;
61
+ readonly agentTypeId: string;
62
+ readonly operation: AgentAccessOperation;
63
+ }
64
+ type ResolveAgentAccess = (input: ResolveAgentAccessInput) => Promise<AgentAccessDecision>;
38
65
  interface AgentSessionRef {
39
66
  readonly agentTypeId: string;
40
67
  readonly sessionId: string;
@@ -58,6 +85,8 @@ interface AuthorizedAgentSessionQuery {
58
85
  readonly agentTypeId?: string;
59
86
  readonly cursor?: string;
60
87
  readonly limit?: number;
88
+ /** Defaults to `all`; archiving is a visibility flag, not a listing default. */
89
+ readonly archived?: SessionArchiveFilter;
61
90
  }
62
91
  type AgentSessionActivity = 'idle' | 'running' | 'aborting' | 'error';
63
92
  interface AgentSessionSummary {
@@ -71,6 +100,8 @@ interface AgentSessionSummary {
71
100
  readonly nativeSessionId?: string;
72
101
  /** Native transcript metadata used to gate rename until a reply exists. */
73
102
  readonly hasAssistantReply?: boolean;
103
+ /** Visibility only: present (true) exactly while the session is archived. */
104
+ readonly archived?: boolean;
74
105
  }
75
106
  interface AgentSessionPage {
76
107
  readonly sessions: readonly AgentSessionSummary[];
@@ -99,6 +130,17 @@ interface RenameAgentSessionInput {
99
130
  readonly requestId: string;
100
131
  readonly title: string;
101
132
  }
133
+ /**
134
+ * Archive is NOT delete: it hides the session from a default listing and
135
+ * nothing else. The transcript stays exactly where it was, and `archived:
136
+ * false` puts the row back.
137
+ */
138
+ interface SetAgentSessionArchivedInput {
139
+ readonly scope: AuthorizedAgentScope;
140
+ readonly ref: AgentSessionRef;
141
+ readonly requestId: string;
142
+ readonly archived: boolean;
143
+ }
102
144
  interface DeleteAgentSessionInput {
103
145
  readonly scope: AuthorizedAgentScope;
104
146
  readonly ref: AgentSessionRef;
@@ -128,6 +170,10 @@ type IdempotentAgentSend = AgentPromptCommand | AgentFollowUpCommand;
128
170
  interface IdempotentAgentControl {
129
171
  readonly requestId: string;
130
172
  }
173
+ interface IdempotentInterruptControl extends IdempotentAgentControl {
174
+ /** Abort-and-queue policy specific to interrupt commands. */
175
+ readonly queueAction?: 'hold' | 'resume';
176
+ }
131
177
  interface IdempotentQueueClear extends IdempotentAgentControl {
132
178
  readonly clientNonce?: string;
133
179
  readonly clientSeq?: number;
@@ -159,18 +205,24 @@ interface AgentSessionConnection {
159
205
  readonly ref: AgentSessionRef;
160
206
  readonly events: AsyncIterable<AgentSessionEvent>;
161
207
  send(input: IdempotentAgentSend): Promise<AgentSendReceipt>;
162
- interrupt(input: IdempotentAgentControl): Promise<CommandReceipt>;
208
+ interrupt(input: IdempotentInterruptControl): Promise<CommandReceipt>;
163
209
  stop(input: IdempotentAgentControl): Promise<StopReceipt>;
164
210
  clearQueue(input: IdempotentQueueClear): Promise<QueueClearReceipt>;
165
211
  close(): Promise<void>;
166
212
  }
167
213
  interface AgentGateway {
214
+ authorizeAgentAccess?(input: {
215
+ readonly scope: AuthorizedAgentScope;
216
+ readonly agentTypeId: string;
217
+ readonly operation: AgentAccessOperation;
218
+ }): Promise<void>;
168
219
  listAgents(input: ListAgentsInput): Promise<readonly AgentSummary[]>;
169
220
  listSessions(input: AuthorizedAgentSessionQuery): Promise<AgentSessionPage>;
170
221
  createSession(input: CreateAgentSessionInput): Promise<AgentSessionRef>;
171
222
  connectSession(input: ConnectAgentSessionInput): Promise<AgentSessionConnection>;
172
223
  readSessionState(input: ReadAgentSessionStateInput): Promise<AgentSessionStateSnapshot>;
173
224
  renameSession(input: RenameAgentSessionInput): Promise<AgentSessionSummary>;
225
+ setSessionArchived(input: SetAgentSessionArchivedInput): Promise<AgentSessionSummary>;
174
226
  deleteSession(input: DeleteAgentSessionInput): Promise<void>;
175
227
  close(): Promise<void>;
176
228
  }
@@ -179,6 +231,9 @@ declare const AgentGatewayErrorCode: {
179
231
  readonly AGENT_TYPE_UNKNOWN: "AGENT_TYPE_UNKNOWN";
180
232
  readonly AGENT_SESSION_NOT_FOUND: "AGENT_SESSION_NOT_FOUND";
181
233
  readonly AGENT_SCOPE_DENIED: "AGENT_SCOPE_DENIED";
234
+ readonly AGENT_ENTITLEMENT_REQUIRED: "AGENT_ENTITLEMENT_REQUIRED";
235
+ readonly AGENT_ACCESS_FORBIDDEN: "AGENT_ACCESS_FORBIDDEN";
236
+ readonly AGENT_ACCESS_POLICY_UNAVAILABLE: "AGENT_ACCESS_POLICY_UNAVAILABLE";
182
237
  readonly AGENT_SESSION_REPLAY_GAP: "AGENT_SESSION_REPLAY_GAP";
183
238
  readonly AGENT_SESSION_CURSOR_AHEAD: "AGENT_SESSION_CURSOR_AHEAD";
184
239
  readonly AGENT_SESSION_CURSOR_EXPIRED: "AGENT_SESSION_CURSOR_EXPIRED";
@@ -192,7 +247,7 @@ declare const AgentGatewayErrorCode: {
192
247
  readonly AGENT_GATEWAY_CLOSED: "AGENT_GATEWAY_CLOSED";
193
248
  };
194
249
  type AgentGatewayErrorCode = (typeof AgentGatewayErrorCode)[keyof typeof AgentGatewayErrorCode];
195
- declare const AGENT_GATEWAY_ERROR_CODES: readonly ["AGENT_TYPE_UNKNOWN", "AGENT_SESSION_NOT_FOUND", "AGENT_SCOPE_DENIED", "AGENT_SESSION_REPLAY_GAP", "AGENT_SESSION_CURSOR_AHEAD", "AGENT_SESSION_CURSOR_EXPIRED", "AGENT_SESSION_CURSOR_INVALID", "AGENT_REQUEST_CONFLICT", "AGENT_REQUEST_IN_PROGRESS", "AGENT_REQUEST_OUTCOME_UNKNOWN", "AGENT_RUNTIME_RESTART_REQUIRED", "AGENT_COMMAND_INVALID_STATE", "AGENT_SHARED_ENVIRONMENT_UNAVAILABLE", "AGENT_GATEWAY_CLOSED"];
250
+ declare const AGENT_GATEWAY_ERROR_CODES: readonly ["AGENT_TYPE_UNKNOWN", "AGENT_SESSION_NOT_FOUND", "AGENT_SCOPE_DENIED", "AGENT_ENTITLEMENT_REQUIRED", "AGENT_ACCESS_FORBIDDEN", "AGENT_ACCESS_POLICY_UNAVAILABLE", "AGENT_SESSION_REPLAY_GAP", "AGENT_SESSION_CURSOR_AHEAD", "AGENT_SESSION_CURSOR_EXPIRED", "AGENT_SESSION_CURSOR_INVALID", "AGENT_REQUEST_CONFLICT", "AGENT_REQUEST_IN_PROGRESS", "AGENT_REQUEST_OUTCOME_UNKNOWN", "AGENT_RUNTIME_RESTART_REQUIRED", "AGENT_COMMAND_INVALID_STATE", "AGENT_SHARED_ENVIRONMENT_UNAVAILABLE", "AGENT_GATEWAY_CLOSED"];
196
251
  interface AgentGatewayErrorDTO {
197
252
  readonly code: AgentGatewayErrorCode;
198
253
  readonly message: string;
@@ -205,4 +260,4 @@ declare class AgentGatewayError extends Error {
205
260
  toJSON(): AgentGatewayErrorDTO;
206
261
  }
207
262
 
208
- export { type AgentGateway as A, type ConnectAgentSessionInput as C, type DeleteAgentSessionInput as D, type IdempotentAgentControl as I, type JsonPrimitive as J, type ListAgentsInput as L, type ReadAgentSessionStateInput as R, type VerifiedAgentScopeClaim as V, type WorkspaceScopeId as W, type AuthorizedAgentScope as a, type AgentSessionRef as b, type AgentSessionActivity as c, type AgentSendReceipt as d, AGENT_GATEWAY_ERROR_CODES as e, type AgentFollowUpCommand as f, AgentGatewayError as g, AgentGatewayErrorCode as h, type AgentGatewayErrorDTO as i, type AgentPromptCommand as j, type AgentScopeVerifier as k, type AgentSessionConnection as l, type AgentSessionEvent as m, type AgentSessionPage as n, type AgentSessionStateSnapshot as o, type AgentSessionSummary as p, type AgentSummary as q, type AuthSubjectId as r, type AuthorizedAgentSessionQuery as s, type CreateAgentSessionInput as t, type IdempotentAgentSend as u, type IdempotentQueueClear as v, type JsonSafe as w, type JsonValue as x, type RenameAgentSessionInput as y };
263
+ export { type AgentGateway as A, type JsonValue as B, type ConnectAgentSessionInput as C, type DeleteAgentSessionInput as D, type RenameAgentSessionInput as E, type ResolveAgentAccess as F, type ResolveAgentAccessInput as G, type IdempotentAgentControl as I, type JsonPrimitive as J, type ListAgentsInput as L, type ReadAgentSessionStateInput as R, type VerifiedAgentScopeClaim as V, type WorkspaceScopeId as W, type AuthorizedAgentScope as a, type AgentSessionRef as b, type AgentSessionActivity as c, type AgentSendReceipt as d, AGENT_GATEWAY_ERROR_CODES as e, type AgentAccessDecision as f, type AgentAccessOperation as g, type AgentFollowUpCommand as h, AgentGatewayError as i, AgentGatewayErrorCode as j, type AgentGatewayErrorDTO as k, type AgentPromptCommand as l, type AgentScopeVerifier as m, type AgentSessionConnection as n, type AgentSessionEvent as o, type AgentSessionPage as p, type AgentSessionStateSnapshot as q, type AgentSessionSummary as r, type AgentSummary as s, type AuthSubjectId as t, type AuthorizedAgentSessionQuery as u, type CreateAgentSessionInput as v, type IdempotentAgentSend as w, type IdempotentInterruptControl as x, type IdempotentQueueClear as y, type JsonSafe as z };
@@ -1,7 +1,7 @@
1
- import { k as InterruptReceipt, j as StopReceipt } from './piChatEvent-iNSXiFQq.js';
2
- import { p as AgentSendInput, j as AgentEvent } from './harness-Dcd08yKr.js';
1
+ import { k as InterruptReceipt, j as StopReceipt } from './piChatEvent-BUWIzw5l.js';
2
+ import { p as AgentSendInput, j as AgentEvent } from './harness-Ct0e4RWc.js';
3
3
  import { b as Workspace } from './sandbox-BMhut3kh.js';
4
- import { b as AgentSessionRef, d as AgentSendReceipt, A as AgentGateway, a as AuthorizedAgentScope } from './errors-DH7C01Pm.js';
4
+ import { b as AgentSessionRef, d as AgentSendReceipt, A as AgentGateway, a as AuthorizedAgentScope } from './errors-CEU4iujR.js';
5
5
 
6
6
  interface WorkspaceAgentDispatcherContext {
7
7
  workspaceId: string;
@@ -1,8 +1,8 @@
1
- import { p as ToolUiMetadata, B as BoringChatPart, v as BoringChatMessage, H as PiChatStatus, P as PiChatSnapshot, m as QueuedUserMessage, w as ChatError, c as PiChatEvent, d as PromptPayload, e as PromptReceipt, F as FollowUpPayload, f as FollowUpReceipt, Q as QueueClearPayload, g as QueueClearReceipt, I as InterruptPayload, h as CommandReceipt, i as StopPayload, j as StopReceipt, b as SessionSummary, y as ErrorCode } from '../piChatEvent-iNSXiFQq.js';
1
+ import { q as ToolUiMetadata, B as BoringChatPart, w as BoringChatMessage, J as PiChatStatus, c as PiChatSnapshot, n as QueuedUserMessage, x as ChatError, d as PiChatEvent, P as PromptPayload, e as PromptReceipt, F as FollowUpPayload, f as FollowUpReceipt, Q as QueueClearPayload, g as QueueClearReceipt, I as InterruptPayload, h as CommandReceipt, i as StopPayload, j as StopReceipt, b as SessionSummary, z as ErrorCode } from '../piChatEvent-BUWIzw5l.js';
2
2
  import * as react from 'react';
3
3
  import { ComponentProps, HTMLAttributes, FormEvent, ReactNode, ComponentType } from 'react';
4
4
  import { FileUIPart, ChatStatus, UIMessage } from 'ai';
5
- import { q as AgentSummary, h as AgentGatewayErrorCode, x as JsonValue } from '../errors-DH7C01Pm.js';
5
+ import { s as AgentSummary, j as AgentGatewayErrorCode, B as JsonValue } from '../errors-CEU4iujR.js';
6
6
  export { Artifact, ArtifactAction, ArtifactActions, ArtifactDescription, ArtifactHeader, ArtifactOpenProvider, ArtifactTitle, OpenArtifactHandler, useOpenArtifact } from './artifacts.js';
7
7
  import { InputGroupAddon, InputGroupButton, InputGroupTextarea, Button, Collapsible, CollapsibleContent, CollapsibleTrigger } from '@hachej/boring-ui-kit';
8
8
  import { Streamdown } from 'streamdown';
@@ -14,6 +14,7 @@ import 'lucide-react';
14
14
  interface UploadFileOptions {
15
15
  apiBaseUrl?: string;
16
16
  workspaceRequestId?: string | null;
17
+ requestHeaders?: Record<string, string | undefined>;
17
18
  directory?: string;
18
19
  sourcePath?: string;
19
20
  responseUrl?: 'markdown' | 'raw';
@@ -451,6 +452,7 @@ declare class RemotePiSession {
451
452
  prompt(payload: PromptPayload): Promise<PromptReceipt>;
452
453
  followUp(payload: FollowUpPayload): Promise<FollowUpReceipt>;
453
454
  clearQueue(payload?: QueueClearPayload): Promise<QueueClearReceipt>;
455
+ private postQueueClear;
454
456
  interrupt(payload?: InterruptPayload): Promise<CommandReceipt>;
455
457
  stop(payload?: StopPayload): Promise<StopReceipt>;
456
458
  suspendStream(): void;
@@ -555,10 +557,18 @@ interface UsePiSessionsResult {
555
557
  loading: boolean;
556
558
  loadingMore: boolean;
557
559
  hasMore: boolean;
560
+ /** Archived inventory is paged independently from the active list. */
561
+ archivedLoaded: boolean;
562
+ archivedLoading: boolean;
563
+ hasMoreArchived: boolean;
558
564
  error: Error | undefined;
559
565
  refresh: (options?: PiSessionRefreshOptions) => Promise<void>;
560
566
  create: (init?: PiSessionCreateInit) => Promise<SessionSummary>;
561
567
  rename: (id: string, title: string) => Promise<SessionSummary>;
568
+ /** Explicit archive capability; never aliases delete. */
569
+ setArchived: (id: string, archived: boolean) => Promise<SessionSummary>;
570
+ /** Loads the first or next archived-only page. */
571
+ loadArchived: () => Promise<void>;
562
572
  switch: (id: string) => void;
563
573
  delete: (id: string) => Promise<void>;
564
574
  loadMore: () => Promise<void>;
@@ -627,6 +637,18 @@ declare function matchPiSessionSearch(session: PiSessionSearchItem, parsed: Pars
627
637
  };
628
638
  declare function searchPiSessions<T extends PiSessionSearchItem>(sessions: readonly T[], query: string, options?: PiSessionSearchOptions): T[];
629
639
 
640
+ interface PiComposerHandledSubmit {
641
+ handled: true;
642
+ message?: string;
643
+ }
644
+ interface PiComposerReplacementSubmit {
645
+ replacement: {
646
+ text: string;
647
+ displayText?: string;
648
+ };
649
+ }
650
+ type PiComposerBeforeSubmitResult = boolean | void | PiComposerHandledSubmit | PiComposerReplacementSubmit;
651
+
630
652
  interface ComposerBlockerAction {
631
653
  id: string;
632
654
  label: string;
@@ -647,6 +669,7 @@ interface ChatSubmitContext {
647
669
  sessionId: string;
648
670
  source: ChatSubmitSource;
649
671
  }
672
+ type ChatBeforeSubmitResult = PiComposerBeforeSubmitResult;
650
673
  interface ChatPanelEmptyState {
651
674
  eyebrow?: string;
652
675
  title?: string;
@@ -705,7 +728,11 @@ interface PiChatPanelProps<TComposerBlocker extends ComposerBlocker = ComposerBl
705
728
  allowPromptDuringInitialHydration?: boolean;
706
729
  workspaceWarmupStatus?: ChatPanelWorkspaceWarmupStatus;
707
730
  onSessionReset?: () => void | Promise<void>;
708
- onBeforeSubmit?: (draft: string, context: ChatSubmitContext) => false | void | boolean | Promise<false | void | boolean>;
731
+ /** Persist oversized text prompts through the workspace upload route and send a compact path reference. Enabled by default. */
732
+ spillLargePrompts?: boolean;
733
+ /** Character threshold for generic prompt spilling. Defaults to 12,000. */
734
+ largePromptThresholdChars?: number;
735
+ onBeforeSubmit?: (draft: string, context: ChatSubmitContext) => ChatBeforeSubmitResult | Promise<ChatBeforeSubmitResult>;
709
736
  onReloadAgentPlugins?: () => Promise<AgentPluginReloadResult | string>;
710
737
  onCommandResult?: (message: string) => void;
711
738
  onComposerWarning?: (message: string) => void;
@@ -730,13 +757,15 @@ interface PiChatPanelProps<TComposerBlocker extends ComposerBlocker = ComposerBl
730
757
  * knowing what the code means or what the action does. */
731
758
  renderNoticeAction?: (notice: PiChatRuntimeNotice) => ReactNode;
732
759
  }
733
- declare function PiChatPanel<TComposerBlocker extends ComposerBlocker = ComposerBlocker>({ sessionId, agentTypeId, extraCommands, apiBaseUrl, workspaceId, storageScope, requestHeaders, storage, fetch, className, chrome, debug, showSessions, hotReloadEnabled, suggestions, emptyState, emptyPlacement, composerPlaceholder, initialDraft, autoSubmitInitialDraft, onDraftRestored, onAutoSubmitInitialDraftAccepted, onAutoSubmitInitialDraftSettled, model, defaultModel, availableModels, hideDefaultModelOption, hideComposerSettings, suppressPreSubmitCancelledWarning, thinkingLevel, thinkingControl, serverResourcesEnabled, mentionedFiles, commands, excludeBuiltinCommands, toolRenderers, createRemoteSession, remoteSessionOptions, hydrateMessages, allowPromptDuringInitialHydration, workspaceWarmupStatus, onSessionReset, onBeforeSubmit, onReloadAgentPlugins, onCommandResult, onComposerWarning, onMentionedFilesConsumed, onPromptSubmitStarted, onData, onOpenArtifact, composerBlockers, onComposerStop, onComposerBlockerAction, onTurnComplete, renderNoticeAction, }: PiChatPanelProps<TComposerBlocker>): react.JSX.Element;
760
+ declare function PiChatPanel<TComposerBlocker extends ComposerBlocker = ComposerBlocker>({ sessionId, agentTypeId, extraCommands, apiBaseUrl, workspaceId, storageScope, requestHeaders, storage, fetch, className, chrome, debug, showSessions, hotReloadEnabled, suggestions, emptyState, emptyPlacement, composerPlaceholder, initialDraft, autoSubmitInitialDraft, onDraftRestored, onAutoSubmitInitialDraftAccepted, onAutoSubmitInitialDraftSettled, model, defaultModel, availableModels, hideDefaultModelOption, hideComposerSettings, suppressPreSubmitCancelledWarning, thinkingLevel, thinkingControl, serverResourcesEnabled, mentionedFiles, commands, excludeBuiltinCommands, toolRenderers, createRemoteSession, remoteSessionOptions, hydrateMessages, allowPromptDuringInitialHydration, workspaceWarmupStatus, onSessionReset, spillLargePrompts, largePromptThresholdChars, onBeforeSubmit, onReloadAgentPlugins, onCommandResult, onComposerWarning, onMentionedFilesConsumed, onPromptSubmitStarted, onData, onOpenArtifact, composerBlockers, onComposerStop, onComposerBlockerAction, onTurnComplete, renderNoticeAction, }: PiChatPanelProps<TComposerBlocker>): react.JSX.Element;
734
761
 
735
762
  type AddressedAgentOption = Pick<AgentSummary, 'agentTypeId' | 'label' | 'description' | 'pluginIds'>;
736
763
  interface UseAddressedAgentSelectionOptions {
737
764
  apiBaseUrl?: string;
738
765
  requestHeaders?: Record<string, string | undefined>;
739
766
  storageScope?: string;
767
+ /** Initial regular Agent selection; never changes fleet membership or order. */
768
+ preferredAgentTypeId?: string;
740
769
  fetch?: typeof globalThis.fetch;
741
770
  enabled?: boolean;
742
771
  }
@@ -747,7 +776,7 @@ interface UseAddressedAgentSelectionResult {
747
776
  error: Error | undefined;
748
777
  selectAgentTypeId: (agentTypeId: string) => void;
749
778
  }
750
- declare function useAddressedAgentSelection({ apiBaseUrl, requestHeaders, storageScope, fetch, enabled, }?: UseAddressedAgentSelectionOptions): UseAddressedAgentSelectionResult;
779
+ declare function useAddressedAgentSelection({ apiBaseUrl, requestHeaders, storageScope, preferredAgentTypeId, fetch, enabled, }?: UseAddressedAgentSelectionOptions): UseAddressedAgentSelectionResult;
751
780
 
752
781
  type GatewayResponseErrorCode = AgentGatewayErrorCode | ErrorCode;
753
782
  declare class GatewayResponseError extends Error {
@@ -903,7 +932,7 @@ type BoringMessageResponseProps = MessageResponseProps & {
903
932
  /** Source path inferred from the preceding write/edit tool call, when known. */
904
933
  codeFilename?: string;
905
934
  };
906
- declare const MessageResponse: react.MemoExoticComponent<({ className, shikiTheme, components, codeFilename, ...props }: BoringMessageResponseProps) => react.JSX.Element>;
935
+ declare const MessageResponse: react.MemoExoticComponent<({ className, shikiTheme, components, codeFilename, rehypePlugins, allowedTags, ...props }: BoringMessageResponseProps) => react.JSX.Element>;
907
936
 
908
937
  type ConversationProps = ComponentProps<typeof StickToBottom> & {
909
938
  onScrollToBottomReady?: (scrollToBottom: () => void) => void;
@@ -965,4 +994,4 @@ declare const ToolContent: ({ className, ...props }: ToolContentProps) => react.
965
994
 
966
995
  declare function cn(...inputs: ClassValue[]): string;
967
996
 
968
- export { type AddressedAgentOption, type AgentCommandContribution, type AgentCommandOptions, type AgentPluginReloadResult, type AvailableModel, BoringChatMessage, ChatEmptyState, type ChatEmptyStateProps, type ChatMessageContribution, type ChatMessageContributionProps, ChatMessageContributionProvider, PiChatPanel as ChatPanel, type PiChatPanelProps as ChatPanelProps, type ChatSuggestion, CodeBlock, type CommandRegistry, type ComposerActionContributionProps, type ComposerBlocker, type ComposerBlockerAction, type ComposerContribution, ComposerContributionProvider, type ComposerDraftUpdate, Conversation, ConversationContent, ConversationScrollButton, DebugDrawer, GatewayResponseError, type GatewayResponseErrorCode, type GroupedToolEntry, Message, MessageAction, MessageActions, MessageContent, MessageResponse, ModelPickerMenu, ModelSelect, ModelSelectTrigger, type ModelSelection, type ParsedCommand, PiChatPanel, type PiChatPanelProps, SessionBrowser as PiSessionBrowser, type PiSessionCreateInit, SessionList as PiSessionList, type PiSessionSearchItem, type PiSessionSearchOptions, type PiSessionSearchSortMode, PromptInput, PromptInputFooter, PromptInputSubmit, PromptInputTextarea, Reasoning, ReasoningContent, ReasoningTrigger, type SessionListProps, type SlashCommand, type SlashCommandContext, type ThinkingLevel, ThinkingSelect, Tool, ToolCallGroup, ToolContent, ToolHeader, type ToolPart$1 as ToolPart, type ToolRenderer, type ToolRendererOverrides, type UploadFileOptions, type UploadFileResult, type UseAddressedAgentSelectionOptions, type UseAddressedAgentSelectionResult, type UsePiSessionsOptions, type UsePiSessionsResult, activeSessionStorageKey, builtinCommands, cn, createCommandRegistry, defaultChatSuggestions, defaultToolRenderers, errorResponseCode, gatewayResponseError, gatewayResponseErrorFromBody, getAgentCommands, matchPiSessionSearch, mergeShadcnToolRenderers, mergeToolRenderers, parsePiSessionSearchQuery, parseSlashCommand, readActiveSessionId, resolveToolRenderer, searchPiSessions, uploadFile, useAddressedAgentSelection, usePiSessions, writeActiveSessionId };
997
+ export { type AddressedAgentOption, type AgentCommandContribution, type AgentCommandOptions, type AgentPluginReloadResult, type AvailableModel, BoringChatMessage, type ChatBeforeSubmitResult, ChatEmptyState, type ChatEmptyStateProps, type ChatMessageContribution, type ChatMessageContributionProps, ChatMessageContributionProvider, PiChatPanel as ChatPanel, type PiChatPanelProps as ChatPanelProps, type ChatSubmitContext, type ChatSuggestion, CodeBlock, type CommandRegistry, type ComposerActionContributionProps, type ComposerBlocker, type ComposerBlockerAction, type ComposerContribution, ComposerContributionProvider, type ComposerDraftUpdate, Conversation, ConversationContent, ConversationScrollButton, DebugDrawer, GatewayResponseError, type GatewayResponseErrorCode, type GroupedToolEntry, Message, MessageAction, MessageActions, MessageContent, MessageResponse, ModelPickerMenu, ModelSelect, ModelSelectTrigger, type ModelSelection, type ParsedCommand, PiChatPanel, type PiChatPanelProps, SessionBrowser as PiSessionBrowser, type PiSessionCreateInit, SessionList as PiSessionList, type PiSessionSearchItem, type PiSessionSearchOptions, type PiSessionSearchSortMode, PromptInput, PromptInputFooter, PromptInputSubmit, PromptInputTextarea, Reasoning, ReasoningContent, ReasoningTrigger, type SessionListProps, type SlashCommand, type SlashCommandContext, type ThinkingLevel, ThinkingSelect, Tool, ToolCallGroup, ToolContent, ToolHeader, type ToolPart$1 as ToolPart, type ToolRenderer, type ToolRendererOverrides, type UploadFileOptions, type UploadFileResult, type UseAddressedAgentSelectionOptions, type UseAddressedAgentSelectionResult, type UsePiSessionsOptions, type UsePiSessionsResult, activeSessionStorageKey, builtinCommands, cn, createCommandRegistry, defaultChatSuggestions, defaultToolRenderers, errorResponseCode, gatewayResponseError, gatewayResponseErrorFromBody, getAgentCommands, matchPiSessionSearch, mergeShadcnToolRenderers, mergeToolRenderers, parsePiSessionSearchQuery, parseSlashCommand, readActiveSessionId, resolveToolRenderer, searchPiSessions, uploadFile, useAddressedAgentSelection, usePiSessions, writeActiveSessionId };