@sentry/junior 0.177.0 → 0.178.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (91) hide show
  1. package/dist/{agent-hooks-IYHCN7CO.js → agent-hooks-PBT4NNBV.js} +12 -12
  2. package/dist/api/conversations/archive.d.ts +5 -2
  3. package/dist/api/conversations/list.d.ts +0 -1
  4. package/dist/api/conversations/membership.d.ts +14 -0
  5. package/dist/api/conversations/projection.d.ts +2 -1
  6. package/dist/api/locations/detail.d.ts +1 -1
  7. package/dist/api/people/shared.d.ts +2 -2
  8. package/dist/api/schema/conversation.d.ts +4 -4
  9. package/dist/api/schema/location.d.ts +1 -1
  10. package/dist/api/schema/person.d.ts +1 -1
  11. package/dist/api/schema.js +1 -1
  12. package/dist/api.js +245 -166
  13. package/dist/app.js +35 -35
  14. package/dist/{catalog-runtime-2TD4CXSB.js → catalog-runtime-M7QGKPFZ.js} +5 -5
  15. package/dist/chat/agent/sandbox.d.ts +2 -0
  16. package/dist/chat/conversations/sql/participants.d.ts +1 -0
  17. package/dist/chat/conversations/store.d.ts +0 -1
  18. package/dist/chat/sandbox/errors.d.ts +4 -0
  19. package/dist/chat/sandbox/noninteractive-command.d.ts +1 -0
  20. package/dist/chat/sandbox/prepare-workspace.d.ts +27 -3
  21. package/dist/chat/sandbox/sandbox.d.ts +2 -0
  22. package/dist/chat/sandbox/session.d.ts +2 -0
  23. package/dist/chat/sandbox/snapshot/builder-sandbox.d.ts +5 -0
  24. package/dist/chat/sandbox/snapshot/install.d.ts +2 -2
  25. package/dist/chat/sandbox/snapshot/span.d.ts +3 -0
  26. package/dist/chat/sandbox/snapshot/store.d.ts +20 -17
  27. package/dist/chat/sandbox/snapshot/waiting-error.d.ts +15 -0
  28. package/dist/chat/sandbox/snapshot/workspace.d.ts +17 -0
  29. package/dist/chat/services/workspace-snapshot-wait.d.ts +27 -0
  30. package/dist/chat/workspaces/types.d.ts +1 -0
  31. package/dist/{chunk-3FWXQZJJ.js → chunk-22T3HB44.js} +1 -1
  32. package/dist/{chunk-DLTP6TUJ.js → chunk-3ZZEPLLB.js} +2 -2
  33. package/dist/{chunk-7ZFESKJ2.js → chunk-4K6VNP3S.js} +9 -9
  34. package/dist/{chunk-N4YEVOEC.js → chunk-534BO42N.js} +45 -276
  35. package/dist/{chunk-6NZRKJWU.js → chunk-6OYVH66J.js} +1 -1
  36. package/dist/{chunk-J2EWL6GJ.js → chunk-ABLODWPO.js} +1 -1
  37. package/dist/{chunk-ORMJY4RG.js → chunk-AGJ4OQ2V.js} +1 -1
  38. package/dist/{chunk-Q362TECJ.js → chunk-AQHSXA3J.js} +331 -2
  39. package/dist/{chunk-4SVAFAI2.js → chunk-AVRWMQ4U.js} +1 -1
  40. package/dist/{chunk-I7PKGMKI.js → chunk-BFLMRTPD.js} +6 -6
  41. package/dist/{chunk-ZCYABD7N.js → chunk-BHHWCNXI.js} +5 -5
  42. package/dist/{chunk-LFZODSAY.js → chunk-BUGO42R6.js} +4 -4
  43. package/dist/{chunk-7B6NW4P7.js → chunk-D3UJTX4U.js} +1 -1
  44. package/dist/{chunk-2IMQLZHS.js → chunk-FQ6BMP5P.js} +767 -81
  45. package/dist/{chunk-4TWDRU64.js → chunk-G3CQEUHI.js} +5 -5
  46. package/dist/{chunk-VGDOEKO2.js → chunk-H6ZXBFGX.js} +1 -1
  47. package/dist/{chunk-SNPQGTHJ.js → chunk-IQRPDKPJ.js} +1 -1
  48. package/dist/{chunk-CAWBLVBY.js → chunk-JVXZ3WDH.js} +6 -6
  49. package/dist/{chunk-7PZDAXIK.js → chunk-KEQAA42D.js} +1 -1
  50. package/dist/{chunk-UB5YB2ED.js → chunk-LAOP4EPL.js} +6 -6
  51. package/dist/{chunk-WYO2HXY5.js → chunk-OGRD5PFM.js} +1 -1
  52. package/dist/{chunk-AFOFVEXP.js → chunk-PRDKO3QB.js} +124 -13
  53. package/dist/{chunk-QLLOX7JY.js → chunk-QCCLDJHB.js} +8 -8
  54. package/dist/{chunk-FVVYHML7.js → chunk-RE4XWXBV.js} +6 -6
  55. package/dist/{chunk-4TRHPYTL.js → chunk-RGV6KHDM.js} +4 -4
  56. package/dist/{chunk-DGGIKWYQ.js → chunk-RGXOLPWO.js} +1 -1
  57. package/dist/{chunk-ELEAIRTG.js → chunk-TKB25A3L.js} +2 -2
  58. package/dist/{chunk-6KGMMVHF.js → chunk-U3UDPGZG.js} +2 -2
  59. package/dist/{chunk-7CVYXUOJ.js → chunk-UGWBJAGN.js} +1 -1
  60. package/dist/{chunk-LVL5NG5G.js → chunk-UMG7M32G.js} +19 -19
  61. package/dist/{chunk-LPMLAJYR.js → chunk-XCNS3CXE.js} +11 -17
  62. package/dist/{chunk-PA7QDS7P.js → chunk-XWUJWHFD.js} +204 -100
  63. package/dist/{chunk-WCQUKX74.js → chunk-ZCHHVTMF.js} +14 -5
  64. package/dist/cli/chat.js +31 -30
  65. package/dist/cli/check.js +6 -6
  66. package/dist/cli/plugins.js +13 -13
  67. package/dist/cli/snapshot-create.js +10 -10
  68. package/dist/cli/upgrade.js +7 -7
  69. package/dist/db/schema/conversation-participants.d.ts +17 -0
  70. package/dist/db/schema/conversations.d.ts +629 -1
  71. package/dist/db/schema/snapshots.d.ts +1 -1
  72. package/dist/db/schema.d.ts +18 -1
  73. package/dist/{db-A3CB76US.js → db-QVYOWATH.js} +7 -7
  74. package/dist/instrumentation.js +4 -4
  75. package/dist/nitro.js +2 -2
  76. package/dist/{oauth-callback-server-64QMI3IB.js → oauth-callback-server-PLPAFXO6.js} +23 -23
  77. package/dist/{runner-EIAE2BGD.js → runner-AGNEIOZS.js} +15 -15
  78. package/dist/{skills-ZADWFKDG.js → skills-U5KQ66EM.js} +6 -6
  79. package/dist/spawn-ZRYYZP2B.js +37 -0
  80. package/dist/{validation-4I6AF4CV.js → validation-QE4U45KS.js} +6 -6
  81. package/dist/version.js +1 -1
  82. package/dist/{work-BS6BZ66U.js → work-ATAXAHJJ.js} +18 -18
  83. package/dist/worker-LIL5AOER.js +24 -0
  84. package/migrations/0033_workspace_snapshot_active_build.sql +1 -0
  85. package/migrations/0034_strong_randall.sql +31 -0
  86. package/migrations/meta/0033_snapshot.json +2914 -0
  87. package/migrations/meta/0034_snapshot.json +3038 -0
  88. package/migrations/meta/_journal.json +15 -1
  89. package/package.json +5 -5
  90. package/dist/spawn-DVUOUFFC.js +0 -37
  91. package/dist/worker-RS5PWTCE.js +0 -24
