@sentry/junior 0.316.0 → 0.317.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 (122) hide show
  1. package/dist/{admin-QYiDMnsu.js → admin-CAugg87B.js} +1 -1
  2. package/dist/{agent-runner-Cr5Fhjf-.js → agent-runner-AjrEV6Qe.js} +13438 -13149
  3. package/dist/{reporting-window-C4dbzDiR.js → agent-status-BA5x3Xtp.js} +33 -1
  4. package/dist/{agent-update-delivery-BY13DPSD.js → agent-update-delivery-B_YIZcgf.js} +5 -5
  5. package/dist/api/schema.d.ts +558 -102
  6. package/dist/api/schema.js +6 -6
  7. package/dist/api.js +230 -213
  8. package/dist/{app-BhvzRD__.d.ts → app-MoNAsVV5.d.ts} +34 -14
  9. package/dist/app.d.ts +1 -1
  10. package/dist/app.js +167 -122
  11. package/dist/catalog-runtime-DfSpJZdY.js +6 -0
  12. package/dist/{change-record-Bqsa5ZXE.d.ts → change-record-BzJgLsv7.d.ts} +60 -1
  13. package/dist/{adapter-context-Bref7aPI.js → channel-access-j-YAVYK4.js} +2 -42
  14. package/dist/{chat-core-engine-3dtlMku3.js → chat-core-engine-aH85nEHv.js} +4 -3
  15. package/dist/{child-message--2G3Ft26.js → child-message-DHjQLEd1.js} +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.js +5 -4
  20. package/dist/cli/snapshot-create.js +5 -2
  21. package/dist/cli/upgrade.js +5 -3
  22. package/dist/config-CHQ8X251.js +2422 -0
  23. package/dist/{continue-in-slack-DbQUFe_F.js → continue-in-slack-D-FZ8Fin.js} +2 -3
  24. package/dist/{conversation-feed-B84pMjHo.js → conversation-feed--9S0_PXL.js} +3 -3
  25. package/dist/{proxy-path-BTmXDjfx.js → conversation-privacy-B1uXn5sf.js} +2 -16
  26. package/dist/{conversation-turn-DzEpTIaf.js → conversation-turn-BUE_7xaN.js} +99 -76
  27. package/dist/{create-DUJBXr6E.js → create-DoDIYgtZ.js} +12 -9
  28. package/dist/{credential-sync-JH_K9Adg.js → credential-sync-BJOqGnjV.js} +17 -12
  29. package/dist/{db-DhzvUY23.js → db-BFmyYZtJ.js} +20265 -27551
  30. package/dist/{deployment-BhvrhQeh.js → deployment-DXq9ZLU4.js} +17 -15
  31. package/dist/{engine-context-C9Nal48K.js → engine-context-CgQ7mlHt.js} +264 -47
  32. package/dist/{html-B_12WjKT.js → html-B3VKTGbJ.js} +6 -2
  33. package/dist/instrumentation.js +15 -7
  34. package/dist/{job-runner-DO8nslyY.js → job-runner-A1lCkybD.js} +391 -24
  35. package/dist/{lineage-D3AZAJVe.js → lineage-Bktb0UcV.js} +1 -1
  36. package/dist/{list-B0zsb5Cp.js → list-Bxvg5wXf.js} +224 -544
  37. package/dist/{logging-B8KEJegM.js → logging--smS7XRK.js} +2 -2
  38. package/dist/{session-stop-DponjDUZ.js → mailbox-turn-uSXhUFc9.js} +4747 -7039
  39. package/dist/{message-B5fKDYzz.js → message-BNenhsmB.js} +12 -22
  40. package/dist/{model-input-CuMWy37l.js → model-input-BReSnwHp.js} +3 -3
  41. package/dist/nitro.d.ts +1 -1
  42. package/dist/nitro.js +20 -6
  43. package/dist/{oauth-callback-server-B3Vvlydo.js → oauth-callback-server-CE4soEIY.js} +2 -2
  44. package/dist/{oauth-relay-6ERrGPbA.js → oauth-relay-C36gX1gH.js} +2 -2
  45. package/dist/{package-discovery-BI6T_RkD.js → package-discovery-DD9vencX.js} +1 -50
  46. package/dist/{list-mkB_GU8R.js → parent-result-Ck1rFYRQ.js} +107 -92
  47. package/dist/{plugins-BXMdNdyA.js → plugins-D_Ru4CWc.js} +1 -1
  48. package/dist/profile-BQ-iBDsZ.js +4657 -0
  49. package/dist/{transcript-CCi7323k.js → prompt-Dv7gkpD6.js} +97 -103
  50. package/dist/proxy-path-BHYoKZdq.js +15 -0
  51. package/dist/registry-iXMT5Jmh.js +3279 -0
  52. package/dist/reports-WKHfGTsU.js +195 -0
  53. package/dist/{resolve-D5JVvv6A.js → resolve-tony4ibz.js} +9 -29
  54. package/dist/{result-CS_7mo8a.js → result-Bta_dlWa.js} +25 -116
  55. package/dist/run-conversation-DL6ru7iW.js +336 -0
  56. package/dist/{runner-BzAES5W3.js → runner-BstDRbD9.js} +7 -7
  57. package/dist/{sandbox-egress-signals-Dwhk2Q5F.js → sandbox-egress-signals-oSJMJOnn.js} +1 -1
  58. package/dist/{schema-z5-wA6N4.js → schema-DfqrHACA.js} +48 -86
  59. package/dist/sender-actors-CPglLd5R.js +83 -0
  60. package/dist/{service-account-D6AsAtc1.js → service-account-CTV_jaNu.js} +3 -1
  61. package/dist/{skills-DgJ9GBPR.js → skills-BCEU41zM.js} +4 -4
  62. package/dist/{slack-conversation-unfurl-Dq71EkhM.js → slack-conversation-unfurl-DxVmhbGP.js} +7 -6
  63. package/dist/{spawn-BJWpdwhQ.js → spawn-frczVPIr.js} +11 -8
  64. package/dist/{system-prompt-table-iIgpmslr.js → system-prompt-table-CiXy0eNR.js} +88 -69
  65. package/dist/{task-runner-BJae4JwE.js → task-runner-C9Yc2_ae.js} +20 -46
  66. package/dist/{thread-context-fiMNylbg.js → thread-context-CqZDKErp.js} +6 -6
  67. package/dist/topics-SRN7IVX-.js +24 -0
  68. package/dist/turn-membership-CENFf3kI.js +856 -0
  69. package/dist/{turn-wake-BjDW7x-5.js → turn-wake-BhloiI2h.js} +4 -5
  70. package/dist/{media-BebquhET.js → types-C4iC-IMC.js} +801 -771
  71. package/dist/user-customization-CvfuY9Eo.js +93 -0
  72. package/dist/users-ByG5RCEJ.js +181 -0
  73. package/dist/{validation-D5WmmmhX.js → validation-8gjfR91V.js} +1 -1
  74. package/dist/{version-CBQoanXb.js → version-BeZhWWBE.js} +1 -1
  75. package/dist/version.js +1 -1
  76. package/dist/{worker-Cyb4kF17.js → worker-BqMQQNRk.js} +5 -4
  77. package/migrations/20261126025226_drop_agent_invocations/migration.sql +6 -0
  78. package/migrations/20261126025226_drop_agent_invocations/snapshot.json +9 -0
  79. package/migrations/20261126033000_space_conversations_lead_children/migration.sql +155 -0
  80. package/migrations/20261126033000_space_conversations_lead_children/snapshot.json +9 -0
  81. package/migrations/20261126144620_drop_user_message_time_index/migration.sql +1 -0
  82. package/migrations/20261126144620_drop_user_message_time_index/snapshot.json +38 -0
  83. package/migrations/20261126153100_inbox_item_subjects/migration.sql +140 -0
  84. package/migrations/20261126153100_inbox_item_subjects/snapshot.json +9 -0
  85. package/migrations/20261126153103_inbox_item_subjects_not_null/migration.sql +12 -0
  86. package/migrations/20261126153103_inbox_item_subjects_not_null/snapshot.json +9 -0
  87. package/migrations/20261126153105_inbox_item_subject_indexes/migration.sql +1 -0
  88. package/migrations/20261126153105_inbox_item_subject_indexes/snapshot.json +9 -0
  89. package/migrations/20261126153108_automation_run_conversation_index/migration.sql +1 -0
  90. package/migrations/20261126153108_automation_run_conversation_index/snapshot.json +9 -0
  91. package/migrations/20261126153159_inbox_item_subjects_schema/migration.sql +4 -0
  92. package/migrations/20261126153159_inbox_item_subjects_schema/snapshot.json +437 -0
  93. package/migrations/20261126153259_inbox_questions/migration.sql +76 -0
  94. package/migrations/20261126153259_inbox_questions/snapshot.json +9 -0
  95. package/migrations/20261126153301_inbox_questions_valid/migration.sql +3 -0
  96. package/migrations/20261126153301_inbox_questions_valid/snapshot.json +9 -0
  97. package/migrations/20261126153343_inbox_questions_schema/migration.sql +5 -0
  98. package/migrations/20261126153343_inbox_questions_schema/snapshot.json +407 -0
  99. package/migrations/20261126154025_inbox_item_owners/migration.sql +74 -0
  100. package/migrations/20261126154025_inbox_item_owners/snapshot.json +9 -0
  101. package/migrations/20261126154048_inbox_item_open_subject_key_index/migration.sql +1 -0
  102. package/migrations/20261126154048_inbox_item_open_subject_key_index/snapshot.json +9 -0
  103. package/migrations/20261126154051_drop_inbox_item_owner_indexes/migration.sql +7 -0
  104. package/migrations/20261126154051_drop_inbox_item_owner_indexes/snapshot.json +9 -0
  105. package/migrations/20261126154121_inbox_item_owners_schema/migration.sql +8 -0
  106. package/migrations/20261126154121_inbox_item_owners_schema/snapshot.json +311 -0
  107. package/migrations/20261126175601_conversation_event_turn/migration.sql +5 -0
  108. package/migrations/20261126175601_conversation_event_turn/snapshot.json +103 -0
  109. package/migrations/20261126175614_conversation_event_turn_index/migration.sql +1 -0
  110. package/migrations/20261126175614_conversation_event_turn_index/snapshot.json +62 -0
  111. package/migrations/20261126230028_merge_leaves/migration.sql +2 -0
  112. package/migrations/20261126230028_merge_leaves/snapshot.json +12 -0
  113. package/migrations/20261126231932_space_lead_holds_name/migration.sql +46 -0
  114. package/migrations/20261126231932_space_lead_holds_name/snapshot.json +58 -0
  115. package/migrations/20261127001022_merge_leaves/migration.sql +2 -0
  116. package/migrations/20261127001022_merge_leaves/snapshot.json +12 -0
  117. package/package.json +5 -5
  118. package/dist/people-CUtFApfL.js +0 -81
  119. package/dist/start-conversation-B-LIqqNi.js +0 -162
  120. package/dist/turn-session-routing-D15orfwy.js +0 -1309
  121. package/dist/user-customization-B27StpVQ.js +0 -9
  122. package/dist/web-message-id-C6P83ans.js +0 -10
