@sentry/junior 0.221.1 → 0.223.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 (65) hide show
  1. package/dist/{agent-CY49A4pN.js → agent-Bzbf92vv.js} +97 -42
  2. package/dist/{agent-hooks-BnZBgDPe.js → agent-hooks-DZU5nsd1.js} +60 -15
  3. package/dist/{agent-runner-BC8iSAfE.js → agent-runner-2VQ9WhkG.js} +6 -5
  4. package/dist/api/schema.d.ts +209 -11
  5. package/dist/api/schema.js +4 -4
  6. package/dist/api.js +18 -515
  7. package/dist/{app-BYD2Nyji.d.ts → app-BbSD6EtD.d.ts} +1 -1
  8. package/dist/app.d.ts +1 -1
  9. package/dist/app.js +241 -39
  10. package/dist/{auth-pause-state-CJwPs1cT.js → auth-pause-state-Bn2vX4PA.js} +41 -7
  11. package/dist/{briefs-BSOhy23c.js → briefs-BJPfCrlT.js} +6 -6
  12. package/dist/{catalog-runtime-0oMD2jas.js → catalog-runtime-BthunUDD.js} +1 -1
  13. package/dist/{checkpoint-Bl47qAIY.js → checkpoint-Deu-OVb3.js} +11 -7
  14. package/dist/cli/chat.js +13 -13
  15. package/dist/cli/check.js +3 -3
  16. package/dist/cli/main.js +1 -1
  17. package/dist/cli/plugins.js +3 -3
  18. package/dist/cli/snapshot-create.js +3 -3
  19. package/dist/cli/upgrade.js +3 -3
  20. package/dist/{client-BrThxuRI.js → client-DjC6-6iU.js} +56 -6
  21. package/dist/{config-CEuC6CFj.js → config-CtoUVs72.js} +6 -7
  22. package/dist/{conversation-BSRGzJmY.js → conversation-1HUoZr2l.js} +75 -4
  23. package/dist/{conversation-privacy-aHn1OwXL.js → conversation-privacy-xS1t92xa.js} +1 -1
  24. package/dist/{credential-sync-Dht95TJQ.js → credential-sync-CKdXEUDO.js} +180 -31
  25. package/dist/{execution-stats-D9m2kmmg.js → execution-stats-CrXs9vSH.js} +3 -3
  26. package/dist/{executor-3IasVOqK.js → executor-AOhG9X1t.js} +1 -1
  27. package/dist/history-yaSjGMD_.d.ts +65 -0
  28. package/dist/instrumentation.js +2 -2
  29. package/dist/{job-queue-36liupTq.js → job-queue-CNd9cpIy.js} +1 -1
  30. package/dist/{logging-gR24QCo_.js → logging-DiN3o3nB.js} +1 -1
  31. package/dist/nitro.d.ts +1 -1
  32. package/dist/nitro.js +3 -3
  33. package/dist/{oauth-callback-server-BvNIWVA3.js → oauth-callback-server-Ca0VLUEw.js} +2 -2
  34. package/dist/{pending-auth-Cl4BsopG.js → pending-auth-D7vmttn_.js} +2 -2
  35. package/dist/{profile-VmUpQuOm.js → profile-BsNrw8lj.js} +4 -4
  36. package/dist/{prompt-BkaHwBW0.js → prompt-90miy8VV.js} +1 -1
  37. package/dist/{registry-BATk1X_v.js → registry-Dankt-Pl.js} +1 -1
  38. package/dist/reporting-window-DbUqng0P.js +229 -0
  39. package/dist/{resolve-Cf79l1H8.js → resolve-B38CpJe2.js} +2 -2
  40. package/dist/{runner-DNN4EPj_.js → runner-Ck5rEjCm.js} +21 -10
  41. package/dist/{sandbox-egress-signals-C-HUJW1G.js → sandbox-egress-signals-BOfFkvly.js} +1 -1
  42. package/dist/{schema-YPJXVcOW.js → schema-RpbW5Od2.js} +5 -128
  43. package/dist/{short-title-Cy3D8vg1.js → short-title-BHd_jUFX.js} +2 -2
  44. package/dist/{skills-DMQkR1Yu.js → skills-DbP4TDft.js} +2 -2
  45. package/dist/{spawn-BHk7RpYw.js → spawn-DzXc_PKO.js} +2 -2
  46. package/dist/{stats-8Bzht8zO.js → stats-pNGp3G5q.js} +56 -15
  47. package/dist/{task-queue-Cm4FhC0n.js → task-queue-Cy9y1foT.js} +3 -3
  48. package/dist/{task-runner-dQwOhCYs.js → task-runner-DI1FBJFJ.js} +8 -8
  49. package/dist/{thread-state-D0Ktlch_.js → thread-state-DXgxOYpZ.js} +5 -5
  50. package/dist/{turn-execution-BfLZfabf.js → turn-execution-BNOXrZ-M.js} +3 -3
  51. package/dist/{turn-lifecycle-D75pWL8e.js → turn-lifecycle-Bjf6y2GO.js} +1 -1
  52. package/dist/{validation-D5fdtuzG.js → validation-D5CIslEu.js} +1 -1
  53. package/dist/{version-DErORHQC.js → version-_ZQFlslB.js} +1 -1
  54. package/dist/version.js +1 -1
  55. package/dist/{web-authorization-IHMPbDay.js → web-authorization-6mmfS_o-.js} +1 -1
  56. package/dist/web-input-BJpWm6go.js +899 -0
  57. package/dist/{work-CaaSjlNk.js → work-DvIlJR3C.js} +9 -9
  58. package/dist/{worker-Eom9CfBl.js → worker-D1qidg-Y.js} +5 -5
  59. package/migrations/0044_event_automation_channel_destinations.sql +36 -0
  60. package/migrations/meta/0044_snapshot.json +3473 -0
  61. package/migrations/meta/_journal.json +7 -0
  62. package/package.json +4 -4
  63. package/dist/history-ClE4toxe.d.ts +0 -32
  64. package/dist/reporting-schema-DosTN__Q.js +0 -105
  65. package/dist/web-input-DskRJhrK.js +0 -392
