@sentry/junior 0.146.0 → 0.148.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-SLJADYE5.js → agent-hooks-VAUYT6PD.js} +10 -10
- package/dist/api/conversations/access.d.ts +2 -1
- package/dist/api/conversations/archive.d.ts +3 -5
- package/dist/api/conversations/create.d.ts +6 -0
- package/dist/api/conversations/detail.d.ts +2 -295
- package/dist/api/conversations/event-list.d.ts +2 -192
- package/dist/api/conversations/list.d.ts +4 -66
- package/dist/api/conversations/routes.d.ts +1 -1
- package/dist/api/conversations/stats.d.ts +0 -54
- package/dist/api/http.d.ts +2 -6
- package/dist/api/locations/detail.d.ts +3 -111
- package/dist/api/locations/list.d.ts +0 -45
- package/dist/api/locations/query.d.ts +2 -1
- package/dist/api/locations/routes.d.ts +1 -1
- package/dist/api/people/list.d.ts +0 -29
- package/dist/api/people/profile.d.ts +2 -106
- package/dist/api/people/profile.query.d.ts +2 -1
- package/dist/api/people/routes.d.ts +1 -1
- package/dist/api/people/shared.d.ts +1 -1
- package/dist/api/people/spend.d.ts +3 -4
- package/dist/api/personal-tokens/routes.d.ts +2 -2
- package/dist/api/route.d.ts +8 -14
- package/dist/api/schema/conversation.d.ts +64 -29
- package/dist/api/schema/location.d.ts +4 -0
- package/dist/api/schema/person.d.ts +7 -3
- package/dist/api/schema.d.ts +2 -2
- package/dist/api/schema.js +7 -1
- package/dist/api/stats.d.ts +0 -13
- package/dist/api/validation.d.ts +7 -0
- package/dist/api/viewer.d.ts +3 -0
- package/dist/api.d.ts +2 -1
- package/dist/api.js +630 -564
- package/dist/app.js +369 -309
- package/dist/{catalog-runtime-RQIMSDPR.js → catalog-runtime-WADOZVTB.js} +5 -5
- package/dist/chat/actor.d.ts +4 -1
- package/dist/chat/agent/prompt.d.ts +0 -2
- package/dist/chat/agent/request.d.ts +4 -5
- package/dist/chat/agent/resume.d.ts +1 -0
- package/dist/chat/agent/sandbox.d.ts +2 -2
- package/dist/chat/agent/tools.d.ts +0 -2
- package/dist/chat/agent-dispatch/context.d.ts +2 -2
- package/dist/chat/agent-dispatch/types.d.ts +2 -2
- package/dist/chat/agent-invocations/types.d.ts +52 -0
- package/dist/chat/api-turns/work.d.ts +103 -0
- package/dist/chat/capabilities/jr-rpc-command.d.ts +2 -2
- package/dist/chat/configuration/service.d.ts +5 -2
- package/dist/chat/configuration/sql.d.ts +9 -0
- package/dist/chat/configuration/types.d.ts +17 -13
- package/dist/chat/conversations/history.d.ts +63 -0
- package/dist/chat/conversations/projection.d.ts +10 -0
- package/dist/chat/conversations/provenance.d.ts +6 -0
- package/dist/chat/conversations/sql/actor-identity.d.ts +19 -0
- package/dist/chat/conversations/store.d.ts +1 -1
- package/dist/chat/credentials/unlink-provider.d.ts +2 -1
- package/dist/chat/credentials/user-token-store.d.ts +2 -0
- package/dist/chat/event-tasks/tool-support.d.ts +2 -0
- package/dist/chat/identities/sql.d.ts +8 -0
- package/dist/chat/logging.d.ts +2 -0
- package/dist/chat/mcp/auth-store.d.ts +0 -2
- package/dist/chat/mcp/oauth.d.ts +0 -2
- package/dist/chat/oauth-flow.d.ts +3 -1
- package/dist/chat/pi/client.d.ts +2 -0
- package/dist/chat/plugins/credential-hooks.d.ts +2 -0
- package/dist/chat/prompt.d.ts +0 -2
- package/dist/chat/resource-events/notification.d.ts +2 -1
- package/dist/chat/resource-events/store.d.ts +1 -1
- package/dist/chat/runtime/delivered-turn-state.d.ts +1 -4
- package/dist/chat/runtime/reply-executor.d.ts +1 -1
- package/dist/chat/runtime/slack-runtime.d.ts +2 -1
- package/dist/chat/runtime/thread-state.d.ts +8 -11
- package/dist/chat/runtime/turn-input.d.ts +4 -2
- package/dist/chat/runtime/turn-preparation.d.ts +11 -4
- package/dist/chat/sandbox/command-result.d.ts +2 -0
- package/dist/chat/sandbox/egress/schemas.d.ts +6 -0
- package/dist/chat/scheduled-tasks/tool-support.d.ts +7 -5
- package/dist/chat/scheduled-tasks/tools/create.d.ts +4 -2
- package/dist/chat/scheduled-tasks/tools/delete.d.ts +4 -2
- package/dist/chat/scheduled-tasks/tools/list.d.ts +4 -2
- package/dist/chat/scheduled-tasks/tools/run-now.d.ts +4 -2
- package/dist/chat/scheduled-tasks/tools/update.d.ts +4 -2
- package/dist/chat/services/mcp-auth-orchestration.d.ts +0 -3
- package/dist/chat/services/plugin-auth-orchestration.d.ts +2 -1
- package/dist/chat/services/provider-default-config.d.ts +2 -2
- package/dist/chat/services/subscribed-decision.d.ts +3 -0
- package/dist/chat/services/subscribed-reply-policy.d.ts +1 -0
- package/dist/chat/services/turn-result.d.ts +0 -3
- package/dist/chat/services/turn-router.d.ts +3 -0
- package/dist/chat/slack/assistant-thread/lifecycle.d.ts +0 -1
- package/dist/chat/slack/assistant-thread/title.d.ts +0 -3
- package/dist/chat/slack/channel.d.ts +26 -0
- package/dist/chat/slack/dispatch-turn.d.ts +2 -1
- package/dist/chat/slack/timestamp-param.d.ts +0 -2
- package/dist/chat/slack/{tools → tool-support}/canvas/api.d.ts +1 -1
- package/dist/chat/slack/tool-support/canvas/context.d.ts +11 -0
- package/dist/chat/slack/tool-support/channel-access.d.ts +42 -0
- package/dist/chat/slack/tool-support/channel-target.d.ts +27 -0
- package/dist/chat/slack/{tools → tool-support}/list/api.d.ts +8 -1
- package/dist/chat/slack/tool-support/list/params.d.ts +5 -0
- package/dist/chat/slack/tools/canvas/create.d.ts +3 -1
- package/dist/chat/slack/tools/canvas/edit.d.ts +2 -0
- package/dist/chat/slack/tools/canvas/read.d.ts +2 -0
- package/dist/chat/slack/tools/canvas/write.d.ts +2 -0
- package/dist/chat/slack/tools/{user-lookup.d.ts → channel-join.d.ts} +6 -5
- package/dist/chat/slack/tools/channel-list-messages.d.ts +5 -2
- package/dist/chat/slack/tools/conversation-message-search.d.ts +4 -8
- package/dist/chat/slack/tools/list/add-items.d.ts +4 -1
- package/dist/chat/slack/tools/list/create.d.ts +2 -0
- package/dist/chat/slack/tools/list/get-items.d.ts +5 -3
- package/dist/chat/slack/tools/list/update-item.d.ts +5 -1
- package/dist/chat/slack/tools/message-add-reaction.d.ts +3 -1
- package/dist/chat/slack/tools/public-search.d.ts +65 -2
- package/dist/chat/slack/tools/send-files.d.ts +3 -1
- package/dist/chat/slack/tools/thread-read.d.ts +4 -5
- package/dist/chat/slack/vision-cache.d.ts +5 -0
- package/dist/chat/source.d.ts +2 -0
- package/dist/chat/state/conversation.d.ts +4 -5
- package/dist/chat/task-execution/checkpoint.d.ts +1 -0
- package/dist/chat/task-execution/state.d.ts +9 -4
- package/dist/chat/task-execution/store.d.ts +3 -2
- package/dist/chat/task-execution/turn-cursor.d.ts +2 -0
- package/dist/chat/task-execution/worker.d.ts +2 -0
- package/dist/chat/tasks/read.d.ts +1 -1
- package/dist/chat/tool-support/structured-result.d.ts +1 -0
- package/dist/chat/tool-support/timed-out-tool-result.d.ts +11 -0
- package/dist/chat/tools/create-event-task.d.ts +2 -0
- package/dist/chat/tools/delete-event-task.d.ts +2 -0
- package/dist/chat/tools/handoff/tool.d.ts +2 -0
- package/dist/chat/tools/list-event-tasks.d.ts +2 -0
- package/dist/chat/tools/list-resource-event-subscriptions.d.ts +2 -0
- package/dist/chat/tools/runtime/report-progress.d.ts +2 -0
- package/dist/chat/tools/runtime/spawn-agent.d.ts +2 -0
- package/dist/chat/tools/search-conversation-events.d.ts +3 -1
- package/dist/chat/tools/search-resource-event-types.d.ts +2 -0
- package/dist/chat/tools/search-tools.d.ts +2 -0
- package/dist/chat/tools/skill/load-skill.d.ts +2 -0
- package/dist/chat/tools/skill/search-mcp-tools.d.ts +2 -0
- package/dist/chat/tools/stop-watching-resources.d.ts +2 -0
- package/dist/chat/tools/system-time.d.ts +2 -0
- package/dist/chat/tools/types.d.ts +11 -10
- package/dist/chat/tools/update-event-task.d.ts +2 -0
- package/dist/chat/tools/user-lookup.d.ts +29 -0
- package/dist/chat/tools/watch-resource-events.d.ts +4 -2
- package/dist/chat/tools/web/fetch-tool.d.ts +2 -0
- package/dist/chat/tools/web/image-generate.d.ts +2 -0
- package/dist/chat/tools/web/search.d.ts +2 -0
- package/dist/{chunk-GYEKOX7N.js → chunk-2B3PT3V2.js} +1 -1
- package/dist/{chunk-JLMVCNXL.js → chunk-45LOR4PU.js} +22 -4
- package/dist/{chunk-FGHADGIC.js → chunk-4AQZYNHM.js} +2 -2
- package/dist/{chunk-W65V465O.js → chunk-4EA2SFK2.js} +66 -4
- package/dist/{chunk-MKRIZ4VG.js → chunk-4GXJUYJV.js} +4 -2
- package/dist/{chunk-F7REGDKO.js → chunk-55F4QU2V.js} +2 -1
- package/dist/{chunk-M6ZWP4RI.js → chunk-7OEIXFC3.js} +2 -2
- package/dist/{chunk-MCFIXAV5.js → chunk-D3WPMGEX.js} +55 -37
- package/dist/{chunk-AISNSNDV.js → chunk-D6YX4NNN.js} +22 -10
- package/dist/chunk-DUY5CDAM.js +36 -0
- package/dist/{chunk-B63BF443.js → chunk-EAI67NTM.js} +9 -1
- package/dist/{chunk-FEKQHPVA.js → chunk-EINWQFXI.js} +9 -8
- package/dist/chunk-GDFF3BQG.js +136 -0
- package/dist/{chunk-X22KCSCO.js → chunk-GXYDVZKM.js} +7 -5
- package/dist/{chunk-X2WMBTS3.js → chunk-HLPLT3NY.js} +8 -5
- package/dist/{chunk-PB222GIA.js → chunk-HWQGBIH7.js} +1 -1
- package/dist/chunk-IL4EDBMV.js +566 -0
- package/dist/{chunk-HQE6EJS5.js → chunk-LAZGHEYU.js} +1 -1
- package/dist/{chunk-QG7OOKIN.js → chunk-LE5H7LMT.js} +1 -1
- package/dist/chunk-LNVEIJ2L.js +48 -0
- package/dist/{chunk-JUA6VU2Z.js → chunk-OJCP3C3J.js} +12 -23
- package/dist/{chunk-37JJDS4H.js → chunk-POSZWRGL.js} +1 -1
- package/dist/{chunk-TCEJ7XXM.js → chunk-QOWHHM3F.js} +1 -1
- package/dist/{chunk-H6U2U3EP.js → chunk-RRJV5UR5.js} +304 -65
- package/dist/{chunk-OFPYOC3M.js → chunk-ULAU5ZGU.js} +127 -120
- package/dist/{chunk-V6SRLKUB.js → chunk-V2FXMOEA.js} +2 -2
- package/dist/{chunk-GDQEU4I7.js → chunk-VCYSOXON.js} +296 -526
- package/dist/{chunk-BLETMLRX.js → chunk-VMNRXKAH.js} +1374 -989
- package/dist/{chunk-37EVZP66.js → chunk-VRHTNBA6.js} +167 -92
- package/dist/{chunk-FXDDDSPL.js → chunk-VY6W3T43.js} +4 -4
- package/dist/{chunk-ZDGHGY74.js → chunk-WCN4YSH7.js} +13 -6
- package/dist/{chunk-PH4Q3A6W.js → chunk-WOONT5ZP.js} +1 -1
- package/dist/{chunk-47OSH2ZO.js → chunk-XJ42NBP5.js} +395 -206
- package/dist/{chunk-SCGVWUZX.js → chunk-ZCHIC2GM.js} +92 -75
- package/dist/chunk-ZPL2RR7F.js +798 -0
- package/dist/cli/chat.js +33 -35
- 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/agent-invocations.d.ts +20 -0
- package/dist/db/schema/conversation-annotations.d.ts +2 -2
- package/dist/db/schema/location-configurations.d.ts +127 -0
- package/dist/db/schema.d.ts +150 -3
- package/dist/{db-WWOMXWTT.js → db-XUKZRFFK.js} +7 -7
- package/dist/instrumentation.js +4 -4
- package/dist/nitro.js +2 -2
- package/dist/{oauth-callback-server-A6ZZX74U.js → oauth-callback-server-LPZMMGFI.js} +25 -26
- package/dist/{runner-KSGB2UAV.js → runner-DGKUTMPX.js} +22 -41
- package/dist/{skills-26QPWKVS.js → skills-P7YUFSXM.js} +6 -6
- package/dist/spawn-DSK3ZEVD.js +38 -0
- package/dist/{validation-OPSRGFGH.js → validation-S7U5M5NR.js} +6 -6
- package/dist/version.js +1 -1
- package/dist/{work-VMSW7STJ.js → work-GAA7TVAD.js} +18 -19
- package/dist/{worker-2JNFB7C7.js → worker-JXPJH3QB.js} +11 -10
- package/migrations/0024_misty_typhoid_mary.sql +12 -0
- package/migrations/meta/0024_snapshot.json +2275 -0
- package/migrations/meta/_journal.json +7 -0
- package/package.json +6 -5
- package/dist/api/health.d.ts +0 -7
- package/dist/api/personal-tokens/create.d.ts +0 -11
- package/dist/api/personal-tokens/list.d.ts +0 -12
- package/dist/api/personal-tokens/revoke.d.ts +0 -5
- package/dist/api/plugin-reports.d.ts +0 -63
- package/dist/api/plugins.d.ts +0 -8
- package/dist/api/runtime.d.ts +0 -24
- package/dist/api/skills.d.ts +0 -6
- package/dist/chat/slack/tools/canvas/context.d.ts +0 -18
- package/dist/chat/slack/tools/channel-access.d.ts +0 -30
- package/dist/chat/state/artifacts.d.ts +0 -30
- package/dist/chat/tool-support/turn-deadline-result.d.ts +0 -3
- package/dist/chunk-HLXXQI5Q.js +0 -238
- package/dist/chunk-LVW7BLLT.js +0 -115
- package/dist/chunk-Q6QZTTLS.js +0 -55
- package/dist/chunk-QSXZ42KX.js +0 -285
- package/dist/chunk-R776HKPK.js +0 -81
- package/dist/chunk-T5GXFFLA.js +0 -67
- package/dist/spawn-5LAJXZ2P.js +0 -39
- /package/dist/chat/slack/{tools → tool-support}/canvas/markdown.d.ts +0 -0
- /package/dist/chat/slack/{tools → tool-support}/channel-capabilities.d.ts +0 -0
- /package/dist/chat/slack/{tools → tool-support}/context.d.ts +0 -0
- /package/dist/chat/slack/{tools → tool-support}/slack-message-url.d.ts +0 -0
package/dist/chunk-Q6QZTTLS.js
DELETED
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
// src/chat/conversations/turn-lifecycle.ts
|
|
2
|
-
var ConversationTurnLifecycleService = class {
|
|
3
|
-
constructor(events) {
|
|
4
|
-
this.events = events;
|
|
5
|
-
}
|
|
6
|
-
events;
|
|
7
|
-
/** Record the turn start once after every input message is durable. */
|
|
8
|
-
async start(input) {
|
|
9
|
-
await this.events.append(input.conversationId, [
|
|
10
|
-
{
|
|
11
|
-
idempotencyKey: `turn:${input.turnId}:started`,
|
|
12
|
-
createdAtMs: input.createdAtMs,
|
|
13
|
-
data: {
|
|
14
|
-
type: "turn_started",
|
|
15
|
-
turnId: input.turnId,
|
|
16
|
-
inputMessageIds: input.inputMessageIds,
|
|
17
|
-
surface: input.surface
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
]);
|
|
21
|
-
}
|
|
22
|
-
/** Record successful or intentional-silence completion once. */
|
|
23
|
-
async complete(input) {
|
|
24
|
-
await this.events.append(input.conversationId, [
|
|
25
|
-
{
|
|
26
|
-
idempotencyKey: `turn:${input.turnId}:terminal`,
|
|
27
|
-
createdAtMs: input.createdAtMs,
|
|
28
|
-
data: {
|
|
29
|
-
type: "turn_completed",
|
|
30
|
-
turnId: input.turnId,
|
|
31
|
-
outcome: input.outcome
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
]);
|
|
35
|
-
}
|
|
36
|
-
/** Record a classified failure once without accepting raw error details. */
|
|
37
|
-
async fail(input) {
|
|
38
|
-
await this.events.append(input.conversationId, [
|
|
39
|
-
{
|
|
40
|
-
idempotencyKey: `turn:${input.turnId}:terminal`,
|
|
41
|
-
createdAtMs: input.createdAtMs,
|
|
42
|
-
data: {
|
|
43
|
-
type: "turn_failed",
|
|
44
|
-
turnId: input.turnId,
|
|
45
|
-
failureCode: input.failureCode,
|
|
46
|
-
...input.eventId ? { eventId: input.eventId } : {}
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
]);
|
|
50
|
-
}
|
|
51
|
-
};
|
|
52
|
-
|
|
53
|
-
export {
|
|
54
|
-
ConversationTurnLifecycleService
|
|
55
|
-
};
|
package/dist/chunk-QSXZ42KX.js
DELETED
|
@@ -1,285 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
getDb
|
|
3
|
-
} from "./chunk-37EVZP66.js";
|
|
4
|
-
import {
|
|
5
|
-
juniorConversations,
|
|
6
|
-
juniorTaskExecutions
|
|
7
|
-
} from "./chunk-MCFIXAV5.js";
|
|
8
|
-
import {
|
|
9
|
-
logWarn
|
|
10
|
-
} from "./chunk-B63BF443.js";
|
|
11
|
-
|
|
12
|
-
// src/chat/tasks/execution-stats.ts
|
|
13
|
-
import {
|
|
14
|
-
and,
|
|
15
|
-
asc,
|
|
16
|
-
count,
|
|
17
|
-
desc,
|
|
18
|
-
eq,
|
|
19
|
-
gte,
|
|
20
|
-
inArray,
|
|
21
|
-
lte,
|
|
22
|
-
max,
|
|
23
|
-
or,
|
|
24
|
-
sql
|
|
25
|
-
} from "drizzle-orm";
|
|
26
|
-
var TASK_EXECUTION_TYPES = ["scheduled", "event"];
|
|
27
|
-
var TASK_EXECUTION_STATUSES = [
|
|
28
|
-
"blocked",
|
|
29
|
-
"completed",
|
|
30
|
-
"failed"
|
|
31
|
-
];
|
|
32
|
-
function utcDate(nowMs) {
|
|
33
|
-
return new Date(nowMs).toISOString().slice(0, 10);
|
|
34
|
-
}
|
|
35
|
-
function emptyDay(date) {
|
|
36
|
-
return { date, event: 0, scheduled: 0 };
|
|
37
|
-
}
|
|
38
|
-
function emptyStatusDay(date) {
|
|
39
|
-
return { blocked: 0, completed: 0, date, failed: 0 };
|
|
40
|
-
}
|
|
41
|
-
async function recordTaskExecution(type, taskId, options) {
|
|
42
|
-
const namespace = options.namespace ?? "junior";
|
|
43
|
-
const nowMs = options.nowMs ?? Date.now();
|
|
44
|
-
const status = options.status ?? "completed";
|
|
45
|
-
try {
|
|
46
|
-
await getDb().insert(juniorTaskExecutions).values({
|
|
47
|
-
...options.conversationId ? { conversationId: options.conversationId } : {},
|
|
48
|
-
executedAtMs: nowMs,
|
|
49
|
-
executionId: options.executionId,
|
|
50
|
-
kind: type,
|
|
51
|
-
namespace,
|
|
52
|
-
status,
|
|
53
|
-
taskId
|
|
54
|
-
}).onConflictDoNothing({
|
|
55
|
-
target: [
|
|
56
|
-
juniorTaskExecutions.kind,
|
|
57
|
-
juniorTaskExecutions.namespace,
|
|
58
|
-
juniorTaskExecutions.executionId
|
|
59
|
-
]
|
|
60
|
-
});
|
|
61
|
-
} catch (error) {
|
|
62
|
-
logWarn("task.execution.stat_failed", {
|
|
63
|
-
error,
|
|
64
|
-
"app.task.execution.id": options.executionId,
|
|
65
|
-
"app.task.execution.namespace": namespace,
|
|
66
|
-
"app.task.execution.status": status,
|
|
67
|
-
"app.task.execution.task_id": taskId,
|
|
68
|
-
"app.task.execution.type": type
|
|
69
|
-
});
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
async function readTaskExecutionSummaries(type, namespace, options = {}) {
|
|
73
|
-
const sevenDaysAgoMs = (options.nowMs ?? Date.now()) - 7 * 24 * 60 * 60 * 1e3;
|
|
74
|
-
const db = getDb();
|
|
75
|
-
const latest = db.selectDistinctOn([juniorTaskExecutions.taskId], {
|
|
76
|
-
conversationId: juniorTaskExecutions.conversationId,
|
|
77
|
-
taskId: juniorTaskExecutions.taskId
|
|
78
|
-
}).from(juniorTaskExecutions).where(
|
|
79
|
-
and(
|
|
80
|
-
eq(juniorTaskExecutions.kind, type),
|
|
81
|
-
eq(juniorTaskExecutions.namespace, namespace)
|
|
82
|
-
)
|
|
83
|
-
).orderBy(
|
|
84
|
-
juniorTaskExecutions.taskId,
|
|
85
|
-
desc(juniorTaskExecutions.executedAtMs),
|
|
86
|
-
desc(juniorTaskExecutions.executionId)
|
|
87
|
-
).as("latest_task_execution");
|
|
88
|
-
const rows = await db.select({
|
|
89
|
-
lastConversationId: latest.conversationId,
|
|
90
|
-
lastExecutedAtMs: max(juniorTaskExecutions.executedAtMs),
|
|
91
|
-
runsLast7Days: sql`count(*) filter (where ${juniorTaskExecutions.executedAtMs} >= ${sevenDaysAgoMs})::int`,
|
|
92
|
-
taskId: juniorTaskExecutions.taskId,
|
|
93
|
-
totalRuns: sql`count(*)::int`
|
|
94
|
-
}).from(juniorTaskExecutions).innerJoin(latest, eq(latest.taskId, juniorTaskExecutions.taskId)).where(
|
|
95
|
-
and(
|
|
96
|
-
eq(juniorTaskExecutions.kind, type),
|
|
97
|
-
eq(juniorTaskExecutions.namespace, namespace)
|
|
98
|
-
)
|
|
99
|
-
).groupBy(juniorTaskExecutions.taskId, latest.conversationId);
|
|
100
|
-
return new Map(
|
|
101
|
-
rows.map((row) => [
|
|
102
|
-
row.taskId,
|
|
103
|
-
{
|
|
104
|
-
...row.lastConversationId ? { lastConversationId: row.lastConversationId } : {},
|
|
105
|
-
...row.lastExecutedAtMs !== null ? { lastExecutedAtMs: row.lastExecutedAtMs } : {},
|
|
106
|
-
runsLast7Days: row.runsLast7Days,
|
|
107
|
-
totalRuns: row.totalRuns
|
|
108
|
-
}
|
|
109
|
-
])
|
|
110
|
-
);
|
|
111
|
-
}
|
|
112
|
-
async function readTaskExecutionDays(dayCount = 90, options = {}) {
|
|
113
|
-
const nowMs = options.nowMs ?? Date.now();
|
|
114
|
-
const end = utcDate(nowMs);
|
|
115
|
-
const endMs = Date.parse(`${end}T23:59:59.999Z`);
|
|
116
|
-
const startMs = Date.parse(`${end}T00:00:00.000Z`) - (dayCount - 1) * 864e5;
|
|
117
|
-
const executionDate = sql`to_char(to_timestamp(${juniorTaskExecutions.executedAtMs} / 1000.0) at time zone 'UTC', 'YYYY-MM-DD')`;
|
|
118
|
-
const rows = await getDb().select({
|
|
119
|
-
count: count(),
|
|
120
|
-
date: executionDate,
|
|
121
|
-
kind: juniorTaskExecutions.kind
|
|
122
|
-
}).from(juniorTaskExecutions).where(
|
|
123
|
-
and(
|
|
124
|
-
gte(juniorTaskExecutions.executedAtMs, startMs),
|
|
125
|
-
lte(juniorTaskExecutions.executedAtMs, endMs),
|
|
126
|
-
eq(juniorTaskExecutions.status, "completed")
|
|
127
|
-
)
|
|
128
|
-
).groupBy(executionDate, juniorTaskExecutions.kind).orderBy(asc(executionDate), asc(juniorTaskExecutions.kind));
|
|
129
|
-
const byDate = /* @__PURE__ */ new Map();
|
|
130
|
-
for (let offset = 0; offset < dayCount; offset += 1) {
|
|
131
|
-
const date = utcDate(startMs + offset * 864e5);
|
|
132
|
-
byDate.set(date, emptyDay(date));
|
|
133
|
-
}
|
|
134
|
-
for (const row of rows) {
|
|
135
|
-
const day = byDate.get(row.date);
|
|
136
|
-
if (!day) continue;
|
|
137
|
-
if (row.kind === "scheduled") day.scheduled = row.count;
|
|
138
|
-
else if (row.kind === "event") day.event = row.count;
|
|
139
|
-
}
|
|
140
|
-
return [...byDate.values()];
|
|
141
|
-
}
|
|
142
|
-
async function readTaskExecutionByConversationId(args) {
|
|
143
|
-
const namespace = args.namespace ?? "junior";
|
|
144
|
-
const rows = await getDb().select({
|
|
145
|
-
kind: juniorTaskExecutions.kind,
|
|
146
|
-
taskId: juniorTaskExecutions.taskId
|
|
147
|
-
}).from(juniorTaskExecutions).where(
|
|
148
|
-
and(
|
|
149
|
-
eq(juniorTaskExecutions.conversationId, args.conversationId),
|
|
150
|
-
eq(juniorTaskExecutions.namespace, namespace),
|
|
151
|
-
inArray(juniorTaskExecutions.kind, [...TASK_EXECUTION_TYPES])
|
|
152
|
-
)
|
|
153
|
-
).orderBy(
|
|
154
|
-
desc(juniorTaskExecutions.executedAtMs),
|
|
155
|
-
desc(juniorTaskExecutions.executionId)
|
|
156
|
-
).limit(1);
|
|
157
|
-
const row = rows[0];
|
|
158
|
-
if (!row) return void 0;
|
|
159
|
-
if (row.kind !== "scheduled" && row.kind !== "event") return void 0;
|
|
160
|
-
return { kind: row.kind, taskId: row.taskId };
|
|
161
|
-
}
|
|
162
|
-
async function readTaskExecutions(args) {
|
|
163
|
-
const namespace = args.namespace ?? "junior";
|
|
164
|
-
const rows = await getDb().select({
|
|
165
|
-
conversationId: juniorTaskExecutions.conversationId,
|
|
166
|
-
executedAtMs: juniorTaskExecutions.executedAtMs,
|
|
167
|
-
executionId: juniorTaskExecutions.executionId,
|
|
168
|
-
status: juniorTaskExecutions.status,
|
|
169
|
-
title: juniorConversations.title
|
|
170
|
-
}).from(juniorTaskExecutions).leftJoin(
|
|
171
|
-
juniorConversations,
|
|
172
|
-
eq(
|
|
173
|
-
juniorConversations.conversationId,
|
|
174
|
-
juniorTaskExecutions.conversationId
|
|
175
|
-
)
|
|
176
|
-
).where(
|
|
177
|
-
and(
|
|
178
|
-
eq(juniorTaskExecutions.kind, args.kind),
|
|
179
|
-
eq(juniorTaskExecutions.namespace, namespace),
|
|
180
|
-
eq(juniorTaskExecutions.taskId, args.taskId)
|
|
181
|
-
)
|
|
182
|
-
).orderBy(
|
|
183
|
-
desc(juniorTaskExecutions.executedAtMs),
|
|
184
|
-
desc(juniorTaskExecutions.executionId)
|
|
185
|
-
).limit(args.limit);
|
|
186
|
-
return rows.map((row) => {
|
|
187
|
-
const title = row.title?.trim();
|
|
188
|
-
return {
|
|
189
|
-
...row.conversationId ? { conversationId: row.conversationId } : {},
|
|
190
|
-
executedAt: new Date(row.executedAtMs).toISOString(),
|
|
191
|
-
executionId: row.executionId,
|
|
192
|
-
status: row.status,
|
|
193
|
-
...title ? { title } : {}
|
|
194
|
-
};
|
|
195
|
-
});
|
|
196
|
-
}
|
|
197
|
-
async function readTaskRuns(args) {
|
|
198
|
-
if (args.tasks.length === 0) return [];
|
|
199
|
-
const namespace = args.namespace ?? "junior";
|
|
200
|
-
const selectors = args.tasks.map(
|
|
201
|
-
(task) => and(
|
|
202
|
-
eq(juniorTaskExecutions.kind, task.kind),
|
|
203
|
-
eq(juniorTaskExecutions.taskId, task.taskId)
|
|
204
|
-
)
|
|
205
|
-
);
|
|
206
|
-
const rows = await getDb().select({
|
|
207
|
-
conversationId: juniorTaskExecutions.conversationId,
|
|
208
|
-
executedAtMs: juniorTaskExecutions.executedAtMs,
|
|
209
|
-
executionId: juniorTaskExecutions.executionId,
|
|
210
|
-
kind: juniorTaskExecutions.kind,
|
|
211
|
-
status: juniorTaskExecutions.status,
|
|
212
|
-
taskId: juniorTaskExecutions.taskId,
|
|
213
|
-
title: juniorConversations.title
|
|
214
|
-
}).from(juniorTaskExecutions).leftJoin(
|
|
215
|
-
juniorConversations,
|
|
216
|
-
eq(
|
|
217
|
-
juniorConversations.conversationId,
|
|
218
|
-
juniorTaskExecutions.conversationId
|
|
219
|
-
)
|
|
220
|
-
).where(and(eq(juniorTaskExecutions.namespace, namespace), or(...selectors))).orderBy(
|
|
221
|
-
desc(juniorTaskExecutions.executedAtMs),
|
|
222
|
-
desc(juniorTaskExecutions.executionId)
|
|
223
|
-
).limit(args.limit);
|
|
224
|
-
return rows.flatMap((row) => {
|
|
225
|
-
if (row.kind !== "scheduled" && row.kind !== "event") return [];
|
|
226
|
-
const title = row.title?.trim();
|
|
227
|
-
return [
|
|
228
|
-
{
|
|
229
|
-
...row.conversationId ? { conversationId: row.conversationId } : {},
|
|
230
|
-
executedAt: new Date(row.executedAtMs).toISOString(),
|
|
231
|
-
executionId: row.executionId,
|
|
232
|
-
kind: row.kind,
|
|
233
|
-
status: row.status,
|
|
234
|
-
taskId: row.taskId,
|
|
235
|
-
...title ? { title } : {}
|
|
236
|
-
}
|
|
237
|
-
];
|
|
238
|
-
});
|
|
239
|
-
}
|
|
240
|
-
async function readTaskExecutionStatusDays(args) {
|
|
241
|
-
const dayCount = args.dayCount ?? 90;
|
|
242
|
-
const namespace = args.namespace ?? "junior";
|
|
243
|
-
const nowMs = args.nowMs ?? Date.now();
|
|
244
|
-
const end = utcDate(nowMs);
|
|
245
|
-
const endMs = Date.parse(`${end}T23:59:59.999Z`);
|
|
246
|
-
const startMs = Date.parse(`${end}T00:00:00.000Z`) - (dayCount - 1) * 864e5;
|
|
247
|
-
const executionDate = sql`to_char(to_timestamp(${juniorTaskExecutions.executedAtMs} / 1000.0) at time zone 'UTC', 'YYYY-MM-DD')`;
|
|
248
|
-
const rows = await getDb().select({
|
|
249
|
-
count: count(),
|
|
250
|
-
date: executionDate,
|
|
251
|
-
status: juniorTaskExecutions.status
|
|
252
|
-
}).from(juniorTaskExecutions).where(
|
|
253
|
-
and(
|
|
254
|
-
eq(juniorTaskExecutions.kind, args.kind),
|
|
255
|
-
eq(juniorTaskExecutions.namespace, namespace),
|
|
256
|
-
eq(juniorTaskExecutions.taskId, args.taskId),
|
|
257
|
-
gte(juniorTaskExecutions.executedAtMs, startMs),
|
|
258
|
-
lte(juniorTaskExecutions.executedAtMs, endMs),
|
|
259
|
-
inArray(juniorTaskExecutions.status, [...TASK_EXECUTION_STATUSES])
|
|
260
|
-
)
|
|
261
|
-
).groupBy(executionDate, juniorTaskExecutions.status).orderBy(asc(executionDate), asc(juniorTaskExecutions.status));
|
|
262
|
-
const byDate = /* @__PURE__ */ new Map();
|
|
263
|
-
for (let offset = 0; offset < dayCount; offset += 1) {
|
|
264
|
-
const date = utcDate(startMs + offset * 864e5);
|
|
265
|
-
byDate.set(date, emptyStatusDay(date));
|
|
266
|
-
}
|
|
267
|
-
for (const row of rows) {
|
|
268
|
-
const day = byDate.get(row.date);
|
|
269
|
-
if (!day) continue;
|
|
270
|
-
if (row.status === "completed") day.completed = row.count;
|
|
271
|
-
else if (row.status === "failed") day.failed = row.count;
|
|
272
|
-
else if (row.status === "blocked") day.blocked = row.count;
|
|
273
|
-
}
|
|
274
|
-
return [...byDate.values()];
|
|
275
|
-
}
|
|
276
|
-
|
|
277
|
-
export {
|
|
278
|
-
recordTaskExecution,
|
|
279
|
-
readTaskExecutionSummaries,
|
|
280
|
-
readTaskExecutionDays,
|
|
281
|
-
readTaskExecutionByConversationId,
|
|
282
|
-
readTaskExecutions,
|
|
283
|
-
readTaskRuns,
|
|
284
|
-
readTaskExecutionStatusDays
|
|
285
|
-
};
|
package/dist/chunk-R776HKPK.js
DELETED
|
@@ -1,81 +0,0 @@
|
|
|
1
|
-
// src/chat/agent/request.ts
|
|
2
|
-
function isAgentRunFeatureDisabled(policy, feature) {
|
|
3
|
-
return policy?.disabledFeatures?.includes(feature) ?? false;
|
|
4
|
-
}
|
|
5
|
-
var RetryableDeliveryError = class extends Error {
|
|
6
|
-
constructor(cause) {
|
|
7
|
-
super("Assistant delivery was transient or ambiguous", { cause });
|
|
8
|
-
this.name = "RetryableDeliveryError";
|
|
9
|
-
}
|
|
10
|
-
};
|
|
11
|
-
function actorFromRouting(routing) {
|
|
12
|
-
if (routing.dispatch?.actor) {
|
|
13
|
-
return routing.dispatch.actor;
|
|
14
|
-
}
|
|
15
|
-
if (routing.actor) {
|
|
16
|
-
return routing.actor;
|
|
17
|
-
}
|
|
18
|
-
if (routing.credentialContext && !("type" in routing.credentialContext.actor)) {
|
|
19
|
-
return routing.credentialContext.actor;
|
|
20
|
-
}
|
|
21
|
-
return void 0;
|
|
22
|
-
}
|
|
23
|
-
function assertRunRoutingConsistency(request) {
|
|
24
|
-
const { destination, source } = request.routing;
|
|
25
|
-
if (source.platform !== destination.platform) {
|
|
26
|
-
throw new TypeError("Run source and destination platforms do not match");
|
|
27
|
-
}
|
|
28
|
-
if (source.platform === "slack" && destination.platform === "slack") {
|
|
29
|
-
if (source.teamId !== destination.teamId) {
|
|
30
|
-
throw new TypeError("Slack source and destination teams do not match");
|
|
31
|
-
}
|
|
32
|
-
} else if (source.platform === "local" && destination.platform === "local") {
|
|
33
|
-
if (source.conversationId !== destination.conversationId) {
|
|
34
|
-
throw new TypeError(
|
|
35
|
-
"Local source and destination conversation IDs do not match"
|
|
36
|
-
);
|
|
37
|
-
}
|
|
38
|
-
if (request.routing.surface !== "internal" && destination.conversationId !== request.conversationId) {
|
|
39
|
-
throw new TypeError(
|
|
40
|
-
"Local source, destination, and run conversation IDs do not match"
|
|
41
|
-
);
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
const actor = request.routing.dispatch?.actor ?? request.routing.actor;
|
|
45
|
-
if (!actor || actor.platform === "system") {
|
|
46
|
-
return;
|
|
47
|
-
}
|
|
48
|
-
if (actor.platform !== destination.platform) {
|
|
49
|
-
throw new TypeError(
|
|
50
|
-
`Actor platform "${actor.platform}" does not match destination platform "${destination.platform}"`
|
|
51
|
-
);
|
|
52
|
-
}
|
|
53
|
-
if (actor.platform === "slack" && destination.platform === "slack" && actor.teamId !== destination.teamId) {
|
|
54
|
-
throw new TypeError("Slack actor team does not match destination team");
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
function toolInvocationDestination(routing) {
|
|
58
|
-
if (routing.destination.platform !== "slack" || !routing.toolChannelId) {
|
|
59
|
-
return routing.destination;
|
|
60
|
-
}
|
|
61
|
-
return {
|
|
62
|
-
platform: "slack",
|
|
63
|
-
teamId: routing.destination.teamId,
|
|
64
|
-
channelId: routing.toolChannelId
|
|
65
|
-
};
|
|
66
|
-
}
|
|
67
|
-
function surfaceFromRouting(routing) {
|
|
68
|
-
if (routing.surface) {
|
|
69
|
-
return routing.surface;
|
|
70
|
-
}
|
|
71
|
-
return routing.source.platform === "slack" ? "slack" : "internal";
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
export {
|
|
75
|
-
isAgentRunFeatureDisabled,
|
|
76
|
-
RetryableDeliveryError,
|
|
77
|
-
actorFromRouting,
|
|
78
|
-
assertRunRoutingConsistency,
|
|
79
|
-
toolInvocationDestination,
|
|
80
|
-
surfaceFromRouting
|
|
81
|
-
};
|
package/dist/chunk-T5GXFFLA.js
DELETED
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
botConfig,
|
|
3
|
-
resolveGatewayModel
|
|
4
|
-
} from "./chunk-MKRIZ4VG.js";
|
|
5
|
-
|
|
6
|
-
// src/chat/services/context-budget.ts
|
|
7
|
-
var COMPACTION_TRIGGER_RATIO = 0.9;
|
|
8
|
-
var CONTEXT_INPUT_LIMIT_RATIO = 0.95;
|
|
9
|
-
var COMPACTION_TARGET_RATIO = 0.8;
|
|
10
|
-
var FALLBACK_CONTEXT_WINDOW_TOKENS = 4e5;
|
|
11
|
-
function positiveInteger(value, fallback) {
|
|
12
|
-
return Number.isFinite(value) && value > 0 ? Math.floor(value) : fallback;
|
|
13
|
-
}
|
|
14
|
-
function estimateTextTokens(text) {
|
|
15
|
-
return Math.ceil(text.length / 4);
|
|
16
|
-
}
|
|
17
|
-
function calculateContextCompactionTriggerTokens(model) {
|
|
18
|
-
const contextWindow = positiveInteger(
|
|
19
|
-
model.contextWindow,
|
|
20
|
-
FALLBACK_CONTEXT_WINDOW_TOKENS
|
|
21
|
-
);
|
|
22
|
-
return Math.max(1, Math.floor(contextWindow * COMPACTION_TRIGGER_RATIO));
|
|
23
|
-
}
|
|
24
|
-
function calculateContextInputLimitTokens(model) {
|
|
25
|
-
const contextWindow = positiveInteger(
|
|
26
|
-
model.contextWindow,
|
|
27
|
-
FALLBACK_CONTEXT_WINDOW_TOKENS
|
|
28
|
-
);
|
|
29
|
-
return Math.max(1, Math.floor(contextWindow * CONTEXT_INPUT_LIMIT_RATIO));
|
|
30
|
-
}
|
|
31
|
-
function calculateContextCompactionTargetTokens(triggerTokens) {
|
|
32
|
-
return Math.max(1, Math.floor(triggerTokens * COMPACTION_TARGET_RATIO));
|
|
33
|
-
}
|
|
34
|
-
function getModelContextBudget(modelId) {
|
|
35
|
-
const model = resolveGatewayModel(modelId);
|
|
36
|
-
const advertisedContextWindow = positiveInteger(
|
|
37
|
-
model.contextWindow,
|
|
38
|
-
FALLBACK_CONTEXT_WINDOW_TOKENS
|
|
39
|
-
);
|
|
40
|
-
return {
|
|
41
|
-
contextWindow: Math.min(
|
|
42
|
-
botConfig.contextWindowTokens,
|
|
43
|
-
advertisedContextWindow
|
|
44
|
-
)
|
|
45
|
-
};
|
|
46
|
-
}
|
|
47
|
-
function getAgentContextCompactionTriggerTokens(modelId) {
|
|
48
|
-
return calculateContextCompactionTriggerTokens(
|
|
49
|
-
getModelContextBudget(modelId)
|
|
50
|
-
);
|
|
51
|
-
}
|
|
52
|
-
function getAgentContextInputLimitTokens(modelId) {
|
|
53
|
-
return calculateContextInputLimitTokens(getModelContextBudget(modelId));
|
|
54
|
-
}
|
|
55
|
-
function getConversationContextCompactionTriggerTokens() {
|
|
56
|
-
return calculateContextCompactionTriggerTokens(
|
|
57
|
-
getModelContextBudget(botConfig.fastModelId)
|
|
58
|
-
);
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
export {
|
|
62
|
-
estimateTextTokens,
|
|
63
|
-
calculateContextCompactionTargetTokens,
|
|
64
|
-
getAgentContextCompactionTriggerTokens,
|
|
65
|
-
getAgentContextInputLimitTokens,
|
|
66
|
-
getConversationContextCompactionTriggerTokens
|
|
67
|
-
};
|
package/dist/spawn-5LAJXZ2P.js
DELETED
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
bindSpawnAgent
|
|
3
|
-
} from "./chunk-M6ZWP4RI.js";
|
|
4
|
-
import "./chunk-JUA6VU2Z.js";
|
|
5
|
-
import "./chunk-X2WMBTS3.js";
|
|
6
|
-
import "./chunk-Q6QZTTLS.js";
|
|
7
|
-
import "./chunk-JAL3CH4G.js";
|
|
8
|
-
import "./chunk-FEKQHPVA.js";
|
|
9
|
-
import "./chunk-DIB4GX3G.js";
|
|
10
|
-
import "./chunk-R776HKPK.js";
|
|
11
|
-
import "./chunk-ZDGHGY74.js";
|
|
12
|
-
import "./chunk-GDQEU4I7.js";
|
|
13
|
-
import "./chunk-3Y47VMHV.js";
|
|
14
|
-
import "./chunk-HUO3UTAQ.js";
|
|
15
|
-
import "./chunk-HLXXQI5Q.js";
|
|
16
|
-
import "./chunk-PDO5BLNM.js";
|
|
17
|
-
import "./chunk-V6SRLKUB.js";
|
|
18
|
-
import "./chunk-37EVZP66.js";
|
|
19
|
-
import "./chunk-MCFIXAV5.js";
|
|
20
|
-
import "./chunk-EM225ITJ.js";
|
|
21
|
-
import "./chunk-GYEKOX7N.js";
|
|
22
|
-
import "./chunk-MKRIZ4VG.js";
|
|
23
|
-
import "./chunk-VFUK3X5B.js";
|
|
24
|
-
import "./chunk-QG7OOKIN.js";
|
|
25
|
-
import "./chunk-PB222GIA.js";
|
|
26
|
-
import "./chunk-37JJDS4H.js";
|
|
27
|
-
import "./chunk-RUIXF3YQ.js";
|
|
28
|
-
import "./chunk-HZF5P5UN.js";
|
|
29
|
-
import "./chunk-F3B2YJ76.js";
|
|
30
|
-
import "./chunk-B63BF443.js";
|
|
31
|
-
import "./chunk-6GWA276C.js";
|
|
32
|
-
import "./chunk-OOUNJNMR.js";
|
|
33
|
-
import "./chunk-H4HBKISO.js";
|
|
34
|
-
import "./chunk-HQE6EJS5.js";
|
|
35
|
-
import "./chunk-F7REGDKO.js";
|
|
36
|
-
import "./chunk-MLKGABMK.js";
|
|
37
|
-
export {
|
|
38
|
-
bindSpawnAgent
|
|
39
|
-
};
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|