@sentry/junior 0.132.0 → 0.134.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-ONXOJDR6.js → agent-hooks-HGXNYOOD.js} +9 -9
- package/dist/api/schema/task.d.ts +60 -0
- package/dist/api/schema.d.ts +2 -2
- package/dist/api/schema.js +3 -1
- package/dist/api.js +90 -20
- package/dist/app.js +110 -39
- package/dist/{catalog-runtime-BATAY4R7.js → catalog-runtime-P6QHU6XE.js} +5 -5
- package/dist/chat/agent/prompt.d.ts +7 -5
- package/dist/chat/agent/repository-context.d.ts +20 -0
- package/dist/chat/agent/sandbox.d.ts +8 -0
- package/dist/chat/agent/tools.d.ts +3 -0
- package/dist/chat/config.d.ts +2 -0
- package/dist/chat/conversations/projection.d.ts +3 -1
- package/dist/chat/conversations/sql/bindings.d.ts +13 -0
- package/dist/chat/conversations/sql/store.d.ts +3 -0
- package/dist/chat/conversations/store.d.ts +15 -0
- package/dist/chat/plugins/agent-hooks.d.ts +2 -2
- package/dist/chat/repository-instructions.d.ts +44 -0
- package/dist/chat/runtime/reply-executor.d.ts +1 -0
- package/dist/chat/runtime/slack-runtime.d.ts +2 -0
- package/dist/chat/sandbox/noninteractive-command.d.ts +2 -0
- package/dist/chat/sandbox/sandbox.d.ts +3 -0
- package/dist/chat/sandbox/session.d.ts +1 -0
- package/dist/chat/services/context-compaction.d.ts +1 -0
- package/dist/chat/slack/dispatch-turn.d.ts +1 -0
- package/dist/chat/slack/reply.d.ts +1 -1
- package/dist/chat/slack/tools/user-lookup.d.ts +2 -6
- package/dist/chat/tasks/execution-stats.d.ts +29 -0
- package/dist/chat/tasks/registered.d.ts +3 -0
- package/dist/chat/tools/index.d.ts +2 -0
- package/dist/chat/tools/sandbox/bash.d.ts +1 -0
- package/dist/chat/tools/system-time.d.ts +11 -1
- package/dist/{chunk-O2UXPUVQ.js → chunk-52DIKFJV.js} +14 -6
- package/dist/{chunk-GOEZU33G.js → chunk-6T3AYZT7.js} +1 -1
- package/dist/{chunk-GPXVDJML.js → chunk-7GKQ7UIO.js} +449 -39
- package/dist/{chunk-QVEXYYFM.js → chunk-7UTBPDXK.js} +24 -1
- package/dist/{chunk-U76PS7AT.js → chunk-AS3I7OIL.js} +2 -2
- package/dist/{chunk-HX236W2U.js → chunk-CDQ4YIZM.js} +9 -0
- package/dist/{chunk-ODIP5CEM.js → chunk-FDNAUM7X.js} +32 -32
- package/dist/{chunk-GTKNPQNN.js → chunk-FL466XX5.js} +36 -24
- package/dist/{chunk-2425Q4OR.js → chunk-GSP5SMZJ.js} +1 -1
- package/dist/{chunk-XN656LB4.js → chunk-KWGJG4HO.js} +6 -12
- package/dist/{chunk-ISNRPCPG.js → chunk-LKK4XMUV.js} +1 -1
- package/dist/{chunk-G3WYA2RS.js → chunk-MFERLE3G.js} +1 -1
- package/dist/{chunk-ZMV2YBT6.js → chunk-NF2TNZPD.js} +788 -674
- package/dist/chunk-NOA34AJY.js +122 -0
- package/dist/{chunk-JYQAE2ZU.js → chunk-NYWSCJVW.js} +1 -1
- package/dist/{chunk-KB2M27DL.js → chunk-QLEKAO7O.js} +130 -40
- package/dist/{chunk-BKE47OOW.js → chunk-S6DMTEOM.js} +2 -2
- package/dist/{chunk-ALDPUN3Z.js → chunk-TR6UEEYD.js} +8 -6
- package/dist/{chunk-WEJIS7OC.js → chunk-U3ZI7CCW.js} +1 -1
- package/dist/{chunk-B7IY6SVJ.js → chunk-VEGF62FV.js} +1 -1
- package/dist/{chunk-SKWIIUS7.js → chunk-VGXJMECA.js} +7 -7
- package/dist/{chunk-V44FFBO3.js → chunk-VP6NCPRS.js} +1 -1
- package/dist/{chunk-WYQP7QSB.js → chunk-VPYKNCTN.js} +101 -61
- package/dist/{chunk-NNHUGGO4.js → chunk-XG5PHKPM.js} +19 -3
- package/dist/{chunk-AW5Z3T7V.js → chunk-YNLQQ622.js} +9 -8
- package/dist/cli/chat.js +25 -25
- package/dist/cli/check.js +6 -6
- package/dist/cli/init.js +1 -1
- package/dist/cli/plugins.js +12 -12
- package/dist/cli/snapshot-create.js +9 -9
- package/dist/cli/upgrade.js +9 -8
- package/dist/db/executor.d.ts +2 -1
- package/dist/db/neon.d.ts +1 -0
- package/dist/db/postgres.d.ts +1 -0
- package/dist/db/schema/conversation-bindings.d.ts +110 -0
- package/dist/db/schema/task-executions.d.ts +110 -0
- package/dist/db/schema.d.ts +221 -1
- package/dist/{db-QFFZACXF.js → db-GFK4NHWJ.js} +7 -7
- package/dist/instrumentation.js +4 -4
- package/dist/nitro.js +2 -2
- package/dist/{oauth-callback-server-5WXLD533.js → oauth-callback-server-HUJLAQ5N.js} +19 -18
- package/dist/{runner-Y3LTUNAA.js → runner-T77AFAH4.js} +13 -12
- package/dist/{skills-7M5C24GM.js → skills-3KUFJOOR.js} +6 -6
- package/dist/{validation-MRILMYDI.js → validation-FMWDHKYU.js} +6 -6
- package/dist/version.js +1 -1
- package/migrations/0018_curvy_excalibur.sql +12 -0
- package/migrations/0019_lowly_valkyrie.sql +14 -0
- package/migrations/meta/0018_snapshot.json +1756 -0
- package/migrations/meta/0019_snapshot.json +1904 -0
- package/migrations/meta/_journal.json +15 -1
- package/package.json +5 -5
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
import {
|
|
2
|
+
getDb
|
|
3
|
+
} from "./chunk-VPYKNCTN.js";
|
|
4
|
+
import {
|
|
5
|
+
juniorTaskExecutions
|
|
6
|
+
} from "./chunk-QLEKAO7O.js";
|
|
7
|
+
import {
|
|
8
|
+
logWarn
|
|
9
|
+
} from "./chunk-6T3AYZT7.js";
|
|
10
|
+
|
|
11
|
+
// src/chat/tasks/execution-stats.ts
|
|
12
|
+
import { and, asc, count, desc, eq, gte, lte, max, sql } from "drizzle-orm";
|
|
13
|
+
function utcDate(nowMs) {
|
|
14
|
+
return new Date(nowMs).toISOString().slice(0, 10);
|
|
15
|
+
}
|
|
16
|
+
function emptyDay(date) {
|
|
17
|
+
return { date, event: 0, registered: 0, scheduled: 0 };
|
|
18
|
+
}
|
|
19
|
+
async function recordTaskExecution(type, taskId, options) {
|
|
20
|
+
const namespace = options.namespace ?? "junior";
|
|
21
|
+
const nowMs = options.nowMs ?? Date.now();
|
|
22
|
+
try {
|
|
23
|
+
await getDb().insert(juniorTaskExecutions).values({
|
|
24
|
+
conversationId: options.conversationId,
|
|
25
|
+
executedAtMs: nowMs,
|
|
26
|
+
executionId: options.executionId,
|
|
27
|
+
kind: type,
|
|
28
|
+
namespace,
|
|
29
|
+
taskId
|
|
30
|
+
}).onConflictDoNothing({
|
|
31
|
+
target: [
|
|
32
|
+
juniorTaskExecutions.kind,
|
|
33
|
+
juniorTaskExecutions.namespace,
|
|
34
|
+
juniorTaskExecutions.executionId
|
|
35
|
+
]
|
|
36
|
+
});
|
|
37
|
+
} catch (error) {
|
|
38
|
+
logWarn("task.execution.stat_failed", {
|
|
39
|
+
error,
|
|
40
|
+
"app.task.execution.id": options.executionId,
|
|
41
|
+
"app.task.execution.namespace": namespace,
|
|
42
|
+
"app.task.execution.task_id": taskId,
|
|
43
|
+
"app.task.execution.type": type
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
async function readTaskExecutionSummaries(type, namespace, options = {}) {
|
|
48
|
+
const sevenDaysAgoMs = (options.nowMs ?? Date.now()) - 7 * 24 * 60 * 60 * 1e3;
|
|
49
|
+
const db = getDb();
|
|
50
|
+
const latest = db.selectDistinctOn([juniorTaskExecutions.taskId], {
|
|
51
|
+
conversationId: juniorTaskExecutions.conversationId,
|
|
52
|
+
taskId: juniorTaskExecutions.taskId
|
|
53
|
+
}).from(juniorTaskExecutions).where(
|
|
54
|
+
and(
|
|
55
|
+
eq(juniorTaskExecutions.kind, type),
|
|
56
|
+
eq(juniorTaskExecutions.namespace, namespace)
|
|
57
|
+
)
|
|
58
|
+
).orderBy(
|
|
59
|
+
juniorTaskExecutions.taskId,
|
|
60
|
+
desc(juniorTaskExecutions.executedAtMs),
|
|
61
|
+
desc(juniorTaskExecutions.executionId)
|
|
62
|
+
).as("latest_task_execution");
|
|
63
|
+
const rows = await db.select({
|
|
64
|
+
lastConversationId: latest.conversationId,
|
|
65
|
+
lastExecutedAtMs: max(juniorTaskExecutions.executedAtMs),
|
|
66
|
+
runsLast7Days: sql`count(*) filter (where ${juniorTaskExecutions.executedAtMs} >= ${sevenDaysAgoMs})::int`,
|
|
67
|
+
taskId: juniorTaskExecutions.taskId,
|
|
68
|
+
totalRuns: sql`count(*)::int`
|
|
69
|
+
}).from(juniorTaskExecutions).innerJoin(latest, eq(latest.taskId, juniorTaskExecutions.taskId)).where(
|
|
70
|
+
and(
|
|
71
|
+
eq(juniorTaskExecutions.kind, type),
|
|
72
|
+
eq(juniorTaskExecutions.namespace, namespace)
|
|
73
|
+
)
|
|
74
|
+
).groupBy(juniorTaskExecutions.taskId, latest.conversationId);
|
|
75
|
+
return new Map(
|
|
76
|
+
rows.map((row) => [
|
|
77
|
+
row.taskId,
|
|
78
|
+
{
|
|
79
|
+
lastConversationId: row.lastConversationId,
|
|
80
|
+
...row.lastExecutedAtMs !== null ? { lastExecutedAtMs: row.lastExecutedAtMs } : {},
|
|
81
|
+
runsLast7Days: row.runsLast7Days,
|
|
82
|
+
totalRuns: row.totalRuns
|
|
83
|
+
}
|
|
84
|
+
])
|
|
85
|
+
);
|
|
86
|
+
}
|
|
87
|
+
async function readTaskExecutionDays(dayCount = 90, options = {}) {
|
|
88
|
+
const nowMs = options.nowMs ?? Date.now();
|
|
89
|
+
const end = utcDate(nowMs);
|
|
90
|
+
const endMs = Date.parse(`${end}T23:59:59.999Z`);
|
|
91
|
+
const startMs = Date.parse(`${end}T00:00:00.000Z`) - (dayCount - 1) * 864e5;
|
|
92
|
+
const executionDate = sql`to_char(to_timestamp(${juniorTaskExecutions.executedAtMs} / 1000.0) at time zone 'UTC', 'YYYY-MM-DD')`;
|
|
93
|
+
const rows = await getDb().select({
|
|
94
|
+
count: count(),
|
|
95
|
+
date: executionDate,
|
|
96
|
+
kind: juniorTaskExecutions.kind
|
|
97
|
+
}).from(juniorTaskExecutions).where(
|
|
98
|
+
and(
|
|
99
|
+
gte(juniorTaskExecutions.executedAtMs, startMs),
|
|
100
|
+
lte(juniorTaskExecutions.executedAtMs, endMs)
|
|
101
|
+
)
|
|
102
|
+
).groupBy(executionDate, juniorTaskExecutions.kind).orderBy(asc(executionDate), asc(juniorTaskExecutions.kind));
|
|
103
|
+
const byDate = /* @__PURE__ */ new Map();
|
|
104
|
+
for (let offset = 0; offset < dayCount; offset += 1) {
|
|
105
|
+
const date = utcDate(startMs + offset * 864e5);
|
|
106
|
+
byDate.set(date, emptyDay(date));
|
|
107
|
+
}
|
|
108
|
+
for (const row of rows) {
|
|
109
|
+
const day = byDate.get(row.date);
|
|
110
|
+
if (!day) continue;
|
|
111
|
+
if (row.kind === "registered") day.registered = row.count;
|
|
112
|
+
else if (row.kind === "scheduled") day.scheduled = row.count;
|
|
113
|
+
else if (row.kind === "event") day.event = row.count;
|
|
114
|
+
}
|
|
115
|
+
return [...byDate.values()];
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
export {
|
|
119
|
+
recordTaskExecution,
|
|
120
|
+
readTaskExecutionSummaries,
|
|
121
|
+
readTaskExecutionDays
|
|
122
|
+
};
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
import {
|
|
2
|
+
DEFAULT_SQL_STATEMENT_TIMEOUT_MS
|
|
3
|
+
} from "./chunk-XG5PHKPM.js";
|
|
1
4
|
import {
|
|
2
5
|
juniorDestinations,
|
|
3
6
|
timestamptz
|
|
@@ -274,25 +277,53 @@ var juniorConversationEvents = pgTable6(
|
|
|
274
277
|
]
|
|
275
278
|
);
|
|
276
279
|
|
|
280
|
+
// src/db/schema/conversation-bindings.ts
|
|
281
|
+
import { index as index5, pgTable as pgTable7, primaryKey as primaryKey3, text as text7 } from "drizzle-orm/pg-core";
|
|
282
|
+
var juniorConversationBindings = pgTable7(
|
|
283
|
+
"junior_conversation_bindings",
|
|
284
|
+
{
|
|
285
|
+
conversationId: text7("conversation_id").notNull().references(() => juniorConversations.conversationId),
|
|
286
|
+
provider: text7("provider").notNull(),
|
|
287
|
+
providerTenantId: text7("provider_tenant_id").notNull().default(""),
|
|
288
|
+
providerDestinationId: text7("provider_destination_id").notNull(),
|
|
289
|
+
providerConversationId: text7("provider_conversation_id").notNull(),
|
|
290
|
+
createdAt: timestamptz("created_at").notNull()
|
|
291
|
+
},
|
|
292
|
+
(table) => [
|
|
293
|
+
primaryKey3({
|
|
294
|
+
name: "junior_conversation_bindings_provider_conversation_pk",
|
|
295
|
+
columns: [
|
|
296
|
+
table.provider,
|
|
297
|
+
table.providerTenantId,
|
|
298
|
+
table.providerDestinationId,
|
|
299
|
+
table.providerConversationId
|
|
300
|
+
]
|
|
301
|
+
}),
|
|
302
|
+
index5("junior_conversation_bindings_conversation_idx").on(
|
|
303
|
+
table.conversationId
|
|
304
|
+
)
|
|
305
|
+
]
|
|
306
|
+
);
|
|
307
|
+
|
|
277
308
|
// src/db/schema/event-tasks.ts
|
|
278
|
-
import { bigint, index as
|
|
279
|
-
var juniorEventTasks =
|
|
309
|
+
import { bigint, index as index6, jsonb as jsonb5, pgTable as pgTable8, text as text8 } from "drizzle-orm/pg-core";
|
|
310
|
+
var juniorEventTasks = pgTable8(
|
|
280
311
|
"junior_event_tasks",
|
|
281
312
|
{
|
|
282
|
-
id:
|
|
283
|
-
teamId:
|
|
284
|
-
namespace:
|
|
285
|
-
identifier:
|
|
313
|
+
id: text8("id").primaryKey(),
|
|
314
|
+
teamId: text8("team_id").notNull(),
|
|
315
|
+
namespace: text8("namespace").notNull(),
|
|
316
|
+
identifier: text8("identifier").notNull(),
|
|
286
317
|
createdAtMs: bigint("created_at_ms", { mode: "number" }).notNull(),
|
|
287
318
|
task: jsonb5("task_json").$type().notNull()
|
|
288
319
|
},
|
|
289
320
|
(table) => [
|
|
290
|
-
|
|
321
|
+
index6("junior_event_tasks_team_idx").on(
|
|
291
322
|
table.teamId,
|
|
292
323
|
table.createdAtMs,
|
|
293
324
|
table.id
|
|
294
325
|
),
|
|
295
|
-
|
|
326
|
+
index6("junior_event_tasks_match_idx").on(
|
|
296
327
|
table.namespace,
|
|
297
328
|
table.identifier,
|
|
298
329
|
table.createdAtMs,
|
|
@@ -302,72 +333,118 @@ var juniorEventTasks = pgTable7(
|
|
|
302
333
|
);
|
|
303
334
|
|
|
304
335
|
// src/db/schema/stats.ts
|
|
305
|
-
import { date, integer as integer3, pgTable as
|
|
306
|
-
var juniorStats =
|
|
336
|
+
import { date, integer as integer3, pgTable as pgTable9, primaryKey as primaryKey4, text as text9 } from "drizzle-orm/pg-core";
|
|
337
|
+
var juniorStats = pgTable9(
|
|
307
338
|
"junior_stats",
|
|
308
339
|
{
|
|
309
340
|
date: date("date", { mode: "string" }).notNull(),
|
|
310
|
-
namespace:
|
|
311
|
-
metric:
|
|
312
|
-
name:
|
|
341
|
+
namespace: text9("namespace").notNull(),
|
|
342
|
+
metric: text9("metric").notNull(),
|
|
343
|
+
name: text9("name").notNull(),
|
|
313
344
|
count: integer3("count").notNull().default(0)
|
|
314
345
|
},
|
|
315
346
|
(table) => [
|
|
316
|
-
|
|
347
|
+
primaryKey4({
|
|
317
348
|
name: "junior_stats_date_namespace_metric_name_pk",
|
|
318
349
|
columns: [table.date, table.namespace, table.metric, table.name]
|
|
319
350
|
})
|
|
320
351
|
]
|
|
321
352
|
);
|
|
322
353
|
|
|
354
|
+
// src/db/schema/task-executions.ts
|
|
355
|
+
import {
|
|
356
|
+
bigint as bigint2,
|
|
357
|
+
foreignKey as foreignKey3,
|
|
358
|
+
index as index7,
|
|
359
|
+
pgTable as pgTable10,
|
|
360
|
+
primaryKey as primaryKey5,
|
|
361
|
+
text as text10
|
|
362
|
+
} from "drizzle-orm/pg-core";
|
|
363
|
+
var juniorTaskExecutions = pgTable10(
|
|
364
|
+
"junior_task_executions",
|
|
365
|
+
{
|
|
366
|
+
executionId: text10("execution_id").notNull(),
|
|
367
|
+
kind: text10("kind").notNull(),
|
|
368
|
+
namespace: text10("namespace").notNull(),
|
|
369
|
+
taskId: text10("task_id").notNull(),
|
|
370
|
+
conversationId: text10("conversation_id").notNull(),
|
|
371
|
+
executedAtMs: bigint2("executed_at_ms", { mode: "number" }).notNull()
|
|
372
|
+
},
|
|
373
|
+
(table) => [
|
|
374
|
+
primaryKey5({
|
|
375
|
+
name: "junior_task_executions_kind_namespace_execution_id_pk",
|
|
376
|
+
columns: [table.kind, table.namespace, table.executionId]
|
|
377
|
+
}),
|
|
378
|
+
foreignKey3({
|
|
379
|
+
name: "junior_task_executions_conversation_id_junior_conversations_conversation_id_fk",
|
|
380
|
+
columns: [table.conversationId],
|
|
381
|
+
foreignColumns: [juniorConversations.conversationId]
|
|
382
|
+
}),
|
|
383
|
+
index7("junior_task_executions_task_time_idx").on(
|
|
384
|
+
table.kind,
|
|
385
|
+
table.namespace,
|
|
386
|
+
table.taskId,
|
|
387
|
+
table.executedAtMs
|
|
388
|
+
),
|
|
389
|
+
index7("junior_task_executions_time_kind_idx").on(
|
|
390
|
+
table.executedAtMs,
|
|
391
|
+
table.kind
|
|
392
|
+
),
|
|
393
|
+
index7("junior_task_executions_conversation_time_idx").on(
|
|
394
|
+
table.conversationId,
|
|
395
|
+
table.executedAtMs
|
|
396
|
+
)
|
|
397
|
+
]
|
|
398
|
+
);
|
|
399
|
+
|
|
323
400
|
// src/db/schema/scheduled-tasks.ts
|
|
324
401
|
import { sql as sql4 } from "drizzle-orm";
|
|
325
|
-
import { bigint as
|
|
326
|
-
var juniorSchedulerTasks =
|
|
402
|
+
import { bigint as bigint3, index as index8, jsonb as jsonb6, pgTable as pgTable11, text as text11 } from "drizzle-orm/pg-core";
|
|
403
|
+
var juniorSchedulerTasks = pgTable11(
|
|
327
404
|
"junior_scheduler_tasks",
|
|
328
405
|
{
|
|
329
|
-
id:
|
|
330
|
-
teamId:
|
|
406
|
+
id: text11("id").primaryKey(),
|
|
407
|
+
teamId: text11("team_id").notNull(),
|
|
331
408
|
// TODO(v0.128.0): Remove after v0.127.x runtimes no longer write this column.
|
|
332
|
-
creatorSlackUserId:
|
|
333
|
-
creatorIdentityId:
|
|
334
|
-
status:
|
|
335
|
-
nextRunAtMs:
|
|
336
|
-
runNowAtMs:
|
|
337
|
-
createdAtMs:
|
|
409
|
+
creatorSlackUserId: text11("creator_slack_user_id"),
|
|
410
|
+
creatorIdentityId: text11("creator_identity_id"),
|
|
411
|
+
status: text11("status").notNull(),
|
|
412
|
+
nextRunAtMs: bigint3("next_run_at_ms", { mode: "number" }),
|
|
413
|
+
runNowAtMs: bigint3("run_now_at_ms", { mode: "number" }),
|
|
414
|
+
createdAtMs: bigint3("created_at_ms", { mode: "number" }).notNull(),
|
|
338
415
|
record: jsonb6("record").$type().notNull()
|
|
339
416
|
},
|
|
340
417
|
(table) => [
|
|
341
418
|
// TODO(v0.128.0): Remove with creatorSlackUserId.
|
|
342
|
-
|
|
343
|
-
|
|
419
|
+
index8("junior_scheduler_tasks_creator_idx").on(table.teamId, table.creatorSlackUserId, table.createdAtMs, table.id).where(sql4`${table.status} <> 'deleted'`),
|
|
420
|
+
index8("junior_scheduler_tasks_creator_identity_idx").on(table.creatorIdentityId, table.createdAtMs, table.id).where(
|
|
344
421
|
sql4`${table.status} <> 'deleted' AND ${table.creatorIdentityId} IS NOT NULL`
|
|
345
422
|
),
|
|
346
|
-
|
|
347
|
-
|
|
423
|
+
index8("junior_scheduler_tasks_team_status_idx").on(table.teamId, table.createdAtMs, table.id).where(sql4`${table.status} <> 'deleted'`),
|
|
424
|
+
index8("junior_scheduler_tasks_run_now_due_idx").on(table.runNowAtMs, table.createdAtMs, table.id).where(
|
|
348
425
|
sql4`${table.status} = 'active' AND ${table.runNowAtMs} IS NOT NULL`
|
|
349
426
|
),
|
|
350
|
-
|
|
427
|
+
index8("junior_scheduler_tasks_next_run_due_idx").on(table.nextRunAtMs, table.createdAtMs, table.id).where(
|
|
351
428
|
sql4`${table.status} = 'active' AND ${table.nextRunAtMs} IS NOT NULL`
|
|
352
429
|
)
|
|
353
430
|
]
|
|
354
431
|
);
|
|
355
|
-
var juniorSchedulerRuns =
|
|
432
|
+
var juniorSchedulerRuns = pgTable11(
|
|
356
433
|
"junior_scheduler_runs",
|
|
357
434
|
{
|
|
358
|
-
id:
|
|
359
|
-
taskId:
|
|
360
|
-
status:
|
|
361
|
-
scheduledForMs:
|
|
435
|
+
id: text11("id").primaryKey(),
|
|
436
|
+
taskId: text11("task_id").notNull(),
|
|
437
|
+
status: text11("status").notNull(),
|
|
438
|
+
scheduledForMs: bigint3("scheduled_for_ms", { mode: "number" }).notNull(),
|
|
362
439
|
record: jsonb6("record").$type().notNull()
|
|
363
440
|
},
|
|
364
441
|
(table) => [
|
|
365
|
-
|
|
442
|
+
index8("junior_scheduler_runs_task_status_idx").on(
|
|
366
443
|
table.taskId,
|
|
367
444
|
table.status,
|
|
368
445
|
table.scheduledForMs
|
|
369
446
|
),
|
|
370
|
-
|
|
447
|
+
index8("junior_scheduler_runs_status_idx").on(
|
|
371
448
|
table.status,
|
|
372
449
|
table.scheduledForMs
|
|
373
450
|
)
|
|
@@ -379,11 +456,13 @@ var juniorSqlSchema = {
|
|
|
379
456
|
juniorConversationAnnotations,
|
|
380
457
|
juniorApiTokens,
|
|
381
458
|
juniorConversationEvents,
|
|
459
|
+
juniorConversationBindings,
|
|
382
460
|
juniorConversations,
|
|
383
461
|
juniorDestinations,
|
|
384
462
|
juniorEventTasks,
|
|
385
463
|
juniorIdentities,
|
|
386
464
|
juniorStats,
|
|
465
|
+
juniorTaskExecutions,
|
|
387
466
|
juniorSchedulerRuns,
|
|
388
467
|
juniorSchedulerTasks,
|
|
389
468
|
juniorUsers
|
|
@@ -497,7 +576,8 @@ function createNeonJuniorSqlExecutor(args) {
|
|
|
497
576
|
return new NeonExecutor(
|
|
498
577
|
new Pool({
|
|
499
578
|
connectionString: args.connectionString,
|
|
500
|
-
max: 3
|
|
579
|
+
max: 3,
|
|
580
|
+
statement_timeout: args.statementTimeoutMs
|
|
501
581
|
})
|
|
502
582
|
);
|
|
503
583
|
}
|
|
@@ -616,17 +696,25 @@ function createPostgresJuniorSqlExecutor(args) {
|
|
|
616
696
|
new Pool2({
|
|
617
697
|
application_name: args.applicationName,
|
|
618
698
|
connectionString: args.connectionString,
|
|
619
|
-
max: 3
|
|
699
|
+
max: 3,
|
|
700
|
+
statement_timeout: args.statementTimeoutMs
|
|
620
701
|
})
|
|
621
702
|
);
|
|
622
703
|
}
|
|
623
704
|
|
|
624
705
|
// src/db/executor.ts
|
|
625
706
|
function createJuniorSqlExecutor(args) {
|
|
707
|
+
const statementTimeoutMs = args.statementTimeoutMs ?? DEFAULT_SQL_STATEMENT_TIMEOUT_MS;
|
|
626
708
|
if (args.driver === "postgres") {
|
|
627
|
-
return createPostgresJuniorSqlExecutor(
|
|
709
|
+
return createPostgresJuniorSqlExecutor({
|
|
710
|
+
connectionString: args.connectionString,
|
|
711
|
+
statementTimeoutMs
|
|
712
|
+
});
|
|
628
713
|
}
|
|
629
|
-
return createNeonJuniorSqlExecutor(
|
|
714
|
+
return createNeonJuniorSqlExecutor({
|
|
715
|
+
connectionString: args.connectionString,
|
|
716
|
+
statementTimeoutMs
|
|
717
|
+
});
|
|
630
718
|
}
|
|
631
719
|
|
|
632
720
|
export {
|
|
@@ -636,8 +724,10 @@ export {
|
|
|
636
724
|
juniorConversationAnnotations,
|
|
637
725
|
juniorApiTokens,
|
|
638
726
|
juniorConversationEvents,
|
|
727
|
+
juniorConversationBindings,
|
|
639
728
|
juniorEventTasks,
|
|
640
729
|
juniorStats,
|
|
730
|
+
juniorTaskExecutions,
|
|
641
731
|
juniorSchedulerTasks,
|
|
642
732
|
juniorSchedulerRuns,
|
|
643
733
|
createJuniorSqlExecutor
|
|
@@ -1,25 +1,25 @@
|
|
|
1
1
|
import {
|
|
2
2
|
getConversationEventStore,
|
|
3
3
|
getDb
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-VPYKNCTN.js";
|
|
5
5
|
import {
|
|
6
6
|
juniorConversationAnnotations,
|
|
7
7
|
juniorConversationEvents,
|
|
8
8
|
juniorIdentities,
|
|
9
9
|
juniorUsers
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-QLEKAO7O.js";
|
|
11
11
|
import {
|
|
12
12
|
SANDBOX_WORKSPACE_ROOT,
|
|
13
13
|
getStateAdapter,
|
|
14
14
|
sleep
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-FDNAUM7X.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-XG5PHKPM.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-6T3AYZT7.js";
|
|
41
41
|
|
|
42
42
|
// src/chat/plugins/agent-hooks.ts
|
|
43
43
|
import {
|
|
@@ -1491,7 +1491,7 @@ async function getPluginUserPromptContributions(args) {
|
|
|
1491
1491
|
}
|
|
1492
1492
|
return contributions;
|
|
1493
1493
|
}
|
|
1494
|
-
function getPluginTools(context) {
|
|
1494
|
+
function getPluginTools(context, sandbox = createSandboxCapability(context.workspace)) {
|
|
1495
1495
|
const tools = {};
|
|
1496
1496
|
for (const plugin of getPlugins()) {
|
|
1497
1497
|
const pluginName = plugin.manifest.name;
|
|
@@ -1544,6 +1544,7 @@ function getPluginTools(context) {
|
|
|
1544
1544
|
...mcp ? { mcp } : {},
|
|
1545
1545
|
model: createPluginModel(pluginName, plugin.model),
|
|
1546
1546
|
resourceEvents,
|
|
1547
|
+
sandbox,
|
|
1547
1548
|
state: createPluginState(pluginName),
|
|
1548
1549
|
users: { resolveActor }
|
|
1549
1550
|
};
|
|
@@ -1566,6 +1567,7 @@ function getPluginTools(context) {
|
|
|
1566
1567
|
...mcp ? { mcp } : {},
|
|
1567
1568
|
model: createPluginModel(pluginName, plugin.model),
|
|
1568
1569
|
resourceEvents,
|
|
1570
|
+
sandbox,
|
|
1569
1571
|
state: createPluginState(pluginName),
|
|
1570
1572
|
users: { resolveActor }
|
|
1571
1573
|
};
|
|
@@ -6,25 +6,25 @@ import {
|
|
|
6
6
|
isDmChannel,
|
|
7
7
|
normalizeSlackConversationId,
|
|
8
8
|
withSlackRetries
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-TR6UEEYD.js";
|
|
10
10
|
import {
|
|
11
11
|
getDb,
|
|
12
12
|
parseDestination
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-VPYKNCTN.js";
|
|
14
14
|
import {
|
|
15
15
|
acquireActiveLock,
|
|
16
16
|
getStateAdapter,
|
|
17
17
|
sleep
|
|
18
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-FDNAUM7X.js";
|
|
19
19
|
import {
|
|
20
20
|
normalizeSlackEmojiName
|
|
21
|
-
} from "./chunk-
|
|
21
|
+
} from "./chunk-XG5PHKPM.js";
|
|
22
22
|
import {
|
|
23
23
|
pluginCatalogRuntime
|
|
24
|
-
} from "./chunk-
|
|
24
|
+
} from "./chunk-VEGF62FV.js";
|
|
25
25
|
import {
|
|
26
26
|
fetchWithBoundedOAuthErrorBodies
|
|
27
|
-
} from "./chunk-
|
|
27
|
+
} from "./chunk-VP6NCPRS.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-6T3AYZT7.js";
|
|
37
37
|
|
|
38
38
|
// src/chat/capabilities/router.ts
|
|
39
39
|
var ProviderCredentialRouter = class {
|