@sentry/junior 0.140.0 → 0.142.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-BFTDRFUO.js → agent-hooks-WDJQQAPH.js} +10 -10
- package/dist/api/conversations/detail.d.ts +1 -0
- package/dist/api/conversations/event-list.d.ts +1 -0
- package/dist/api/schema/conversation.d.ts +4 -0
- package/dist/api/schema/task.d.ts +8 -0
- package/dist/api/schema.js +1 -1
- package/dist/api.js +35 -23
- package/dist/app.js +63 -92
- package/dist/{catalog-runtime-RK664S5T.js → catalog-runtime-CLHTYBHB.js} +5 -5
- package/dist/chat/agent/repository-context.d.ts +1 -0
- package/dist/chat/conversations/history.d.ts +2 -0
- package/dist/chat/conversations/projection.d.ts +8 -0
- package/dist/chat/conversations/store.d.ts +5 -0
- package/dist/chat/conversations/structured-events.d.ts +11 -0
- package/dist/chat/event-tasks/types.d.ts +7 -1
- package/dist/chat/runtime/thread-state.d.ts +3 -1
- package/dist/chat/runtime/turn.d.ts +0 -4
- package/dist/chat/scheduled-tasks/tools/create.d.ts +1 -0
- package/dist/chat/scheduled-tasks/types.d.ts +5 -0
- package/dist/chat/services/conversation-memory.d.ts +2 -1
- package/dist/chat/services/guardian-action-policy.d.ts +1 -1
- package/dist/chat/services/short-title.d.ts +25 -0
- package/dist/chat/state/conversation.d.ts +6 -17
- package/dist/chat/state/turn-session.d.ts +3 -4
- package/dist/chat/tools/create-event-task.d.ts +1 -0
- package/dist/{chunk-MYVCHWDG.js → chunk-4EZV6URQ.js} +107 -37
- package/dist/{chunk-557HLSNH.js → chunk-4L7PKEHM.js} +5 -1
- package/dist/{chunk-WTGLUX4K.js → chunk-5ITSZIAP.js} +1 -1
- package/dist/{chunk-3CUBAGA3.js → chunk-5QVVW3FY.js} +7 -7
- package/dist/{chunk-XX2QNQN4.js → chunk-6IMKBHCG.js} +81 -47
- package/dist/{chunk-3B7O3GNU.js → chunk-7R3CGEMF.js} +3 -3
- package/dist/{chunk-S3FAOKQU.js → chunk-A646AKNB.js} +29 -29
- package/dist/{chunk-BMFRFSTM.js → chunk-B2H7NI5C.js} +165 -535
- package/dist/{chunk-AA2EPMUF.js → chunk-CA4WLRA3.js} +4 -4
- package/dist/{chunk-D3X2PI3D.js → chunk-CBMIVCPM.js} +2 -2
- package/dist/chunk-DRTWANQF.js +67 -0
- package/dist/{chunk-CDQ4YIZM.js → chunk-HLXXQI5Q.js} +55 -1
- package/dist/{chunk-TKTZ4L4Z.js → chunk-HVTWCMDS.js} +1 -1
- package/dist/{chunk-CPPTBHQN.js → chunk-JIWZ7T4C.js} +1 -1
- package/dist/{chunk-UXMRN2ZX.js → chunk-LGY7YX5O.js} +1 -1
- package/dist/{chunk-YB363QGA.js → chunk-LL3BGP7J.js} +1 -1
- package/dist/{chunk-TGIKZJ3Y.js → chunk-LXLBYA6N.js} +2 -2
- package/dist/{chunk-XROWZSOY.js → chunk-N3H7G5K6.js} +1 -1
- package/dist/{chunk-J5H65GY2.js → chunk-NWO5IB7V.js} +1 -1
- package/dist/{chunk-YWM6MJT4.js → chunk-OGQGJAD7.js} +2 -0
- package/dist/{chunk-VRDHAITB.js → chunk-OQAPYAXH.js} +3 -3
- package/dist/{chunk-4PIT6O7A.js → chunk-PWDCFIQG.js} +6 -6
- package/dist/{chunk-OGNL2QY7.js → chunk-QDRMQI5W.js} +4 -4
- package/dist/{chunk-5KAZMR5U.js → chunk-R7E476CH.js} +6 -6
- package/dist/{chunk-HEFBGCCU.js → chunk-RYYBUI34.js} +2 -2
- package/dist/{chunk-WSWM6A3R.js → chunk-SCHH6264.js} +19 -3
- package/dist/{chunk-I3OZR3HG.js → chunk-SF6YKONJ.js} +1 -1
- package/dist/{chunk-DMDOKRPC.js → chunk-T4NFQ5SG.js} +5 -5
- package/dist/{chunk-5YAWB2AX.js → chunk-VJMBLWYR.js} +15 -17
- package/dist/{chunk-A6BI25J3.js → chunk-WJEW7UNC.js} +341 -16
- package/dist/{chunk-N2I7W2VS.js → chunk-WYLSMTWU.js} +1 -1
- package/dist/{chunk-NPL66ZWL.js → chunk-XAW6IN6M.js} +1 -1
- package/dist/chunk-XFHSZNOX.js +75 -0
- package/dist/{chunk-Z2A7BDHT.js → chunk-ZPNUI4L3.js} +23 -26
- package/dist/cli/chat.js +33 -31
- package/dist/cli/check.js +6 -6
- package/dist/cli/plugins.js +13 -13
- package/dist/cli/snapshot-create.js +9 -9
- package/dist/cli/upgrade.js +7 -7
- package/dist/db/schema/event-tasks.d.ts +20 -52
- package/dist/db/schema/scheduled-tasks.d.ts +17 -0
- package/dist/db/schema.d.ts +36 -52
- package/dist/{db-QOGYDDQM.js → db-6N4CD5AI.js} +7 -7
- package/dist/instrumentation.js +4 -4
- package/dist/nitro.js +2 -2
- package/dist/{oauth-callback-server-CT4RMGCP.js → oauth-callback-server-G4K2X56R.js} +24 -22
- package/dist/{runner-PHMLHNLX.js → runner-DEIHVRUE.js} +25 -26
- package/dist/{skills-AYRM4QGF.js → skills-FZVJ6ZFW.js} +6 -6
- package/dist/spawn-WD4F67SZ.js +38 -0
- package/dist/{validation-M5JNGRGL.js → validation-EOLSG7B6.js} +6 -6
- package/dist/version.js +1 -1
- package/dist/{work-LZWE6HK4.js → work-AS3IBMLA.js} +17 -17
- package/dist/{worker-KOGPXFYK.js → worker-VGGNGOUU.js} +10 -10
- package/migrations/0023_task_title_columns.sql +2 -0
- package/migrations/meta/0023_snapshot.json +2198 -0
- package/migrations/meta/_journal.json +7 -0
- package/package.json +4 -4
- package/dist/spawn-OGRQFUNK.js +0 -38
|
@@ -1,25 +1,25 @@
|
|
|
1
1
|
import {
|
|
2
2
|
ToolInputError
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-HLXXQI5Q.js";
|
|
4
4
|
import {
|
|
5
5
|
canRouteResourceEvents,
|
|
6
6
|
getPlugins
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-PWDCFIQG.js";
|
|
8
8
|
import {
|
|
9
9
|
getDb
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-SCHH6264.js";
|
|
11
11
|
import {
|
|
12
12
|
juniorEventTasks,
|
|
13
13
|
juniorSchedulerRuns,
|
|
14
14
|
juniorSchedulerTasks,
|
|
15
15
|
juniorStats
|
|
16
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-4L7PKEHM.js";
|
|
17
17
|
import {
|
|
18
18
|
juniorDestinations
|
|
19
19
|
} from "./chunk-VFUK3X5B.js";
|
|
20
20
|
import {
|
|
21
21
|
logInfo
|
|
22
|
-
} from "./chunk-
|
|
22
|
+
} from "./chunk-XAW6IN6M.js";
|
|
23
23
|
|
|
24
24
|
// src/chat/event-tasks/store.ts
|
|
25
25
|
import { and, asc, desc, eq, inArray, or, sql } from "drizzle-orm";
|
|
@@ -57,41 +57,55 @@ var eventTaskSchema = z.object({
|
|
|
57
57
|
}).strict();
|
|
58
58
|
|
|
59
59
|
// src/chat/event-tasks/store.ts
|
|
60
|
-
function
|
|
61
|
-
|
|
60
|
+
function eventTaskJsonPayload(task) {
|
|
61
|
+
const { title: _title, ...payload } = task;
|
|
62
|
+
return payload;
|
|
63
|
+
}
|
|
64
|
+
function parseTask(row) {
|
|
65
|
+
const raw = row.task && typeof row.task === "object" ? { ...row.task } : row.task;
|
|
66
|
+
if (raw && typeof raw === "object" && "title" in raw) {
|
|
67
|
+
delete raw.title;
|
|
68
|
+
}
|
|
69
|
+
const payload = eventTaskSchema.parse(raw);
|
|
70
|
+
const title = row.title?.trim();
|
|
71
|
+
return title ? { ...payload, title } : payload;
|
|
62
72
|
}
|
|
63
73
|
async function getEventTask(db, id) {
|
|
64
|
-
const rows = await db.select({ task: juniorEventTasks.task }).from(juniorEventTasks).where(eq(juniorEventTasks.id, id)).limit(1);
|
|
65
|
-
return rows[0] ? parseTask(rows[0]
|
|
74
|
+
const rows = await db.select({ task: juniorEventTasks.task, title: juniorEventTasks.title }).from(juniorEventTasks).where(eq(juniorEventTasks.id, id)).limit(1);
|
|
75
|
+
return rows[0] ? parseTask(rows[0]) : void 0;
|
|
66
76
|
}
|
|
67
77
|
async function createEventTask(db, task) {
|
|
68
|
-
const parsed = eventTaskSchema.parse(task);
|
|
78
|
+
const parsed = eventTaskSchema.parse(eventTaskJsonPayload(task));
|
|
79
|
+
const title = task.title?.trim() || null;
|
|
69
80
|
await db.insert(juniorEventTasks).values({
|
|
70
81
|
id: parsed.id,
|
|
71
82
|
teamId: parsed.destination.teamId,
|
|
72
83
|
namespace: parsed.trigger.namespace,
|
|
73
84
|
identifier: parsed.trigger.identifier,
|
|
74
85
|
createdAtMs: parsed.createdAtMs,
|
|
86
|
+
title,
|
|
75
87
|
task: parsed
|
|
76
88
|
}).onConflictDoNothing();
|
|
77
|
-
return await getEventTask(db, parsed.id) ?? parsed;
|
|
89
|
+
return await getEventTask(db, parsed.id) ?? { ...parsed, ...title ? { title } : {} };
|
|
78
90
|
}
|
|
79
91
|
async function saveEventTask(db, task) {
|
|
80
|
-
const parsed = eventTaskSchema.parse(task);
|
|
92
|
+
const parsed = eventTaskSchema.parse(eventTaskJsonPayload(task));
|
|
93
|
+
const title = task.title?.trim() || null;
|
|
81
94
|
const rows = await db.update(juniorEventTasks).set({
|
|
82
95
|
namespace: parsed.trigger.namespace,
|
|
83
96
|
identifier: parsed.trigger.identifier,
|
|
97
|
+
title,
|
|
84
98
|
task: parsed
|
|
85
|
-
}).where(eq(juniorEventTasks.id, parsed.id)).returning({ task: juniorEventTasks.task });
|
|
86
|
-
return rows[0] ? parseTask(rows[0]
|
|
99
|
+
}).where(eq(juniorEventTasks.id, parsed.id)).returning({ task: juniorEventTasks.task, title: juniorEventTasks.title });
|
|
100
|
+
return rows[0] ? parseTask(rows[0]) : void 0;
|
|
87
101
|
}
|
|
88
102
|
async function deleteEventTask(db, id) {
|
|
89
|
-
const rows = await db.delete(juniorEventTasks).where(eq(juniorEventTasks.id, id)).returning({ task: juniorEventTasks.task });
|
|
90
|
-
return rows[0] ? parseTask(rows[0]
|
|
103
|
+
const rows = await db.delete(juniorEventTasks).where(eq(juniorEventTasks.id, id)).returning({ task: juniorEventTasks.task, title: juniorEventTasks.title });
|
|
104
|
+
return rows[0] ? parseTask(rows[0]) : void 0;
|
|
91
105
|
}
|
|
92
106
|
async function listEventTasksForTeam(db, teamId) {
|
|
93
|
-
const rows = await db.select({ task: juniorEventTasks.task }).from(juniorEventTasks).where(eq(juniorEventTasks.teamId, teamId)).orderBy(asc(juniorEventTasks.createdAtMs), asc(juniorEventTasks.id));
|
|
94
|
-
return rows.map(
|
|
107
|
+
const rows = await db.select({ task: juniorEventTasks.task, title: juniorEventTasks.title }).from(juniorEventTasks).where(eq(juniorEventTasks.teamId, teamId)).orderBy(asc(juniorEventTasks.createdAtMs), asc(juniorEventTasks.id));
|
|
108
|
+
return rows.map(parseTask);
|
|
95
109
|
}
|
|
96
110
|
function viewerSlackIdentities(user) {
|
|
97
111
|
return user.identities.filter(
|
|
@@ -114,12 +128,12 @@ async function listEventTasksCreatedBy(db, user, limit) {
|
|
|
114
128
|
)
|
|
115
129
|
);
|
|
116
130
|
if (!ownership) return [];
|
|
117
|
-
const rows = await db.select({ task: juniorEventTasks.task }).from(juniorEventTasks).where(ownership).orderBy(desc(juniorEventTasks.createdAtMs), desc(juniorEventTasks.id)).limit(limit);
|
|
118
|
-
return rows.map(
|
|
131
|
+
const rows = await db.select({ task: juniorEventTasks.task, title: juniorEventTasks.title }).from(juniorEventTasks).where(ownership).orderBy(desc(juniorEventTasks.createdAtMs), desc(juniorEventTasks.id)).limit(limit);
|
|
132
|
+
return rows.map(parseTask);
|
|
119
133
|
}
|
|
120
134
|
async function listPublicEventTasksForTeams(db, teamIds, limit) {
|
|
121
135
|
if (teamIds.length === 0) return [];
|
|
122
|
-
const rows = await db.select({ task: juniorEventTasks.task }).from(juniorEventTasks).innerJoin(
|
|
136
|
+
const rows = await db.select({ task: juniorEventTasks.task, title: juniorEventTasks.title }).from(juniorEventTasks).innerJoin(
|
|
123
137
|
juniorDestinations,
|
|
124
138
|
and(
|
|
125
139
|
eq(juniorDestinations.provider, "slack"),
|
|
@@ -132,17 +146,17 @@ async function listPublicEventTasksForTeams(db, teamIds, limit) {
|
|
|
132
146
|
eq(juniorDestinations.visibility, "public")
|
|
133
147
|
)
|
|
134
148
|
).orderBy(desc(juniorEventTasks.createdAtMs), desc(juniorEventTasks.id)).limit(limit);
|
|
135
|
-
return rows.map(
|
|
149
|
+
return rows.map(parseTask);
|
|
136
150
|
}
|
|
137
151
|
async function findMatchingEventTasks(db, event, teamId) {
|
|
138
|
-
const rows = await db.select({ task: juniorEventTasks.task }).from(juniorEventTasks).where(
|
|
152
|
+
const rows = await db.select({ task: juniorEventTasks.task, title: juniorEventTasks.title }).from(juniorEventTasks).where(
|
|
139
153
|
and(
|
|
140
154
|
eq(juniorEventTasks.teamId, teamId),
|
|
141
155
|
eq(juniorEventTasks.namespace, event.namespace),
|
|
142
156
|
eq(juniorEventTasks.identifier, event.identifier)
|
|
143
157
|
)
|
|
144
158
|
).orderBy(asc(juniorEventTasks.createdAtMs), asc(juniorEventTasks.id));
|
|
145
|
-
return rows.map(
|
|
159
|
+
return rows.map(parseTask).filter((task) => task.trigger.events.includes(event.eventType));
|
|
146
160
|
}
|
|
147
161
|
|
|
148
162
|
// src/stats.ts
|
|
@@ -934,12 +948,18 @@ function canFinishRun(run, startedAtMs) {
|
|
|
934
948
|
}
|
|
935
949
|
return run.status === "running" && run.startedAtMs === startedAtMs;
|
|
936
950
|
}
|
|
937
|
-
function parseStoredTask(value) {
|
|
938
|
-
const
|
|
939
|
-
|
|
940
|
-
}
|
|
941
|
-
|
|
951
|
+
function parseStoredTask(value, title) {
|
|
952
|
+
const record = parseJsonRecord(value);
|
|
953
|
+
if (!record) return void 0;
|
|
954
|
+
const { title: recordTitle, ...rest } = record;
|
|
955
|
+
const parsed = taskRecordSchema.safeParse(rest);
|
|
956
|
+
if (!parsed.success) return void 0;
|
|
957
|
+
const storedTitle = title ?? (typeof recordTitle === "string" ? recordTitle : null);
|
|
958
|
+
return stripLegacyTaskFields(parsed.data, storedTitle);
|
|
959
|
+
}
|
|
960
|
+
function stripLegacyTaskFields(task, title) {
|
|
942
961
|
const { version: _version, status, ...current } = task;
|
|
962
|
+
const storedTitle = title?.trim() || void 0;
|
|
943
963
|
if (status === "paused") {
|
|
944
964
|
const {
|
|
945
965
|
nextRunAtMs: _nextRunAtMs,
|
|
@@ -948,14 +968,20 @@ function stripLegacyTaskFields(task) {
|
|
|
948
968
|
} = current;
|
|
949
969
|
return {
|
|
950
970
|
...rest,
|
|
951
|
-
status: "deleted"
|
|
971
|
+
status: "deleted",
|
|
972
|
+
...storedTitle ? { title: storedTitle } : {}
|
|
952
973
|
};
|
|
953
974
|
}
|
|
954
975
|
return {
|
|
955
976
|
...current,
|
|
956
|
-
status
|
|
977
|
+
status,
|
|
978
|
+
...storedTitle ? { title: storedTitle } : {}
|
|
957
979
|
};
|
|
958
980
|
}
|
|
981
|
+
function scheduledTaskJsonRecord(task) {
|
|
982
|
+
const { title: _title, ...record } = task;
|
|
983
|
+
return record;
|
|
984
|
+
}
|
|
959
985
|
function stripLegacyRunFields(run) {
|
|
960
986
|
const {
|
|
961
987
|
idempotencyKey: _idempotencyKey,
|
|
@@ -984,21 +1010,19 @@ function listedScheduledTask(task) {
|
|
|
984
1010
|
return task !== void 0 && task.status !== "deleted";
|
|
985
1011
|
}
|
|
986
1012
|
function requireStoredTask(task) {
|
|
987
|
-
const parsed = parseStoredTask(task);
|
|
1013
|
+
const parsed = parseStoredTask(task, task.title);
|
|
988
1014
|
if (!parsed) {
|
|
989
1015
|
throw new Error("Scheduled task routing context is invalid.");
|
|
990
1016
|
}
|
|
991
1017
|
return parsed;
|
|
992
1018
|
}
|
|
993
|
-
function parseSqlTaskRecord(value, creatorIdentityId) {
|
|
1019
|
+
function parseSqlTaskRecord(value, creatorIdentityId, title) {
|
|
994
1020
|
const record = parseJsonRecord(value);
|
|
995
|
-
const
|
|
996
|
-
|
|
997
|
-
);
|
|
998
|
-
return parsed.success ? stripLegacyTaskFields(parsed.data) : void 0;
|
|
1021
|
+
const withIdentity = record && creatorIdentityId ? { ...record, creatorIdentityId } : record;
|
|
1022
|
+
return parseStoredTask(withIdentity, title);
|
|
999
1023
|
}
|
|
1000
1024
|
function parseSqlTaskRow(row) {
|
|
1001
|
-
return parseSqlTaskRecord(row.record, row.creatorIdentityId);
|
|
1025
|
+
return parseSqlTaskRecord(row.record, row.creatorIdentityId, row.title);
|
|
1002
1026
|
}
|
|
1003
1027
|
function parseSqlRunRow(row) {
|
|
1004
1028
|
const parsed = runRecordSchema.safeParse(parseJsonRecord(row.record));
|
|
@@ -1011,6 +1035,7 @@ async function withSqlLock(db, key, callback) {
|
|
|
1011
1035
|
});
|
|
1012
1036
|
}
|
|
1013
1037
|
async function upsertSqlTask(db, task) {
|
|
1038
|
+
const title = task.title?.trim() || null;
|
|
1014
1039
|
await db.insert(juniorSchedulerTasks).values({
|
|
1015
1040
|
createdAtMs: task.createdAtMs,
|
|
1016
1041
|
creatorIdentityId: task.creatorIdentityId,
|
|
@@ -1018,10 +1043,11 @@ async function upsertSqlTask(db, task) {
|
|
|
1018
1043
|
creatorSlackUserId: task.createdBy.slackUserId,
|
|
1019
1044
|
id: task.id,
|
|
1020
1045
|
nextRunAtMs: task.nextRunAtMs,
|
|
1021
|
-
record: task,
|
|
1046
|
+
record: scheduledTaskJsonRecord(task),
|
|
1022
1047
|
runNowAtMs: task.runNowAtMs,
|
|
1023
1048
|
status: task.status,
|
|
1024
|
-
teamId: task.destination.teamId
|
|
1049
|
+
teamId: task.destination.teamId,
|
|
1050
|
+
title
|
|
1025
1051
|
}).onConflictDoUpdate({
|
|
1026
1052
|
target: juniorSchedulerTasks.id,
|
|
1027
1053
|
set: {
|
|
@@ -1032,7 +1058,8 @@ async function upsertSqlTask(db, task) {
|
|
|
1032
1058
|
record: sql3`excluded.record`,
|
|
1033
1059
|
runNowAtMs: sql3`excluded.run_now_at_ms`,
|
|
1034
1060
|
status: sql3`excluded.status`,
|
|
1035
|
-
teamId: sql3`excluded.team_id
|
|
1061
|
+
teamId: sql3`excluded.team_id`,
|
|
1062
|
+
title: sql3`excluded.title`
|
|
1036
1063
|
}
|
|
1037
1064
|
});
|
|
1038
1065
|
}
|
|
@@ -1056,7 +1083,8 @@ async function upsertSqlRun(db, run) {
|
|
|
1056
1083
|
async function getTaskFromSql(db, taskId) {
|
|
1057
1084
|
const rows = await db.select({
|
|
1058
1085
|
creatorIdentityId: juniorSchedulerTasks.creatorIdentityId,
|
|
1059
|
-
record: juniorSchedulerTasks.record
|
|
1086
|
+
record: juniorSchedulerTasks.record,
|
|
1087
|
+
title: juniorSchedulerTasks.title
|
|
1060
1088
|
}).from(juniorSchedulerTasks).where(eq2(juniorSchedulerTasks.id, taskId)).limit(1);
|
|
1061
1089
|
return rows[0] ? parseSqlTaskRow(rows[0]) : void 0;
|
|
1062
1090
|
}
|
|
@@ -1067,7 +1095,8 @@ async function getRunFromSql(db, runId) {
|
|
|
1067
1095
|
async function listTasksFromSql(db) {
|
|
1068
1096
|
const rows = await db.select({
|
|
1069
1097
|
creatorIdentityId: juniorSchedulerTasks.creatorIdentityId,
|
|
1070
|
-
record: juniorSchedulerTasks.record
|
|
1098
|
+
record: juniorSchedulerTasks.record,
|
|
1099
|
+
title: juniorSchedulerTasks.title
|
|
1071
1100
|
}).from(juniorSchedulerTasks).where(notInArray(juniorSchedulerTasks.status, ["deleted", "paused"])).orderBy(
|
|
1072
1101
|
asc3(juniorSchedulerTasks.createdAtMs),
|
|
1073
1102
|
asc3(juniorSchedulerTasks.id)
|
|
@@ -1088,6 +1117,7 @@ async function listTasksCreatedByFromSql(db, input) {
|
|
|
1088
1117
|
)
|
|
1089
1118
|
) : void 0;
|
|
1090
1119
|
const search = query ? or2(
|
|
1120
|
+
sql3`strpos(lower(${juniorSchedulerTasks.title}), ${query}) > 0`,
|
|
1091
1121
|
sql3`strpos(lower(${juniorSchedulerTasks.record}->'task'->>'text'), ${query}) > 0`,
|
|
1092
1122
|
sql3`strpos(lower(${juniorSchedulerTasks.record}->'schedule'->>'description'), ${query}) > 0`,
|
|
1093
1123
|
sql3`strpos(lower(${juniorSchedulerTasks.record}->'schedule'->>'timezone'), ${query}) > 0`,
|
|
@@ -1097,7 +1127,8 @@ async function listTasksCreatedByFromSql(db, input) {
|
|
|
1097
1127
|
createdAtMs: juniorSchedulerTasks.createdAtMs,
|
|
1098
1128
|
creatorIdentityId: juniorSchedulerTasks.creatorIdentityId,
|
|
1099
1129
|
id: juniorSchedulerTasks.id,
|
|
1100
|
-
record: juniorSchedulerTasks.record
|
|
1130
|
+
record: juniorSchedulerTasks.record,
|
|
1131
|
+
title: juniorSchedulerTasks.title
|
|
1101
1132
|
}).from(juniorSchedulerTasks).where(
|
|
1102
1133
|
and3(
|
|
1103
1134
|
notInArray(juniorSchedulerTasks.status, ["deleted", "paused"]),
|
|
@@ -1124,7 +1155,8 @@ async function listTasksCreatedByFromSql(db, input) {
|
|
|
1124
1155
|
async function listTasksForTeamFromSql(db, teamId) {
|
|
1125
1156
|
const rows = await db.select({
|
|
1126
1157
|
creatorIdentityId: juniorSchedulerTasks.creatorIdentityId,
|
|
1127
|
-
record: juniorSchedulerTasks.record
|
|
1158
|
+
record: juniorSchedulerTasks.record,
|
|
1159
|
+
title: juniorSchedulerTasks.title
|
|
1128
1160
|
}).from(juniorSchedulerTasks).where(
|
|
1129
1161
|
and3(
|
|
1130
1162
|
eq2(juniorSchedulerTasks.teamId, teamId),
|
|
@@ -1140,7 +1172,8 @@ async function listPublicScheduledTasksForTeams(db, teamIds, limit) {
|
|
|
1140
1172
|
if (teamIds.length === 0) return [];
|
|
1141
1173
|
const rows = await db.select({
|
|
1142
1174
|
creatorIdentityId: juniorSchedulerTasks.creatorIdentityId,
|
|
1143
|
-
record: juniorSchedulerTasks.record
|
|
1175
|
+
record: juniorSchedulerTasks.record,
|
|
1176
|
+
title: juniorSchedulerTasks.title
|
|
1144
1177
|
}).from(juniorSchedulerTasks).innerJoin(
|
|
1145
1178
|
juniorDestinations,
|
|
1146
1179
|
and3(
|
|
@@ -1236,7 +1269,8 @@ var SqlSchedulerStore = class {
|
|
|
1236
1269
|
async (db) => {
|
|
1237
1270
|
const rows = await db.select({
|
|
1238
1271
|
creatorIdentityId: juniorSchedulerTasks.creatorIdentityId,
|
|
1239
|
-
record: juniorSchedulerTasks.record
|
|
1272
|
+
record: juniorSchedulerTasks.record,
|
|
1273
|
+
title: juniorSchedulerTasks.title
|
|
1240
1274
|
}).from(juniorSchedulerTasks).where(
|
|
1241
1275
|
and3(
|
|
1242
1276
|
eq2(juniorSchedulerTasks.status, "active"),
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import {
|
|
2
2
|
getDb
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-SCHH6264.js";
|
|
4
4
|
import {
|
|
5
5
|
juniorConversations,
|
|
6
6
|
juniorTaskExecutions
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-4L7PKEHM.js";
|
|
8
8
|
import {
|
|
9
9
|
logWarn
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-XAW6IN6M.js";
|
|
11
11
|
|
|
12
12
|
// src/chat/tasks/execution-stats.ts
|
|
13
13
|
import { and, asc, count, desc, eq, gte, inArray, lte, max, sql } from "drizzle-orm";
|
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
toCanonicalInputMessage,
|
|
4
4
|
toCanonicalOutputMessage,
|
|
5
5
|
toGenAiMessagesTraceAttributes
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-LGY7YX5O.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-XAW6IN6M.js";
|
|
15
15
|
|
|
16
16
|
// src/chat/services/provider-error.ts
|
|
17
17
|
var ProviderError = class extends Error {
|
|
@@ -195,6 +195,31 @@ function getProviderErrorAttributes(error) {
|
|
|
195
195
|
};
|
|
196
196
|
}
|
|
197
197
|
|
|
198
|
+
// src/chat/model-profile.ts
|
|
199
|
+
import { z } from "zod";
|
|
200
|
+
var STANDARD_MODEL_PROFILE = "standard";
|
|
201
|
+
var DEFAULT_HANDOFF_MODEL_PROFILE = "handoff";
|
|
202
|
+
var modelProfileSchema = z.string().regex(/^[a-z][a-z0-9_-]*$/);
|
|
203
|
+
var ModelProfileNotConfiguredError = class extends Error {
|
|
204
|
+
constructor(profile) {
|
|
205
|
+
super(`Model profile "${profile}" is not configured`);
|
|
206
|
+
this.name = "ModelProfileNotConfiguredError";
|
|
207
|
+
}
|
|
208
|
+
};
|
|
209
|
+
function modelIdForProfile(config, profile) {
|
|
210
|
+
return profileConfig(config, profile).modelId;
|
|
211
|
+
}
|
|
212
|
+
function standardModelId(config) {
|
|
213
|
+
return modelIdForProfile(config, STANDARD_MODEL_PROFILE);
|
|
214
|
+
}
|
|
215
|
+
function profileConfig(config, profile) {
|
|
216
|
+
const profileConfig2 = Object.hasOwn(config.profiles, profile) ? config.profiles[profile] : void 0;
|
|
217
|
+
if (!profileConfig2) {
|
|
218
|
+
throw new ModelProfileNotConfiguredError(profile);
|
|
219
|
+
}
|
|
220
|
+
return profileConfig2;
|
|
221
|
+
}
|
|
222
|
+
|
|
198
223
|
// src/chat/config.ts
|
|
199
224
|
import { getModel as getModel2 } from "@earendil-works/pi-ai/compat";
|
|
200
225
|
|
|
@@ -652,7 +677,7 @@ function normalizeSlackEmojiName(value) {
|
|
|
652
677
|
}
|
|
653
678
|
|
|
654
679
|
// src/chat/reasoning-level.ts
|
|
655
|
-
import { z } from "zod";
|
|
680
|
+
import { z as z2 } from "zod";
|
|
656
681
|
var TURN_REASONING_LEVELS = [
|
|
657
682
|
"none",
|
|
658
683
|
"low",
|
|
@@ -661,32 +686,7 @@ var TURN_REASONING_LEVELS = [
|
|
|
661
686
|
"xhigh"
|
|
662
687
|
];
|
|
663
688
|
function parseTurnReasoningLevel(value) {
|
|
664
|
-
return
|
|
665
|
-
}
|
|
666
|
-
|
|
667
|
-
// src/chat/model-profile.ts
|
|
668
|
-
import { z as z2 } from "zod";
|
|
669
|
-
var STANDARD_MODEL_PROFILE = "standard";
|
|
670
|
-
var DEFAULT_HANDOFF_MODEL_PROFILE = "handoff";
|
|
671
|
-
var modelProfileSchema = z2.string().regex(/^[a-z][a-z0-9_-]*$/);
|
|
672
|
-
var ModelProfileNotConfiguredError = class extends Error {
|
|
673
|
-
constructor(profile) {
|
|
674
|
-
super(`Model profile "${profile}" is not configured`);
|
|
675
|
-
this.name = "ModelProfileNotConfiguredError";
|
|
676
|
-
}
|
|
677
|
-
};
|
|
678
|
-
function modelIdForProfile(config, profile) {
|
|
679
|
-
return profileConfig(config, profile).modelId;
|
|
680
|
-
}
|
|
681
|
-
function standardModelId(config) {
|
|
682
|
-
return modelIdForProfile(config, STANDARD_MODEL_PROFILE);
|
|
683
|
-
}
|
|
684
|
-
function profileConfig(config, profile) {
|
|
685
|
-
const profileConfig2 = Object.hasOwn(config.profiles, profile) ? config.profiles[profile] : void 0;
|
|
686
|
-
if (!profileConfig2) {
|
|
687
|
-
throw new ModelProfileNotConfiguredError(profile);
|
|
688
|
-
}
|
|
689
|
-
return profileConfig2;
|
|
689
|
+
return z2.enum(TURN_REASONING_LEVELS).parse(value);
|
|
690
690
|
}
|
|
691
691
|
|
|
692
692
|
// src/chat/config.ts
|