package/dist/app.js CHANGED
@@ -1,15 +1,15 @@
1
1
  import {
2
2
  processConversationWork
3
- } from "./chunk-UB5YB2ED.js";
3
+ } from "./chunk-LAOP4EPL.js";
4
4
  import {
5
5
  bindSpawnAgent
6
- } from "./chunk-DGGIKWYQ.js";
6
+ } from "./chunk-RGXOLPWO.js";
7
7
  import {
8
8
  createAgentInvocationWorker,
9
9
  enqueueAgentInvocation,
10
10
  listPendingAgentInvocationMailboxAppends,
11
11
  routeAgentInvocationWork
12
- } from "./chunk-FVVYHML7.js";
12
+ } from "./chunk-RE4XWXBV.js";
13
13
  import {
14
14
  GET as GET2,
15
15
  GET2 as GET3,
@@ -36,12 +36,8 @@ import {
36
36
  startSlackProcessingReaction,
37
37
  stripLeadingBotMention,
38
38
  wakePausedTurn
39
- } from "./chunk-LVL5NG5G.js";
39
+ } from "./chunk-UMG7M32G.js";
40
40
  import "./chunk-FA6POGLH.js";
41
- import {
42
- getTurnRequestDeadline,
43
- runWithTurnRequestDeadline
44
- } from "./chunk-6NZRKJWU.js";
45
41
  import {
46
42
  GET,
47
43
  apiTurnIdForMessage,
@@ -58,8 +54,8 @@ import {
58
54
  resolveSlackConversationContext,
59
55
  routeApiTurnWork,
60
56
  webActorFromEmail
61
- } from "./chunk-AFOFVEXP.js";
62
- import "./chunk-4SVAFAI2.js";
57
+ } from "./chunk-PRDKO3QB.js";
58
+ import "./chunk-AVRWMQ4U.js";
63
59
  import {
64
60
  CONVERSATION_WORK_STALE_ENQUEUE_MS,
65
61
  appendAndEnqueueInboundMessage,
@@ -70,7 +66,7 @@ import {
70
66
  isInvalidConversationRecordError,
71
67
  listActiveConversationIds,
72
68
  removeActiveConversation
73
- } from "./chunk-LFZODSAY.js";
69
+ } from "./chunk-BUGO42R6.js";
74
70
  import {
75
71
  buildDeliveredTurnStatePatch,
76
72
  claimDispatchMailboxAppend,
@@ -100,7 +96,7 @@ import {
100
96
  requireTurnFailureEventId,
101
97
  resolveTurnSessionRouting,
102
98
  scheduleSessionCompletedPluginTasks
103
- } from "./chunk-7ZFESKJ2.js";
99
+ } from "./chunk-4K6VNP3S.js";
104
100
  import {
105
101
  ConversationTurnLifecycleService,
106
102
  coerceThreadConversationState,
@@ -110,7 +106,7 @@ import {
110
106
  persistThreadRuntimeState,
111
107
  persistThreadState,
112
108
  persistThreadStateById
113
- } from "./chunk-4TWDRU64.js";
109
+ } from "./chunk-G3CQEUHI.js";
114
110
  import "./chunk-UTL3MHPC.js";
