@sentry/junior 0.134.0 → 0.136.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.
- package/dist/{agent-hooks-HGXNYOOD.js → agent-hooks-TQSI2FKN.js} +9 -9
- package/dist/api/schema/task.d.ts +0 -24
- package/dist/api/schema.d.ts +2 -2
- package/dist/api/schema.js +1 -3
- package/dist/api.js +20 -71
- package/dist/app.js +26 -25
- package/dist/{catalog-runtime-P6QHU6XE.js → catalog-runtime-VXL5EO2X.js} +5 -5
- package/dist/chat/tasks/execution-stats.d.ts +1 -2
- package/dist/{chunk-NYWSCJVW.js → chunk-2E5D3Z3U.js} +1 -1
- package/dist/{chunk-NF2TNZPD.js → chunk-3NLQQ7DC.js} +14 -14
- package/dist/{chunk-7GKQ7UIO.js → chunk-3TOCJOYJ.js} +4 -4
- package/dist/{chunk-MFERLE3G.js → chunk-3UUDZPO5.js} +1 -1
- package/dist/{chunk-VPYKNCTN.js → chunk-4ULSYOL6.js} +3 -3
- package/dist/{chunk-VP6NCPRS.js → chunk-4VDQGQHY.js} +1 -1
- package/dist/{chunk-FDNAUM7X.js → chunk-5I3MXBNV.js} +1 -1
- package/dist/chunk-6ABWAONM.js +233 -0
- package/dist/{chunk-TR6UEEYD.js → chunk-76Y5A57F.js} +5 -5
- package/dist/{chunk-6T3AYZT7.js → chunk-BECYUPSQ.js} +1 -1
- package/dist/{chunk-QLEKAO7O.js → chunk-BTBTQEXF.js} +13 -7
- package/dist/{chunk-KWGJG4HO.js → chunk-CGZ6O74P.js} +3 -3
- package/dist/{chunk-YNLQQ622.js → chunk-CTKCGKWB.js} +4 -4
- package/dist/{chunk-GSP5SMZJ.js → chunk-DO37VD6O.js} +1 -1
- package/dist/{chunk-VGXJMECA.js → chunk-HEGTNY2S.js} +7 -7
- package/dist/{chunk-VEGF62FV.js → chunk-IUSO5QUB.js} +1 -1
- package/dist/{chunk-LKK4XMUV.js → chunk-KRUSDASP.js} +1 -1
- package/dist/{chunk-S6DMTEOM.js → chunk-QCX3TRIM.js} +2 -2
- package/dist/{chunk-XG5PHKPM.js → chunk-QE4DN7JQ.js} +2 -2
- package/dist/{chunk-7UTBPDXK.js → chunk-TRZSM67C.js} +0 -13
- package/dist/{chunk-52DIKFJV.js → chunk-UIAZI7UJ.js} +6 -14
- package/dist/{chunk-FL466XX5.js → chunk-XRC4TXJ4.js} +12 -12
- package/dist/{chunk-U3ZI7CCW.js → chunk-ZIYDJIWQ.js} +1 -1
- package/dist/cli/chat.js +24 -24
- package/dist/cli/check.js +6 -6
- package/dist/cli/plugins.js +12 -12
- package/dist/cli/snapshot-create.js +9 -9
- package/dist/cli/upgrade.js +7 -7
- package/dist/{db-GFK4NHWJ.js → db-NN6T27OO.js} +7 -7
- package/dist/instrumentation.js +4 -4
- package/dist/nitro.js +2 -2
- package/dist/{oauth-callback-server-HUJLAQ5N.js → oauth-callback-server-VJQ27ITN.js} +17 -18
- package/dist/{runner-T77AFAH4.js → runner-ZHI3GQII.js} +11 -12
- package/dist/{skills-3KUFJOOR.js → skills-YT5ZSNAW.js} +6 -6
- package/dist/{validation-FMWDHKYU.js → validation-EKUNT5IY.js} +6 -6
- package/dist/version.js +1 -1
- package/migrations/0020_restrict_task_execution_kinds.sql +2 -0
- package/migrations/meta/0020_snapshot.json +1848 -0
- package/migrations/meta/_journal.json +8 -1
- package/package.json +5 -5
- package/dist/chat/tasks/registered.d.ts +0 -3
- package/dist/chunk-AS3I7OIL.js +0 -115
- package/dist/chunk-NOA34AJY.js +0 -122
|
@@ -5,12 +5,12 @@ import {
|
|
|
5
5
|
juniorConversations,
|
|
6
6
|
juniorIdentities,
|
|
7
7
|
juniorUsers
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-BTBTQEXF.js";
|
|
9
9
|
import {
|
|
10
10
|
TURN_REASONING_LEVELS,
|
|
11
11
|
getChatConfig,
|
|
12
12
|
modelProfileSchema
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-QE4DN7JQ.js";
|
|
14
14
|
import {
|
|
15
15
|
juniorDestinations
|
|
16
16
|
} from "./chunk-VFUK3X5B.js";
|
|
@@ -20,7 +20,7 @@ import {
|
|
|
20
20
|
} from "./chunk-F3B2YJ76.js";
|
|
21
21
|
import {
|
|
22
22
|
normalizeIdentityEmail
|
|
23
|
-
} from "./chunk-
|
|
23
|
+
} from "./chunk-BECYUPSQ.js";
|
|
24
24
|
|
|
25
25
|
// src/chat/conversations/sql/store.ts
|
|
26
26
|
import { randomUUID as randomUUID2 } from "crypto";
|
|
@@ -0,0 +1,233 @@
|
|
|
1
|
+
import {
|
|
2
|
+
healthReportSchema
|
|
3
|
+
} from "./chunk-UTL3MHPC.js";
|
|
4
|
+
import {
|
|
5
|
+
parseSlackThreadId
|
|
6
|
+
} from "./chunk-3UUDZPO5.js";
|
|
7
|
+
import {
|
|
8
|
+
normalizeSlackConversationId
|
|
9
|
+
} from "./chunk-76Y5A57F.js";
|
|
10
|
+
import {
|
|
11
|
+
getDb
|
|
12
|
+
} from "./chunk-4ULSYOL6.js";
|
|
13
|
+
import {
|
|
14
|
+
juniorTaskExecutions
|
|
15
|
+
} from "./chunk-BTBTQEXF.js";
|
|
16
|
+
import {
|
|
17
|
+
logWarn
|
|
18
|
+
} from "./chunk-BECYUPSQ.js";
|
|
19
|
+
|
|
20
|
+
// src/handlers/health.ts
|
|
21
|
+
function readHealthReport() {
|
|
22
|
+
return healthReportSchema.parse({
|
|
23
|
+
status: "ok",
|
|
24
|
+
service: "junior",
|
|
25
|
+
timestamp: (/* @__PURE__ */ new Date()).toISOString()
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
function GET() {
|
|
29
|
+
return Response.json(readHealthReport());
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
// src/chat/tasks/execution-stats.ts
|
|
33
|
+
import { and, asc, count, desc, eq, gte, lte, max, sql } from "drizzle-orm";
|
|
34
|
+
function utcDate(nowMs) {
|
|
35
|
+
return new Date(nowMs).toISOString().slice(0, 10);
|
|
36
|
+
}
|
|
37
|
+
function emptyDay(date) {
|
|
38
|
+
return { date, event: 0, scheduled: 0 };
|
|
39
|
+
}
|
|
40
|
+
async function recordTaskExecution(type, taskId, options) {
|
|
41
|
+
const namespace = options.namespace ?? "junior";
|
|
42
|
+
const nowMs = options.nowMs ?? Date.now();
|
|
43
|
+
try {
|
|
44
|
+
await getDb().insert(juniorTaskExecutions).values({
|
|
45
|
+
conversationId: options.conversationId,
|
|
46
|
+
executedAtMs: nowMs,
|
|
47
|
+
executionId: options.executionId,
|
|
48
|
+
kind: type,
|
|
49
|
+
namespace,
|
|
50
|
+
taskId
|
|
51
|
+
}).onConflictDoNothing({
|
|
52
|
+
target: [
|
|
53
|
+
juniorTaskExecutions.kind,
|
|
54
|
+
juniorTaskExecutions.namespace,
|
|
55
|
+
juniorTaskExecutions.executionId
|
|
56
|
+
]
|
|
57
|
+
});
|
|
58
|
+
} catch (error) {
|
|
59
|
+
logWarn("task.execution.stat_failed", {
|
|
60
|
+
error,
|
|
61
|
+
"app.task.execution.id": options.executionId,
|
|
62
|
+
"app.task.execution.namespace": namespace,
|
|
63
|
+
"app.task.execution.task_id": taskId,
|
|
64
|
+
"app.task.execution.type": type
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
async function readTaskExecutionSummaries(type, namespace, options = {}) {
|
|
69
|
+
const sevenDaysAgoMs = (options.nowMs ?? Date.now()) - 7 * 24 * 60 * 60 * 1e3;
|
|
70
|
+
const db = getDb();
|
|
71
|
+
const latest = db.selectDistinctOn([juniorTaskExecutions.taskId], {
|
|
72
|
+
conversationId: juniorTaskExecutions.conversationId,
|
|
73
|
+
taskId: juniorTaskExecutions.taskId
|
|
74
|
+
}).from(juniorTaskExecutions).where(
|
|
75
|
+
and(
|
|
76
|
+
eq(juniorTaskExecutions.kind, type),
|
|
77
|
+
eq(juniorTaskExecutions.namespace, namespace)
|
|
78
|
+
)
|
|
79
|
+
).orderBy(
|
|
80
|
+
juniorTaskExecutions.taskId,
|
|
81
|
+
desc(juniorTaskExecutions.executedAtMs),
|
|
82
|
+
desc(juniorTaskExecutions.executionId)
|
|
83
|
+
).as("latest_task_execution");
|
|
84
|
+
const rows = await db.select({
|
|
85
|
+
lastConversationId: latest.conversationId,
|
|
86
|
+
lastExecutedAtMs: max(juniorTaskExecutions.executedAtMs),
|
|
87
|
+
runsLast7Days: sql`count(*) filter (where ${juniorTaskExecutions.executedAtMs} >= ${sevenDaysAgoMs})::int`,
|
|
88
|
+
taskId: juniorTaskExecutions.taskId,
|
|
89
|
+
totalRuns: sql`count(*)::int`
|
|
90
|
+
}).from(juniorTaskExecutions).innerJoin(latest, eq(latest.taskId, juniorTaskExecutions.taskId)).where(
|
|
91
|
+
and(
|
|
92
|
+
eq(juniorTaskExecutions.kind, type),
|
|
93
|
+
eq(juniorTaskExecutions.namespace, namespace)
|
|
94
|
+
)
|
|
95
|
+
).groupBy(juniorTaskExecutions.taskId, latest.conversationId);
|
|
96
|
+
return new Map(
|
|
97
|
+
rows.map((row) => [
|
|
98
|
+
row.taskId,
|
|
99
|
+
{
|
|
100
|
+
lastConversationId: row.lastConversationId,
|
|
101
|
+
...row.lastExecutedAtMs !== null ? { lastExecutedAtMs: row.lastExecutedAtMs } : {},
|
|
102
|
+
runsLast7Days: row.runsLast7Days,
|
|
103
|
+
totalRuns: row.totalRuns
|
|
104
|
+
}
|
|
105
|
+
])
|
|
106
|
+
);
|
|
107
|
+
}
|
|
108
|
+
async function readTaskExecutionDays(dayCount = 90, options = {}) {
|
|
109
|
+
const nowMs = options.nowMs ?? Date.now();
|
|
110
|
+
const end = utcDate(nowMs);
|
|
111
|
+
const endMs = Date.parse(`${end}T23:59:59.999Z`);
|
|
112
|
+
const startMs = Date.parse(`${end}T00:00:00.000Z`) - (dayCount - 1) * 864e5;
|
|
113
|
+
const executionDate = sql`to_char(to_timestamp(${juniorTaskExecutions.executedAtMs} / 1000.0) at time zone 'UTC', 'YYYY-MM-DD')`;
|
|
114
|
+
const rows = await getDb().select({
|
|
115
|
+
count: count(),
|
|
116
|
+
date: executionDate,
|
|
117
|
+
kind: juniorTaskExecutions.kind
|
|
118
|
+
}).from(juniorTaskExecutions).where(
|
|
119
|
+
and(
|
|
120
|
+
gte(juniorTaskExecutions.executedAtMs, startMs),
|
|
121
|
+
lte(juniorTaskExecutions.executedAtMs, endMs)
|
|
122
|
+
)
|
|
123
|
+
).groupBy(executionDate, juniorTaskExecutions.kind).orderBy(asc(executionDate), asc(juniorTaskExecutions.kind));
|
|
124
|
+
const byDate = /* @__PURE__ */ new Map();
|
|
125
|
+
for (let offset = 0; offset < dayCount; offset += 1) {
|
|
126
|
+
const date = utcDate(startMs + offset * 864e5);
|
|
127
|
+
byDate.set(date, emptyDay(date));
|
|
128
|
+
}
|
|
129
|
+
for (const row of rows) {
|
|
130
|
+
const day = byDate.get(row.date);
|
|
131
|
+
if (!day) continue;
|
|
132
|
+
if (row.kind === "scheduled") day.scheduled = row.count;
|
|
133
|
+
else if (row.kind === "event") day.event = row.count;
|
|
134
|
+
}
|
|
135
|
+
return [...byDate.values()];
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
// src/chat/slack/conversation-context.ts
|
|
139
|
+
function normalizeConversationName(type, channelName) {
|
|
140
|
+
const trimmed = channelName?.trim();
|
|
141
|
+
if (!trimmed) return void 0;
|
|
142
|
+
if (type === "public_channel" || type === "private_channel" || type === "private_channel_or_group_dm") {
|
|
143
|
+
return trimmed.startsWith("#") ? trimmed : `#${trimmed}`;
|
|
144
|
+
}
|
|
145
|
+
return trimmed;
|
|
146
|
+
}
|
|
147
|
+
function typeFromSlackChannelType(channelType) {
|
|
148
|
+
if (channelType === "channel") return "public_channel";
|
|
149
|
+
if (channelType === "group") return "private_channel";
|
|
150
|
+
if (channelType === "mpim") return "group_dm";
|
|
151
|
+
if (channelType === "im") return "direct_message";
|
|
152
|
+
return void 0;
|
|
153
|
+
}
|
|
154
|
+
function typeFromChannelId(channelId, channelName) {
|
|
155
|
+
const normalized = normalizeSlackConversationId(channelId);
|
|
156
|
+
if (!normalized) return void 0;
|
|
157
|
+
if (normalized.startsWith("C")) return "public_channel";
|
|
158
|
+
if (normalized.startsWith("D")) return "direct_message";
|
|
159
|
+
if (normalized.startsWith("G")) {
|
|
160
|
+
return channelName?.trim().startsWith("mpdm-") ? "group_dm" : "private_channel_or_group_dm";
|
|
161
|
+
}
|
|
162
|
+
return void 0;
|
|
163
|
+
}
|
|
164
|
+
function toSlackEventChannelType(channelType) {
|
|
165
|
+
if (channelType === "channel" || channelType === "group" || channelType === "mpim" || channelType === "im") {
|
|
166
|
+
return channelType;
|
|
167
|
+
}
|
|
168
|
+
return void 0;
|
|
169
|
+
}
|
|
170
|
+
function conversationVisibilityFromSlackChannelType(channelType) {
|
|
171
|
+
if (!channelType) return void 0;
|
|
172
|
+
return channelType === "channel" ? "public" : "private";
|
|
173
|
+
}
|
|
174
|
+
function resolveSlackChannelTypeFromMessage(message) {
|
|
175
|
+
const raw = message.raw;
|
|
176
|
+
if (!raw || typeof raw !== "object") {
|
|
177
|
+
return void 0;
|
|
178
|
+
}
|
|
179
|
+
const channelType = raw.channel_type;
|
|
180
|
+
return typeof channelType === "string" ? toSlackEventChannelType(channelType.trim()) : void 0;
|
|
181
|
+
}
|
|
182
|
+
function resolveSlackConversationContext(input) {
|
|
183
|
+
const type = typeFromSlackChannelType(input.channelType) ?? typeFromChannelId(input.channelId, input.channelName);
|
|
184
|
+
if (!type) return void 0;
|
|
185
|
+
const name = normalizeConversationName(type, input.channelName);
|
|
186
|
+
const visibility = conversationVisibilityFromSlackChannelType(
|
|
187
|
+
input.channelType
|
|
188
|
+
);
|
|
189
|
+
return {
|
|
190
|
+
type,
|
|
191
|
+
...name ? { name } : {},
|
|
192
|
+
...visibility ? { visibility } : {}
|
|
193
|
+
};
|
|
194
|
+
}
|
|
195
|
+
function resolveSlackConversationContextFromThreadId(input) {
|
|
196
|
+
const slackThread = parseSlackThreadId(input.threadId);
|
|
197
|
+
const context = resolveSlackConversationContext({
|
|
198
|
+
channelId: slackThread?.channelId,
|
|
199
|
+
channelName: input.channelName
|
|
200
|
+
});
|
|
201
|
+
if (!context || !input.visibility) {
|
|
202
|
+
return context;
|
|
203
|
+
}
|
|
204
|
+
return {
|
|
205
|
+
...context,
|
|
206
|
+
type: input.visibility === "private" && context.type === "public_channel" ? "private_channel" : context.type,
|
|
207
|
+
visibility: input.visibility
|
|
208
|
+
};
|
|
209
|
+
}
|
|
210
|
+
function formatSlackConversationTypeLabel(type) {
|
|
211
|
+
if (type === "public_channel") return "Public Channel";
|
|
212
|
+
if (type === "private_channel") return "Private Channel";
|
|
213
|
+
if (type === "group_dm") return "Group DM";
|
|
214
|
+
if (type === "direct_message") return "Direct Message";
|
|
215
|
+
return "Private Channel or Group DM";
|
|
216
|
+
}
|
|
217
|
+
function formatSlackConversationRedactedLabel(context) {
|
|
218
|
+
if (!context) return void 0;
|
|
219
|
+
return formatSlackConversationTypeLabel(context.type);
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
export {
|
|
223
|
+
readHealthReport,
|
|
224
|
+
GET,
|
|
225
|
+
recordTaskExecution,
|
|
226
|
+
readTaskExecutionSummaries,
|
|
227
|
+
readTaskExecutionDays,
|
|
228
|
+
conversationVisibilityFromSlackChannelType,
|
|
229
|
+
resolveSlackChannelTypeFromMessage,
|
|
230
|
+
resolveSlackConversationContext,
|
|
231
|
+
resolveSlackConversationContextFromThreadId,
|
|
232
|
+
formatSlackConversationRedactedLabel
|
|
233
|
+
};
|
|
@@ -1,25 +1,25 @@
|
|
|
1
1
|
import {
|
|
2
2
|
getConversationEventStore,
|
|
3
3
|
getDb
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-4ULSYOL6.js";
|
|
5
5
|
import {
|
|
6
6
|
juniorConversationAnnotations,
|
|
7
7
|
juniorConversationEvents,
|
|
8
8
|
juniorIdentities,
|
|
9
9
|
juniorUsers
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-BTBTQEXF.js";
|
|
11
11
|
import {
|
|
12
12
|
SANDBOX_WORKSPACE_ROOT,
|
|
13
13
|
getStateAdapter,
|
|
14
14
|
sleep
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-5I3MXBNV.js";
|
|
16
16
|
import {
|
|
17
17
|
botConfig,
|
|
18
18
|
completeObject,
|
|
19
19
|
embedTexts,
|
|
20
20
|
getSlackBotToken,
|
|
21
21
|
standardModelId
|
|
22
|
-
} from "./chunk-
|
|
22
|
+
} from "./chunk-QE4DN7JQ.js";
|
|
23
23
|
import {
|
|
24
24
|
isActorUserId,
|
|
25
25
|
parseActorUserId
|
|
@@ -37,7 +37,7 @@ import {
|
|
|
37
37
|
setSpanAttributes,
|
|
38
38
|
setSpanStatus,
|
|
39
39
|
withSpan
|
|
40
|
-
} from "./chunk-
|
|
40
|
+
} from "./chunk-BECYUPSQ.js";
|
|
41
41
|
|
|
42
42
|
// src/chat/plugins/agent-hooks.ts
|
|
43
43
|
import {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
DEFAULT_SQL_STATEMENT_TIMEOUT_MS
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-QE4DN7JQ.js";
|
|
4
4
|
import {
|
|
5
5
|
juniorDestinations,
|
|
6
6
|
timestamptz
|
|
@@ -352,8 +352,10 @@ var juniorStats = pgTable9(
|
|
|
352
352
|
);
|
|
353
353
|
|
|
354
354
|
// src/db/schema/task-executions.ts
|
|
355
|
+
import { sql as sql4 } from "drizzle-orm";
|
|
355
356
|
import {
|
|
356
357
|
bigint as bigint2,
|
|
358
|
+
check,
|
|
357
359
|
foreignKey as foreignKey3,
|
|
358
360
|
index as index7,
|
|
359
361
|
pgTable as pgTable10,
|
|
@@ -371,6 +373,10 @@ var juniorTaskExecutions = pgTable10(
|
|
|
371
373
|
executedAtMs: bigint2("executed_at_ms", { mode: "number" }).notNull()
|
|
372
374
|
},
|
|
373
375
|
(table) => [
|
|
376
|
+
check(
|
|
377
|
+
"junior_task_executions_kind_check",
|
|
378
|
+
sql4`${table.kind} in ('scheduled', 'event')`
|
|
379
|
+
),
|
|
374
380
|
primaryKey5({
|
|
375
381
|
name: "junior_task_executions_kind_namespace_execution_id_pk",
|
|
376
382
|
columns: [table.kind, table.namespace, table.executionId]
|
|
@@ -398,7 +404,7 @@ var juniorTaskExecutions = pgTable10(
|
|
|
398
404
|
);
|
|
399
405
|
|
|
400
406
|
// src/db/schema/scheduled-tasks.ts
|
|
401
|
-
import { sql as
|
|
407
|
+
import { sql as sql5 } from "drizzle-orm";
|
|
402
408
|
import { bigint as bigint3, index as index8, jsonb as jsonb6, pgTable as pgTable11, text as text11 } from "drizzle-orm/pg-core";
|
|
403
409
|
var juniorSchedulerTasks = pgTable11(
|
|
404
410
|
"junior_scheduler_tasks",
|
|
@@ -416,16 +422,16 @@ var juniorSchedulerTasks = pgTable11(
|
|
|
416
422
|
},
|
|
417
423
|
(table) => [
|
|
418
424
|
// TODO(v0.128.0): Remove with creatorSlackUserId.
|
|
419
|
-
index8("junior_scheduler_tasks_creator_idx").on(table.teamId, table.creatorSlackUserId, table.createdAtMs, table.id).where(
|
|
425
|
+
index8("junior_scheduler_tasks_creator_idx").on(table.teamId, table.creatorSlackUserId, table.createdAtMs, table.id).where(sql5`${table.status} <> 'deleted'`),
|
|
420
426
|
index8("junior_scheduler_tasks_creator_identity_idx").on(table.creatorIdentityId, table.createdAtMs, table.id).where(
|
|
421
|
-
|
|
427
|
+
sql5`${table.status} <> 'deleted' AND ${table.creatorIdentityId} IS NOT NULL`
|
|
422
428
|
),
|
|
423
|
-
index8("junior_scheduler_tasks_team_status_idx").on(table.teamId, table.createdAtMs, table.id).where(
|
|
429
|
+
index8("junior_scheduler_tasks_team_status_idx").on(table.teamId, table.createdAtMs, table.id).where(sql5`${table.status} <> 'deleted'`),
|
|
424
430
|
index8("junior_scheduler_tasks_run_now_due_idx").on(table.runNowAtMs, table.createdAtMs, table.id).where(
|
|
425
|
-
|
|
431
|
+
sql5`${table.status} = 'active' AND ${table.runNowAtMs} IS NOT NULL`
|
|
426
432
|
),
|
|
427
433
|
index8("junior_scheduler_tasks_next_run_due_idx").on(table.nextRunAtMs, table.createdAtMs, table.id).where(
|
|
428
|
-
|
|
434
|
+
sql5`${table.status} = 'active' AND ${table.nextRunAtMs} IS NOT NULL`
|
|
429
435
|
)
|
|
430
436
|
]
|
|
431
437
|
);
|
|
@@ -4,16 +4,16 @@ import {
|
|
|
4
4
|
import {
|
|
5
5
|
canRouteResourceEvents,
|
|
6
6
|
getPlugins
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-76Y5A57F.js";
|
|
8
8
|
import {
|
|
9
9
|
getDb
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-4ULSYOL6.js";
|
|
11
11
|
import {
|
|
12
12
|
juniorEventTasks,
|
|
13
13
|
juniorSchedulerRuns,
|
|
14
14
|
juniorSchedulerTasks,
|
|
15
15
|
juniorStats
|
|
16
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-BTBTQEXF.js";
|
|
17
17
|
import {
|
|
18
18
|
juniorDestinations
|
|
19
19
|
} from "./chunk-VFUK3X5B.js";
|
|
@@ -2,18 +2,18 @@ import {
|
|
|
2
2
|
SANDBOX_WORKSPACE_ROOT,
|
|
3
3
|
getStateAdapter,
|
|
4
4
|
sleep
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-5I3MXBNV.js";
|
|
6
6
|
import {
|
|
7
7
|
toOptionalTrimmed
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-QE4DN7JQ.js";
|
|
9
9
|
import {
|
|
10
10
|
pluginCatalogRuntime
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-IUSO5QUB.js";
|
|
12
12
|
import {
|
|
13
13
|
setSpanAttributes,
|
|
14
14
|
setSpanStatus,
|
|
15
15
|
withSpan
|
|
16
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-BECYUPSQ.js";
|
|
17
17
|
|
|
18
18
|
// src/chat/sandbox/resources.ts
|
|
19
19
|
var configuredResources;
|
|
@@ -6,25 +6,25 @@ import {
|
|
|
6
6
|
isDmChannel,
|
|
7
7
|
normalizeSlackConversationId,
|
|
8
8
|
withSlackRetries
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-76Y5A57F.js";
|
|
10
10
|
import {
|
|
11
11
|
getDb,
|
|
12
12
|
parseDestination
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-4ULSYOL6.js";
|
|
14
14
|
import {
|
|
15
15
|
acquireActiveLock,
|
|
16
16
|
getStateAdapter,
|
|
17
17
|
sleep
|
|
18
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-5I3MXBNV.js";
|
|
19
19
|
import {
|
|
20
20
|
normalizeSlackEmojiName
|
|
21
|
-
} from "./chunk-
|
|
21
|
+
} from "./chunk-QE4DN7JQ.js";
|
|
22
22
|
import {
|
|
23
23
|
pluginCatalogRuntime
|
|
24
|
-
} from "./chunk-
|
|
24
|
+
} from "./chunk-IUSO5QUB.js";
|
|
25
25
|
import {
|
|
26
26
|
fetchWithBoundedOAuthErrorBodies
|
|
27
|
-
} from "./chunk-
|
|
27
|
+
} from "./chunk-4VDQGQHY.js";
|
|
28
28
|
import {
|
|
29
29
|
parseSlackMessageTs,
|
|
30
30
|
parseSlackUserId
|
|
@@ -33,7 +33,7 @@ import {
|
|
|
33
33
|
isRecord,
|
|
34
34
|
logInfo,
|
|
35
35
|
logWarn
|
|
36
|
-
} from "./chunk-
|
|
36
|
+
} from "./chunk-BECYUPSQ.js";
|
|
37
37
|
|
|
38
38
|
// src/chat/capabilities/router.ts
|
|
39
39
|
var ProviderCredentialRouter = class {
|
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
toCanonicalInputMessage,
|
|
4
4
|
toCanonicalOutputMessage,
|
|
5
5
|
toGenAiMessagesTraceAttributes
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-KRUSDASP.js";
|
|
7
7
|
import {
|
|
8
8
|
extractGenAiUsageAttributes,
|
|
9
9
|
logException,
|
|
@@ -11,7 +11,7 @@ import {
|
|
|
11
11
|
normalizeGenAiFinishReason,
|
|
12
12
|
serializeGenAiAttribute,
|
|
13
13
|
withSpan
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-BECYUPSQ.js";
|
|
15
15
|
|
|
16
16
|
// src/chat/config.ts
|
|
17
17
|
import { getModel as getModel2 } from "@earendil-works/pi-ai/compat";
|
|
@@ -627,25 +627,13 @@ var taskSummarySchema = z7.discriminatedUnion("kind", [
|
|
|
627
627
|
scheduledTaskSummarySchema,
|
|
628
628
|
eventTaskSummarySchema
|
|
629
629
|
]);
|
|
630
|
-
var registeredTaskSummarySchema = z7.object({
|
|
631
|
-
id: z7.string().min(1),
|
|
632
|
-
lastConversationId: z7.string().min(1).optional(),
|
|
633
|
-
lastRunAt: z7.string().datetime().optional(),
|
|
634
|
-
name: z7.string().min(1),
|
|
635
|
-
pluginDisplayName: z7.string().min(1),
|
|
636
|
-
pluginName: z7.string().min(1),
|
|
637
|
-
runsLast7Days: z7.number().int().nonnegative(),
|
|
638
|
-
totalRuns: z7.number().int().nonnegative()
|
|
639
|
-
}).strict();
|
|
640
630
|
var taskExecutionDaySchema = z7.object({
|
|
641
631
|
date: z7.string().min(1),
|
|
642
632
|
event: z7.number().int().nonnegative(),
|
|
643
|
-
registered: z7.number().int().nonnegative(),
|
|
644
633
|
scheduled: z7.number().int().nonnegative()
|
|
645
634
|
}).strict();
|
|
646
635
|
var taskListSchema = z7.object({
|
|
647
636
|
executionDays: z7.array(taskExecutionDaySchema),
|
|
648
|
-
registeredTasks: z7.array(registeredTaskSummarySchema),
|
|
649
637
|
tasks: z7.array(taskSummarySchema),
|
|
650
638
|
truncated: z7.boolean()
|
|
651
639
|
}).strict();
|
|
@@ -706,7 +694,6 @@ export {
|
|
|
706
694
|
scheduledTaskSummarySchema,
|
|
707
695
|
eventTaskSummarySchema,
|
|
708
696
|
taskSummarySchema,
|
|
709
|
-
registeredTaskSummarySchema,
|
|
710
697
|
taskListSchema,
|
|
711
698
|
taskParamsSchema,
|
|
712
699
|
statSchema,
|
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
import {
|
|
2
|
-
recordTaskExecution
|
|
3
|
-
} from "./chunk-NOA34AJY.js";
|
|
4
1
|
import {
|
|
5
2
|
pluginTaskId,
|
|
6
3
|
pluginTaskParamsSchema,
|
|
@@ -25,7 +22,7 @@ import {
|
|
|
25
22
|
persistThreadStateById,
|
|
26
23
|
stripRuntimeTurnContext,
|
|
27
24
|
updateConversationStats
|
|
28
|
-
} from "./chunk-
|
|
25
|
+
} from "./chunk-3TOCJOYJ.js";
|
|
29
26
|
import {
|
|
30
27
|
createPluginConversationEvents,
|
|
31
28
|
createPluginEmbedder,
|
|
@@ -33,26 +30,26 @@ import {
|
|
|
33
30
|
createPluginModel,
|
|
34
31
|
createPluginState,
|
|
35
32
|
getPlugins
|
|
36
|
-
} from "./chunk-
|
|
33
|
+
} from "./chunk-76Y5A57F.js";
|
|
37
34
|
import {
|
|
38
35
|
getDb,
|
|
39
36
|
sameActorIdentity
|
|
40
|
-
} from "./chunk-
|
|
37
|
+
} from "./chunk-4ULSYOL6.js";
|
|
41
38
|
import {
|
|
42
39
|
getStateAdapter
|
|
43
|
-
} from "./chunk-
|
|
40
|
+
} from "./chunk-5I3MXBNV.js";
|
|
44
41
|
import {
|
|
45
42
|
ProviderError,
|
|
46
43
|
findProviderError,
|
|
47
44
|
getProviderErrorAttributes,
|
|
48
45
|
getProviderErrorUserMessage
|
|
49
|
-
} from "./chunk-
|
|
46
|
+
} from "./chunk-QE4DN7JQ.js";
|
|
50
47
|
import {
|
|
51
48
|
parseSlackMessageTs
|
|
52
49
|
} from "./chunk-F3B2YJ76.js";
|
|
53
50
|
import {
|
|
54
51
|
buildTurnFailureResponse
|
|
55
|
-
} from "./chunk-
|
|
52
|
+
} from "./chunk-BECYUPSQ.js";
|
|
56
53
|
|
|
57
54
|
// src/chat/runtime/delivered-turn-state.ts
|
|
58
55
|
function buildDeliveredTurnStatePatch(args) {
|
|
@@ -381,11 +378,6 @@ async function processPluginTask(message, options = {}) {
|
|
|
381
378
|
await resolved.task.run(
|
|
382
379
|
taskPluginContext(resolved.plugin, message, options)
|
|
383
380
|
);
|
|
384
|
-
await recordTaskExecution("registered", message.name, {
|
|
385
|
-
conversationId: message.params.conversationId,
|
|
386
|
-
executionId: pluginTaskId(message),
|
|
387
|
-
namespace: message.plugin
|
|
388
|
-
});
|
|
389
381
|
});
|
|
390
382
|
}
|
|
391
383
|
|