@sentry/junior 0.206.0 → 0.208.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 (64) hide show
  1. package/dist/{agent-C9yuiZUF.js → agent-BfxfHsf1.js} +375 -346
  2. package/dist/{agent-hooks-DNjlz2A-.js → agent-hooks-CuGjLjmR.js} +224 -97
  3. package/dist/{agent-runner-E67lFrDG.js → agent-runner-Dz1PMKP0.js} +9 -9
  4. package/dist/api/schema.d.ts +39 -39
  5. package/dist/api/schema.js +2 -2
  6. package/dist/api.d.ts +1 -1
  7. package/dist/api.js +154 -154
  8. package/dist/{app-AxGmJHwK.d.ts → app-DfNrn_gS.d.ts} +2 -2
  9. package/dist/app.d.ts +1 -1
  10. package/dist/app.js +185 -183
  11. package/dist/{auth-pause-state-MVZ6xvEK.js → auth-pause-state-Bjoh8wCy.js} +7 -7
  12. package/dist/{briefs-CvJFQvhJ.js → briefs-q_onrGmf.js} +3 -3
  13. package/dist/{catalog-runtime-TBR8n4e1.js → catalog-runtime-D8YUMNhb.js} +1 -1
  14. package/dist/{checkpoint-BY47jJCB.js → checkpoint-FKMcINix.js} +8 -8
  15. package/dist/cli/chat.js +13 -13
  16. package/dist/cli/check.js +3 -3
  17. package/dist/cli/main.js +1 -1
  18. package/dist/cli/plugins.js +3 -3
  19. package/dist/cli/snapshot-create.js +3 -3
  20. package/dist/cli/upgrade.d.ts +1 -1
  21. package/dist/cli/upgrade.js +3 -3
  22. package/dist/{client-ceE7NtvC.js → client-bRyPqwAV.js} +4 -4
  23. package/dist/{config-CIE83sR2.js → config-EtF2uEaW.js} +6 -6
  24. package/dist/{context-B45_WqVX.js → context-Bplcgypl.js} +13 -13
  25. package/dist/{conversation-privacy-Auyq26XQ.js → conversation-privacy-whGaV2TG.js} +1 -1
  26. package/dist/{credential-sync-BO33aNQd.js → credential-sync-DM-EE1ey.js} +21 -21
  27. package/dist/{db-BeyXKJOI.d.ts → db-D74z7BZH.d.ts} +1 -1
  28. package/dist/{execution-stats-SiS2FLcv.js → execution-stats-C-f8zwMU.js} +77 -77
  29. package/dist/{executor-BfbYPW63.js → executor-BW5qp0jC.js} +43 -14
  30. package/dist/instrumentation.js +2 -2
  31. package/dist/{job-queue-CyTc24Es.js → job-queue-BIHNIEIX.js} +1 -1
  32. package/dist/{logging-D37bayDc.js → logging-sNS84Yuu.js} +1 -1
  33. package/dist/nitro.d.ts +1 -1
  34. package/dist/nitro.js +3 -3
  35. package/dist/{oauth-callback-server-BtfOeHTZ.js → oauth-callback-server-Co6D_yXP.js} +2 -2
  36. package/dist/{pending-auth-BPUzcs7n.js → pending-auth-CRJCt9Ux.js} +2 -2
  37. package/dist/{profile-CSixooTi.js → profile-BfLMVhWo.js} +4 -4
  38. package/dist/{prompt-3gqNY1Ka.js → prompt-x-0ZtTyb.js} +14 -14
  39. package/dist/{registry-DiR0-xRg.js → registry-Cyww_jnC.js} +2 -2
  40. package/dist/{resolve-Bn5q__9b.js → resolve-BApIFQXX.js} +2 -2
  41. package/dist/{runner-DFx3dIJH.js → runner-C9okx4GL.js} +10 -10
  42. package/dist/{sandbox-egress-signals-bwvjihxA.js → sandbox-egress-signals-BHfx0esj.js} +1 -1
  43. package/dist/{schema-8GXFfclK.js → schema-CwTeb-BF.js} +39 -39
  44. package/dist/{skills-BhM5qyCF.js → skills-DhL_wXEp.js} +2 -2
  45. package/dist/{spawn-Dk0PqdH6.js → spawn-msnzfE8_.js} +2 -2
  46. package/dist/{stats-DKRP4rsY.js → stats-Cq5w_Awk.js} +292 -268
  47. package/dist/{store-C5qxF2ac.d.ts → store-Det8MQ9g.d.ts} +1 -1
  48. package/dist/{task-queue-CdpTvu4R.js → task-queue-JfmWmpjS.js} +3 -3
  49. package/dist/{task-runner-alpjVSxQ.js → task-runner-Cm0gXoLH.js} +15 -15
  50. package/dist/{thread-state-CRK7aA41.js → thread-state-lw2QwQ-y.js} +5 -5
  51. package/dist/{turn-execution-XtyzIHog.js → turn-execution-C7K6lQp1.js} +3 -3
  52. package/dist/{turn-lifecycle-VbwZLfBv.js → turn-lifecycle-DVlJLwB0.js} +1 -1
  53. package/dist/{usage-D4A48Bdl.js → usage-BMuAlKIW.js} +2 -2
  54. package/dist/{validation-jn_46o4U.js → validation-BI-r3iQA.js} +1 -1
  55. package/dist/{version-DcfJxB4z.js → version-s6smK6lP.js} +1 -1
  56. package/dist/version.js +1 -1
  57. package/dist/{web-authorization-CsfLSfEs.js → web-authorization-C9MxPvXX.js} +1 -1
  58. package/dist/{web-input-BPp_sc7t.js → web-input-CwVlaLd0.js} +7 -109
  59. package/dist/{work-Di-ubSGg.js → work-BK0W1QAt.js} +9 -9
  60. package/dist/{worker-Cu_D5Mr8.js → worker-D-WWKHQD.js} +5 -5
  61. package/migrations/0041_automation_outcomes_backfill.sql +27 -0
  62. package/migrations/meta/0041_snapshot.json +3516 -0
  63. package/migrations/meta/_journal.json +7 -0
  64. package/package.json +5 -5