@@ -0,0 +1,195 @@
1
+ import { Pi as createPluginState, St as getRegistrations, Vi as basePluginContext, ur as createPluginConversationEventStats } from "./db-BFmyYZtJ.js";
2
+ import { h as createPluginLogger, r as runPluginHooksAtOnce } from "./prompt-Dv7gkpD6.js";
3
+ // src/chat/plugins/hooks/reports.ts
4
+ const OPERATIONAL_REPORT_MAX_METRICS = 8;
5
+ const OPERATIONAL_REPORT_MAX_WIDGETS = 12;
6
+ const OPERATIONAL_REPORT_MAX_CHART_SERIES = 8;
7
+ const OPERATIONAL_REPORT_MAX_RECORD_SETS = 8;
8
+ const OPERATIONAL_REPORT_MAX_FIELDS = 8;
9
+ const OPERATIONAL_REPORT_MAX_RECORDS = 25;
10
+ const OPERATIONAL_REPORT_MAX_LABEL_LENGTH = 80;
11
+ const OPERATIONAL_REPORT_MAX_VALUE_LENGTH = 160;
12
+ function pluginReadState(state) {
13
+ return { get: state.get };
14
+ }
15
+ function operationalReportText(value, maxLength) {
16
+ if (typeof value !== "string") return;
17
+ const trimmed = value.trim();
18
+ if (!trimmed) return;
19
+ return trimmed.length <= maxLength ? trimmed : `${trimmed.slice(0, Math.max(0, maxLength - 3))}...`;
20
+ }
21
+ function operationalReportTone(tone) {
22
+ return tone === "danger" || tone === "good" || tone === "neutral" || tone === "warning" ? tone : void 0;
23
+ }
24
+ function sanitizeOperationalReport(args) {
25
+ const metrics = args.report.metrics?.slice(0, OPERATIONAL_REPORT_MAX_METRICS).map((metric) => {
26
+ const label = operationalReportText(metric.label, OPERATIONAL_REPORT_MAX_LABEL_LENGTH);
27
+ const value = operationalReportText(metric.value, OPERATIONAL_REPORT_MAX_VALUE_LENGTH);
28
+ if (!label || !value) return;
29
+ const sanitizedMetric = {
30
+ label,
31
+ value
32
+ };
33
+ const tone = operationalReportTone(metric.tone);
34
+ if (tone) sanitizedMetric.tone = tone;
35
+ return sanitizedMetric;
36
+ }).filter((metric) => Boolean(metric));
37
+ const recordSets = args.report.recordSets?.slice(0, OPERATIONAL_REPORT_MAX_RECORD_SETS).map((recordSet, recordSetIndex) => {
38
+ const title = operationalReportText(recordSet.title, OPERATIONAL_REPORT_MAX_LABEL_LENGTH);
39
+ if (!title) return;
40
+ const fields = recordSet.fields?.slice(0, OPERATIONAL_REPORT_MAX_FIELDS).map((field) => {
41
+ const key = operationalReportText(field.key, OPERATIONAL_REPORT_MAX_LABEL_LENGTH);
42
+ const label = operationalReportText(field.label, OPERATIONAL_REPORT_MAX_LABEL_LENGTH);
43
+ return key && label ? {
44
+ key,
45
+ label
46
+ } : void 0;
47
+ }).filter((field) => Boolean(field));
48
+ const records = recordSet.records?.slice(0, OPERATIONAL_REPORT_MAX_RECORDS).map((record, recordIndex) => {
49
+ const sanitizedRecord = {
50
+ id: operationalReportText(record.id, OPERATIONAL_REPORT_MAX_LABEL_LENGTH) ?? `${recordSetIndex}:${recordIndex}`,
51
+ values: Object.fromEntries((fields ?? []).map((field) => [field.key, operationalReportText(record.values[field.key], OPERATIONAL_REPORT_MAX_VALUE_LENGTH) ?? ""]))
52
+ };
53
+ const tone = operationalReportTone(record.tone);
54
+ if (tone) sanitizedRecord.tone = tone;
55
+ return sanitizedRecord;
56
+ });
57
+ const sanitizedRecordSet = { title };
58
+ if (fields?.length) sanitizedRecordSet.fields = fields;
59
+ const emptyText = operationalReportText(recordSet.emptyText, OPERATIONAL_REPORT_MAX_VALUE_LENGTH);
60
+ if (emptyText) sanitizedRecordSet.emptyText = emptyText;
61
+ if (records?.length) sanitizedRecordSet.records = records;
62
+ return sanitizedRecordSet;
63
+ }).filter((recordSet) => Boolean(recordSet));
64
+ const widgets = args.report.widgets?.slice(0, OPERATIONAL_REPORT_MAX_WIDGETS).map((widget, widgetIndex) => {
65
+ const id = operationalReportText(widget.id, OPERATIONAL_REPORT_MAX_LABEL_LENGTH) ?? String(widgetIndex);
66
+ const title = operationalReportText(widget.title, OPERATIONAL_REPORT_MAX_LABEL_LENGTH);
67
+ if (!title) return;
68
+ const seriesEntries = widget.series.slice(0, OPERATIONAL_REPORT_MAX_CHART_SERIES).map((item) => {
69
+ const key = operationalReportText(item.key, OPERATIONAL_REPORT_MAX_LABEL_LENGTH);
70
+ const label = operationalReportText(item.label, OPERATIONAL_REPORT_MAX_LABEL_LENGTH);
71
+ if (!key || !label) return;
72
+ const sanitizedSeries = {
73
+ key,
74
+ label
75
+ };
76
+ if (item.format === "usd") sanitizedSeries.format = "usd";
77
+ const tone = operationalReportTone(item.tone);
78
+ if (tone) sanitizedSeries.tone = tone;
79
+ return {
80
+ sanitizedSeries,
81
+ sourceKey: item.key
82
+ };
83
+ }).filter((item) => Boolean(item));
84
+ if (!seriesEntries.length) return;
85
+ const series = seriesEntries.map((item) => item.sanitizedSeries);
86
+ const sanitizedWidget = {
87
+ categories: widget.categories.slice(-100).map((category, categoryIndex) => ({
88
+ id: operationalReportText(category.id, OPERATIONAL_REPORT_MAX_LABEL_LENGTH) ?? `${widgetIndex}:${categoryIndex}`,
89
+ label: operationalReportText(category.label, OPERATIONAL_REPORT_MAX_LABEL_LENGTH) ?? String(categoryIndex + 1),
90
+ values: Object.fromEntries(seriesEntries.map(({ sanitizedSeries, sourceKey }) => {
91
+ const value = category.values[sourceKey];
92
+ return [sanitizedSeries.key, value !== void 0 && Number.isFinite(value) ? value : 0];
93
+ }))
94
+ })),
95
+ id,
96
+ series,
97
+ title,
98
+ type: "bar_chart"
99
+ };
100
+ const description = operationalReportText(widget.description, OPERATIONAL_REPORT_MAX_VALUE_LENGTH);
101
+ if (description) sanitizedWidget.description = description;
102
+ const emptyText = operationalReportText(widget.emptyText, OPERATIONAL_REPORT_MAX_VALUE_LENGTH);
103
+ if (emptyText) sanitizedWidget.emptyText = emptyText;
104
+ const timeRangeDays = widget.timeRangeDays?.filter((days) => days === 1 || days === 7 || days === 30 || days === 90);
105
+ if (timeRangeDays?.length) sanitizedWidget.timeRangeDays = [...new Set(timeRangeDays)];
106
+ return sanitizedWidget;
107
+ }).filter((widget) => Boolean(widget));
108
+ const sanitized = { pluginName: args.pluginName };
109
+ const generatedAt = operationalReportText(args.report.generatedAt, OPERATIONAL_REPORT_MAX_VALUE_LENGTH);
110
+ if (generatedAt) sanitized.generatedAt = generatedAt;
111
+ if (recordSets?.length) sanitized.recordSets = recordSets;
112
+ if (metrics?.length) sanitized.metrics = metrics;
113
+ if (widgets?.length) sanitized.widgets = widgets;
114
+ const title = operationalReportText(args.report.title, OPERATIONAL_REPORT_MAX_LABEL_LENGTH);
115
+ if (title) sanitized.title = title;
116
+ return sanitized;
117
+ }
118
+ function failedOperationalReport(args) {
119
+ return {
120
+ generatedAt: new Date(args.nowMs).toISOString(),
121
+ pluginName: args.pluginName,
122
+ metrics: [{
123
+ label: "report",
124
+ tone: "danger",
125
+ value: "failed"
126
+ }],
127
+ title: args.pluginName,
128
+ recordSets: [{
129
+ emptyText: "This plugin report failed to load.",
130
+ title: "Error"
131
+ }]
132
+ };
133
+ }
134
+ /** Collect read-only operational summaries exposed by plugins. */
135
+ async function getPluginOperationalReports(nowMs) {
136
+ const reports = [];
137
+ const outcomes = await runPluginHooksAtOnce(getRegistrations(), (plugin) => {
138
+ const hook = plugin.hooks?.operationalReport;
139
+ return hook && (() => hook({
140
+ ...basePluginContext(plugin),
141
+ eventStats: createPluginConversationEventStats(plugin, () => nowMs),
142
+ nowMs,
143
+ state: pluginReadState(createPluginState(plugin.manifest.name))
144
+ }));
145
+ });
146
+ for (const outcome of outcomes) {
147
+ const pluginName = outcome.plugin.manifest.name;
148
+ try {
149
+ if ("error" in outcome) throw outcome.error;
150
+ const report = outcome.value;
151
+ if (!report) continue;
152
+ reports.push(sanitizeOperationalReport({
153
+ pluginName,
154
+ report
155
+ }));
156
+ } catch (error) {
157
+ createPluginLogger(pluginName).error("Plugin operational report failed", { error: error instanceof Error ? error.message : String(error) });
158
+ reports.push(failedOperationalReport({
159
+ nowMs,
160
+ pluginName
161
+ }));
162
+ }
163
+ }
164
+ return reports;
165
+ }
166
+ /** Collect person-scoped plugin reports for one profile subject. */
167
+ async function getPluginProfileReports(args) {
168
+ const reports = [];
169
+ const outcomes = await runPluginHooksAtOnce(getRegistrations(), (plugin) => {
170
+ const hook = plugin.hooks?.profileReport;
171
+ return hook && (() => hook({
172
+ ...basePluginContext(plugin),
173
+ nowMs: args.nowMs,
174
+ state: pluginReadState(createPluginState(plugin.manifest.name)),
175
+ subject: args.subject,
176
+ viewer: args.viewer
177
+ }));
178
+ });
179
+ for (const outcome of outcomes) {
180
+ const pluginName = outcome.plugin.manifest.name;
181
+ try {
182
+ if ("error" in outcome) throw outcome.error;
183
+ const report = outcome.value;
184
+ if (!report) continue;
185
+ reports.push(sanitizeOperationalReport({
186
+ pluginName,
187
+ report
188
+ }));
189
+ } catch (error) {
190
+ createPluginLogger(pluginName).error("Plugin profile report failed", { error: error instanceof Error ? error.message : String(error) });
191
+ }
192
+ }
193
+ return reports;
194
+ }
195
+ export { getPluginOperationalReports, getPluginProfileReports };
@@ -1,38 +1,18 @@
1
- import { Gn as create, Jn as CURL_DOWNLOAD_ARGS, Oa as runNonInteractiveCommand, Pd as sleep, Xn as getSandboxProvider, nf as getStateAdapter, qn as isStale } from "./db-DhzvUY23.js";
2
- import { E as SANDBOX_COMMAND_PATH, M as SANDBOX_WORKSPACE_ROOT } from "./transcript-CCi7323k.js";
3
- import { E as withSpan, b as setSpanAttributes } from "./logging-B8KEJegM.js";
1
+ import { n as getChatConfig } from "./config-CHQ8X251.js";
2
+ import { Js as sleep, Ku as getStateAdapter, qi as runNonInteractiveCommand } from "./db-BFmyYZtJ.js";
3
+ import { a as SANDBOX_COMMAND_PATH, d as SANDBOX_WORKSPACE_ROOT } from "./prompt-Dv7gkpD6.js";
4
+ import { i as CURL_DOWNLOAD_ARGS, o as getSandboxProvider, r as isStale, t as create } from "./profile-BQ-iBDsZ.js";
5
+ import { E as withSpan, b as setSpanAttributes } from "./logging--smS7XRK.js";
4
6
  import * as z from "zod";
