@sentry/junior 0.318.0 → 0.319.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 (92) hide show
  1. package/dist/{context-BKF_5zzI.js → adapter-8_S6Birm.js} +537 -537
  2. package/dist/{admin-UOHix_5P.js → admin-EsbUON1j.js} +1 -1
  3. package/dist/{agent-runner-DeYymwh2.js → agent-CtzMl32d.js} +18608 -5452
  4. package/dist/{agent-status-BA5x3Xtp.js → agent-status-Bq_AIpyp.js} +105 -1
  5. package/dist/{agent-update-delivery-DH8bx7jU.js → agent-update-delivery-pAvsbuGL.js} +4 -5
  6. package/dist/api/schema.d.ts +43 -23
  7. package/dist/api/schema.js +4 -4
  8. package/dist/api.js +70 -80
  9. package/dist/{app-DKAOuaoC.d.ts → app-tACXxJPI.d.ts} +4 -4
  10. package/dist/app.d.ts +2 -2
  11. package/dist/app.js +213 -91
  12. package/dist/{change-record-BzJgLsv7.d.ts → change-record-K-KsqNhT.d.ts} +9 -5
  13. package/dist/{channel-access-A0de5lRv.js → channel-access-DET5hzZM.js} +1 -1
  14. package/dist/{chat-core-engine-D3Wd7f5n.js → chat-core-engine-DpM3tMVi.js} +5 -5
  15. package/dist/cli/chat.d.ts +1 -1
  16. package/dist/cli/chat.js +23 -23
  17. package/dist/cli/check.js +5 -5
  18. package/dist/cli/main.js +2 -2
  19. package/dist/cli/plugins.d.ts +1 -1
  20. package/dist/cli/plugins.js +8 -8
  21. package/dist/cli/snapshot-create.js +5 -5
  22. package/dist/cli/upgrade.d.ts +1 -1
  23. package/dist/cli/upgrade.js +3 -4
  24. package/dist/{continue-in-slack-YxwMQVeR.js → continue-in-slack-CFzDyxkH.js} +3 -3
  25. package/dist/{conversation-feed-Cj7IuBtM.js → conversation-feed-DEUdD7mb.js} +2 -106
  26. package/dist/{conversation-privacy-Cr_dNW1p.js → conversation-privacy-C2vYK55O.js} +1 -1
  27. package/dist/{create-Btl1y1rq.js → create-Ta3SEIB5.js} +115 -5
  28. package/dist/{credential-sync-DTarZ63K.js → credential-sync-DyRqDmY4.js} +15 -18
  29. package/dist/{db-of6e3sGt.js → db-BCaNWl9p.js} +4579 -717
  30. package/dist/{deployment-C0qXa0FD.js → deployment-CfOew1Tm.js} +3 -3
  31. package/dist/{engine-context-C_QL_bMQ.js → engine-context-CiExoy1B.js} +144 -149
  32. package/dist/{html-9_pS9SjY.js → html-Bb2Si1bR.js} +6 -8
  33. package/dist/instrumentation.js +7 -23
  34. package/dist/list-wwDcROh9.js +5007 -0
  35. package/dist/{logging-BnOG0qz2.js → logging-BRPTXAdf.js} +8 -33
  36. package/dist/{mailbox-turn-Byrry9o1.js → markers-9QoqW5ov.js} +1675 -1255
  37. package/dist/nitro.d.ts +2 -2
  38. package/dist/nitro.js +6 -7
  39. package/dist/{oauth-callback-server-CjnnUr4o.js → oauth-callback-server-vhL9b-PZ.js} +2 -2
  40. package/dist/{oauth-relay-BvHFH0fV.js → oauth-relay-CH2v7WiB.js} +1 -1
  41. package/dist/{plugins-fBrz8PCV.d.ts → plugins-DhGXZjlu.d.ts} +1 -0
  42. package/dist/{profile-iHw1uu32.js → profile-D9LdwmZi.js} +16 -18
  43. package/dist/{prompt-DEkStuxG.js → prompt-3TqxEOtc.js} +1 -1
  44. package/dist/{reports-C1d9azyV.js → reports-K-tbtEyx.js} +2 -2
  45. package/dist/{resolve-DC6zBuDV.js → resolve-BBV2qf8A.js} +5 -5
  46. package/dist/{result-DxewDuXb.js → result-5IdGJP4M.js} +20 -9
  47. package/dist/{runner-99YxVN_r.js → runner-BK_joPlM.js} +7 -8
  48. package/dist/{sandbox-egress-signals-CgoX5CTI.js → sandbox-egress-signals-DXgWXXmm.js} +1 -1
  49. package/dist/{schema-BTojNBr5.js → schema-zWGG6VC1.js} +13 -7
  50. package/dist/{service-account-YDCPSByj.js → service-account-CateFyhw.js} +4 -5
  51. package/dist/{skills-CleC0Hze.js → skills-Ccjw8h2P.js} +9 -9
  52. package/dist/{slack-conversation-unfurl-BNQLC12R.js → slack-conversation-unfurl-ZC_TSpc4.js} +7 -7
  53. package/dist/storage-C9U7R5rM.js +273 -0
  54. package/dist/{system-prompt-table-Ci6Ck4gk.js → system-prompt-table-YBTHIFlP.js} +26 -84
  55. package/dist/topic-B2EWKKBT.js +6 -0
  56. package/dist/{package-discovery-DD9vencX.js → topics-DxuKurCX.js} +21 -1
  57. package/dist/{types-DCzTAA63.js → types-BNHkJrOP.js} +25 -11
  58. package/dist/{users-Cb9c1k9q.js → users-CCRAqYb_.js} +1 -1
  59. package/dist/{validation-BiUmWPhy.js → validation-BCUpJa8K.js} +4 -4
  60. package/dist/{version-VEXiEcZu.js → version-BNm0JYj3.js} +1 -1
  61. package/dist/version.js +1 -1
  62. package/dist/{worker-ChWYQdhm.js → worker-BhgpZ7_b.js} +4 -4
  63. package/migrations/20261127052408_space_name_nullable/migration.sql +5 -0
  64. package/migrations/20261127052408_space_name_nullable/snapshot.json +29 -0
  65. package/migrations/20261127060000_annotation_object_id_index/migration.sql +1 -0
  66. package/migrations/20261127060000_annotation_object_id_index/snapshot.json +69 -0
  67. package/migrations/20261127060001_annotation_subjects/migration.sql +78 -0
  68. package/migrations/20261127060001_annotation_subjects/snapshot.json +104 -0
  69. package/migrations/20261127060002_annotation_subject_index/migration.sql +1 -0
  70. package/migrations/20261127060002_annotation_subject_index/snapshot.json +70 -0
  71. package/migrations/20261127060003_annotation_title_url/migration.sql +84 -0
  72. package/migrations/20261127060003_annotation_title_url/snapshot.json +73 -0
  73. package/package.json +9 -7
  74. package/dist/auth-pause-state-f9hJM_zO.js +0 -113
  75. package/dist/catalog-runtime-BfdAnztW.js +0 -6
  76. package/dist/child-message-peFWLcCZ.js +0 -15
  77. package/dist/conversation-turn-Bru4w_FD.js +0 -1250
  78. package/dist/job-runner-B2XEvpif.js +0 -1505
  79. package/dist/lineage-nh4z9iQN.js +0 -36
  80. package/dist/list-HRP3TIRl.js +0 -12631
  81. package/dist/markers-CTTtJqYn.js +0 -342
  82. package/dist/message-BRUuLgrY.js +0 -153
  83. package/dist/model-input-CFC62mf-.js +0 -82
  84. package/dist/registry-Cl7Labpe.js +0 -3279
  85. package/dist/run-conversation-Cz2ubZK-.js +0 -337
  86. package/dist/sender-actors-77zTQbSG.js +0 -84
  87. package/dist/spawn-DuZfodPa.js +0 -45
  88. package/dist/task-runner-BJ9Up3bG.js +0 -1529
  89. package/dist/topic-CRYYBYp-.js +0 -7
  90. package/dist/topics-BoCkoPJJ.js +0 -21
  91. package/dist/turn-membership-VT7XZh-L.js +0 -856
  92. package/dist/turn-wake-C7HeLHAM.js +0 -151
