@sentry/junior 0.138.0 → 0.140.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 (81) hide show
  1. package/dist/{agent-hooks-SCR74Q3E.js → agent-hooks-BFTDRFUO.js} +10 -10
  2. package/dist/api/schema/task.d.ts +104 -1
  3. package/dist/api/schema.d.ts +2 -2
  4. package/dist/api/schema.js +9 -1
  5. package/dist/api.js +198 -54
  6. package/dist/app.js +374 -607
  7. package/dist/{catalog-runtime-IU3QF4GG.js → catalog-runtime-RK664S5T.js} +6 -6
  8. package/dist/chat/agent/request.d.ts +12 -2
  9. package/dist/chat/credentials/context.d.ts +14 -0
  10. package/dist/chat/resource-events/actor.d.ts +23 -0
  11. package/dist/chat/scheduled-tasks/telemetry.d.ts +7 -0
  12. package/dist/chat/scheduled-tasks/tool-support.d.ts +10 -2
  13. package/dist/chat/scheduled-tasks/tools/create.d.ts +4 -2
  14. package/dist/chat/scheduled-tasks/tools/delete.d.ts +4 -2
  15. package/dist/chat/scheduled-tasks/tools/list.d.ts +4 -2
  16. package/dist/chat/scheduled-tasks/tools/run-now.d.ts +4 -2
  17. package/dist/chat/scheduled-tasks/tools/update.d.ts +4 -2
  18. package/dist/chat/scheduled-tasks/types.d.ts +1 -1
  19. package/dist/chat/slack/dashboard-link.d.ts +2 -0
  20. package/dist/chat/state/turn-session-keys.d.ts +2 -2
  21. package/dist/chat/state/turn-session.d.ts +16 -12
  22. package/dist/chat/tasks/execution-stats.d.ts +34 -3
  23. package/dist/chat/tasks/read.d.ts +3 -1
  24. package/dist/chunk-3B7O3GNU.js +207 -0
  25. package/dist/{chunk-N7WARMC6.js → chunk-3CUBAGA3.js} +7 -7
  26. package/dist/{chunk-5MXWHTCK.js → chunk-4PIT6O7A.js} +17 -8
  27. package/dist/{chunk-DCLLQGS6.js → chunk-557HLSNH.js} +8 -3
  28. package/dist/{chunk-SD3OFRWY.js → chunk-5KAZMR5U.js} +6 -6
  29. package/dist/{chunk-ZBSMCXKV.js → chunk-5YAWB2AX.js} +7 -6
  30. package/dist/{chunk-FEUNPTGV.js → chunk-A6BI25J3.js} +434 -12
  31. package/dist/{chunk-5LTJ4ITU.js → chunk-AA2EPMUF.js} +4 -4
  32. package/dist/{chunk-TUUDXEXU.js → chunk-BMFRFSTM.js} +68 -79
  33. package/dist/{chunk-C7ZVPO4Z.js → chunk-CPPTBHQN.js} +1 -1
  34. package/dist/{chunk-ZXNTJJIE.js → chunk-D3X2PI3D.js} +2 -2
  35. package/dist/{chunk-LPVUNO2W.js → chunk-DMDOKRPC.js} +7 -7
  36. package/dist/{chunk-TCS76X5D.js → chunk-HEFBGCCU.js} +2 -2
  37. package/dist/{chunk-EPBBYMNE.js → chunk-HUO3UTAQ.js} +1 -1
  38. package/dist/{chunk-KFRHRSCJ.js → chunk-I3OZR3HG.js} +2 -2
  39. package/dist/{chunk-BOLJOV5T.js → chunk-J5H65GY2.js} +1 -1
  40. package/dist/{chunk-RZIBSCYC.js → chunk-MYVCHWDG.js} +39 -23
  41. package/dist/{chunk-QS527AV5.js → chunk-N2I7W2VS.js} +1 -1
  42. package/dist/{chunk-JNNJZURV.js → chunk-NPL66ZWL.js} +1 -1
  43. package/dist/{chunk-A7WCHXZV.js → chunk-OGNL2QY7.js} +4 -4
  44. package/dist/{chunk-77VDLF3Z.js → chunk-RUIXF3YQ.js} +10 -0
  45. package/dist/{chunk-BYW4B4PR.js → chunk-S3FAOKQU.js} +2 -2
  46. package/dist/chunk-TGIKZJ3Y.js +115 -0
  47. package/dist/{chunk-YU5QUF67.js → chunk-TKTZ4L4Z.js} +1 -1
  48. package/dist/{chunk-VPZFVJND.js → chunk-UXMRN2ZX.js} +1 -1
  49. package/dist/{chunk-HIWJWWMT.js → chunk-VRDHAITB.js} +3 -3
  50. package/dist/{chunk-SIPKWSXK.js → chunk-WSWM6A3R.js} +3 -3
  51. package/dist/{chunk-FNLBTB4K.js → chunk-WTGLUX4K.js} +1 -1
  52. package/dist/{chunk-PB3CXNVL.js → chunk-XROWZSOY.js} +1 -1
  53. package/dist/{chunk-TDJCLNDH.js → chunk-XX2QNQN4.js} +147 -86
  54. package/dist/{chunk-KDCHVT25.js → chunk-YB363QGA.js} +9 -2
  55. package/dist/{chunk-HCIVH3JS.js → chunk-YWM6MJT4.js} +29 -1
  56. package/dist/{chunk-E5UYAIKJ.js → chunk-Z2A7BDHT.js} +17 -19
  57. package/dist/cli/chat.js +33 -33
  58. package/dist/cli/check.js +7 -7
  59. package/dist/cli/plugins.js +14 -14
  60. package/dist/cli/snapshot-create.js +10 -10
  61. package/dist/cli/upgrade.js +8 -8
  62. package/dist/db/schema/task-executions.d.ts +23 -2
  63. package/dist/db/schema.d.ts +20 -1
  64. package/dist/{db-UO2IWXGA.js → db-QOGYDDQM.js} +7 -7
  65. package/dist/instrumentation.js +4 -4
  66. package/dist/nitro.js +2 -2
  67. package/dist/{oauth-callback-server-MAQI43LX.js → oauth-callback-server-CT4RMGCP.js} +22 -21
  68. package/dist/{runner-PIUQEXKE.js → runner-PHMLHNLX.js} +18 -16
  69. package/dist/{sandbox-egress-signals-A5HWIQH4.js → sandbox-egress-signals-EKPAVWQL.js} +2 -2
  70. package/dist/{skills-4ARJADHQ.js → skills-AYRM4QGF.js} +7 -7
  71. package/dist/spawn-OGRQFUNK.js +38 -0
  72. package/dist/{validation-S3EE3HWL.js → validation-M5JNGRGL.js} +7 -7
  73. package/dist/version.js +1 -1
  74. package/dist/{work-UARRUAW3.js → work-LZWE6HK4.js} +18 -18
  75. package/dist/{worker-DOCIRVD3.js → worker-KOGPXFYK.js} +10 -10
  76. package/migrations/0022_task_execution_status.sql +3 -0
  77. package/migrations/meta/0022_snapshot.json +2186 -0
  78. package/migrations/meta/_journal.json +7 -0
  79. package/package.json +5 -5
  80. package/dist/chunk-ELKW5FIB.js +0 -233
  81. package/dist/spawn-G2AWPMCT.js +0 -38