5
7
  // src/chat/sandbox/resources.ts
6
- let configuredResources;
7
- function resourcesFromEnv() {
8
- const value = process.env["SANDBOX_VCPUS"]?.trim();
9
- if (!value || !/^\d+$/.test(value)) return;
10
- const vcpus = Number(value);
11
- if (!Number.isSafeInteger(vcpus) || vcpus <= 0) return;
12
- return { vcpus };
13
- }
14
- /** Return the app-level sandbox sizing override. */
15
- function getSandboxResourceConfig() {
16
- return configuredResources;
17
- }
18
- /** Replace app-level sandbox sizing and return the previous setting. */
19
- function setSandboxResourceConfig(config) {
20
- const previous = configuredResources;
21
- if (config?.vcpus === void 0) {
22
- configuredResources = void 0;
23
- return previous;
24
- }
25
- if (!Number.isSafeInteger(config.vcpus) || config.vcpus <= 0) throw new Error("sandbox.vcpus must be a positive integer");
26
- configuredResources = { vcpus: config.vcpus };
27
- return previous;
28
- }
29
8
  /**
30
9
  * Resolve sandbox sizing. A Workspace vCPU setting wins over the app setting,
31
- * which wins over the legacy environment setting.
10
+ * which wins over `SANDBOX_VCPUS`.
32
11
  */