@@ -0,0 +1,65 @@
1
+ import { z } from "zod";
2
+ import "@sentry/junior-plugin-api";
3
+ //#region src/chat/conversations/cards.d.ts
4
+ /** Built-in response types accepted by Message storage and delivery. */
5
+ declare const messageCardSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
6
+ kind: z.ZodLiteral<"automation">;
7
+ id: z.ZodString;
8
+ title: z.ZodString;
9
+ url: z.ZodNullable<z.ZodString>;
10
+ instruction: z.ZodString;
11
+ trigger: z.ZodString;
12
+ warning: z.ZodNullable<z.ZodString>;
13
+ }, z.core.$strict>, z.ZodObject<{
14
+ kind: z.ZodLiteral<"object">;
15
+ key: z.ZodString;
16
+ label: z.ZodString;
17
+ objectType: z.ZodEnum<{
18
+ task: "task";
19
+ code_change: "code_change";
20
+ automation: "automation";
21
+ item: "item";
22
+ }>;
23
+ title: z.ZodString;
24
+ url: z.ZodNullable<z.ZodURL>;
25
+ description: z.ZodOptional<z.ZodString>;
26
+ status: z.ZodOptional<z.ZodString>;
27
+ trigger: z.ZodOptional<z.ZodString>;
28
+ warning: z.ZodOptional<z.ZodString>;
29
+ plugin: z.ZodString;
30
+ }, z.core.$strict>], "kind">;
31
+ type MessageCard = z.output<typeof messageCardSchema>;
32
+ /** Render each built-in card with its own text format. */
33
+ declare function messageCardText(card: MessageCard): string;
34
+ //#endregion
35
+ //#region src/chat/conversations/history.d.ts
36
+ /** Where a failed turn stopped. */
37
+ declare const conversationTurnFailureCodeSchema: z.ZodEnum<{
38
+ agent_run_failed: "agent_run_failed";
39
+ delivery_failed: "delivery_failed";
40
+ model_execution_failed: "model_execution_failed";
41
+ persistence_failed: "persistence_failed";
42
+ }>;
43
+ /**
44
+ * Why a failed turn stopped.
45
+ * Values are fixed labels only. Do not store raw exception text.
46
+ */
47
+ declare const conversationTurnFailureReasonSchema: z.ZodEnum<{
48
+ unknown: "unknown";
49
+ capacity: "capacity";
50
+ auth: "auth";
51
+ permission: "permission";
52
+ rate_limit: "rate_limit";
53
+ timeout: "timeout";
54
+ network: "network";
55
+ server: "server";
56
+ invalid_request: "invalid_request";
57
+ invalid_response: "invalid_response";
58
+ quota: "quota";
59
+ content_policy: "content_policy";
60
+ empty_output: "empty_output";
61
+ tool_errors: "tool_errors";
62
+ suppressed_output: "suppressed_output";
63
+ }>;
64
+ //#endregion
65
+ export { messageCardText as i, conversationTurnFailureReasonSchema as n, MessageCard as r, conversationTurnFailureCodeSchema as t };
@@ -1,6 +1,6 @@
1
- import { M as getDeploymentServiceVersion, N as getDeploymentTelemetryAttributes } from "./logging-gR24QCo_.js";
1
+ import { M as getDeploymentServiceVersion, N as getDeploymentTelemetryAttributes } from "./logging-DiN3o3nB.js";
2
2
  import { _ as vercelAIIntegration, a as getClient, b as withStreamedSpan, c as init, o as getGlobalScope } from "./sentry-CgWZM_kV.js";
3
- import { n as getCurrentConversationPrivacy } from "./conversation-privacy-aHn1OwXL.js";
3
+ import { n as getCurrentConversationPrivacy } from "./conversation-privacy-xS1t92xa.js";
4
4
  import { t as consumePrivateTraceResultMarker } from "./private-trace-result-BLvBjy_e.js";
5
5
  //#region src/chat/sentry-payload-filter.ts