@@ -0,0 +1,273 @@
1
+ import { R as getChatConfig } from "./adapter-8_S6Birm.js";
2
+ import { G as mapBounded } from "./prompt-3TqxEOtc.js";
3
+ import * as z from "zod";
4
+ import { AwsClient } from "aws4fetch";
5
+ import { del, get, issueSignedToken, presignUrl, put } from "@vercel/blob";
6
+ // src/chat/attachments/memory.ts
7
+ /**
8
+ * Store attachments in process memory, for tests.
9
+ *
10
+ * Objects are lost when the process stops, and each process has its own
11
+ * copy. Do not use this provider for deployed apps.
12
+ */
13
+ function createMemoryAttachmentStorage() {
14
+ const objects = /* @__PURE__ */ new Map();
15
+ return {
16
+ objects,
17
+ provider: "memory",
18
+ async put(input) {
19
+ objects.set(input.key, Buffer.from(await new Response(input.body).arrayBuffer()));
20
+ },
21
+ async get(key, range) {
22
+ const body = objects.get(key);
23
+ if (!body) return null;
24
+ const bytes = range ? body.subarray(range.start, range.end + 1) : body;
25
+ return new ReadableStream({ start(controller) {
26
+ controller.enqueue(new Uint8Array(bytes));
27
+ controller.close();
28
+ } });
29
+ },
30
+ async delete(keys) {
31
+ for (const key of keys) objects.delete(key);
32
+ }
33
+ };
34
+ }
35
+ // src/chat/attachments/s3.ts
36
+ const S3_DELETE_CONCURRENCY = 8;
37
+ /**
38
+ * Path-style object URL. Local S3 servers and AWS S3 both accept it.
39
+ *
40
+ * URL parsing removes `.` and `..` segments, also in `%2e` form. A key with
41
+ * such a segment would address a different object, so reject it.
42
+ */
43
+ function objectUrl(config, key) {
44
+ const endpoint = config.endpoint.replace(/\/+$/, "");
45
+ const segments = key.split("/");
46
+ if (segments.some((segment) => segment === "." || segment === "..")) throw new Error("S3 object keys cannot contain . or .. path segments");
47
+ const path = segments.map(encodeURIComponent).join("/");
48
+ return `${endpoint}/${encodeURIComponent(config.bucket)}/${path}`;
49
+ }
50
+ /**
51
+ * Read a small S3 response body to the end so the connection is released.
52
+ *
53
+ * Error and empty bodies are small. `body.cancel()` can hang under the test
54
+ * HTTP interceptor, so read the body instead.
55
+ */
56
+ async function drain(response) {
57
+ await response.arrayBuffer();
58
+ }
59
+ /** Throw on a failed S3 response, and release the response body. */
60
+ async function expectOk(response, operation) {
61
+ await drain(response);
62
+ if (!response.ok) throw new Error(`S3 ${operation} failed with status ${response.status}`);
63
+ }
64
+ /** Presigned URL lifetime in whole seconds, at least one. */
65
+ function expiresInSeconds(expiresAtMs) {
66
+ return String(Math.max(1, Math.ceil((expiresAtMs - Date.now()) / 1e3)));
67
+ }
68
+ /** Store private conversation attachments in an S3-compatible bucket. */
69
+ function createS3AttachmentStorage(config) {
70
+ const client = new AwsClient({
71
+ accessKeyId: config.accessKeyId,
72
+ region: config.region,
73
+ secretAccessKey: config.secretAccessKey,
74
+ service: "s3"
75
+ });
76
+ const writeClient = new AwsClient({
77
+ accessKeyId: config.accessKeyId,
78
+ region: config.region,
79
+ retries: 0,
80
+ secretAccessKey: config.secretAccessKey,
81
+ service: "s3"
82
+ });
83
+ return {
84
+ provider: "s3",
85
+ async put(input) {
86
+ await expectOk(await writeClient.fetch(objectUrl(config, input.key), {
87
+ body: input.body,
88
+ headers: {
89
+ "content-length": String(input.bytes),
90
+ "content-type": input.contentType,
91
+ "x-amz-content-sha256": "UNSIGNED-PAYLOAD"
92
+ },
93
+ method: "PUT"
94
+ }), "put");
95
+ },
96
+ async createUploadTarget(input) {
97
+ const url = new URL(objectUrl(config, input.key));
98
+ url.searchParams.set("X-Amz-Expires", expiresInSeconds(input.expiresAtMs));
99
+ const browserHeaders = {
100
+ "content-type": input.contentType,
101
+ "if-none-match": "*"
102
+ };
103
+ return {
104
+ headers: browserHeaders,
105
+ method: "PUT",
106
+ url: (await client.sign(url.toString(), {
107
+ aws: {
108
+ allHeaders: true,
109
+ signQuery: true
110
+ },
111
+ headers: {
112
+ ...browserHeaders,
113
+ "content-length": String(input.bytes)
114
+ },
115
+ method: "PUT"
116
+ })).url
117
+ };
118
+ },
119
+ async createDownloadUrl(input) {
120
+ const url = new URL(objectUrl(config, input.key));
121
+ url.searchParams.set("X-Amz-Expires", expiresInSeconds(input.expiresAtMs));
122
+ return (await client.sign(url.toString(), {
123
+ aws: { signQuery: true },
124
+ method: "GET"
125
+ })).url;
126
+ },
127
+ async get(key, range) {
128
+ const response = await client.fetch(objectUrl(config, key), range ? { headers: { range: rangeHeader(range) } } : void 0);
129
+ if (response.status === 404) {
130
+ await drain(response);
131
+ return null;
132
+ }
133
+ if (!response.ok) await expectOk(response, "get");
134
+ if (range && response.status !== 206) {
135
+ await drain(response);
136
+ throw new Error(`S3 get ignored the byte range with status ${response.status}`);
137
+ }
138
+ return response.body;
139
+ },
140
+ async delete(keys) {
141
+ await mapBounded(keys, async (key) => {
142
+ const response = await client.fetch(objectUrl(config, key), { method: "DELETE" });
143
+ if (response.status === 404) {
144
+ await drain(response);
145
+ return;
146
+ }
147
+ await expectOk(response, "delete");
148
+ }, S3_DELETE_CONCURRENCY);
149
+ }
150
+ };
151
+ }
152
+ // src/chat/attachments/vercel.ts
153
+ const BLOB_API_VERSION = "12";
154
+ const delegationPayloadSchema = z.object({ storeId: z.string().min(1) });
155
+ /**
156
+ * Read the store id from a delegation token, as the SDK does for its own
157
+ * presigned requests. The token payload is base64url JSON before the dot.
158
+ */
159
+ function delegationStoreId(delegationToken) {
160
+ const { storeId } = delegationPayloadSchema.parse(JSON.parse(Buffer.from(delegationToken.split(".")[0] ?? "", "base64url").toString()));
161
+ return storeId.replace(/^store_/, "");
162
+ }
163
+ /** Store private conversation attachments in Vercel Blob. */
164
+ function createVercelAttachmentStorage() {
165
+ return {
166
+ provider: "vercel-blob",
167
+ async put(input) {
168
+ await put(input.key, input.body, {
169
+ access: "private",
170
+ addRandomSuffix: false,
171
+ allowOverwrite: true,
172
+ contentType: input.contentType
173
+ });
174
+ },
175
+ async createUploadTarget(input) {
176
+ const limits = {
177
+ allowedContentTypes: [input.contentType],
178
+ maximumSizeInBytes: input.bytes,
179
+ validUntil: input.expiresAtMs
180
+ };
181
+ const token = await issueSignedToken({
182
+ ...limits,
183
+ operations: ["put"],
184
+ pathname: input.key
185
+ });
186
+ const { presignedUrl } = await presignUrl(token, {
187
+ ...limits,
188
+ access: "private",
189
+ addRandomSuffix: false,
190
+ allowOverwrite: false,
191
+ operation: "put",
192
+ pathname: input.key
193
+ });
194
+ return {
195
+ headers: {
196
+ "x-api-version": BLOB_API_VERSION,
197
+ "x-content-type": input.contentType,
198
+ "x-vercel-blob-access": "private",
199
+ "x-vercel-blob-store-id": delegationStoreId(token.delegationToken)
200
+ },
201
+ method: "PUT",
202
+ url: presignedUrl
203
+ };
204
+ },
205
+ async createDownloadUrl(input) {
206
+ const token = await issueSignedToken({
207
+ operations: ["get"],
208
+ pathname: input.key,
209
+ validUntil: input.expiresAtMs
210
+ });
211
+ const { presignedUrl } = await presignUrl(token, {
212
+ access: "private",
213
+ operation: "get",
214
+ pathname: input.key,
215
+ useCache: false,
216
+ validUntil: input.expiresAtMs
217
+ });
218
+ return presignedUrl;
219
+ },
220
+ async get(key, range) {
221
+ const result = await get(key, {
222
+ access: "private",
223
+ useCache: false,
224
+ ...range ? { headers: { range: rangeHeader(range) } } : void 0
225
+ });
226
+ if (result?.statusCode !== 200) return null;
227
+ if (range && !result.headers.get("content-range")) {
228
+ await result.stream.cancel();
229
+ throw new Error("Vercel Blob get ignored the byte range");
230
+ }
231
+ return result.stream;
232
+ },
233
+ async delete(keys) {
234
+ if (keys.length === 0) return;
235
+ await del(keys);
236
+ }
237
+ };
238
+ }
239
+ // src/chat/attachments/storage.ts
240
+ /** Stream bytes that are already in memory to `AttachmentStorage.put`. */
241
+ function bufferBody(data) {
242
+ return new ReadableStream({ start(controller) {
243
+ controller.enqueue(data);
244
+ controller.close();
245
+ } });
246
+ }
247
+ /** Build the HTTP `Range` request header value for one byte range. */
248
+ function rangeHeader(range) {
249
+ return `bytes=${range.start}-${range.end}`;
250
+ }
251
+ /**
252
+ * Return attachment storage for the configured provider.
253
+ *
254
+ * Callers do not choose a provider. Chat config decides it.
255
+ */
256
+ function getAttachmentStorage() {
257
+ return createAttachmentStorage(getChatConfig().attachmentStorage);
258
+ }
259
+ /**
260
+ * Create attachment storage for one provider config.
261
+ *
262
+ * Runtime code uses `getAttachmentStorage()`. Call this only to test a
263
+ * provider adapter with its own config.
264
+ */
265
+ function createAttachmentStorage(config) {
266
+ switch (config.provider) {
267
+ case "vercel-blob": return createVercelAttachmentStorage();
268
+ case "s3": return createS3AttachmentStorage(config.s3);
269
+ case "memory": return createMemoryAttachmentStorage();
270
+ default: throw new Error(`Unsupported attachment storage provider: ${String(config.provider)}`);
271
+ }
272
+ }
273
+ export { getAttachmentStorage as n, bufferBody as t };
@@ -1,7 +1,7 @@
1
1
  import { t as __exportAll } from "./rolldown-runtime-BKpuH2hG.js";
