@sentry/junior 0.267.0 → 0.268.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-DZSokpwj.js → actor-CP9K2Idu.js} +2 -1
- package/dist/{adapter-BybMEezj.js → adapter-04AcD2SO.js} +4 -6
- package/dist/{admin-DOs1_EiW.js → admin-DIU1QyG3.js} +1 -1
- package/dist/{agent-invocations-CxKldAeB.js → agent-invocations-C1RNOCs8.js} +2 -0
- package/dist/{agent-runner-DgNATN4D.js → agent-runner-CAYfFmU7.js} +4409 -3020
- package/dist/api/schema.d.ts +2 -5629
- package/dist/api/schema.js +4 -4
- package/dist/api.d.ts +1 -1
- package/dist/api.js +154 -32
- package/dist/{app-DAB3fzyp.d.ts → app-z6Uuyq3j.d.ts} +3 -2
- package/dist/app.d.ts +1 -1
- package/dist/app.js +332 -98
- package/dist/{briefs-CWKjka7v.js → briefs-DQbV2jNr.js} +2 -2
- package/dist/{catalog-runtime-cMlAI5LY.js → catalog-runtime-BD9GSpc6.js} +1 -1
- package/dist/cli/chat.js +15 -15
- package/dist/cli/check.js +3 -3
- package/dist/cli/main.js +3 -3
- package/dist/cli/plugins.js +4 -4
- package/dist/cli/snapshot-create.js +4 -4
- package/dist/cli/upgrade.d.ts +1 -1
- package/dist/cli/upgrade.js +3 -3
- package/dist/{client-BjgbMawj.js → client-C1yDYjoS.js} +2 -2
- package/dist/{config-CdB6yJj5.js → config-DrTeF80T.js} +2 -2
- package/dist/{connections-RE_65jzK.js → connections-D46f8vvi.js} +10 -11
- package/dist/{conversation-privacy-BzgJC5k0.js → conversation-privacy-CxlOCiUo.js} +1 -1
- package/dist/{credential-sync-DhEGEpgq.js → credential-sync-sm9fegLY.js} +29 -34
- package/dist/{credentialed-CIGwoLU2.js → credentialed-lukuD-cc.js} +39 -13
- package/dist/db-BU4LQD8s.d.ts +6 -0
- package/dist/{executor-VYrx_K4w.js → executor-4vhvsMZJ.js} +78 -4
- package/dist/instrumentation.js +2 -2
- package/dist/{assistant-reply-CT7VcXQe.js → interruption-marker-CkncDT8d.js} +8 -2
- package/dist/{job-queue-C0BZSa7r.js → job-queue-In9QKz-I.js} +2 -2
- package/dist/{list-1XQP-o6K.js → list-BkgnXEEB.js} +298 -807
- package/dist/{logging-DuZ1A4ab.js → logging-DLSpkSSr.js} +1 -1
- package/dist/{message-NKSbbnA6.js → message-BObyg59s.js} +4 -4
- package/dist/nitro.d.ts +1 -1
- package/dist/nitro.js +3 -3
- package/dist/{oauth-callback-server-qAHLPtml.js → oauth-callback-server-B-WbSdoH.js} +2 -2
- package/dist/{registry-FQutO926.js → registry-BgecKva0.js} +2 -2
- package/dist/{web-message-id-CJSUiksE.js → reporting-window-DVCD_10C.js} +1 -10
- package/dist/{resolve-Bk4yeuHy.js → resolve-Cpa4Bu1O.js} +3 -3
- package/dist/{result-B9e9ATOU.js → result-D3TSmZZ8.js} +8 -8
- package/dist/{runner-C3S2ObH-.js → runner-DS5OKhEp.js} +10 -10
- package/dist/{sandbox-egress-signals-DqpGzzMB.js → sandbox-egress-signals-CnDjY5rx.js} +1 -1
- package/dist/{schema-X7Fj4fv1.js → schema-0050HFnB.js} +80 -4
- package/dist/schema-ZngqcOWM.d.ts +5813 -0
- package/dist/{service-account-Do30HUNv.js → service-account-CKV2WTY7.js} +3 -3
- package/dist/{service-account-BQasl-qq.js → service-account-DGjnDw9y.js} +3 -3
- package/dist/{session-stop-DkOjt46_.js → session-stop-Dam1EI7B.js} +494 -18
- package/dist/{skills-CQHrwfOa.js → skills-CfAnfImD.js} +2 -2
- package/dist/{spawn-BHuqN14f.js → spawn-cmq9p4Ly.js} +2 -2
- package/dist/{store-6EetVP-m.js → store-C5PN02QO.js} +4 -4
- package/dist/{store-B8CABbmR.d.ts → store-xMuuXRE0.d.ts} +13 -7
- package/dist/{store-DvNZIsCr.js → store-zPEoJPBB.js} +3 -3
- package/dist/{task-queue-B0DLgd2P.js → task-queue-_mf28dSu.js} +3 -3
- package/dist/{task-runner-B-PD_JOj.js → task-runner-DMI2prDO.js} +11 -12
- package/dist/{tasks-0ilmuCux.js → tasks-SB9z-VTU.js} +124 -21
- package/dist/{thread-state-DRmdJ2QN.js → thread-state-BbbPh0Sn.js} +8 -18
- package/dist/{turn-failure-response-G11cs2gE.js → turn-failure-response-BKKmnMB5.js} +10 -15
- package/dist/{turn-lifecycle-OzLIwvi1.js → turn-lifecycle-oP0kVeGz.js} +1 -1
- package/dist/{validation-CxEmt1id.js → validation--JsAGLwc.js} +1 -1
- package/dist/{version-Bapedn4A.js → version-jHwJp4hC.js} +1 -1
- package/dist/version.js +1 -1
- package/dist/{viewer-DrN3oC2X.js → viewer-CpXTGlep.js} +323 -235
- package/dist/{user-input-request-BDFBdF8r.js → web-message-id-DlHNANtd.js} +17 -1
- package/dist/{work-DUQoNcqP.js → work-3N-GHY9m.js} +10 -10
- package/dist/{worker-D1l4Ugk0.js → worker-CCdbcItd.js} +6 -6
- package/migrations/0065_user_customization.sql +1 -0
- package/migrations/0066_review_items.sql +53 -0
- package/migrations/0067_review_item_dedupe_tenant.sql +2 -0
- package/migrations/0068_review_item_slack_cards.sql +10 -0
- package/migrations/meta/0065_snapshot.json +3511 -0
- package/migrations/meta/0066_snapshot.json +4099 -0
- package/migrations/meta/0067_snapshot.json +3921 -0
- package/migrations/meta/0068_snapshot.json +4176 -0
- package/migrations/meta/_journal.json +29 -1
- package/package.json +5 -5
- package/dist/db-Bg-zC3r5.d.ts +0 -5
- package/dist/images-CecjXAAz.js +0 -64
- package/dist/turn-session-routing-Dyut9l7Y.js +0 -76
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { h as logWarn } from "./logging-
|
|
2
|
-
import { c as QUEUE_SIGNATURE_MAX_AGE_MS, d as getQueueProvider, l as signQueueMessage, p as runWithTurnRequestDeadline, u as verifyQueueMessage } from "./job-queue-
|
|
1
|
+
import { h as logWarn } from "./logging-DLSpkSSr.js";
|
|
2
|
+
import { c as QUEUE_SIGNATURE_MAX_AGE_MS, d as getQueueProvider, l as signQueueMessage, p as runWithTurnRequestDeadline, u as verifyQueueMessage } from "./job-queue-In9QKz-I.js";
|
|
3
3
|
import { z } from "zod";
|
|
4
4
|
import { createHash } from "node:crypto";
|
|
5
5
|
// src/chat/queue/callback.ts
|
|
@@ -110,7 +110,7 @@ function pluginTaskCallback() {
|
|
|
110
110
|
maxDeliveries: PLUGIN_TASK_MAX_DELIVERIES,
|
|
111
111
|
onRejected: logPluginTaskQueueMessageRejected,
|
|
112
112
|
run: async (message) => {
|
|
113
|
-
const { processPluginTask } = await import("./task-runner-
|
|
113
|
+
const { processPluginTask } = await import("./task-runner-DMI2prDO.js").then((n) => n.r);
|
|
114
114
|
await processPluginTask(message);
|
|
115
115
|
},
|
|
116
116
|
topic: PLUGIN_TASK_QUEUE_TOPIC,
|
|
@@ -1,17 +1,16 @@
|
|
|
1
1
|
import { t as __exportAll } from "./rolldown-runtime-nwUcYXjP.js";
|
|
2
|
-
import {
|
|
3
|
-
import { _ as runBestEffort, h as logWarn } from "./logging-
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import { s as juniorConversations } from "./agent-invocations-
|
|
7
|
-
import {
|
|
2
|
+
import { A as resolveConversationRouting, Gn as isToolResultError, Hn as instructionTextForProjection, Kn as isToolResultMessage, Rn as getPiMessageRole, Yn as stripRuntimeTurnContext, Yt as getTurnRecord, ft as hydrateConversationMessages, i as readScheduledAutomation, l as blockEventAutomation, m as getEventAutomation, qn as normalizeToolNameFromResult, vt as fallbackShortTitle } from "./tasks-SB9z-VTU.js";
|
|
3
|
+
import { _ as runBestEffort, h as logWarn } from "./logging-DLSpkSSr.js";
|
|
4
|
+
import { m as parseSlackMessageTs } from "./actor-CP9K2Idu.js";
|
|
5
|
+
import { F as agentTurnTotalTokens, P as agentTurnCostUsd, i as readActorIdentity, m as getDb, p as getConversationStore } from "./viewer-CpXTGlep.js";
|
|
6
|
+
import { s as juniorConversations } from "./agent-invocations-C1RNOCs8.js";
|
|
7
|
+
import { d as juniorAutomations, l as juniorAutomationRuns, u as juniorAutomationVersions } from "./executor-4vhvsMZJ.js";
|
|
8
8
|
import { m as sameActorIdentity } from "./history-C84mlAwO.js";
|
|
9
|
-
import { h as credentialSubjectSchema } from "./registry-
|
|
10
|
-
import {
|
|
11
|
-
import { i as getStateAdapter } from "./adapter-
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import { i as pluginTaskParamsSchema, r as pluginTaskId, s as sendVercelPluginTask } from "./task-queue-B0DLgd2P.js";
|
|
9
|
+
import { h as credentialSubjectSchema } from "./registry-BgecKva0.js";
|
|
10
|
+
import { Fn as createPluginModel, In as createPluginLogger, Kn as createPluginConversationEvents, Nn as createPluginState, Pn as createPluginEmbedder, Q as openSlackDirectMessage, U as escapeSlackMrkdwnText, W as formatSlackLink, _n as getDashboardTaskLink, cr as createPluginCache, g as coreTaskRegistrations, p as getPlugins, pn as JUNIOR_THREAD_STATE_TTL_MS, tt as postSlackMessage } from "./credentialed-lukuD-cc.js";
|
|
11
|
+
import { i as getStateAdapter } from "./adapter-04AcD2SO.js";
|
|
12
|
+
import { o as coerceThreadConversationState, r as getPersistedThreadState } from "./thread-state-BbbPh0Sn.js";
|
|
13
|
+
import { i as pluginTaskParamsSchema, r as pluginTaskId, s as sendVercelPluginTask } from "./task-queue-_mf28dSu.js";
|
|
15
14
|
import { z } from "zod";
|
|
16
15
|
import { createHash } from "node:crypto";
|
|
17
16
|
import { and, asc, count, desc, eq, gte, inArray, isNotNull, lte, max, sql } from "drizzle-orm";
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import { a as completeText, f as unwrapCurrentInstruction, p as escapeXml, s as resolveGatewayModel, y as isProviderRetryError } from "./client-
|
|
2
|
-
import { i as getChatConfig, n as botConfig } from "./config-
|
|
3
|
-
import { B as isRecord, H as toOptionalString, V as toOptionalNumber, b as setSpanAttributes, h as logWarn, o as getActiveTraceContext, p as logException, t as buildTurnFailureResponse } from "./logging-
|
|
4
|
-
import { c as
|
|
5
|
-
import { B as parseDestination,
|
|
6
|
-
import { d as juniorDestinations } from "./agent-invocations-
|
|
7
|
-
import {
|
|
1
|
+
import { a as completeText, f as unwrapCurrentInstruction, p as escapeXml, s as resolveGatewayModel, y as isProviderRetryError } from "./client-C1yDYjoS.js";
|
|
2
|
+
import { i as getChatConfig, n as botConfig } from "./config-DrTeF80T.js";
|
|
3
|
+
import { B as isRecord, H as toOptionalString, V as toOptionalNumber, b as setSpanAttributes, h as logWarn, o as getActiveTraceContext, p as logException, t as buildTurnFailureResponse } from "./logging-DLSpkSSr.js";
|
|
4
|
+
import { c as parseStoredSlackActor, l as toStoredSlackActor, m as parseSlackMessageTs } from "./actor-CP9K2Idu.js";
|
|
5
|
+
import { B as parseDestination, H as sameDestination, N as addAgentTurnUsage, S as startLocationThread, _ as withConversationEventLock, d as getConversationEventStore, g as createSqlConversationEventStore, h as getSqlExecutor, j as bindProviderConversation, m as getDb, p as getConversationStore } from "./viewer-CpXTGlep.js";
|
|
6
|
+
import { d as juniorDestinations } from "./agent-invocations-C1RNOCs8.js";
|
|
7
|
+
import { d as juniorAutomations, l as juniorAutomationRuns, p as juniorLocationConfigurations, u as juniorAutomationVersions } from "./executor-4vhvsMZJ.js";
|
|
8
8
|
import { d as contextProvenance, f as instructionActors, n as agentHistoryItemSchema, p as instructionProvenanceFor } from "./history-C84mlAwO.js";
|
|
9
|
-
import { f as credentialContextForActor, h as credentialSubjectSchema } from "./registry-
|
|
10
|
-
import { n as pluginCatalogRuntime } from "./catalog-runtime-
|
|
11
|
-
import { H as startOAuthFlow,
|
|
12
|
-
import { a as MUTATION_LOCK_TTL_MS, c as withLock, i as getStateAdapter, r as getDefaultRedisStateAdapterFor, s as fenceLock } from "./adapter-
|
|
9
|
+
import { f as credentialContextForActor, h as credentialSubjectSchema } from "./registry-BgecKva0.js";
|
|
10
|
+
import { n as pluginCatalogRuntime } from "./catalog-runtime-BD9GSpc6.js";
|
|
11
|
+
import { H as startOAuthFlow, In as createPluginLogger, bt as parseSandboxEgressAuthRequiredSignal, cr as createPluginCache, dr as agentsInstructionsUpdatedEvent, fr as authenticationLinkedEvent, p as getPlugins, pn as JUNIOR_THREAD_STATE_TTL_MS, pr as authenticationUnlinkedEvent, t as executeCredentialedEgressRequest, un as sleep$1, ur as JUNIOR_NATIVE_EVENT_NAMESPACE, wt as resolveSandboxEgressProviderForHost, yn as ToolInputError, z as formatProviderLabel } from "./credentialed-lukuD-cc.js";
|
|
12
|
+
import { a as MUTATION_LOCK_TTL_MS, c as withLock, i as getStateAdapter, r as getDefaultRedisStateAdapterFor, s as fenceLock } from "./adapter-04AcD2SO.js";
|
|
13
13
|
import { L as messageCardRef } from "./conversation-DSo310Ps.js";
|
|
14
14
|
import { A as eventAutomationSchema, E as scheduledAutomationSchema, S as automationVersionSchema } from "./automation-CmeFBSEh.js";
|
|
15
15
|
import { isDeepStrictEqual } from "node:util";
|
|
@@ -401,7 +401,11 @@ function createDurableLocationConfigurationService(args) {
|
|
|
401
401
|
* Add new keys here as features graduate from private experiments; remove them
|
|
402
402
|
* once they become stable defaults.
|
|
403
403
|
*/
|
|
404
|
-
const EXPERIMENTAL_FEATURES = [
|
|
404
|
+
const EXPERIMENTAL_FEATURES = [
|
|
405
|
+
"operator-tools",
|
|
406
|
+
"passive-routing",
|
|
407
|
+
"user-customization"
|
|
408
|
+
];
|
|
405
409
|
const EXPERIMENTAL_FEATURE_SET = new Set(EXPERIMENTAL_FEATURES);
|
|
406
410
|
let configuredExperimental = {};
|
|
407
411
|
function isExperimentalFeature(value) {
|
|
@@ -887,7 +891,8 @@ const SESSION_CONTEXT_SECTION_TAG = "runtime";
|
|
|
887
891
|
const REQUEST_CONTEXT_SECTION_TAG = {
|
|
888
892
|
pluginContext: "plugin-context",
|
|
889
893
|
conversationNotes: "conversation-notes",
|
|
890
|
-
disabledTools: "disabled-tools"
|
|
894
|
+
disabledTools: "disabled-tools",
|
|
895
|
+
userCustomization: "user-customization"
|
|
891
896
|
};
|
|
892
897
|
// src/chat/pi/transcript.ts
|
|
893
898
|
const RUNTIME_TURN_CONTEXT_START = `<${TURN_CONTEXT_TAG}>`;
|
|
@@ -1158,6 +1163,13 @@ const inboundMessageSourceSchema = z.enum([
|
|
|
1158
1163
|
const agentInputSchema = z.object({
|
|
1159
1164
|
attachments: z.array(z.unknown()).optional(),
|
|
1160
1165
|
authorId: z.string().min(1).optional(),
|
|
1166
|
+
/**
|
|
1167
|
+
* Identity of the input author, resolved at ingress.
|
|
1168
|
+
*
|
|
1169
|
+
* TODO(dcramer): Set this at every ingress after every deployed worker
|
|
1170
|
+
* reads it. This schema is strict, so an older worker rejects the entry.
|
|
1171
|
+
*/
|
|
1172
|
+
authorIdentityId: z.string().min(1).optional(),
|
|
1161
1173
|
metadata: z.record(z.string(), z.unknown()).optional(),
|
|
1162
1174
|
text: z.string()
|
|
1163
1175
|
}).strict().refine((input) => input.text.trim() || input.attachments?.length, { message: "agent input requires text or attachments" });
|
|
@@ -2300,8 +2312,17 @@ async function withTurnCursorMutation(conversationId, turnId, run) {
|
|
|
2300
2312
|
if (!result.acquired) throw new Error(`Could not acquire turn cursor lock for ${turnId}`);
|
|
2301
2313
|
return result.value;
|
|
2302
2314
|
}
|
|
2303
|
-
|
|
2304
|
-
|
|
2315
|
+
/**
|
|
2316
|
+
* Read this Turn's own totals. A newer Turn can own the latest Conversation
|
|
2317
|
+
* metrics while this Turn is paused, so fall back to this Turn's metric rows.
|
|
2318
|
+
*/
|
|
2319
|
+
async function executionMetricsForTurn(conversationStore, conversation, turnId) {
|
|
2320
|
+
if (!conversation) return void 0;
|
|
2321
|
+
if (conversation.executionMetrics?.runId === turnId) return conversation.executionMetrics;
|
|
2322
|
+
return await conversationStore.getRunMetrics({
|
|
2323
|
+
conversationId: conversation.conversationId,
|
|
2324
|
+
runId: turnId
|
|
2325
|
+
});
|
|
2305
2326
|
}
|
|
2306
2327
|
/** Keep only keys whose value is defined. */
|
|
2307
2328
|
function definedProps$1(values) {
|
|
@@ -2350,6 +2371,7 @@ const storedTurnSummarySchema = z.object({
|
|
|
2350
2371
|
/** Full resume cursor stored for one turn. */
|
|
2351
2372
|
const storedTurnRecordSchema = z.object({
|
|
2352
2373
|
actor: actorSchema.optional(),
|
|
2374
|
+
actorIdentityId: z.string().min(1).optional(),
|
|
2353
2375
|
schemaVersion: z.literal(TURN_CURSOR_SCHEMA_VERSION),
|
|
2354
2376
|
version: z.number().int().nonnegative(),
|
|
2355
2377
|
conversationId: z.string().min(1),
|
|
@@ -2472,6 +2494,7 @@ function materializeTurnRecord(stored, piProjection, turnStartMessageIndex, runt
|
|
|
2472
2494
|
actors: instructionActors(piProjection.provenance),
|
|
2473
2495
|
cumulativeDurationMs: runtimeMetrics?.cumulativeDurationMs ?? 0,
|
|
2474
2496
|
...definedProps$1({
|
|
2497
|
+
actorIdentityId: stored.actorIdentityId,
|
|
2475
2498
|
channelName: runtimeMetrics?.channelName,
|
|
2476
2499
|
credentialSubject: stored.credentialSubject,
|
|
2477
2500
|
cumulativeToolCallCount: stored.cumulativeToolCallCount,
|
|
@@ -2513,8 +2536,9 @@ async function materializeStoredTurnRecord(conversationId, turnId, followCurrent
|
|
|
2513
2536
|
const followsReplacement = followCurrentReplacement && (parsed.state === "running" || parsed.state === "paused") && parsed.historyVersion !== void 0 && parsed.historyVersion !== currentHistoryVersion;
|
|
2514
2537
|
const piProjection = followsReplacement ? projectConversationEvents(await eventStore.loadCurrentHistory(conversationId), { defaultProfile: botConfig.defaultProfile }) : pinnedProjection;
|
|
2515
2538
|
const turnStartMessageIndex = followsReplacement ? 0 : parsed.turnStartSeq === void 0 ? void 0 : piProjection.seqs.filter((seq) => seq <= parsed.turnStartSeq).length;
|
|
2516
|
-
const
|
|
2517
|
-
const
|
|
2539
|
+
const conversationStore = getConversationStore();
|
|
2540
|
+
const conversation = await conversationStore.get({ conversationId });
|
|
2541
|
+
const executionMetrics = await executionMetricsForTurn(conversationStore, conversation, turnId);
|
|
2518
2542
|
return materializeTurnRecord(parsed, piProjection, turnStartMessageIndex, {
|
|
2519
2543
|
channelName: conversation?.channelName,
|
|
2520
2544
|
cumulativeDurationMs: executionMetrics?.durationMs,
|
|
@@ -2545,6 +2569,7 @@ function buildStoredRecord(args) {
|
|
|
2545
2569
|
committedSeq: args.committedSeq,
|
|
2546
2570
|
...definedProps$1({
|
|
2547
2571
|
actor: args.actor,
|
|
2572
|
+
actorIdentityId: args.actorIdentityId,
|
|
2548
2573
|
credentialSubject: args.credentialSubject,
|
|
2549
2574
|
cumulativeToolCallCount: args.cumulativeToolCallCount,
|
|
2550
2575
|
turnLimitWrappedUp: args.turnLimitWrappedUp,
|
|
@@ -2623,6 +2648,7 @@ async function updateTurnState(args) {
|
|
|
2623
2648
|
lastProgressAtMs: parsed.lastProgressAtMs,
|
|
2624
2649
|
previousVersion: parsed.version,
|
|
2625
2650
|
...definedProps$1({
|
|
2651
|
+
actorIdentityId: args.existing.actorIdentityId,
|
|
2626
2652
|
credentialSubject: args.existing.credentialSubject,
|
|
2627
2653
|
cumulativeToolCallCount: args.existing.cumulativeToolCallCount,
|
|
2628
2654
|
turnLimitWrappedUp: args.existing.turnLimitWrappedUp,
|
|
@@ -2649,8 +2675,9 @@ async function upsertTurnRecord(args) {
|
|
|
2649
2675
|
}
|
|
2650
2676
|
async function upsertTurnRecordLocked(args, fence) {
|
|
2651
2677
|
const existingRecord = await getStoredTurnRecord(args.conversationId, args.turnId);
|
|
2652
|
-
const
|
|
2653
|
-
const
|
|
2678
|
+
const conversationStore = args.conversationStore ?? getConversationStore();
|
|
2679
|
+
const conversation = await conversationStore.get({ conversationId: args.conversationId });
|
|
2680
|
+
const executionMetrics = await executionMetricsForTurn(conversationStore, conversation, args.turnId);
|
|
2654
2681
|
const existingDispatchId = existingRecord?.dispatchId ?? (await listTurnSummaries(args.conversationId)).find((summary) => summary.turnId === args.turnId)?.dispatchId;
|
|
2655
2682
|
if (existingDispatchId && args.dispatchId && existingDispatchId !== args.dispatchId) throw new Error(`Turn ${args.turnId} dispatchId cannot be changed`);
|
|
2656
2683
|
const ttlMs = turnCursorTtlMs(args.state, args.ttlMs);
|
|
@@ -2699,6 +2726,7 @@ async function upsertTurnRecordLocked(args, fence) {
|
|
|
2699
2726
|
historyVersion: commit.historyVersion,
|
|
2700
2727
|
previousVersion: existingRecord?.version,
|
|
2701
2728
|
...definedProps$1({
|
|
2729
|
+
actorIdentityId: existingRecord?.actorIdentityId,
|
|
2702
2730
|
credentialSubject: existingRecord?.credentialSubject ?? args.credentialSubject,
|
|
2703
2731
|
cumulativeToolCallCount: args.cumulativeToolCallCount ?? existingRecord?.cumulativeToolCallCount,
|
|
2704
2732
|
turnLimitWrappedUp: args.turnLimitWrappedUp ?? existingRecord?.turnLimitWrappedUp,
|
|
@@ -2728,7 +2756,7 @@ async function recordTurnSummaryOwned(args, fence) {
|
|
|
2728
2756
|
const stored = await getStoredTurnRecord(args.conversationId, args.turnId);
|
|
2729
2757
|
const conversationStore = args.conversationStore ?? getConversationStore();
|
|
2730
2758
|
const conversation = await conversationStore.get({ conversationId: args.conversationId });
|
|
2731
|
-
const executionMetrics = executionMetricsForTurn(conversation, args.turnId);
|
|
2759
|
+
const executionMetrics = await executionMetricsForTurn(conversationStore, conversation, args.turnId);
|
|
2732
2760
|
const priorSummary = (await listTurnSummaries(args.conversationId)).find((summary) => summary.turnId === args.turnId);
|
|
2733
2761
|
const terminalSummary = priorSummary && (priorSummary.state === "completed" || priorSummary.state === "failed" || priorSummary.state === "abandoned") ? priorSummary : void 0;
|
|
2734
2762
|
const terminalRecord = stored && (stored.state === "completed" || stored.state === "failed" || stored.state === "abandoned") ? stored : void 0;
|
|
@@ -4552,6 +4580,81 @@ function requireEventIdentifier(catalog, input) {
|
|
|
4552
4580
|
const fitting = resourceTypes.filter(fits).map((candidate) => candidate.type);
|
|
4553
4581
|
throw new ToolInputError([`Identifier "${identifier}" does not fit resourceType "${input.resourceType}" in namespace "${input.namespace}". Expected format: "${resourceType.identifier.format}".`, ...fitting.length > 0 ? [`If the identifier is correct, use one of these resourceType values: ${fitting.map((type) => `"${type}"`).join(", ")}.`] : []].join(" "));
|
|
4554
4582
|
}
|
|
4583
|
+
// src/chat/services/turn-session-routing.ts
|
|
4584
|
+
async function loadConversationChain(conversationId, conversationStore) {
|
|
4585
|
+
const chain = [];
|
|
4586
|
+
const seen = /* @__PURE__ */ new Set();
|
|
4587
|
+
let cursor = conversationId;
|
|
4588
|
+
while (cursor && !seen.has(cursor)) {
|
|
4589
|
+
seen.add(cursor);
|
|
4590
|
+
const conversation = await conversationStore.get({ conversationId: cursor });
|
|
4591
|
+
if (!conversation) break;
|
|
4592
|
+
chain.push(conversation);
|
|
4593
|
+
cursor = conversation.parentConversationId;
|
|
4594
|
+
}
|
|
4595
|
+
return chain;
|
|
4596
|
+
}
|
|
4597
|
+
/**
|
|
4598
|
+
* Normalize a stored Slack session source against the conversation destination.
|
|
4599
|
+
*
|
|
4600
|
+
* Does not create channel or thread values from the conversation id.
|
|
4601
|
+
*/
|
|
4602
|
+
function slackSourceForDestination(args) {
|
|
4603
|
+
if (args.source?.kind !== "slack" || args.source.channelId !== args.destination.channelId) return;
|
|
4604
|
+
const threadTs = args.source.threadTs?.trim();
|
|
4605
|
+
return {
|
|
4606
|
+
kind: "slack",
|
|
4607
|
+
visibility: args.source.visibility ?? "public",
|
|
4608
|
+
teamId: args.source.teamId?.trim() || args.destination.teamId,
|
|
4609
|
+
channelId: args.source.channelId,
|
|
4610
|
+
...threadTs ? { threadTs } : void 0
|
|
4611
|
+
};
|
|
4612
|
+
}
|
|
4613
|
+
/**
|
|
4614
|
+
* Resolve the Conversation Location, Destination, and session Source.
|
|
4615
|
+
*
|
|
4616
|
+
* Reads parent Conversations when this Conversation has no Destination.
|
|
4617
|
+
*/
|
|
4618
|
+
async function resolveConversationRouting(args) {
|
|
4619
|
+
const conversationStore = args.conversationStore ?? (await import("./viewer-CpXTGlep.js").then((n) => n.u)).getConversationStore();
|
|
4620
|
+
const chain = await loadConversationChain(args.conversationId, conversationStore);
|
|
4621
|
+
let destination;
|
|
4622
|
+
let source;
|
|
4623
|
+
let location;
|
|
4624
|
+
for (const conversation of chain) {
|
|
4625
|
+
destination ??= conversation.destination;
|
|
4626
|
+
source ??= conversation.sessionSource;
|
|
4627
|
+
location ??= conversation.location;
|
|
4628
|
+
if (destination && source) break;
|
|
4629
|
+
}
|
|
4630
|
+
if (!destination) return;
|
|
4631
|
+
if (destination.platform === "slack") {
|
|
4632
|
+
const slackSource = slackSourceForDestination({
|
|
4633
|
+
destination,
|
|
4634
|
+
source
|
|
4635
|
+
});
|
|
4636
|
+
return {
|
|
4637
|
+
destination,
|
|
4638
|
+
...location ? { location } : void 0,
|
|
4639
|
+
...slackSource ? { source: slackSource } : void 0
|
|
4640
|
+
};
|
|
4641
|
+
}
|
|
4642
|
+
return {
|
|
4643
|
+
destination,
|
|
4644
|
+
...location ? { location } : void 0,
|
|
4645
|
+
...source ? { source } : void 0
|
|
4646
|
+
};
|
|
4647
|
+
}
|
|
4648
|
+
/** Require the Conversation Destination and Source from SQL. */
|
|
4649
|
+
async function resolveTurnSessionRouting(args) {
|
|
4650
|
+
const routing = await resolveConversationRouting(args);
|
|
4651
|
+
if (!routing?.destination || !routing.source) throw new Error(`Conversation ${args.conversationId} is missing durable routing metadata`);
|
|
4652
|
+
return {
|
|
4653
|
+
destination: routing.destination,
|
|
4654
|
+
...routing.location ? { location: routing.location } : void 0,
|
|
4655
|
+
source: routing.source
|
|
4656
|
+
};
|
|
4657
|
+
}
|
|
4555
4658
|
// src/chat/automations/revision.ts
|
|
4556
4659
|
/** Storage revisions prevent stale edits from replacing newer values. */
|
|
4557
4660
|
var AutomationConflictError = class extends ToolInputError {
|
|
@@ -5147,4 +5250,4 @@ async function saveScheduledAutomation(db, task, expectedRevision, editedBy) {
|
|
|
5147
5250
|
async function saveScheduledAutomationInLock(db, task, current) {
|
|
5148
5251
|
await writeScheduledAutomation(db, requireStoredTask(task), current);
|
|
5149
5252
|
}
|
|
5150
|
-
export {
|
|
5253
|
+
export { loadTurnRoute as $, TURN_CONTEXT_TAG as $n, CONVERSATION_WORK_STALE_ENQUEUE_MS as $t, resolveConversationRouting as A, TurnBudgetExceededError as An, upsertConversationMessage as At, registeredEventMatchSchema as B, getUserMessageInstructionText as Bn, clearPendingAuth as Bt, automationVersionOf as C, removeActiveConversation as Cn, estimateConversationContextTokens as Ct, AutomationConflictError as D, steerWebPendingMessages as Dn, normalizeConversationText as Dt, sameDefinitionValue as E, startConversationWork as En, markConversationMessage as Et, eventCatalogEntry as F, isTurnExecutionLimitExceededError as Fn, AuthPausePersistenceError as Ft, requireValidEventTrigger as G, isToolResultError as Gn, saveTurnCheckpoint as Gt, registeredEventTypeSchema as H, instructionTextForProjection as Hn, wasPendingAuthStopped as Ht, eventGuidance as I, persistWithRetry as In, AuthorizationFlowDisabledError as It, loadConnectedMcpProviders as J, retainRuntimeTurnContext as Jn, failTurnRecord as Jt, commitAcceptedReply as K, isToolResultMessage as Kn, abandonTurnRecord as Kt, eventNamespaceSchema as L, extractAssistantText as Ln, AuthorizationPauseError as Lt, CORE_EVENT_NAMESPACE as M, TurnToolCallLimitExceededError as Mn, PluginCredentialFailureError as Mt, automationEventCatalog as N, buildTurnErrorResponse as Nn, createPluginAuthOrchestration as Nt, automationRevision as O, stopConversationWork as On, recordDeliveredAssistantMessage as Ot, describeRegisteredEventTrigger as P, createTurnLimitGate as Pn, authorizationId as Pt, loadTurnProjection as Q, SESSION_CONTEXT_SECTION_TAG as Qn, CONVERSATION_WORK_CHECK_IN_INTERVAL_MS as Qt, eventWatchUnavailable as R, getPiMessageRole as Rn, abandonReplacedPendingAuth as Rt, automationDefinition as S, releaseConversationWork as Sn, createConversationMemoryService as St, readAutomationVersion as T, requestConversationWork as Tn, isHumanConversationMessage as Tt, registeredResourceTypeSchema as U, isAssistantMessage as Un, continuableMessages as Ut, registeredEventTriggerProblems as V, hasRuntimeTurnContext as Vn, getConversationPendingAuth as Vt, requireEventIdentifier as W, isContinuablePiBoundary as Wn, loadTurnCheckpoint as Wt, loadLastModelProfile as X, trimTrailingAssistantMessages as Xn, listTurnSummaries as Xt, loadConversationProjection as Y, stripRuntimeTurnContext as Yn, getTurnRecord as Yt, loadProjection as Z, REQUEST_CONTEXT_SECTION_TAG as Zn, recordTurnSummary as Zt, parseEventAutomationRow as _, isInvalidConversationRecordError as _n, setConfigDefaults as _r, settleConversationTitleWork as _t, saveScheduledAutomation as a, checkInConversationWork as an, getThreadStopDecision as ar, recordAuthorizationRequested as at, admitEventAutomationRun as b, recordAttemptFailure as bn, appendThreadContextMessages as bt, withScheduledAutomationLock as c, completeConversationStop as cn, getAgentContextInputLimitTokens as cr, recordSubscribedReplyRoute as ct, createEventAutomation as d, drainConversationMailbox as dn, setExperimentalFeatures as dr, appendConversationMessages as dt, ackMessages as en, buildDeterministicAssistantMessageId as er, openConversationProjection as et, deleteEventAutomation as f, getConversation as fn, createDurableLocationConfigurationService as fr, hydrateConversationMessages as ft, listEventAutomationsForTeam as g, isFinalAttempt as gn, getConfigDefaults as gr, resolveConversationTitle as gt, listDeletedEventAutomationsCreatedBy as h, hasRunnableConversationWork as hn, piMessageFromHistoryItem as hr, persistConversationMessageSummaries as ht, readScheduledAutomation as i, cancelHumanFacingPendingMessages as in, getSubscribedReplyPreflightDecision as ir, recordAuthorizationCompleted as it, resolveTurnSessionRouting as j, TurnSliceLimitExceededError as jn, createPluginEgress as jt, requireAutomationRevision as k, TURN_LIMIT_DISABLED_REASON as kn, turnHasReply as kt, blockEventAutomation as l, completeConversationWork as ln, getExperimentalFeatures as lr, recordToolExecutionStarted as lt, getEventAutomation as m, hasConversationStop as mn, historyItemFromPiMessage as mr, projectConversationMessages as mt, listScheduledAutomationsForTeam as n, appendInboundMessage as nn, SubscribedReplyReason as nr, recordAttachmentsDelivered as nt, saveScheduledAutomationInLock as o, clearConsumedConversationWake as on, estimateTextTokens as or, recordGuardianActionReviewed as ot, findMatchingEventAutomations as p, getConversationWorkState as pn, configValueSchema as pr, persistConversationMessages as pt, commitMessages as q, normalizeToolNameFromResult as qn, completeTurnRecord as qt, parseScheduledAutomationRow as r, beginConversationResume as rn, decideSubscribedThreadReply as rr, recordAuthenticationLinked as rt, scheduledRunId as s, clearExpiredConversationLease as sn, getAgentContextCompactionTriggerTokens as sr, recordMcpProviderConnected as st, createScheduledAutomation as t, appendExclusiveInboundMessage as tn, buildDeterministicTurnId as tr, recordAgentsInstructionsUpdated as tt, collectEventAutomationMatchKeys as u, deadLetterAttempt as un, isExperimentalFeatureEnabled as ur, recordTurnRoute as ut, saveEventAutomation as v, listActiveConversationIds as vn, fallbackShortTitle as vt, listAutomationVersions as w, requestAnotherSlice as wn, getConversationMessageSlackTs as wt, eventAutomationRunLimitReason as x, recordConversationRetry as xn, buildConversationContext as xt, setEventAutomationStatus as y, markConversationWorkEnqueued as yn, resolveTaskTitle as yt, hasEventCatalogEntries as z, getTerminalAssistantMessages as zn, canReusePendingAuthLink as zt };
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { B as isRecord, H as toOptionalString, V as toOptionalNumber } from "./logging-
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import { i as getStateAdapter } from "./adapter-
|
|
1
|
+
import { fr as createDurableLocationConfigurationService, pt as persistConversationMessages } from "./tasks-SB9z-VTU.js";
|
|
2
|
+
import { B as isRecord, H as toOptionalString, V as toOptionalNumber } from "./logging-DLSpkSSr.js";
|
|
3
|
+
import { m as getDb } from "./viewer-CpXTGlep.js";
|
|
4
|
+
import { pn as JUNIOR_THREAD_STATE_TTL_MS } from "./credentialed-lukuD-cc.js";
|
|
5
|
+
import { i as getStateAdapter } from "./adapter-04AcD2SO.js";
|
|
6
6
|
// src/chat/state/conversation.ts
|
|
7
7
|
function defaultConversationState() {
|
|
8
8
|
return {
|
|
@@ -134,19 +134,9 @@ function getPersistedSandboxState(state) {
|
|
|
134
134
|
...workspaceId ? { workspaceId } : void 0
|
|
135
135
|
};
|
|
136
136
|
}
|
|
137
|
-
/** Persist a thread-state patch for a Chat thread handle. */
|
|
138
|
-
async function persistThreadState(thread, patch) {
|
|
139
|
-
if (patch.conversation) await persistConversationMessages({
|
|
140
|
-
conversation: patch.conversation,
|
|
141
|
-
conversationId: toOptionalString(thread.id) ?? toOptionalString(thread.runId)
|
|
142
|
-
});
|
|
143
|
-
await persistThreadRuntimeState(thread, patch);
|
|
144
|
-
}
|
|
145
137
|
/** Persist only the Redis-backed runtime scratch in a thread-state patch. */
|
|
146
|
-
async function persistThreadRuntimeState(
|
|
147
|
-
|
|
148
|
-
if (!threadId) throw new Error("thread id is required to persist runtime scratch");
|
|
149
|
-
await mergePersistedState(threadStateKey(threadId), buildThreadStatePayload(patch));
|
|
138
|
+
async function persistThreadRuntimeState(conversationId, patch) {
|
|
139
|
+
await mergePersistedState(threadStateKey(conversationId), buildThreadStatePayload(patch));
|
|
150
140
|
}
|
|
151
141
|
/** Load the persisted state payload for a thread without requiring a Chat singleton. */
|
|
152
142
|
async function getPersistedThreadState(threadId) {
|
|
@@ -181,4 +171,4 @@ function getLocationConfigurationService(destination) {
|
|
|
181
171
|
loadLegacy: async () => await getLegacyChannelState(destination.channelId)
|
|
182
172
|
});
|
|
183
173
|
}
|
|
184
|
-
export {
|
|
174
|
+
export { persistThreadStateById as a, persistThreadRuntimeState as i, getPersistedSandboxState as n, coerceThreadConversationState as o, getPersistedThreadState as r, getLocationConfigurationService as t };
|
|
@@ -1,12 +1,13 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { _ as getProviderErrorAttributes, g as findProviderError, m as ProviderError, v as getProviderErrorUserMessage } from "./client-
|
|
3
|
-
import { B as isRecord, t as buildTurnFailureResponse } from "./logging-
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
1
|
+
import { Bt as clearPendingAuth, Et as markConversationMessage, ft as hydrateConversationMessages, tr as buildDeterministicTurnId } from "./tasks-SB9z-VTU.js";
|
|
2
|
+
import { _ as getProviderErrorAttributes, g as findProviderError, m as ProviderError, v as getProviderErrorUserMessage } from "./client-C1yDYjoS.js";
|
|
3
|
+
import { B as isRecord, t as buildTurnFailureResponse } from "./logging-DLSpkSSr.js";
|
|
4
|
+
import { m as parseSlackMessageTs } from "./actor-CP9K2Idu.js";
|
|
5
|
+
import { d as getConversationEventStore, m as getDb } from "./viewer-CpXTGlep.js";
|
|
6
|
+
import { rr as listConversationAnnotations } from "./credentialed-lukuD-cc.js";
|
|
7
7
|
import { B as removedCardSchema, V as resolveMessageCards, z as readMessageCardRefs } from "./conversation-DSo310Ps.js";
|
|
8
|
-
import { D as parseAgentInvocationResultMessageId, J as markTurnClosed, Y as markTurnCompleted, c as getAgentInvocation, m as getAgentInvocationTurnId } from "./store-
|
|
9
|
-
import {
|
|
8
|
+
import { D as parseAgentInvocationResultMessageId, J as markTurnClosed, Y as markTurnCompleted, c as getAgentInvocation, m as getAgentInvocationTurnId } from "./store-C5PN02QO.js";
|
|
9
|
+
import { t as getInterruptionMarker } from "./interruption-marker-CkncDT8d.js";
|
|
10
|
+
import { a as persistThreadStateById, o as coerceThreadConversationState, r as getPersistedThreadState } from "./thread-state-BbbPh0Sn.js";
|
|
10
11
|
// src/chat/conversations/pending-cards.ts
|
|
11
12
|
/**
|
|
12
13
|
* Add the cards that tool results selected since the last visible assistant
|
|
@@ -66,12 +67,6 @@ async function loadPendingMessageCards(conversationId) {
|
|
|
66
67
|
if (selection.cards.size === 0) return [];
|
|
67
68
|
return resolveMessageCards([...selection.cards.values()].reverse(), await listConversationAnnotations(getDb(), conversationId));
|
|
68
69
|
}
|
|
69
|
-
// src/chat/interruption-marker.ts
|
|
70
|
-
const INTERRUPTED_MARKER = "\n\n[Response interrupted before completion]";
|
|
71
|
-
/** Return the marker added when a visible reply ended mid-execution. */
|
|
72
|
-
function getInterruptionMarker() {
|
|
73
|
-
return INTERRUPTED_MARKER;
|
|
74
|
-
}
|
|
75
70
|
// src/chat/runtime/delivered-turn-state.ts
|
|
76
71
|
/** Build state after destination delivery or intentional no-reply completion. */
|
|
77
72
|
function buildDeliveredTurnStatePatch(args) {
|
|
@@ -222,4 +217,4 @@ function finalizeFailedTurnReplyWithEvent(args) {
|
|
|
222
217
|
}
|
|
223
218
|
};
|
|
224
219
|
}
|
|
225
|
-
export { persistAuthPauseTurnState as a, getTurnUserSlackMessageTs as c,
|
|
220
|
+
export { persistAuthPauseTurnState as a, getTurnUserSlackMessageTs as c, completeAuthPauseTurn as i, buildDeliveredTurnStatePatch as l, getAgentTurnDiagnosticsAttributes as n, getTurnUserMessage as o, requireTurnFailureEventId as r, getTurnUserReplyAttachmentContext as s, finalizeFailedTurnReplyWithEvent as t, loadPendingMessageCards as u };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { d as getConversationEventStore } from "./viewer-CpXTGlep.js";
|
|
2
2
|
// src/chat/conversations/turn-lifecycle.ts
|
|
3
3
|
/** Persist correlated turn lifecycle facts with retry-safe terminal exclusion. */
|
|
4
4
|
var ConversationTurnLifecycleService = class {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { t as __exportAll } from "./rolldown-runtime-nwUcYXjP.js";
|
|
2
|
-
import { n as pluginCatalogRuntime } from "./catalog-runtime-
|
|
2
|
+
import { n as pluginCatalogRuntime } from "./catalog-runtime-BD9GSpc6.js";
|
|
3
3
|
import { isDeepStrictEqual } from "node:util";
|
|
4
4
|
// src/chat/plugins/validation.ts
|
|
5
5
|
var validation_exports = /* @__PURE__ */ __exportAll({
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// package.json
|
|
2
|
-
var version = "0.
|
|
2
|
+
var version = "0.268.0";
|
|
3
3
|
// src/version.ts
|
|
4
4
|
/** Installed Junior package version, or `unknown` when package metadata is unavailable. */
|
|
5
5
|
const JUNIOR_VERSION = typeof version === "string" && version.trim() ? version : "unknown";
|
package/dist/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { t as JUNIOR_VERSION } from "./version-
|
|
1
|
+
export { t as JUNIOR_VERSION } from "./version-jHwJp4hC.js";
|