33
12
  function getSandboxResources(workspace) {
34
13
  if (workspace?.vcpus) return { vcpus: workspace.vcpus };
35
- return configuredResources ?? resourcesFromEnv();
14
+ const { vcpus } = getChatConfig().sandbox;
15
+ return vcpus === void 0 ? void 0 : { vcpus };
36
16
  }
37
17
  // src/chat/sandbox/snapshot/span.ts
38
18
  /** Record the reusable snapshot selected for a new Sandbox. */
@@ -444,4 +424,4 @@ async function resolve(params) {
444
424
  };
445
425
  });
446
426
  }
447
- export { setSnapshotSpanAttributes as a, setSandboxResourceConfig as c, postinstall as i, resolve as n, getSandboxResourceConfig as o, dependencies as r, getSandboxResources as s, getCachedSnapshot as t };
427
+ export { setSnapshotSpanAttributes as a, postinstall as i, resolve as n, getSandboxResources as o, dependencies as r, getCachedSnapshot as t };
@@ -1,87 +1,12 @@
1
- import { t as __exportAll } from "./rolldown-runtime-BKpuH2hG.js";
2
- import { Xu as publishAgentUpdate, i as getConversationStore, sl as SYSTEM_IDENTITY_ID } from "./db-DhzvUY23.js";
3
- import { A as getAgentReplyMessageId, T as parentMessageText, Xt as getConversationWorkState, et as buildDeterministicTurnId, gi as readInboundMessageSender, k as readAgentConfig, kr as EVENT_SYSTEM_ACTOR, m as resolveMailboxTurnWork, n as getConversationStoppedAtMs, on as EVENT_WAIT_MS, p as listActiveMailboxTurns, t as enqueueAutomatedInput, w as logDroppedParentMessage, xi as readParentMessage } from "./session-stop-DponjDUZ.js";
4
- import { a as listUnreportedSiblingAgents, f as isDroppedChildInput, i as listOpenChildAgents, l as childAgentInput, o as parentResultActor, p as readChildConversationSender, s as recordChildAgentEnded, u as getChildAgentInputSender } from "./list-mkB_GU8R.js";
5
- import { G as mapBounded, H as renderDataTag } from "./transcript-CCi7323k.js";
6
- import { n as listChildMessages, t as childMessageSenderMetadata } from "./child-message--2G3Ft26.js";
7
- import { Dn as AGENT_MESSAGE_EVENT_TYPE, En as AGENT_INVOCATION_EVENT_NAMESPACE, On as AGENT_UPDATE_EVENT_TYPE } from "./media-BebquhET.js";
8
- import * as z from "zod";
9
- import { actorSchema } from "@sentry/junior-plugin-api";
10
- // src/chat/agent-invocations/result-actors.ts
11
- const senderActorMetadataSchema = z.object({ actor: actorSchema });
12
- /**
13
- * Return the Inbound message author id for results sent by one Actor.
14
- * `selectContiguousTurnBatch` in `task-execution/worker.ts` puts messages in
15
- * one attempt only when their author ids and sources match. Mid-Turn drains
16
- * take only `interrupt` messages, and results are `defer`. So results never
17
- * share a Turn and its credentials with another Actor or with watch Events.
18
- * Keep this id unique per Actor if either rule changes.
19
- */
20
- function resultAuthorId(actor) {
21
- switch (actor.platform) {
22
- case "system": return `agent-invocation:system:${actor.name}`;
23
- case "slack": return `agent-invocation:slack:${actor.teamId}:${actor.userId}`;
24
- default: return `agent-invocation:${actor.platform}:${actor.userId}`;
25
- }
26
- }
27
- /** Read the Actor of the child Turn that a reply or message carries. */
28
- function senderActorFromMetadata(metadata) {
29
- const parsed = senderActorMetadataSchema.safeParse(metadata);
30
- return parsed.success ? parsed.data.actor : void 0;
31
- }
32
- /**
33
- * Run each child reply or message as the Actor of the child Turn that sent
34
- * it, which the input carries, so the parent never gets more authority than
35
- * that Turn. A parent message from the stored parent runs as the Actor of the
36
- * parent's Turn, with its grants and text. Input that a Turn with another
37
- * Actor sent, or that names no child of this Conversation, runs as the Event
38
- * system Actor. Input that `isDroppedChildInput` drops is left out. Returns
39
- * undefined when no input is left.
40
- */
41
- async function withAgentInvocationResultActors(work) {
42
- if (work.kind !== "mailbox") return work;
43
- const kept = (await mapBounded(work.batch, async (entry) => {
44
- const parentMessage = readParentMessage(entry.message);
45
- if (parentMessage) {
46
- if (await isDroppedChildInput(entry.message)) {
47
- logDroppedParentMessage(entry.message, parentMessage);
48
- return;
49
- }
50
- const text = await parentMessageText(entry.message, parentMessage);
51
- return {
52
- ...entry,
53
- actor: parentMessage.actor,
54
- requestText: entry.message.input.text.trim(),
55
- ...parentMessage.credentialContext ? { credentialContext: parentMessage.credentialContext } : void 0,
56
- message: {
57
- ...entry.message,
58
- input: {
59
- ...entry.message.input,
60
- text
61
- }
62
- }
63
- };
64
- }
65
- const input = childAgentInput(entry.message);
66
- if (!input) return entry;
67
- if (await isDroppedChildInput(entry.message)) return;
68
- const sender = await getChildAgentInputSender(entry.message, input);
69
- const actor = senderActorFromMetadata(entry.message.input.metadata);
70
- if (!sender || !actor || entry.message.input.authorId !== resultAuthorId(actor)) return {
71
- ...entry,
72
- actor: EVENT_SYSTEM_ACTOR
73
- };
74
- return {
75
- ...entry,
76
- actor
77
- };
78
- })).filter((entry) => entry !== void 0);
79
- return kept.length > 0 ? {
80
- kind: "mailbox",
81
- batch: kept
82
- } : void 0;
83
- }
84
- // src/chat/agent-invocations/store.ts
1
+ import { Nn as readInboundMessageSender, i as getConversationStore, lu as remindsNoReplyForChildStatus, mo as publishAgentUpdate, oc as SYSTEM_IDENTITY_ID, rn as getConversationWorkState } from "./db-BFmyYZtJ.js";
2
+ import { O as EVENT_WAIT_MS, Rt as buildDeterministicTurnId, S as getAgentReplyMessageId, U as enqueueAutomatedInput, W as getConversationStoppedAtMs, Xn as EVENT_SYSTEM_ACTOR, b as readAgentConfig, i as listActiveMailboxTurns, x as getAgentMessageId } from "./mailbox-turn-uSXhUFc9.js";
3
+ import { c as listUnreportedSiblingAgents, m as readChildConversationSender, n as recordChildAgentEnded, s as listOpenChildAgents, t as parentResultActor } from "./parent-result-Ck1rFYRQ.js";
4
+ import { t as resultAuthorId } from "./sender-actors-CPglLd5R.js";
5
+ import { n as listChildMessages, t as childMessageSenderMetadata } from "./child-message-DHjQLEd1.js";
6
+ import { U as renderDataTag } from "./prompt-Dv7gkpD6.js";
7
+ import { _ as NO_REPLY_TOOL_NAME } from "./system-prompt-table-CiXy0eNR.js";
8
+ import { En as AGENT_UPDATE_EVENT_TYPE, Tn as AGENT_MESSAGE_EVENT_TYPE, wn as AGENT_EVENT_NAMESPACE } from "./types-C4iC-IMC.js";
9
+ // src/chat/child-agents/store.ts
85
10
  /**
86
11
  * Read the name, agent type, fork flag, and title of one child Conversation,
87
12
  * for labels, from its binding, title, and agent config.
@@ -105,7 +30,7 @@ async function childAgentStillWorks(conversationId) {
105
30
  if ((await listOpenChildAgents(conversationId)).length > 0) return true;
106
31
  return ((await getConversationWorkState({ conversationId }))?.messages ?? []).some((message) => readInboundMessageSender(message) !== void 0);
107
32
  }
108
- // src/chat/agent-invocations/agent-update.ts
33
+ // src/chat/child-agents/agent-update.ts
109
34
  /**
110
35
  * Agent update: what one Conversation reports to the agents that wait on
111
36
  * it. Every kind of Conversation reports with the same update. A parent gets
@@ -129,16 +54,15 @@ function renderAgentResult(args) {
129
54
  waiting_on: args.waitingOn
130
55
  }, "An agent", text || "(empty)");
131
56
  }
132
- // src/chat/agent-invocations/result.ts
133
- var result_exports = /* @__PURE__ */ __exportAll({ createChildConversationWorker: () => createChildConversationWorker });
57
+ // src/chat/child-agents/result.ts
134
58
  /**
135
59
  * Render the parent agent input for one child agent result as one
136
60
  * `<agent-result>`, the agent update that a Watch on the child also gets.
137
- * The system prompt says what to do for each status, so the input repeats no
138
- * guidance.
61
+ * The system prompt says what to do for each status. A Lead's done result
62
+ * also reminds it that a status update needs no reply.
139
63
  */
