@sentry/junior 0.302.0 → 0.303.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/{adapter-context-Cx9fn9B3.js → adapter-context-BdVnSuY5.js} +2 -2
- package/dist/{admin-_poE5NKL.js → admin-AfeAdS3J.js} +2 -2
- package/dist/{agent-runner-CY9RvsTX.js → agent-runner-BP8_DLUv.js} +2987 -2948
- package/dist/api/schema.d.ts +2 -2
- package/dist/api/schema.js +6 -6
- package/dist/api.d.ts +13 -12
- package/dist/api.js +207 -80
- package/dist/{app-BpY3wtRP.d.ts → app-Dd9v1mNx.d.ts} +15 -15
- package/dist/app.d.ts +1 -1
- package/dist/app.js +63 -64
- package/dist/{automation-Cva5ZOwW.js → automation-D9MvhOWY.js} +3 -1
- package/dist/{background-compaction-queue-CXFq1_Cz.js → background-compaction-queue-xaE05jxH.js} +6 -6
- package/dist/{briefs-B3NG-pid.js → briefs-D8i-dKTp.js} +4 -4
- package/dist/{catalog-runtime-Dss0lSV6.js → catalog-runtime-d1EM6Z0V.js} +2 -2
- package/dist/cli/chat.d.ts +1 -1
- package/dist/cli/chat.js +21 -21
- package/dist/cli/check.js +8 -8
- package/dist/cli/env.d.ts +1 -0
- package/dist/cli/env.js +8 -7
- package/dist/cli/init.js +13 -4
- package/dist/cli/main.js +4 -4
- package/dist/cli/plugins.js +6 -6
- package/dist/cli/snapshot-create.js +7 -5
- package/dist/cli/upgrade.d.ts +2 -2
- package/dist/cli/upgrade.js +5 -5
- package/dist/{config-CzeZiMKs.js → config-oGM7KA9M.js} +44 -63
- package/dist/{connections-CDYhMfrs.js → connections-BlikzEJv.js} +6 -6
- package/dist/{continue-in-slack-7Uf05ndC.js → continue-in-slack-BZnYifiG.js} +5 -5
- package/dist/{conversation-BNXfq6Lb.js → conversation-CY1jnBiC.js} +1 -1
- package/dist/{conversation-feed-Clf_cv0n.js → conversation-feed-BZJRk6UV.js} +1 -1
- package/dist/{conversation-privacy-D9xnM5mK.js → conversation-privacy-Cx515ddM.js} +7 -7
- package/dist/{conversation-turn-D7SEZgTG.js → conversation-turn-DAhRdX4m.js} +20 -23
- package/dist/{credential-sync-DoD0gW-j.js → credential-sync-DfhmWFeo.js} +18 -18
- package/dist/{db-B-gtnNjr.js → db-C-2tFxk3.js} +15 -15
- package/dist/{db-BdsCzytP.d.ts → db-DPqcEM9_.d.ts} +25 -25
- package/dist/{executor-DZg20EqU.js → executor-NVfS8aQ2.js} +14 -8
- package/dist/{history-IjdmO_r6.js → history-UZ3M2M9r.js} +13 -10
- package/dist/{install-t1KQyTUs.js → install-CHLrpRZc.js} +3 -3
- package/dist/instrumentation.d.ts +4 -4
- package/dist/instrumentation.js +10 -10
- package/dist/{lineage-C79GjoQr.js → lineage-HGLhd_-N.js} +2 -2
- package/dist/{logging-C9oDAg4M.js → logging-DiyqRLBx.js} +19 -19
- package/dist/{message-BLUCzJXN.js → message-CkCOcbFH.js} +9 -9
- package/dist/{model-input-5jwNC45G.js → model-input-DmoPPtPE.js} +4 -9
- package/dist/nitro.d.ts +1 -1
- package/dist/nitro.js +7 -7
- package/dist/{oauth-callback-server-BBl66vCb.js → oauth-callback-server-CIf_6YmA.js} +5 -4
- package/dist/{oauth-relay-DRzq73b6.js → oauth-relay-DAmfVmJu.js} +3 -6
- package/dist/{package-discovery-DJhGdS4c.js → package-discovery-x4AvVhMj.js} +1 -1
- package/dist/{plugin-module-Cf5gVPWP.js → plugin-module-Cv2ETe8Y.js} +1 -1
- package/dist/{plugins-BBX07Jzt.js → plugins-Bkk0XRo2.js} +3 -3
- package/dist/{projection-CIBwgD3s.js → projection-DBq8tsA5.js} +221 -173
- package/dist/{prompt-CRQbzp5e.js → prompt-D2KlJopL.js} +4 -4
- package/dist/{queue-CZyYgPF0.d.ts → queue-CbEHUO0l.d.ts} +1 -1
- package/dist/{queue-DtCDaIct.js → queue-DFaOscp5.js} +4 -4
- package/dist/{registry-DdFQHZ_d.js → registry-Bu0Z9BEO.js} +37 -37
- package/dist/{resolve-CdW4BdrK.js → resolve-DXuA3G0g.js} +3 -3
- package/dist/{result-oOMv1t4O.js → result-DpiNseDA.js} +10 -15
- package/dist/rolldown-runtime-BKpuH2hG.js +26 -0
- package/dist/{runner-DqitLtm-.js → runner-iu1heRFv.js} +10 -10
- package/dist/{sandbox-egress-signals-Bw9I0yfJ.js → sandbox-egress-signals-2HFYDcQf.js} +1 -1
- package/dist/{schema-BIFM-U1a.d.ts → schema-DHMOaRzC.d.ts} +520 -13
- package/dist/{schema-DnVQepWP.js → schema-DvfX3Gq_.js} +77 -13
- package/dist/{secrets-DebYU866.js → secrets-DHaJ5TTn.js} +4 -4
- package/dist/{sentry-BRTJqumy.js → sentry-CPbZjomA.js} +3 -28
- package/dist/{sentry-route-name-BhwWnfqj.js → sentry-route-name-C6EIzAGP.js} +1 -1
- package/dist/{service-account-CrZftRTb.js → service-account-BcT5LR7V.js} +47 -47
- package/dist/{service-account-B6mKAPVo.js → service-account-xYkaQTrw.js} +3 -3
- package/dist/{session-stop-DW63Z3kj.js → session-stop-BLLp1IP_.js} +28 -35
- package/dist/{skills-C16fz60Z.js → skills-CNAGH4ju.js} +6 -9
- package/dist/{slack-conversation-unfurl-BHhefEb7.js → slack-conversation-unfurl-DYnqe5ci.js} +10 -15
- package/dist/{spawn-D_RnFYfy.js → spawn-cGasWW33.js} +7 -7
- package/dist/{legacy-web-actor-id-C-cEeWqL.js → state-CDS6h_Wv.js} +32 -32
- package/dist/{stop-7p1i08CY.js → stop-DMMA67yT.js} +221 -139
- package/dist/{store-C28I0CVW.js → store-Dgs7Oe44.js} +5 -5
- package/dist/{task-queue-BVUJbQ28.js → task-queue-DcF0nhhz.js} +3 -3
- package/dist/{task-runner-CWi8j7Z6.js → task-runner-BGXF7Fo7.js} +15 -18
- package/dist/{thread-context-D3-yYUd0.js → thread-context-BPky1KBe.js} +12 -12
- package/dist/{turn-session-routing-BFMS9ATF.js → turn-session-routing-DGvn9MSl.js} +32 -32
- package/dist/{turn-user-message-C3-O8Omt.js → turn-user-message-19CkuUvM.js} +3 -3
- package/dist/{validation-BSFKUIb4.js → validation-lu1DgjNQ.js} +2 -2
- package/dist/vercel.js +1 -1
- package/dist/{version-BHHXNi-0.js → version-Uo3c94Dx.js} +1 -1
- package/dist/version.js +1 -1
- package/dist/{viewer-B1SO21Qa.js → viewer-BPQHMx3-.js} +3 -3
- package/dist/{warmup-Bz9bzkzN.js → warmup-H8uLvW9e.js} +149 -130
- package/dist/{worker-BspReIIK.js → worker-B-pM_-3K.js} +9 -12
- package/migrations/0109_user_preferences.sql +1 -0
- package/migrations/0110_code_change_repository_state_index.sql +1 -0
- package/migrations/meta/0109_snapshot.json +4925 -0
- package/migrations/meta/0110_snapshot.json +4952 -0
- package/migrations/meta/_journal.json +15 -1
- package/package.json +16 -19
package/dist/cli/env.d.ts
CHANGED
|
@@ -3,6 +3,7 @@ export declare const JUNIOR_LOCAL_DEV_HEARTBEAT_SECRET = "junior-local-dev-heart
|
|
|
3
3
|
/** Apply global development defaults after env files have been loaded. */
|
|
4
4
|
export declare function applyJuniorDevelopmentDefaults(env: NodeJS.ProcessEnv, options?: {
|
|
5
5
|
baseUrl?: string;
|
|
6
|
+
vercelDeployment?: boolean;
|
|
6
7
|
}): void;
|
|
7
8
|
/**
|
|
8
9
|
* Load CLI env files from the nearest package root and workspace root so
|
package/dist/cli/env.js
CHANGED
|
@@ -17,12 +17,12 @@ function hasValue(value) {
|
|
|
17
17
|
}
|
|
18
18
|
/** Apply global development defaults after env files have been loaded. */
|
|
19
19
|
function applyJuniorDevelopmentDefaults(env, options = {}) {
|
|
20
|
-
if ((env
|
|
21
|
-
if (!hasValue(env
|
|
22
|
-
if (!hasValue(env
|
|
23
|
-
if (!hasValue(env
|
|
20
|
+
if ((env["NODE_ENV"] ?? "development") !== "development") return;
|
|
21
|
+
if (!hasValue(env["JUNIOR_SECRET"])) env["JUNIOR_SECRET"] = JUNIOR_LOCAL_DEV_INTERNAL_SECRET;
|
|
22
|
+
if (!hasValue(env["JUNIOR_STATE_ADAPTER"]) && !options.vercelDeployment) env["JUNIOR_STATE_ADAPTER"] = "memory";
|
|
23
|
+
if (!hasValue(env["JUNIOR_SCHEDULER_SECRET"]) && !hasValue(env["CRON_SECRET"])) env["JUNIOR_SCHEDULER_SECRET"] = JUNIOR_LOCAL_DEV_HEARTBEAT_SECRET;
|
|
24
24
|
const baseUrl = options.baseUrl;
|
|
25
|
-
if (!hasValue(env
|
|
25
|
+
if (!hasValue(env["JUNIOR_BASE_URL"]) && hasValue(baseUrl)) env["JUNIOR_BASE_URL"] = baseUrl.trim();
|
|
26
26
|
}
|
|
27
27
|
function hasEnvRootMarker(dir) {
|
|
28
28
|
return fs.existsSync(path.join(dir, "package.json")) || fs.existsSync(path.join(dir, "pnpm-workspace.yaml"));
|
|
@@ -51,12 +51,13 @@ function resolveCliEnvRoots(cwd) {
|
|
|
51
51
|
* `pnpm exec junior ...` sees the same credentials as local repo scripts.
|
|
52
52
|
*/
|
|
53
53
|
function loadCliEnvFiles(cwd = process.cwd()) {
|
|
54
|
-
const nodeEnv = process.env
|
|
54
|
+
const nodeEnv = process.env["NODE_ENV"] ?? "development";
|
|
55
|
+
const vercelDeployment = (process.env["VERCEL_ENV"] === "production" || process.env["VERCEL_ENV"] === "preview") && hasValue(process.env["REDIS_URL"]);
|
|
55
56
|
for (const root of resolveCliEnvRoots(cwd)) for (const envFile of envFileNames(nodeEnv)) {
|
|
56
57
|
const absolutePath = path.join(root, envFile);
|
|
57
58
|
if (!fs.existsSync(absolutePath)) continue;
|
|
58
59
|
process.loadEnvFile(absolutePath);
|
|
59
60
|
}
|
|
60
|
-
applyJuniorDevelopmentDefaults(process.env);
|
|
61
|
+
applyJuniorDevelopmentDefaults(process.env, { vercelDeployment });
|
|
61
62
|
}
|
|
62
63
|
export { JUNIOR_LOCAL_DEV_HEARTBEAT_SECRET, JUNIOR_LOCAL_DEV_INTERNAL_SECRET, applyJuniorDevelopmentDefaults, loadCliEnvFiles };
|
package/dist/cli/init.js
CHANGED
|
@@ -60,13 +60,21 @@ export default withSentryConfig(config, {
|
|
|
60
60
|
function writeTsConfig(targetDir) {
|
|
61
61
|
fs.writeFileSync(path.join(targetDir, "tsconfig.json"), `${JSON.stringify({
|
|
62
62
|
extends: "nitro/tsconfig",
|
|
63
|
-
compilerOptions: {}
|
|
63
|
+
compilerOptions: { noUncheckedIndexedAccess: true }
|
|
64
64
|
}, null, 2)}\n`);
|
|
65
65
|
}
|
|
66
66
|
function writePnpmWorkspace(targetDir) {
|
|
67
67
|
fs.writeFileSync(path.join(targetDir, "pnpm-workspace.yaml"), `minimumReleaseAge: 1440
|
|
68
68
|
minimumReleaseAgeExclude:
|
|
69
69
|
- "@sentry/*"
|
|
70
|
+
# pnpm fails the install when a dependency has an unreviewed build script.
|
|
71
|
+
# These are the Junior runtime dependencies that have one.
|
|
72
|
+
allowBuilds:
|
|
73
|
+
"@google/genai": true
|
|
74
|
+
"@mongodb-js/zstd": true
|
|
75
|
+
esbuild: true
|
|
76
|
+
node-liblzma: false
|
|
77
|
+
protobufjs: true
|
|
70
78
|
`);
|
|
71
79
|
}
|
|
72
80
|
function writeVercelJson(targetDir) {
|
|
@@ -88,14 +96,13 @@ jobs:
|
|
|
88
96
|
steps:
|
|
89
97
|
- uses: actions/checkout@v6
|
|
90
98
|
- uses: pnpm/action-setup@v6
|
|
91
|
-
with:
|
|
92
|
-
version: 10
|
|
93
99
|
- uses: actions/setup-node@v6
|
|
94
100
|
with:
|
|
95
101
|
node-version: 24
|
|
96
102
|
cache: pnpm
|
|
97
103
|
- run: pnpm install
|
|
98
104
|
- run: pnpm check
|
|
105
|
+
- run: pnpm typecheck
|
|
99
106
|
# Snapshot warmup needs Vercel OIDC, so the Vercel deploy build runs it.
|
|
100
107
|
- run: pnpm build
|
|
101
108
|
env:
|
|
@@ -116,6 +123,8 @@ async function runInit(dir, log = console.log) {
|
|
|
116
123
|
version: "0.1.0",
|
|
117
124
|
private: true,
|
|
118
125
|
type: "module",
|
|
126
|
+
packageManager: "pnpm@12.18.0",
|
|
127
|
+
engines: { node: "24.x" },
|
|
119
128
|
scripts: {
|
|
120
129
|
dev: "nitro dev",
|
|
121
130
|
check: "junior check",
|
|
@@ -130,7 +139,7 @@ async function runInit(dir, log = console.log) {
|
|
|
130
139
|
hono: "^4.13.11"
|
|
131
140
|
},
|
|
132
141
|
devDependencies: {
|
|
133
|
-
"@types/node": "^
|
|
142
|
+
"@types/node": "^24.19.2",
|
|
134
143
|
jiti: "^2.7.0",
|
|
135
144
|
nitro: "3.0.260522-beta",
|
|
136
145
|
typescript: "^7.0.2"
|
package/dist/cli/main.js
CHANGED
|
@@ -24,7 +24,7 @@ function formatCliFailure(error) {
|
|
|
24
24
|
// src/cli/main.ts
|
|
25
25
|
const SENTRY_FLUSH_TIMEOUT_MS = 2e3;
|
|
26
26
|
async function flushSentry() {
|
|
27
|
-
await (await import("../sentry-
|
|
27
|
+
await (await import("../sentry-CPbZjomA.js").then((n) => n.u)).flush(SENTRY_FLUSH_TIMEOUT_MS);
|
|
28
28
|
}
|
|
29
29
|
async function initSentry() {
|
|
30
30
|
(await import("../instrumentation.js")).initSentry();
|
|
@@ -45,13 +45,13 @@ async function runChat(argv, pluginSet) {
|
|
|
45
45
|
return await (await import("./chat.js")).runChat(argv, void 0, { pluginSet });
|
|
46
46
|
}
|
|
47
47
|
async function runAdmin(argv) {
|
|
48
|
-
return await (await import("../admin-
|
|
48
|
+
return await (await import("../admin-AfeAdS3J.js")).runAdmin(argv);
|
|
49
49
|
}
|
|
50
50
|
async function runServiceAccount(argv) {
|
|
51
|
-
return await (await import("../service-account-
|
|
51
|
+
return await (await import("../service-account-xYkaQTrw.js")).runServiceAccount(argv);
|
|
52
52
|
}
|
|
53
53
|
async function runBriefs(argv) {
|
|
54
|
-
return await (await import("../briefs-
|
|
54
|
+
return await (await import("../briefs-D8i-dKTp.js")).runBriefs(argv);
|
|
55
55
|
}
|
|
56
56
|
function topLevelCommand(argv) {
|
|
57
57
|
return (argv[0] === "--" ? argv.slice(1) : argv)[0];
|
package/dist/cli/plugins.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { n as pluginCatalogRuntime } from "../catalog-runtime-
|
|
4
|
-
import { n as validatePluginRegistrations, t as validatePluginEgressCredentialHooks } from "../validation-
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
1
|
+
import { o as getDb } from "../db-C-2tFxk3.js";
|
|
2
|
+
import { fr as setPlugins, pr as validatePlugins, yo as createPluginLogger } from "../projection-DBq8tsA5.js";
|
|
3
|
+
import { n as pluginCatalogRuntime } from "../catalog-runtime-d1EM6Z0V.js";
|
|
4
|
+
import { n as validatePluginRegistrations, t as validatePluginEgressCredentialHooks } from "../validation-lu1DgjNQ.js";
|
|
5
|
+
import { t as loadAppPluginSet } from "../plugin-module-Cv2ETe8Y.js";
|
|
6
|
+
import { a as pluginRuntimeRegistrationsFromPluginSet, i as pluginCliRegistrationsFromPluginSet, r as pluginCatalogConfigFromPluginSet } from "../plugins-Bkk0XRo2.js";
|
|
7
7
|
import { stderr, stdout } from "node:process";
|
|
8
8
|
import { createJiti } from "jiti";
|
|
9
9
|
import { Command, CommanderError } from "commander";
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { n as
|
|
4
|
-
import {
|
|
1
|
+
import { i as getChatConfig } from "../config-oGM7KA9M.js";
|
|
2
|
+
import { n as pluginCatalogRuntime } from "../catalog-runtime-d1EM6Z0V.js";
|
|
3
|
+
import { n as resolve } from "../resolve-DXuA3G0g.js";
|
|
4
|
+
import { $a as SANDBOX_RUNTIME, na as create } from "../projection-DBq8tsA5.js";
|
|
5
|
+
import { K as disconnectStateAdapter } from "../db-C-2tFxk3.js";
|
|
5
6
|
// src/cli/snapshot-create.ts
|
|
6
7
|
const DEFAULT_TIMEOUT_MS = 6e5;
|
|
7
8
|
function progressMessage(phase) {
|
|
@@ -44,7 +45,7 @@ function logSnapshotProfile(runtime, log) {
|
|
|
44
45
|
}
|
|
45
46
|
/** Resolve or create the default sandbox snapshot and report its progress. */
|
|
46
47
|
async function runSnapshotCreate(log = console.log) {
|
|
47
|
-
if (process.env
|
|
48
|
+
if (process.env["JUNIOR_SKIP_SNAPSHOT"] === "1") {
|
|
48
49
|
log("Skipping sandbox snapshot create (JUNIOR_SKIP_SNAPSHOT=1)");
|
|
49
50
|
return;
|
|
50
51
|
}
|
|
@@ -67,6 +68,7 @@ async function runSnapshotCreate(log = console.log) {
|
|
|
67
68
|
`resolve_outcome=${snapshot.resolveOutcome}`,
|
|
68
69
|
`cache_hit=${snapshot.cacheHit}`,
|
|
69
70
|
`dependency_count=${snapshot.dependencyCount}`,
|
|
71
|
+
`state=${getChatConfig().state.adapter}`,
|
|
70
72
|
...snapshot.profileHash ? [`profile_hash=${snapshot.profileHash}`] : [],
|
|
71
73
|
...snapshot.snapshotId ? [`snapshot_id=${snapshot.snapshotId}`] : [],
|
|
72
74
|
...snapshot.rebuildReason ? [`rebuild_reason=${snapshot.rebuildReason}`] : []
|
package/dist/cli/upgrade.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import "../db-BdsCzytP.js";
|
|
2
1
|
import { n as JuniorPluginSet } from "../plugins-B_0Cr0MO.js";
|
|
2
|
+
import "../db-DPqcEM9_.js";
|
|
3
3
|
interface UpgradeIo {
|
|
4
4
|
info: (line: string) => void;
|
|
5
5
|
}
|
|
@@ -7,6 +7,6 @@ interface UpgradeIo {
|
|
|
7
7
|
export declare function resolveUpgradePluginSet(): Promise<JuniorPluginSet | undefined>;
|
|
8
8
|
/** Apply Junior and enabled-plugin database migrations. */
|
|
9
9
|
export declare function runUpgrade(io?: UpgradeIo, options?: {
|
|
10
|
-
pluginSet?: JuniorPluginSet | null;
|
|
10
|
+
pluginSet?: JuniorPluginSet | null | undefined;
|
|
11
11
|
}): Promise<void>;
|
|
12
12
|
export {};
|
package/dist/cli/upgrade.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { i as getChatConfig } from "../config-
|
|
2
|
-
import { t as createJuniorSqlExecutor } from "../executor-
|
|
3
|
-
import { t as
|
|
4
|
-
import {
|
|
5
|
-
import { t as
|
|
1
|
+
import { i as getChatConfig } from "../config-oGM7KA9M.js";
|
|
2
|
+
import { t as createJuniorSqlExecutor } from "../executor-NVfS8aQ2.js";
|
|
3
|
+
import { t as loadAppPluginSet } from "../plugin-module-Cv2ETe8Y.js";
|
|
4
|
+
import { t as createPluginCatalogRuntime } from "../registry-Bu0Z9BEO.js";
|
|
5
|
+
import { n as pluginCatalogConfigFromEnv, r as pluginCatalogConfigFromPluginSet, t as defineJuniorPlugins } from "../plugins-Bkk0XRo2.js";
|
|
6
6
|
import { basename, dirname, join, resolve } from "node:path";
|
|
7
7
|
import { createHash } from "node:crypto";
|
|
8
8
|
import { readMigrationFiles } from "drizzle-orm/migrator";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { E as withSpan, g as normalizeGenAiFinishReason, h as logWarn, i as extractGenAiUsageAttributes, p as logException, v as serializeGenAiAttribute } from "./logging-
|
|
3
|
-
import { a as toCanonicalInputMessage, n as getCurrentConversationPrivacy, o as toCanonicalOutputMessage, s as toGenAiMessagesTraceAttributes } from "./conversation-privacy-
|
|
1
|
+
import { t as __exportAll } from "./rolldown-runtime-BKpuH2hG.js";
|
|
2
|
+
import { E as withSpan, g as normalizeGenAiFinishReason, h as logWarn, i as extractGenAiUsageAttributes, p as logException, v as serializeGenAiAttribute } from "./logging-DiyqRLBx.js";
|
|
3
|
+
import { a as toCanonicalInputMessage, n as getCurrentConversationPrivacy, o as toCanonicalOutputMessage, s as toGenAiMessagesTraceAttributes } from "./conversation-privacy-Cx515ddM.js";
|
|
4
4
|
import { AwsClient } from "aws4fetch";
|
|
5
5
|
import { del, get, issueSignedToken, presignUrl, put } from "@vercel/blob";
|
|
6
6
|
import * as z from "zod";
|
|
@@ -167,7 +167,7 @@ function readS3StorageConfig(env) {
|
|
|
167
167
|
accessKeyId: readRequiredSetting(env, "JUNIOR_S3_ACCESS_KEY_ID"),
|
|
168
168
|
bucket: readRequiredSetting(env, "JUNIOR_S3_BUCKET"),
|
|
169
169
|
endpoint: readRequiredSetting(env, "JUNIOR_S3_ENDPOINT"),
|
|
170
|
-
region: toOptionalTrimmed(env
|
|
170
|
+
region: toOptionalTrimmed(env["JUNIOR_S3_REGION"]) ?? "us-east-1",
|
|
171
171
|
secretAccessKey: readRequiredSetting(env, "JUNIOR_S3_SECRET_ACCESS_KEY")
|
|
172
172
|
};
|
|
173
173
|
}
|
|
@@ -277,7 +277,7 @@ function createS3AttachmentStorage(config) {
|
|
|
277
277
|
// src/chat/attachments/config.ts
|
|
278
278
|
/** Read attachment storage settings from environment variables. */
|
|
279
279
|
function readAttachmentStorageConfig(env) {
|
|
280
|
-
const provider = toOptionalTrimmed(env
|
|
280
|
+
const provider = toOptionalTrimmed(env["JUNIOR_ATTACHMENT_STORAGE_PROVIDER"]) ?? "vercel-blob";
|
|
281
281
|
switch (provider) {
|
|
282
282
|
case "vercel-blob":
|
|
283
283
|
case "memory": return { provider };
|
|
@@ -315,11 +315,11 @@ function parseKey(entry, index) {
|
|
|
315
315
|
}
|
|
316
316
|
/** Parse and check the encryption keyring from environment variables. */
|
|
317
317
|
function readEncryptionKeyring(env) {
|
|
318
|
-
const entries = (env
|
|
318
|
+
const entries = (env["JUNIOR_ENCRYPTION_KEYS"] ?? "").split(",").map((entry) => entry.trim()).filter(Boolean);
|
|
319
319
|
if (entries.length === 0) throw new Error("JUNIOR_ENCRYPTION_KEYS is required. Generate a key with: node -e \"console.log('k1:' + require('node:crypto').randomBytes(32).toString('base64url'))\"");
|
|
320
320
|
const keys = entries.map(parseKey);
|
|
321
321
|
if (new Set(keys.map((key) => key.id)).size !== keys.length) throw new Error("JUNIOR_ENCRYPTION_KEYS must not repeat a key id");
|
|
322
|
-
const activeId = env
|
|
322
|
+
const activeId = env["JUNIOR_ENCRYPTION_KEY_ID"]?.trim() || (keys.length === 1 ? keys[0]?.id : void 0);
|
|
323
323
|
if (!activeId) throw new Error("JUNIOR_ENCRYPTION_KEY_ID is required when JUNIOR_ENCRYPTION_KEYS has more than one key");
|
|
324
324
|
const active = keys.find((key) => key.id === activeId);
|
|
325
325
|
if (!active) throw new Error(`JUNIOR_ENCRYPTION_KEY_ID "${activeId}" is not in JUNIOR_ENCRYPTION_KEYS`);
|
|
@@ -340,16 +340,16 @@ function readWorkerConcurrency(value) {
|
|
|
340
340
|
}
|
|
341
341
|
/** Read queue settings from environment variables. */
|
|
342
342
|
function readQueueConfig(env) {
|
|
343
|
-
const provider = toOptionalTrimmed(env
|
|
343
|
+
const provider = toOptionalTrimmed(env["JUNIOR_QUEUE_PROVIDER"]) ?? "vercel";
|
|
344
344
|
switch (provider) {
|
|
345
345
|
case "vercel": return { provider };
|
|
346
346
|
case "bullmq": {
|
|
347
|
-
const redisUrl = toOptionalTrimmed(env
|
|
347
|
+
const redisUrl = toOptionalTrimmed(env["JUNIOR_QUEUE_REDIS_URL"]);
|
|
348
348
|
if (!redisUrl) throw new Error("JUNIOR_QUEUE_REDIS_URL is required when JUNIOR_QUEUE_PROVIDER is bullmq");
|
|
349
349
|
return {
|
|
350
350
|
provider,
|
|
351
351
|
redisUrl,
|
|
352
|
-
workerConcurrency: readWorkerConcurrency(env
|
|
352
|
+
workerConcurrency: readWorkerConcurrency(env["JUNIOR_QUEUE_WORKER_CONCURRENCY"])
|
|
353
353
|
};
|
|
354
354
|
}
|
|
355
355
|
default: throw new Error("JUNIOR_QUEUE_PROVIDER must be vercel or bullmq");
|
|
@@ -1261,10 +1261,10 @@ async function completeText(params) {
|
|
|
1261
1261
|
}, startAttributes);
|
|
1262
1262
|
}
|
|
1263
1263
|
function logContextFromMetadata(modelId, metadata) {
|
|
1264
|
-
const conversationId = typeof metadata?.conversationId === "string" ? metadata
|
|
1265
|
-
const messageConversationId = typeof metadata?.threadId === "string" ? metadata
|
|
1266
|
-
const destinationName = typeof metadata?.channelId === "string" ? metadata
|
|
1267
|
-
const runId = typeof metadata?.runId === "string" ? metadata
|
|
1264
|
+
const conversationId = typeof metadata?.["conversationId"] === "string" ? metadata["conversationId"] : typeof metadata?.["threadId"] === "string" ? metadata["threadId"] : void 0;
|
|
1265
|
+
const messageConversationId = typeof metadata?.["threadId"] === "string" ? metadata["threadId"] : void 0;
|
|
1266
|
+
const destinationName = typeof metadata?.["channelId"] === "string" ? metadata["channelId"] : void 0;
|
|
1267
|
+
const runId = typeof metadata?.["runId"] === "string" ? metadata["runId"] : void 0;
|
|
1268
1268
|
return {
|
|
1269
1269
|
modelId,
|
|
1270
1270
|
...conversationId ? { conversationId } : void 0,
|
|
@@ -1548,26 +1548,7 @@ function toPiReasoningLevel(level) {
|
|
|
1548
1548
|
return level === "none" ? "off" : level;
|
|
1549
1549
|
}
|
|
1550
1550
|
// src/chat/config.ts
|
|
1551
|
-
var config_exports = /* @__PURE__ */ __exportAll({
|
|
1552
|
-
CONVERSATION_WORK_SOFT_YIELD_BUFFER_SECONDS: () => 40,
|
|
1553
|
-
DEFAULT_SQL_STATEMENT_TIMEOUT_MS: () => DEFAULT_SQL_STATEMENT_TIMEOUT_MS,
|
|
1554
|
-
FUNCTION_TIMEOUT_BUFFER_SECONDS: () => 20,
|
|
1555
|
-
botConfig: () => botConfig,
|
|
1556
|
-
getChatConfig: () => getChatConfig,
|
|
1557
|
-
getRuntimeMetadata: () => getRuntimeMetadata,
|
|
1558
|
-
getSlackBotToken: () => getSlackBotToken,
|
|
1559
|
-
getSlackClientId: () => getSlackClientId,
|
|
1560
|
-
getSlackClientSecret: () => getSlackClientSecret,
|
|
1561
|
-
getSlackSigningSecret: () => getSlackSigningSecret,
|
|
1562
|
-
readChatConfig: () => readChatConfig,
|
|
1563
|
-
resetRuntimeConfig: () => resetRuntimeConfig,
|
|
1564
|
-
restoreRuntimeConfig: () => restoreRuntimeConfig,
|
|
1565
|
-
setBotModelConfig: () => setBotModelConfig,
|
|
1566
|
-
setBotName: () => setBotName,
|
|
1567
|
-
setRuntimeLimits: () => setRuntimeLimits,
|
|
1568
|
-
setSlackReactionConfig: () => setSlackReactionConfig,
|
|
1569
|
-
snapshotRuntimeConfig: () => snapshotRuntimeConfig
|
|
1570
|
-
});
|
|
1551
|
+
var config_exports = /* @__PURE__ */ __exportAll({ botConfig: () => botConfig });
|
|
1571
1552
|
const MIN_AGENT_TURN_TIMEOUT_MS = 1e4;
|
|
1572
1553
|
const DEFAULT_AGENT_TURN_TIMEOUT_MS = 72e4;
|
|
1573
1554
|
const MAX_SLICES_PER_TURN = 100;
|
|
@@ -1698,24 +1679,24 @@ function parseReactionEmoji(envName, rawValue, defaultEmoji) {
|
|
|
1698
1679
|
}
|
|
1699
1680
|
function readBotConfig(env, functionMaxDurationSeconds) {
|
|
1700
1681
|
const maxTurnTimeoutMs = resolveMaxTurnTimeoutMs(functionMaxDurationSeconds);
|
|
1701
|
-
const modelId = validateGatewayModelId(env
|
|
1702
|
-
const reasoningLevel = toOptionalTrimmed(env
|
|
1703
|
-
const fastModelId = validateGatewayModelId(env
|
|
1704
|
-
const guardianModelId = validateGatewayModelId(env
|
|
1682
|
+
const modelId = validateGatewayModelId(env["AI_MODEL"]) ?? DEFAULT_MODEL_ID;
|
|
1683
|
+
const reasoningLevel = toOptionalTrimmed(env["AI_REASONING_LEVEL"]);
|
|
1684
|
+
const fastModelId = validateGatewayModelId(env["AI_FAST_MODEL"] ?? env["AI_MODEL"]) ?? DEFAULT_FAST_MODEL_ID;
|
|
1685
|
+
const guardianModelId = validateGatewayModelId(env["AI_GUARDIAN_MODEL"]) ?? DEFAULT_GUARDIAN_MODEL_ID;
|
|
1705
1686
|
return {
|
|
1706
|
-
userName: toOptionalTrimmed(env
|
|
1687
|
+
userName: toOptionalTrimmed(env["JUNIOR_BOT_NAME"]) ?? "junior",
|
|
1707
1688
|
modelId,
|
|
1708
|
-
contextWindowTokens: parseOptionalPositiveInteger("AI_MODEL_CONTEXT_WINDOW_TOKENS", env
|
|
1689
|
+
contextWindowTokens: parseOptionalPositiveInteger("AI_MODEL_CONTEXT_WINDOW_TOKENS", env["AI_MODEL_CONTEXT_WINDOW_TOKENS"]) ?? DEFAULT_MODEL_CONTEXT_WINDOW_TOKENS,
|
|
1709
1690
|
reasoningLevel: reasoningLevel === void 0 ? DEFAULT_REASONING_LEVEL : parseTurnReasoningLevel(reasoningLevel),
|
|
1710
|
-
decisionModelId: toOptionalTrimmed(env
|
|
1691
|
+
decisionModelId: toOptionalTrimmed(env["AI_DECISION_MODEL"]) ?? DEFAULT_DECISION_MODEL_ID,
|
|
1711
1692
|
fastModelId,
|
|
1712
1693
|
guardianModelId,
|
|
1713
|
-
imageGenerationModelId: toOptionalTrimmed(env
|
|
1714
|
-
embeddingModelId: validateEmbeddingModelId(env
|
|
1715
|
-
rerankingModelId: toOptionalTrimmed(env
|
|
1716
|
-
loadingMessages: parseLoadingMessages(env
|
|
1717
|
-
refusalFallbackModelId: validateGatewayModelId(env
|
|
1718
|
-
visionModelId: env
|
|
1694
|
+
imageGenerationModelId: toOptionalTrimmed(env["AI_IMAGE_MODEL"]) ?? DEFAULT_IMAGE_GENERATION_MODEL_ID,
|
|
1695
|
+
embeddingModelId: validateEmbeddingModelId(env["AI_EMBEDDING_MODEL"]) ?? DEFAULT_EMBEDDING_MODEL_ID,
|
|
1696
|
+
rerankingModelId: toOptionalTrimmed(env["AI_RERANKING_MODEL"]) ?? DEFAULT_RERANKING_MODEL_ID,
|
|
1697
|
+
loadingMessages: parseLoadingMessages(env["JUNIOR_LOADING_MESSAGES"]),
|
|
1698
|
+
refusalFallbackModelId: validateGatewayModelId(env["AI_REFUSAL_FALLBACK_MODEL"]),
|
|
1699
|
+
visionModelId: env["AI_VISION_MODEL"] === void 0 ? DEFAULT_VISION_MODEL_ID : validateGatewayModelId(env["AI_VISION_MODEL"]),
|
|
1719
1700
|
maxAgentDepth: 0,
|
|
1720
1701
|
maxSlicesPerTurn: MAX_SLICES_PER_TURN,
|
|
1721
1702
|
maxToolCallsPerTurn: MAX_TOOL_CALLS_PER_TURN,
|
|
@@ -1723,12 +1704,12 @@ function readBotConfig(env, functionMaxDurationSeconds) {
|
|
|
1723
1704
|
maxConsecutiveAutomatedTurns: MAX_CONSECUTIVE_AUTOMATED_TURNS,
|
|
1724
1705
|
maxEventAutomationRuns: MAX_EVENT_AUTOMATION_RUNS,
|
|
1725
1706
|
eventAutomationRunWindowMs: EVENT_AUTOMATION_RUN_WINDOW_MS,
|
|
1726
|
-
turnTimeoutMs: parseAgentTurnTimeoutMs(env
|
|
1727
|
-
webSearchModelId: validateGatewayModelId(env
|
|
1707
|
+
turnTimeoutMs: parseAgentTurnTimeoutMs(env["AGENT_TURN_TIMEOUT_MS"], maxTurnTimeoutMs),
|
|
1708
|
+
webSearchModelId: validateGatewayModelId(env["AI_WEB_SEARCH_MODEL"]) ?? DEFAULT_WEB_SEARCH_MODEL_ID
|
|
1728
1709
|
};
|
|
1729
1710
|
}
|
|
1730
1711
|
function readDatabaseUrl(env) {
|
|
1731
|
-
const databaseUrl = toOptionalTrimmed(env
|
|
1712
|
+
const databaseUrl = toOptionalTrimmed(env["DATABASE_URL"]);
|
|
1732
1713
|
if (!databaseUrl) throw new Error("DATABASE_URL is required");
|
|
1733
1714
|
return databaseUrl;
|
|
1734
1715
|
}
|
|
@@ -1741,7 +1722,7 @@ function isLocalDatabaseUrl(databaseUrl) {
|
|
|
1741
1722
|
}
|
|
1742
1723
|
}
|
|
1743
1724
|
function readSqlDriver(env, databaseUrl) {
|
|
1744
|
-
const value = toOptionalTrimmed(env
|
|
1725
|
+
const value = toOptionalTrimmed(env["JUNIOR_DATABASE_DRIVER"]);
|
|
1745
1726
|
if (value === void 0) {
|
|
1746
1727
|
if (isLocalDatabaseUrl(databaseUrl)) return "postgres";
|
|
1747
1728
|
return "neon";
|
|
@@ -1750,7 +1731,7 @@ function readSqlDriver(env, databaseUrl) {
|
|
|
1750
1731
|
throw new Error("JUNIOR_DATABASE_DRIVER must be postgres or neon");
|
|
1751
1732
|
}
|
|
1752
1733
|
function readSqlStatementTimeoutMs(env) {
|
|
1753
|
-
const rawValue = toOptionalTrimmed(env
|
|
1734
|
+
const rawValue = toOptionalTrimmed(env["JUNIOR_SQL_STATEMENT_TIMEOUT_MS"]);
|
|
1754
1735
|
if (rawValue === void 0) return DEFAULT_SQL_STATEMENT_TIMEOUT_MS;
|
|
1755
1736
|
const value = Number.parseInt(rawValue, 10);
|
|
1756
1737
|
if (!Number.isSafeInteger(value) || value < 0 || String(value) !== rawValue) throw new Error("JUNIOR_SQL_STATEMENT_TIMEOUT_MS must be a non-negative integer");
|
|
@@ -1765,8 +1746,8 @@ function readChatConfig(env = process.env, functionMaxDurationSeconds = DEFAULT_
|
|
|
1765
1746
|
bot: readBotConfig(env, resolvedFunctionMaxDurationSeconds),
|
|
1766
1747
|
queue: readQueueConfig(env),
|
|
1767
1748
|
functionMaxDurationSeconds: resolvedFunctionMaxDurationSeconds,
|
|
1768
|
-
cacheWarmingEnabled: parseKillSwitch("JUNIOR_CACHE_WARMING_ENABLED", env
|
|
1769
|
-
conversationWorkEnabled: parseKillSwitch("JUNIOR_CONVERSATION_WORK_ENABLED", env
|
|
1749
|
+
cacheWarmingEnabled: parseKillSwitch("JUNIOR_CACHE_WARMING_ENABLED", env["JUNIOR_CACHE_WARMING_ENABLED"]),
|
|
1750
|
+
conversationWorkEnabled: parseKillSwitch("JUNIOR_CONVERSATION_WORK_ENABLED", env["JUNIOR_CONVERSATION_WORK_ENABLED"]),
|
|
1770
1751
|
conversationWorkSoftYieldAfterMs: resolveConversationWorkSoftYieldAfterMs(resolvedFunctionMaxDurationSeconds),
|
|
1771
1752
|
encryption: readEncryptionKeyring(env),
|
|
1772
1753
|
sql: {
|
|
@@ -1775,18 +1756,18 @@ function readChatConfig(env = process.env, functionMaxDurationSeconds = DEFAULT_
|
|
|
1775
1756
|
statementTimeoutMs: readSqlStatementTimeoutMs(env)
|
|
1776
1757
|
},
|
|
1777
1758
|
slack: {
|
|
1778
|
-
botToken: toOptionalTrimmed(env
|
|
1779
|
-
clientId: toOptionalTrimmed(env
|
|
1780
|
-
clientSecret: toOptionalTrimmed(env
|
|
1759
|
+
botToken: toOptionalTrimmed(env["SLACK_BOT_TOKEN"]) ?? toOptionalTrimmed(env["SLACK_BOT_USER_TOKEN"]),
|
|
1760
|
+
clientId: toOptionalTrimmed(env["SLACK_CLIENT_ID"]),
|
|
1761
|
+
clientSecret: toOptionalTrimmed(env["SLACK_CLIENT_SECRET"]),
|
|
1781
1762
|
completedReactionEmoji: DEFAULT_COMPLETED_REACTION_EMOJI,
|
|
1782
1763
|
processingReactionEmoji: DEFAULT_PROCESSING_REACTION_EMOJI,
|
|
1783
|
-
signingSecret: toOptionalTrimmed(env
|
|
1764
|
+
signingSecret: toOptionalTrimmed(env["SLACK_SIGNING_SECRET"])
|
|
1784
1765
|
},
|
|
1785
|
-
sandbox: { provider: env
|
|
1766
|
+
sandbox: { provider: env["JUNIOR_SANDBOX_PROVIDER"]?.trim().toLowerCase() === "docker" ? "docker" : "vercel" },
|
|
1786
1767
|
state: {
|
|
1787
|
-
adapter: env
|
|
1788
|
-
keyPrefix: toOptionalTrimmed(env
|
|
1789
|
-
redisUrl: toOptionalTrimmed(env
|
|
1768
|
+
adapter: env["JUNIOR_STATE_ADAPTER"]?.trim().toLowerCase() === "memory" ? "memory" : "redis",
|
|
1769
|
+
keyPrefix: toOptionalTrimmed(env["JUNIOR_STATE_KEY_PREFIX"]),
|
|
1770
|
+
redisUrl: toOptionalTrimmed(env["REDIS_URL"])
|
|
1790
1771
|
}
|
|
1791
1772
|
};
|
|
1792
1773
|
}
|
|
@@ -1867,7 +1848,7 @@ function getSlackClientSecret() {
|
|
|
1867
1848
|
}
|
|
1868
1849
|
/** Return runtime metadata (version from deploy environment). */
|
|
1869
1850
|
function getRuntimeMetadata() {
|
|
1870
|
-
return { version: toOptionalTrimmed(process.env
|
|
1851
|
+
return { version: toOptionalTrimmed(process.env["VERCEL_GIT_COMMIT_SHA"]) };
|
|
1871
1852
|
}
|
|
1872
1853
|
/** Apply model overrides from createApp(). */
|
|
1873
1854
|
function setBotModelConfig(config) {
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { n as botConfig } from "./config-
|
|
3
|
-
import { I as deleteProviderIdentityForSlackUser, L as deleteProviderIdentityForUser, s as getSqlExecutor } from "./db-
|
|
4
|
-
import { u as hasRequiredOAuthScope } from "./registry-
|
|
5
|
-
import { n as pluginCatalogRuntime } from "./catalog-runtime-
|
|
6
|
-
import { h as deleteMcpStoredOAuthCredentials, m as deleteMcpServerSessionId, p as deleteMcpAuthSessionsForUserProvider } from "./service-account-
|
|
1
|
+
import { pa as startOAuthFlow } from "./projection-DBq8tsA5.js";
|
|
2
|
+
import { n as botConfig } from "./config-oGM7KA9M.js";
|
|
3
|
+
import { I as deleteProviderIdentityForSlackUser, L as deleteProviderIdentityForUser, s as getSqlExecutor } from "./db-C-2tFxk3.js";
|
|
4
|
+
import { u as hasRequiredOAuthScope } from "./registry-Bu0Z9BEO.js";
|
|
5
|
+
import { n as pluginCatalogRuntime } from "./catalog-runtime-d1EM6Z0V.js";
|
|
6
|
+
import { h as deleteMcpStoredOAuthCredentials, m as deleteMcpServerSessionId, p as deleteMcpAuthSessionsForUserProvider } from "./service-account-BcT5LR7V.js";
|
|
7
7
|
import { randomBytes } from "node:crypto";
|
|
8
8
|
// src/handlers/oauth-html.ts
|
|
9
9
|
/** Build pre-escaped callback HTML with the shared response security policy. */
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Lt as moveIdleConversationDestination, Mo as readLatestConversationBrief, Ta as getSlackMessagePermalink, ga as formatSlackLink, ha as escapeSlackMrkdwnText, ji as getDashboardConversationLink, ka as postSlackMessage, wa as deleteSlackMessage } from "./projection-DBq8tsA5.js";
|
|
2
|
+
import { A as setFirstConversationLocation, J as getStateAdapter, a as getConversationStore, nt as getConversationIdByProviderConversation, o as getDb, s as getSqlExecutor, tt as claimProviderConversation, x as withConversationMutationLock } from "./db-C-2tFxk3.js";
|
|
2
3
|
import { u as parseSlackChannelId, v as parseSlackMessageTs } from "./actor-D2iXzvlN.js";
|
|
3
|
-
import {
|
|
4
|
-
import
|
|
5
|
-
import {
|
|
6
|
-
import "./store-C28I0CVW.js";
|
|
4
|
+
import { _r as checkSlackChannelReadAccess, vr as joinPublicChannelForRead } from "./warmup-H8uLvW9e.js";
|
|
5
|
+
import "./store-Dgs7Oe44.js";
|
|
6
|
+
import { F as juniorDestinations } from "./executor-NVfS8aQ2.js";
|
|
7
7
|
import { and, eq } from "drizzle-orm";
|
|
8
8
|
// src/chat/slack/continue-in-slack.ts
|
|
9
9
|
/** Refusal for a move that cannot wait for the active Run. */
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as conversationTurnFailureReasonSchema, h as usageSchema, i as conversationTurnFailureCodeSchema } from "./history-
|
|
1
|
+
import { a as conversationTurnFailureReasonSchema, h as usageSchema, i as conversationTurnFailureCodeSchema } from "./history-UZ3M2M9r.js";
|
|
2
2
|
import * as z from "zod";
|
|
3
3
|
import { codeChangeStateSchema, conversationAnnotationInputSchema, conversationEventPresentationSchema, conversationSidebarAnnotationSchema, objectFactFields, objectTypeSchema } from "@sentry/junior-plugin-api";
|
|
4
4
|
// src/chat/briefs/schema.ts
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { J as messageAttachmentSchema, Q as briefOutcomeStatusSchema, R as reviewItemChangeRecordSchema, b as conversationSummaryReportSchema, i as actorIdentitySchema, u as conversationDetailReportSchema } from "./conversation-
|
|
1
|
+
import { J as messageAttachmentSchema, Q as briefOutcomeStatusSchema, R as reviewItemChangeRecordSchema, b as conversationSummaryReportSchema, i as actorIdentitySchema, u as conversationDetailReportSchema } from "./conversation-CY1jnBiC.js";
|
|
2
2
|
import * as z from "zod";
|
|
3
3
|
// src/api/objects/cards.ts
|
|
4
4
|
const MAX_LABEL_CHARS = 256;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { h as logWarn } from "./logging-
|
|
1
|
+
import { h as logWarn } from "./logging-DiyqRLBx.js";
|
|
2
2
|
import { AsyncLocalStorage } from "node:async_hooks";
|
|
3
3
|
// src/chat/conversation-privacy.ts
|
|
4
4
|
const SAFE_METADATA_KEY_LIMIT = 20;
|
|
@@ -79,11 +79,11 @@ function summarizeContent(content) {
|
|
|
79
79
|
continue;
|
|
80
80
|
}
|
|
81
81
|
const record = part;
|
|
82
|
-
const type = canonicalContentPartType(typeof record
|
|
82
|
+
const type = canonicalContentPartType(typeof record["type"] === "string" ? record["type"] : "unknown");
|
|
83
83
|
partTypes.add(type);
|
|
84
|
-
if (typeof record
|
|
85
|
-
else if (typeof record
|
|
86
|
-
else if (typeof record
|
|
84
|
+
if (typeof record["text"] === "string") chars += record["text"].length;
|
|
85
|
+
else if (typeof record["thinking"] === "string") chars += record["thinking"].length;
|
|
86
|
+
else if (typeof record["data"] === "string") chars += record["data"].length;
|
|
87
87
|
else chars += serializedLength(part);
|
|
88
88
|
}
|
|
89
89
|
return {
|
|
@@ -165,8 +165,8 @@ function toGenAiMessagesTraceAttributes(prefix, messages) {
|
|
|
165
165
|
continue;
|
|
166
166
|
}
|
|
167
167
|
const record = message;
|
|
168
|
-
if (typeof record
|
|
169
|
-
const summary = summarizeContent(record
|
|
168
|
+
if (typeof record["role"] === "string") roles.add(record["role"]);
|
|
169
|
+
const summary = summarizeContent(record["content"]);
|
|
170
170
|
contentChars += summary.chars;
|
|
171
171
|
for (const partType of summary.partTypes) partTypes.add(partType);
|
|
172
172
|
}
|
|
@@ -1,21 +1,22 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { E as withSpan, S as setTags, h as logWarn, p as logException } from "./logging-
|
|
5
|
-
import {
|
|
6
|
-
import { M as juniorConversations } from "./executor-
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import { t as
|
|
17
|
-
import {
|
|
18
|
-
import {
|
|
1
|
+
import { t as __exportAll } from "./rolldown-runtime-BKpuH2hG.js";
|
|
2
|
+
import { B as blockScheduledAutomation, E as notifyAutomationBlocked, X as blockEventAutomation, a as getPersistedThreadState, c as coerceThreadConversationState, g as getDispatchRecord, i as getPersistedSandboxState, k as readAutomationExecutionByConversationId, m as getDispatchIdForConversation, s as persistThreadStateById } from "./turn-session-routing-DGvn9MSl.js";
|
|
3
|
+
import { C as isPersonInput, D as turnBehavior, a as getConversationStore, ft as nextDetailVersion, o as getDb, r as getConversationEventStore, s as getSqlExecutor, w as isTopLevelKind } from "./db-C-2tFxk3.js";
|
|
4
|
+
import { E as withSpan, S as setTags, h as logWarn, p as logException } from "./logging-DiyqRLBx.js";
|
|
5
|
+
import { Y as readMessageAttachments } from "./conversation-CY1jnBiC.js";
|
|
6
|
+
import { M as juniorConversations } from "./executor-NVfS8aQ2.js";
|
|
7
|
+
import { c as buildDeliveredTurnStatePatch, l as loadPendingMessageCards, o as completeAuthPauseTurn, r as finalizeFailedTurnReplyWithEvent, t as buildTurnThreadContext } from "./thread-context-BPky1KBe.js";
|
|
8
|
+
import { Et as resolveConversationDestination, Gn as AgentRunError, Hn as createWebAuthorization, Kn as executeTurn, jn as supersedeOpenMailboxTurns, on as childAgentTurnOptions, sn as isParentMessageMeta, un as readParentMessage, xn as completeCancelledConversationTurn } from "./warmup-H8uLvW9e.js";
|
|
9
|
+
import { A as latestConversationMessageSeq, I as upsertConversationMessage, M as normalizeConversationText, N as recordDeliveredAssistantMessage, a as loadProjection, at as failTurnRecord, b as persistConversationMessages, bn as persistWithRetry, j as markConversationMessage, ki as verifyTimerWatchCredentialSubject, nt as saveTurnCheckpoint, st as getTurnRecord, t as commitAcceptedReply, un as getAssistantReplyText, v as hydrateConversationMessages } from "./projection-DBq8tsA5.js";
|
|
10
|
+
import { R as buildDeterministicTurnId, _ as ConversationTurnLifecycleService, d as isTurnInputCommitLostError, g as startActiveTurn, h as markTurnFailed, l as getConversationTurnBoundaryError, s as TurnInputCommitLostError, t as getTurnUserMessage } from "./turn-user-message-19CkuUvM.js";
|
|
11
|
+
import { f as credentialContextForActor } from "./registry-Bu0Z9BEO.js";
|
|
12
|
+
import { i as getActiveSpan, r as continueTrace } from "./sentry-CPbZjomA.js";
|
|
13
|
+
import { i as measureTurnCompactionWait } from "./agent-runner-BP8_DLUv.js";
|
|
14
|
+
import { n as botConfig } from "./config-oGM7KA9M.js";
|
|
15
|
+
import { D as turnInputFactsFromConversationMessage, E as sourceFromTurnInput, I as maybePostAutomatedTurnLimitNotice, M as isEventMailboxMetadata, N as renderEventBatchInputs, O as legacyWebMailboxMetadataSchema, P as timerWatchCredentialSubject, U as recordFinishedTurnForAutomatedLimit, c as loadReviewItemInput, f as buildSteeringPiMessage, g as withoutSavedSteeringMessages, j as eventBatchMessageMeta, m as instructionForInputs, p as instructionActorFor, s as eventReviewItemInputs, x as getEventBatchDelayMs } from "./session-stop-BLLp1IP_.js";
|
|
16
|
+
import { n as scheduleSessionCompletedPluginTasks, t as processPluginTask } from "./task-runner-BGXF7Fo7.js";
|
|
17
|
+
import { p as instructionProvenanceFor } from "./history-UZ3M2M9r.js";
|
|
18
|
+
import { o as isEventConversationMessage } from "./prompt-D2KlJopL.js";
|
|
19
|
+
import { t as readConversationLineage } from "./lineage-HGLhd_-N.js";
|
|
19
20
|
import { isDeepStrictEqual } from "node:util";
|
|
20
21
|
import { createHash } from "node:crypto";
|
|
21
22
|
import { and, eq, isNotNull, isNull } from "drizzle-orm";
|
|
@@ -146,7 +147,6 @@ async function commitAssistantMessage(args) {
|
|
|
146
147
|
const conversationMessageId = recordDeliveredAssistantMessage({
|
|
147
148
|
cards: args.cards,
|
|
148
149
|
conversation: args.conversation,
|
|
149
|
-
...args.quiet ? { quiet: args.quiet } : void 0,
|
|
150
150
|
sessionId: args.sessionId,
|
|
151
151
|
source: args.source,
|
|
152
152
|
text: args.text,
|
|
@@ -531,9 +531,8 @@ function createConversationTurnWorker(agentRunner, deliverMessage, deliverToPare
|
|
|
531
531
|
if (!replyText?.trim()) return;
|
|
532
532
|
failureCode = "delivery_failed";
|
|
533
533
|
const cards = await loadPendingMessageCards(context.conversationId);
|
|
534
|
-
const quiet = options?.quiet === true && isEventTurn && cards.length === 0;
|
|
535
534
|
let deliveryResult;
|
|
536
|
-
if ((options?.reply ? postsToProvider : deliverToProvider) && !
|
|
535
|
+
if ((options?.reply ? postsToProvider : deliverToProvider) && !await isConversationDeliveryPaused(context.conversationId)) {
|
|
537
536
|
if (!conversationLocation || !deliverMessage) throw new Error(`Conversation ${context.conversationId} cannot deliver to its Location`);
|
|
538
537
|
deliveryResult = await deliverMessage({
|
|
539
538
|
cards,
|
|
@@ -548,7 +547,6 @@ function createConversationTurnWorker(agentRunner, deliverMessage, deliverToPare
|
|
|
548
547
|
conversation,
|
|
549
548
|
conversationId: context.conversationId,
|
|
550
549
|
...deliveryResult ? { deliveryResult } : void 0,
|
|
551
|
-
...quiet ? { quiet } : void 0,
|
|
552
550
|
sessionId: turnId,
|
|
553
551
|
...deliveryResult ? { source: "slack" } : source.kind === "web" ? { source: "web" } : void 0,
|
|
554
552
|
text: replyText,
|
|
@@ -667,7 +665,6 @@ function createConversationTurnWorker(agentRunner, deliverMessage, deliverToPare
|
|
|
667
665
|
text: reply.blocked.missing
|
|
668
666
|
});
|
|
669
667
|
else if (reply.blocked) await blockRunAutomation(context.conversationId, reply.blocked);
|
|
670
|
-
else if (reply.noReply?.note && isEventTurn) await deliverAssistantMessage(reply.noReply.note, { quiet: true });
|
|
671
668
|
const completedState = buildDeliveredTurnStatePatch({
|
|
672
669
|
conversation,
|
|
673
670
|
reply,
|