@@ -1,16 +1,16 @@
1
1
  import {
2
2
  pluginCatalogRuntime
3
- } from "./chunk-QS527AV5.js";
4
- import "./chunk-KFRHRSCJ.js";
5
- import "./chunk-77VDLF3Z.js";
3
+ } from "./chunk-N2I7W2VS.js";
4
+ import "./chunk-I3OZR3HG.js";
5
+ import "./chunk-RUIXF3YQ.js";
6
6
  import "./chunk-HZF5P5UN.js";
7
7
  import "./chunk-F3B2YJ76.js";
8
- import "./chunk-JNNJZURV.js";
8
+ import "./chunk-NPL66ZWL.js";
9
9
  import "./chunk-6GWA276C.js";
10
10
  import "./chunk-OOUNJNMR.js";
11
11
  import "./chunk-H4HBKISO.js";
12
- import "./chunk-KDCHVT25.js";
13
- import "./chunk-C7ZVPO4Z.js";
12
+ import "./chunk-YB363QGA.js";
13
+ import "./chunk-CPPTBHQN.js";
14
14
  import "./chunk-MLKGABMK.js";
15
15
  export {
16
16
  pluginCatalogRuntime
@@ -75,10 +75,20 @@ export interface AgentRunInput {
75
75
  piMessages?: PiMessage[];
76
76
  conversationContext?: string;
77
77
  }
78
- /** Carries identity and addressing needed to route tools, auth, and delivery. */
78
+ /**
79
+ * Identity and addressing for one run.
80
+ *
81
+ * Set `actor` first (who runs). Derive `credentialContext` with
82
+ * `credentialContextForActor(actor, subject?)` unless a caller already bound
83
+ * credentials (dispatch with delegated subject). They name the same principal
84
+ * except when a system actor carries `credentialContext.subject` for delegated
85
+ * user tokens.
86
+ */
79
87
  export interface AgentRunRouting {
80
- credentialContext?: CredentialContext;
88
+ /** Who this run executes as. Prefer always setting this. */
81
89
  actor?: Actor;
90
+ /** Credential authority projected from actor (plus optional subject). */
91
+ credentialContext?: CredentialContext;
82
92
  source: Source;
83
93
  slackConversation?: SlackConversationContext;
84
94
  /**
@@ -1,4 +1,5 @@
1
1
  import { z } from "zod";
2
+ import { type Actor } from "@/chat/actor";
2
3
  declare const credentialSubjectBindingSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
3
4
  type: z.ZodLiteral<"slack-direct-conversation">;
4
5
  teamId: z.ZodString;
@@ -100,6 +101,19 @@ export type CredentialSubjectBinding = z.output<typeof credentialSubjectBindingS
100
101
  export type CredentialSystemActor = z.output<typeof credentialSystemActorSchema>;
101
102
  export type CredentialSubject = z.output<typeof credentialSubjectSchema>;
102
103
  export type CredentialContext = z.output<typeof credentialContextSchema>;
104
+ /**
105
+ * Build credential authority from the run actor.
106
+ *
107
+ * `actor` is the rich execution principal. This projects the credential stub
108
+ * tools/auth need from it:
109
+ * - user actor → `{ actor: { type: "user", userId } }`
110
+ * - system actor → `{ actor: systemActor, subject? }`
111
+ *
112
+ * They only diverge when a system run carries an explicit delegated `subject`
113
+ * (scheduled/event-task creator credentials). Callers should set `actor` first,
114
+ * then derive this — do not hand-build parallel shapes.
115
+ */
116
+ export declare function credentialContextForActor(actor: Actor, subject?: CredentialSubject): CredentialContext;
103
117
  /** Return the user whose OAuth token may satisfy this credential request. */
104
118
  export declare function credentialUserSubjectId(context: CredentialContext): string | undefined;
105
119
  /** Parse an untrusted credential context payload from sandbox egress state. */
@@ -0,0 +1,23 @@
1
+ /** Synthetic Slack author id stamped on resource-event mailbox messages. */
2
+ export declare const RESOURCE_EVENT_SLACK_AUTHOR_ID = "UJRNEVENT";
3
+ /** System execution actor for every resource-event turn. */
4
+ export declare const RESOURCE_EVENT_SYSTEM_ACTOR: {
5
+ readonly platform: "system";
6
+ readonly name: "resource-event";
7
+ };
8
+ /** Whether a durable conversation message is a resource-event turn input. */
9
+ export declare function isResourceEventConversationMessage(message: {
10
+ author?: {
11
+ userId?: string;
12
+ };
13
+ meta?: {
14
+ eventType?: string;
15
+ };
16
+ }): boolean;
17
+ /**
18
+ * Whether a Slack Message payload is a synthetic resource-event notification.
19
+ * Checks the raw `event_type` marker stamped at mailbox serialization.
20
+ */
21
+ export declare function isResourceEventSlackMessage(message: {
22
+ raw?: unknown;
23
+ }): boolean;
@@ -0,0 +1,7 @@
1
+ import type { ScheduledRun, ScheduledTask } from "./types";
2
+ /** Correlation attributes shared by scheduled-task create and run events. */
3
+ export declare function scheduledTaskAttributes(task: Pick<ScheduledTask, "id" | "conversationAccess" | "credentialMode" | "destination" | "nextRunAtMs" | "schedule" | "status">, extras?: Record<string, unknown>): Record<string, unknown>;
4
+ /** Correlation attributes for one scheduled-task run transition. */
5
+ export declare function scheduledTaskRunAttributes(task: Pick<ScheduledTask, "id" | "conversationAccess" | "credentialMode" | "destination" | "nextRunAtMs" | "schedule" | "status">, run: Pick<ScheduledRun, "id" | "dispatchId" | "scheduledForMs" | "resultMessageTs" | "status">, extras?: Record<string, unknown>): Record<string, unknown>;
6
+ /** Emit the lifecycle event for one skipped scheduled-task run. */
7
+ export declare function logScheduledTaskRunSkipped(task: Pick<ScheduledTask, "id" | "conversationAccess" | "credentialMode" | "destination" | "nextRunAtMs" | "schedule" | "status">, run: Pick<ScheduledRun, "id" | "dispatchId" | "scheduledForMs" | "resultMessageTs" | "status">, extras?: Record<string, unknown>): void;
@@ -19,6 +19,7 @@ export declare const MAX_LISTED_TASKS = 50;
19
19
  declare const compactTaskResultSchema: z.ZodObject<{
20
20
  id: z.ZodString;
21
21
  status: z.ZodEnum<{
22
+ completed: "completed";
22
23
  blocked: "blocked";
23
24
  active: "active";
24
25
  deleted: "deleted";
@@ -43,6 +44,7 @@ declare const compactTaskResultSchema: z.ZodObject<{
43
44
  system: "system";
44
45
  creator: "creator";
45
46
  }>;
47
+ dashboard_url: z.ZodNullable<z.ZodString>;
46
48
  last_run_at: z.ZodNullable<z.ZodString>;
47
49
  run_now_at: z.ZodNullable<z.ZodString>;
48
50
  }, z.core.$strict>;
@@ -56,6 +58,7 @@ export declare const scheduleTaskToolResultSchema: z.ZodObject<{
56
58
  task: z.ZodObject<{
57
59
  id: z.ZodString;
58
60
  status: z.ZodEnum<{
61
+ completed: "completed";
59
62
  blocked: "blocked";
60
63
  active: "active";
61
64
  deleted: "deleted";
@@ -80,6 +83,7 @@ export declare const scheduleTaskToolResultSchema: z.ZodObject<{
80
83
  system: "system";
81
84
  creator: "creator";
82
85
  }>;
86
+ dashboard_url: z.ZodNullable<z.ZodString>;
83
87
  last_run_at: z.ZodNullable<z.ZodString>;
84
88
  run_now_at: z.ZodNullable<z.ZodString>;
85
89
  }, z.core.$strict>;
@@ -93,6 +97,7 @@ export declare const scheduleListToolResultSchema: z.ZodObject<{
93
97
  tasks: z.ZodArray<z.ZodObject<{
94
98
  id: z.ZodString;
95
99
  status: z.ZodEnum<{
100
+ completed: "completed";
96
101
  blocked: "blocked";
97
102
  active: "active";
98
103
  deleted: "deleted";
@@ -117,6 +122,7 @@ export declare const scheduleListToolResultSchema: z.ZodObject<{
117
122
  system: "system";
118
123
  creator: "creator";
119
124
  }>;
125
+ dashboard_url: z.ZodNullable<z.ZodString>;
120
126
  last_run_at: z.ZodNullable<z.ZodString>;
121
127
  run_now_at: z.ZodNullable<z.ZodString>;
122
128
  }, z.core.$strict>>;
@@ -145,7 +151,7 @@ export declare function scheduleTaskToolResult(target: string, task: CompactTask
145
151
  readonly target: string;
146
152
  readonly task: {
147
153
  id: string;
148
- status: "blocked" | "active" | "deleted";
154
+ status: "completed" | "blocked" | "active" | "deleted";
149
155
  task: string;
150
156
  schedule: string;
151
157
  timezone: string;
@@ -156,6 +162,7 @@ export declare function scheduleTaskToolResult(target: string, task: CompactTask
156
162
  visibility: "public" | "private";
157
163
  };
158
164
  credential_mode: "system" | "creator";
165
+ dashboard_url: string | null;
159
166
  last_run_at: string | null;
160
167
  run_now_at: string | null;
161
168
  };
@@ -169,7 +176,7 @@ export declare function scheduleListToolResult(args: {
169
176
  readonly target: string;
170
177
  readonly tasks: {
171
178
  id: string;
172
- status: "blocked" | "active" | "deleted";
179
+ status: "completed" | "blocked" | "active" | "deleted";
173
180
  task: string;
174
181
  schedule: string;
175
182
  timezone: string;
@@ -180,6 +187,7 @@ export declare function scheduleListToolResult(args: {
180
187
  visibility: "public" | "private";
181
188
  };
182
189
  credential_mode: "system" | "creator";
190
+ dashboard_url: string | null;
183
191
  last_run_at: string | null;
184
192
  run_now_at: string | null;
185
193
  }[];
@@ -34,7 +34,7 @@ export declare function createSlackScheduleCreateTaskTool(context: SchedulerTool
34
34
  target: string;
35
35
  task: {
36
36
  id: string;
37
- status: "blocked" | "active" | "deleted";
37
+ status: "completed" | "blocked" | "active" | "deleted";
38
38
  task: string;
39
39
  schedule: string;
40
40
  timezone: string;
@@ -45,6 +45,7 @@ export declare function createSlackScheduleCreateTaskTool(context: SchedulerTool
45
45
  visibility: "public" | "private";
46
46
  };
47
47
  credential_mode: "system" | "creator";
48
+ dashboard_url: string | null;
48
49
  last_run_at: string | null;
49
50
  run_now_at: string | null;
50
51
  };
@@ -57,7 +58,7 @@ export declare function createSlackScheduleCreateTaskTool(context: SchedulerTool
57
58
  target: string;
58
59
  task: {
59
60
  id: string;
60
- status: "blocked" | "active" | "deleted";
61
+ status: "completed" | "blocked" | "active" | "deleted";
61
62
  task: string;
62
63
  schedule: string;
63
64
  timezone: string;
@@ -68,6 +69,7 @@ export declare function createSlackScheduleCreateTaskTool(context: SchedulerTool
68
69
  visibility: "public" | "private";
69
70
  };
70
71
  credential_mode: "system" | "creator";
72
+ dashboard_url: string | null;
71
73
  last_run_at: string | null;
72
74
  run_now_at: string | null;
73
75
  };
@@ -10,7 +10,7 @@ export declare function createSlackScheduleDeleteTaskTool(context: SchedulerTool
10
10
  target: string;
11
11
  task: {
12
12
  id: string;
13
- status: "blocked" | "active" | "deleted";
13
+ status: "completed" | "blocked" | "active" | "deleted";
14
14
  task: string;
15
15
  schedule: string;
16
16
  timezone: string;
@@ -21,6 +21,7 @@ export declare function createSlackScheduleDeleteTaskTool(context: SchedulerTool
21
21
  visibility: "public" | "private";
22
22
  };
23
23
  credential_mode: "system" | "creator";
24
+ dashboard_url: string | null;
24
25
  last_run_at: string | null;
25
26
  run_now_at: string | null;
26
27
  };
@@ -33,7 +34,7 @@ export declare function createSlackScheduleDeleteTaskTool(context: SchedulerTool
33
34
  target: string;
34
35
  task: {
35
36
  id: string;
36
- status: "blocked" | "active" | "deleted";
37
+ status: "completed" | "blocked" | "active" | "deleted";
37
38
  task: string;
38
39
  schedule: string;
39
40
  timezone: string;
@@ -44,6 +45,7 @@ export declare function createSlackScheduleDeleteTaskTool(context: SchedulerTool
44
45
  visibility: "public" | "private";
45
46
  };
46
47
  credential_mode: "system" | "creator";
48
+ dashboard_url: string | null;
47
49
  last_run_at: string | null;
48
50
  run_now_at: string | null;
49
51
  };
@@ -8,7 +8,7 @@ export declare function createSlackScheduleListTasksTool(context: SchedulerToolC
8
8
  target: string;
9
9
  tasks: {
10
10
  id: string;
11
- status: "blocked" | "active" | "deleted";
11
+ status: "completed" | "blocked" | "active" | "deleted";
12
12
  task: string;
13
13
  schedule: string;
14
14
  timezone: string;
@@ -19,6 +19,7 @@ export declare function createSlackScheduleListTasksTool(context: SchedulerToolC
19
19
  visibility: "public" | "private";
20
20
  };
21
21
  credential_mode: "system" | "creator";
22
+ dashboard_url: string | null;
22
23
  last_run_at: string | null;
23
24
  run_now_at: string | null;
24
25
  }[];
@@ -31,7 +32,7 @@ export declare function createSlackScheduleListTasksTool(context: SchedulerToolC
31
32
  target: string;
32
33
  tasks: {
33
34
  id: string;
34
- status: "blocked" | "active" | "deleted";
35
+ status: "completed" | "blocked" | "active" | "deleted";
35
36
  task: string;
36
37
  schedule: string;
37
38
  timezone: string;
@@ -42,6 +43,7 @@ export declare function createSlackScheduleListTasksTool(context: SchedulerToolC
42
43
  visibility: "public" | "private";
43
44
  };
44
45
  credential_mode: "system" | "creator";
46
+ dashboard_url: string | null;
45
47
  last_run_at: string | null;
46
48
  run_now_at: string | null;
47
49
  }[];
@@ -10,7 +10,7 @@ export declare function createSlackScheduleRunTaskNowTool(context: SchedulerTool
10
10
  target: string;
11
11
  task: {
12
12
  id: string;
13
- status: "blocked" | "active" | "deleted";
13
+ status: "completed" | "blocked" | "active" | "deleted";
14
14
  task: string;
15
15
  schedule: string;
16
16
  timezone: string;
@@ -21,6 +21,7 @@ export declare function createSlackScheduleRunTaskNowTool(context: SchedulerTool
21
21
  visibility: "public" | "private";
22
22
  };
23
23
  credential_mode: "system" | "creator";
24
+ dashboard_url: string | null;
24
25
  last_run_at: string | null;
25
26
  run_now_at: string | null;
26
27
  };
@@ -33,7 +34,7 @@ export declare function createSlackScheduleRunTaskNowTool(context: SchedulerTool
33
34
  target: string;
34
35
  task: {
35
36
  id: string;
36
- status: "blocked" | "active" | "deleted";
37
+ status: "completed" | "blocked" | "active" | "deleted";
37
38
  task: string;
38
39
  schedule: string;
39
40
  timezone: string;
@@ -44,6 +45,7 @@ export declare function createSlackScheduleRunTaskNowTool(context: SchedulerTool
44
45
  visibility: "public" | "private";
45
46
  };
46
47
  credential_mode: "system" | "creator";
48
+ dashboard_url: string | null;
47
49
  last_run_at: string | null;
48
50
  run_now_at: string | null;
49
51
  };
@@ -36,7 +36,7 @@ export declare function createSlackScheduleUpdateTaskTool(context: SchedulerTool
36
36
  target: string;
37
37
  task: {
38
38
  id: string;
39
- status: "blocked" | "active" | "deleted";
39
+ status: "completed" | "blocked" | "active" | "deleted";
40
40
  task: string;
41
41
  schedule: string;
42
42
  timezone: string;
@@ -47,6 +47,7 @@ export declare function createSlackScheduleUpdateTaskTool(context: SchedulerTool
47
47
  visibility: "public" | "private";
48
48
  };
49
49
  credential_mode: "system" | "creator";
50
+ dashboard_url: string | null;
50
51
  last_run_at: string | null;
51
52
  run_now_at: string | null;
52
53
  };
@@ -59,7 +60,7 @@ export declare function createSlackScheduleUpdateTaskTool(context: SchedulerTool
59
60
  target: string;
60
61
  task: {
61
62
  id: string;
62
- status: "blocked" | "active" | "deleted";
63
+ status: "completed" | "blocked" | "active" | "deleted";
63
64
  task: string;
64
65
  schedule: string;
65
66
  timezone: string;
@@ -70,6 +71,7 @@ export declare function createSlackScheduleUpdateTaskTool(context: SchedulerTool
70
71
  visibility: "public" | "private";
71
72
  };
72
73
  credential_mode: "system" | "creator";
74
+ dashboard_url: string | null;
73
75
  last_run_at: string | null;
74
76
  run_now_at: string | null;
75
77
  };
@@ -1,7 +1,7 @@
1
1
  /** Durable scheduled-task domain types owned by Junior core. */
2
2
  import type { SlackDestination, SystemActor } from "@sentry/junior-plugin-api";
3
3
  import { z } from "zod";
4
- export type ScheduledTaskStatus = "active" | "blocked" | "deleted";
4
+ export type ScheduledTaskStatus = "active" | "blocked" | "completed" | "deleted";
5
5
  export declare const scheduledTaskCredentialModeSchema: z.ZodEnum<{
6
6
  system: "system";
7
7
  creator: "creator";
@@ -7,3 +7,5 @@ export interface DashboardConversationLinkOptions {
7
7
  export declare function setDashboardConversationLinkOptions(options: DashboardConversationLinkOptions | undefined): DashboardConversationLinkOptions | undefined;
8
8
  /** Build the dashboard conversation URL when the core dashboard is enabled. */
9
9
  export declare function getDashboardConversationLink(conversationId: string): string | undefined;
10
+ /** Build the dashboard task detail URL when the core dashboard is enabled. */
11
+ export declare function getDashboardTaskLink(taskId: string): string | undefined;
@@ -1,6 +1,6 @@
1
- /** Storage prefix shared by turn-session records and their indexes. */
1
+ /** Storage prefix for resumable turn-session state. */
2
2
  export declare const AGENT_TURN_SESSION_PREFIX = "junior:agent_turn_session";
3
3
  /** Return the durable key for one resumable turn-session record. */
4
4
  export declare function agentTurnSessionKey(conversationId: string, sessionId: string): string;
5
- /** Return the index key for every turn session owned by one conversation. */
5
+ /** Return the recovery index key for turn sessions in one conversation. */
6
6
  export declare function agentTurnSessionConversationIndexKey(conversationId: string): string;
@@ -7,7 +7,6 @@
7
7
  * `junior_conversation_events` so resumes can materialize the exact continuable
8
8
  * boundary without duplicating the event history.
9
9
  */
10
- import { type StateAdapter } from "chat";
11
10
  import { type Destination, type Source } from "@sentry/junior-plugin-api";
12
11
  import { type PiMessage } from "@/chat/pi/messages";
13
12
  import { type Actor } from "@/chat/actor";
@@ -42,11 +41,9 @@ export interface AgentTurnSessionRecord {
42
41
  * All distinct actors annotated on this run's committed instruction-authority
43
42
  * messages, in first-seen order. Persisted as an attribution handle so a
44
43
  * summary-only handoff cannot erase them. It never grants authority or
45
- * replaces the singular execution actor.
44
+ * replaces the singular execution actor, which is rebuilt at resume.
46
45
  */
47
46
  actors: Actor[];
48
- /** The single actor this run executes as (credential binding, auth flows). */
49
- actor?: Actor;
50
47
  resumeReason?: AgentTurnResumeReason;
51
48
  resumedFromSliceId?: number;
52
49
  sessionId: string;
@@ -58,7 +55,20 @@ export interface AgentTurnSessionRecord {
58
55
  turnStartMessageIndex?: number;
59
56
  updatedAtMs: number;
60
57
  }
61
- export type AgentTurnSessionSummary = Omit<AgentTurnSessionRecord, "errorMessage" | "actors" | "piMessages" | "piMessageProvenance" | "turnStartMessageIndex">;
58
+ export interface AgentTurnSessionSummary {
59
+ conversationId: string;
60
+ dispatchId?: string;
61
+ dispatchOutcome?: AgentDispatchOutcome;
62
+ /** Provider-owned identifier returned after visible delivery is accepted. */
63
+ resultMessageId?: string;
64
+ resumeReason?: AgentTurnResumeReason;
65
+ sessionId: string;
66
+ sliceId: number;
67
+ state: AgentTurnSessionStatus;
68
+ surface?: AgentTurnSurface;
69
+ updatedAtMs: number;
70
+ version: number;
71
+ }
62
72
  /** Read a turn record pinned to the history version containing its checkpoint. */
63
73
  export declare function getAgentTurnSessionRecord(conversationId: string, sessionId: string): Promise<AgentTurnSessionRecord | undefined>;
64
74
  /** Read a turn session for resume, following a newer committed replacement while unfinished. */
@@ -126,14 +136,8 @@ export declare function recordAgentTurnSessionSummary(args: {
126
136
  traceId?: string;
127
137
  ttlMs?: number;
128
138
  }): Promise<void>;
129
- /** List recent turn-session summaries for authenticated operational dashboards. */
130
- export declare function listAgentTurnSessionSummaries(limit?: number): Promise<AgentTurnSessionSummary[]>;
131
- /** List turn-session summaries for one conversation without the global feed cap. */
139
+ /** List retained turn-session recovery projections for one conversation. */
132
140
  export declare function listAgentTurnSessionSummariesForConversation(conversationId: string): Promise<AgentTurnSessionSummary[]>;
133
- /** List retained run summaries without falling back to global history. */
134
- export declare function listBoundedAgentTurnSessionSummariesForConversation(conversationId: string): Promise<AgentTurnSessionSummary[]>;
135
- /** Read complete per-conversation summary indexes with bounded backend load. */
136
- export declare function listAgentTurnSessionSummariesForConversations(stateAdapter: StateAdapter, conversationIds: string[]): Promise<Map<string, AgentTurnSessionSummary[]>>;
137
141
  /** Mark an unfinished turn session record as abandoned when a newer turn wins. */
138
142
  export declare function abandonAgentTurnSessionRecord(args: {
139
143
  conversationId: string;
@@ -1,4 +1,6 @@
1
+ import { type TaskExecutionStatus } from "@/db/schema/task-executions";
1
2
  export declare const TASK_EXECUTION_TYPES: readonly ["scheduled", "event"];
3
+ export declare const TASK_EXECUTION_STATUSES: readonly ["blocked", "completed", "failed"];
2
4
  export type TaskExecutionType = (typeof TASK_EXECUTION_TYPES)[number];
3
5
  export type TaskExecutionDay = {
4
6
  date: string;
@@ -11,18 +13,47 @@ export type TaskExecutionSummary = {
11
13
  runsLast7Days: number;
12
14
  totalRuns: number;
13
15
  };
14
- /** Record one successful task execution and its durable conversation. */
16
+ export type TaskExecutionRecord = {
17
+ conversationId?: string;
18
+ executedAt: string;
19
+ executionId: string;
20
+ status: TaskExecutionStatus;
21
+ title?: string;
22
+ };
23
+ export type TaskExecutionStatusDay = {
24
+ blocked: number;
25
+ completed: number;
26
+ date: string;
27
+ failed: number;
28
+ };
29
+ /** Record one terminal task execution and its durable conversation when present. */
15
30
  export declare function recordTaskExecution(type: TaskExecutionType, taskId: string, options: {
16
- conversationId: string;
31
+ conversationId?: string;
17
32
  executionId: string;
18
33
  namespace?: string;
19
34
  nowMs?: number;
35
+ status?: TaskExecutionStatus;
20
36
  }): Promise<void>;
21
37
  /** Load usage analytics for all tasks of one type and namespace. */
22
38
  export declare function readTaskExecutionSummaries(type: TaskExecutionType, namespace: string, options?: {
23
39
  nowMs?: number;
24
40
  }): Promise<Map<string, TaskExecutionSummary>>;
25
- /** Load a fixed trailing window of successful executions stacked by task type. */
41
+ /** Load a fixed trailing window of completed executions stacked by task type. */
26
42
  export declare function readTaskExecutionDays(dayCount?: number, options?: {
27
43
  nowMs?: number;
28
44
  }): Promise<TaskExecutionDay[]>;
45
+ /** Load newest-first executions for one task, with conversation titles when present. */
46
+ export declare function readTaskExecutions(args: {
47
+ kind: TaskExecutionType;
48
+ limit: number;
49
+ namespace?: string;
50
+ taskId: string;
51
+ }): Promise<TaskExecutionRecord[]>;
52
+ /** Load a fixed trailing window of terminal executions for one task by status. */
53
+ export declare function readTaskExecutionStatusDays(args: {
54
+ dayCount?: number;
55
+ kind: TaskExecutionType;
56
+ namespace?: string;
57
+ nowMs?: number;
58
+ taskId: string;
59
+ }): Promise<TaskExecutionStatusDay[]>;
@@ -1,9 +1,11 @@
1
1
  import type { User } from "@sentry/junior-plugin-api";
2
- import type { TaskList } from "@/api/schema/task";
2
+ import type { TaskExecutionList, TaskList } from "@/api/schema/task";
3
3
  /** Read viewer-owned and public-workspace tasks as one bounded newest-first projection. */
4
4
  export declare function readViewerTasks(user: User): Promise<TaskList>;
5
5
  export declare class ViewerTaskNotFoundError extends Error {
6
6
  constructor();
7
7
  }
8
+ /** Read one viewer-visible task and its newest terminal executions. */
9
+ export declare function readViewerTaskExecutions(user: User, kind: "scheduled" | "event", id: string): Promise<TaskExecutionList>;
8
10
  /** Delete one viewer-owned scheduled or event task. */
9
11
  export declare function deleteViewerTask(user: User, kind: "scheduled" | "event", id: string): Promise<void>;