@sentry/junior 0.257.0 → 0.259.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/adapter-Bn0gFVSF.js +270 -0
- package/dist/{admin-DgIkm6Vy.js → admin-C8xz2f10.js} +2 -3
- package/dist/{agent-hooks-BjtTzvru.js → agent-hooks-B00FaKdP.js} +70 -109
- package/dist/{agent-invocations-Bdu3ROfo.js → agent-invocations-Qfz7dWgU.js} +6 -12
- package/dist/{agent-runner-D7OboVb3.js → agent-runner-CPSd7rKm.js} +324 -742
- package/dist/api/schema.d.ts +442 -447
- package/dist/api/schema.js +6 -6
- package/dist/api.d.ts +2 -12
- package/dist/api.js +165 -158
- package/dist/{app-BsU5QNBd.d.ts → app-Bbxrehjf.d.ts} +25 -45
- package/dist/app.d.ts +3 -3
- package/dist/app.js +206 -321
- package/dist/{assistant-reply-CbTPebzL.js → assistant-reply-CqthTerd.js} +3 -5
- package/dist/{automation-CHdlHVZP.js → automation-DWBFBenG.js} +6 -11
- package/dist/{briefs-oLOldnDM.js → briefs-DNYbQ9cD.js} +8 -11
- package/dist/{cadence-D00SCzT1.js → cadence-R7Em4RjE.js} +1 -2
- package/dist/{catalog-runtime-CZzhGQ7F.js → catalog-runtime-B8SuFPGb.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 +8 -5
- package/dist/cli/plugins.d.ts +2 -4
- package/dist/cli/plugins.js +7 -8
- package/dist/cli/run.d.ts +3 -3
- package/dist/cli/run.js +3 -3
- package/dist/cli/snapshot-create.d.ts +1 -3
- package/dist/cli/snapshot-create.js +5 -5
- package/dist/cli/upgrade.d.ts +3 -6
- package/dist/cli/upgrade.js +11 -17
- package/dist/{client-D8HnkOQX.js → client-BZdxgKyL.js} +64 -18
- package/dist/{config-CJRnWK9H.js → config-Deqpfpg9.js} +21 -15
- package/dist/{connections-ClYrKzpX.js → connections-9gJkfS85.js} +179 -20
- package/dist/{conversation-CKNLYBJt.js → conversation-DjN3mlog.js} +8 -15
- package/dist/{conversation-privacy-C8b1nphZ.js → conversation-privacy-CFhNKxp-.js} +2 -3
- package/dist/{conversation-work-C6y3T5Hx.js → conversation-work-BaT_T6EB.js} +1 -2
- package/dist/{credential-sync-BXfohNmJ.js → credential-sync-BABGymK3.js} +23 -190
- package/dist/{db-Ca9Nt5ci.d.ts → db-BnRqQ7G5.d.ts} +1 -1
- package/dist/{executor-Do0THDRR.js → executor-Bb3eQb8q.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-BbSdVHC6.js} +5 -6
- package/dist/instrumentation.d.ts +1 -3
- package/dist/instrumentation.js +6 -8
- package/dist/{job-queue-B6SV9uVa.js → job-queue-vdGU-5ge.js} +6 -12
- package/dist/{logging-CWxiIuCF.js → logging-BStXN56b.js} +7 -12
- package/dist/{message-TUOdbSBW.js → message-DRf6m4uO.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-JmOgLcGl.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-rG5U_QS1.js} +92 -83
- package/dist/{plugin-module-CVvEUSMH.js → plugin-module-Cf5gVPWP.js} +1 -2
- package/dist/{plugins-CjfUP5gJ.d.ts → plugins-B_0Cr0MO.d.ts} +5 -5
- 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-qBM6B_-V.js} +14 -295
- 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-B_M_x_iS.js} +56 -30
- package/dist/{resolve-ncQPZROQ.js → resolve-BzpuLh8c.js} +8 -12
- package/dist/{result-C883vngT.js → result-DEZH_AnZ.js} +13 -17
- package/dist/{rolldown-runtime-B4FMCO8f.js → rolldown-runtime-nwUcYXjP.js} +1 -2
- package/dist/{runner-CzYImdOF.js → runner-BqQlG10t.js} +12 -13
- package/dist/{sandbox-egress-signals-CZbMINHI.js → sandbox-egress-signals-DCq3WLs5.js} +2 -3
- package/dist/{schema-Dy69D4Ge.js → schema-CF9HqNRY.js} +30 -27
- package/dist/{sentry-CgWZM_kV.js → sentry-BBUlHih9.js} +2 -3
- package/dist/service-account-BqTBkyD7.js +120 -0
- package/dist/service-account-BzhW7kXu.js +661 -0
- package/dist/{session-stop-CQjKd4a2.js → session-stop-CV65ZlU3.js} +23 -33
- package/dist/{skills-C22SLruK.js → skills-CiWS5_Ub.js} +9 -9
- package/dist/{spawn-DY9CLXDL.js → spawn-BSAQ7UQZ.js} +4 -5
- package/dist/{store-DXFIQy-G.js → store-B1GES4gC.js} +13 -15
- package/dist/{store-DoewL5mG.d.ts → store-CG0VJyye.d.ts} +0 -14
- package/dist/{task-queue-B17vV0La.js → task-queue-BAeGEMjJ.js} +5 -7
- package/dist/{task-runner-DUjvzYXj.js → task-runner-BlGhcQPi.js} +22 -26
- package/dist/{tasks-D_WIJtvO.js → tasks-DieKX3d4.js} +63 -78
- package/dist/{thread-state-Ch4yuCqG.js → thread-state-DpSWS4Rr.js} +13 -19
- package/dist/{turn-failure-response-C5nBKC4S.js → turn-failure-response-DQljogGJ.js} +16 -22
- package/dist/{turn-lifecycle-CO-ylUmV.js → turn-lifecycle-BLgrkV_L.js} +2 -3
- package/dist/{turn-session-routing-B3LWooK5.js → turn-session-routing-BlajheOU.js} +2 -3
- package/dist/{validation-CXYxaNYx.js → validation-23d7K9tX.js} +3 -4
- package/dist/vercel.d.ts +1 -3
- package/dist/vercel.js +1 -2
- package/dist/{version-BcdZy2zg.js → version-B_XumRx-.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-B2_ABsYi.js} +26 -57
- package/dist/{web-input-B9Bv0_lR.js → web-input-BZDyxpzR.js} +101 -158
- package/dist/{web-message-id-xPI_EFSC.js → web-message-id-CJSUiksE.js} +3 -6
- package/dist/{work-nAfDSUFP.js → work-D3QKiV0O.js} +14 -16
- package/dist/{worker-vGXZ6XFT.js → worker-C8mUjYf9.js} +7 -8
- package/package.json +10 -9
|
@@ -1,30 +1,30 @@
|
|
|
1
|
-
import {
|
|
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 {
|
|
13
|
-
import {
|
|
1
|
+
import { a as completeText, f as unwrapCurrentInstruction, p as escapeXml, s as resolveGatewayModel } from "./client-BZdxgKyL.js";
|
|
2
|
+
import { f as logException, m as logWarn, o as getActiveTraceId, s as getLogContextAttributes, t as buildTurnFailureResponse, y as setSpanAttributes } from "./logging-BStXN56b.js";
|
|
3
|
+
import { n as captureMessage } from "./sentry-BBUlHih9.js";
|
|
4
|
+
import { n as botConfig, v as normalizeSlackEmojiName } from "./config-Deqpfpg9.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-B2_ABsYi.js";
|
|
7
|
+
import { a as juniorAutomationRuns, o as juniorAutomationVersions, s as juniorAutomations } from "./executor-Bb3eQb8q.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-B_M_x_iS.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-B00FaKdP.js";
|
|
11
|
+
import { G as messageCardRef } from "./conversation-DjN3mlog.js";
|
|
12
|
+
import { S as sleep } from "./profile-qBM6B_-V.js";
|
|
13
|
+
import { i as MUTATION_LOCK_TTL_MS, o as fenceLock, r as getStateAdapter, s as withLock } from "./adapter-Bn0gFVSF.js";
|
|
14
|
+
import { A as eventAutomationSchema, E as scheduledAutomationSchema, S as automationVersionSchema } from "./automation-DWBFBenG.js";
|
|
14
15
|
import { isDeepStrictEqual } from "node:util";
|
|
15
16
|
import { z } from "zod";
|
|
16
17
|
import { createHash } from "node:crypto";
|
|
17
18
|
import { and, asc, desc, eq, inArray, ne, or, sql } from "drizzle-orm";
|
|
18
19
|
import { actorSchema, eventMatches, sourceSchema } from "@sentry/junior-plugin-api";
|
|
19
|
-
|
|
20
|
+
// src/chat/pi/messages.ts
|
|
20
21
|
/** Permissive schema for durable Pi SDK messages whose content shape may evolve. */
|
|
21
22
|
const piMessageSchema = z.object({ role: z.string() }).passthrough().transform((value) => value);
|
|
22
23
|
z.object({
|
|
23
24
|
content: z.array(z.unknown()),
|
|
24
25
|
role: z.string().min(1)
|
|
25
26
|
}).passthrough().transform((value) => value);
|
|
26
|
-
|
|
27
|
-
//#region src/chat/pi/conversation-events.ts
|
|
27
|
+
// src/chat/pi/conversation-events.ts
|
|
28
28
|
function authorizationObservationMessage(data, createdAtMs) {
|
|
29
29
|
const label = data.kind === "mcp" ? "MCP authorization" : "Authorization";
|
|
30
30
|
return piMessageSchema.parse({
|
|
@@ -129,8 +129,7 @@ function projectConversationEvents(events, options) {
|
|
|
129
129
|
replacementSeq
|
|
130
130
|
};
|
|
131
131
|
}
|
|
132
|
-
|
|
133
|
-
//#region src/chat/services/context-budget.ts
|
|
132
|
+
// src/chat/services/context-budget.ts
|
|
134
133
|
const COMPACTION_TRIGGER_RATIO = .9;
|
|
135
134
|
const CONTEXT_INPUT_LIMIT_RATIO = .95;
|
|
136
135
|
const COMPACTION_TARGET_RATIO = .8;
|
|
@@ -173,8 +172,7 @@ function getAgentContextInputLimitTokens(modelId) {
|
|
|
173
172
|
function getConversationContextCompactionTriggerTokens() {
|
|
174
173
|
return calculateContextCompactionTriggerTokens(getModelContextBudget(botConfig.fastModelId));
|
|
175
174
|
}
|
|
176
|
-
|
|
177
|
-
//#region src/chat/services/conversation-memory.ts
|
|
175
|
+
// src/chat/services/conversation-memory.ts
|
|
178
176
|
const CONTEXT_MIN_LIVE_MESSAGES = 12;
|
|
179
177
|
const CONTEXT_COMPACTION_BATCH_SIZE = 24;
|
|
180
178
|
const CONTEXT_MAX_COMPACTIONS = 16;
|
|
@@ -271,6 +269,7 @@ function markConversationMessage(conversation, messageId, patch) {
|
|
|
271
269
|
const messageIndex = conversation.messages.findIndex((entry) => entry.id === messageId);
|
|
272
270
|
if (messageIndex < 0) return;
|
|
273
271
|
const current = conversation.messages[messageIndex];
|
|
272
|
+
if (!current) return;
|
|
274
273
|
conversation.messages[messageIndex] = {
|
|
275
274
|
...current,
|
|
276
275
|
meta: {
|
|
@@ -526,8 +525,7 @@ async function resolveTaskTitle(args) {
|
|
|
526
525
|
signal: args.signal
|
|
527
526
|
});
|
|
528
527
|
}
|
|
529
|
-
|
|
530
|
-
//#region src/chat/services/conversation-title.ts
|
|
528
|
+
// src/chat/services/conversation-title.ts
|
|
531
529
|
const inFlightTitles = /* @__PURE__ */ new Map();
|
|
532
530
|
/**
|
|
533
531
|
* Set-once conversation title from the earliest human message.
|
|
@@ -630,8 +628,7 @@ async function resolveConversationTitle(args) {
|
|
|
630
628
|
}
|
|
631
629
|
return (await (args.conversationStore ?? getConversationStore()).get({ conversationId: args.conversationId }))?.title?.trim() || void 0;
|
|
632
630
|
}
|
|
633
|
-
|
|
634
|
-
//#region src/chat/conversations/message-summaries.ts
|
|
631
|
+
// src/chat/conversations/message-summaries.ts
|
|
635
632
|
/** Project the latest source-message summary snapshot from event history. */
|
|
636
633
|
function projectConversationMessageSummaries(events) {
|
|
637
634
|
for (let index = events.length - 1; index >= 0; index -= 1) {
|
|
@@ -657,8 +654,7 @@ async function persistConversationMessageSummaries(args) {
|
|
|
657
654
|
createdAtMs: args.conversation.compactions.at(-1)?.createdAtMs ?? Date.now()
|
|
658
655
|
}]);
|
|
659
656
|
}
|
|
660
|
-
|
|
661
|
-
//#region src/chat/conversations/message-projection.ts
|
|
657
|
+
// src/chat/conversations/message-projection.ts
|
|
662
658
|
function isMessageEvent(event) {
|
|
663
659
|
return event.data.type === "message" || event.data.type === "message_updated" || event.data.type === "message_handled";
|
|
664
660
|
}
|
|
@@ -720,8 +716,7 @@ function projectConversationMessages(history) {
|
|
|
720
716
|
};
|
|
721
717
|
});
|
|
722
718
|
}
|
|
723
|
-
|
|
724
|
-
//#region src/chat/conversations/messages.ts
|
|
719
|
+
// src/chat/conversations/messages.ts
|
|
725
720
|
/**
|
|
726
721
|
* Conversation-message persistence and hydration.
|
|
727
722
|
*/
|
|
@@ -813,8 +808,7 @@ async function appendConversationMessages(eventStore, args) {
|
|
|
813
808
|
});
|
|
814
809
|
await eventStore.append(args.conversationId, events);
|
|
815
810
|
}
|
|
816
|
-
|
|
817
|
-
//#region src/chat/conversations/projection.ts
|
|
811
|
+
// src/chat/conversations/projection.ts
|
|
818
812
|
/**
|
|
819
813
|
* Conversation projection orchestration.
|
|
820
814
|
*
|
|
@@ -1281,8 +1275,7 @@ async function recordGuardianActionReviewed(args) {
|
|
|
1281
1275
|
createdAtMs: Date.now()
|
|
1282
1276
|
}]);
|
|
1283
1277
|
}
|
|
1284
|
-
|
|
1285
|
-
//#region src/chat/tools/execution/tool-input-error.ts
|
|
1278
|
+
// src/chat/tools/execution/tool-input-error.ts
|
|
1286
1279
|
/** Thrown when a tool fails due to invalid model/user input, not a system error. */
|
|
1287
1280
|
var ToolInputError = class extends Error {
|
|
1288
1281
|
constructor(message, options) {
|
|
@@ -1290,16 +1283,14 @@ var ToolInputError = class extends Error {
|
|
|
1290
1283
|
this.name = "ToolInputError";
|
|
1291
1284
|
}
|
|
1292
1285
|
};
|
|
1293
|
-
|
|
1294
|
-
//#region src/chat/turn-context-tag.ts
|
|
1286
|
+
// src/chat/turn-context-tag.ts
|
|
1295
1287
|
/**
|
|
1296
1288
|
* Canonical tag name for the runtime turn context block injected into Pi
|
|
1297
1289
|
* messages. Shared between prompt assembly and turn context stripping to keep
|
|
1298
1290
|
* both in sync without requiring the full prompt module.
|
|
1299
1291
|
*/
|
|
1300
1292
|
const TURN_CONTEXT_TAG = "runtime-turn-context";
|
|
1301
|
-
|
|
1302
|
-
//#region src/chat/pi/transcript.ts
|
|
1293
|
+
// src/chat/pi/transcript.ts
|
|
1303
1294
|
const RUNTIME_TURN_CONTEXT_START = `<${TURN_CONTEXT_TAG}>`;
|
|
1304
1295
|
const AGENTS_INSTRUCTIONS_START = "# AGENTS.md instructions";
|
|
1305
1296
|
function userMessageContent(message) {
|
|
@@ -1431,8 +1422,7 @@ function stripRuntimeTurnContext(messages) {
|
|
|
1431
1422
|
}];
|
|
1432
1423
|
});
|
|
1433
1424
|
}
|
|
1434
|
-
|
|
1435
|
-
//#region src/chat/services/turn-limit.ts
|
|
1425
|
+
// src/chat/services/turn-limit.ts
|
|
1436
1426
|
/** Terminal failure when one turn uses too many execution slices. */
|
|
1437
1427
|
var TurnSliceLimitExceededError = class extends Error {
|
|
1438
1428
|
constructor(maxSlices) {
|
|
@@ -1495,8 +1485,7 @@ function buildTurnLimitResponse(eventId) {
|
|
|
1495
1485
|
function buildTurnErrorResponse(error, eventId) {
|
|
1496
1486
|
return isTurnExecutionLimitExceededError(error) ? buildTurnLimitResponse(eventId) : buildTurnFailureResponse(eventId);
|
|
1497
1487
|
}
|
|
1498
|
-
|
|
1499
|
-
//#region src/chat/services/persist-retry.ts
|
|
1488
|
+
// src/chat/services/persist-retry.ts
|
|
1500
1489
|
/**
|
|
1501
1490
|
* Shared post-delivery persist retry.
|
|
1502
1491
|
*
|
|
@@ -1517,8 +1506,7 @@ async function persistWithRetry(persist) {
|
|
|
1517
1506
|
}
|
|
1518
1507
|
throw lastError;
|
|
1519
1508
|
}
|
|
1520
|
-
|
|
1521
|
-
//#region src/chat/task-execution/turn-cursor-keys.ts
|
|
1509
|
+
// src/chat/task-execution/turn-cursor-keys.ts
|
|
1522
1510
|
/** Redis namespace for the current turn cursor format. */
|
|
1523
1511
|
const TURN_CURSOR_PREFIX = "junior:turn_cursor:v2";
|
|
1524
1512
|
/** Return the Redis key for one turn cursor. */
|
|
@@ -1533,8 +1521,7 @@ function turnCursorIndexKey(conversationId) {
|
|
|
1533
1521
|
function turnCursorMutationKey(conversationId, turnId) {
|
|
1534
1522
|
return `${TURN_CURSOR_PREFIX}:mutation:${conversationId}:${turnId}`;
|
|
1535
1523
|
}
|
|
1536
|
-
|
|
1537
|
-
//#region src/chat/task-execution/turn-cursor.ts
|
|
1524
|
+
// src/chat/task-execution/turn-cursor.ts
|
|
1538
1525
|
/**
|
|
1539
1526
|
* Internal turn cursor storage for `checkpoint.ts`.
|
|
1540
1527
|
*
|
|
@@ -2089,8 +2076,7 @@ async function failTurnRecord(args) {
|
|
|
2089
2076
|
});
|
|
2090
2077
|
});
|
|
2091
2078
|
}
|
|
2092
|
-
|
|
2093
|
-
//#region src/chat/task-execution/checkpoint.ts
|
|
2079
|
+
// src/chat/task-execution/checkpoint.ts
|
|
2094
2080
|
function definedProps(values) {
|
|
2095
2081
|
return Object.fromEntries(Object.entries(values).filter(([, value]) => value !== void 0));
|
|
2096
2082
|
}
|
|
@@ -2241,8 +2227,7 @@ async function saveDone(args) {
|
|
|
2241
2227
|
});
|
|
2242
2228
|
});
|
|
2243
2229
|
}
|
|
2244
|
-
|
|
2245
|
-
//#region src/chat/slack/post-warning.ts
|
|
2230
|
+
// src/chat/slack/post-warning.ts
|
|
2246
2231
|
const codes = /* @__PURE__ */ new Set([
|
|
2247
2232
|
"invalid_metadata_format",
|
|
2248
2233
|
"invalid_metadata_schema",
|
|
@@ -2338,8 +2323,7 @@ function captureSlackPostWarning(response, attributes) {
|
|
|
2338
2323
|
}
|
|
2339
2324
|
});
|
|
2340
2325
|
}
|
|
2341
|
-
|
|
2342
|
-
//#region src/chat/slack/work-object.ts
|
|
2326
|
+
// src/chat/slack/work-object.ts
|
|
2343
2327
|
const url = z.url({ protocol: /^https?$/ });
|
|
2344
2328
|
const textField = z.strictObject({
|
|
2345
2329
|
type: z.literal("string"),
|
|
@@ -2388,8 +2372,7 @@ const slackEntitySchema = z.discriminatedUnion("entity_type", [entity.extend({
|
|
|
2388
2372
|
entity_type: z.literal("slack#/entities/task"),
|
|
2389
2373
|
entity_payload: payload.extend({ fields: z.strictObject({ status: z.strictObject({ value: z.string() }).optional() }).optional() })
|
|
2390
2374
|
})]);
|
|
2391
|
-
|
|
2392
|
-
//#region src/chat/slack/outbound.ts
|
|
2375
|
+
// src/chat/slack/outbound.ts
|
|
2393
2376
|
const MAX_SLACK_MESSAGE_TEXT_CHARS = 4e4;
|
|
2394
2377
|
function requireSlackConversationId(channelId, action) {
|
|
2395
2378
|
const normalized = normalizeSlackConversationId(channelId);
|
|
@@ -2579,8 +2562,7 @@ async function removeReactionFromMessage(input) {
|
|
|
2579
2562
|
}
|
|
2580
2563
|
return { ok: true };
|
|
2581
2564
|
}
|
|
2582
|
-
|
|
2583
|
-
//#region src/chat/slack/status-format.ts
|
|
2565
|
+
// src/chat/slack/status-format.ts
|
|
2584
2566
|
const SLACK_STATUS_MAX_LENGTH = 50;
|
|
2585
2567
|
/** Truncate a status string to fit Slack's 50-char assistant status limit. */
|
|
2586
2568
|
function truncateStatusText(text) {
|
|
@@ -2589,8 +2571,7 @@ function truncateStatusText(text) {
|
|
|
2589
2571
|
if (trimmed.length <= SLACK_STATUS_MAX_LENGTH) return trimmed;
|
|
2590
2572
|
return `${trimmed.slice(0, 47).trimEnd()}...`;
|
|
2591
2573
|
}
|
|
2592
|
-
|
|
2593
|
-
//#region src/chat/slack/mrkdwn.ts
|
|
2574
|
+
// src/chat/slack/mrkdwn.ts
|
|
2594
2575
|
/** Escape dynamic text for Slack mrkdwn without changing intended formatting. */
|
|
2595
2576
|
function escapeSlackMrkdwnText(text) {
|
|
2596
2577
|
return text.replaceAll("&", "&").replaceAll("<", "<").replaceAll(">", ">");
|
|
@@ -2652,7 +2633,7 @@ function hasUnmatchedClosingParen(text) {
|
|
|
2652
2633
|
function readBareUrl(line, start) {
|
|
2653
2634
|
let end = start;
|
|
2654
2635
|
while (end < line.length) {
|
|
2655
|
-
const ch = line
|
|
2636
|
+
const ch = line.charAt(end);
|
|
2656
2637
|
if (/\s/.test(ch) || ch === "<" || ch === ">" || ch === "\"" || ch === "`" || ch === "|" || ch === "*") break;
|
|
2657
2638
|
end++;
|
|
2658
2639
|
}
|
|
@@ -2757,8 +2738,7 @@ function ensureBlockSpacing(text) {
|
|
|
2757
2738
|
const lines = text.split("\n");
|
|
2758
2739
|
const result = [];
|
|
2759
2740
|
let inCodeBlock = false;
|
|
2760
|
-
for (
|
|
2761
|
-
const line = lines[i];
|
|
2741
|
+
for (const line of lines) {
|
|
2762
2742
|
if (codeBlockPattern.test(line.trimStart())) {
|
|
2763
2743
|
if (!inCodeBlock) {
|
|
2764
2744
|
const prev = result.length > 0 ? result[result.length - 1] : void 0;
|
|
@@ -2802,8 +2782,7 @@ function normalizeSlackStatusText(text) {
|
|
|
2802
2782
|
function slackMention(userId) {
|
|
2803
2783
|
return `<@${userId}>`;
|
|
2804
2784
|
}
|
|
2805
|
-
|
|
2806
|
-
//#region src/chat/automations/revision.ts
|
|
2785
|
+
// src/chat/automations/revision.ts
|
|
2807
2786
|
/** Storage revisions prevent stale edits from replacing newer values. */
|
|
2808
2787
|
var AutomationConflictError = class extends ToolInputError {
|
|
2809
2788
|
constructor() {
|
|
@@ -2825,8 +2804,7 @@ function automationRevision(task) {
|
|
|
2825
2804
|
function requireAutomationRevision(task, revision) {
|
|
2826
2805
|
if (!task || automationRevision(task) !== revision) throw new AutomationConflictError();
|
|
2827
2806
|
}
|
|
2828
|
-
|
|
2829
|
-
//#region src/chat/automations/versions.ts
|
|
2807
|
+
// src/chat/automations/versions.ts
|
|
2830
2808
|
/** Automation versions keep each saved definition so people can see how it changed. */
|
|
2831
2809
|
/** Return the versioned part of an Automation. Lifecycle and run state are excluded. */
|
|
2832
2810
|
function automationDefinition(task) {
|
|
@@ -2909,12 +2887,9 @@ async function readAutomationVersion(db, automationId, version) {
|
|
|
2909
2887
|
async function listAutomationVersions(db, automationId, limit) {
|
|
2910
2888
|
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
2889
|
}
|
|
2912
|
-
|
|
2913
|
-
//#region src/chat/event-automations/run-limit.ts
|
|
2890
|
+
// src/chat/event-automations/run-limit.ts
|
|
2914
2891
|
const RUN_LIST_PREFIX = "junior:event_automation_runs:v1";
|
|
2915
2892
|
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
2893
|
const runEntrySchema = z.union([z.object({
|
|
2919
2894
|
atMs: z.number().finite(),
|
|
2920
2895
|
id: z.string().min(1)
|
|
@@ -2923,21 +2898,34 @@ function runListKey(automationId) {
|
|
|
2923
2898
|
return `${RUN_LIST_PREFIX}:${automationId}`;
|
|
2924
2899
|
}
|
|
2925
2900
|
function runListMaxLength() {
|
|
2926
|
-
return botConfig.
|
|
2901
|
+
return botConfig.maxEventAutomationRuns + RUN_LIST_BURST_ROOM;
|
|
2927
2902
|
}
|
|
2928
2903
|
async function appendRunEntry(state, automationId, entry) {
|
|
2929
2904
|
await state.connect();
|
|
2930
2905
|
await state.appendToList(runListKey(automationId), entry, {
|
|
2931
2906
|
maxLength: runListMaxLength(),
|
|
2932
|
-
ttlMs:
|
|
2907
|
+
ttlMs: botConfig.eventAutomationRunWindowMs
|
|
2933
2908
|
});
|
|
2934
2909
|
}
|
|
2910
|
+
function describeRunWindow(windowMs) {
|
|
2911
|
+
for (const [unit, unitMs] of [
|
|
2912
|
+
["day", 864e5],
|
|
2913
|
+
["hour", 36e5],
|
|
2914
|
+
["minute", 6e4],
|
|
2915
|
+
["second", 1e3]
|
|
2916
|
+
]) if (windowMs % unitMs === 0) {
|
|
2917
|
+
const count = windowMs / unitMs;
|
|
2918
|
+
return count === 1 ? unit : `${count} ${unit}s`;
|
|
2919
|
+
}
|
|
2920
|
+
return `${windowMs} ms`;
|
|
2921
|
+
}
|
|
2935
2922
|
/** Reason stored on an Event automation that the run limit blocked. */
|
|
2936
2923
|
function eventAutomationRunLimitReason() {
|
|
2937
|
-
|
|
2924
|
+
const window = describeRunWindow(botConfig.eventAutomationRunWindowMs);
|
|
2925
|
+
return `This automation reached its limit of ${botConfig.maxEventAutomationRuns} runs per ${window}. Check that its trigger is not too broad, then resume it.`;
|
|
2938
2926
|
}
|
|
2939
2927
|
/**
|
|
2940
|
-
* Count one run of an Event automation, or refuse when its
|
|
2928
|
+
* Count one run of an Event automation, or refuse when its window is full.
|
|
2941
2929
|
*
|
|
2942
2930
|
* `runKey` is the dispatch idempotency key, so a provider retry of the same
|
|
2943
2931
|
* Event does not count again.
|
|
@@ -2948,7 +2936,7 @@ async function admitEventAutomationRun(args) {
|
|
|
2948
2936
|
atMs: args.nowMs,
|
|
2949
2937
|
id: args.runKey
|
|
2950
2938
|
});
|
|
2951
|
-
const windowStartMs = args.nowMs -
|
|
2939
|
+
const windowStartMs = args.nowMs - botConfig.eventAutomationRunWindowMs;
|
|
2952
2940
|
const values = await state.getList(runListKey(args.automationId));
|
|
2953
2941
|
const entries = values.flatMap((value) => {
|
|
2954
2942
|
const entry = runEntrySchema.safeParse(value);
|
|
@@ -2964,7 +2952,7 @@ async function admitEventAutomationRun(args) {
|
|
|
2964
2952
|
for (const entry of entries.slice(lastReset + 1)) {
|
|
2965
2953
|
if ("reset" in entry) continue;
|
|
2966
2954
|
if (entry.atMs > windowStartMs) runKeys.add(entry.id);
|
|
2967
|
-
if (entry.id === args.runKey) return full || runKeys.size > botConfig.
|
|
2955
|
+
if (entry.id === args.runKey) return full || runKeys.size > botConfig.maxEventAutomationRuns ? "limited" : "allowed";
|
|
2968
2956
|
}
|
|
2969
2957
|
return "limited";
|
|
2970
2958
|
}
|
|
@@ -2978,8 +2966,7 @@ async function admitEventAutomationRun(args) {
|
|
|
2978
2966
|
async function clearEventAutomationRuns(automationId, state = getStateAdapter()) {
|
|
2979
2967
|
await appendRunEntry(state, automationId, { reset: true });
|
|
2980
2968
|
}
|
|
2981
|
-
|
|
2982
|
-
//#region src/chat/event-automations/store.ts
|
|
2969
|
+
// src/chat/event-automations/store.ts
|
|
2983
2970
|
/**
|
|
2984
2971
|
* Validate an event automation and split it into its SQL columns. Lifecycle
|
|
2985
2972
|
* columns are written separately.
|
|
@@ -3161,8 +3148,7 @@ async function blockEventAutomation(db, id, reason) {
|
|
|
3161
3148
|
statusReason: reason
|
|
3162
3149
|
}).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
3150
|
}
|
|
3164
|
-
|
|
3165
|
-
//#region src/chat/scheduled-automations/tasks.ts
|
|
3151
|
+
// src/chat/scheduled-automations/tasks.ts
|
|
3166
3152
|
const SCHEDULER_KEY_PREFIX = "junior:scheduler";
|
|
3167
3153
|
/** Decode a Scheduled automation row. Returns undefined for an invalid row. */
|
|
3168
3154
|
function parseScheduledAutomationRow(row) {
|
|
@@ -3284,5 +3270,4 @@ async function saveScheduledAutomation(db, task, expectedRevision, editedBy) {
|
|
|
3284
3270
|
async function saveScheduledAutomationInLock(db, task, current) {
|
|
3285
3271
|
await writeScheduledAutomation(db, requireStoredTask(task), current);
|
|
3286
3272
|
}
|
|
3287
|
-
//#endregion
|
|
3288
3273
|
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 {
|
|
1
|
+
import { B as toOptionalNumber, V as toOptionalString, z as isRecord } from "./logging-BStXN56b.js";
|
|
2
|
+
import { d as getDb } from "./viewer-B2_ABsYi.js";
|
|
3
|
+
import { d as juniorDestinations } from "./agent-invocations-Qfz7dWgU.js";
|
|
4
|
+
import { l as juniorLocationConfigurations } from "./executor-Bb3eQb8q.js";
|
|
5
|
+
import { Gt as persistConversationMessages } from "./tasks-DieKX3d4.js";
|
|
6
|
+
import { it as JUNIOR_THREAD_STATE_TTL_MS } from "./agent-hooks-B00FaKdP.js";
|
|
7
|
+
import { r as getStateAdapter } from "./adapter-Bn0gFVSF.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
|
|
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 getProviderErrorAttributes, g as findProviderError, m as ProviderError, v as getProviderErrorUserMessage } from "./client-BZdxgKyL.js";
|
|
2
|
+
import { t as buildTurnFailureResponse, z as isRecord } from "./logging-BStXN56b.js";
|
|
3
|
+
import { g as parseSlackMessageTs } from "./actor-tlxzqaRe.js";
|
|
4
|
+
import { c as getConversationEventStore, d as getDb } from "./viewer-B2_ABsYi.js";
|
|
5
|
+
import { Wt as hydrateConversationMessages, in as markConversationMessage } from "./tasks-DieKX3d4.js";
|
|
6
|
+
import { Nt as listConversationAnnotations } from "./agent-hooks-B00FaKdP.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-rG5U_QS1.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-DpSWS4Rr.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-B2_ABsYi.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-B2_ABsYi.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-B8SuFPGb.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.259.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 };
|