6
6
  const PAYLOAD_ATTRIBUTE_KEYS = /* @__PURE__ */ new Set([
@@ -1,4 +1,4 @@
1
- import { a as getChatConfig } from "./config-CEuC6CFj.js";
1
+ import { a as getChatConfig } from "./config-CtoUVs72.js";
2
2
  import { a as signQueueMessage, i as QUEUE_SIGNATURE_MAX_AGE_MS, o as verifyQueueMessage, s as createVercelQueueClient } from "./vercel-queue-DIkVcfK4.js";
3
3
  import { AsyncLocalStorage } from "node:async_hooks";
4
4
  import { z } from "zod";
@@ -1,5 +1,5 @@
1
1
  import { d as setTag, f as setUser, h as startSpan, i as getActiveSpan, l as logger, n as captureMessage, p as spanToJSON, s as getTraceData, t as captureException, y as withScope } from "./sentry-CgWZM_kV.js";
2
- import { t as JUNIOR_VERSION } from "./version-DErORHQC.js";
2
+ import { t as JUNIOR_VERSION } from "./version-_ZQFlslB.js";
3
3
  import path from "node:path";
4
4
  import { styleText } from "node:util";
5
5
  import { ConfigError, configureSync, getConfig, getLogger } from "@logtape/logtape";
package/dist/nitro.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { n as JuniorDashboardOptions } from "./app-BYD2Nyji.js";
1
+ import { n as JuniorDashboardOptions } from "./app-BbSD6EtD.js";
2
2
  import { n as JuniorPluginSet } from "./plugins-BT2l4We3.js";
3
3
  //#region src/nitro.d.ts
4
4
  export type JuniorNitroDashboardOptions = JuniorDashboardOptions;
package/dist/nitro.js CHANGED
@@ -1,9 +1,9 @@
1
- import { A as JUNIOR_WORKSPACE_SNAPSHOT_JOB_CALLBACK_ROUTE, D as JUNIOR_PLUGIN_TASK_CALLBACK_ROUTE, E as JUNIOR_HEARTBEAT_ROUTE, O as JUNIOR_RETENTION_CRON_SCHEDULE, T as JUNIOR_HEARTBEAT_CRON_SCHEDULE, k as JUNIOR_RETENTION_ROUTE, w as JUNIOR_CONVERSATION_WORK_CALLBACK_ROUTE } from "./logging-gR24QCo_.js";
1
+ import { A as JUNIOR_WORKSPACE_SNAPSHOT_JOB_CALLBACK_ROUTE, D as JUNIOR_PLUGIN_TASK_CALLBACK_ROUTE, E as JUNIOR_HEARTBEAT_ROUTE, O as JUNIOR_RETENTION_CRON_SCHEDULE, T as JUNIOR_HEARTBEAT_CRON_SCHEDULE, k as JUNIOR_RETENTION_ROUTE, w as JUNIOR_CONVERSATION_WORK_CALLBACK_ROUTE } from "./logging-DiN3o3nB.js";
2
2
  import { d as resolvePackageDir, t as discoverInstalledPluginPackageContent, u as isValidPackageName } from "./package-discovery-7a9YqLhE.js";
3
3
  import { n as resolveConversationWorkQueueTopic } from "./vercel-queue-DIkVcfK4.js";
4
- import { t as WORKSPACE_SNAPSHOT_JOB_QUEUE_TOPIC } from "./job-queue-36liupTq.js";
4
+ import { t as WORKSPACE_SNAPSHOT_JOB_QUEUE_TOPIC } from "./job-queue-CNd9cpIy.js";
5
5
  import { a as pluginRuntimeRegistrationsFromPluginSet, r as pluginCatalogConfigFromPluginSet } from "./plugins-egKWjgue.js";
6
- import { t as PLUGIN_TASK_QUEUE_TOPIC } from "./task-queue-Cm4FhC0n.js";
6
+ import { t as PLUGIN_TASK_QUEUE_TOPIC } from "./task-queue-Cy9y1foT.js";
7
7
  import { n as loadPluginSetFromModule, r as resolvePluginModule } from "./plugin-module-BKGOXca2.js";
8
8
  import path from "node:path";
9
9
  import { cpSync, existsSync, mkdirSync, readdirSync, statSync } from "node:fs";
@@ -1,5 +1,5 @@
1
- import { X as createUserTokenStore } from "./agent-CY49A4pN.js";
2
- import { a as GET, n as syncLocalOAuthCredential, r as GET$1 } from "./credential-sync-Dht95TJQ.js";
1
+ import { X as createUserTokenStore } from "./agent-Bzbf92vv.js";
2
+ import { a as GET, n as syncLocalOAuthCredential, r as GET$1 } from "./credential-sync-CKdXEUDO.js";
3
3
  import { createServer } from "node:http";
4
4
  //#region src/chat/local/oauth-callback-server.ts
5
5
  const LOCAL_OAUTH_TIMEOUT_MS = 6e5;
@@ -1,5 +1,5 @@
1
- import { g as extractAssistantText, i as abandonTurnRecord } from "./checkpoint-Bl47qAIY.js";
2
- import { qt as buildDeterministicTurnId } from "./stats-8Bzht8zO.js";
1
+ import { g as extractAssistantText, i as abandonTurnRecord } from "./checkpoint-Deu-OVb3.js";
2
+ import { qt as buildDeterministicTurnId } from "./stats-pNGp3G5q.js";
3
3
  //#region src/chat/runtime/turn.ts
4
4
  /** Classified Slack turn failure carrying the owning Sentry capture outward. */
5
5
  var ConversationTurnBoundaryError = class extends Error {
@@ -1,7 +1,7 @@
1
- import { w as toOptionalTrimmed } from "./client-BrThxuRI.js";
2
- import { _ as setSpanAttributes, v as setSpanStatus } from "./logging-gR24QCo_.js";
3
- import { a as getChatConfig } from "./config-CEuC6CFj.js";
4
- import { n as pluginCatalogRuntime } from "./catalog-runtime-0oMD2jas.js";
1
+ import { w as toOptionalTrimmed } from "./client-DjC6-6iU.js";
2
+ import { _ as setSpanAttributes, v as setSpanStatus } from "./logging-DiN3o3nB.js";
3
+ import { a as getChatConfig } from "./config-CtoUVs72.js";
4
+ import { n as pluginCatalogRuntime } from "./catalog-runtime-BthunUDD.js";
5
5
  import { createHash } from "node:crypto";
6
6
  import { createMemoryState } from "@chat-adapter/state-memory";
7
7
  import { createRedisState } from "@chat-adapter/state-redis";
@@ -1,4 +1,4 @@
1
- import { M as conversationBriefSchema, N as parseBriefInput, j as briefOutcomeStatusSchema } from "./conversation-BSRGzJmY.js";
1
+ import { I as briefOutcomeStatusSchema, L as conversationBriefSchema, R as parseBriefInput } from "./conversation-1HUoZr2l.js";
2
2
  import { z } from "zod";
3
3
  //#region src/chat/briefs/generate.ts
4
4
  const MAX_INPUT_CHARS = 6e4;
@@ -1,4 +1,4 @@
1
- import { _ as setSpanAttributes, d as logInfo, f as logWarn } from "./logging-gR24QCo_.js";
1
+ import { _ as setSpanAttributes, d as logInfo, f as logWarn } from "./logging-DiN3o3nB.js";
2
2
  import { i as credentialUserSubjectId } from "./context-Bplcgypl.js";
3
3
  import { n as normalizePluginPackageNames, o as pluginRoots, t as discoverInstalledPluginPackageContent } from "./package-discovery-7a9YqLhE.js";
4
4
  import path from "node:path";
@@ -0,0 +1,229 @@
1
+ import { z } from "zod";
2
+ //#region src/reporting-schema.ts
3
+ const healthReportSchema = z.object({
4
+ status: z.literal("ok"),
5
+ service: z.string(),
6
+ timestamp: z.string()
7
+ }).strict();
8
+ const pluginSchema = z.object({
9
+ configKeys: z.array(z.string()),
10
+ description: z.string(),
11
+ displayName: z.string(),
12
+ name: z.string()
13
+ }).strict();
14
+ const pluginsSchema = z.array(pluginSchema);
15
+ const skillReportSchema = z.object({
16
+ name: z.string(),
17
+ pluginProvider: z.string().optional()
18
+ }).strict();
19
+ const skillReportsSchema = z.array(skillReportSchema);
20
+ const pluginPackageContentItemReportSchema = z.object({
21
+ dir: z.string(),
22
+ hasMigrationsDir: z.boolean(),
23
+ hasSkillsDir: z.boolean(),
24
+ packageName: z.string()
25
+ }).strict();
26
+ const pluginPackageContentReportSchema = z.object({
27
+ packageNames: z.array(z.string()),
28
+ packages: z.array(pluginPackageContentItemReportSchema),
29
+ manifestRoots: z.array(z.string()),
30
+ skillRoots: z.array(z.string()),
31
+ tracingIncludes: z.array(z.string())
32
+ }).strict();
33
+ const runtimeInfoReportSchema = z.object({
34
+ cwd: z.string(),
35
+ homeDir: z.string(),
36
+ descriptionText: z.string().optional(),
37
+ providers: z.array(z.string()),
38
+ skills: z.array(skillReportSchema),
39
+ packagedContent: pluginPackageContentReportSchema
40
+ }).strict();
41
+ const pluginOperationalToneSchema = z.enum([
42
+ "danger",
43
+ "good",
44
+ "neutral",
45
+ "warning"
46
+ ]);
47
+ const pluginOperationalMetricSchema = z.object({
48
+ label: z.string(),
49
+ tone: pluginOperationalToneSchema.optional(),
50
+ value: z.string()
51
+ }).strict();
52
+ const pluginOperationalFieldSchema = z.object({
53
+ key: z.string(),
54
+ label: z.string()
55
+ }).strict();
56
+ const pluginOperationalRecordSchema = z.object({
57
+ id: z.string(),
58
+ tone: pluginOperationalToneSchema.optional(),
59
+ values: z.record(z.string(), z.string())
60
+ }).strict();
61
+ const pluginOperationalRecordSetSchema = z.object({
62
+ fields: z.array(pluginOperationalFieldSchema).optional(),
63
+ emptyText: z.string().optional(),
64
+ records: z.array(pluginOperationalRecordSchema).optional(),
65
+ title: z.string()
66
+ }).strict();
67
+ const pluginOperationalBarChartWidgetSchema = z.object({
68
+ categories: z.array(z.object({
69
+ id: z.string().min(1),
70
+ label: z.string().min(1),
71
+ values: z.record(z.string(), z.number().finite())
72
+ }).strict()).max(100),
73
+ description: z.string().optional(),
74
+ emptyText: z.string().optional(),
75
+ id: z.string().min(1),
76
+ series: z.array(z.object({
77
+ format: z.literal("usd").optional(),
78
+ key: z.string().min(1),
79
+ label: z.string().min(1),
80
+ tone: pluginOperationalToneSchema.optional()
81
+ }).strict()).min(1).max(8),
82
+ timeRangeDays: z.array(z.union([
83
+ z.literal(1),
84
+ z.literal(7),
85
+ z.literal(30),
86
+ z.literal(90)
87
+ ])).min(1).max(4).optional(),
88
+ title: z.string().min(1),
89
+ type: z.literal("bar_chart")
90
+ }).strict();
91
+ const pluginOperationalReportSchema = z.object({
92
+ generatedAt: z.string().optional(),
93
+ metrics: z.array(pluginOperationalMetricSchema).optional(),
94
+ recordSets: z.array(pluginOperationalRecordSetSchema).optional(),
95
+ title: z.string().optional(),
96
+ pluginName: z.string(),
97
+ widgets: z.array(pluginOperationalBarChartWidgetSchema).max(12).optional()
98
+ }).strict();
99
+ const pluginOperationalReportFeedSchema = z.object({
100
+ generatedAt: z.string(),
101
+ reports: z.array(pluginOperationalReportSchema),
102
+ source: z.literal("plugins")
103
+ }).strict();
104
+ //#endregion
105
+ //#region src/api/reporting-window.ts
106
+ /** Shared UTC day/hour/six-hour windows for dashboard activity series. */
107
+ const HOUR_MS = 36e5;
108
+ const SIX_HOUR_MS = 6 * HOUR_MS;
109
+ const DAY_MS = 24 * HOUR_MS;
110
+ /** Start of the UTC calendar day containing `valueMs`. */
111
+ function startOfUtcDay(valueMs) {
112
+ const date = new Date(valueMs);
113
+ date.setUTCHours(0, 0, 0, 0);
114
+ return date;
115
+ }
116
+ /** Start of the UTC hour containing `valueMs`. */
117
+ function startOfUtcHour(valueMs) {
118
+ const date = new Date(valueMs);
119
+ date.setUTCMinutes(0, 0, 0);
120
+ return date;
121
+ }
122
+ /** Start of the UTC 6-hour bucket containing `valueMs` (00/06/12/18). */
123
+ function startOfUtcSixHour(valueMs) {
124
+ const date = startOfUtcHour(valueMs);
125
+ date.setUTCHours(Math.floor(date.getUTCHours() / 6) * 6, 0, 0, 0);
126
+ return date;
127
+ }
128
+ /** UTC day key `YYYY-MM-DD`. */
129
+ function utcDayKey(value) {
130
+ return (typeof value === "number" ? new Date(value) : value).toISOString().slice(0, 10);
131
+ }
132
+ /** UTC hour key `YYYY-MM-DDTHH`. */
133
+ function utcHourKey(value) {
134
+ return (typeof value === "number" ? new Date(value) : value).toISOString().slice(0, 13);
135
+ }
136
+ /** UTC 6-hour bucket key `YYYY-MM-DDTHH` at 00/06/12/18. */
137
+ function utcSixHourKey(value) {
138
+ return utcHourKey(startOfUtcSixHour(typeof value === "number" ? value : value.getTime()));
139
+ }
140
+ /** Inclusive trailing UTC day window ending on today's UTC day. */
141
+ function trailingUtcDayWindow(nowMs, dayCount) {
142
+ const end = startOfUtcDay(nowMs);
143
+ const start = new Date(end);
144
+ start.setUTCDate(start.getUTCDate() - (dayCount - 1));
145
+ return {
146
+ end,
147
+ start
148
+ };
149
+ }
150
+ /** Inclusive trailing UTC hour window ending on the current UTC hour. */
151
+ function trailingUtcHourWindow(nowMs, hourCount = 24) {
152
+ const end = startOfUtcHour(nowMs);
153
+ return {
154
+ end,
155
+ start: /* @__PURE__ */ new Date(end.getTime() - (hourCount - 1) * HOUR_MS)
156
+ };
157
+ }
158
+ /** Inclusive trailing UTC 6-hour window ending on the current 6h bucket. */
159
+ function trailingUtcSixHourWindow(nowMs, bucketCount = 28) {
160
+ const end = startOfUtcSixHour(nowMs);
161
+ return {
162
+ end,
163
+ start: /* @__PURE__ */ new Date(end.getTime() - (bucketCount - 1) * SIX_HOUR_MS)
164
+ };
165
+ }
166
+ /** Fill a fixed UTC day window from a sparse map. */
167
+ function fillUtcDays(args) {
168
+ const { end, start } = trailingUtcDayWindow(args.nowMs, args.count);
169
+ const items = [];
170
+ for (const cursor = new Date(start); cursor.getTime() <= end.getTime(); cursor.setUTCDate(cursor.getUTCDate() + 1)) {
171
+ const date = utcDayKey(cursor);
172
+ items.push(args.rows.get(date) ?? args.empty(date));
173
+ }
174
+ return items;
175
+ }
176
+ /** Fill a fixed UTC hour window from a sparse map. */
177
+ function fillUtcHours(args) {
178
+ const hourCount = args.count ?? 24;
179
+ const { end, start } = trailingUtcHourWindow(args.nowMs, hourCount);
180
+ const items = [];
181
+ for (const cursor = new Date(start); cursor.getTime() <= end.getTime(); cursor.setTime(cursor.getTime() + HOUR_MS)) {
182
+ const date = utcHourKey(cursor);
183
+ items.push(args.rows.get(date) ?? args.empty(date));
184
+ }
185
+ return items;
186
+ }
187
+ /** Fill a fixed UTC 6-hour window from a map of known rows. */
188
+ function fillUtcSixHours(args) {
189
+ const bucketCount = args.count ?? 28;
190
+ const { end, start } = trailingUtcSixHourWindow(args.nowMs, bucketCount);
191
+ const items = [];
192
+ for (const cursor = new Date(start); cursor.getTime() <= end.getTime(); cursor.setTime(cursor.getTime() + SIX_HOUR_MS)) {
193
+ const date = utcSixHourKey(cursor);
194
+ items.push(args.rows.get(date) ?? args.empty(date));
195
+ }
196
+ return items;
197
+ }
198
+ /**
199
+ * Sum hour rows into trailing 6-hour buckets.
200
+ * Adds number fields. Keeps other fields from the first row in the bucket.
201
+ * Sets `date` to the 6-hour bucket key.
202
+ */
203
+ function sumUtcHoursIntoSixHours(args) {
204
+ const bucketCount = args.count ?? 28;
205
+ const bySix = /* @__PURE__ */ new Map();
206
+ for (const hour of args.hours) {
207
+ const key = utcSixHourKey(Date.parse(`${hour.date}:00:00.000Z`));
208
+ const next = {
209
+ ...bySix.get(key) ?? args.empty(key),
210
+ date: key
211
+ };
212
+ for (const [field, value] of Object.entries(hour)) {
213
+ if (field === "date") continue;
214
+ if (typeof value === "number") {
215
+ const prior = next[field];
216
+ next[field] = (typeof prior === "number" ? prior : 0) + value;
217
+ }
218
+ }
219
+ bySix.set(key, next);
220
+ }
221
+ return fillUtcSixHours({
222
+ count: bucketCount,
223
+ empty: args.empty,
224
+ nowMs: args.nowMs,
225
+ rows: bySix
226
+ });
227
+ }
228
+ //#endregion
229
+ export { skillReportsSchema as S, pluginPackageContentReportSchema as _, fillUtcSixHours as a, runtimeInfoReportSchema as b, trailingUtcDayWindow as c, utcDayKey as d, utcHourKey as f, pluginPackageContentItemReportSchema as g, pluginOperationalReportSchema as h, fillUtcHours as i, trailingUtcHourWindow as l, pluginOperationalReportFeedSchema as m, HOUR_MS as n, startOfUtcHour as o, healthReportSchema as p, fillUtcDays as r, sumUtcHoursIntoSixHours as s, DAY_MS as t, trailingUtcSixHourWindow as u, pluginSchema as v, skillReportSchema as x, pluginsSchema as y };
@@ -1,5 +1,5 @@
1
- import { C as withSpan, _ as setSpanAttributes } from "./logging-gR24QCo_.js";
2
- import { A as sleep, P as SANDBOX_WORKSPACE_ROOT, r as isStale, t as create, u as isSandboxUnavailableError, v as getVercelSandboxCredentials, w as getStateAdapter, x as runNonInteractiveCommand } from "./profile-VmUpQuOm.js";
1
+ import { C as withSpan, _ as setSpanAttributes } from "./logging-DiN3o3nB.js";
2
+ import { A as sleep, P as SANDBOX_WORKSPACE_ROOT, r as isStale, t as create, u as isSandboxUnavailableError, v as getVercelSandboxCredentials, w as getStateAdapter, x as runNonInteractiveCommand } from "./profile-BsNrw8lj.js";
3
3
  import { z } from "zod";
4
4
  import { FileSystem, Sandbox } from "@vercel/sandbox";
5
5
  //#region src/chat/sandbox/resources.ts
@@ -1,16 +1,25 @@
1
- import { p as authorizationId } from "./agent-CY49A4pN.js";
2
- import { S as withLogContext, u as logException, y as setTags } from "./logging-gR24QCo_.js";
1
+ import { p as authorizationId } from "./agent-Bzbf92vv.js";
2
+ import { S as withLogContext, u as logException, y as setTags } from "./logging-DiN3o3nB.js";
3
3
  import { t as credentialContextForActor } from "./context-Bplcgypl.js";
4
- import { Ht as getConversationEventStore, Wt as getConversationStore } from "./agent-hooks-BnZBgDPe.js";
5
- import { F as loadProjection, V as recordAuthorizationCompleted, X as persistConversationMessages, Y as hydrateConversationMessages, ct as recordDeliveredAssistantMessage, d as persistWithRetry, j as commitAcceptedReply, ot as markConversationMessage, r as saveTurnCheckpoint, st as normalizeConversationText, tt as buildConversationContext, ut as upsertConversationMessage } from "./checkpoint-Bl47qAIY.js";
6
- import { S as startActiveTurn, s as getAssistantReplyText, x as markTurnFailed } from "./pending-auth-Cl4BsopG.js";
7
- import { n as scheduleSessionCompletedPluginTasks, t as processPluginTask } from "./task-runner-dQwOhCYs.js";
8
- import { t as ConversationTurnLifecycleService } from "./turn-lifecycle-D75pWL8e.js";
9
- import { n as getPersistedSandboxState, o as persistThreadStateById, r as getPersistedThreadState, s as coerceThreadConversationState } from "./thread-state-D0Ktlch_.js";
10
- import { d as buildDeliveredTurnStatePatch, r as finalizeFailedTurnReplyWithEvent, t as completeAuthPauseTurn } from "./auth-pause-state-CJwPs1cT.js";
4
+ import { Kt as getConversationStore, Wt as getConversationEventStore } from "./agent-hooks-DZU5nsd1.js";
5
+ import { M as messageCardText } from "./conversation-1HUoZr2l.js";
6
+ import { F as loadProjection, V as recordAuthorizationCompleted, X as persistConversationMessages, Y as hydrateConversationMessages, ct as recordDeliveredAssistantMessage, d as persistWithRetry, j as commitAcceptedReply, ot as markConversationMessage, r as saveTurnCheckpoint, st as normalizeConversationText, tt as buildConversationContext, ut as upsertConversationMessage } from "./checkpoint-Deu-OVb3.js";
7
+ import { S as startActiveTurn, s as getAssistantReplyText, x as markTurnFailed } from "./pending-auth-D7vmttn_.js";
8
+ import { n as scheduleSessionCompletedPluginTasks, t as processPluginTask } from "./task-runner-DI1FBJFJ.js";
9
+ import { t as ConversationTurnLifecycleService } from "./turn-lifecycle-Bjf6y2GO.js";
10
+ import { n as getPersistedSandboxState, o as persistThreadStateById, r as getPersistedThreadState, s as coerceThreadConversationState } from "./thread-state-DXgxOYpZ.js";
11
+ import { f as buildDeliveredTurnStatePatch, r as finalizeFailedTurnReplyWithEvent, s as loadPendingMessageCards, t as completeAuthPauseTurn } from "./auth-pause-state-Bn2vX4PA.js";
11
12
  import { randomUUID } from "node:crypto";
12
13
  import { createLocalSource, localDestinationSchema } from "@sentry/junior-plugin-api";
13
14
  //#region src/chat/local/runner.ts
15
+ /**
16
+ * Local agent turn runtime.
17
+ *
18
+ * This module owns the Slack-free execution boundary for CLI-originated turns:
19
+ * it persists local conversation state, invokes the shared agent runner with
20
+ * a local destination, and only commits assistant delivery after the CLI sink
21
+ * accepts each completed tool-free assistant message.
22
+ */
14
23
  const SENTRY_EVENT_ID_PATTERN = /^[a-f0-9]{32}$/i;
15
24
  const LOCAL_FAILURE_EVENT_NAMES = {
16
25
  agent_run_failed: "local.agent_run.failed",
@@ -132,9 +141,11 @@ async function runLocalAgentTurnInContext(input, deps) {
132
141
  const text = typeof reply === "string" ? reply : getAssistantReplyText(reply);
133
142
  if (!text?.trim()) return;
134
143
  failureCode = "delivery_failed";
135
- await deps.deliverReply({ text });
144
+ const cards = await loadPendingMessageCards(input.conversationId);
145
+ await deps.deliverReply({ text: [text, ...cards.map(messageCardText)].join("\n\n") });
136
146
  assistantMessageDelivered = true;
137
147
  const recordedMessageId = recordDeliveredAssistantMessage({
148
+ cards,
138
149
  conversation,
139
150
  sessionId: turnId,
140
151
  text,
@@ -1,4 +1,4 @@
1
- import { Y as sandboxEgressSignalsResponseSchema } from "./agent-CY49A4pN.js";
1
+ import { Y as sandboxEgressSignalsResponseSchema } from "./agent-Bzbf92vv.js";
2
2
  //#region src/chat/local/sandbox-egress-signals.ts
3
3
  const SANDBOX_EGRESS_SIGNALS_PATH = "/api/internal/sandbox-egress/signals";
4
4
  const LOCAL_DEV_SERVER_TIMEOUT_MS = 1e3;
@@ -1,136 +1,12 @@
1
1
  import { t as juniorDestinationKindSchema } from "./destinations-BeBiJeEM.js";
2
- import { E as conversationSummaryReportSchema, n as actorIdentitySchema, w as conversationStatsItemSchema } from "./conversation-BSRGzJmY.js";
3
- import "./reporting-schema-DosTN__Q.js";
2
+ import { E as conversationSummaryReportSchema, n as actorIdentitySchema, w as conversationStatsItemSchema } from "./conversation-1HUoZr2l.js";
3
+ import { i as fillUtcHours, r as fillUtcDays, s as sumUtcHoursIntoSixHours } from "./reporting-window-DbUqng0P.js";
4
4
  import { z } from "zod";
5
5
  import { codeChangeStateSchema, taskOutcomeSchema } from "@sentry/junior-plugin-api";
6
6
  //#region src/api/schema/common.ts
7
7
  /** Stable error body returned by Junior-owned REST endpoints. */
8
8
  const apiErrorSchema = z.object({ error: z.string().min(1) }).strict();
9
9
  //#endregion
10
- //#region src/api/reporting-window.ts
11
- /** Shared UTC day/hour/six-hour windows for dashboard activity series. */
12
- const HOUR_MS = 36e5;
13
- const SIX_HOUR_MS = 6 * HOUR_MS;
14
- const DAY_MS = 24 * HOUR_MS;
15
- /** Start of the UTC calendar day containing `valueMs`. */
16
- function startOfUtcDay(valueMs) {
17
- const date = new Date(valueMs);
18
- date.setUTCHours(0, 0, 0, 0);
19
- return date;
20
- }
21
- /** Start of the UTC hour containing `valueMs`. */
22
- function startOfUtcHour(valueMs) {
23
- const date = new Date(valueMs);
24
- date.setUTCMinutes(0, 0, 0);
25
- return date;
26
- }
27
- /** Start of the UTC 6-hour bucket containing `valueMs` (00/06/12/18). */
28
- function startOfUtcSixHour(valueMs) {
29
- const date = startOfUtcHour(valueMs);
30
- date.setUTCHours(Math.floor(date.getUTCHours() / 6) * 6, 0, 0, 0);
31
- return date;
32
- }
33
- /** UTC day key `YYYY-MM-DD`. */
34
- function utcDayKey(value) {
35
- return (typeof value === "number" ? new Date(value) : value).toISOString().slice(0, 10);
36
- }
37
- /** UTC hour key `YYYY-MM-DDTHH`. */
38
- function utcHourKey(value) {
39
- return (typeof value === "number" ? new Date(value) : value).toISOString().slice(0, 13);
40
- }
41
- /** UTC 6-hour bucket key `YYYY-MM-DDTHH` at 00/06/12/18. */
42
- function utcSixHourKey(value) {
43
- return utcHourKey(startOfUtcSixHour(typeof value === "number" ? value : value.getTime()));
44
- }
45
- /** Inclusive trailing UTC day window ending on today's UTC day. */
46
- function trailingUtcDayWindow(nowMs, dayCount) {
47
- const end = startOfUtcDay(nowMs);
48
- const start = new Date(end);
49
- start.setUTCDate(start.getUTCDate() - (dayCount - 1));
50
- return {
51
- end,
52
- start
53
- };
54
- }
55
- /** Inclusive trailing UTC hour window ending on the current UTC hour. */
56
- function trailingUtcHourWindow(nowMs, hourCount = 24) {
57
- const end = startOfUtcHour(nowMs);
58
- return {
59
- end,
60
- start: /* @__PURE__ */ new Date(end.getTime() - (hourCount - 1) * HOUR_MS)
61
- };
62
- }
63
- /** Inclusive trailing UTC 6-hour window ending on the current 6h bucket. */
64
- function trailingUtcSixHourWindow(nowMs, bucketCount = 28) {
65
- const end = startOfUtcSixHour(nowMs);
66
- return {
67
- end,
68
- start: /* @__PURE__ */ new Date(end.getTime() - (bucketCount - 1) * SIX_HOUR_MS)
69
- };
70
- }
71
- /** Fill a fixed UTC day window from a sparse map. */
72
- function fillUtcDays(args) {
73
- const { end, start } = trailingUtcDayWindow(args.nowMs, args.count);
74
- const items = [];
75
- for (const cursor = new Date(start); cursor.getTime() <= end.getTime(); cursor.setUTCDate(cursor.getUTCDate() + 1)) {
76
- const date = utcDayKey(cursor);
77
- items.push(args.rows.get(date) ?? args.empty(date));
78
- }
79
- return items;
80
- }
81
- /** Fill a fixed UTC hour window from a sparse map. */
82
- function fillUtcHours(args) {
83
- const hourCount = args.count ?? 24;
84
- const { end, start } = trailingUtcHourWindow(args.nowMs, hourCount);
85
- const items = [];
86
- for (const cursor = new Date(start); cursor.getTime() <= end.getTime(); cursor.setTime(cursor.getTime() + HOUR_MS)) {
87
- const date = utcHourKey(cursor);
88
- items.push(args.rows.get(date) ?? args.empty(date));
89
- }
90
- return items;
91
- }
92
- /** Fill a fixed UTC 6-hour window from a map of known rows. */
93
- function fillUtcSixHours(args) {
94
- const bucketCount = args.count ?? 28;
95
- const { end, start } = trailingUtcSixHourWindow(args.nowMs, bucketCount);
96
- const items = [];
97
- for (const cursor = new Date(start); cursor.getTime() <= end.getTime(); cursor.setTime(cursor.getTime() + SIX_HOUR_MS)) {
98
- const date = utcSixHourKey(cursor);
99
- items.push(args.rows.get(date) ?? args.empty(date));
100
- }
101
- return items;
102
- }
103
- /**
104
- * Sum hour rows into trailing 6-hour buckets.
105
- * Adds number fields. Keeps other fields from the first row in the bucket.
106
- * Sets `date` to the 6-hour bucket key.
107
- */
108
- function sumUtcHoursIntoSixHours(args) {
109
- const bucketCount = args.count ?? 28;
110
- const bySix = /* @__PURE__ */ new Map();
111
- for (const hour of args.hours) {
112
- const key = utcSixHourKey(Date.parse(`${hour.date}:00:00.000Z`));
113
- const next = {
114
- ...bySix.get(key) ?? args.empty(key),
115
- date: key
116
- };
117
- for (const [field, value] of Object.entries(hour)) {
118
- if (field === "date") continue;
119
- if (typeof value === "number") {
120
- const prior = next[field];
121
- next[field] = (typeof prior === "number" ? prior : 0) + value;
122
- }
123
- }
124
- bySix.set(key, next);
125
- }
126
- return fillUtcSixHours({
127
- count: bucketCount,
128
- empty: args.empty,
129
- nowMs: args.nowMs,
130
- rows: bySix
131
- });
132
- }
133
- //#endregion
134
10
  //#region src/api/schema/code.ts
135
11
  const codeChangeSummarySchema = z.object({
136
12
  closed: z.number().int().nonnegative(),
@@ -241,9 +117,10 @@ function activityHours(hours, nowMs) {
241
117
  * Hour keys must be summed into 6-hour keys first.
242
118
  */
243
119
  function activitySixHours(hours, nowMs) {
120
+ const series = hours instanceof Map ? activityHours(hours, nowMs) : [...hours];
244
121
  return sumUtcHoursIntoSixHours({
245
122
  empty: emptyActivityDay,
246
- hours: hours instanceof Map ? activityHours(hours, nowMs) : [...hours],
123
+ hours: series,
247
124
  nowMs
248
125
  });
249
126
  }
@@ -556,4 +433,4 @@ const statsReportSchema = z.object({
556
433
  windowStart: z.string()
557
434
  }).strict();
558
435
  //#endregion
559
- export { sumUtcHoursIntoSixHours as $, actorProfileReportSchema as A, dailyConversationActivitySchema as B, createPersonalTokenBodySchema as C, personalTokenParamsSchema as D, personalTokenMetadataSchema as E, locationDirectoryReportSchema as F, codePersonReportSchema as G, codeChangeSummaryReportSchema as H, locationParamsSchema as I, HOUR_MS as J, codeRepositorySummarySchema as K, activityDays as L, personalSpendReportSchema as M, locationActivityDayReportSchema as N, revokePersonalTokenResponseSchema as O, locationDetailReportSchema as P, startOfUtcHour as Q, activityHours as R, scheduledAutomationSummarySchema as S, personalTokenListSchema as T, codeChangeSummarySchema as U, codeActivityDaySchema as V, codeOverviewReportSchema as W, fillUtcHours as X, fillUtcDays as Y, fillUtcSixHours as Z, automationRunListSchema as _, workspaceBodySchema as a, apiErrorSchema as at, automationSummarySchema as b, workspaceRepoSchema as c, automationExecutionSchema as d, trailingUtcDayWindow as et, automationExecutionStatusDaySchema as f, automationParamsSchema as g, automationListSchema as h, deleteWorkspaceResponseSchema as i, utcHourKey as it, personParamsSchema as j, actorDirectoryReportSchema as k, workspaceSchema as l, automationListQuerySchema as m, statsReportSchema as n, trailingUtcSixHourWindow as nt, workspaceListSchema as o, automationExecutionStatusSchema as p, DAY_MS as q, baselineSnapshotSchema as r, utcDayKey as rt, workspaceParamsSchema as s, statSchema as t, trailingUtcHourWindow as tt, automationExecutionListSchema as u, automationRunSchema as v, createdPersonalTokenSchema as w, eventAutomationSummarySchema as x, automationRunWindowsSchema as y, activitySixHours as z };
436
+ export { actorProfileReportSchema as A, dailyConversationActivitySchema as B, createPersonalTokenBodySchema as C, personalTokenParamsSchema as D, personalTokenMetadataSchema as E, locationDirectoryReportSchema as F, codePersonReportSchema as G, codeChangeSummaryReportSchema as H, locationParamsSchema as I, codeRepositorySummarySchema as K, activityDays as L, personalSpendReportSchema as M, locationActivityDayReportSchema as N, revokePersonalTokenResponseSchema as O, locationDetailReportSchema as P, activityHours as R, scheduledAutomationSummarySchema as S, personalTokenListSchema as T, codeChangeSummarySchema as U, codeActivityDaySchema as V, codeOverviewReportSchema as W, automationRunListSchema as _, workspaceBodySchema as a, automationSummarySchema as b, workspaceRepoSchema as c, automationExecutionSchema as d, automationExecutionStatusDaySchema as f, automationParamsSchema as g, automationListSchema as h, deleteWorkspaceResponseSchema as i, personParamsSchema as j, actorDirectoryReportSchema as k, workspaceSchema as l, automationListQuerySchema as m, statsReportSchema as n, workspaceListSchema as o, automationExecutionStatusSchema as p, apiErrorSchema as q, baselineSnapshotSchema as r, workspaceParamsSchema as s, statSchema as t, automationExecutionListSchema as u, automationRunSchema as v, createdPersonalTokenSchema as w, eventAutomationSummarySchema as x, automationRunWindowsSchema as y, activitySixHours as z };
@@ -1,5 +1,5 @@
1
- import { f as logWarn } from "./logging-gR24QCo_.js";
2
- import { n as botConfig } from "./config-CEuC6CFj.js";
1
+ import { f as logWarn } from "./logging-DiN3o3nB.js";
2
+ import { n as botConfig } from "./config-CtoUVs72.js";
3
3
  const TITLE_PROMPTS = {
4
4
  conversation: [
5
5
  "Generate a concise 5-8 word conversation title from the first user message below.",
@@ -1,7 +1,7 @@
1
1
  import { t as __exportAll } from "./rolldown-runtime-B4FMCO8f.js";
2
- import { f as logWarn } from "./logging-gR24QCo_.js";
2
+ import { f as logWarn } from "./logging-DiN3o3nB.js";
3
3
  import { s as skillRoots } from "./package-discovery-7a9YqLhE.js";
4
- import { n as pluginCatalogRuntime } from "./catalog-runtime-0oMD2jas.js";
4
+ import { n as pluginCatalogRuntime } from "./catalog-runtime-BthunUDD.js";
5
5
  import path from "node:path";
6
6
  import { z } from "zod";
7
7
  import fs from "node:fs/promises";
@@ -1,6 +1,6 @@
1
1
  import { t as __exportAll } from "./rolldown-runtime-B4FMCO8f.js";
2
- import { C as toolInvocationDestination, y as actorFromRun } from "./agent-runner-BC8iSAfE.js";
3
- import { n as createAndEnqueueAgentInvocation } from "./work-CaaSjlNk.js";
2
+ import { C as toolInvocationDestination, y as actorFromRun } from "./agent-runner-2VQ9WhkG.js";
3
+ import { n as createAndEnqueueAgentInvocation } from "./work-DvIlJR3C.js";
4
4
  //#region src/chat/agent-invocations/spawn.ts
5
5
  var spawn_exports = /* @__PURE__ */ __exportAll({ bindSpawnAgent: () => bindSpawnAgent });
6
6
  /** Bind a Run's Actor and credentials to new Agent invocations. */