115
111
  import {
116
112
  getVercelConversationWorkQueue,
@@ -129,7 +125,7 @@ import {
129
125
  import {
130
126
  validatePluginEgressCredentialHooks,
131
127
  validatePluginRegistrations
132
- } from "./chunk-WYO2HXY5.js";
128
+ } from "./chunk-OGRD5PFM.js";
133
129
  import {
134
130
  defineJuniorPlugins,
135
131
  pluginCatalogConfigFromEnv,
@@ -161,11 +157,11 @@ import {
161
157
  shouldEmitDevAgentTrace,
162
158
  shouldPropagateSandboxEgressTrace,
163
159
  unpublishedArtifactHeaders
164
- } from "./chunk-2IMQLZHS.js";
160
+ } from "./chunk-FQ6BMP5P.js";
165
161
  import {
166
162
  AuthorizationFlowDisabledError,
167
163
  PluginCredentialFailureError
168
- } from "./chunk-ZCYABD7N.js";
164
+ } from "./chunk-BHHWCNXI.js";
169
165
  import "./chunk-DIB4GX3G.js";
170
166
  import {
171
167
  createAgentRunner,
@@ -173,7 +169,11 @@ import {
173
169
  deleteMcpAuthSessionsForUserProvider,
174
170
  deleteMcpServerSessionId,
175
171
  deleteMcpStoredOAuthCredentials
176
- } from "./chunk-QLLOX7JY.js";
172
+ } from "./chunk-QCCLDJHB.js";
173
+ import {
174
+ getTurnRequestDeadline,
175
+ runWithTurnRequestDeadline
176
+ } from "./chunk-6OYVH66J.js";
177
177
  import {
178
178
  RetryableDeliveryError
179
179
  } from "./chunk-RF6J3DIO.js";
@@ -181,7 +181,7 @@ import {
181
181
  formatProviderLabel,
182
182
  postSlackMessage,
183
183
  startOAuthFlow
184
- } from "./chunk-CAWBLVBY.js";
184
+ } from "./chunk-JVXZ3WDH.js";
185
185
  import "./chunk-6ZWRNC4D.js";
186
186
  import {
187
187
  getExperimentalFeatures,
@@ -197,10 +197,10 @@ import {
197
197
  requestAttachmentDeletion,
198
198
  resourceEventGuidance,
199
199
  scheduledTaskRunAttributes
200
- } from "./chunk-4TRHPYTL.js";
200
+ } from "./chunk-RGV6KHDM.js";
201
201
  import {
202
202
  parseSlackThreadId
203
- } from "./chunk-3FWXQZJJ.js";
203
+ } from "./chunk-22T3HB44.js";
204
204
  import {
205
205
  ConversationTurnBoundaryError,
206
206
  CooperativeTurnYieldError,
@@ -252,11 +252,11 @@ import {
252
252
  trimTrailingAssistantMessages,
253
253
  turnHasReply,
254
254
  upsertConversationMessage
255
- } from "./chunk-I7PKGMKI.js";
255
+ } from "./chunk-BFLMRTPD.js";
256
256
  import {
257
257
  getSandboxResourceConfig,
258
258
  setSandboxResourceConfig
259
- } from "./chunk-N4YEVOEC.js";
259
+ } from "./chunk-534BO42N.js";
260
260
  import "./chunk-PDO5BLNM.js";