2
- import { D as isToolResultError, F as SESSION_CONTEXT_SECTION_TAG, I as TURN_CONTEXT_TAG, N as CAPABILITY_SECTION_TAG, O as isToolResultMessage, P as REQUEST_CONTEXT_SECTION_TAG, _ as extractAssistantText, d as SANDBOX_WORKSPACE_ROOT, f as sandboxSkillDir, h as createPluginLogger, k as normalizeToolNameFromResult, n as toPromptContributionContext, o as SANDBOX_DATA_ROOT, r as runPluginHooksAtOnce, t as PLUGIN_PROMPT_CONTRIBUTION_TOTAL_MAX_CHARS, w as isAssistantMessage } from "./prompt-DEkStuxG.js";
3
- import { a as listReferenceFiles, c as soulPathCandidates, l as worldPathCandidates } from "./package-discovery-DD9vencX.js";
4
- import { m as logWarn, p as logInfo } from "./logging-BnOG0qz2.js";
2
+ import { D as isToolResultError, F as SESSION_CONTEXT_SECTION_TAG, I as TURN_CONTEXT_TAG, N as CAPABILITY_SECTION_TAG, O as isToolResultMessage, P as REQUEST_CONTEXT_SECTION_TAG, _ as extractAssistantText, d as SANDBOX_WORKSPACE_ROOT, f as sandboxSkillDir, h as createPluginLogger, k as normalizeToolNameFromResult, n as toPromptContributionContext, o as SANDBOX_DATA_ROOT, r as runPluginHooksAtOnce, t as PLUGIN_PROMPT_CONTRIBUTION_TOTAL_MAX_CHARS, w as isAssistantMessage } from "./prompt-3TqxEOtc.js";
3
+ import { m as worldPathCandidates, p as soulPathCandidates, u as listReferenceFiles } from "./topics-DxuKurCX.js";
4
+ import { m as logWarn, p as logInfo } from "./logging-BRPTXAdf.js";
5
5
  import * as z from "zod";
6
6
  import path from "node:path";
7
7
  import { escapeClosingTag, escapeTagText, escapeTagTextAndQuotes, findTags, indentTagLines, markdownNodes, openingTag, parseMarkdown, promptMessageSchema, renderInlineTag, renderTag, unescapeTagText } from "@sentry/junior-plugin-api";
@@ -234,44 +234,11 @@ async function getPluginSystemPromptContributions(plugins, platform) {
234
234
  }
235
235
  // src/chat/system-prompt-rules.ts
