@sentry/junior 0.246.0 → 0.247.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/{admin-Bh-MYw-j.js → admin-BGwaqDMs.js} +1 -1
- package/dist/{agent-hooks-DpklSWZg.js → agent-hooks-C72ByH0C.js} +11 -11
- package/dist/{agent-invocations-BO6ddZax.js → agent-invocations-D_YoNnAn.js} +8 -2
- package/dist/{agent-runner-DSKpHjHW.js → agent-runner-DsAFAKKs.js} +451 -2412
- package/dist/api/schema.js +2 -2
- package/dist/api.js +24 -21
- package/dist/{app-BYB7szGb.d.ts → app-4t4mPTdS.d.ts} +8 -1
- package/dist/app.d.ts +1 -1
- package/dist/app.js +30 -27
- package/dist/assistant-reply-ChOzcTBS.js +45 -0
- package/dist/{briefs-cZ5vWqP_.js → briefs-Dc7qZrhc.js} +4 -4
- package/dist/{catalog-runtime-CTaQXYqS.js → catalog-runtime-DS1k7fUG.js} +1 -1
- package/dist/cli/chat.js +22 -16
- package/dist/cli/check.js +3 -3
- package/dist/cli/main.js +2 -2
- package/dist/cli/plugins.js +4 -4
- package/dist/cli/snapshot-create.js +3 -3
- package/dist/cli/upgrade.js +3 -3
- package/dist/{client--xtsAxKP.js → client-BVnfNd3D.js} +2 -2
- package/dist/{config-BK53Ip5C.js → config-CgWvImQL.js} +2 -2
- package/dist/{conversation-CvBG57Io.js → conversation-CYsbVFLx.js} +71 -1
- package/dist/{conversation-privacy-BDBFw6Ws.js → conversation-privacy-D3TdVM9H.js} +1 -1
- package/dist/{credential-sync-BiuhC9Ds.js → credential-sync-DLw3jkv-.js} +14 -14
- package/dist/{executor-bmmuRY-w.js → executor-DQazjeGA.js} +3 -3
- package/dist/{images-DZliDtSH.js → images-C3e5E-p_.js} +4 -21
- package/dist/instrumentation.js +2 -2
- package/dist/{job-queue-Cz3M7gg4.js → job-queue-BEUqRhjC.js} +1 -1
- package/dist/{logging-DVtMYOdD.js → logging-CZEc8_v4.js} +1 -1
- package/dist/message-BIJa7lKh.js +59 -0
- package/dist/nitro.d.ts +1 -1
- package/dist/nitro.js +3 -3
- package/dist/{oauth-authorization-By_MVRDC.js → oauth-authorization-BA4Dt6a7.js} +1 -45
- package/dist/{oauth-callback-server-BrUo6w1e.js → oauth-callback-server-R9OSdLP1.js} +2 -2
- package/dist/{pending-auth-BuQLZ6dK.js → pending-auth-Oo5AQhaf.js} +2 -2
- package/dist/{profile-BevMNSlr.js → profile-aVLDAirh.js} +4 -4
- package/dist/{prompt-C9Q9cjD3.js → prompt-ZG1UCxjF.js} +1 -1
- package/dist/{registry-C2rSEio1.js → registry-CtaDOOM5.js} +1 -1
- package/dist/{resolve-qPhrznTf.js → resolve-Bdw4hu7s.js} +2 -2
- package/dist/result-DNgmkASh.js +463 -0
- package/dist/{runner-CNh5eMWx.js → runner-BUSScEu5.js} +11 -10
- package/dist/{sandbox-egress-signals-BnDEKu8d.js → sandbox-egress-signals-E9r8bf9G.js} +1 -1
- package/dist/{schema-BWMRg8JS.js → schema-tyd6hALh.js} +2 -2
- package/dist/session-stop-CAhBfBUT.js +782 -0
- package/dist/{skills-C6zJbudq.js → skills-DQy-mmBC.js} +2 -2
- package/dist/{spawn-C3efZSx3.js → spawn-DQ_MVWZ6.js} +3 -2
- package/dist/store-DjLA8GKs.js +1417 -0
- package/dist/{task-queue-BX4vG6uA.js → task-queue-BT2h_t8I.js} +3 -3
- package/dist/{task-runner-T51kll0U.js → task-runner-CiPepjIB.js} +11 -11
- package/dist/{tasks-B9OIjl2K.js → tasks-DMmRrIVl.js} +9 -9
- package/dist/{thread-state-AGZtVyXp.js → thread-state-ehZYGpX9.js} +7 -7
- package/dist/{turn-failure-response-DJ8KU2bo.js → turn-failure-response-D7J10z7l.js} +9 -9
- package/dist/{turn-lifecycle-DZJkJ95q.js → turn-lifecycle-Buswqs90.js} +1 -1
- package/dist/{turn-session-routing-mRqLbMZW.js → turn-session-routing-Bw-yiSb4.js} +1 -1
- package/dist/{validation-Dg0Ihxzo.js → validation-DTguegIe.js} +1 -1
- package/dist/{version-Deub4try.js → version-BrZSE5du.js} +1 -1
- package/dist/version.js +1 -1
- package/dist/{viewer-D5hbx6TE.js → viewer-BlAozHer.js} +4 -4
- package/dist/{web-authorization-DCxixz5S.js → web-authorization-DwyTlkAg.js} +6 -6
- package/dist/{web-input-0sorYVLh.js → web-input-DSYxI7Wi.js} +43 -208
- package/dist/{work-rm2X7jj4.js → work-CRBXkJoU.js} +89 -13
- package/dist/{worker-bnGsAOP3.js → worker-BVJKM9Ja.js} +7 -7
- package/migrations/0053_conversation_stopped_at.sql +1 -0
- package/migrations/0054_flowery_rage.sql +1 -0
- package/migrations/meta/0053_snapshot.json +3771 -0
- package/migrations/meta/0054_snapshot.json +3777 -0
- package/migrations/meta/_journal.json +14 -0
- package/package.json +6 -5
- package/dist/message-BSN-Ma5f.js +0 -317
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { f as escapeXml } from "./client
|
|
3
|
-
import { d as logException, h as runBestEffort, p as logWarn } from "./logging-
|
|
4
|
-
import { a as getRuntimeMetadata, n as botConfig } from "./config-
|
|
1
|
+
import { Ft as createUserTokenStore, Mt as parseOAuthStatePayload, Nt as resolveBaseUrl, _ as resolvePluginOAuthAccount, d as getMcpAuthSession, f as getMcpStoredOAuthCredentials, jt as formatProviderLabel, o as finalizeMcpAuthorization, p as putMcpStoredOAuthCredentials, s as deleteMcpAuthSession, x as lookupSlackUserProfile, yt as getMcpProviderErrorAttributes } from "./agent-runner-DsAFAKKs.js";
|
|
2
|
+
import { f as escapeXml } from "./client-BVnfNd3D.js";
|
|
3
|
+
import { d as logException, h as runBestEffort, p as logWarn } from "./logging-CZEc8_v4.js";
|
|
4
|
+
import { a as getRuntimeMetadata, n as botConfig } from "./config-CgWvImQL.js";
|
|
5
5
|
import { f as parseSlackUserId } from "./actor-BTtLaeWy.js";
|
|
6
|
-
import { A as upsertIdentity, f as getSqlExecutor, j as upsertLinkedIdentity } from "./viewer-
|
|
6
|
+
import { A as upsertIdentity, f as getSqlExecutor, j as upsertLinkedIdentity } from "./viewer-BlAozHer.js";
|
|
7
7
|
import { i as homeDir } from "./package-discovery-BVvSnQBB.js";
|
|
8
|
-
import { n as buildOAuthTokenRequest, r as parseOAuthTokenResponse, u as hasRequiredOAuthScope } from "./registry-
|
|
9
|
-
import { n as pluginCatalogRuntime } from "./catalog-runtime-
|
|
10
|
-
import { t as discoverSkills } from "./skills-
|
|
11
|
-
import { Nt as recordAuthenticationLinked, Pt as recordAuthorizationCompleted, Q as getTurnRecord, V as postSlackMessage } from "./tasks-
|
|
12
|
-
import { zt as getSlackClient } from "./agent-hooks-
|
|
13
|
-
import { E as acquireActiveLock, w as getStateAdapter } from "./profile-
|
|
14
|
-
import { i as getConversationPendingAuth } from "./pending-auth-
|
|
15
|
-
import { r as getPersistedThreadState, s as coerceThreadConversationState } from "./thread-state-
|
|
16
|
-
import { n as deleteWebAuthorization, o as wakeAuthorizedTurn, s as wakePausedTurn } from "./web-authorization-
|
|
8
|
+
import { n as buildOAuthTokenRequest, r as parseOAuthTokenResponse, u as hasRequiredOAuthScope } from "./registry-CtaDOOM5.js";
|
|
9
|
+
import { n as pluginCatalogRuntime } from "./catalog-runtime-DS1k7fUG.js";
|
|
10
|
+
import { t as discoverSkills } from "./skills-DQy-mmBC.js";
|
|
11
|
+
import { Nt as recordAuthenticationLinked, Pt as recordAuthorizationCompleted, Q as getTurnRecord, V as postSlackMessage } from "./tasks-DMmRrIVl.js";
|
|
12
|
+
import { zt as getSlackClient } from "./agent-hooks-C72ByH0C.js";
|
|
13
|
+
import { E as acquireActiveLock, w as getStateAdapter } from "./profile-aVLDAirh.js";
|
|
14
|
+
import { i as getConversationPendingAuth } from "./pending-auth-Oo5AQhaf.js";
|
|
15
|
+
import { r as getPersistedThreadState, s as coerceThreadConversationState } from "./thread-state-ehZYGpX9.js";
|
|
16
|
+
import { n as deleteWebAuthorization, o as wakeAuthorizedTurn, s as wakePausedTurn } from "./web-authorization-DwyTlkAg.js";
|
|
17
17
|
import { n as relayLocalOAuthCallback } from "./oauth-relay-CdCnu80W.js";
|
|
18
18
|
import path from "node:path";
|
|
19
19
|
import { z } from "zod";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { d as logException } from "./logging-
|
|
1
|
+
import { d as logException } from "./logging-CZEc8_v4.js";
|
|
2
2
|
import { g as startSpanManual } from "./sentry-CgWZM_kV.js";
|
|
3
|
-
import "./config-
|
|
4
|
-
import { a as juniorAgentInvocations, c as juniorIdentities, d as juniorDestinations, f as timestamptz, i as juniorAgentBindings, l as juniorUsers, s as juniorConversations } from "./agent-invocations-
|
|
3
|
+
import "./config-CgWvImQL.js";
|
|
4
|
+
import { a as juniorAgentInvocations, c as juniorIdentities, d as juniorDestinations, f as timestamptz, i as juniorAgentBindings, l as juniorUsers, s as juniorConversations } from "./agent-invocations-D_YoNnAn.js";
|
|
5
5
|
import { AsyncLocalStorage } from "node:async_hooks";
|
|
6
6
|
import { sql } from "drizzle-orm";
|
|
7
7
|
import { bigint, boolean, check, date, doublePrecision, foreignKey, index, integer, jsonb, pgTable, primaryKey, text, uniqueIndex, uuid } from "drizzle-orm/pg-core";
|
|
@@ -1,35 +1,18 @@
|
|
|
1
1
|
import { t as __exportAll } from "./rolldown-runtime-B4FMCO8f.js";
|
|
2
|
-
import { D as storeAttachment, T as readLiveAttachment } from "./agent-runner-
|
|
3
|
-
import { f as getSqlExecutor } from "./viewer-
|
|
4
|
-
import "./conversation-
|
|
2
|
+
import { D as storeAttachment, T as readLiveAttachment } from "./agent-runner-DsAFAKKs.js";
|
|
3
|
+
import { f as getSqlExecutor } from "./viewer-BlAozHer.js";
|
|
4
|
+
import { I as detectImageMediaType } from "./conversation-CYsbVFLx.js";
|
|
5
5
|
//#region src/chat/attachments/images.ts
|
|
6
6
|
var images_exports = /* @__PURE__ */ __exportAll({
|
|
7
7
|
decodeInputImages: () => decodeInputImages,
|
|
8
8
|
loadInputImages: () => loadInputImages,
|
|
9
9
|
storeInputImages: () => storeInputImages
|
|
10
10
|
});
|
|
11
|
-
function matchesImageType(data, contentType) {
|
|
12
|
-
switch (contentType) {
|
|
13
|
-
case "image/png": return data.subarray(0, 8).equals(Buffer.from([
|
|
14
|
-
137,
|
|
15
|
-
80,
|
|
16
|
-
78,
|
|
17
|
-
71,
|
|
18
|
-
13,
|
|
19
|
-
10,
|
|
20
|
-
26,
|
|
21
|
-
10
|
|
22
|
-
]));
|
|
23
|
-
case "image/jpeg": return data[0] === 255 && data[1] === 216 && data[2] === 255;
|
|
24
|
-
case "image/gif": return ["GIF87a", "GIF89a"].includes(data.toString("ascii", 0, 6));
|
|
25
|
-
case "image/webp": return data.toString("ascii", 0, 4) === "RIFF" && data.toString("ascii", 8, 12) === "WEBP";
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
11
|
/** Check declared image types against file signatures before storing uploads. */
|
|
29
12
|
function decodeInputImages(images) {
|
|
30
13
|
const files = images.map((image) => {
|
|
31
14
|
const data = Buffer.from(image.data, "base64");
|
|
32
|
-
if (
|
|
15
|
+
if (detectImageMediaType(data) !== image.contentType || data.toString("base64") !== image.data) throw new Error("Use PNG, JPEG, GIF, or WebP image files.");
|
|
33
16
|
return {
|
|
34
17
|
data,
|
|
35
18
|
bytes: data.byteLength,
|
package/dist/instrumentation.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { N as getDeploymentServiceVersion, P as getDeploymentTelemetryAttributes } from "./logging-
|
|
1
|
+
import { N as getDeploymentServiceVersion, P as getDeploymentTelemetryAttributes } from "./logging-CZEc8_v4.js";
|
|
2
2
|
import { _ as vercelAIIntegration, a as getClient, b as withStreamedSpan, c as init, o as getGlobalScope } from "./sentry-CgWZM_kV.js";
|
|
3
|
-
import { n as getCurrentConversationPrivacy } from "./conversation-privacy-
|
|
3
|
+
import { n as getCurrentConversationPrivacy } from "./conversation-privacy-D3TdVM9H.js";
|
|
4
4
|
import { t as consumePrivateTraceResultMarker } from "./private-trace-result-BLvBjy_e.js";
|
|
5
5
|
//#region src/chat/sentry-payload-filter.ts
|
|
6
6
|
const PAYLOAD_ATTRIBUTE_KEYS = /* @__PURE__ */ new Set([
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { i as getChatConfig } from "./config-
|
|
1
|
+
import { i as getChatConfig } from "./config-CgWvImQL.js";
|
|
2
2
|
import { AsyncLocalStorage } from "node:async_hooks";
|
|
3
3
|
import { z } from "zod";
|
|
4
4
|
import { createHash, createHmac, timingSafeEqual } from "node:crypto";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { d as setTag, f as setUser, h as startSpan, i as getActiveSpan, l as logger, n as captureMessage, p as spanToJSON, s as getTraceData, t as captureException, y as withScope } from "./sentry-CgWZM_kV.js";
|
|
2
|
-
import { t as JUNIOR_VERSION } from "./version-
|
|
2
|
+
import { t as JUNIOR_VERSION } from "./version-BrZSE5du.js";
|
|
3
3
|
import path from "node:path";
|
|
4
4
|
import { styleText } from "node:util";
|
|
5
5
|
import { ConfigError, configureSync, getConfig, getLogger } from "@logtape/logtape";
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { t as __exportAll } from "./rolldown-runtime-B4FMCO8f.js";
|
|
2
|
+
import { Bt as toolInvocationDestination, Q as getActiveAgentInvocationForConversation, Y as createAgentInvocationForMessage, Z as findChildAgentConversationId, _t as AgentMessageTargetError, vt as PARENT_AGENT_TARGET, zt as actorFromRun } from "./agent-runner-DsAFAKKs.js";
|
|
3
|
+
import { n as enqueueAgentMessageToParent } from "./result-DNgmkASh.js";
|
|
4
|
+
import { r as enqueueAgentInvocation } from "./work-CRBXkJoU.js";
|
|
5
|
+
//#region src/chat/agent-invocations/message.ts
|
|
6
|
+
var message_exports = /* @__PURE__ */ __exportAll({ bindMessageAgent: () => bindMessageAgent });
|
|
7
|
+
/**
|
|
8
|
+
* Bind a Run's Actor and credentials to messages for its parent and child
|
|
9
|
+
* agents. A message to a child continues that child. A message to the parent
|
|
10
|
+
* wakes the parent like a result.
|
|
11
|
+
*/
|
|
12
|
+
function bindMessageAgent(run, options) {
|
|
13
|
+
const actor = actorFromRun(run);
|
|
14
|
+
if (!actor) return;
|
|
15
|
+
return async (input, call) => {
|
|
16
|
+
call.signal?.throwIfAborted();
|
|
17
|
+
const queue = typeof options.queue === "function" ? options.queue() : options.queue;
|
|
18
|
+
if (input.to === "parent") {
|
|
19
|
+
const sender = await getActiveAgentInvocationForConversation(run.conversationId);
|
|
20
|
+
if (!sender) throw new AgentMessageTargetError("This conversation has no parent agent");
|
|
21
|
+
await enqueueAgentMessageToParent({
|
|
22
|
+
messageKey: `${run.turnId}:${call.toolCallId}`,
|
|
23
|
+
queue,
|
|
24
|
+
sender,
|
|
25
|
+
state: options.state,
|
|
26
|
+
text: input.text
|
|
27
|
+
});
|
|
28
|
+
return {
|
|
29
|
+
conversationId: sender.parentConversationId,
|
|
30
|
+
delivery: "queued"
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
const childConversationId = await findChildAgentConversationId({
|
|
34
|
+
parentConversationId: run.conversationId,
|
|
35
|
+
target: input.to
|
|
36
|
+
});
|
|
37
|
+
if (!childConversationId) throw new AgentMessageTargetError(`"${input.to}" is not "${PARENT_AGENT_TARGET}" or a child agent of this conversation`);
|
|
38
|
+
const { invocation, queued } = await createAgentInvocationForMessage({
|
|
39
|
+
actor,
|
|
40
|
+
childConversationId,
|
|
41
|
+
...run.credentialContext ? { credentialContext: run.credentialContext } : void 0,
|
|
42
|
+
destination: toolInvocationDestination(run),
|
|
43
|
+
idempotencyKey: `${run.turnId}:${call.toolCallId}`,
|
|
44
|
+
input: input.text,
|
|
45
|
+
parentConversationId: run.conversationId,
|
|
46
|
+
parentToolCallId: call.toolCallId
|
|
47
|
+
});
|
|
48
|
+
await enqueueAgentInvocation(invocation, {
|
|
49
|
+
...options,
|
|
50
|
+
queue
|
|
51
|
+
});
|
|
52
|
+
return {
|
|
53
|
+
conversationId: childConversationId,
|
|
54
|
+
delivery: queued ? "queued" : "started"
|
|
55
|
+
};
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
//#endregion
|
|
59
|
+
export { message_exports as n, bindMessageAgent as t };
|
package/dist/nitro.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { r as JuniorDashboardOptions } from "./app-
|
|
1
|
+
import { r as JuniorDashboardOptions } from "./app-4t4mPTdS.js";
|
|
2
2
|
import { n as JuniorPluginSet } from "./plugins-CjfUP5gJ.js";
|
|
3
3
|
//#region src/nitro.d.ts
|
|
4
4
|
export type JuniorNitroDashboardOptions = JuniorDashboardOptions;
|
package/dist/nitro.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { A as JUNIOR_RETENTION_ROUTE, D as JUNIOR_HEARTBEAT_ROUTE, E as JUNIOR_HEARTBEAT_CRON_SCHEDULE, O as JUNIOR_PLUGIN_TASK_CALLBACK_ROUTE, T as JUNIOR_CONVERSATION_WORK_CALLBACK_ROUTE, j as JUNIOR_WORKSPACE_SNAPSHOT_JOB_CALLBACK_ROUTE, k as JUNIOR_RETENTION_CRON_SCHEDULE } from "./logging-
|
|
1
|
+
import { A as JUNIOR_RETENTION_ROUTE, D as JUNIOR_HEARTBEAT_ROUTE, E as JUNIOR_HEARTBEAT_CRON_SCHEDULE, O as JUNIOR_PLUGIN_TASK_CALLBACK_ROUTE, T as JUNIOR_CONVERSATION_WORK_CALLBACK_ROUTE, j as JUNIOR_WORKSPACE_SNAPSHOT_JOB_CALLBACK_ROUTE, k as JUNIOR_RETENTION_CRON_SCHEDULE } from "./logging-CZEc8_v4.js";
|
|
2
2
|
import { d as resolvePackageDir, t as discoverInstalledPluginPackageContent, u as isValidPackageName } from "./package-discovery-BVvSnQBB.js";
|
|
3
|
-
import { o as resolveConversationWorkQueueTopic, t as WORKSPACE_SNAPSHOT_JOB_QUEUE_TOPIC } from "./job-queue-
|
|
3
|
+
import { o as resolveConversationWorkQueueTopic, t as WORKSPACE_SNAPSHOT_JOB_QUEUE_TOPIC } from "./job-queue-BEUqRhjC.js";
|
|
4
4
|
import { a as pluginRuntimeRegistrationsFromPluginSet, r as pluginCatalogConfigFromPluginSet } from "./plugins-egKWjgue.js";
|
|
5
|
-
import { t as PLUGIN_TASK_QUEUE_TOPIC } from "./task-queue-
|
|
5
|
+
import { t as PLUGIN_TASK_QUEUE_TOPIC } from "./task-queue-BT2h_t8I.js";
|
|
6
6
|
import { n as loadPluginSetFromModule, r as resolvePluginModule } from "./plugin-module-CVvEUSMH.js";
|
|
7
7
|
import path from "node:path";
|
|
8
8
|
import { cpSync, existsSync, mkdirSync, readdirSync, statSync } from "node:fs";
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { ot as extractAssistantText } from "./tasks-B9OIjl2K.js";
|
|
2
1
|
//#region src/chat/runtime/turn.ts
|
|
3
2
|
/** Classified Slack turn failure carrying the owning Sentry capture outward. */
|
|
4
3
|
var ConversationTurnBoundaryError = class extends Error {
|
|
@@ -91,53 +90,10 @@ function markTurnFailed(args) {
|
|
|
91
90
|
});
|
|
92
91
|
}
|
|
93
92
|
//#endregion
|
|
94
|
-
//#region src/chat/no-reply.ts
|
|
95
|
-
const NO_REPLY_MARKER = "[[NO_REPLY]]";
|
|
96
|
-
/**
|
|
97
|
-
* True when one assistant message ends with the silence marker.
|
|
98
|
-
* Mid-sentence mentions do not match. Detection is per message only.
|
|
99
|
-
*/
|
|
100
|
-
function isNoReplyMarker(text) {
|
|
101
|
-
return text.trimEnd().endsWith(NO_REPLY_MARKER);
|
|
102
|
-
}
|
|
103
|
-
//#endregion
|
|
104
|
-
//#region src/chat/services/assistant-reply.ts
|
|
105
|
-
const THINKING_XML_BLOCK_PATTERN = /[ \t]*<thinking\b[^>]*>[\s\S]*?<\/thinking>[ \t]*(?:\r?\n)?/gi;
|
|
106
|
-
const FENCED_CODE_BLOCK_PATTERN = /```[\s\S]*?```/g;
|
|
107
|
-
/** Remove provider reasoning wrappers while preserving fenced code examples. */
|
|
108
|
-
function sanitizeAssistantText(text) {
|
|
109
|
-
let result = "";
|
|
110
|
-
let cursor = 0;
|
|
111
|
-
for (const match of text.matchAll(FENCED_CODE_BLOCK_PATTERN)) {
|
|
112
|
-
const start = match.index;
|
|
113
|
-
if (start === void 0) continue;
|
|
114
|
-
result += text.slice(cursor, start).replace(THINKING_XML_BLOCK_PATTERN, "");
|
|
115
|
-
result += match[0];
|
|
116
|
-
cursor = start + match[0].length;
|
|
117
|
-
}
|
|
118
|
-
return (result + text.slice(cursor).replace(THINKING_XML_BLOCK_PATTERN, "")).trim();
|
|
119
|
-
}
|
|
120
|
-
/** Decide whether one completed assistant message becomes a reply. */
|
|
121
|
-
function decideReply(message) {
|
|
122
|
-
if (message.content.some((part) => part.type === "toolCall")) return { kind: "suppress" };
|
|
123
|
-
const text = sanitizeAssistantText(extractAssistantText(message));
|
|
124
|
-
if (!text) return { kind: "empty" };
|
|
125
|
-
if (isNoReplyMarker(text)) return { kind: "suppress" };
|
|
126
|
-
return {
|
|
127
|
-
kind: "deliver",
|
|
128
|
-
text
|
|
129
|
-
};
|
|
130
|
-
}
|
|
131
|
-
/** Return destination-visible reply text when the message is deliverable. */
|
|
132
|
-
function getAssistantReplyText(message) {
|
|
133
|
-
const decision = decideReply(message);
|
|
134
|
-
return decision.kind === "deliver" ? decision.text : void 0;
|
|
135
|
-
}
|
|
136
|
-
//#endregion
|
|
137
93
|
//#region src/chat/oauth-authorization.ts
|
|
138
94
|
/** Build the stable event identity shared by authorization request and completion. */
|
|
139
95
|
function authorizationId(args) {
|
|
140
96
|
return `${args.sessionId}:${args.kind}:${args.provider}`;
|
|
141
97
|
}
|
|
142
98
|
//#endregion
|
|
143
|
-
export {
|
|
99
|
+
export { TurnInputDeferredError as a, isTurnInputCommitLostError as c, markTurnCompleted as d, markTurnFailed as f, TurnInputCommitLostError as i, isTurnInputDeferredError as l, ConversationTurnBoundaryError as n, getConversationTurnBoundaryError as o, startActiveTurn as p, CooperativeTurnYieldError as r, isCooperativeTurnYieldError as s, authorizationId as t, markTurnClosed as u };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { a as GET, n as syncLocalOAuthCredential, r as GET$1 } from "./credential-sync-
|
|
1
|
+
import { Ft as createUserTokenStore } from "./agent-runner-DsAFAKKs.js";
|
|
2
|
+
import { a as GET, n as syncLocalOAuthCredential, r as GET$1 } from "./credential-sync-DLw3jkv-.js";
|
|
3
3
|
import { createServer } from "node:http";
|
|
4
4
|
//#region src/chat/local/oauth-callback-server.ts
|
|
5
5
|
const LOCAL_OAUTH_TIMEOUT_MS = 6e5;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { v as isProviderRetryError } from "./client
|
|
2
|
-
import { Y as abandonTurnRecord, sn as estimateTextTokens } from "./tasks-
|
|
1
|
+
import { v as isProviderRetryError } from "./client-BVnfNd3D.js";
|
|
2
|
+
import { Y as abandonTurnRecord, sn as estimateTextTokens } from "./tasks-DMmRrIVl.js";
|
|
3
3
|
import { r as isExperimentalFeatureEnabled } from "./experimental-Qn9rKLgx.js";
|
|
4
4
|
import { z } from "zod";
|
|
5
5
|
//#region src/chat/state/turn-id.ts
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { S as toOptionalTrimmed } from "./client
|
|
2
|
-
import { v as setSpanAttributes, y as setSpanStatus } from "./logging-
|
|
3
|
-
import { i as getChatConfig } from "./config-
|
|
4
|
-
import { n as pluginCatalogRuntime } from "./catalog-runtime-
|
|
1
|
+
import { S as toOptionalTrimmed } from "./client-BVnfNd3D.js";
|
|
2
|
+
import { v as setSpanAttributes, y as setSpanStatus } from "./logging-CZEc8_v4.js";
|
|
3
|
+
import { i as getChatConfig } from "./config-CgWvImQL.js";
|
|
4
|
+
import { n as pluginCatalogRuntime } from "./catalog-runtime-DS1k7fUG.js";
|
|
5
5
|
import { createHash } from "node:crypto";
|
|
6
6
|
import { createMemoryState } from "@chat-adapter/state-memory";
|
|
7
7
|
import { createRedisState } from "@chat-adapter/state-redis";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { B as
|
|
1
|
+
import { B as briefOutcomeStatusSchema, H as parseBriefInput, V as conversationBriefSchema } from "./conversation-CYsbVFLx.js";
|
|
2
2
|
import { z } from "zod";
|
|
3
3
|
//#region src/chat/briefs/generate.ts
|
|
4
4
|
const MAX_INPUT_CHARS = 6e4;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { f as logInfo, p as logWarn, v as setSpanAttributes } from "./logging-
|
|
1
|
+
import { f as logInfo, p as logWarn, v as setSpanAttributes } from "./logging-CZEc8_v4.js";
|
|
2
2
|
import { o as parseActorUserId } from "./actor-BTtLaeWy.js";
|
|
3
3
|
import { n as normalizePluginPackageNames, o as pluginRoots, t as discoverInstalledPluginPackageContent } from "./package-discovery-BVvSnQBB.js";
|
|
4
4
|
import path from "node:path";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { v as setSpanAttributes, w as withSpan } from "./logging-
|
|
2
|
-
import { N as SANDBOX_WORKSPACE_ROOT, k as sleep, r as isStale, t as create, u as isSandboxUnavailableError, v as getVercelSandboxCredentials, w as getStateAdapter, x as runNonInteractiveCommand } from "./profile-
|
|
1
|
+
import { v as setSpanAttributes, w as withSpan } from "./logging-CZEc8_v4.js";
|
|
2
|
+
import { N as SANDBOX_WORKSPACE_ROOT, k as sleep, r as isStale, t as create, u as isSandboxUnavailableError, v as getVercelSandboxCredentials, w as getStateAdapter, x as runNonInteractiveCommand } from "./profile-aVLDAirh.js";
|
|
3
3
|
import { z } from "zod";
|
|
4
4
|
import { FileSystem, Sandbox } from "@vercel/sandbox";
|
|
5
5
|
//#region src/chat/sandbox/resources.ts
|