261
261
  import "./chunk-UIE3R5XU.js";
262
262
  import {
@@ -287,7 +287,7 @@ import {
287
287
  verifyEventTaskCredentialSubject,
288
288
  verifyScheduledTaskCredentialSubject,
289
289
  verifySlackDirectCredentialSubject
290
- } from "./chunk-PA7QDS7P.js";
290
+ } from "./chunk-XWUJWHFD.js";
291
291
  import "./chunk-3Y47VMHV.js";
292
292
  import {
293
293
  contextProvenance,
@@ -301,21 +301,21 @@ import {
301
301
  requireSlackDestination,
302
302
  withConversationEventLock,
303
303
  withConversationMutationLock
304
- } from "./chunk-LPMLAJYR.js";
304
+ } from "./chunk-XCNS3CXE.js";
305
305
  import {
306
306
  juniorAgentBindings,
307
307
  juniorAgentInvocations,
308
308
  juniorConversationEvents,
309
309
  juniorConversations
310
- } from "./chunk-WCQUKX74.js";
310
+ } from "./chunk-ZCHHVTMF.js";
311
311
  import {
312
312
  sleep
313
- } from "./chunk-Q362TECJ.js";
313
+ } from "./chunk-AQHSXA3J.js";
314
314
  import {
315
315
  acquireActiveLock,
316
316
  getStateAdapter,
317
317
  withActiveLock
318
- } from "./chunk-VGDOEKO2.js";
318
+ } from "./chunk-H6ZXBFGX.js";
319
319
  import {
320
320
  STANDARD_MODEL_PROFILE,
321
321
  botConfig,
@@ -333,16 +333,16 @@ import {
333
333
  modelIdForProfile,
334
334
  setSlackReactionConfig,
335
335
  standardModelId
336
- } from "./chunk-DLTP6TUJ.js";
336
+ } from "./chunk-3ZZEPLLB.js";
337
337
  import {
338
338
  juniorDestinations
339
339
  } from "./chunk-VFUK3X5B.js";
340
- import "./chunk-7PZDAXIK.js";
341
- import "./chunk-6KGMMVHF.js";
340
+ import "./chunk-KEQAA42D.js";
341
+ import "./chunk-U3UDPGZG.js";
342
342
  import {
343
343
  pluginCatalogRuntime
344
- } from "./chunk-J2EWL6GJ.js";
345
- import "./chunk-7B6NW4P7.js";
344
+ } from "./chunk-ABLODWPO.js";
345
+ import "./chunk-D3UJTX4U.js";
346
346
  import {
347
347
  credentialContextForActor
348
348
  } from "./chunk-CGA4ERJ5.js";
@@ -374,7 +374,7 @@ import {
374
374
  withContext,
375
375
  withLogContext,
376
376
  withSpan
377
- } from "./chunk-7CVYXUOJ.js";
377
+ } from "./chunk-UGWBJAGN.js";
378
378
  import {
379
379
  continueTrace
380
380
  } from "./chunk-6GWA276C.js";
@@ -382,10 +382,10 @@ import "./chunk-OOUNJNMR.js";
382
382
  import "./chunk-H4HBKISO.js";
383
383
  import {
384
384
  JUNIOR_PLUGIN_TASK_CALLBACK_ROUTE
385
- } from "./chunk-ORMJY4RG.js";
385
+ } from "./chunk-AGJ4OQ2V.js";
386
386
  import {
387
387
  JUNIOR_VERSION
388
- } from "./chunk-SNPQGTHJ.js";
388
+ } from "./chunk-IQRPDKPJ.js";
389
389
  import "./chunk-MLKGABMK.js";
390
390
 
391
391
  // src/app.ts
@@ -1,15 +1,15 @@
1
1
  import {
2
2
  pluginCatalogRuntime
3
- } from "./chunk-J2EWL6GJ.js";
4
- import "./chunk-7B6NW4P7.js";
3
+ } from "./chunk-ABLODWPO.js";
4
+ import "./chunk-D3UJTX4U.js";
5
5
  import "./chunk-CGA4ERJ5.js";
6
6
  import "./chunk-M63DETLL.js";
7
- import "./chunk-7CVYXUOJ.js";
7
+ import "./chunk-UGWBJAGN.js";
8
8
  import "./chunk-6GWA276C.js";
9
9
  import "./chunk-OOUNJNMR.js";
10
10
  import "./chunk-H4HBKISO.js";
11
- import "./chunk-ORMJY4RG.js";
12
- import "./chunk-SNPQGTHJ.js";
11
+ import "./chunk-AGJ4OQ2V.js";
12
+ import "./chunk-IQRPDKPJ.js";
13
13
  import "./chunk-MLKGABMK.js";