236
236
  /**
237
- * System prompt rules.
238
- *
239
- * This module owns the core rule blocks 2 to 6 of the static system prompt.
240
- * `prompt.ts` adds the identity block before them and the consumer blocks
241
- * after them. The model reads the prompt as one ordered set of blocks, and
242
- * each rule has one block, so order and priority stay stable:
243
- *
244
- * 1. Identity: one header sentence with the role and the precedence rule,
245
- * then the name and platform identity.
246
- * 2. Working principles: `<task-execution>` (or `<automation-run>`,
247
- * `<child-agent-run>`) says what the job is, when to continue, and when
248
- * to ask. A Lead also gets `<lead>`, which says how it runs the Space's
249
- * work. `<evidence>` says what to claim, how to mark
250
- * inference, how to find a failure cause, and how to handle pushback.
251
- * 3. Context and trust: `<context-trust>` holds generic rules for context
252
- * inputs, with no tag table and no context data.
253
- * 4. Actions and safety: `<safety>` holds action limits, approvals, and
254
- * retries with side effects.
255
- * 5. Tools and skills: `<tool-policy>` and `<skill-policy>` hold rules
256
- * that span tools. A rule for one tool goes in its description.
257
- * 6. Communication and output: `<tool-call-style>`, `<conversation>`,
258
- * `<slack-actions>`, `<failure-reporting>`, `<output>`.
259
- * 7. Personality: the consumer's `SOUL.md`, for voice and tone only.
260
- * 8. World: the consumer's `WORLD.md`, for operator facts and workflow.
261
- * 9. Plugin guidance: `<plugin-system-context>` from plugin `systemPrompt`
262
- * hooks.
263
- *
264
- * Blocks 7 to 9 come last, and the identity header says that core rules win
265
- * over them. A Prompt mode can replace the content of a block, but cannot add
266
- * or move one. `<tool-call-style>`, `<conversation>`, and the conversation
267
- * lines of `<context-trust>` are only for a person's input. `child_agent`
268
- * also gets the Inbox item line of `<context-trust>`, because a child gets
269
- * answers to its own items. `<slack-actions>` is only for a person's input on
270
- * Slack. `thread` and `automation` hold two rule sets, with `for` set to the
271
- * sender.
272
- *
273
- * Put a new rule in the block that owns it. If no block fits, change this map
274
- * in the same change. The `build-tools` repo skill says how to write a rule.
237
+ * Block map: 1 and 7-9 (`SOUL.md`, `WORLD.md`, plugins) are in `prompt.ts`.
238
+ * 2 `<task-execution>` or `<automation-run>`/`<child-agent-run>`, `<lead>`,
239
+ * `<evidence>`; 3 `<context-trust>`; 4 `<safety>`; 5 `<tool-policy>`,
240
+ * `<skill-policy>`; 6 `<tool-call-style>`, `<conversation>`, `<slack-actions>`,
241
+ * `<failure-reporting>`, `<output>`. A mode never adds or moves a block.
275
242
  */
276
243
  /**
277
244
  * The rule sets of each Prompt mode, in prompt order. A rule set with a
@@ -316,9 +283,9 @@ function buildIdentityHeader(platform, mode) {
316
283
  /**
317
284
  * Block 2, `<task-execution>`: what the job is in a conversation, when to keep
318
285
  * going, and when to ask. Junior acts as a colleague who owns the task, so it
319
- * makes small decisions itself instead of asking. Junior may infer intent here, but it must not
320
- * present an inferred fact as verified. The
321
- * `automation` and `child_agent` modes replace this section with their own.
286
+ * makes small decisions itself instead of asking. It may infer intent, but it
287
+ * must not present an inferred fact as verified. The `automation` and
288
+ * `child_agent` modes replace this section with their own.
322
289
  */
