@sentry/junior 0.257.0 → 0.258.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/{actor-BTtLaeWy.js → actor-tlxzqaRe.js} +3 -6
- package/dist/{admin-DgIkm6Vy.js → admin-My1SLGVO.js} +2 -3
- package/dist/{agent-hooks-BjtTzvru.js → agent-hooks-BJ_5mlRH.js} +69 -109
- package/dist/{agent-invocations-Bdu3ROfo.js → agent-invocations-Qfz7dWgU.js} +6 -12
- package/dist/{agent-runner-D7OboVb3.js → agent-runner-DGsFQw72.js} +261 -458
- package/dist/api/schema.d.ts +414 -448
- package/dist/api/schema.js +5 -5
- package/dist/api.d.ts +2 -12
- package/dist/api.js +94 -158
- package/dist/{app-BsU5QNBd.d.ts → app-PX2H1PxU.d.ts} +21 -44
- package/dist/app.d.ts +3 -3
- package/dist/app.js +204 -321
- package/dist/{assistant-reply-CbTPebzL.js → assistant-reply-H1M-91oF.js} +3 -5
- package/dist/{automation-CHdlHVZP.js → automation-DWBFBenG.js} +6 -11
- package/dist/{briefs-oLOldnDM.js → briefs-vYoK85rJ.js} +8 -11
- package/dist/{cadence-D00SCzT1.js → cadence-R7Em4RjE.js} +1 -2
- package/dist/{catalog-runtime-CZzhGQ7F.js → catalog-runtime-BN4DVxco.js} +3 -4
- package/dist/cli/chat.d.ts +2 -4
- package/dist/cli/chat.js +22 -24
- package/dist/cli/check.d.ts +1 -3
- package/dist/cli/check.js +4 -5
- package/dist/cli/env.d.ts +1 -3
- package/dist/cli/env.js +1 -2
- package/dist/cli/init.d.ts +1 -3
- package/dist/cli/init.js +3 -3
- package/dist/cli/main.d.ts +1 -3
- package/dist/cli/main.js +4 -5
- package/dist/cli/plugins.d.ts +2 -4
- package/dist/cli/plugins.js +7 -8
- package/dist/cli/run.d.ts +1 -2
- package/dist/cli/run.js +1 -2
- package/dist/cli/snapshot-create.d.ts +1 -3
- package/dist/cli/snapshot-create.js +4 -5
- package/dist/cli/upgrade.d.ts +3 -6
- package/dist/cli/upgrade.js +11 -17
- package/dist/{client-D8HnkOQX.js → client-DbyHuMFU.js} +9 -16
- package/dist/{config-CJRnWK9H.js → config-_WO_AjCB.js} +18 -15
- package/dist/{connections-ClYrKzpX.js → connections-ag_1JOhB.js} +14 -19
- package/dist/{conversation-CKNLYBJt.js → conversation-DjN3mlog.js} +8 -15
- package/dist/{conversation-privacy-C8b1nphZ.js → conversation-privacy-DHP_xnVj.js} +2 -3
- package/dist/{conversation-work-C6y3T5Hx.js → conversation-work-BaT_T6EB.js} +1 -2
- package/dist/{credential-sync-BXfohNmJ.js → credential-sync-B-CPX_ag.js} +23 -28
- package/dist/{db-Ca9Nt5ci.d.ts → db-BnRqQ7G5.d.ts} +1 -1
- package/dist/{executor-Do0THDRR.js → executor-RvG6kVe1.js} +30 -52
- package/dist/{experimental-CQIvMUO7.js → experimental-BNK1l1jv.js} +2 -4
- package/dist/{history-9pO1Zd4Y.js → history-AY8rs-FR.js} +5 -9
- package/dist/{history-DvqWZlYX.d.ts → history-BgI33Kie.d.ts} +12 -20
- package/dist/{images-BN_BiBXF.js → images-C2J_bj2g.js} +5 -6
- package/dist/instrumentation.d.ts +1 -3
- package/dist/instrumentation.js +6 -8
- package/dist/{job-queue-B6SV9uVa.js → job-queue-DVe37it2.js} +6 -12
- package/dist/{logging-CWxiIuCF.js → logging-DsHONhVm.js} +7 -12
- package/dist/{message-TUOdbSBW.js → message-DyitL8no.js} +5 -6
- package/dist/{model-profile-BwU8mqwD.js → model-profile-Bg8EoCKD.js} +2 -4
- package/dist/nitro.d.ts +3 -5
- package/dist/nitro.js +12 -17
- package/dist/{oauth-authorization-BA4Dt6a7.js → oauth-authorization-djQn5Nhy.js} +2 -4
- package/dist/{oauth-callback-server-Dj5UJODo.js → oauth-callback-server-CDby-pCn.js} +3 -4
- package/dist/{oauth-relay-CdCnu80W.js → oauth-relay-CTygMkNx.js} +2 -3
- package/dist/{package-discovery-BVvSnQBB.js → package-discovery-DJBompdd.js} +17 -21
- package/dist/{pending-auth-s_QFribU.js → pending-auth-D8J1uJUS.js} +37 -28
- package/dist/{plugin-module-CVvEUSMH.js → plugin-module-Cf5gVPWP.js} +1 -2
- package/dist/{plugins-CjfUP5gJ.d.ts → plugins-B11Mfkmv.d.ts} +0 -4
- package/dist/{plugins-egKWjgue.js → plugins-DOm9Y6qI.js} +2 -3
- package/dist/{private-trace-result-BLvBjy_e.js → private-trace-result-CE7_lEdq.js} +1 -2
- package/dist/{profile-h-72wM78.js → profile-DpYjfKke.js} +16 -28
- package/dist/{prompt-DyoEj9c2.js → prompt-xgpyMtg7.js} +5 -9
- package/dist/{queue-B5SnqRln.d.ts → queue-C37RbDVc.d.ts} +0 -2
- package/dist/{registry-sLTr-sV9.js → registry-Du566MtJ.js} +16 -29
- package/dist/{resolve-ncQPZROQ.js → resolve-ClCIgh8E.js} +7 -12
- package/dist/{result-C883vngT.js → result-BBbKA61B.js} +13 -17
- package/dist/{rolldown-runtime-B4FMCO8f.js → rolldown-runtime-nwUcYXjP.js} +1 -2
- package/dist/{runner-CzYImdOF.js → runner-CCuqFSqx.js} +12 -13
- package/dist/{sandbox-egress-signals-CZbMINHI.js → sandbox-egress-signals-DY1mbKF4.js} +2 -3
- package/dist/{schema-Dy69D4Ge.js → schema-DrMh3NtR.js} +15 -26
- package/dist/{sentry-CgWZM_kV.js → sentry-BBUlHih9.js} +2 -3
- package/dist/{session-stop-CQjKd4a2.js → session-stop-CIoFiwwe.js} +23 -33
- package/dist/{skills-C22SLruK.js → skills-DyQBLIrK.js} +9 -9
- package/dist/{spawn-DY9CLXDL.js → spawn-Dqfeo7XP.js} +4 -5
- package/dist/{store-DoewL5mG.d.ts → store-CG0VJyye.d.ts} +0 -14
- package/dist/{store-DXFIQy-G.js → store-DJLwq4x8.js} +13 -15
- package/dist/{task-queue-B17vV0La.js → task-queue-BzW4MaWU.js} +5 -7
- package/dist/{task-runner-DUjvzYXj.js → task-runner-D3qJh4fK.js} +22 -26
- package/dist/{tasks-D_WIJtvO.js → tasks-CEXKTASS.js} +62 -78
- package/dist/{thread-state-Ch4yuCqG.js → thread-state-W3f6kAtz.js} +13 -19
- package/dist/{turn-failure-response-C5nBKC4S.js → turn-failure-response-CWx7aNIh.js} +16 -22
- package/dist/{turn-lifecycle-CO-ylUmV.js → turn-lifecycle-C9JFst7-.js} +2 -3
- package/dist/{turn-session-routing-B3LWooK5.js → turn-session-routing-CUxtfpr7.js} +2 -3
- package/dist/{validation-CXYxaNYx.js → validation-BHRxa5G4.js} +3 -4
- package/dist/vercel.d.ts +1 -3
- package/dist/vercel.js +1 -2
- package/dist/{version-BcdZy2zg.js → version-C0U6rHg0.js} +3 -5
- package/dist/{version-CnXZ614E.d.ts → version-Cc2OFd9G.d.ts} +0 -2
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -2
- package/dist/{viewer-DSZXygMU.js → viewer-CGvvRqKp.js} +26 -57
- package/dist/{web-input-B9Bv0_lR.js → web-input-Keb5GRWj.js} +98 -155
- package/dist/{web-message-id-xPI_EFSC.js → web-message-id-CJSUiksE.js} +3 -6
- package/dist/{work-nAfDSUFP.js → work-DRcsJ3hV.js} +14 -16
- package/dist/{worker-vGXZ6XFT.js → worker-Cjo-QqPq.js} +7 -8
- package/package.json +7 -6
|
@@ -1,30 +1,29 @@
|
|
|
1
|
-
import { d as unwrapCurrentInstruction, f as escapeXml, i as completeText, o as resolveGatewayModel } from "./client-
|
|
2
|
-
import { f as logException, m as logWarn, o as getActiveTraceId, s as getLogContextAttributes, t as buildTurnFailureResponse, y as setSpanAttributes } from "./logging-
|
|
3
|
-
import { n as captureMessage } from "./sentry-
|
|
4
|
-
import { n as botConfig, v as normalizeSlackEmojiName } from "./config-
|
|
5
|
-
import { c as toStoredSlackActor, f as parseSlackUserId, g as parseSlackMessageTs } from "./actor-
|
|
6
|
-
import {
|
|
7
|
-
import { a as juniorAutomationRuns, o as juniorAutomationVersions, s as juniorAutomations } from "./executor-
|
|
8
|
-
import { d as contextProvenance, f as instructionActors, n as agentHistoryItemSchema, p as instructionProvenanceFor } from "./history-
|
|
9
|
-
import { h as credentialSubjectSchema } from "./registry-
|
|
10
|
-
import { $t as authenticationUnlinkedEvent, Gt as normalizeSlackConversationId, Ht as getSlackClient, Qt as authenticationLinkedEvent, Rt as SlackActionError, Xt as JUNIOR_NATIVE_EVENT_NAMESPACE, Zt as agentsInstructionsUpdatedEvent, n as applyPluginFormatMarkdown, qt as withSlackRetries } from "./agent-hooks-
|
|
11
|
-
import { G as messageCardRef } from "./conversation-
|
|
12
|
-
import { D as fenceLock, O as withLock, T as MUTATION_LOCK_TTL_MS, k as sleep, w as getStateAdapter } from "./profile-
|
|
13
|
-
import { A as eventAutomationSchema, E as scheduledAutomationSchema, S as automationVersionSchema } from "./automation-
|
|
1
|
+
import { d as unwrapCurrentInstruction, f as escapeXml, i as completeText, o as resolveGatewayModel } from "./client-DbyHuMFU.js";
|
|
2
|
+
import { f as logException, m as logWarn, o as getActiveTraceId, s as getLogContextAttributes, t as buildTurnFailureResponse, y as setSpanAttributes } from "./logging-DsHONhVm.js";
|
|
3
|
+
import { n as captureMessage } from "./sentry-BBUlHih9.js";
|
|
4
|
+
import { n as botConfig, v as normalizeSlackEmojiName } from "./config-_WO_AjCB.js";
|
|
5
|
+
import { c as toStoredSlackActor, f as parseSlackUserId, g as parseSlackMessageTs } from "./actor-tlxzqaRe.js";
|
|
6
|
+
import { C as addAgentTurnUsage, c as getConversationEventStore, f as getSqlExecutor, m as withConversationEventLock, p as createSqlConversationEventStore, u as getConversationStore, x as bindProviderConversation, y as startLocationThread } from "./viewer-CGvvRqKp.js";
|
|
7
|
+
import { a as juniorAutomationRuns, o as juniorAutomationVersions, s as juniorAutomations } from "./executor-RvG6kVe1.js";
|
|
8
|
+
import { d as contextProvenance, f as instructionActors, n as agentHistoryItemSchema, p as instructionProvenanceFor } from "./history-AY8rs-FR.js";
|
|
9
|
+
import { h as credentialSubjectSchema } from "./registry-Du566MtJ.js";
|
|
10
|
+
import { $t as authenticationUnlinkedEvent, Gt as normalizeSlackConversationId, Ht as getSlackClient, Qt as authenticationLinkedEvent, Rt as SlackActionError, Xt as JUNIOR_NATIVE_EVENT_NAMESPACE, Zt as agentsInstructionsUpdatedEvent, n as applyPluginFormatMarkdown, qt as withSlackRetries } from "./agent-hooks-BJ_5mlRH.js";
|
|
11
|
+
import { G as messageCardRef } from "./conversation-DjN3mlog.js";
|
|
12
|
+
import { D as fenceLock, O as withLock, T as MUTATION_LOCK_TTL_MS, k as sleep, w as getStateAdapter } from "./profile-DpYjfKke.js";
|
|
13
|
+
import { A as eventAutomationSchema, E as scheduledAutomationSchema, S as automationVersionSchema } from "./automation-DWBFBenG.js";
|
|
14
14
|
import { isDeepStrictEqual } from "node:util";
|
|
15
15
|
import { z } from "zod";
|
|
16
16
|
import { createHash } from "node:crypto";
|
|
17
17
|
import { and, asc, desc, eq, inArray, ne, or, sql } from "drizzle-orm";
|
|
18
18
|
import { actorSchema, eventMatches, sourceSchema } from "@sentry/junior-plugin-api";
|
|
19
|
-
|
|
19
|
+
// src/chat/pi/messages.ts
|
|
20
20
|
/** Permissive schema for durable Pi SDK messages whose content shape may evolve. */
|
|
21
21
|
const piMessageSchema = z.object({ role: z.string() }).passthrough().transform((value) => value);
|
|
22
22
|
z.object({
|
|
23
23
|
content: z.array(z.unknown()),
|
|
24
24
|
role: z.string().min(1)
|
|
25
25
|
}).passthrough().transform((value) => value);
|
|
26
|
-
|
|
27
|
-
//#region src/chat/pi/conversation-events.ts
|
|
26
|
+
// src/chat/pi/conversation-events.ts
|
|
28
27
|
function authorizationObservationMessage(data, createdAtMs) {
|
|
29
28
|
const label = data.kind === "mcp" ? "MCP authorization" : "Authorization";
|
|
30
29
|
return piMessageSchema.parse({
|
|
@@ -129,8 +128,7 @@ function projectConversationEvents(events, options) {
|
|
|
129
128
|
replacementSeq
|
|
130
129
|
};
|
|
131
130
|
}
|
|
132
|
-
|
|
133
|
-
//#region src/chat/services/context-budget.ts
|
|
131
|
+
// src/chat/services/context-budget.ts
|
|
134
132
|
const COMPACTION_TRIGGER_RATIO = .9;
|
|
135
133
|
const CONTEXT_INPUT_LIMIT_RATIO = .95;
|
|
136
134
|
const COMPACTION_TARGET_RATIO = .8;
|
|
@@ -173,8 +171,7 @@ function getAgentContextInputLimitTokens(modelId) {
|
|
|
173
171
|
function getConversationContextCompactionTriggerTokens() {
|
|
174
172
|
return calculateContextCompactionTriggerTokens(getModelContextBudget(botConfig.fastModelId));
|
|
175
173
|
}
|
|
176
|
-
|
|
177
|
-
//#region src/chat/services/conversation-memory.ts
|
|
174
|
+
// src/chat/services/conversation-memory.ts
|
|
178
175
|
const CONTEXT_MIN_LIVE_MESSAGES = 12;
|
|
179
176
|
const CONTEXT_COMPACTION_BATCH_SIZE = 24;
|
|
180
177
|
const CONTEXT_MAX_COMPACTIONS = 16;
|
|
@@ -271,6 +268,7 @@ function markConversationMessage(conversation, messageId, patch) {
|
|
|
271
268
|
const messageIndex = conversation.messages.findIndex((entry) => entry.id === messageId);
|
|
272
269
|
if (messageIndex < 0) return;
|
|
273
270
|
const current = conversation.messages[messageIndex];
|
|
271
|
+
if (!current) return;
|
|
274
272
|
conversation.messages[messageIndex] = {
|
|
275
273
|
...current,
|
|
276
274
|
meta: {
|
|
@@ -526,8 +524,7 @@ async function resolveTaskTitle(args) {
|
|
|
526
524
|
signal: args.signal
|
|
527
525
|
});
|
|
528
526
|
}
|
|
529
|
-
|
|
530
|
-
//#region src/chat/services/conversation-title.ts
|
|
527
|
+
// src/chat/services/conversation-title.ts
|
|
531
528
|
const inFlightTitles = /* @__PURE__ */ new Map();
|
|
532
529
|
/**
|
|
533
530
|
* Set-once conversation title from the earliest human message.
|
|
@@ -630,8 +627,7 @@ async function resolveConversationTitle(args) {
|
|
|
630
627
|
}
|
|
631
628
|
return (await (args.conversationStore ?? getConversationStore()).get({ conversationId: args.conversationId }))?.title?.trim() || void 0;
|
|
632
629
|
}
|
|
633
|
-
|
|
634
|
-
//#region src/chat/conversations/message-summaries.ts
|
|
630
|
+
// src/chat/conversations/message-summaries.ts
|
|
635
631
|
/** Project the latest source-message summary snapshot from event history. */
|
|
636
632
|
function projectConversationMessageSummaries(events) {
|
|
637
633
|
for (let index = events.length - 1; index >= 0; index -= 1) {
|
|
@@ -657,8 +653,7 @@ async function persistConversationMessageSummaries(args) {
|
|
|
657
653
|
createdAtMs: args.conversation.compactions.at(-1)?.createdAtMs ?? Date.now()
|
|
658
654
|
}]);
|
|
659
655
|
}
|
|
660
|
-
|
|
661
|
-
//#region src/chat/conversations/message-projection.ts
|
|
656
|
+
// src/chat/conversations/message-projection.ts
|
|
662
657
|
function isMessageEvent(event) {
|
|
663
658
|
return event.data.type === "message" || event.data.type === "message_updated" || event.data.type === "message_handled";
|
|
664
659
|
}
|
|
@@ -720,8 +715,7 @@ function projectConversationMessages(history) {
|
|
|
720
715
|
};
|
|
721
716
|
});
|
|
722
717
|
}
|
|
723
|
-
|
|
724
|
-
//#region src/chat/conversations/messages.ts
|
|
718
|
+
// src/chat/conversations/messages.ts
|
|
725
719
|
/**
|
|
726
720
|
* Conversation-message persistence and hydration.
|
|
727
721
|
*/
|
|
@@ -813,8 +807,7 @@ async function appendConversationMessages(eventStore, args) {
|
|
|
813
807
|
});
|
|
814
808
|
await eventStore.append(args.conversationId, events);
|
|
815
809
|
}
|
|
816
|
-
|
|
817
|
-
//#region src/chat/conversations/projection.ts
|
|
810
|
+
// src/chat/conversations/projection.ts
|
|
818
811
|
/**
|
|
819
812
|
* Conversation projection orchestration.
|
|
820
813
|
*
|
|
@@ -1281,8 +1274,7 @@ async function recordGuardianActionReviewed(args) {
|
|
|
1281
1274
|
createdAtMs: Date.now()
|
|
1282
1275
|
}]);
|
|
1283
1276
|
}
|
|
1284
|
-
|
|
1285
|
-
//#region src/chat/tools/execution/tool-input-error.ts
|
|
1277
|
+
// src/chat/tools/execution/tool-input-error.ts
|
|
1286
1278
|
/** Thrown when a tool fails due to invalid model/user input, not a system error. */
|
|
1287
1279
|
var ToolInputError = class extends Error {
|
|
1288
1280
|
constructor(message, options) {
|
|
@@ -1290,16 +1282,14 @@ var ToolInputError = class extends Error {
|
|
|
1290
1282
|
this.name = "ToolInputError";
|
|
1291
1283
|
}
|
|
1292
1284
|
};
|
|
1293
|
-
|
|
1294
|
-
//#region src/chat/turn-context-tag.ts
|
|
1285
|
+
// src/chat/turn-context-tag.ts
|
|
1295
1286
|
/**
|
|
1296
1287
|
* Canonical tag name for the runtime turn context block injected into Pi
|
|
1297
1288
|
* messages. Shared between prompt assembly and turn context stripping to keep
|
|
1298
1289
|
* both in sync without requiring the full prompt module.
|
|
1299
1290
|
*/
|
|
1300
1291
|
const TURN_CONTEXT_TAG = "runtime-turn-context";
|
|
1301
|
-
|
|
1302
|
-
//#region src/chat/pi/transcript.ts
|
|
1292
|
+
// src/chat/pi/transcript.ts
|
|
1303
1293
|
const RUNTIME_TURN_CONTEXT_START = `<${TURN_CONTEXT_TAG}>`;
|
|
1304
1294
|
const AGENTS_INSTRUCTIONS_START = "# AGENTS.md instructions";
|
|
1305
1295
|
function userMessageContent(message) {
|
|
@@ -1431,8 +1421,7 @@ function stripRuntimeTurnContext(messages) {
|
|
|
1431
1421
|
}];
|
|
1432
1422
|
});
|
|
1433
1423
|
}
|
|
1434
|
-
|
|
1435
|
-
//#region src/chat/services/turn-limit.ts
|
|
1424
|
+
// src/chat/services/turn-limit.ts
|
|
1436
1425
|
/** Terminal failure when one turn uses too many execution slices. */
|
|
1437
1426
|
var TurnSliceLimitExceededError = class extends Error {
|
|
1438
1427
|
constructor(maxSlices) {
|
|
@@ -1495,8 +1484,7 @@ function buildTurnLimitResponse(eventId) {
|
|
|
1495
1484
|
function buildTurnErrorResponse(error, eventId) {
|
|
1496
1485
|
return isTurnExecutionLimitExceededError(error) ? buildTurnLimitResponse(eventId) : buildTurnFailureResponse(eventId);
|
|
1497
1486
|
}
|
|
1498
|
-
|
|
1499
|
-
//#region src/chat/services/persist-retry.ts
|
|
1487
|
+
// src/chat/services/persist-retry.ts
|
|
1500
1488
|
/**
|
|
1501
1489
|
* Shared post-delivery persist retry.
|
|
1502
1490
|
*
|
|
@@ -1517,8 +1505,7 @@ async function persistWithRetry(persist) {
|
|
|
1517
1505
|
}
|
|
1518
1506
|
throw lastError;
|
|
1519
1507
|
}
|
|
1520
|
-
|
|
1521
|
-
//#region src/chat/task-execution/turn-cursor-keys.ts
|
|
1508
|
+
// src/chat/task-execution/turn-cursor-keys.ts
|
|
1522
1509
|
/** Redis namespace for the current turn cursor format. */
|
|
1523
1510
|
const TURN_CURSOR_PREFIX = "junior:turn_cursor:v2";
|
|
1524
1511
|
/** Return the Redis key for one turn cursor. */
|
|
@@ -1533,8 +1520,7 @@ function turnCursorIndexKey(conversationId) {
|
|
|
1533
1520
|
function turnCursorMutationKey(conversationId, turnId) {
|
|
1534
1521
|
return `${TURN_CURSOR_PREFIX}:mutation:${conversationId}:${turnId}`;
|
|
1535
1522
|
}
|
|
1536
|
-
|
|
1537
|
-
//#region src/chat/task-execution/turn-cursor.ts
|
|
1523
|
+
// src/chat/task-execution/turn-cursor.ts
|
|
1538
1524
|
/**
|
|
1539
1525
|
* Internal turn cursor storage for `checkpoint.ts`.
|
|
1540
1526
|
*
|
|
@@ -2089,8 +2075,7 @@ async function failTurnRecord(args) {
|
|
|
2089
2075
|
});
|
|
2090
2076
|
});
|
|
2091
2077
|
}
|
|
2092
|
-
|
|
2093
|
-
//#region src/chat/task-execution/checkpoint.ts
|
|
2078
|
+
// src/chat/task-execution/checkpoint.ts
|
|
2094
2079
|
function definedProps(values) {
|
|
2095
2080
|
return Object.fromEntries(Object.entries(values).filter(([, value]) => value !== void 0));
|
|
2096
2081
|
}
|
|
@@ -2241,8 +2226,7 @@ async function saveDone(args) {
|
|
|
2241
2226
|
});
|
|
2242
2227
|
});
|
|
2243
2228
|
}
|
|
2244
|
-
|
|
2245
|
-
//#region src/chat/slack/post-warning.ts
|
|
2229
|
+
// src/chat/slack/post-warning.ts
|
|
2246
2230
|
const codes = /* @__PURE__ */ new Set([
|
|
2247
2231
|
"invalid_metadata_format",
|
|
2248
2232
|
"invalid_metadata_schema",
|
|
@@ -2338,8 +2322,7 @@ function captureSlackPostWarning(response, attributes) {
|
|
|
2338
2322
|
}
|
|
2339
2323
|
});
|
|
2340
2324
|
}
|
|
2341
|
-
|
|
2342
|
-
//#region src/chat/slack/work-object.ts
|
|
2325
|
+
// src/chat/slack/work-object.ts
|
|
2343
2326
|
const url = z.url({ protocol: /^https?$/ });
|
|
2344
2327
|
const textField = z.strictObject({
|
|
2345
2328
|
type: z.literal("string"),
|
|
@@ -2388,8 +2371,7 @@ const slackEntitySchema = z.discriminatedUnion("entity_type", [entity.extend({
|
|
|
2388
2371
|
entity_type: z.literal("slack#/entities/task"),
|
|
2389
2372
|
entity_payload: payload.extend({ fields: z.strictObject({ status: z.strictObject({ value: z.string() }).optional() }).optional() })
|
|
2390
2373
|
})]);
|
|
2391
|
-
|
|
2392
|
-
//#region src/chat/slack/outbound.ts
|
|
2374
|
+
// src/chat/slack/outbound.ts
|
|
2393
2375
|
const MAX_SLACK_MESSAGE_TEXT_CHARS = 4e4;
|
|
2394
2376
|
function requireSlackConversationId(channelId, action) {
|
|
2395
2377
|
const normalized = normalizeSlackConversationId(channelId);
|
|
@@ -2579,8 +2561,7 @@ async function removeReactionFromMessage(input) {
|
|
|
2579
2561
|
}
|
|
2580
2562
|
return { ok: true };
|
|
2581
2563
|
}
|
|
2582
|
-
|
|
2583
|
-
//#region src/chat/slack/status-format.ts
|
|
2564
|
+
// src/chat/slack/status-format.ts
|
|
2584
2565
|
const SLACK_STATUS_MAX_LENGTH = 50;
|
|
2585
2566
|
/** Truncate a status string to fit Slack's 50-char assistant status limit. */
|
|
2586
2567
|
function truncateStatusText(text) {
|
|
@@ -2589,8 +2570,7 @@ function truncateStatusText(text) {
|
|
|
2589
2570
|
if (trimmed.length <= SLACK_STATUS_MAX_LENGTH) return trimmed;
|
|
2590
2571
|
return `${trimmed.slice(0, 47).trimEnd()}...`;
|
|
2591
2572
|
}
|
|
2592
|
-
|
|
2593
|
-
//#region src/chat/slack/mrkdwn.ts
|
|
2573
|
+
// src/chat/slack/mrkdwn.ts
|
|
2594
2574
|
/** Escape dynamic text for Slack mrkdwn without changing intended formatting. */
|
|
2595
2575
|
function escapeSlackMrkdwnText(text) {
|
|
2596
2576
|
return text.replaceAll("&", "&").replaceAll("<", "<").replaceAll(">", ">");
|
|
@@ -2652,7 +2632,7 @@ function hasUnmatchedClosingParen(text) {
|
|
|
2652
2632
|
function readBareUrl(line, start) {
|
|
2653
2633
|
let end = start;
|
|
2654
2634
|
while (end < line.length) {
|
|
2655
|
-
const ch = line
|
|
2635
|
+
const ch = line.charAt(end);
|
|
2656
2636
|
if (/\s/.test(ch) || ch === "<" || ch === ">" || ch === "\"" || ch === "`" || ch === "|" || ch === "*") break;
|
|
2657
2637
|
end++;
|
|
2658
2638
|
}
|
|
@@ -2757,8 +2737,7 @@ function ensureBlockSpacing(text) {
|
|
|
2757
2737
|
const lines = text.split("\n");
|
|
2758
2738
|
const result = [];
|
|
2759
2739
|
let inCodeBlock = false;
|
|
2760
|
-
for (
|
|
2761
|
-
const line = lines[i];
|
|
2740
|
+
for (const line of lines) {
|
|
2762
2741
|
if (codeBlockPattern.test(line.trimStart())) {
|
|
2763
2742
|
if (!inCodeBlock) {
|
|
2764
2743
|
const prev = result.length > 0 ? result[result.length - 1] : void 0;
|
|
@@ -2802,8 +2781,7 @@ function normalizeSlackStatusText(text) {
|
|
|
2802
2781
|
function slackMention(userId) {
|
|
2803
2782
|
return `<@${userId}>`;
|
|
2804
2783
|
}
|
|
2805
|
-
|
|
2806
|
-
//#region src/chat/automations/revision.ts
|
|
2784
|
+
// src/chat/automations/revision.ts
|
|
2807
2785
|
/** Storage revisions prevent stale edits from replacing newer values. */
|
|
2808
2786
|
var AutomationConflictError = class extends ToolInputError {
|
|
2809
2787
|
constructor() {
|
|
@@ -2825,8 +2803,7 @@ function automationRevision(task) {
|
|
|
2825
2803
|
function requireAutomationRevision(task, revision) {
|
|
2826
2804
|
if (!task || automationRevision(task) !== revision) throw new AutomationConflictError();
|
|
2827
2805
|
}
|
|
2828
|
-
|
|
2829
|
-
//#region src/chat/automations/versions.ts
|
|
2806
|
+
// src/chat/automations/versions.ts
|
|
2830
2807
|
/** Automation versions keep each saved definition so people can see how it changed. */
|
|
2831
2808
|
/** Return the versioned part of an Automation. Lifecycle and run state are excluded. */
|
|
2832
2809
|
function automationDefinition(task) {
|
|
@@ -2909,12 +2886,9 @@ async function readAutomationVersion(db, automationId, version) {
|
|
|
2909
2886
|
async function listAutomationVersions(db, automationId, limit) {
|
|
2910
2887
|
return (await db.select(versionColumns).from(juniorAutomationVersions).innerJoin(juniorAutomations, eq(juniorAutomations.id, juniorAutomationVersions.automationId)).where(eq(juniorAutomationVersions.automationId, automationId)).orderBy(desc(juniorAutomationVersions.version)).limit(limit)).map(parseVersionRow);
|
|
2911
2888
|
}
|
|
2912
|
-
|
|
2913
|
-
//#region src/chat/event-automations/run-limit.ts
|
|
2889
|
+
// src/chat/event-automations/run-limit.ts
|
|
2914
2890
|
const RUN_LIST_PREFIX = "junior:event_automation_runs:v1";
|
|
2915
2891
|
const RUN_LIST_BURST_ROOM = 100;
|
|
2916
|
-
/** Length of the rolling window for the run limit. */
|
|
2917
|
-
const EVENT_AUTOMATION_RUN_WINDOW_MS = 36e5;
|
|
2918
2892
|
const runEntrySchema = z.union([z.object({
|
|
2919
2893
|
atMs: z.number().finite(),
|
|
2920
2894
|
id: z.string().min(1)
|
|
@@ -2923,21 +2897,34 @@ function runListKey(automationId) {
|
|
|
2923
2897
|
return `${RUN_LIST_PREFIX}:${automationId}`;
|
|
2924
2898
|
}
|
|
2925
2899
|
function runListMaxLength() {
|
|
2926
|
-
return botConfig.
|
|
2900
|
+
return botConfig.maxEventAutomationRuns + RUN_LIST_BURST_ROOM;
|
|
2927
2901
|
}
|
|
2928
2902
|
async function appendRunEntry(state, automationId, entry) {
|
|
2929
2903
|
await state.connect();
|
|
2930
2904
|
await state.appendToList(runListKey(automationId), entry, {
|
|
2931
2905
|
maxLength: runListMaxLength(),
|
|
2932
|
-
ttlMs:
|
|
2906
|
+
ttlMs: botConfig.eventAutomationRunWindowMs
|
|
2933
2907
|
});
|
|
2934
2908
|
}
|
|
2909
|
+
function describeRunWindow(windowMs) {
|
|
2910
|
+
for (const [unit, unitMs] of [
|
|
2911
|
+
["day", 864e5],
|
|
2912
|
+
["hour", 36e5],
|
|
2913
|
+
["minute", 6e4],
|
|
2914
|
+
["second", 1e3]
|
|
2915
|
+
]) if (windowMs % unitMs === 0) {
|
|
2916
|
+
const count = windowMs / unitMs;
|
|
2917
|
+
return count === 1 ? unit : `${count} ${unit}s`;
|
|
2918
|
+
}
|
|
2919
|
+
return `${windowMs} ms`;
|
|
2920
|
+
}
|
|
2935
2921
|
/** Reason stored on an Event automation that the run limit blocked. */
|
|
2936
2922
|
function eventAutomationRunLimitReason() {
|
|
2937
|
-
|
|
2923
|
+
const window = describeRunWindow(botConfig.eventAutomationRunWindowMs);
|
|
2924
|
+
return `This automation reached its limit of ${botConfig.maxEventAutomationRuns} runs per ${window}. Check that its trigger is not too broad, then resume it.`;
|
|
2938
2925
|
}
|
|
2939
2926
|
/**
|
|
2940
|
-
* Count one run of an Event automation, or refuse when its
|
|
2927
|
+
* Count one run of an Event automation, or refuse when its window is full.
|
|
2941
2928
|
*
|
|
2942
2929
|
* `runKey` is the dispatch idempotency key, so a provider retry of the same
|
|
2943
2930
|
* Event does not count again.
|
|
@@ -2948,7 +2935,7 @@ async function admitEventAutomationRun(args) {
|
|
|
2948
2935
|
atMs: args.nowMs,
|
|
2949
2936
|
id: args.runKey
|
|
2950
2937
|
});
|
|
2951
|
-
const windowStartMs = args.nowMs -
|
|
2938
|
+
const windowStartMs = args.nowMs - botConfig.eventAutomationRunWindowMs;
|
|
2952
2939
|
const values = await state.getList(runListKey(args.automationId));
|
|
2953
2940
|
const entries = values.flatMap((value) => {
|
|
2954
2941
|
const entry = runEntrySchema.safeParse(value);
|
|
@@ -2964,7 +2951,7 @@ async function admitEventAutomationRun(args) {
|
|
|
2964
2951
|
for (const entry of entries.slice(lastReset + 1)) {
|
|
2965
2952
|
if ("reset" in entry) continue;
|
|
2966
2953
|
if (entry.atMs > windowStartMs) runKeys.add(entry.id);
|
|
2967
|
-
if (entry.id === args.runKey) return full || runKeys.size > botConfig.
|
|
2954
|
+
if (entry.id === args.runKey) return full || runKeys.size > botConfig.maxEventAutomationRuns ? "limited" : "allowed";
|
|
2968
2955
|
}
|
|
2969
2956
|
return "limited";
|
|
2970
2957
|
}
|
|
@@ -2978,8 +2965,7 @@ async function admitEventAutomationRun(args) {
|
|
|
2978
2965
|
async function clearEventAutomationRuns(automationId, state = getStateAdapter()) {
|
|
2979
2966
|
await appendRunEntry(state, automationId, { reset: true });
|
|
2980
2967
|
}
|
|
2981
|
-
|
|
2982
|
-
//#region src/chat/event-automations/store.ts
|
|
2968
|
+
// src/chat/event-automations/store.ts
|
|
2983
2969
|
/**
|
|
2984
2970
|
* Validate an event automation and split it into its SQL columns. Lifecycle
|
|
2985
2971
|
* columns are written separately.
|
|
@@ -3161,8 +3147,7 @@ async function blockEventAutomation(db, id, reason) {
|
|
|
3161
3147
|
statusReason: reason
|
|
3162
3148
|
}).where(and(eventAutomationWhere(id), or(eq(juniorAutomations.status, "active"), and(eq(juniorAutomations.status, "paused"), sql`${juniorAutomations.statusReason} is distinct from ${reason}`)))).returning({ status: juniorAutomations.status }))[0]?.status === "blocked";
|
|
3163
3149
|
}
|
|
3164
|
-
|
|
3165
|
-
//#region src/chat/scheduled-automations/tasks.ts
|
|
3150
|
+
// src/chat/scheduled-automations/tasks.ts
|
|
3166
3151
|
const SCHEDULER_KEY_PREFIX = "junior:scheduler";
|
|
3167
3152
|
/** Decode a Scheduled automation row. Returns undefined for an invalid row. */
|
|
3168
3153
|
function parseScheduledAutomationRow(row) {
|
|
@@ -3284,5 +3269,4 @@ async function saveScheduledAutomation(db, task, expectedRevision, editedBy) {
|
|
|
3284
3269
|
async function saveScheduledAutomationInLock(db, task, current) {
|
|
3285
3270
|
await writeScheduledAutomation(db, requireStoredTask(task), current);
|
|
3286
3271
|
}
|
|
3287
|
-
//#endregion
|
|
3288
3272
|
export { recordTurnSummary as $, buildConversationContext as $t, escapeSlackMrkdwnText as A, loadTurnProjection as At, postSlackMessage as B, recordSubscribedReplyRoute as Bt, automationVersionOf as C, ToolInputError as Ct, AutomationConflictError as D, loadConversationProjection as Dt, sameDefinitionValue as E, loadConnectedMcpProviders as Et, truncateStatusText as F, recordAuthenticationLinked as Ft, continuableMessages as G, persistConversationMessages as Gt, uploadFilesToConversation as H, recordTurnRoute as Ht, addReactionToMessage as I, recordAuthorizationCompleted as It, abandonTurnRecord as J, resolveConversationTitle as Jt, loadTurnCheckpoint as K, projectConversationMessages as Kt, getSlackMessagePermalink as L, recordAuthorizationRequested as Lt, normalizeSlackReplyMarkdown as M, openConversationProjection as Mt, normalizeSlackStatusText as N, recordAgentsInstructionsUpdated as Nt, automationRevision as O, loadLastModelProfile as Ot, slackMention as P, recordAttachmentsDelivered as Pt, listTurnSummaries as Q, appendThreadContextMessages as Qt, openSlackDirectMessage as R, recordGuardianActionReviewed as Rt, automationDefinition as S, TURN_CONTEXT_TAG as St, readAutomationVersion as T, commitMessages as Tt, slackEntitySchema as U, appendConversationMessages as Ut, removeReactionFromMessage as V, recordToolExecutionStarted as Vt, slackExternalRefIdSchema as W, hydrateConversationMessages as Wt, failTurnRecord as X, fallbackShortTitle as Xt, completeTurnRecord as Y, settleConversationTitleWork as Yt, getTurnRecord as Z, resolveTaskTitle as Zt, parseEventAutomationRow as _, isToolResultMessage as _t, saveScheduledAutomation as a, normalizeConversationText as an, buildTurnErrorResponse as at, admitEventAutomationRun as b, stripRuntimeTurnContext as bt, withScheduledAutomationLock as c, upsertConversationMessage as cn, extractAssistantText as ct, createEventAutomation as d, getAgentContextInputLimitTokens as dn, getUserMessageInstructionText as dt, createConversationMemoryService as en, persistWithRetry as et, deleteEventAutomation as f, historyItemFromPiMessage as fn, hasRuntimeTurnContext as ft, listEventAutomationsForTeam as g, isToolResultError as gt, listDeletedEventAutomationsCreatedBy as h, isContinuablePiBoundary as ht, readScheduledAutomation as i, markConversationMessage as in, TurnToolCallLimitExceededError as it, formatSlackLink as j, loadTurnRoute as jt, requireAutomationRevision as k, loadProjection as kt, blockEventAutomation as l, estimateTextTokens as ln, getPiMessageRole as lt, getEventAutomation as m, isAssistantMessage as mt, listScheduledAutomationsForTeam as n, getConversationMessageSlackTs as nn, TurnBudgetExceededError as nt, saveScheduledAutomationInLock as o, recordDeliveredAssistantMessage as on, createTurnLimitGate as ot, findMatchingEventAutomations as p, piMessageFromHistoryItem as pn, instructionTextForProjection as pt, saveTurnCheckpoint as q, persistConversationMessageSummaries as qt, parseScheduledAutomationRow as r, isHumanConversationMessage as rn, TurnSliceLimitExceededError as rt, scheduledRunId as s, turnHasReply as sn, isTurnExecutionLimitExceededError as st, createScheduledAutomation as t, estimateConversationContextTokens as tn, TURN_LIMIT_DISABLED_REASON as tt, collectEventAutomationMatchKeys as u, getAgentContextCompactionTriggerTokens as un, getTerminalAssistantMessages as ut, saveEventAutomation as v, normalizeToolNameFromResult as vt, listAutomationVersions as w, commitAcceptedReply as wt, eventAutomationRunLimitReason as x, trimTrailingAssistantMessages as xt, setEventAutomationStatus as y, retainRuntimeTurnContext as yt, postSlackEphemeralMessage as z, recordMcpProviderConnected as zt };
|
|
@@ -1,18 +1,17 @@
|
|
|
1
|
-
import { B as toOptionalNumber, V as toOptionalString, z as isRecord } from "./logging-
|
|
2
|
-
import {
|
|
3
|
-
import { d as juniorDestinations } from "./agent-invocations-
|
|
4
|
-
import { l as juniorLocationConfigurations } from "./executor-
|
|
5
|
-
import { Gt as persistConversationMessages } from "./tasks-
|
|
6
|
-
import { it as JUNIOR_THREAD_STATE_TTL_MS } from "./agent-hooks-
|
|
7
|
-
import { w as getStateAdapter } from "./profile-
|
|
1
|
+
import { B as toOptionalNumber, V as toOptionalString, z as isRecord } from "./logging-DsHONhVm.js";
|
|
2
|
+
import { d as getDb } from "./viewer-CGvvRqKp.js";
|
|
3
|
+
import { d as juniorDestinations } from "./agent-invocations-Qfz7dWgU.js";
|
|
4
|
+
import { l as juniorLocationConfigurations } from "./executor-RvG6kVe1.js";
|
|
5
|
+
import { Gt as persistConversationMessages } from "./tasks-CEXKTASS.js";
|
|
6
|
+
import { it as JUNIOR_THREAD_STATE_TTL_MS } from "./agent-hooks-BJ_5mlRH.js";
|
|
7
|
+
import { w as getStateAdapter } from "./profile-DpYjfKke.js";
|
|
8
8
|
import { z } from "zod";
|
|
9
9
|
import { randomUUID } from "node:crypto";
|
|
10
10
|
import { and, eq, sql } from "drizzle-orm";
|
|
11
|
-
|
|
11
|
+
// src/chat/configuration/types.ts
|
|
12
12
|
/** JSON value accepted by Location configuration. */
|
|
13
13
|
const configValueSchema = z.json();
|
|
14
|
-
|
|
15
|
-
//#region src/chat/configuration/validation.ts
|
|
14
|
+
// src/chat/configuration/validation.ts
|
|
16
15
|
const CONFIG_KEY_RE = /^[a-z0-9]+(?:\.[a-z0-9-]+)+$/;
|
|
17
16
|
const SECRET_KEY_RE = /(?:^|[_.-])(token|secret|password|passphrase|api[-_]?key|private[-_]?key|credential|auth)(?:$|[_.-])/i;
|
|
18
17
|
const SECRET_VALUE_PATTERNS = [
|
|
@@ -51,8 +50,7 @@ function validateConfigValue(value) {
|
|
|
51
50
|
collectStringValues(value, stringValues);
|
|
52
51
|
for (const text of stringValues) for (const pattern of SECRET_VALUE_PATTERNS) if (pattern.test(text)) return "Configuration value appears to contain secret material and is not allowed";
|
|
53
52
|
}
|
|
54
|
-
|
|
55
|
-
//#region src/chat/configuration/service.ts
|
|
53
|
+
// src/chat/configuration/service.ts
|
|
56
54
|
function sanitizeEntry(value) {
|
|
57
55
|
if (!isRecord(value)) return;
|
|
58
56
|
const key = toOptionalString(value.key);
|
|
@@ -123,8 +121,7 @@ function createLocationConfigurationService(storage) {
|
|
|
123
121
|
resolveValues
|
|
124
122
|
};
|
|
125
123
|
}
|
|
126
|
-
|
|
127
|
-
//#region src/chat/configuration/sql.ts
|
|
124
|
+
// src/chat/configuration/sql.ts
|
|
128
125
|
/** Resolve or create the canonical Location for a Slack Destination. */
|
|
129
126
|
async function resolveLocationId(db, destination) {
|
|
130
127
|
const channelId = destination.channelId;
|
|
@@ -248,8 +245,7 @@ function createDurableLocationConfigurationService(args) {
|
|
|
248
245
|
}
|
|
249
246
|
});
|
|
250
247
|
}
|
|
251
|
-
|
|
252
|
-
//#region src/chat/state/conversation.ts
|
|
248
|
+
// src/chat/state/conversation.ts
|
|
253
249
|
function defaultConversationState() {
|
|
254
250
|
return {
|
|
255
251
|
schemaVersion: 1,
|
|
@@ -335,8 +331,7 @@ function buildConversationStatePatch(conversation) {
|
|
|
335
331
|
processing: { ...conversation.processing }
|
|
336
332
|
} };
|
|
337
333
|
}
|
|
338
|
-
|
|
339
|
-
//#region src/chat/runtime/thread-state.ts
|
|
334
|
+
// src/chat/runtime/thread-state.ts
|
|
340
335
|
function threadStateKey(threadId) {
|
|
341
336
|
return `thread-state:${threadId}`;
|
|
342
337
|
}
|
|
@@ -428,5 +423,4 @@ function getLocationConfigurationService(destination) {
|
|
|
428
423
|
loadLegacy: async () => await getLegacyChannelState(destination.channelId)
|
|
429
424
|
});
|
|
430
425
|
}
|
|
431
|
-
//#endregion
|
|
432
426
|
export { persistThreadState as a, configValueSchema as c, persistThreadRuntimeState as i, getPersistedSandboxState as n, persistThreadStateById as o, getPersistedThreadState as r, coerceThreadConversationState as s, getLocationConfigurationService as t };
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { _ as getProviderErrorUserMessage, g as getProviderErrorAttributes, h as findProviderError, p as ProviderError } from "./client-
|
|
2
|
-
import { t as buildTurnFailureResponse, z as isRecord } from "./logging-
|
|
3
|
-
import { g as parseSlackMessageTs } from "./actor-
|
|
4
|
-
import {
|
|
5
|
-
import { Wt as hydrateConversationMessages, in as markConversationMessage } from "./tasks-
|
|
6
|
-
import { Nt as listConversationAnnotations } from "./agent-hooks-
|
|
7
|
-
import { J as removedCardSchema, Y as resolveMessageCards, q as readMessageCardRefs } from "./conversation-
|
|
8
|
-
import {
|
|
9
|
-
import { d as markTurnCompleted, u as markTurnClosed } from "./oauth-authorization-
|
|
10
|
-
import { o as persistThreadStateById, r as getPersistedThreadState, s as coerceThreadConversationState } from "./thread-state-
|
|
11
|
-
|
|
1
|
+
import { _ as getProviderErrorUserMessage, g as getProviderErrorAttributes, h as findProviderError, p as ProviderError } from "./client-DbyHuMFU.js";
|
|
2
|
+
import { t as buildTurnFailureResponse, z as isRecord } from "./logging-DsHONhVm.js";
|
|
3
|
+
import { g as parseSlackMessageTs } from "./actor-tlxzqaRe.js";
|
|
4
|
+
import { c as getConversationEventStore, d as getDb } from "./viewer-CGvvRqKp.js";
|
|
5
|
+
import { Wt as hydrateConversationMessages, in as markConversationMessage } from "./tasks-CEXKTASS.js";
|
|
6
|
+
import { Nt as listConversationAnnotations } from "./agent-hooks-BJ_5mlRH.js";
|
|
7
|
+
import { J as removedCardSchema, Y as resolveMessageCards, q as readMessageCardRefs } from "./conversation-DjN3mlog.js";
|
|
8
|
+
import { d as buildDeterministicTurnId, r as clearPendingAuth } from "./pending-auth-D8J1uJUS.js";
|
|
9
|
+
import { d as markTurnCompleted, u as markTurnClosed } from "./oauth-authorization-djQn5Nhy.js";
|
|
10
|
+
import { o as persistThreadStateById, r as getPersistedThreadState, s as coerceThreadConversationState } from "./thread-state-W3f6kAtz.js";
|
|
11
|
+
// src/chat/conversations/pending-cards.ts
|
|
12
12
|
/** Select undelivered cards and load their latest saved facts. */
|
|
13
13
|
async function loadPendingMessageCards(conversationId) {
|
|
14
14
|
const cards = /* @__PURE__ */ new Map();
|
|
@@ -41,15 +41,13 @@ async function loadPendingMessageCards(conversationId) {
|
|
|
41
41
|
if (cards.size === 0) return [];
|
|
42
42
|
return resolveMessageCards([...cards.values()].reverse(), await listConversationAnnotations(getDb(), conversationId));
|
|
43
43
|
}
|
|
44
|
-
|
|
45
|
-
//#region src/chat/interruption-marker.ts
|
|
44
|
+
// src/chat/interruption-marker.ts
|
|
46
45
|
const INTERRUPTED_MARKER = "\n\n[Response interrupted before completion]";
|
|
47
46
|
/** Return the marker added when a visible reply ended mid-execution. */
|
|
48
47
|
function getInterruptionMarker() {
|
|
49
48
|
return INTERRUPTED_MARKER;
|
|
50
49
|
}
|
|
51
|
-
|
|
52
|
-
//#region src/chat/runtime/delivered-turn-state.ts
|
|
50
|
+
// src/chat/runtime/delivered-turn-state.ts
|
|
53
51
|
/** Build state after destination delivery or intentional no-reply completion. */
|
|
54
52
|
function buildDeliveredTurnStatePatch(args) {
|
|
55
53
|
const conversation = structuredClone(args.conversation);
|
|
@@ -68,8 +66,7 @@ function buildDeliveredTurnStatePatch(args) {
|
|
|
68
66
|
sandboxRef: args.reply.sandboxRef
|
|
69
67
|
};
|
|
70
68
|
}
|
|
71
|
-
|
|
72
|
-
//#region src/chat/runtime/turn-user-message.ts
|
|
69
|
+
// src/chat/runtime/turn-user-message.ts
|
|
73
70
|
/** Return the user message for a persisted turn/session, if one exists. */
|
|
74
71
|
function getTurnUserMessage(conversation, sessionId) {
|
|
75
72
|
for (let index = conversation.messages.length - 1; index >= 0; index -= 1) {
|
|
@@ -96,8 +93,7 @@ function getTurnUserReplyAttachmentContext(message) {
|
|
|
96
93
|
...!imagesHydrated && imageAttachmentCount > 0 ? { omittedImageAttachmentCount: imageAttachmentCount } : void 0
|
|
97
94
|
};
|
|
98
95
|
}
|
|
99
|
-
|
|
100
|
-
//#region src/chat/runtime/auth-pause-state.ts
|
|
96
|
+
// src/chat/runtime/auth-pause-state.ts
|
|
101
97
|
/** Mark an auth-paused turn complete after private authorization link delivery. */
|
|
102
98
|
function completeAuthPauseTurn(args) {
|
|
103
99
|
markConversationMessage(args.conversation, getTurnUserMessageId(args.conversation, args.sessionId), {
|
|
@@ -124,8 +120,7 @@ async function persistAuthPauseTurnState(args) {
|
|
|
124
120
|
});
|
|
125
121
|
await persistThreadStateById(args.threadStateId, { conversation });
|
|
126
122
|
}
|
|
127
|
-
|
|
128
|
-
//#region src/chat/services/turn-failure-response.ts
|
|
123
|
+
// src/chat/services/turn-failure-response.ts
|
|
129
124
|
/** Require captured turn failures to carry a real Sentry event reference. */
|
|
130
125
|
function requireTurnFailureEventId(eventId, eventName) {
|
|
131
126
|
if (!eventId) throw new Error(`Sentry did not return an event ID for ${eventName}`);
|
|
@@ -202,5 +197,4 @@ function finalizeFailedTurnReplyWithEvent(args) {
|
|
|
202
197
|
}
|
|
203
198
|
};
|
|
204
199
|
}
|
|
205
|
-
//#endregion
|
|
206
200
|
export { persistAuthPauseTurnState as a, getTurnUserSlackMessageTs as c, loadPendingMessageCards as d, completeAuthPauseTurn as i, buildDeliveredTurnStatePatch as l, getAgentTurnDiagnosticsAttributes as n, getTurnUserMessage as o, requireTurnFailureEventId as r, getTurnUserReplyAttachmentContext as s, finalizeFailedTurnReplyWithEvent as t, getInterruptionMarker as u };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import { c as getConversationEventStore } from "./viewer-CGvvRqKp.js";
|
|
2
|
+
// src/chat/conversations/turn-lifecycle.ts
|
|
3
3
|
/** Persist correlated turn lifecycle facts with retry-safe terminal exclusion. */
|
|
4
4
|
var ConversationTurnLifecycleService = class {
|
|
5
5
|
events;
|
|
@@ -50,5 +50,4 @@ var ConversationTurnLifecycleService = class {
|
|
|
50
50
|
function getTurnLifecycle() {
|
|
51
51
|
return new ConversationTurnLifecycleService(getConversationEventStore());
|
|
52
52
|
}
|
|
53
|
-
//#endregion
|
|
54
53
|
export { getTurnLifecycle as n, ConversationTurnLifecycleService as t };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// src/chat/services/turn-session-routing.ts
|
|
2
2
|
async function loadConversationChain(conversationId, conversationStore) {
|
|
3
3
|
const chain = [];
|
|
4
4
|
const seen = /* @__PURE__ */ new Set();
|
|
@@ -34,7 +34,7 @@ function slackSourceForDestination(args) {
|
|
|
34
34
|
* Reads parent Conversations when this Conversation has no Destination.
|
|
35
35
|
*/
|
|
36
36
|
async function resolveConversationRouting(args) {
|
|
37
|
-
const conversationStore = args.conversationStore ?? (await import("./viewer-
|
|
37
|
+
const conversationStore = args.conversationStore ?? (await import("./viewer-CGvvRqKp.js").then((n) => n.s)).getConversationStore();
|
|
38
38
|
const chain = await loadConversationChain(args.conversationId, conversationStore);
|
|
39
39
|
let destination;
|
|
40
40
|
let source;
|
|
@@ -73,5 +73,4 @@ async function resolveTurnSessionRouting(args) {
|
|
|
73
73
|
source: routing.source
|
|
74
74
|
};
|
|
75
75
|
}
|
|
76
|
-
//#endregion
|
|
77
76
|
export { resolveTurnSessionRouting as n, resolveConversationRouting as t };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { t as __exportAll } from "./rolldown-runtime-
|
|
2
|
-
import { n as pluginCatalogRuntime } from "./catalog-runtime-
|
|
1
|
+
import { t as __exportAll } from "./rolldown-runtime-nwUcYXjP.js";
|
|
2
|
+
import { n as pluginCatalogRuntime } from "./catalog-runtime-BN4DVxco.js";
|
|
3
3
|
import { isDeepStrictEqual } from "node:util";
|
|
4
|
-
|
|
4
|
+
// src/chat/plugins/validation.ts
|
|
5
5
|
var validation_exports = /* @__PURE__ */ __exportAll({
|
|
6
6
|
validatePluginEgressCredentialHooks: () => validatePluginEgressCredentialHooks,
|
|
7
7
|
validatePluginRegistrations: () => validatePluginRegistrations
|
|
@@ -35,5 +35,4 @@ function validatePluginEgressCredentialHooks(registrations) {
|
|
|
35
35
|
if (!hasDomains && !hasGenericCredentials) throw new Error(`Plugin "${provider.manifest.name}" egress credential hooks require manifest.domains to list sandbox egress hosts.`);
|
|
36
36
|
}
|
|
37
37
|
}
|
|
38
|
-
//#endregion
|
|
39
38
|
export { validatePluginRegistrations as n, validation_exports as r, validatePluginEgressCredentialHooks as t };
|
package/dist/vercel.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
//#region src/vercel.d.ts
|
|
2
1
|
export interface JuniorVercelConfigOptions {
|
|
3
2
|
/** Override the Vercel build command, or pass null to omit it. */
|
|
4
3
|
buildCommand?: string | null;
|
|
@@ -8,5 +7,4 @@ export interface JuniorVercelConfigOptions {
|
|
|
8
7
|
* New apps run `junior upgrade` before `pnpm build`; older installs without
|
|
9
8
|
* Junior SQL configured can override `buildCommand` to keep their prior build.
|
|
10
9
|
*/
|
|
11
|
-
export declare function juniorVercelConfig(options?: JuniorVercelConfigOptions): Record<string, unknown>;
|
|
12
|
-
//#endregion
|
|
10
|
+
export declare function juniorVercelConfig(options?: JuniorVercelConfigOptions): Record<string, unknown>;
|
package/dist/vercel.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// src/vercel.ts
|
|
2
2
|
/** Return the root Vercel project config for scaffolded Junior apps.
|
|
3
3
|
*
|
|
4
4
|
* New apps run `junior upgrade` before `pnpm build`; older installs without
|
|
@@ -10,5 +10,4 @@ function juniorVercelConfig(options = {}) {
|
|
|
10
10
|
if (buildCommand !== null) config.buildCommand = buildCommand;
|
|
11
11
|
return config;
|
|
12
12
|
}
|
|
13
|
-
//#endregion
|
|
14
13
|
export { juniorVercelConfig };
|
|
@@ -1,8 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
var version = "0.
|
|
3
|
-
|
|
4
|
-
//#region src/version.ts
|
|
1
|
+
// package.json
|
|
2
|
+
var version = "0.258.0";
|
|
3
|
+
// src/version.ts
|
|
5
4
|
/** Installed Junior package version, or `unknown` when package metadata is unavailable. */
|
|
6
5
|
const JUNIOR_VERSION = typeof version === "string" && version.trim() ? version : "unknown";
|
|
7
|
-
//#endregion
|
|
8
6
|
export { JUNIOR_VERSION as t };
|
package/dist/version.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as JUNIOR_VERSION } from "./version-
|
|
1
|
+
import { t as JUNIOR_VERSION } from "./version-Cc2OFd9G.js";
|
|
2
2
|
export { JUNIOR_VERSION };
|