140
64
  function renderResultInput(sender, result, openSiblings) {
141
- return renderAgentResult({
65
+ const agentResult = renderAgentResult({
142
66
  conversationId: sender.childConversationId,
143
67
  name: sender.agentName,
144
68
  source: "child_agent",
@@ -149,6 +73,11 @@ function renderResultInput(sender, result, openSiblings) {
149
73
  },
150
74
  waitingOn: openSiblings.length ? openSiblings.map(siblingLabel).join(", ") : void 0
151
75
  });
76
+ return result.status === "done" ? withNoReplyReminder(sender, agentResult) : agentResult;
77
+ }
78
+ const NO_REPLY_REMINDER = `If this is only a status update with nothing a member needs, end with \`${NO_REPLY_TOOL_NAME}\`.`;
79
+ function withNoReplyReminder(sender, input) {
80
+ return remindsNoReplyForChildStatus(sender.parentKind) ? `${input}\n${NO_REPLY_REMINDER}` : input;
152
81
  }
153
82
  function siblingLabel(sibling) {
154
83
  return sibling.agentName ?? sibling.title ?? sibling.childConversationId;
@@ -188,12 +117,12 @@ function senderEventMetadata(actor, event) {
188
117
  };
189
118
  }
190
119
  function renderMessageInput(sender, text) {
191
- return renderDataTag("agent-message", {
120
+ return withNoReplyReminder(sender, renderDataTag("agent-message", {
192
121
  conversation_id: sender.childConversationId,
193
122
  name: sender.agentName,
194
123
  source: "child_agent",
195
124
  title: sender.title
196
- }, "A child agent that you started", text.trim());
125
+ }, "A child agent that you started", text.trim()));
197
126
  }
198
127
  /**
199
128
  * Append one message from a child agent to its parent mailbox and wake the
@@ -204,13 +133,13 @@ function renderMessageInput(sender, text) {
204
133
  async function enqueueAgentMessageToParent(args) {
205
134
  const nowMs = args.nowMs ?? Date.now();
206
135
  const senderId = args.sender.childConversationId;
207
- const inboundMessageId = `agent-invocation:${senderId}:message:${args.messageKey}`;
136
+ const inboundMessageId = getAgentMessageId(senderId, args.messageKey);
208
137
  const summary = `${childAgentLabel(args.sender)} sent a message.`;
209
138
  const metadata = senderEventMetadata(args.actor, {
210
139
  eventKey: inboundMessageId,
211
140
  eventType: AGENT_MESSAGE_EVENT_TYPE,
212
141
  identifier: senderId,
213
- namespace: AGENT_INVOCATION_EVENT_NAMESPACE,
142
+ namespace: AGENT_EVENT_NAMESPACE,
214
143
  trustedSummary: summary
215
144
  });
216
145
  await enqueueAutomatedInput({
@@ -271,7 +200,7 @@ async function enqueueStarterUpdate(args) {
271
200
  eventKey: inboundMessageId,
272
201
  eventType: AGENT_UPDATE_EVENT_TYPE,
273
202
  identifier: senderId,
274
- namespace: AGENT_INVOCATION_EVENT_NAMESPACE,
203
+ namespace: AGENT_EVENT_NAMESPACE,
275
204
  ...stillWorks ? void 0 : { status },
276
205
  trustedSummary: `${childAgentLabel(args.sender)} ${stillWorks ? "sent a message." : RESULT_SUMMARIES[status]}`
277
206
  }),
@@ -330,24 +259,4 @@ function createEndStoppedChildWork(options) {
330
259
  });
331
260
  };
332
261
  }
333
- /**
334
- * Build the worker for all work of a child Conversation. The caller selects
335
- * it from the stored kind of the Conversation, never from a Turn Source.
336
- * Every input, such as a parent task or message, a person's Message in a
337
- * Thread, a Watch Event, or a reply of the child's own child agent, runs on
338
- * the Conversation loop, like input to a root.
339
- */
340
- function createChildConversationWorker(options) {
341
- return async (context) => {
342
- const work = await resolveMailboxTurnWork(context);
343
- const kept = work ? await withAgentInvocationResultActors(work) : void 0;
344
- if (!kept) {
345
- await context.attempt.ack();
346
- return { status: "completed" };
347
- }
348
- const result = await options.runTurn(context, kept);
349
- if (result.status === "completed") await recordChildAgentEnded(context.conversationId, "success", options);
350
- return result;
351
- };
352
- }
353
- export { result_exports as a, withAgentInvocationResultActors as c, enqueueStarterUpdate as i, createEndStoppedChildWork as n, renderAgentResult as o, enqueueAgentMessageToParent as r, getChildAgentLabel as s, createChildConversationWorker as t };
262
+ export { getChildAgentLabel as a, renderAgentResult as i, enqueueAgentMessageToParent as n, enqueueStarterUpdate as r, createEndStoppedChildWork as t };