323
290
  const TASK_EXECUTION_RULES = [
324
291
  "- Work as a trusted colleague who owns the task. Make the reasonable small decisions yourself and take the next appropriate step. Do not ask the user to confirm each step.",
@@ -353,12 +320,10 @@ const AUTOMATION_RUN_RULES = [
353
320
  `- Use \`${NO_REPLY_TOOL_NAME}\` when the run worked and nothing should be posted, such as when a condition in the instruction is not met, or when a temporary failure stopped the work.`
354
321
  ];
355
322
  /**
356
- * Block 2, `<lead>`: how a Space's Lead runs the Space's work. The identity
357
- * header states its role. It plans, starts, reviews, and connects the work
358
- * of its child agents, and never does that work itself. Its tool list has no
359
- * tools for the work, so the rules say where work goes. `<task-execution>`
360
- * holds the rules that it shares with other Conversations, such as how to
361
- * ask a person.
323
+ * Block 2, `<lead>`: how a Space's Lead runs the Space's work. It plans,
324
+ * starts, reviews, and connects its child agents' work and never does it
325
+ * itself. Its tool list has no tools for the work, so the rules say where work
326
+ * goes. `<task-execution>` holds the rules it shares, such as how to ask.
362
327
  */
363
328
  const LEAD_RULES = [
364
329
  "- The members of the Space talk to you, and the person of a Turn is the member who sent its input. Your child agents are the Space's other Conversations.",
@@ -555,7 +520,7 @@ const TOOL_CALL_STYLE_RULES = [
555
520
  ];
556
521
  /**
557
522
  * Block 6, `<conversation>`: how replies fit the thread, including follow-ups
558
- * and resumed Turns.
523
+ * and resumed Turns. It and `<slack-actions>` apply only to a person's input.
559
524
  */
560
525
  const CONVERSATION_RULES = ["- In thread follow-ups, answer from prior thread context; do not repeat resolved clarifying questions.", "- Runtime owns continuation and authorization notices; on resumed turns, answer with the final requested content only."];
561
526
  /**
@@ -694,28 +659,11 @@ function buildRuleBlocks(platform, mode) {
694
659
  }
695
660
  // src/chat/prompt.ts
696
661
  /**
697
- * Prompt assembly.
698
- *
699
- * This module owns Junior's static system prompt and volatile per-turn runtime
700
- * context. The header of `system-prompt-rules.ts` holds the block order.
701
- *
702
- * The system prompt is the same for every Turn of one deployment, platform,
703
- * and Prompt mode, so it holds no request, actor, time, or Conversation data.
704
- * Facts for one request go in the context message: a user-role message before
705
- * the current instruction, with `<runtime-turn-context>`, `AGENTS.md` at Turn
706
- * start, and `<thread-context>`, each in its own content part. The current
707
- * instruction is a separate user-role message with only a person's words and
708
- * attachments. Tool results, files, and fetched pages are tool result
709
- * messages.
710
- *
711
- * A Turn adds `AGENTS.md` only when it differs from the latest copy in
712
- * history. An `AGENTS.md` that the Turn finds or changes later is a new
713
- * user-role message at the end of history, because earlier messages do not
714
- * change. Only context compaction rewrites them.
715
- *
716
- * Runtime context is session-scoped bootstrap data; it must stay separate
717
- * from durable conversation history so compaction does not retain runtime
718
- * instructions as user text.
662
+ * Builds the static system prompt, with no request, actor, time, or
663
+ * Conversation data, and the per-Turn context message before the instruction:
664
+ * `<runtime-turn-context>`, `AGENTS.md`, and `<thread-context>`, a part each.
665
+ * Runtime context stays out of durable history. A Turn adds `AGENTS.md` only
666
+ * when it differs from history, and a later change as a new message at the end.
719
667
  */
720
668
  const DEFAULT_SOUL = "You are a practical and concise assistant.";
721
669
  function getLoggedMarkdownFiles() {
@@ -986,16 +934,10 @@ function buildContextSection(params) {
986
934
  }
987
935
  /**
988
936
  * Capability sections: the skills, MCP catalogs, tool guidance, Workspaces,
989
- * and Code Mode script tools that the model can use now, each with its tags,
990
- * or null when it is empty. A Turn sends the ones that changed as named
991
- * system prompt sections, so the Turn context and history stay the same.
992
- *
993
- * At Turn start, one system message sets each section that differs from the
994
- * section state of history, or removes an empty one. System messages before
995
- * the first assistant message fold into the system prompt. Pi sends a later
996
- * one before the next assistant message, or folds it into the system prompt
997
- * for a model without mid-conversation system messages. Context compaction
998
- * folds the section state into one system message.
937
+ * and script tools the model can use now, or null when empty. At Turn start,
938
+ * one system message sets or removes each section that differs from history,
939
+ * so the Turn context and history stay the same. Compaction folds the section
940
+ * state into one system message.
999
941
  */
1000
942
  function buildCapabilitySections(params) {
1001
943
  const contents = {
@@ -1110,7 +1052,7 @@ function buildCoreSystemPromptSections(platform, mode, botName, files = {
1110
1052
  }] : []
1111
1053
  ];
1112
1054
  }
1113
- /** Build volatile runtime context that belongs in the user turn, not the system prompt. */
1055
+ /** Build the per-Turn runtime context, which stays out of the system prompt. */
1114
1056
  function buildTurnContextPrompt(params) {
1115
1057
  const includeSessionContext = params.includeSessionContext ?? true;
1116
1058
  const pluginPromptContributions = renderPluginContextSection(params.pluginPromptContributions);
@@ -0,0 +1,6 @@
1
+ // src/core/turn/topic.ts
2
+ /** Queue topic of Turn step messages. */
3
+ const TURN_STEP_TOPIC = "junior_turn_step";
4
+ /** Queue topic of the messages that say a Turn ended. */
5
+ const TURN_ENDED_TOPIC = "junior_turn_ended";
6
+ export { TURN_STEP_TOPIC as n, TURN_ENDED_TOPIC as t };
@@ -3,6 +3,16 @@ import { createRequire } from "node:module";
3
3
  import path from "node:path";
4
4
  import fs, { statSync } from "node:fs";
5
5
  import { fileURLToPath } from "node:url";
6
+ // src/chat/optional-string.ts
7
+ /**
8
+ * Normalize optional env-style strings so blank values do not masquerade as
9
+ * configured inputs.
10
+ */
11
+ function toOptionalTrimmed(value) {
12
+ if (!value) return;
13
+ const trimmed = value.trim();
14
+ return trimmed.length > 0 ? trimmed : void 0;
15
+ }
6
16
  // src/package-resolution.ts
7
17
  function isDirectory$1(targetPath) {
8
18
  try {
@@ -447,4 +457,14 @@ function discoverInstalledPluginPackageContent(cwd = process.cwd(), options) {
447
457
  tracingIncludes: uniqueStringsInOrder(tracingIncludes)
448
458
  };
449
459
  }
450
- export { listReferenceFiles as a, soulPathCandidates as c, resolvePackageDir as d, homeDir as i, worldPathCandidates as l, normalizePluginPackageNames as n, pluginRoots as o, discovery_exports as r, skillRoots as s, discoverInstalledPluginPackageContent as t, isValidPackageName as u };
460
+ // src/chat/queue/topics.ts
461
+ /**
462
+ * Queue topic names. Vercel queue wiring uses them at build, so keep them
463
+ * stable, and keep this module free of runtime configuration.
464
+ */
465
+ const CACHE_WARMUP_QUEUE_TOPIC = "junior_cache_warmups";
466
+ const PLUGIN_TASK_QUEUE_TOPIC = "junior_plugin_tasks";
467
+ const WORKSPACE_SNAPSHOT_JOB_QUEUE_TOPIC = "junior_workspace_snapshots";
468
+ const BACKGROUND_COMPACTION_QUEUE_TOPIC = "junior_context_compaction";
469
+ const DEFAULT_CONVERSATION_WORK_QUEUE_TOPIC = "junior_conversation_work";
470
+ export { toOptionalTrimmed as _, WORKSPACE_SNAPSHOT_JOB_QUEUE_TOPIC as a, discovery_exports as c, pluginRoots as d, skillRoots as f, resolvePackageDir as g, isValidPackageName as h, PLUGIN_TASK_QUEUE_TOPIC as i, homeDir as l, worldPathCandidates as m, CACHE_WARMUP_QUEUE_TOPIC as n, discoverInstalledPluginPackageContent as o, soulPathCandidates as p, DEFAULT_CONVERSATION_WORK_QUEUE_TOPIC as r, normalizePluginPackageNames as s, BACKGROUND_COMPACTION_QUEUE_TOPIC as t, listReferenceFiles as u };
@@ -1,5 +1,5 @@
1
1
  import * as z from "zod";
2
- import { actorSchema, actorUserIdSchema, conversationAnnotationInputSchema, conversationEventPresentationSchema, conversationSidebarAnnotationSchema, destinationVisibilitySchema, eventMatchFieldsSchema, eventMatchSchema, eventReachSchema, eventTypeSchema, objectFactFields, objectTypeSchema, pluginEventTypeSchema, slackDestinationSchema, taskOutcomeSchema } from "@sentry/junior-plugin-api";
2
+ import { actorSchema, actorUserIdSchema, conversationEventPresentationSchema, conversationSidebarAnnotationSchema, destinationVisibilitySchema, eventMatchFieldsSchema, eventMatchSchema, eventReachSchema, eventTypeSchema, liveAnnotationSchema, objectFactFields, objectTypeSchema, pluginEventTypeSchema, slackDestinationSchema, taskOutcomeSchema } from "@sentry/junior-plugin-api";
3
3
  // src/usage-schema.ts
4
4
  const usageCostSchema = z.object({
5
5
  input: z.number().finite().nonnegative().optional(),
@@ -1118,6 +1118,20 @@ function automationCardText(card) {
1118
1118
  `Automation ID: ${card.id}`
1119
1119
  ].filter(Boolean).join("\n");
1120
1120
  }
1121
+ /**
1122
+ * Return the status and warning that the card and the Slack details of an
1123
+ * Automation show. The status is the saved status, except that an active
1124
+ * Automation whose trigger cannot work shows as unavailable. Only a block or
1125
+ * a trigger problem gives a warning, like Needs attention in `collection.ts`.
1126
+ */
1127
+ function automationCardStatus(automation) {
1128
+ const problems = automation.triggerProblems ?? [];
1129
+ const warning = [automation.status === "blocked" ? automation.statusReason ?? "This automation is blocked." : void 0, problems.length > 0 ? ["Trigger unavailable.", ...problems].join(" ") : void 0].filter(Boolean).join(" ");
1130
+ return {
1131
+ status: automation.status === "active" && problems.length > 0 ? "unavailable" : automation.status,
1132
+ warning: warning || void 0
1133
+ };
1134
+ }
1121
1135
  // src/chat/conversations/cards.ts
1122
1136
  const storedCardSchema = automationCardSchema.extend({ operation: z.enum([
1123
1137
  "created",
@@ -1163,10 +1177,11 @@ function messageCardRef(card) {
1163
1177
  function readMessageCardRefs(value) {
1164
1178
  return [...storedCardSchema.array().parse(value.cards ?? []).flatMap(({ operation, ...card }) => operation === "deleted" ? [] : [messageCardRef(card)]), ...messageCardRefSchema.strip().array().parse(value.objectCards ?? [])];
1165
1179
  }
1166
- /** Resolve current saved facts without fetching providers or changing history. */
1180
+ /** Match each reference to the Annotation as it was read, in reference order. */
1167
1181
  function resolveMessageCards(refs, annotations) {
1168
1182
  return refs.map((ref) => {
1169
- const annotation = annotations.find((item) => item.kind === ref.kind && item.plugin === ref.plugin && item.key === ref.key);
1183
+ const named = annotations.filter((item) => item.plugin === ref.plugin && item.key === ref.key);
1184
+ const annotation = named.find((item) => item.kind === ref.kind) ?? named.find((item) => item.kind === "resource_link");
1170
1185
  return annotation ? annotationCard(annotation) : {
1171
1186
  ...ref,
1172
1187
  objectType: "item",
@@ -1177,7 +1192,11 @@ function resolveMessageCards(refs, annotations) {
1177
1192
  };
1178
1193
  });
1179
1194
  }
1180
- /** Copy saved annotation facts without storage timestamps for Message delivery. */
1195
+ /**
1196
+ * Return the card of a read Annotation without its timestamps, for Message
1197
+ * delivery. An Annotation that shows only its label gets that label as its
1198
+ * title.
1199
+ */
1181
1200
  function annotationCard(annotation) {
1182
1201
  const { createdAt: _createdAt, updatedAt: _updatedAt, ...value } = annotation;
1183
1202
  return value.kind === "object" ? value : {
@@ -2131,12 +2150,7 @@ const conversationSourceTaskSchema = z.object({
2131
2150
  message: "sourceTask id and label must both be set or both omitted"
2132
2151
  });
2133
2152
  });
2134
- const conversationAnnotationReportSchema = conversationAnnotationInputSchema.and(z.object({
2135
- plugin: z.string().min(1),
2136
- createdAt: z.string().datetime(),
2137
- updatedAt: z.string().datetime(),
2138
- previewImages: z.array(objectPreviewImageSchema).optional()
2139
- }));
2153
+ const conversationAnnotationReportSchema = liveAnnotationSchema.and(z.object({ previewImages: z.array(objectPreviewImageSchema).optional() }));
2140
2154
  const conversationActivityPreviewSchema = z.object({
2141
2155
  createdAt: z.string().datetime(),
2142
2156
  mentions: z.array(actorIdentitySchema).optional(),
@@ -3064,4 +3078,4 @@ const TODOS_REGISTRATION_NAME = "todos";
3064
3078
  const UPDATE_TODOS_TOOL_NAME = `${TODOS_REGISTRATION_NAME}_updateTodos`;
3065
3079
  /** Assignee text for the list's own agent, in tool results and blocks. */
3066
3080
  const SELF_TODO_ASSIGNEE = "self";
3067
- export { activityPreviewText as $, automationTitleSchema as $t, automationVersionSchema as A, isWithinNotificationSchedule as An, spaceListQuerySchema as At, conversationDetailQuerySchema as B, TOP_LEVEL_AGENT_MESSAGE_EVENT_TYPE as Bn, annotationCard as Bt, automationScheduleIntentSchema as C, userInputRequestSchema as Cn, instructionActors as Ct, automationVersionActivateSchema as D, automationTaskSchema as Dn, SPACE_NAME_MAX_CHARS as Dt, automationUpdateSchema as E, automationTaskDescription as En, SPACE_DESCRIPTION_MAX_CHARS as Et, actorIdentitySchema as F, isValidTimeZone as Fn, spaceVisibilitySchema as Ft, conversationParamsSchema as G, usageSchema as Gn, resolveMessageCards as Gt, conversationEventHistorySchema as H, isAgentUpdateEventType as Hn, messageCardText as Ht, conversationActivityPreviewSchema as I, CONTENT_VERSION_HEADER as In, updateSpaceBodySchema as It, conversationReportMessageEventSchema as J, inputFileSchema as Jt, conversationReportEventDataSchema as K, usageTokensSchema as Kn, MAX_ATTACHMENT_BYTES as Kt, conversationAttachmentParamsSchema as L, apiErrorSchema as Ln, conversationTreeStateSchema as Lt, scheduledAutomationSummarySchema as M, getFirstRunAtMs as Mn, spaceParamsSchema as Mt, CONVERSATION_DETAIL_VERSION_HEADER as N, getNextRunAtMs as Nn, spaceRefSchema as Nt, automationVersionListSchema as O, automationTaskText as On, archiveSpaceBodySchema as Ot, CONVERSATION_VERSION_HEADER as P, getZonedDateTimeParts as Pn, spaceSchema as Pt, conversationUsageSchema as Q, automationInstructionToolSchema as Qt, conversationAttachmentQuerySchema as R, AGENT_MESSAGE_EVENT_TYPE as Rn, conversationReadPositionSchema as Rt, automationRunWindowsSchema as S, userInputQuestionSchema as Sn, contextProvenance as St, automationSummarySchema as T, automationTaskColumns as Tn, sameActorIdentity as Tt, conversationEventPageSchema as U, isLegacyResultEventType as Un, readMessageCardRefs as Ut, conversationDetailReportSchema as V, isAgentMessageEventType as Vn, messageCardRef as Vt, conversationEventsQuerySchema as W, gatewayOnlyProviders as Wn, removedCardSchema as Wt, conversationSummaryReportSchema as X, readMessageAttachments as Xt, conversationReportStatusSchema as Y, messageAttachmentSchema as Yt, conversationSurfaceSchema as Z, automationContextToolSchema as Zt, automationListQuerySchema as _, buttonUserInputField as _n, historyReplacementSchema as _t, UPDATE_TODOS_TOOL_NAME as a, compileScheduleIntent as an, KNOWN_CONVERSATION_EVENT_TYPES as at, automationRunListSchema as b, normalizeUserInputAnswer as bn, piMessageSchema as bt, automationEditSchema as c, weekdaySchema as cn, conversationTurnFailureReasonSchema as ct, automationExecutionSchema as d, inboxItemNoticeRequestSchema as dn, agentHistoryFromRow as dt, taskOutcomeInputSchema as en, conversationChildAgentTotalsSchema as et, automationExecutionStatusDaySchema as f, inboxItemQuestion as fn, encodeAgentHistoryPayload as ft, automationListPageSchema as g, answeredChoices as gn, historyItemFromPiMessage as gt, automationListItemSchema as h, USER_INPUT_NOTE as hn, HISTORY_REPLACEMENT_TYPES as ht, TODO_STATUSES as i, ScheduleIntentError as in, formatAgentTypes as it, eventAutomationSummarySchema as j, notificationScheduleSchema as jn, spaceListSchema as jt, automationVersionParamsSchema as k, DEFAULT_NOTIFICATION_SCHEDULE as kn, createSpaceBodySchema as kt, automationEventCatalogSchema as l, eventAutomationSchema as ln, decodeStoredConversationEvent as lt, automationLifecycleSchema as m, USER_INPUT_LIMITS as mn, AGENT_HISTORY_ITEM_TYPES as mt, SELF_TODO_ASSIGNEE as n, scheduledAutomationSchema as nn, agentTypeInstructions as nt, isOpenTodoStatus as o, scheduleIntentFromTool as on, conversationEventDataSchema as ot, automationExecutionStatusSchema as p, inboxItemRequestSchema as pn, isAgentHistoryData as pt, conversationReportEventSchema as q, MAX_INPUT_ATTACHMENTS as qt, TODOS_REGISTRATION_NAME as r, scheduledRunSchema as rn, agentTypeSchema as rt, automationEditErrorSchema as s, toolScheduleIntentSchema as sn, conversationTurnFailureCodeSchema as st, OPEN_TODO_STATUSES as t, SCHEDULED_AUTOMATION_SYSTEM_ACTOR as tn, AGENT_TYPES as tt, automationExecutionListSchema as u, eventAutomationTriggerSchema as un, newConversationEventSchema as ut, automationListSchema as v, formatUserInputAnswer as vn, isHistoryReplacement as vt, automationSchedulePreviewSchema as w, automationSkillNameSchema as wn, instructionProvenanceFor as wt, automationRunSchema as x, userInputFieldsSchema as xn, agentInstructionProvenance as xt, automationParamsSchema as y, isEmptyUserInputAnswer as yn, piMessageFromHistoryItem as yt, conversationAuxiliaryCostsSchema as z, AGENT_UPDATE_EVENT_TYPE as zn, inboxItemChangeRecordSchema as zt };
3081
+ export { activityPreviewText as $, automationInstructionToolSchema as $t, automationVersionSchema as A, DEFAULT_NOTIFICATION_SCHEDULE as An, spaceListQuerySchema as At, conversationDetailQuerySchema as B, AGENT_UPDATE_EVENT_TYPE as Bn, annotationCard as Bt, automationScheduleIntentSchema as C, userInputQuestionSchema as Cn, instructionActors as Ct, automationVersionActivateSchema as D, automationTaskDescription as Dn, SPACE_NAME_MAX_CHARS as Dt, automationUpdateSchema as E, automationTaskColumns as En, SPACE_DESCRIPTION_MAX_CHARS as Et, actorIdentitySchema as F, getZonedDateTimeParts as Fn, spaceVisibilitySchema as Ft, conversationParamsSchema as G, gatewayOnlyProviders as Gn, resolveMessageCards as Gt, conversationEventHistorySchema as H, isAgentMessageEventType as Hn, messageCardText as Ht, conversationActivityPreviewSchema as I, isValidTimeZone as In, updateSpaceBodySchema as It, conversationReportMessageEventSchema as J, MAX_INPUT_ATTACHMENTS as Jt, conversationReportEventDataSchema as K, usageSchema as Kn, automationCardStatus as Kt, conversationAttachmentParamsSchema as L, CONTENT_VERSION_HEADER as Ln, conversationTreeStateSchema as Lt, scheduledAutomationSummarySchema as M, notificationScheduleSchema as Mn, spaceParamsSchema as Mt, CONVERSATION_DETAIL_VERSION_HEADER as N, getFirstRunAtMs as Nn, spaceRefSchema as Nt, automationVersionListSchema as O, automationTaskSchema as On, archiveSpaceBodySchema as Ot, CONVERSATION_VERSION_HEADER as P, getNextRunAtMs as Pn, spaceSchema as Pt, conversationUsageSchema as Q, automationContextToolSchema as Qt, conversationAttachmentQuerySchema as R, apiErrorSchema as Rn, conversationReadPositionSchema as Rt, automationRunWindowsSchema as S, userInputFieldsSchema as Sn, contextProvenance as St, automationSummarySchema as T, automationSkillNameSchema as Tn, sameActorIdentity as Tt, conversationEventPageSchema as U, isAgentUpdateEventType as Un, readMessageCardRefs as Ut, conversationDetailReportSchema as V, TOP_LEVEL_AGENT_MESSAGE_EVENT_TYPE as Vn, messageCardRef as Vt, conversationEventsQuerySchema as W, isLegacyResultEventType as Wn, removedCardSchema as Wt, conversationSummaryReportSchema as X, messageAttachmentSchema as Xt, conversationReportStatusSchema as Y, inputFileSchema as Yt, conversationSurfaceSchema as Z, readMessageAttachments as Zt, automationListQuerySchema as _, answeredChoices as _n, historyReplacementSchema as _t, UPDATE_TODOS_TOOL_NAME as a, ScheduleIntentError as an, KNOWN_CONVERSATION_EVENT_TYPES as at, automationRunListSchema as b, isEmptyUserInputAnswer as bn, piMessageSchema as bt, automationEditSchema as c, toolScheduleIntentSchema as cn, conversationTurnFailureReasonSchema as ct, automationExecutionSchema as d, eventAutomationTriggerSchema as dn, agentHistoryFromRow as dt, automationTitleSchema as en, conversationChildAgentTotalsSchema as et, automationExecutionStatusDaySchema as f, inboxItemNoticeRequestSchema as fn, encodeAgentHistoryPayload as ft, automationListPageSchema as g, USER_INPUT_NOTE as gn, historyItemFromPiMessage as gt, automationListItemSchema as h, USER_INPUT_LIMITS as hn, HISTORY_REPLACEMENT_TYPES as ht, TODO_STATUSES as i, scheduledRunSchema as in, formatAgentTypes as it, eventAutomationSummarySchema as j, isWithinNotificationSchedule as jn, spaceListSchema as jt, automationVersionParamsSchema as k, automationTaskText as kn, createSpaceBodySchema as kt, automationEventCatalogSchema as l, weekdaySchema as ln, decodeStoredConversationEvent as lt, automationLifecycleSchema as m, inboxItemRequestSchema as mn, AGENT_HISTORY_ITEM_TYPES as mt, SELF_TODO_ASSIGNEE as n, SCHEDULED_AUTOMATION_SYSTEM_ACTOR as nn, agentTypeInstructions as nt, isOpenTodoStatus as o, compileScheduleIntent as on, conversationEventDataSchema as ot, automationExecutionStatusSchema as p, inboxItemQuestion as pn, isAgentHistoryData as pt, conversationReportEventSchema as q, usageTokensSchema as qn, MAX_ATTACHMENT_BYTES as qt, TODOS_REGISTRATION_NAME as r, scheduledAutomationSchema as rn, agentTypeSchema as rt, automationEditErrorSchema as s, scheduleIntentFromTool as sn, conversationTurnFailureCodeSchema as st, OPEN_TODO_STATUSES as t, taskOutcomeInputSchema as tn, AGENT_TYPES as tt, automationExecutionListSchema as u, eventAutomationSchema as un, newConversationEventSchema as ut, automationListSchema as v, buttonUserInputField as vn, isHistoryReplacement as vt, automationSchedulePreviewSchema as w, userInputRequestSchema as wn, instructionProvenanceFor as wt, automationRunSchema as x, normalizeUserInputAnswer as xn, agentInstructionProvenance as xt, automationParamsSchema as y, formatUserInputAnswer as yn, piMessageFromHistoryItem as yt, conversationAuxiliaryCostsSchema as z, AGENT_MESSAGE_EVENT_TYPE as zn, inboxItemChangeRecordSchema as zt };
@@ -1,4 +1,4 @@
1
- import { Bs as withSlackRetries, Ms as getSlackClient, Os as SlackActionError } from "./db-of6e3sGt.js";
1
+ import { Zs as getSlackClient, ac as withSlackRetries, qs as SlackActionError } from "./db-BCaNWl9p.js";
2
2
  import * as z from "zod";
3
3
  // src/chat/slack/users.ts
4
4
  const profileFieldsSchema = z.object({ fields: z.record(z.string(), z.object({
@@ -1,5 +1,5 @@
1
1
  import { t as __exportAll } from "./rolldown-runtime-BKpuH2hG.js";
2
- import { n as pluginCatalogRuntime } from "./catalog-runtime-BfdAnztW.js";
2
+ import { Fd as getAppContext } from "./db-BCaNWl9p.js";
3
3
  import { isDeepStrictEqual } from "node:util";
4
4
  // src/chat/plugins/validation.ts
5
5
  var validation_exports = /* @__PURE__ */ __exportAll({
@@ -8,18 +8,18 @@ var validation_exports = /* @__PURE__ */ __exportAll({
8
8
  });
9
9
  /** Validate hook registrations against the loaded plugin manifest catalog. */
10
10
  function validatePluginRegistrations(registrations) {
11
- const loadedPlugins = new Map(pluginCatalogRuntime.getProviders().map((plugin) => [plugin.manifest.name, plugin]));
11
+ const loadedPlugins = new Map(getAppContext().catalog.getProviders().map((plugin) => [plugin.manifest.name, plugin]));
12
12
  for (const registration of registrations) {
13
13
  const loadedPlugin = loadedPlugins.get(registration.manifest.name);
14
14
  if (!loadedPlugin) throw new Error(`Plugin registration "${registration.manifest.name}" does not have a matching plugin manifest. Add an inline manifest, packageName, or app-local plugin.yaml with the same name.`);
15
- const effectiveRegistrationManifest = pluginCatalogRuntime.parseConfiguredInlineManifest(registration.manifest, loadedPlugin.dir);
15
+ const effectiveRegistrationManifest = getAppContext().catalog.parseConfiguredInlineManifest(registration.manifest, loadedPlugin.dir);
16
16
  if (!isDeepStrictEqual(effectiveRegistrationManifest, loadedPlugin.manifest)) throw new Error(`Plugin registration "${registration.manifest.name}" manifest does not match the loaded plugin manifest. Use one canonical manifest source for runtime hook plugins.`);
17
17
  }
18
18
  }
19
19
  /** Validate credential hook registrations against the loaded plugin manifests. */
20
20
  function validatePluginEgressCredentialHooks(registrations) {
21
21
  const plugins = new Map(registrations.map((registration) => [registration.manifest.name, registration]));
22
- for (const provider of pluginCatalogRuntime.getProviders()) {
22
+ for (const provider of getAppContext().catalog.getProviders()) {
23
23
  const hooks = plugins.get(provider.manifest.name)?.hooks;
24
24
  const hasGrantHook = Boolean(hooks?.grantForEgress);
25
25
  const hasIssueHook = Boolean(hooks?.issueCredential);
@@ -1,5 +1,5 @@
1
1
  // package.json
2
- var version = "0.318.0";
2
+ var version = "0.319.0";
3
3
  // src/version.ts
4
4
  /** Installed Junior package version, or `unknown` when package metadata is unavailable. */
5
5
  const JUNIOR_VERSION = typeof version === "string" && version.trim() ? version : "unknown";
package/dist/version.js CHANGED
@@ -1 +1 @@
1
- export { t as JUNIOR_VERSION } from "./version-VEXiEcZu.js";
1
+ export { t as JUNIOR_VERSION } from "./version-BNm0JYj3.js";
@@ -1,8 +1,8 @@
1
1
  import { t as __exportAll } from "./rolldown-runtime-BKpuH2hG.js";
2
- import { $t as completeConversationWork, Cn as isFinalAttempt, Gt as beginConversationResume, Ir as ConversationQueueMessageRejectedError, Jt as claimConversationAttempt, Mn as isAttemptInterrupt, Nl as isTopLevel, Nn as selectAttemptMessages, Qt as completeConversationStop, Vt as ackMessages, Xt as clearConsumedConversationWake, an as getConversationWorkState, cn as recordAttemptFailure, dn as requestAnotherSlice, en as deadLetterAttempt, ln as recordConversationRetry, pn as startConversationWork, qt as checkInConversationWork, rd as isProviderRetryError, rn as ensureConversationWake, tn as drainConversationMailbox, un as releaseConversationWork, ur as getTurnRequestDeadline, wn as isInvalidConversationRecordError, xn as hasConversationStop, yn as countPendingConversationMessages, zr as nudgeIdempotencyKey } from "./db-of6e3sGt.js";
3
- import { R as getChatConfig } from "./context-BKF_5zzI.js";
4
- import { f as logException, m as logWarn, p as logInfo, w as withLogContext, y as setSpanAttributes } from "./logging-BnOG0qz2.js";
5
- import { G as saveHeldInput, U as getConversationStoppedAtMs } from "./mailbox-turn-Byrry9o1.js";
2
+ import { $t as completeConversationStop, Ed as isProviderRetryError, Gr as nudgeIdempotencyKey, Hr as ConversationQueueMessageRejectedError, Ht as ackMessages, Jt as checkInConversationWork, Kt as beginConversationResume, Nn as isAttemptInterrupt, Pn as selectAttemptMessages, Sn as hasConversationStop, Tn as isInvalidConversationRecordError, Yt as claimConversationAttempt, Zt as clearConsumedConversationWake, bn as countPendingConversationMessages, dn as releaseConversationWork, dr as getTurnRequestDeadline, en as completeConversationWork, fn as requestAnotherSlice, in as ensureConversationWake, ln as recordAttemptFailure, mn as startConversationWork, nn as drainConversationMailbox, nu as isTopLevel, on as getConversationWorkState, tn as deadLetterAttempt, un as recordConversationRetry, wn as isFinalAttempt } from "./db-BCaNWl9p.js";
3
+ import { R as getChatConfig } from "./adapter-8_S6Birm.js";
4
+ import { f as logException, m as logWarn, p as logInfo, w as withLogContext, y as setSpanAttributes } from "./logging-BRPTXAdf.js";
5
+ import { A as getConversationStoppedAtMs, M as saveHeldInput } from "./markers-9QoqW5ov.js";
6
6
  // src/chat/task-execution/lost-lease.ts
7
7
  /**
8
8
  * Count a slice that lost its Conversation Lease as a failed attempt, then
@@ -0,0 +1,5 @@
1
+ -- New Spaces keep their name on the Lead only. 0.317.0 and 0.318.0 do not
2
+ -- read junior_spaces.name. A rollback to 0.316.0, which reads it, is no
3
+ -- longer supported.
4
+ -- squawk-ignore ban-drop-not-null -- unused since 0.317.0
5
+ ALTER TABLE "junior_spaces" ALTER COLUMN "name" DROP NOT NULL;