@@ -1,7 +1,7 @@
1
- import { f as logWarn } from "./logging-D37bayDc.js";
2
- import { It as getDb } from "./agent-hooks-DNjlz2A-.js";
3
- import { s as juniorTaskExecutions, w as juniorConversations } from "./executor-BfbYPW63.js";
4
- import { n as agentTurnCostUsd, r as agentTurnTotalTokens } from "./usage-D4A48Bdl.js";
1
+ import { f as logWarn } from "./logging-sNS84Yuu.js";
2
+ import { Gt as getDb } from "./agent-hooks-CuGjLjmR.js";
3
+ import { s as juniorAutomationExecutions, w as juniorConversations } from "./executor-BW5qp0jC.js";
4
+ import { n as agentTurnCostUsd, r as agentTurnTotalTokens } from "./usage-BMuAlKIW.js";
5
5
  import { and, asc, count, desc, eq, gte, inArray, lte, max, or, sql } from "drizzle-orm";
6
6
  //#region src/api/conversations/aggregate.ts
7
7
  function usageTokenValue(source, field) {
@@ -85,9 +85,9 @@ function conversationActiveDaysColumn() {
85
85
  return sql`COUNT(DISTINCT (${juniorConversations.lastActivityAt} AT TIME ZONE 'UTC')::date)::integer`;
86
86
  }
87
87
  //#endregion
88
- //#region src/chat/tasks/execution-stats.ts
89
- const TASK_EXECUTION_TYPES = ["scheduled", "event"];
90
- const TASK_EXECUTION_STATUSES = [
88
+ //#region src/chat/automations/execution-stats.ts
89
+ const AUTOMATION_EXECUTION_TYPES = ["scheduled", "event"];
90
+ const AUTOMATION_EXECUTION_STATUSES = [
91
91
  "blocked",
92
92
  "completed",
93
93
  "failed"
@@ -101,8 +101,8 @@ const EMPTY_RUN_WINDOWS = {
101
101
  30: 0,
102
102
  90: 0
103
103
  };
104
- /** Empty run windows for tasks with no execution history. */
105
- function emptyTaskRunWindows() {
104
+ /** Empty run windows for automations with no execution history. */
105
+ function emptyAutomationRunWindows() {
106
106
  return { ...EMPTY_RUN_WINDOWS };
107
107
  }
108
108
  function utcDate(nowMs) {
@@ -124,24 +124,24 @@ function emptyStatusDay(date) {
124
124
  failed: 0
125
125
  };
126
126
  }
127
- /** Record one terminal task execution and its durable conversation when present. */
128
- async function recordTaskExecution(type, taskId, options) {
127
+ /** Record one terminal automation execution and its durable conversation when present. */
128
+ async function recordAutomationExecution(type, automationId, options) {
129
129
  const namespace = options.namespace ?? "junior";
130
130
  const nowMs = options.nowMs ?? Date.now();
131
131
  const status = options.status ?? "completed";
132
132
  try {
133
- await getDb().insert(juniorTaskExecutions).values({
133
+ await getDb().insert(juniorAutomationExecutions).values({
134
134
  ...options.conversationId ? { conversationId: options.conversationId } : void 0,
135
135
  executedAtMs: nowMs,
136
136
  executionId: options.executionId,
137
137
  kind: type,
138
138
  namespace,
139
139
  status,
140
- taskId
140
+ automationId
141
141
  }).onConflictDoNothing({ target: [
142
- juniorTaskExecutions.kind,
143
- juniorTaskExecutions.namespace,
144
- juniorTaskExecutions.executionId
142
+ juniorAutomationExecutions.kind,
143
+ juniorAutomationExecutions.namespace,
144
+ juniorAutomationExecutions.executionId
145
145
  ] });
146
146
  } catch (error) {
147
147
  logWarn("task.execution.stat_failed", {
@@ -149,34 +149,34 @@ async function recordTaskExecution(type, taskId, options) {
149
149
  "app.task.execution.id": options.executionId,
150
150
  "app.task.execution.namespace": namespace,
151
151
  "app.task.execution.status": status,
152
- "app.task.execution.task_id": taskId,
152
+ "app.task.execution.task_id": automationId,
153
153
  "app.task.execution.type": type
154
154
  });
155
155
  }
156
156
  }
157
- /** Load usage analytics for all tasks of one type and namespace. */
158
- async function readTaskExecutionSummaries(type, namespace, options = {}) {
157
+ /** Load usage analytics for all automations of one type and namespace. */
158
+ async function readAutomationExecutionSummaries(type, namespace, options = {}) {
159
159
  const nowMs = options.nowMs ?? Date.now();
160
160
  const oneDayAgoMs = nowMs - 864e5;
161
161
  const sevenDaysAgoMs = nowMs - 6048e5;
162
162
  const thirtyDaysAgoMs = nowMs - 2592e6;
163
163
  const ninetyDaysAgoMs = nowMs - 7776e6;
164
164
  const db = getDb();
165
- const latest = db.selectDistinctOn([juniorTaskExecutions.taskId], {
166
- conversationId: juniorTaskExecutions.conversationId,
167
- taskId: juniorTaskExecutions.taskId
168
- }).from(juniorTaskExecutions).where(and(eq(juniorTaskExecutions.kind, type), eq(juniorTaskExecutions.namespace, namespace))).orderBy(juniorTaskExecutions.taskId, desc(juniorTaskExecutions.executedAtMs), desc(juniorTaskExecutions.executionId)).as("latest_task_execution");
165
+ const latest = db.selectDistinctOn([juniorAutomationExecutions.automationId], {
166
+ conversationId: juniorAutomationExecutions.conversationId,
167
+ automationId: juniorAutomationExecutions.automationId
168
+ }).from(juniorAutomationExecutions).where(and(eq(juniorAutomationExecutions.kind, type), eq(juniorAutomationExecutions.namespace, namespace))).orderBy(juniorAutomationExecutions.automationId, desc(juniorAutomationExecutions.executedAtMs), desc(juniorAutomationExecutions.executionId)).as("latest_task_execution");
169
169
  const rows = await db.select({
170
170
  lastConversationId: latest.conversationId,
171
- lastExecutedAtMs: max(juniorTaskExecutions.executedAtMs),
172
- runsLast1Day: sql`count(*) filter (where ${juniorTaskExecutions.executedAtMs} >= ${oneDayAgoMs})::int`,
173
- runsLast7Days: sql`count(*) filter (where ${juniorTaskExecutions.executedAtMs} >= ${sevenDaysAgoMs})::int`,
174
- runsLast30Days: sql`count(*) filter (where ${juniorTaskExecutions.executedAtMs} >= ${thirtyDaysAgoMs})::int`,
175
- runsLast90Days: sql`count(*) filter (where ${juniorTaskExecutions.executedAtMs} >= ${ninetyDaysAgoMs})::int`,
176
- taskId: juniorTaskExecutions.taskId,
171
+ lastExecutedAtMs: max(juniorAutomationExecutions.executedAtMs),
172
+ runsLast1Day: sql`count(*) filter (where ${juniorAutomationExecutions.executedAtMs} >= ${oneDayAgoMs})::int`,
173
+ runsLast7Days: sql`count(*) filter (where ${juniorAutomationExecutions.executedAtMs} >= ${sevenDaysAgoMs})::int`,
174
+ runsLast30Days: sql`count(*) filter (where ${juniorAutomationExecutions.executedAtMs} >= ${thirtyDaysAgoMs})::int`,
175
+ runsLast90Days: sql`count(*) filter (where ${juniorAutomationExecutions.executedAtMs} >= ${ninetyDaysAgoMs})::int`,
176
+ automationId: juniorAutomationExecutions.automationId,
177
177
  totalRuns: sql`count(*)::int`
178
- }).from(juniorTaskExecutions).innerJoin(latest, eq(latest.taskId, juniorTaskExecutions.taskId)).where(and(eq(juniorTaskExecutions.kind, type), eq(juniorTaskExecutions.namespace, namespace))).groupBy(juniorTaskExecutions.taskId, latest.conversationId);
179
- return new Map(rows.map((row) => [row.taskId, {
178
+ }).from(juniorAutomationExecutions).innerJoin(latest, eq(latest.automationId, juniorAutomationExecutions.automationId)).where(and(eq(juniorAutomationExecutions.kind, type), eq(juniorAutomationExecutions.namespace, namespace))).groupBy(juniorAutomationExecutions.automationId, latest.conversationId);
179
+ return new Map(rows.map((row) => [row.automationId, {
180
180
  ...row.lastConversationId ? { lastConversationId: row.lastConversationId } : void 0,
181
181
  ...row.lastExecutedAtMs !== null ? { lastExecutedAtMs: row.lastExecutedAtMs } : void 0,
182
182
  runs: {
@@ -189,18 +189,18 @@ async function readTaskExecutionSummaries(type, namespace, options = {}) {
189
189
  }]));
190
190
  }
191
191
  /** Load a fixed trailing window of completed executions stacked by task type. */
192
- async function readTaskExecutionDays(dayCount = 90, options = {}) {
192
+ async function readAutomationExecutionDays(dayCount = 90, options = {}) {
193
193
  const end = utcDate(options.nowMs ?? Date.now());
194
194
  const endMs = Date.parse(`${end}T23:59:59.999Z`);
195
195
  const startMs = Date.parse(`${end}T00:00:00.000Z`) - (dayCount - 1) * 864e5;
196
- const executionDate = sql`to_char(to_timestamp(${juniorTaskExecutions.executedAtMs} / 1000.0) at time zone 'UTC', 'YYYY-MM-DD')`;
196
+ const executionDate = sql`to_char(to_timestamp(${juniorAutomationExecutions.executedAtMs} / 1000.0) at time zone 'UTC', 'YYYY-MM-DD')`;
197
197
  const conversationCost = conversationUsageCostExpr(juniorConversations.usage);
198
198
  const rows = await getDb().select({
199
199
  count: count(),
200
200
  costUsd: sql`SUM(${conversationCost})::double precision`,
201
201
  date: executionDate,
202
- kind: juniorTaskExecutions.kind
203
- }).from(juniorTaskExecutions).leftJoin(juniorConversations, eq(juniorConversations.conversationId, juniorTaskExecutions.conversationId)).where(and(gte(juniorTaskExecutions.executedAtMs, startMs), lte(juniorTaskExecutions.executedAtMs, endMs), eq(juniorTaskExecutions.status, "completed"))).groupBy(executionDate, juniorTaskExecutions.kind).orderBy(asc(executionDate), asc(juniorTaskExecutions.kind));
202
+ kind: juniorAutomationExecutions.kind
203
+ }).from(juniorAutomationExecutions).leftJoin(juniorConversations, eq(juniorConversations.conversationId, juniorAutomationExecutions.conversationId)).where(and(gte(juniorAutomationExecutions.executedAtMs, startMs), lte(juniorAutomationExecutions.executedAtMs, endMs), eq(juniorAutomationExecutions.status, "completed"))).groupBy(executionDate, juniorAutomationExecutions.kind).orderBy(asc(executionDate), asc(juniorAutomationExecutions.kind));
204
204
  const byDate = /* @__PURE__ */ new Map();
205
205
  for (let offset = 0; offset < dayCount; offset += 1) {
206
206
  const date = utcDate(startMs + offset * 864e5);
@@ -216,20 +216,20 @@ async function readTaskExecutionDays(dayCount = 90, options = {}) {
216
216
  return [...byDate.values()];
217
217
  }
218
218
  /** Load a fixed trailing window of completed executions stacked by hour. */
219
- async function readTaskExecutionHours(hourCount = 168, options = {}) {
219
+ async function readAutomationExecutionHours(hourCount = 168, options = {}) {
220
220
  const nowMs = options.nowMs ?? Date.now();
221
221
  const end = new Date(nowMs);
222
222
  end.setUTCMinutes(0, 0, 0);
223
223
  const endMs = end.getTime() + 3599999;
224
224
  const startMs = end.getTime() - (hourCount - 1) * 36e5;
225
- const executionHour = sql`to_char(to_timestamp(${juniorTaskExecutions.executedAtMs} / 1000.0) at time zone 'UTC', 'YYYY-MM-DD"T"HH24')`;
225
+ const executionHour = sql`to_char(to_timestamp(${juniorAutomationExecutions.executedAtMs} / 1000.0) at time zone 'UTC', 'YYYY-MM-DD"T"HH24')`;
226
226
  const conversationCost = conversationUsageCostExpr(juniorConversations.usage);
227
227
  const rows = await getDb().select({
228
228
  count: count(),
229
229
  costUsd: sql`SUM(${conversationCost})::double precision`,
230
230
  date: executionHour,
231
- kind: juniorTaskExecutions.kind
232
- }).from(juniorTaskExecutions).leftJoin(juniorConversations, eq(juniorConversations.conversationId, juniorTaskExecutions.conversationId)).where(and(gte(juniorTaskExecutions.executedAtMs, startMs), lte(juniorTaskExecutions.executedAtMs, endMs), eq(juniorTaskExecutions.status, "completed"))).groupBy(executionHour, juniorTaskExecutions.kind).orderBy(asc(executionHour), asc(juniorTaskExecutions.kind));
231
+ kind: juniorAutomationExecutions.kind
232
+ }).from(juniorAutomationExecutions).leftJoin(juniorConversations, eq(juniorConversations.conversationId, juniorAutomationExecutions.conversationId)).where(and(gte(juniorAutomationExecutions.executedAtMs, startMs), lte(juniorAutomationExecutions.executedAtMs, endMs), eq(juniorAutomationExecutions.status, "completed"))).groupBy(executionHour, juniorAutomationExecutions.kind).orderBy(asc(executionHour), asc(juniorAutomationExecutions.kind));
233
233
  const byHour = /* @__PURE__ */ new Map();
234
234
  for (let offset = 0; offset < hourCount; offset += 1) {
235
235
  const date = new Date(startMs + offset * 36e5).toISOString().slice(0, 13);
@@ -244,60 +244,60 @@ async function readTaskExecutionHours(hourCount = 168, options = {}) {
244
244
  }
245
245
  return [...byHour.values()];
246
246
  }
247
- /** Load the newest terminal task execution linked to one conversation, if any. */
248
- async function readTaskExecutionByConversationId(args) {
247
+ /** Load the newest terminal automation execution linked to one conversation, if any. */
248
+ async function readAutomationExecutionByConversationId(args) {
249
249
  const namespace = args.namespace ?? "junior";
250
250
  const row = (await getDb().select({
251
- kind: juniorTaskExecutions.kind,
252
- taskId: juniorTaskExecutions.taskId
253
- }).from(juniorTaskExecutions).where(and(eq(juniorTaskExecutions.conversationId, args.conversationId), eq(juniorTaskExecutions.namespace, namespace), inArray(juniorTaskExecutions.kind, [...TASK_EXECUTION_TYPES]))).orderBy(desc(juniorTaskExecutions.executedAtMs), desc(juniorTaskExecutions.executionId)).limit(1))[0];
251
+ kind: juniorAutomationExecutions.kind,
252
+ automationId: juniorAutomationExecutions.automationId
253
+ }).from(juniorAutomationExecutions).where(and(eq(juniorAutomationExecutions.conversationId, args.conversationId), eq(juniorAutomationExecutions.namespace, namespace), inArray(juniorAutomationExecutions.kind, [...AUTOMATION_EXECUTION_TYPES]))).orderBy(desc(juniorAutomationExecutions.executedAtMs), desc(juniorAutomationExecutions.executionId)).limit(1))[0];
254
254
  if (!row) return void 0;
255
255
  if (row.kind !== "scheduled" && row.kind !== "event") return void 0;
256
256
  return {
257
257
  kind: row.kind,
258
- taskId: row.taskId
258
+ automationId: row.automationId
259
259
  };
260
260
  }
261
- /** Load newest-first executions for one task, with conversation titles when present. */
262
- async function readTaskExecutions(args) {
261
+ /** Load newest-first executions for one automation, with conversation titles when present. */
262
+ async function readAutomationExecutions(args) {
263
263
  const namespace = args.namespace ?? "junior";
264
264
  return (await getDb().select({
265
- conversationId: juniorTaskExecutions.conversationId,
265
+ conversationId: juniorAutomationExecutions.conversationId,
266
266
  durationMs: juniorConversations.durationMs,
267
- executedAtMs: juniorTaskExecutions.executedAtMs,
268
- executionId: juniorTaskExecutions.executionId,
269
- status: juniorTaskExecutions.status,
267
+ executedAtMs: juniorAutomationExecutions.executedAtMs,
268
+ executionId: juniorAutomationExecutions.executionId,
269
+ status: juniorAutomationExecutions.status,
270
270
  title: juniorConversations.title,
271
271
  usage: juniorConversations.usage
272
- }).from(juniorTaskExecutions).leftJoin(juniorConversations, eq(juniorConversations.conversationId, juniorTaskExecutions.conversationId)).where(and(eq(juniorTaskExecutions.kind, args.kind), eq(juniorTaskExecutions.namespace, namespace), eq(juniorTaskExecutions.taskId, args.taskId))).orderBy(desc(juniorTaskExecutions.executedAtMs), desc(juniorTaskExecutions.executionId)).limit(args.limit)).map((row) => mapTaskExecutionRecord(row));
272
+ }).from(juniorAutomationExecutions).leftJoin(juniorConversations, eq(juniorConversations.conversationId, juniorAutomationExecutions.conversationId)).where(and(eq(juniorAutomationExecutions.kind, args.kind), eq(juniorAutomationExecutions.namespace, namespace), eq(juniorAutomationExecutions.automationId, args.automationId))).orderBy(desc(juniorAutomationExecutions.executedAtMs), desc(juniorAutomationExecutions.executionId)).limit(args.limit)).map((row) => mapAutomationExecutionRecord(row));
273
273
  }
274
274
  /** Load newest-first executions for the supplied viewer-visible tasks. */
275
- async function readTaskRuns(args) {
276
- const tasks = args.tasks ?? [];
275
+ async function readAutomationRuns(args) {
276
+ const automations = args.automations ?? [];
277
277
  const conversationIds = [...new Set((args.conversationIds ?? []).filter((conversationId) => conversationId.trim().length > 0))];
278
- if (tasks.length === 0 && conversationIds.length === 0) return [];
278
+ if (automations.length === 0 && conversationIds.length === 0) return [];
279
279
  const namespace = args.namespace ?? "junior";
280
- const selectors = [...tasks.map((task) => and(eq(juniorTaskExecutions.kind, task.kind), eq(juniorTaskExecutions.taskId, task.taskId))), ...conversationIds.length > 0 ? [inArray(juniorTaskExecutions.conversationId, conversationIds)] : []];
280
+ const selectors = [...automations.map((task) => and(eq(juniorAutomationExecutions.kind, task.kind), eq(juniorAutomationExecutions.automationId, task.automationId))), ...conversationIds.length > 0 ? [inArray(juniorAutomationExecutions.conversationId, conversationIds)] : []];
281
281
  return (await getDb().select({
282
- conversationId: juniorTaskExecutions.conversationId,
282
+ conversationId: juniorAutomationExecutions.conversationId,
283
283
  durationMs: juniorConversations.durationMs,
284
- executedAtMs: juniorTaskExecutions.executedAtMs,
285
- executionId: juniorTaskExecutions.executionId,
286
- kind: juniorTaskExecutions.kind,
287
- status: juniorTaskExecutions.status,
288
- taskId: juniorTaskExecutions.taskId,
284
+ executedAtMs: juniorAutomationExecutions.executedAtMs,
285
+ executionId: juniorAutomationExecutions.executionId,
286
+ kind: juniorAutomationExecutions.kind,
287
+ status: juniorAutomationExecutions.status,
288
+ automationId: juniorAutomationExecutions.automationId,
289
289
  title: juniorConversations.title,
290
290
  usage: juniorConversations.usage
291
- }).from(juniorTaskExecutions).leftJoin(juniorConversations, eq(juniorConversations.conversationId, juniorTaskExecutions.conversationId)).where(and(eq(juniorTaskExecutions.namespace, namespace), or(...selectors))).orderBy(desc(juniorTaskExecutions.executedAtMs), desc(juniorTaskExecutions.executionId)).limit(args.limit)).flatMap((row) => {
291
+ }).from(juniorAutomationExecutions).leftJoin(juniorConversations, eq(juniorConversations.conversationId, juniorAutomationExecutions.conversationId)).where(and(eq(juniorAutomationExecutions.namespace, namespace), or(...selectors))).orderBy(desc(juniorAutomationExecutions.executedAtMs), desc(juniorAutomationExecutions.executionId)).limit(args.limit)).flatMap((row) => {
292
292
  if (row.kind !== "scheduled" && row.kind !== "event") return [];
293
293
  return [{
294
- ...mapTaskExecutionRecord(row),
294
+ ...mapAutomationExecutionRecord(row),
295
295
  kind: row.kind,
296
- taskId: row.taskId
296
+ automationId: row.automationId
297
297
  }];
298
298
  });
299
299
  }
300
- function mapTaskExecutionRecord(row) {
300
+ function mapAutomationExecutionRecord(row) {
301
301
  const title = row.title?.trim();
302
302
  const costUsd = agentTurnCostUsd(row.usage ?? void 0);
303
303
  const totalTokens = agentTurnTotalTokens(row.usage ?? void 0);
@@ -313,19 +313,19 @@ function mapTaskExecutionRecord(row) {
313
313
  ...totalTokens !== void 0 ? { totalTokens } : void 0
314
314
  };
315
315
  }
316
- /** Load a fixed trailing window of terminal executions for one task by status. */
317
- async function readTaskExecutionStatusDays(args) {
316
+ /** Load a fixed trailing window of terminal executions for one automation by status. */
317
+ async function readAutomationExecutionStatusDays(args) {
318
318
  const dayCount = args.dayCount ?? 90;
319
319
  const namespace = args.namespace ?? "junior";
320
320
  const end = utcDate(args.nowMs ?? Date.now());
321
321
  const endMs = Date.parse(`${end}T23:59:59.999Z`);
322
322
  const startMs = Date.parse(`${end}T00:00:00.000Z`) - (dayCount - 1) * 864e5;
323
- const executionDate = sql`to_char(to_timestamp(${juniorTaskExecutions.executedAtMs} / 1000.0) at time zone 'UTC', 'YYYY-MM-DD')`;
323
+ const executionDate = sql`to_char(to_timestamp(${juniorAutomationExecutions.executedAtMs} / 1000.0) at time zone 'UTC', 'YYYY-MM-DD')`;
324
324
  const rows = await getDb().select({
325
325
  count: count(),
326
326
  date: executionDate,
327
- status: juniorTaskExecutions.status
328
- }).from(juniorTaskExecutions).where(and(eq(juniorTaskExecutions.kind, args.kind), eq(juniorTaskExecutions.namespace, namespace), eq(juniorTaskExecutions.taskId, args.taskId), gte(juniorTaskExecutions.executedAtMs, startMs), lte(juniorTaskExecutions.executedAtMs, endMs), inArray(juniorTaskExecutions.status, [...TASK_EXECUTION_STATUSES]))).groupBy(executionDate, juniorTaskExecutions.status).orderBy(asc(executionDate), asc(juniorTaskExecutions.status));
327
+ status: juniorAutomationExecutions.status
328
+ }).from(juniorAutomationExecutions).where(and(eq(juniorAutomationExecutions.kind, args.kind), eq(juniorAutomationExecutions.namespace, namespace), eq(juniorAutomationExecutions.automationId, args.automationId), gte(juniorAutomationExecutions.executedAtMs, startMs), lte(juniorAutomationExecutions.executedAtMs, endMs), inArray(juniorAutomationExecutions.status, [...AUTOMATION_EXECUTION_STATUSES]))).groupBy(executionDate, juniorAutomationExecutions.status).orderBy(asc(executionDate), asc(juniorAutomationExecutions.status));
329
329
  const byDate = /* @__PURE__ */ new Map();
330
330
  for (let offset = 0; offset < dayCount; offset += 1) {
331
331
  const date = utcDate(startMs + offset * 864e5);
@@ -340,8 +340,8 @@ async function readTaskExecutionStatusDays(args) {
340
340
  }
341
341
  return [...byDate.values()];
342
342
  }
343
- /** Load a fixed trailing window of terminal executions for one task by hour. */
344
- async function readTaskExecutionStatusHours(args) {
343
+ /** Load a fixed trailing window of terminal executions for one automation by hour. */
344
+ async function readAutomationExecutionStatusHours(args) {
345
345
  const hourCount = args.hourCount ?? 168;
346
346
  const namespace = args.namespace ?? "junior";
347
347
  const nowMs = args.nowMs ?? Date.now();
@@ -349,12 +349,12 @@ async function readTaskExecutionStatusHours(args) {
349
349
  end.setUTCMinutes(0, 0, 0);
350
350
  const endMs = end.getTime() + 3599999;
351
351
  const startMs = end.getTime() - (hourCount - 1) * 36e5;
352
- const executionHour = sql`to_char(to_timestamp(${juniorTaskExecutions.executedAtMs} / 1000.0) at time zone 'UTC', 'YYYY-MM-DD"T"HH24')`;
352
+ const executionHour = sql`to_char(to_timestamp(${juniorAutomationExecutions.executedAtMs} / 1000.0) at time zone 'UTC', 'YYYY-MM-DD"T"HH24')`;
353
353
  const rows = await getDb().select({
354
354
  count: count(),
355
355
  date: executionHour,
356
- status: juniorTaskExecutions.status
357
- }).from(juniorTaskExecutions).where(and(eq(juniorTaskExecutions.kind, args.kind), eq(juniorTaskExecutions.namespace, namespace), eq(juniorTaskExecutions.taskId, args.taskId), gte(juniorTaskExecutions.executedAtMs, startMs), lte(juniorTaskExecutions.executedAtMs, endMs), inArray(juniorTaskExecutions.status, [...TASK_EXECUTION_STATUSES]))).groupBy(executionHour, juniorTaskExecutions.status).orderBy(asc(executionHour), asc(juniorTaskExecutions.status));
356
+ status: juniorAutomationExecutions.status
357
+ }).from(juniorAutomationExecutions).where(and(eq(juniorAutomationExecutions.kind, args.kind), eq(juniorAutomationExecutions.namespace, namespace), eq(juniorAutomationExecutions.automationId, args.automationId), gte(juniorAutomationExecutions.executedAtMs, startMs), lte(juniorAutomationExecutions.executedAtMs, endMs), inArray(juniorAutomationExecutions.status, [...AUTOMATION_EXECUTION_STATUSES]))).groupBy(executionHour, juniorAutomationExecutions.status).orderBy(asc(executionHour), asc(juniorAutomationExecutions.status));
358
358
  const byHour = /* @__PURE__ */ new Map();
359
359
  for (let offset = 0; offset < hourCount; offset += 1) {
360
360
  const date = new Date(startMs + offset * 36e5).toISOString().slice(0, 13);
@@ -370,4 +370,4 @@ async function readTaskExecutionStatusHours(args) {
370
370
  return [...byHour.values()];
371
371
  }
372
372
  //#endregion
373
- export { readTaskExecutionStatusDays as a, readTaskExecutions as c, conversationActiveDaysColumn as d, conversationAggregateColumns as f, readTaskExecutionHours as i, readTaskRuns as l, readTaskExecutionByConversationId as n, readTaskExecutionStatusHours as o, conversationRangeColumns as p, readTaskExecutionDays as r, readTaskExecutionSummaries as s, emptyTaskRunWindows as t, recordTaskExecution as u };
373
+ export { readAutomationExecutionStatusDays as a, readAutomationExecutions as c, conversationActiveDaysColumn as d, conversationAggregateColumns as f, readAutomationExecutionHours as i, readAutomationRuns as l, readAutomationExecutionByConversationId as n, readAutomationExecutionStatusHours as o, conversationRangeColumns as p, readAutomationExecutionDays as r, readAutomationExecutionSummaries as s, emptyAutomationRunWindows as t, recordAutomationExecution as u };
@@ -1,4 +1,5 @@
1
- import "./config-CIE83sR2.js";
1
+ import { h as startSpan } from "./sentry-CD3SdJl-.js";
2
+ import "./config-EtF2uEaW.js";
2
3
  import { n as juniorDestinations, r as timestamptz } from "./destinations-BeBiJeEM.js";
3
4
  import { AsyncLocalStorage } from "node:async_hooks";
4
5
  import { getTableColumns, sql } from "drizzle-orm";
@@ -353,8 +354,8 @@ const juniorLocationConfigurations = pgTable("junior_location_configurations", {
353
354
  expiresAt: text("expires_at")
354
355
  }, (table) => [primaryKey({ columns: [table.locationId, table.key] })]);
355
356
  //#endregion
356
- //#region src/db/schema/event-tasks.ts
357
- const juniorEventTasks = pgTable("junior_event_tasks", {
357
+ //#region src/db/schema/event-automations.ts
358
+ const juniorEventAutomations = pgTable("junior_event_tasks", {
358
359
  id: text("id").primaryKey(),
359
360
  teamId: text("team_id").notNull(),
360
361
  namespace: text("namespace").notNull(),
@@ -389,13 +390,13 @@ const juniorStats = pgTable("junior_stats", {
389
390
  ]
390
391
  })]);
391
392
  //#endregion
392
- //#region src/db/schema/task-executions.ts
393
- /** One terminal task execution linked to its durable conversation when present. */
394
- const juniorTaskExecutions = pgTable("junior_task_executions", {
393
+ //#region src/db/schema/automation-executions.ts
394
+ /** One terminal automation execution linked to its durable conversation when present. */
395
+ const juniorAutomationExecutions = pgTable("junior_task_executions", {
395
396
  executionId: text("execution_id").notNull(),
396
397
  kind: text("kind").notNull(),
397
398
  namespace: text("namespace").notNull(),
398
- taskId: text("task_id").notNull(),
399
+ automationId: text("task_id").notNull(),
399
400
  conversationId: text("conversation_id"),
400
401
  executedAtMs: bigint("executed_at_ms", { mode: "number" }).notNull(),
401
402
  status: text("status").$type().notNull()
@@ -415,12 +416,12 @@ const juniorTaskExecutions = pgTable("junior_task_executions", {
415
416
  columns: [table.conversationId],
416
417
  foreignColumns: [juniorConversations.conversationId]
417
418
  }),
418
- index("junior_task_executions_task_time_idx").on(table.kind, table.namespace, table.taskId, table.executedAtMs),
419
+ index("junior_task_executions_task_time_idx").on(table.kind, table.namespace, table.automationId, table.executedAtMs),
419
420
  index("junior_task_executions_time_kind_idx").on(table.executedAtMs, table.kind),
420
421
  index("junior_task_executions_conversation_time_idx").on(table.conversationId, table.executedAtMs)
421
422
  ]);
422
423
  //#endregion
423
- //#region src/db/schema/scheduled-tasks.ts
424
+ //#region src/db/schema/scheduled-automations.ts
424
425
  const juniorSchedulerTasks = pgTable("junior_scheduler_tasks", {
425
426
  id: text("id").primaryKey(),
426
427
  teamId: text("team_id").notNull(),
@@ -520,11 +521,11 @@ const juniorSqlSchema = {
520
521
  juniorConversations,
521
522
  juniorLocationConfigurations,
522
523
  juniorDestinations,
523
- juniorEventTasks,
524
+ juniorEventAutomations,
524
525
  juniorIdentities,
525
526
  juniorSnapshots,
526
527
  juniorStats,
527
- juniorTaskExecutions,
528
+ juniorAutomationExecutions,
528
529
  juniorSchedulerRuns,
529
530
  juniorSchedulerTasks,
530
531
  juniorUsers,
@@ -532,6 +533,34 @@ const juniorSqlSchema = {
532
533
  juniorWorkspaces
533
534
  };
534
535
  //#endregion
536
+ //#region src/db/tracing.ts
537
+ const traced = Symbol("junior.db.traced");
538
+ const SQL_OPERATION = /^[\s;]*(ALTER|CALL|CREATE|DELETE|DROP|INSERT|MERGE|SELECT|TRUNCATE|UPDATE)\b/i;
539
+ function operationFromQuery(query) {
540
+ const text = typeof query === "string" ? query : query && typeof query === "object" && "text" in query ? query.text : void 0;
541
+ return typeof text === "string" ? SQL_OPERATION.exec(text)?.[1]?.toUpperCase() : void 0;
542
+ }
543
+ /** Add safe database spans to an owned PostgreSQL query client. */
544
+ function traceQueries(client, driver) {
545
+ if (client[traced]) return client;
546
+ client[traced] = true;
547
+ const query = client.query.bind(client);
548
+ client.query = ((...args) => {
549
+ const operation = operationFromQuery(args[0]);
550
+ return startSpan({
551
+ name: operation ?? "postgresql",
552
+ op: "db.query",
553
+ onlyIfParent: true,
554
+ attributes: {
555
+ "db.system.name": "postgresql",
556
+ ...operation ? { "db.operation.name": operation } : void 0,
557
+ "app.db.driver": driver
558
+ }
559
+ }, () => query(...args));
560
+ });
561
+ return client;
562
+ }
563
+ //#endregion
535
564
  //#region src/db/neon.ts
536
565
  var NeonExecutor = class {
537
566
  pool;
@@ -619,7 +648,7 @@ var NeonExecutor = class {
619
648
  await this.pool.end();
620
649
  }
621
650
  queryClient() {
622
- return this.transactionClient.getStore() ?? this.pool;
651
+ return traceQueries(this.transactionClient.getStore() ?? this.pool, "neon");
623
652
  }
624
653
  };
625
654
  /** Create the shared Neon-backed Junior SQL executor. */
@@ -719,7 +748,7 @@ var PostgresExecutor = class {
719
748
  await this.pool.end();
720
749
  }
721
750
  queryClient() {
722
- return this.transactionClient.getStore() ?? this.pool;
751
+ return traceQueries(this.transactionClient.getStore() ?? this.pool, "postgres");
723
752
  }
724
753
  };
725
754
  /** Create the shared Node Postgres-backed Junior SQL executor. */
@@ -746,4 +775,4 @@ function createJuniorSqlExecutor(args) {
746
775
  });
747
776
  }
748
777
  //#endregion
749
- export { conversationReadColumns as C, juniorArtifacts as D, juniorUsers as E, juniorAttachments as S, juniorIdentities as T, juniorConversationEvents as _, juniorSchedulerRuns as a, juniorCodeChanges as b, juniorStats as c, AGENT_INVOCATION_MAILBOX_STATUSES as d, juniorAgentBindings as f, juniorConversationBriefs as g, juniorConversationBindings as h, juniorWorkspaces as i, juniorEventTasks as l, juniorConversationParticipants as m, juniorSnapshots as n, juniorSchedulerTasks as o, juniorAgentInvocations as p, juniorWorkspaceRepos as r, juniorTaskExecutions as s, createJuniorSqlExecutor as t, juniorLocationConfigurations as u, juniorApiTokens as v, juniorConversations as w, juniorCodeRepositories as x, juniorConversationAnnotations as y };
778
+ export { conversationReadColumns as C, juniorArtifacts as D, juniorUsers as E, juniorAttachments as S, juniorIdentities as T, juniorConversationEvents as _, juniorSchedulerRuns as a, juniorCodeChanges as b, juniorStats as c, AGENT_INVOCATION_MAILBOX_STATUSES as d, juniorAgentBindings as f, juniorConversationBriefs as g, juniorConversationBindings as h, juniorWorkspaces as i, juniorEventAutomations as l, juniorConversationParticipants as m, juniorSnapshots as n, juniorSchedulerTasks as o, juniorAgentInvocations as p, juniorWorkspaceRepos as r, juniorAutomationExecutions as s, createJuniorSqlExecutor as t, juniorLocationConfigurations as u, juniorApiTokens as v, juniorConversations as w, juniorCodeRepositories as x, juniorConversationAnnotations as y };
@@ -1,6 +1,6 @@
1
- import { M as getDeploymentServiceVersion, N as getDeploymentTelemetryAttributes } from "./logging-D37bayDc.js";
1
+ import { M as getDeploymentServiceVersion, N as getDeploymentTelemetryAttributes } from "./logging-sNS84Yuu.js";
2
2
  import { a as getClient, c as init, g as vercelAIIntegration, o as getGlobalScope, y as withStreamedSpan } from "./sentry-CD3SdJl-.js";
3
- import { n as getCurrentConversationPrivacy } from "./conversation-privacy-Auyq26XQ.js";
3
+ import { n as getCurrentConversationPrivacy } from "./conversation-privacy-whGaV2TG.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-CIE83sR2.js";
1
+ import { a as getChatConfig } from "./config-EtF2uEaW.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, v as withScope } from "./sentry-CD3SdJl-.js";
2
- import { t as JUNIOR_VERSION } from "./version-DcfJxB4z.js";
2
+ import { t as JUNIOR_VERSION } from "./version-s6smK6lP.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-AxGmJHwK.js";
1
+ import { n as JuniorDashboardOptions } from "./app-DfNrn_gS.js";
2
2
  import { n as JuniorPluginSet } from "./plugins-BI9A1vKA.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-D37bayDc.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-sNS84Yuu.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-CyTc24Es.js";
4
+ import { t as WORKSPACE_SNAPSHOT_JOB_QUEUE_TOPIC } from "./job-queue-BIHNIEIX.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-CdpTvu4R.js";
6
+ import { t as PLUGIN_TASK_QUEUE_TOPIC } from "./task-queue-JfmWmpjS.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 { Y as createUserTokenStore } from "./agent-C9yuiZUF.js";
2
- import { a as GET, n as syncLocalOAuthCredential, r as GET$1 } from "./credential-sync-BO33aNQd.js";
1
+ import { Y as createUserTokenStore } from "./agent-BfxfHsf1.js";
2
+ import { a as GET, n as syncLocalOAuthCredential, r as GET$1 } from "./credential-sync-DM-EE1ey.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 { i as abandonTurnRecord, yt as extractAssistantText } from "./checkpoint-BY47jJCB.js";
2
- import { Kt as buildDeterministicTurnId } from "./stats-DKRP4rsY.js";
1
+ import { i as abandonTurnRecord, yt as extractAssistantText } from "./checkpoint-FKMcINix.js";
2
+ import { Kt as buildDeterministicTurnId } from "./stats-Cq5w_Awk.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-ceE7NtvC.js";
2
- import { _ as setSpanAttributes, v as setSpanStatus } from "./logging-D37bayDc.js";
3
- import { a as getChatConfig } from "./config-CIE83sR2.js";
4
- import { n as pluginCatalogRuntime } from "./catalog-runtime-TBR8n4e1.js";
1
+ import { w as toOptionalTrimmed } from "./client-bRyPqwAV.js";
2
+ import { _ as setSpanAttributes, v as setSpanStatus } from "./logging-sNS84Yuu.js";
3
+ import { a as getChatConfig } from "./config-EtF2uEaW.js";
4
+ import { n as pluginCatalogRuntime } from "./catalog-runtime-D8YUMNhb.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";
@@ -407,36 +407,36 @@ async function generateBrief(args) {
407
407
  };
408
408
  }
409
409
  //#endregion
410
- //#region src/chat/resource-events/actor.ts
410
+ //#region src/chat/events/actor.ts
411
411
  /**
412
- * System author ID stamped on resource-event mailbox messages.
412
+ * System author ID stamped on event mailbox messages.
413
413
  *
414
414
  * Keep this stable so conversation history can recognize the same system input
415
- * for resource-event Turns.
415
+ * for event Turns.
416
416
  *
417
- * TODO(dcramer): Delete this ID after resumes read resource-event Source.kind
417
+ * TODO(dcramer): Delete this ID after resumes read event Source.kind
418
418
  * from the Turn checkpoint instead of Message author data.
419
419
  */
420
- const RESOURCE_EVENT_AUTHOR_ID = "UJRNEVENT";
421
- /** System Message author for resource-event input. */
422
- const RESOURCE_EVENT_MESSAGE_AUTHOR = {
420
+ const EVENT_AUTHOR_ID = "UJRNEVENT";
421
+ /** System Message author for event input. */
422
+ const EVENT_MESSAGE_AUTHOR = {
423
423
  fullName: "Junior event",
424
424
  isBot: true,
425
- userId: RESOURCE_EVENT_AUTHOR_ID,
425
+ userId: EVENT_AUTHOR_ID,
426
426
  userName: "junior-event"
427
427
  };
428
- /** System execution actor for every resource-event turn. */
429
- const RESOURCE_EVENT_SYSTEM_ACTOR = {
428
+ /** System execution actor for every event turn. */
429
+ const EVENT_SYSTEM_ACTOR = {
430
430
  platform: "system",
431
- name: "resource-event"
431
+ name: "event"
432
432
  };
433
433
  /**
434
- * Whether a saved Message started a resource-event Turn.
434
+ * Whether a saved Message started a event Turn.
435
435
  *
436
436
  * TODO(dcramer): Delete this marker check after deployed Turn cursors all store
437
437
  * Source and Actor. `eventType` only supports saved synthetic Slack input.
438
438
  */
439
- function isResourceEventConversationMessage(message) {
439
+ function isEventConversationMessage(message) {
440
440
  return Boolean(message.meta?.eventType) || message.author?.userId === "UJRNEVENT";
441
441
  }
442
442
  //#endregion
@@ -549,4 +549,4 @@ Rules:
549
549
  - Keep the summary under 600 characters, intent under 400 characters, outcome text under 600 characters, and each other string under 400 characters.
550
550
  `;
551
551
  //#endregion
552
- export { RESOURCE_EVENT_SYSTEM_ACTOR as a, RESOURCE_EVENT_MESSAGE_AUTHOR as i, briefEntriesFromReportEvents as n, isResourceEventConversationMessage as o, RESOURCE_EVENT_AUTHOR_ID as r, generateBrief as s, BRIEF_PROMPT as t };
552
+ export { EVENT_SYSTEM_ACTOR as a, EVENT_MESSAGE_AUTHOR as i, briefEntriesFromReportEvents as n, isEventConversationMessage as o, EVENT_AUTHOR_ID as r, generateBrief as s, BRIEF_PROMPT as t };
@@ -1,5 +1,5 @@
1
- import { _ as setSpanAttributes, d as logInfo, f as logWarn } from "./logging-D37bayDc.js";
2
- import { i as credentialUserSubjectId } from "./context-B45_WqVX.js";
1
+ import { _ as setSpanAttributes, d as logInfo, f as logWarn } from "./logging-sNS84Yuu.js";
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";
5
5
  import { z } from "zod";
@@ -1,5 +1,5 @@
1
- import { C as withSpan, _ as setSpanAttributes } from "./logging-D37bayDc.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-CSixooTi.js";
1
+ import { C as withSpan, _ as setSpanAttributes } from "./logging-sNS84Yuu.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-BfLMVhWo.js";
3
3
  import { z } from "zod";
4
4
  import { FileSystem, Sandbox } from "@vercel/sandbox";
5
5
  //#region src/chat/sandbox/resources.ts