14
14
  export {
15
15
  pluginCatalogRuntime
@@ -31,6 +31,8 @@ export interface AgentSandboxOptions {
31
31
  actor?: Actor;
32
32
  locationConfiguration?: LocationConfigurationService;
33
33
  configurationValues: Record<string, unknown>;
34
+ /** Durable-worker soft yield for long Workspace snapshot waits. */
35
+ shouldYield?: () => boolean;
34
36
  getActiveSkill(): Skill | null;
35
37
  prepareSandbox(workspace: SandboxWorkspace): void | Promise<void>;
36
38
  prepareWorkspace?(workspace: SandboxWorkspace, recipe: Workspace, signal?: AbortSignal): Promise<void>;
@@ -9,6 +9,7 @@ export declare function recordConversationParticipant(executor: JuniorSqlDatabas
9
9
  actorIdentityId: string;
10
10
  conversationId: string;
11
11
  atMs: number;
12
+ restoreArchive?: boolean;
12
13
  }): Promise<void>;
13
14
  /** Find which of the supplied root conversations include the linked user. */
14
15
  export declare function rootConversationIdsForParticipant(executor: JuniorSqlDatabase, args: {
@@ -18,7 +18,6 @@ export interface ConversationLineage {
18
18
  parentConversationId: string;
19
19
  }
20
20
  export interface Conversation {
21
- archivedAtMs?: number;
22
21
  channelName?: string;
23
22
  conversationId: string;
24
23
  createdAtMs: number;
@@ -6,6 +6,10 @@ export declare function isSandboxUnavailableError(error: unknown): boolean;
6
6
  export declare function isSandboxMissingError(error: unknown): boolean;
7
7
  /** Detect transient snapshot boot races so sandbox creation can retry. */
8
8
  export declare function isSnapshottingError(error: unknown): boolean;
9
+ /** Detect cancellation so a durable builder stays available for check-in. */
10
+ export declare function isAbortError(error: unknown): boolean;
11
+ /** Detect transient Vercel Sandbox API failures that keep a job resumable. */
12
+ export declare function isSandboxApiTransientError(error: unknown): boolean;
9
13
  /** Detect interrupted command streams where no reliable exit status is available. */
10
14
  export declare function isSandboxCommandStreamInterruptedError(error: unknown): boolean;
11
15
  /** Wrap raw sandbox setup failures into one stable user-facing error contract. */
@@ -10,6 +10,7 @@ interface NonInteractiveCommandInput extends NonInteractiveShellOptions {
10
10
  login?: boolean;
11
11
  signal?: AbortSignal;
12
12
  sudo?: boolean;
13
+ timeoutMs?: number;
13
14
  }
14
15
  /** Render one argv command as a safely quoted shell script. */
15
16
  export declare function buildCommandScript(input: Pick<NonInteractiveCommandInput, "args" | "cmd">): string;
@@ -1,11 +1,35 @@
1
1
  import type { SandboxSession } from "@/chat/sandbox/workspace";
2
2
  import type { Workspace } from "@/chat/workspaces/types";
3
- /** Prepare repositories and setup state before a Workspace snapshot is captured. */
4
- export declare function prepareWorkspaceSnapshot(params: {
3
+ interface PrepareWorkspaceParams {
5
4
  sandbox: SandboxSession;
6
5
  workspace: Workspace;
7
6
  signal?: AbortSignal;
8
7
  applyNetworkPolicy(sandbox: SandboxSession): Promise<unknown>;
9
8
  prepareRepositories?(sandbox: SandboxSession, workspace: Workspace, signal?: AbortSignal): Promise<void>;
10
9
  removeCredentialRoute: boolean;
11
- }): Promise<void>;
10
+ }
11
+ /** Prepare repositories before a Workspace setup script starts. */
12
+ export declare function prepareWorkspaceRepositories(params: PrepareWorkspaceParams): Promise<void>;
13
+ /** Build the command for one Workspace setup script. */
14
+ export declare function workspaceSetupCommand(workspace: Workspace): {
15
+ cmd: string;
16
+ args: string[];
17
+ cwd: string;
18
+ env: {
19
+ JUNIOR_REPOS_ROOT: string;
20
+ JUNIOR_WORKSPACE_ROOT: string;
21
+ };
22
+ };
23
+ /** Build a restart-safe command for one Workspace snapshot setup script. */
24
+ export declare function workspaceSnapshotSetupCommand(workspace: Workspace, buildId: string): {
25
+ cmd: string;
26
+ args: string[];
27
+ cwd: string;
28
+ env: {
29
+ JUNIOR_REPOS_ROOT: string;
30
+ JUNIOR_WORKSPACE_ROOT: string;
31
+ };
32
+ };
33
+ /** Prepare repositories and setup state before a Workspace snapshot is captured. */
34
+ export declare function prepareWorkspaceSnapshot(params: PrepareWorkspaceParams): Promise<void>;
35
+ export {};
@@ -33,6 +33,8 @@ export interface SandboxOptions {
33
33
  skills: SkillMetadata[];
34
34
  referenceFiles: string[];
35
35
  timeoutMs?: number;
36
+ /** Durable-worker soft yield for long Workspace snapshot waits. */
37
+ shouldYield?: () => boolean;
36
38
  traceContext?: LogContext;
37
39
  tracePropagation?: SandboxEgressTracePropagationConfig;
38
40
  credentialEgress?: CredentialContext;
@@ -38,6 +38,8 @@ interface SandboxRuntimeOptions {
38
38
  skills: SkillMetadata[];
39
39
  referenceFiles: string[];
40
40
  timeoutMs?: number;
41
+ /** Durable-worker soft yield for long Workspace snapshot waits. */
42
+ shouldYield?: () => boolean;
41
43
  traceContext?: LogContext;
42
44
  commandEnv?: () => Promise<Record<string, string>>;
43
45
  createNetworkPolicy?: (egressId: string, traceHeaders?: TracePropagationHeaders) => NetworkPolicy | undefined;
@@ -0,0 +1,5 @@
1
+ import { Sandbox } from "@vercel/sandbox";
2
+ /** Resume the named Sandbox that owns one Workspace snapshot build. */
3
+ export declare function getWorkspaceSnapshotBuilder(name: string, signal?: AbortSignal): Promise<Sandbox>;
4
+ /** Permanently delete named Workspace snapshot builders without resuming them. */
5
+ export declare function deleteWorkspaceSnapshotBuilders(names: Iterable<string>): Promise<void>;
@@ -1,6 +1,6 @@
1
1
  import type { PluginRuntimeDependency, PluginRuntimePostinstallCommand } from "@/chat/plugins/types";
2
2
  import type { SandboxSession } from "@/chat/sandbox/workspace";
3
3
  /** Install declared system and npm dependencies into a snapshot sandbox. */
4
- export declare function dependencies(sandbox: SandboxSession, values: PluginRuntimeDependency[], signal?: AbortSignal): Promise<void>;
4
+ export declare function dependencies(sandbox: SandboxSession, values: PluginRuntimeDependency[], signal?: AbortSignal, timeoutMs?: number): Promise<void>;
5
5
  /** Run declared postinstall commands after dependency binaries are available. */
6
- export declare function postinstall(sandbox: SandboxSession, commands: PluginRuntimePostinstallCommand[], signal?: AbortSignal): Promise<void>;
6
+ export declare function postinstall(sandbox: SandboxSession, commands: PluginRuntimePostinstallCommand[], signal?: AbortSignal, timeoutMs?: number): Promise<void>;
@@ -1,2 +1,5 @@
1
+ import type { Snapshot } from "@/chat/sandbox/snapshot/resolve";
2
+ /** Record the reusable snapshot selected for a new Sandbox. */
3
+ export declare function setSnapshotSpanAttributes(snapshot: Snapshot): void;
1
4
  /** Record one stage of dependency snapshot resolution or creation. */
2
5
  export declare function trace<T>(name: string, op: string, attributes: Record<string, unknown>, callback: () => Promise<T>): Promise<T>;
@@ -1,28 +1,31 @@
1
1
  import type { JuniorDatabase } from "@/db/db";
2
- import type { WorkspaceSnapshot, WorkspaceSnapshotBuild } from "@/chat/workspaces/types";
2
+ import type { Workspace, WorkspaceSnapshot, WorkspaceSnapshotBuild } from "@/chat/workspaces/types";
3
3
  /** Current ready artifact and build state for one Workspace profile. */
4
4
  export interface WorkspaceSnapshots {
5
5
  ready: WorkspaceSnapshot | null;
6
6
  build: WorkspaceSnapshotBuild | null;
7
7
  }
8
+ /** Result of replacing the ready snapshot for one Workspace profile. */
9
+ export interface WorkspaceSnapshotWriteResult {
10
+ written: boolean;
11
+ replacedBuilderNames: string[];
12
+ }
8
13
  /** Load bounded ready and build views for one Workspace profile hash. */
9
14
  export declare function loadSnapshotsForProfile(db: JuniorDatabase, workspaceId: string, profileHash: string): Promise<WorkspaceSnapshots>;
10
- /** Drop in-flight or failed rows when a recipe changes. Keep ready rows. */
11
- export declare function clearNonReadySnapshots(db: JuniorDatabase, workspaceId: string): Promise<string[]>;
12
- /** Drop one ready row whose provider snapshot no longer exists. */
13
- export declare function invalidateMissingReadySnapshot(params: {
15
+ /** Drop every snapshot row before its Workspace is deleted. */
16
+ export declare function clearWorkspaceSnapshots(db: JuniorDatabase, workspaceId: string): Promise<string[]>;
17
+ /** Drop one ready snapshot and return the name of its provider owner. */
18
+ export declare function invalidateReadySnapshot(params: {
14
19
  workspaceId: string;
15
20
  profileHash: string;
16
21
  snapshotId: string;
17
- }): Promise<void>;
18
- /** Record the full Sandbox snapshot after a successful Workspace prepare. */
19
- export declare function setWorkspaceSnapshot(workspaceId: string, snapshot: WorkspaceSnapshot): Promise<void>;
20
- /** Record a Workspace snapshot build that can continue across execution slices. */
21
- export declare function setWorkspaceSnapshotBuild(workspaceId: string, build: WorkspaceSnapshotBuild): Promise<void>;
22
- /** Persist Workspace snapshot facts when resolve returns a concrete entry. */
23
- export declare function recordResolvedWorkspaceSnapshot(workspaceId: string, snapshot: {
24
- snapshotId?: string;
25
- profileHash?: string;
26
- createdAtMs?: number;
27
- buildDurationMs?: number;
28
- }): Promise<void>;
22
+ }): Promise<string | null>;
23
+ /** Complete one owned build and report provider owners that it replaced. */
24
+ export declare function setWorkspaceSnapshot(workspaceId: string, snapshot: WorkspaceSnapshot, options: {
25
+ buildId: string;
26
+ }): Promise<WorkspaceSnapshotWriteResult>;
27
+ /** Update an owned build row. Initial creation locks and verifies its Workspace. */
28
+ export declare function setWorkspaceSnapshotBuild(workspaceId: string, build: WorkspaceSnapshotBuild, options?: {
29
+ insertIfMissing?: boolean;
30
+ expectedRecipe?: Pick<Workspace, "setupScript" | "repos">;
31
+ }): Promise<boolean>;
@@ -0,0 +1,15 @@
1
+ /**
2
+ * Soft deadline hit while a Workspace snapshot is still building.
3
+ * The tool returns timed_out so the host can yield at a tool-result boundary.
4
+ */
5
+ export declare class WorkspaceSnapshotWaitingError extends Error {
6
+ readonly code = "workspace_snapshot_waiting";
7
+ readonly workspaceName: string;
8
+ constructor(workspaceName: string);
9
+ }
10
+ /** True when a structured tool result is a soft Workspace snapshot wait. */
11
+ export declare function isWorkspaceSnapshotWaitingResult(details: unknown): boolean;
12
+ /** Workspace name from a soft-wait tool result, if present. */
13
+ export declare function workspaceNameFromWaitingResult(details: unknown): string | undefined;
14
+ /** True when an error chain contains the Workspace snapshot wait signal. */
15
+ export declare function isWorkspaceSnapshotWaitingError(error: unknown): error is WorkspaceSnapshotWaitingError;
@@ -0,0 +1,17 @@
1
+ import type { Snapshot } from "@/chat/sandbox/snapshot/resolve";
2
+ import { type SandboxSession } from "@/chat/sandbox/workspace";
3
+ import type { Workspace } from "@/chat/workspaces/types";
4
+ /**
5
+ * Resolve a Workspace snapshot through resumable execution slices.
6
+ * Cold builds have one shared one-hour budget across every execution slice.
7
+ */
8
+ export declare function resolveWorkspaceSnapshot(params: {
9
+ workspace: Workspace;
10
+ runtime: string;
11
+ staleSnapshotId?: string;
12
+ signal?: AbortSignal;
13
+ shouldYield?: () => boolean;
14
+ applyNetworkPolicy(sandbox: SandboxSession): Promise<unknown>;
15
+ prepareRepositories?(sandbox: SandboxSession, workspace: Workspace, signal?: AbortSignal): Promise<void>;
16
+ removeCredentialRoute: boolean;
17
+ }): Promise<Snapshot>;
@@ -0,0 +1,27 @@
1
+ import type { AgentTool } from "@earendil-works/pi-agent-core";
2
+ import type { PiMessage } from "@/chat/pi/messages";
3
+ /** Pending soft wait for a Workspace snapshot from the latest tool result. */
4
+ export declare function pendingWorkspaceSnapshotWait(messages: readonly PiMessage[]): {
5
+ name: string;
6
+ } | null;
7
+ /**
8
+ * Continue a soft Workspace snapshot wait without another model turn.
9
+ * Re-invokes switchWorkspace and appends the complete Pi tool boundary.
10
+ */
11
+ export declare function continueWorkspaceSnapshotWait(args: {
12
+ messages: PiMessage[];
13
+ tools: AgentTool[];
14
+ signal?: AbortSignal;
15
+ }): Promise<{
16
+ kind: "none";
17
+ } | {
18
+ kind: "waiting";
19
+ messages: PiMessage[];
20
+ } | {
21
+ kind: "ready";
22
+ messages: PiMessage[];
23
+ } | {
24
+ kind: "failed";
25
+ error: unknown;
26
+ messages: PiMessage[];
27
+ }>;
@@ -15,6 +15,7 @@ export type WorkspaceSnapshotStatus = WorkspaceSnapshotBuildStatus | "ready";
15
15
  export type WorkspaceSnapshotBuildPhase = "created" | "dependencies_installed" | "repositories_prepared";
16
16
  /** Current snapshot build for one Workspace recipe. */
17
17
  export interface WorkspaceSnapshotBuild {
18
+ id: string;
18
19
  status: WorkspaceSnapshotBuildStatus;
19
20
  phase: WorkspaceSnapshotBuildPhase;
20
21
  profileHash: string;
@@ -5,7 +5,7 @@ import {
5
5
  } from "./chunk-M63DETLL.js";
6
6
  import {
7
7
  toOptionalString
8
- } from "./chunk-7CVYXUOJ.js";
8
+ } from "./chunk-UGWBJAGN.js";
9
9
 
10
10
  // src/chat/slack/context.ts
11
11
  import { z } from "zod";
@@ -3,7 +3,7 @@ import {
3
3
  toCanonicalInputMessage,
4
4
  toCanonicalOutputMessage,
5
5
  toGenAiMessagesTraceAttributes
6
- } from "./chunk-7PZDAXIK.js";
6
+ } from "./chunk-KEQAA42D.js";
7
7
  import {
8
8
  extractGenAiUsageAttributes,
9
9
  logException,
@@ -11,7 +11,7 @@ import {
11
11
  normalizeGenAiFinishReason,
12
12
  serializeGenAiAttribute,
13
13
  withSpan
14
- } from "./chunk-7CVYXUOJ.js";
14
+ } from "./chunk-UGWBJAGN.js";
15
15
 
16
16
  // src/chat/services/provider-error.ts
17
17
  var ProviderError = class extends Error {
@@ -2,7 +2,7 @@ import {
2
2
  coerceThreadConversationState,
3
3
  getPersistedThreadState,
4
4
  persistThreadStateById
5
- } from "./chunk-4TWDRU64.js";
5
+ } from "./chunk-G3CQEUHI.js";
6
6
  import {
7
7
  pluginTaskId,
8
8
  pluginTaskParamsSchema,
@@ -22,7 +22,7 @@ import {
22
22
  markTurnCompleted,
23
23
  normalizeToolNameFromResult,
24
24
  stripRuntimeTurnContext
25
- } from "./chunk-I7PKGMKI.js";
25
+ } from "./chunk-BFLMRTPD.js";
26
26
  import {
27
27
  createPluginConversationEvents,
28
28
  createPluginEmbedder,
@@ -30,7 +30,7 @@ import {
30
30
  createPluginModel,
31
31
  createPluginState,
32
32
  getPlugins
33
- } from "./chunk-PA7QDS7P.js";
33
+ } from "./chunk-XWUJWHFD.js";
34
34
  import {
35
35
  JUNIOR_THREAD_STATE_TTL_MS
36
36
  } from "./chunk-3Y47VMHV.js";
@@ -38,20 +38,20 @@ import {
38
38
  getConversationStore,
39
39
  getDb,
40
40
  sameActorIdentity
41
- } from "./chunk-LPMLAJYR.js";
41
+ } from "./chunk-XCNS3CXE.js";
42
42
  import {
43
43
  juniorConversations,
44
44
  juniorTaskExecutions
45
- } from "./chunk-WCQUKX74.js";
45
+ } from "./chunk-ZCHHVTMF.js";
46
46
  import {
47
47
  getStateAdapter
48
- } from "./chunk-VGDOEKO2.js";
48
+ } from "./chunk-H6ZXBFGX.js";
49
49
  import {
50
50
  ProviderError,
51
51
  findProviderError,
52
52
  getProviderErrorAttributes,
53
53
  getProviderErrorUserMessage
54
- } from "./chunk-DLTP6TUJ.js";
54
+ } from "./chunk-3ZZEPLLB.js";
55
55
  import {
56
56
  credentialSubjectSchema
57
57
  } from "./chunk-CGA4ERJ5.js";
@@ -61,7 +61,7 @@ import {
61
61
  import {
62
62
  buildTurnFailureResponse,
63
63
  logWarn
64
- } from "./chunk-7CVYXUOJ.js";
64
+ } from "./chunk-UGWBJAGN.js";
65
65
 
66
66
  // src/chat/runtime/delivered-turn-state.ts
67
67
  function buildDeliveredTurnStatePatch(args) {
@@ -87,7 +87,7 @@ import { pluginRunContextSchema } from "@sentry/junior-plugin-api";
87
87
 
88
88
  // src/chat/services/turn-session-routing.ts
89
89
  async function resolveTurnSessionRouting(args) {
90
- const conversationStore = args.conversationStore ?? (await import("./db-A3CB76US.js")).getConversationStore();
90
+ const conversationStore = args.conversationStore ?? (await import("./db-QVYOWATH.js")).getConversationStore();
91
91
  const conversation = await conversationStore.get({
92
92
  conversationId: args.conversationId
93
93
  });