@sentry/junior 0.191.0 → 0.192.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-HIWWBBKO.js → agent-hooks-3JY76L5X.js} +11 -11
- package/dist/api/activity.d.ts +3 -1
- package/dist/api/code/overview.d.ts +12 -0
- package/dist/api/locations/detail.d.ts +8 -0
- package/dist/api/locations/list.d.ts +5 -0
- package/dist/api/people/code.d.ts +6 -0
- package/dist/api/people/shared.d.ts +2 -0
- package/dist/api/reporting-window.d.ts +40 -0
- package/dist/api/schema/code.d.ts +14 -0
- package/dist/api/schema/conversation.d.ts +27 -0
- package/dist/api/schema/location.d.ts +15 -0
- package/dist/api/schema/person.d.ts +104 -0
- package/dist/api/schema/task.d.ts +15 -2
- package/dist/api/schema.d.ts +1 -1
- package/dist/api/schema.js +2 -2
- package/dist/api.js +536 -141
- package/dist/app.js +39 -39
- package/dist/{catalog-runtime-4OKH4265.js → catalog-runtime-5JVLWXRY.js} +4 -4
- package/dist/chat/tasks/execution-stats.d.ts +12 -0
- package/dist/{chunk-L4JLLS6C.js → chunk-3ADPXQBL.js} +1 -1
- package/dist/{chunk-VGYZ3YZM.js → chunk-3O2NXVGB.js} +21 -21
- package/dist/{chunk-CUUE5MGF.js → chunk-3UJSII43.js} +3 -3
- package/dist/{chunk-X6PQKQTY.js → chunk-47JFLZSF.js} +4 -4
- package/dist/{chunk-WBNQYVCM.js → chunk-4AFSQJD6.js} +2 -2
- package/dist/{chunk-NY5SJGJZ.js → chunk-4B4DQGOM.js} +22 -22
- package/dist/{chunk-AWFSSFAX.js → chunk-4CCQZHD3.js} +9 -9
- package/dist/{chunk-DP6H3U2X.js → chunk-4WIA45WD.js} +1 -1
- package/dist/{chunk-2JAWOTUT.js → chunk-4Z7B5WVV.js} +2 -2
- package/dist/{chunk-BVWC5DBM.js → chunk-5V4BAUCH.js} +1 -1
- package/dist/{chunk-QRNJO7DZ.js → chunk-6FCKJDKS.js} +1 -1
- package/dist/{chunk-7PYCRKQL.js → chunk-6LX6KV5C.js} +3 -3
- package/dist/{chunk-WCSXTDOL.js → chunk-7XO7PTZE.js} +1 -1
- package/dist/{chunk-S7NSFCCW.js → chunk-AKR6W7VV.js} +3 -3
- package/dist/{chunk-ZNFNGDT7.js → chunk-ARSUYYQG.js} +1 -1
- package/dist/{chunk-CCPOZMS4.js → chunk-BGLMT6KP.js} +3 -3
- package/dist/{chunk-NK3UEKAW.js → chunk-BUTAWPUV.js} +50 -8
- package/dist/{chunk-LOYTPSAK.js → chunk-EIYOABL4.js} +4 -4
- package/dist/{chunk-PFAZSRGR.js → chunk-EYIMZY5O.js} +114 -19
- package/dist/{chunk-BVYUIVXE.js → chunk-EYNUOZCN.js} +1 -1
- package/dist/{chunk-EQZUBYRF.js → chunk-FGYWKKTJ.js} +1 -1
- package/dist/{chunk-3PDR63SX.js → chunk-G4E5WIRL.js} +4 -4
- package/dist/{chunk-ZRN3OS7M.js → chunk-H5Q2T5VC.js} +1 -1
- package/dist/{chunk-SEIZ2XLD.js → chunk-IBO4YFFZ.js} +1 -1
- package/dist/{chunk-Q32BSFN4.js → chunk-ITTEDZGY.js} +8 -8
- package/dist/{chunk-5IMKUVMS.js → chunk-KR5F3QSP.js} +9 -9
- package/dist/{chunk-YNRLCUCB.js → chunk-LRTEMMCZ.js} +1 -1
- package/dist/{chunk-ZJRGWZZ2.js → chunk-MB2CTEPD.js} +74 -4
- package/dist/{chunk-WNIVCR74.js → chunk-OBN7UEQJ.js} +2 -2
- package/dist/{chunk-HNMRX2EN.js → chunk-PXP2M32M.js} +5 -5
- package/dist/{chunk-TH6LMEOW.js → chunk-PXUBRZBU.js} +1 -1
- package/dist/{chunk-6KISW5UY.js → chunk-PYVGXGKC.js} +2 -2
- package/dist/{chunk-UTL3MHPC.js → chunk-RC745GGZ.js} +8 -1
- package/dist/{chunk-RZS4F5K4.js → chunk-RWBZZMW6.js} +3 -3
- package/dist/{chunk-GQN4REF5.js → chunk-SSR6YBWW.js} +6 -6
- package/dist/{chunk-MFZOIKET.js → chunk-SZ2O3CGS.js} +1 -1
- package/dist/{chunk-KTW62MG5.js → chunk-VF3EDS7P.js} +6 -6
- package/dist/{chunk-CECRMPXJ.js → chunk-YE6DVM43.js} +8 -8
- package/dist/{chunk-K2NKG42A.js → chunk-YRWGJ5OO.js} +5 -5
- package/dist/{chunk-SGRL7NV6.js → chunk-Z4DNJI5F.js} +5 -5
- package/dist/cli/chat.js +33 -33
- package/dist/cli/check.js +5 -5
- package/dist/cli/plugins.js +12 -12
- package/dist/cli/snapshot-create.js +9 -9
- package/dist/cli/upgrade.js +6 -6
- package/dist/db/schema/stats.d.ts +5 -1
- package/dist/{db-LG4ZEWA3.js → db-LRM6AP66.js} +6 -6
- package/dist/instrumentation.js +3 -3
- package/dist/nitro.js +6 -6
- package/dist/{oauth-callback-server-KI7ZRTOG.js → oauth-callback-server-BKCDVYVH.js} +29 -29
- package/dist/reporting-schema.d.ts +2 -2
- package/dist/{runner-K2EOSAZQ.js → runner-RUXGS3E6.js} +21 -21
- package/dist/{skills-JTRDFKMA.js → skills-DXP2RCJF.js} +5 -5
- package/dist/spawn-HH7GH7XT.js +42 -0
- package/dist/task-runner-H5I7R3LJ.js +36 -0
- package/dist/{validation-NBWURHAP.js → validation-F4KYLIF2.js} +5 -5
- package/dist/version.js +1 -1
- package/dist/{work-35TBEAUI.js → work-UUNMNSML.js} +21 -21
- package/dist/{worker-F762M6XM.js → worker-PMIJ5NLD.js} +10 -10
- package/package.json +5 -5
- package/dist/spawn-SRBETYCF.js +0 -42
- package/dist/task-runner-INQIQ4VF.js +0 -36
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import {
|
|
2
2
|
AgentRunError,
|
|
3
3
|
executeTurn
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-BGLMT6KP.js";
|
|
5
5
|
import {
|
|
6
6
|
ConversationTurnLifecycleService
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-PXUBRZBU.js";
|
|
8
8
|
import {
|
|
9
9
|
getPersistedSandboxState,
|
|
10
10
|
getPersistedThreadState,
|
|
11
11
|
persistThreadStateById
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-Z4DNJI5F.js";
|
|
13
13
|
import {
|
|
14
14
|
AgentInvocationBusyError,
|
|
15
15
|
AgentInvocationLimitError,
|
|
@@ -18,32 +18,32 @@ import {
|
|
|
18
18
|
agentBindingSchema,
|
|
19
19
|
agentInvocationSchema,
|
|
20
20
|
createAgentInvocationSchema
|
|
21
|
-
} from "./chunk-
|
|
21
|
+
} from "./chunk-PXP2M32M.js";
|
|
22
22
|
import {
|
|
23
23
|
TurnInputCommitLostError,
|
|
24
24
|
getAssistantReplyText,
|
|
25
25
|
getConversationTurnBoundaryError,
|
|
26
26
|
isTurnInputCommitLostError
|
|
27
|
-
} from "./chunk-
|
|
27
|
+
} from "./chunk-7XO7PTZE.js";
|
|
28
28
|
import {
|
|
29
29
|
failTurnRecord,
|
|
30
30
|
getTerminalAssistantMessages,
|
|
31
31
|
getTurnRecord,
|
|
32
32
|
openConversationProjection,
|
|
33
33
|
saveTurnCheckpoint
|
|
34
|
-
} from "./chunk-
|
|
34
|
+
} from "./chunk-VF3EDS7P.js";
|
|
35
35
|
import {
|
|
36
36
|
appendAndEnqueueInboundMessage
|
|
37
|
-
} from "./chunk-
|
|
37
|
+
} from "./chunk-G4E5WIRL.js";
|
|
38
38
|
import {
|
|
39
39
|
getConversationEventStore,
|
|
40
40
|
getConversationStore,
|
|
41
41
|
getSqlExecutor
|
|
42
|
-
} from "./chunk-
|
|
42
|
+
} from "./chunk-AKR6W7VV.js";
|
|
43
43
|
import {
|
|
44
44
|
juniorAgentBindings,
|
|
45
45
|
juniorAgentInvocations
|
|
46
|
-
} from "./chunk-
|
|
46
|
+
} from "./chunk-IBO4YFFZ.js";
|
|
47
47
|
|
|
48
48
|
// src/chat/agent-invocations/work.ts
|
|
49
49
|
import { z } from "zod";
|
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
toCanonicalInputMessage,
|
|
8
8
|
toCanonicalOutputMessage,
|
|
9
9
|
toGenAiMessagesTraceAttributes
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-EYNUOZCN.js";
|
|
11
11
|
import {
|
|
12
12
|
extractGenAiUsageAttributes,
|
|
13
13
|
logException,
|
|
@@ -15,7 +15,7 @@ import {
|
|
|
15
15
|
normalizeGenAiFinishReason,
|
|
16
16
|
serializeGenAiAttribute,
|
|
17
17
|
withSpan
|
|
18
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-3ADPXQBL.js";
|
|
19
19
|
|
|
20
20
|
// src/chat/services/provider-error.ts
|
|
21
21
|
var ProviderError = class extends Error {
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import {
|
|
2
2
|
toOptionalTrimmed
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-4Z7B5WVV.js";
|
|
4
4
|
import {
|
|
5
5
|
pluginCatalogRuntime
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-FGYWKKTJ.js";
|
|
7
7
|
import {
|
|
8
8
|
setSpanAttributes,
|
|
9
9
|
setSpanStatus
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-3ADPXQBL.js";
|
|
11
11
|
|
|
12
12
|
// src/chat/sandbox/paths.ts
|
|
13
13
|
function normalizeWorkspaceRoot(input) {
|
|
@@ -8,7 +8,7 @@ import {
|
|
|
8
8
|
juniorConversations,
|
|
9
9
|
juniorIdentities,
|
|
10
10
|
juniorUsers
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-IBO4YFFZ.js";
|
|
12
12
|
import {
|
|
13
13
|
conversationEventDataSchema,
|
|
14
14
|
decodeStoredConversationEvent,
|
|
@@ -20,7 +20,7 @@ import {
|
|
|
20
20
|
} from "./chunk-VFUK3X5B.js";
|
|
21
21
|
import {
|
|
22
22
|
getChatConfig
|
|
23
|
-
} from "./chunk-
|
|
23
|
+
} from "./chunk-4Z7B5WVV.js";
|
|
24
24
|
import {
|
|
25
25
|
parseActorUserId,
|
|
26
26
|
parseSlackChannelReferenceId,
|
|
@@ -28,7 +28,7 @@ import {
|
|
|
28
28
|
} from "./chunk-N7TMSOZH.js";
|
|
29
29
|
import {
|
|
30
30
|
normalizeIdentityEmail
|
|
31
|
-
} from "./chunk-
|
|
31
|
+
} from "./chunk-3ADPXQBL.js";
|
|
32
32
|
|
|
33
33
|
// src/chat/conversations/sql/store.ts
|
|
34
34
|
import { randomUUID as randomUUID2 } from "crypto";
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import {
|
|
2
2
|
ConversationTurnLifecycleService
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-PXUBRZBU.js";
|
|
4
4
|
import {
|
|
5
5
|
runAgentWithTimeout
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-SSR6YBWW.js";
|
|
7
7
|
import {
|
|
8
8
|
getConversationEventStore
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-AKR6W7VV.js";
|
|
10
10
|
|
|
11
11
|
// src/chat/runtime/turn-execution.ts
|
|
12
12
|
var AgentRunError = class extends Error {
|
|
@@ -5,7 +5,7 @@ import {
|
|
|
5
5
|
getConversationEventStore,
|
|
6
6
|
getDb,
|
|
7
7
|
getSqlExecutor
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-AKR6W7VV.js";
|
|
9
9
|
import {
|
|
10
10
|
juniorCodeChanges,
|
|
11
11
|
juniorCodeRepositories,
|
|
@@ -16,7 +16,7 @@ import {
|
|
|
16
16
|
juniorUsers,
|
|
17
17
|
juniorWorkspaceRepos,
|
|
18
18
|
juniorWorkspaces
|
|
19
|
-
} from "./chunk-
|
|
19
|
+
} from "./chunk-IBO4YFFZ.js";
|
|
20
20
|
import {
|
|
21
21
|
SANDBOX_WORKSPACE_ROOT,
|
|
22
22
|
getVercelSandboxCredentials,
|
|
@@ -24,16 +24,16 @@ import {
|
|
|
24
24
|
isSandboxMissingError,
|
|
25
25
|
runNonInteractiveCommand,
|
|
26
26
|
sleep
|
|
27
|
-
} from "./chunk-
|
|
27
|
+
} from "./chunk-6LX6KV5C.js";
|
|
28
28
|
import {
|
|
29
29
|
getStateAdapter
|
|
30
|
-
} from "./chunk-
|
|
30
|
+
} from "./chunk-LRTEMMCZ.js";
|
|
31
31
|
import {
|
|
32
32
|
botConfig,
|
|
33
33
|
completeObject,
|
|
34
34
|
embedTexts,
|
|
35
35
|
getSlackBotToken
|
|
36
|
-
} from "./chunk-
|
|
36
|
+
} from "./chunk-4Z7B5WVV.js";
|
|
37
37
|
import {
|
|
38
38
|
defaultModelId
|
|
39
39
|
} from "./chunk-D4YV5TDV.js";
|
|
@@ -52,7 +52,7 @@ import {
|
|
|
52
52
|
setSpanAttributes,
|
|
53
53
|
setSpanStatus,
|
|
54
54
|
withSpan
|
|
55
|
-
} from "./chunk-
|
|
55
|
+
} from "./chunk-3ADPXQBL.js";
|
|
56
56
|
|
|
57
57
|
// src/chat/plugins/agent-hooks.ts
|
|
58
58
|
import {
|
|
@@ -211,7 +211,7 @@ import { z } from "zod";
|
|
|
211
211
|
var DAY_MS = 24 * 60 * 60 * 1e3;
|
|
212
212
|
var costRowSchema = z.object({
|
|
213
213
|
costUsd: z.number().finite().nonnegative(),
|
|
214
|
-
date: z.string().
|
|
214
|
+
date: z.string().regex(/^\d{4}-\d{2}-\d{2}(T\d{2})?$/),
|
|
215
215
|
events: z.number().int().nonnegative()
|
|
216
216
|
}).strict();
|
|
217
217
|
function startOfUtcDay(value) {
|
|
@@ -231,6 +231,48 @@ function registeredEventName(plugin, eventName) {
|
|
|
231
231
|
}
|
|
232
232
|
function createPluginConversationEventStats(plugin, now = Date.now) {
|
|
233
233
|
return {
|
|
234
|
+
async costsByHour(input) {
|
|
235
|
+
const eventName = registeredEventName(plugin, input.eventName);
|
|
236
|
+
const hourCount = input.hours ?? 24;
|
|
237
|
+
const end = new Date(now());
|
|
238
|
+
end.setUTCMinutes(0, 0, 0);
|
|
239
|
+
const start = new Date(end.getTime() - (hourCount - 1) * 60 * 60 * 1e3);
|
|
240
|
+
const endExclusive = new Date(end.getTime() + 60 * 60 * 1e3);
|
|
241
|
+
const date = sql`TO_CHAR(
|
|
242
|
+
${juniorConversationEvents.createdAt} AT TIME ZONE 'UTC',
|
|
243
|
+
'YYYY-MM-DD"T"HH24'
|
|
244
|
+
)`;
|
|
245
|
+
const cost = sql`CASE
|
|
246
|
+
WHEN jsonb_typeof(${juniorConversationEvents.payload}->'content'->'costUsd') = 'number'
|
|
247
|
+
THEN (${juniorConversationEvents.payload}->'content'->>'costUsd')::double precision
|
|
248
|
+
ELSE 0
|
|
249
|
+
END`;
|
|
250
|
+
const rows = await getDb().select({
|
|
251
|
+
costUsd: sql`SUM(${cost})::double precision`.mapWith(Number),
|
|
252
|
+
date,
|
|
253
|
+
events: sql`COUNT(*)::integer`.mapWith(Number)
|
|
254
|
+
}).from(juniorConversationEvents).where(
|
|
255
|
+
and2(
|
|
256
|
+
eq2(juniorConversationEvents.type, "structured_event"),
|
|
257
|
+
sql`${juniorConversationEvents.payload}->>'namespace' = ${plugin.manifest.name}`,
|
|
258
|
+
sql`${juniorConversationEvents.payload}->>'name' = ${eventName}`,
|
|
259
|
+
gte(juniorConversationEvents.createdAt, start),
|
|
260
|
+
lt(juniorConversationEvents.createdAt, endExclusive)
|
|
261
|
+
)
|
|
262
|
+
).groupBy(date);
|
|
263
|
+
const byHour = new Map(
|
|
264
|
+
z.array(costRowSchema).parse(rows).map((row) => [row.date, row])
|
|
265
|
+
);
|
|
266
|
+
return Array.from({ length: hourCount }, (_, index) => {
|
|
267
|
+
const hour = new Date(start.getTime() + index * 60 * 60 * 1e3);
|
|
268
|
+
const key = hour.toISOString().slice(0, 13);
|
|
269
|
+
return byHour.get(key) ?? {
|
|
270
|
+
costUsd: 0,
|
|
271
|
+
date: key,
|
|
272
|
+
events: 0
|
|
273
|
+
};
|
|
274
|
+
});
|
|
275
|
+
},
|
|
234
276
|
async costsByDay(input) {
|
|
235
277
|
const eventName = registeredEventName(plugin, input.eventName);
|
|
236
278
|
const end = startOfUtcDay(now());
|
|
@@ -3191,7 +3233,7 @@ function sanitizeOperationalReport(args) {
|
|
|
3191
3233
|
sanitizedWidget.emptyText = emptyText;
|
|
3192
3234
|
}
|
|
3193
3235
|
const timeRangeDays = widget.timeRangeDays?.filter(
|
|
3194
|
-
(days) => days === 7 || days === 30 || days === 90
|
|
3236
|
+
(days) => days === 1 || days === 7 || days === 30 || days === 90
|
|
3195
3237
|
);
|
|
3196
3238
|
if (timeRangeDays?.length) {
|
|
3197
3239
|
sanitizedWidget.timeRangeDays = [...new Set(timeRangeDays)];
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import {
|
|
2
2
|
ToolInputError
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-OBN7UEQJ.js";
|
|
4
4
|
import {
|
|
5
5
|
getPlugins
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-BUTAWPUV.js";
|
|
7
7
|
import {
|
|
8
8
|
getDb
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-AKR6W7VV.js";
|
|
10
10
|
import {
|
|
11
11
|
juniorAttachments,
|
|
12
12
|
juniorConversations,
|
|
@@ -14,7 +14,7 @@ import {
|
|
|
14
14
|
juniorSchedulerRuns,
|
|
15
15
|
juniorSchedulerTasks,
|
|
16
16
|
juniorStats
|
|
17
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-IBO4YFFZ.js";
|
|
18
18
|
import {
|
|
19
19
|
juniorDestinations
|
|
20
20
|
} from "./chunk-VFUK3X5B.js";
|
|
@@ -11,6 +11,61 @@ import {
|
|
|
11
11
|
|
|
12
12
|
// src/api/activity.ts
|
|
13
13
|
import { z } from "zod";
|
|
14
|
+
|
|
15
|
+
// src/api/reporting-window.ts
|
|
16
|
+
var HOUR_MS = 60 * 60 * 1e3;
|
|
17
|
+
var DAY_MS = 24 * HOUR_MS;
|
|
18
|
+
var WINDOW_HOURS = 24;
|
|
19
|
+
function startOfUtcDay(valueMs) {
|
|
20
|
+
const date = new Date(valueMs);
|
|
21
|
+
date.setUTCHours(0, 0, 0, 0);
|
|
22
|
+
return date;
|
|
23
|
+
}
|
|
24
|
+
function startOfUtcHour(valueMs) {
|
|
25
|
+
const date = new Date(valueMs);
|
|
26
|
+
date.setUTCMinutes(0, 0, 0);
|
|
27
|
+
return date;
|
|
28
|
+
}
|
|
29
|
+
function utcDayKey(value) {
|
|
30
|
+
const date = typeof value === "number" ? new Date(value) : value;
|
|
31
|
+
return date.toISOString().slice(0, 10);
|
|
32
|
+
}
|
|
33
|
+
function utcHourKey(value) {
|
|
34
|
+
const date = typeof value === "number" ? new Date(value) : value;
|
|
35
|
+
return date.toISOString().slice(0, 13);
|
|
36
|
+
}
|
|
37
|
+
function trailingUtcDayWindow(nowMs, dayCount) {
|
|
38
|
+
const end = startOfUtcDay(nowMs);
|
|
39
|
+
const start = new Date(end);
|
|
40
|
+
start.setUTCDate(start.getUTCDate() - (dayCount - 1));
|
|
41
|
+
return { end, start };
|
|
42
|
+
}
|
|
43
|
+
function trailingUtcHourWindow(nowMs, hourCount = WINDOW_HOURS) {
|
|
44
|
+
const end = startOfUtcHour(nowMs);
|
|
45
|
+
const start = new Date(end.getTime() - (hourCount - 1) * HOUR_MS);
|
|
46
|
+
return { end, start };
|
|
47
|
+
}
|
|
48
|
+
function fillUtcDays(args) {
|
|
49
|
+
const { end, start } = trailingUtcDayWindow(args.nowMs, args.count);
|
|
50
|
+
const items = [];
|
|
51
|
+
for (const cursor = new Date(start); cursor.getTime() <= end.getTime(); cursor.setUTCDate(cursor.getUTCDate() + 1)) {
|
|
52
|
+
const date = utcDayKey(cursor);
|
|
53
|
+
items.push(args.rows.get(date) ?? args.empty(date));
|
|
54
|
+
}
|
|
55
|
+
return items;
|
|
56
|
+
}
|
|
57
|
+
function fillUtcHours(args) {
|
|
58
|
+
const hourCount = args.count ?? WINDOW_HOURS;
|
|
59
|
+
const { end, start } = trailingUtcHourWindow(args.nowMs, hourCount);
|
|
60
|
+
const items = [];
|
|
61
|
+
for (const cursor = new Date(start); cursor.getTime() <= end.getTime(); cursor.setTime(cursor.getTime() + HOUR_MS)) {
|
|
62
|
+
const date = utcHourKey(cursor);
|
|
63
|
+
items.push(args.rows.get(date) ?? args.empty(date));
|
|
64
|
+
}
|
|
65
|
+
return items;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
// src/api/activity.ts
|
|
14
69
|
var dailyConversationActivitySchema = z.object({
|
|
15
70
|
active: z.number(),
|
|
16
71
|
conversations: z.number(),
|
|
@@ -29,16 +84,19 @@ function emptyActivityDay(date) {
|
|
|
29
84
|
};
|
|
30
85
|
}
|
|
31
86
|
function activityDays(days, nowMs, count) {
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
87
|
+
return fillUtcDays({
|
|
88
|
+
count,
|
|
89
|
+
empty: emptyActivityDay,
|
|
90
|
+
nowMs,
|
|
91
|
+
rows: days
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
function activityHours(hours, nowMs) {
|
|
95
|
+
return fillUtcHours({
|
|
96
|
+
empty: emptyActivityDay,
|
|
97
|
+
nowMs,
|
|
98
|
+
rows: hours
|
|
99
|
+
});
|
|
42
100
|
}
|
|
43
101
|
|
|
44
102
|
// src/api/schema/code.ts
|
|
@@ -54,10 +112,11 @@ var codeChangeSummarySchema = z2.object({
|
|
|
54
112
|
mergeRate: z2.number().min(0).max(1).optional(),
|
|
55
113
|
open: z2.number().int().nonnegative()
|
|
56
114
|
}).strict();
|
|
115
|
+
var codeMetricBucketSchema = z2.string().regex(/^\d{4}-\d{2}-\d{2}(T\d{2})?$/);
|
|
57
116
|
var codeActivityDaySchema = z2.object({
|
|
58
117
|
closed: z2.number().int().nonnegative(),
|
|
59
118
|
created: z2.number().int().nonnegative(),
|
|
60
|
-
date:
|
|
119
|
+
date: codeMetricBucketSchema,
|
|
61
120
|
merged: z2.number().int().nonnegative()
|
|
62
121
|
}).strict();
|
|
63
122
|
var codeRepositorySummarySchema = z2.object({
|
|
@@ -86,6 +145,7 @@ var codeChangeSummaryReportSchema = z2.object({
|
|
|
86
145
|
}).strict();
|
|
87
146
|
var codeOverviewReportSchema = z2.object({
|
|
88
147
|
activityDays: z2.array(codeActivityDaySchema),
|
|
148
|
+
activityHours: z2.array(codeActivityDaySchema).optional(),
|
|
89
149
|
changes: z2.array(codeChangeSummaryReportSchema),
|
|
90
150
|
generatedAt: z2.string(),
|
|
91
151
|
repositories: z2.array(codeRepositorySummarySchema),
|
|
@@ -95,6 +155,7 @@ var codeOverviewReportSchema = z2.object({
|
|
|
95
155
|
}).strict();
|
|
96
156
|
var codePersonReportSchema = z2.object({
|
|
97
157
|
activityDays: z2.array(codeActivityDaySchema),
|
|
158
|
+
activityHours: z2.array(codeActivityDaySchema).optional(),
|
|
98
159
|
generatedAt: z2.string(),
|
|
99
160
|
summary: codeChangeSummarySchema,
|
|
100
161
|
windowEnd: z2.string(),
|
|
@@ -623,11 +684,12 @@ var conversationStatsItemSchema = z3.object({
|
|
|
623
684
|
costUsd: z3.number().optional(),
|
|
624
685
|
tokens: z3.number().optional()
|
|
625
686
|
}).strict();
|
|
687
|
+
var conversationMetricBucketSchema = z3.string().regex(/^\d{4}-\d{2}-\d{2}(T\d{2})?$/);
|
|
626
688
|
var conversationMetricDaySchema = z3.object({
|
|
627
689
|
cachedInputTokens: z3.number().optional(),
|
|
628
690
|
conversations: z3.number(),
|
|
629
691
|
costUsd: z3.number().optional(),
|
|
630
|
-
date:
|
|
692
|
+
date: conversationMetricBucketSchema,
|
|
631
693
|
durationMs: z3.number(),
|
|
632
694
|
inputTokens: z3.number().optional(),
|
|
633
695
|
tokens: z3.number().optional()
|
|
@@ -636,7 +698,7 @@ var guardianMetricDaySchema = z3.object({
|
|
|
636
698
|
allow: z3.number(),
|
|
637
699
|
ask: z3.number(),
|
|
638
700
|
costUsd: z3.number().optional(),
|
|
639
|
-
date:
|
|
701
|
+
date: conversationMetricBucketSchema,
|
|
640
702
|
deny: z3.number(),
|
|
641
703
|
requests: z3.number()
|
|
642
704
|
}).strict();
|
|
@@ -646,6 +708,7 @@ var guardianStatsSchema = z3.object({
|
|
|
646
708
|
costUsd: z3.number().optional(),
|
|
647
709
|
deny: z3.number(),
|
|
648
710
|
metricDays: z3.array(guardianMetricDaySchema),
|
|
711
|
+
metricHours: z3.array(guardianMetricDaySchema).optional(),
|
|
649
712
|
requests: z3.number()
|
|
650
713
|
}).strict();
|
|
651
714
|
var conversationStatsReportSchema = z3.object({
|
|
@@ -657,6 +720,7 @@ var conversationStatsReportSchema = z3.object({
|
|
|
657
720
|
generatedAt: z3.string(),
|
|
658
721
|
guardian: guardianStatsSchema,
|
|
659
722
|
metricDays: z3.array(conversationMetricDaySchema),
|
|
723
|
+
metricHours: z3.array(conversationMetricDaySchema).optional(),
|
|
660
724
|
locations: z3.array(conversationStatsItemSchema),
|
|
661
725
|
actors: z3.array(conversationStatsItemSchema),
|
|
662
726
|
source: z3.literal("conversation_index"),
|
|
@@ -671,11 +735,12 @@ var conversationStatsReportSchema = z3.object({
|
|
|
671
735
|
import { z as z4 } from "zod";
|
|
672
736
|
var personParamsSchema = z4.object({ email: z4.string().trim().min(1) }).strict();
|
|
673
737
|
var peopleConversationStatsItemSchema = conversationStatsItemSchema.omit({ costUsd: true });
|
|
738
|
+
var peopleMetricBucketSchema = z4.string().regex(/^\d{4}-\d{2}-\d{2}(T\d{2})?$/);
|
|
674
739
|
var actorActivityDayReportSchema = z4.object({
|
|
675
740
|
active: z4.number(),
|
|
676
741
|
conversations: z4.number(),
|
|
677
742
|
costUsd: z4.number().optional(),
|
|
678
|
-
date:
|
|
743
|
+
date: peopleMetricBucketSchema,
|
|
679
744
|
durationMs: z4.number(),
|
|
680
745
|
failed: z4.number(),
|
|
681
746
|
tokens: z4.number().optional()
|
|
@@ -683,7 +748,7 @@ var actorActivityDayReportSchema = z4.object({
|
|
|
683
748
|
var peopleActivityDayReportSchema = z4.object({
|
|
684
749
|
activePeople: z4.number(),
|
|
685
750
|
conversations: z4.number(),
|
|
686
|
-
date:
|
|
751
|
+
date: peopleMetricBucketSchema
|
|
687
752
|
}).strict();
|
|
688
753
|
var actorTotalsReportSchema = z4.object({
|
|
689
754
|
active: z4.number(),
|
|
@@ -693,14 +758,28 @@ var actorTotalsReportSchema = z4.object({
|
|
|
693
758
|
failed: z4.number(),
|
|
694
759
|
tokens: z4.number().optional()
|
|
695
760
|
}).strict();
|
|
761
|
+
var actorWindowMetricsSchema = z4.object({
|
|
762
|
+
conversations: z4.number().int().nonnegative(),
|
|
763
|
+
costUsd: z4.number().finite().nonnegative(),
|
|
764
|
+
durationMs: z4.number().finite().nonnegative(),
|
|
765
|
+
priorCostUsd: z4.number().finite().nonnegative()
|
|
766
|
+
}).strict();
|
|
767
|
+
var actorDirectoryWindowsSchema = z4.object({
|
|
768
|
+
1: actorWindowMetricsSchema,
|
|
769
|
+
7: actorWindowMetricsSchema,
|
|
770
|
+
30: actorWindowMetricsSchema,
|
|
771
|
+
90: actorWindowMetricsSchema
|
|
772
|
+
}).strict();
|
|
696
773
|
var identifiedActorSchema = actorIdentitySchema.extend({ email: z4.string().min(1) }).strict();
|
|
697
774
|
var actorSummaryReportSchema = actorTotalsReportSchema.extend({
|
|
698
775
|
firstSeenAt: z4.string(),
|
|
699
776
|
lastSeenAt: z4.string(),
|
|
700
|
-
actor: identifiedActorSchema
|
|
777
|
+
actor: identifiedActorSchema,
|
|
778
|
+
windows: actorDirectoryWindowsSchema
|
|
701
779
|
}).strict();
|
|
702
780
|
var actorDirectoryReportSchema = z4.object({
|
|
703
781
|
activityDays: z4.array(peopleActivityDayReportSchema),
|
|
782
|
+
activityHours: z4.array(peopleActivityDayReportSchema).optional(),
|
|
704
783
|
generatedAt: z4.string(),
|
|
705
784
|
people: z4.array(actorSummaryReportSchema),
|
|
706
785
|
source: z4.literal("conversation_index"),
|
|
@@ -709,6 +788,7 @@ var actorDirectoryReportSchema = z4.object({
|
|
|
709
788
|
}).strict();
|
|
710
789
|
var actorProfileReportSchema = z4.object({
|
|
711
790
|
activityDays: z4.array(actorActivityDayReportSchema),
|
|
791
|
+
activityHours: z4.array(actorActivityDayReportSchema).optional(),
|
|
712
792
|
generatedAt: z4.string(),
|
|
713
793
|
locations: z4.array(peopleConversationStatsItemSchema),
|
|
714
794
|
recentConversations: z4.array(conversationSummaryReportSchema),
|
|
@@ -741,13 +821,15 @@ var locationSummaryReportSchema = conversationStatsItemSchema.extend({
|
|
|
741
821
|
visibility: z5.literal("public")
|
|
742
822
|
}).strict();
|
|
743
823
|
var locationActorSummaryReportSchema = conversationStatsItemSchema.extend({ actor: actorIdentitySchema }).strict();
|
|
824
|
+
var locationMetricBucketSchema = z5.string().regex(/^\d{4}-\d{2}-\d{2}(T\d{2})?$/);
|
|
744
825
|
var locationActivityDayReportSchema = z5.object({
|
|
745
|
-
date:
|
|
826
|
+
date: locationMetricBucketSchema,
|
|
746
827
|
privateConversations: z5.number(),
|
|
747
828
|
publicConversations: z5.number()
|
|
748
829
|
}).strict();
|
|
749
830
|
var locationDirectoryReportSchema = z5.object({
|
|
750
831
|
activityDays: z5.array(locationActivityDayReportSchema),
|
|
832
|
+
activityHours: z5.array(locationActivityDayReportSchema).optional(),
|
|
751
833
|
generatedAt: z5.string(),
|
|
752
834
|
locations: z5.array(locationSummaryReportSchema),
|
|
753
835
|
privateActivity: conversationStatsItemSchema,
|
|
@@ -757,6 +839,7 @@ var locationDirectoryReportSchema = z5.object({
|
|
|
757
839
|
}).strict();
|
|
758
840
|
var locationDetailReportSchema = locationSummaryReportSchema.extend({
|
|
759
841
|
activityDays: z5.array(dailyConversationActivitySchema),
|
|
842
|
+
activityHours: z5.array(dailyConversationActivitySchema).optional(),
|
|
760
843
|
actors: z5.array(locationActorSummaryReportSchema),
|
|
761
844
|
generatedAt: z5.string(),
|
|
762
845
|
recentConversations: z5.array(conversationSummaryReportSchema),
|
|
@@ -867,13 +950,15 @@ var taskSummarySchema = z9.discriminatedUnion("kind", [
|
|
|
867
950
|
scheduledTaskSummarySchema,
|
|
868
951
|
eventTaskSummarySchema
|
|
869
952
|
]);
|
|
953
|
+
var taskMetricBucketSchema = z9.string().regex(/^\d{4}-\d{2}-\d{2}(T\d{2})?$/);
|
|
870
954
|
var taskExecutionDaySchema = z9.object({
|
|
871
|
-
date:
|
|
955
|
+
date: taskMetricBucketSchema,
|
|
872
956
|
event: z9.number().int().nonnegative(),
|
|
873
957
|
scheduled: z9.number().int().nonnegative()
|
|
874
958
|
}).strict();
|
|
875
959
|
var taskListSchema = z9.object({
|
|
876
960
|
executionDays: z9.array(taskExecutionDaySchema),
|
|
961
|
+
executionHours: z9.array(taskExecutionDaySchema).optional(),
|
|
877
962
|
tasks: z9.array(taskSummarySchema),
|
|
878
963
|
truncated: z9.boolean()
|
|
879
964
|
}).strict();
|
|
@@ -896,11 +981,12 @@ var taskExecutionSchema = z9.object({
|
|
|
896
981
|
var taskExecutionStatusDaySchema = z9.object({
|
|
897
982
|
blocked: z9.number().int().nonnegative(),
|
|
898
983
|
completed: z9.number().int().nonnegative(),
|
|
899
|
-
date:
|
|
984
|
+
date: taskMetricBucketSchema,
|
|
900
985
|
failed: z9.number().int().nonnegative()
|
|
901
986
|
}).strict();
|
|
902
987
|
var taskExecutionListSchema = z9.object({
|
|
903
988
|
executionDays: z9.array(taskExecutionStatusDaySchema),
|
|
989
|
+
executionHours: z9.array(taskExecutionStatusDaySchema).optional(),
|
|
904
990
|
executions: z9.array(taskExecutionSchema),
|
|
905
991
|
task: taskSummarySchema,
|
|
906
992
|
truncated: z9.boolean()
|
|
@@ -964,8 +1050,17 @@ export {
|
|
|
964
1050
|
codeChangeSummaryReportSchema,
|
|
965
1051
|
codeOverviewReportSchema,
|
|
966
1052
|
codePersonReportSchema,
|
|
1053
|
+
HOUR_MS,
|
|
1054
|
+
DAY_MS,
|
|
1055
|
+
utcDayKey,
|
|
1056
|
+
utcHourKey,
|
|
1057
|
+
trailingUtcDayWindow,
|
|
1058
|
+
trailingUtcHourWindow,
|
|
1059
|
+
fillUtcDays,
|
|
1060
|
+
fillUtcHours,
|
|
967
1061
|
dailyConversationActivitySchema,
|
|
968
1062
|
activityDays,
|
|
1063
|
+
activityHours,
|
|
969
1064
|
locationParamsSchema,
|
|
970
1065
|
locationActivityDayReportSchema,
|
|
971
1066
|
locationDirectoryReportSchema,
|
|
@@ -8,14 +8,14 @@ import {
|
|
|
8
8
|
getConversationStore,
|
|
9
9
|
parseDestination,
|
|
10
10
|
sameDestination
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-AKR6W7VV.js";
|
|
12
12
|
import {
|
|
13
13
|
getDefaultRedisStateAdapterFor,
|
|
14
14
|
getStateAdapter
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-LRTEMMCZ.js";
|
|
16
16
|
import {
|
|
17
17
|
getChatConfig
|
|
18
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-4Z7B5WVV.js";
|
|
19
19
|
import {
|
|
20
20
|
parseStoredSlackActor
|
|
21
21
|
} from "./chunk-N7TMSOZH.js";
|
|
@@ -23,7 +23,7 @@ import {
|
|
|
23
23
|
isRecord,
|
|
24
24
|
toOptionalNumber,
|
|
25
25
|
toOptionalString
|
|
26
|
-
} from "./chunk-
|
|
26
|
+
} from "./chunk-3ADPXQBL.js";
|
|
27
27
|
|
|
28
28
|
// src/chat/task-execution/state.ts
|
|
29
29
|
import { randomUUID } from "crypto";
|