@sentry/junior 0.177.0 → 0.179.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/{agent-hooks-IYHCN7CO.js → agent-hooks-32IDCLMW.js} +12 -12
- package/dist/api/conversations/archive.d.ts +5 -2
- package/dist/api/conversations/list.d.ts +0 -1
- package/dist/api/conversations/membership.d.ts +14 -0
- package/dist/api/conversations/projection.d.ts +2 -1
- package/dist/api/locations/detail.d.ts +1 -1
- package/dist/api/people/shared.d.ts +2 -2
- package/dist/api/schema/conversation.d.ts +4 -4
- package/dist/api/schema/location.d.ts +1 -1
- package/dist/api/schema/person.d.ts +1 -1
- package/dist/api/schema.js +1 -1
- package/dist/api.js +399 -287
- package/dist/app.js +573 -198
- package/dist/{catalog-runtime-2TD4CXSB.js → catalog-runtime-FBVA6WAQ.js} +5 -5
- package/dist/chat/agent/sandbox.d.ts +2 -0
- package/dist/chat/conversations/sql/participants.d.ts +1 -0
- package/dist/chat/conversations/store.d.ts +0 -1
- package/dist/chat/sandbox/errors.d.ts +4 -0
- package/dist/chat/sandbox/noninteractive-command.d.ts +1 -0
- package/dist/chat/sandbox/prepare-workspace.d.ts +27 -3
- package/dist/chat/sandbox/sandbox.d.ts +2 -0
- package/dist/chat/sandbox/session.d.ts +2 -0
- package/dist/chat/sandbox/snapshot/builder-sandbox.d.ts +5 -0
- package/dist/chat/sandbox/snapshot/install.d.ts +2 -2
- package/dist/chat/sandbox/snapshot/span.d.ts +3 -0
- package/dist/chat/sandbox/snapshot/store.d.ts +20 -17
- package/dist/chat/sandbox/snapshot/waiting-error.d.ts +15 -0
- package/dist/chat/sandbox/snapshot/workspace.d.ts +17 -0
- package/dist/chat/scheduled-tasks/personal.d.ts +5 -8
- package/dist/chat/scheduled-tasks/runs.d.ts +49 -0
- package/dist/chat/scheduled-tasks/schedule-intent.d.ts +1 -1
- package/dist/chat/scheduled-tasks/tasks.d.ts +27 -0
- package/dist/chat/scheduled-tasks/tool-support.d.ts +0 -4
- package/dist/chat/scheduled-tasks/tools/create.d.ts +1 -1
- package/dist/chat/scheduled-tasks/tools/update.d.ts +1 -1
- package/dist/chat/scheduled-tasks/types.d.ts +127 -78
- package/dist/chat/services/workspace-snapshot-wait.d.ts +27 -0
- package/dist/chat/workspaces/types.d.ts +1 -0
- package/dist/{chunk-CAWBLVBY.js → chunk-2HIPYNQI.js} +6 -6
- package/dist/{chunk-ZCYABD7N.js → chunk-3AFVR5UC.js} +5 -5
- package/dist/{chunk-PA7QDS7P.js → chunk-3I7XE3PA.js} +204 -100
- package/dist/{chunk-VGDOEKO2.js → chunk-3TM3FYLQ.js} +1 -1
- package/dist/{chunk-6NZRKJWU.js → chunk-4GWXAILB.js} +1 -1
- package/dist/{chunk-LFZODSAY.js → chunk-5IRROPA5.js} +4 -4
- package/dist/{chunk-N4YEVOEC.js → chunk-B6ECUSVX.js} +45 -276
- package/dist/{chunk-4TWDRU64.js → chunk-CJLBLELR.js} +5 -5
- package/dist/{chunk-3FWXQZJJ.js → chunk-FAS6AIMF.js} +1 -1
- package/dist/{chunk-I7PKGMKI.js → chunk-FIDMHAO6.js} +6 -6
- package/dist/{chunk-4SVAFAI2.js → chunk-FTGD2FBP.js} +1 -1
- package/dist/{chunk-LVL5NG5G.js → chunk-G2CAC4CV.js} +19 -19
- package/dist/{chunk-DLTP6TUJ.js → chunk-GENV6KF2.js} +2 -2
- package/dist/{chunk-FVVYHML7.js → chunk-GPLAT6H7.js} +6 -6
- package/dist/{chunk-7CVYXUOJ.js → chunk-HQNE5APD.js} +1 -1
- package/dist/{chunk-Q362TECJ.js → chunk-JMJNFEDC.js} +331 -2
- package/dist/{chunk-AFOFVEXP.js → chunk-JT4WMD3C.js} +124 -13
- package/dist/{chunk-7ZFESKJ2.js → chunk-KJLHIHFF.js} +9 -9
- package/dist/{chunk-QLLOX7JY.js → chunk-Q5B3WTGG.js} +8 -8
- package/dist/{chunk-DGGIKWYQ.js → chunk-R5NWWYIS.js} +1 -1
- package/dist/{chunk-WCQUKX74.js → chunk-R6U7N4FS.js} +14 -5
- package/dist/{chunk-WYO2HXY5.js → chunk-RTRBYSF3.js} +1 -1
- package/dist/{chunk-2IMQLZHS.js → chunk-RZRYOLCE.js} +1144 -136
- package/dist/{chunk-7B6NW4P7.js → chunk-SLGGOASN.js} +1 -1
- package/dist/{chunk-SNPQGTHJ.js → chunk-TIEKUH4Q.js} +1 -1
- package/dist/{chunk-ELEAIRTG.js → chunk-TKB25A3L.js} +2 -2
- package/dist/{chunk-UB5YB2ED.js → chunk-U4TKB6F6.js} +6 -6
- package/dist/{chunk-ORMJY4RG.js → chunk-UT6X7XN7.js} +1 -1
- package/dist/{chunk-LPMLAJYR.js → chunk-VP4OVRDD.js} +11 -17
- package/dist/{chunk-7PZDAXIK.js → chunk-XSPSCWLH.js} +1 -1
- package/dist/chunk-XZY6G5YZ.js +1088 -0
- package/dist/{chunk-J2EWL6GJ.js → chunk-YFNAMRGE.js} +1 -1
- package/dist/{chunk-6KGMMVHF.js → chunk-ZQMG3CL5.js} +2 -2
- package/dist/cli/chat.js +31 -30
- package/dist/cli/check.js +6 -6
- package/dist/cli/plugins.js +13 -13
- package/dist/cli/snapshot-create.js +10 -10
- package/dist/cli/upgrade.js +7 -7
- package/dist/db/schema/conversation-participants.d.ts +17 -0
- package/dist/db/schema/conversations.d.ts +629 -1
- package/dist/db/schema/scheduled-tasks.d.ts +29 -5
- package/dist/db/schema/snapshots.d.ts +1 -1
- package/dist/db/schema.d.ts +46 -5
- package/dist/{db-A3CB76US.js → db-EJAV7JL6.js} +7 -7
- package/dist/instrumentation.js +4 -4
- package/dist/nitro.js +2 -2
- package/dist/{oauth-callback-server-64QMI3IB.js → oauth-callback-server-GAVSUBTQ.js} +23 -23
- package/dist/{runner-EIAE2BGD.js → runner-34JL64JF.js} +15 -15
- package/dist/{skills-ZADWFKDG.js → skills-U545HALM.js} +6 -6
- package/dist/spawn-I2S4IDUQ.js +37 -0
- package/dist/{validation-4I6AF4CV.js → validation-EVXVGA44.js} +6 -6
- package/dist/version.js +1 -1
- package/dist/{work-BS6BZ66U.js → work-QOAUPDBU.js} +18 -18
- package/dist/worker-5GX2IKLZ.js +24 -0
- package/migrations/0033_workspace_snapshot_active_build.sql +1 -0
- package/migrations/0034_strong_randall.sql +31 -0
- package/migrations/meta/0033_snapshot.json +2914 -0
- package/migrations/meta/0034_snapshot.json +3038 -0
- package/migrations/meta/_journal.json +15 -1
- package/package.json +4 -4
- package/dist/chat/scheduled-tasks/store.d.ts +0 -78
- package/dist/chunk-4TRHPYTL.js +0 -1944
- package/dist/spawn-DVUOUFFC.js +0 -37
- package/dist/worker-RS5PWTCE.js +0 -24
|
@@ -1,21 +1,19 @@
|
|
|
1
1
|
import {
|
|
2
2
|
SANDBOX_WORKSPACE_ROOT,
|
|
3
3
|
create,
|
|
4
|
+
getVercelSandboxCredentials,
|
|
5
|
+
isSandboxUnavailableError,
|
|
4
6
|
isStale,
|
|
5
7
|
runNonInteractiveCommand,
|
|
6
8
|
sleep
|
|
7
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-JMJNFEDC.js";
|
|
8
10
|
import {
|
|
9
11
|
getStateAdapter
|
|
10
|
-
} from "./chunk-
|
|
11
|
-
import {
|
|
12
|
-
toOptionalTrimmed
|
|
13
|
-
} from "./chunk-DLTP6TUJ.js";
|
|
12
|
+
} from "./chunk-3TM3FYLQ.js";
|
|
14
13
|
import {
|
|
15
14
|
setSpanAttributes,
|
|
16
|
-
setSpanStatus,
|
|
17
15
|
withSpan
|
|
18
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-HQNE5APD.js";
|
|
19
17
|
|
|
20
18
|
// src/chat/sandbox/resources.ts
|
|
21
19
|
var configuredResources;
|
|
@@ -53,18 +51,17 @@ function getSandboxResources() {
|
|
|
53
51
|
import { Sandbox } from "@vercel/sandbox";
|
|
54
52
|
import { z } from "zod";
|
|
55
53
|
|
|
56
|
-
// src/chat/sandbox/credentials.ts
|
|
57
|
-
function getVercelSandboxCredentials() {
|
|
58
|
-
const token = toOptionalTrimmed(process.env.VERCEL_TOKEN);
|
|
59
|
-
const teamId = toOptionalTrimmed(process.env.VERCEL_TEAM_ID);
|
|
60
|
-
const projectId = toOptionalTrimmed(process.env.VERCEL_PROJECT_ID);
|
|
61
|
-
if (token && teamId && projectId) {
|
|
62
|
-
return { token, teamId, projectId };
|
|
63
|
-
}
|
|
64
|
-
return void 0;
|
|
65
|
-
}
|
|
66
|
-
|
|
67
54
|
// src/chat/sandbox/snapshot/span.ts
|
|
55
|
+
function setSnapshotSpanAttributes(snapshot) {
|
|
56
|
+
setSpanAttributes({
|
|
57
|
+
"app.sandbox.source": snapshot.snapshotId ? "snapshot" : "created",
|
|
58
|
+
"app.sandbox.snapshot.cache_hit": snapshot.cacheHit,
|
|
59
|
+
"app.sandbox.snapshot.resolve_outcome": snapshot.resolveOutcome,
|
|
60
|
+
...snapshot.profileHash ? { "app.sandbox.snapshot.profile_hash": snapshot.profileHash } : {},
|
|
61
|
+
"app.sandbox.snapshot.dependency_count": snapshot.dependencyCount,
|
|
62
|
+
...snapshot.rebuildReason ? { "app.sandbox.snapshot.rebuild_reason": snapshot.rebuildReason } : {}
|
|
63
|
+
});
|
|
64
|
+
}
|
|
68
65
|
async function trace(name, op, attributes, callback) {
|
|
69
66
|
return await withSpan(name, op, {}, callback, attributes);
|
|
70
67
|
}
|
|
@@ -82,12 +79,13 @@ async function tryRun(sandbox, params) {
|
|
|
82
79
|
const result = await runNonInteractiveCommand(sandbox, params);
|
|
83
80
|
return result.exitCode === 0;
|
|
84
81
|
}
|
|
85
|
-
async function installGh(sandbox, signal) {
|
|
82
|
+
async function installGh(sandbox, signal, timeoutMs) {
|
|
86
83
|
const installed = await tryRun(sandbox, {
|
|
87
84
|
cmd: "dnf",
|
|
88
85
|
args: ["install", "-y", "gh"],
|
|
89
86
|
signal,
|
|
90
|
-
sudo: true
|
|
87
|
+
sudo: true,
|
|
88
|
+
timeoutMs
|
|
91
89
|
});
|
|
92
90
|
if (installed) {
|
|
93
91
|
return;
|
|
@@ -100,7 +98,8 @@ async function installGh(sandbox, signal) {
|
|
|
100
98
|
"--from-repofile=https://cli.github.com/packages/rpm/gh-cli.repo"
|
|
101
99
|
],
|
|
102
100
|
signal,
|
|
103
|
-
sudo: true
|
|
101
|
+
sudo: true,
|
|
102
|
+
timeoutMs
|
|
104
103
|
});
|
|
105
104
|
if (!repoAdded) {
|
|
106
105
|
await runOrThrow(
|
|
@@ -109,7 +108,8 @@ async function installGh(sandbox, signal) {
|
|
|
109
108
|
cmd: "dnf",
|
|
110
109
|
args: ["install", "-y", "dnf-command(config-manager)"],
|
|
111
110
|
signal,
|
|
112
|
-
sudo: true
|
|
111
|
+
sudo: true,
|
|
112
|
+
timeoutMs
|
|
113
113
|
},
|
|
114
114
|
"dnf install dnf-command(config-manager)"
|
|
115
115
|
);
|
|
@@ -123,7 +123,8 @@ async function installGh(sandbox, signal) {
|
|
|
123
123
|
"https://cli.github.com/packages/rpm/gh-cli.repo"
|
|
124
124
|
],
|
|
125
125
|
signal,
|
|
126
|
-
sudo: true
|
|
126
|
+
sudo: true,
|
|
127
|
+
timeoutMs
|
|
127
128
|
},
|
|
128
129
|
"dnf config-manager --add-repo gh-cli.repo"
|
|
129
130
|
);
|
|
@@ -134,7 +135,8 @@ async function installGh(sandbox, signal) {
|
|
|
134
135
|
cmd: "dnf",
|
|
135
136
|
args: ["install", "-y", "gh", "--repo", "gh-cli"],
|
|
136
137
|
signal,
|
|
137
|
-
sudo: true
|
|
138
|
+
sudo: true,
|
|
139
|
+
timeoutMs
|
|
138
140
|
},
|
|
139
141
|
"dnf install gh --repo gh-cli"
|
|
140
142
|
);
|
|
@@ -151,21 +153,23 @@ function filePath(url, sha256) {
|
|
|
151
153
|
const sanitized = basename.replace(/[^a-zA-Z0-9._-]/g, "_");
|
|
152
154
|
return `/tmp/junior-runtime-${sha256.slice(0, 12)}-${sanitized}`;
|
|
153
155
|
}
|
|
154
|
-
async function installUrl(sandbox, dependency, signal) {
|
|
156
|
+
async function installUrl(sandbox, dependency, signal, timeoutMs) {
|
|
155
157
|
const rpmPath = filePath(dependency.url, dependency.sha256);
|
|
156
158
|
await runOrThrow(
|
|
157
159
|
sandbox,
|
|
158
160
|
{
|
|
159
161
|
cmd: "curl",
|
|
160
162
|
args: ["-fsSL", dependency.url, "-o", rpmPath],
|
|
161
|
-
signal
|
|
163
|
+
signal,
|
|
164
|
+
timeoutMs
|
|
162
165
|
},
|
|
163
166
|
`curl download ${dependency.url}`
|
|
164
167
|
);
|
|
165
168
|
const checksum = await runNonInteractiveCommand(sandbox, {
|
|
166
169
|
cmd: "sha256sum",
|
|
167
170
|
args: [rpmPath],
|
|
168
|
-
signal
|
|
171
|
+
signal,
|
|
172
|
+
timeoutMs
|
|
169
173
|
});
|
|
170
174
|
const expected = dependency.sha256;
|
|
171
175
|
const actual = checksum.stdout.trim().split(/\s+/)[0]?.toLowerCase();
|
|
@@ -187,12 +191,13 @@ async function installUrl(sandbox, dependency, signal) {
|
|
|
187
191
|
cmd: "dnf",
|
|
188
192
|
args: ["install", "-y", rpmPath],
|
|
189
193
|
signal,
|
|
190
|
-
sudo: true
|
|
194
|
+
sudo: true,
|
|
195
|
+
timeoutMs
|
|
191
196
|
},
|
|
192
197
|
`dnf install ${dependency.url}`
|
|
193
198
|
);
|
|
194
199
|
}
|
|
195
|
-
async function dependencies(sandbox, values, signal) {
|
|
200
|
+
async function dependencies(sandbox, values, signal, timeoutMs) {
|
|
196
201
|
const system = values.filter(
|
|
197
202
|
(dependency) => dependency.type === "system"
|
|
198
203
|
);
|
|
@@ -210,9 +215,9 @@ async function dependencies(sandbox, values, signal) {
|
|
|
210
215
|
for (const dependency of system) {
|
|
211
216
|
signal?.throwIfAborted();
|
|
212
217
|
if ("url" in dependency) {
|
|
213
|
-
await installUrl(sandbox, dependency, signal);
|
|
218
|
+
await installUrl(sandbox, dependency, signal, timeoutMs);
|
|
214
219
|
} else if (dependency.package === "gh") {
|
|
215
|
-
await installGh(sandbox, signal);
|
|
220
|
+
await installGh(sandbox, signal, timeoutMs);
|
|
216
221
|
} else {
|
|
217
222
|
await runOrThrow(
|
|
218
223
|
sandbox,
|
|
@@ -220,7 +225,8 @@ async function dependencies(sandbox, values, signal) {
|
|
|
220
225
|
cmd: "dnf",
|
|
221
226
|
args: ["install", "-y", dependency.package],
|
|
222
227
|
signal,
|
|
223
|
-
sudo: true
|
|
228
|
+
sudo: true,
|
|
229
|
+
timeoutMs
|
|
224
230
|
},
|
|
225
231
|
`dnf install ${dependency.package}`
|
|
226
232
|
);
|
|
@@ -248,7 +254,8 @@ async function dependencies(sandbox, values, signal) {
|
|
|
248
254
|
`${SANDBOX_WORKSPACE_ROOT}/.junior`,
|
|
249
255
|
...npm
|
|
250
256
|
],
|
|
251
|
-
signal
|
|
257
|
+
signal,
|
|
258
|
+
timeoutMs
|
|
252
259
|
},
|
|
253
260
|
"npm install"
|
|
254
261
|
);
|
|
@@ -256,7 +263,7 @@ async function dependencies(sandbox, values, signal) {
|
|
|
256
263
|
);
|
|
257
264
|
}
|
|
258
265
|
}
|
|
259
|
-
async function postinstall(sandbox, commands, signal) {
|
|
266
|
+
async function postinstall(sandbox, commands, signal, timeoutMs) {
|
|
260
267
|
if (commands.length === 0) {
|
|
261
268
|
return;
|
|
262
269
|
}
|
|
@@ -275,6 +282,7 @@ async function postinstall(sandbox, commands, signal) {
|
|
|
275
282
|
login: true,
|
|
276
283
|
pathPrefix: `${SANDBOX_WORKSPACE_ROOT}/.junior/bin:$PATH`,
|
|
277
284
|
signal,
|
|
285
|
+
timeoutMs,
|
|
278
286
|
...command.sudo !== void 0 ? { sudo: command.sudo } : {}
|
|
279
287
|
});
|
|
280
288
|
if (result.exitCode !== 0) {
|
|
@@ -292,240 +300,6 @@ async function postinstall(sandbox, commands, signal) {
|
|
|
292
300
|
import {
|
|
293
301
|
FileSystem
|
|
294
302
|
} from "@vercel/sandbox";
|
|
295
|
-
|
|
296
|
-
// src/chat/sandbox/http-error-details.ts
|
|
297
|
-
var DEFAULT_PREVIEW_LIMIT = 512;
|
|
298
|
-
function toTrimmedString(value, maxChars) {
|
|
299
|
-
if (typeof value !== "string") {
|
|
300
|
-
return void 0;
|
|
301
|
-
}
|
|
302
|
-
const normalized = value.trim();
|
|
303
|
-
if (!normalized) {
|
|
304
|
-
return void 0;
|
|
305
|
-
}
|
|
306
|
-
return normalized.length > maxChars ? `${normalized.slice(0, maxChars)}\u2026` : normalized;
|
|
307
|
-
}
|
|
308
|
-
function extractHttpErrorDetails(error, options = {}) {
|
|
309
|
-
const prefix = options.attributePrefix ?? "app.http_error";
|
|
310
|
-
const previewLimit = options.previewLimit ?? DEFAULT_PREVIEW_LIMIT;
|
|
311
|
-
const normalizedError = error instanceof Error ? error : new Error(String(error));
|
|
312
|
-
const err = error ?? {};
|
|
313
|
-
const attributes = {
|
|
314
|
-
"error.type": normalizedError.name || "Error",
|
|
315
|
-
"exception.message": toTrimmedString(normalizedError.message, previewLimit) ?? "HTTP error"
|
|
316
|
-
};
|
|
317
|
-
const response = err.response;
|
|
318
|
-
const statusCode = typeof response?.status === "number" ? response.status : void 0;
|
|
319
|
-
const statusText = toTrimmedString(response?.statusText, previewLimit);
|
|
320
|
-
const responseUrl = toTrimmedString(response?.url, previewLimit);
|
|
321
|
-
const responseText = toTrimmedString(err.text, previewLimit);
|
|
322
|
-
const responseJson = toTrimmedString(
|
|
323
|
-
err.json && typeof err.json === "object" ? JSON.stringify(err.json) : void 0,
|
|
324
|
-
previewLimit
|
|
325
|
-
);
|
|
326
|
-
const contentType = toTrimmedString(
|
|
327
|
-
response?.headers?.get?.("content-type"),
|
|
328
|
-
previewLimit
|
|
329
|
-
);
|
|
330
|
-
const requestIdHeader = toTrimmedString(
|
|
331
|
-
response?.headers?.get?.("x-request-id"),
|
|
332
|
-
previewLimit
|
|
333
|
-
);
|
|
334
|
-
const vercelIdHeader = toTrimmedString(
|
|
335
|
-
response?.headers?.get?.("x-vercel-id"),
|
|
336
|
-
previewLimit
|
|
337
|
-
);
|
|
338
|
-
const requestId = requestIdHeader ?? vercelIdHeader;
|
|
339
|
-
if (statusCode !== void 0) {
|
|
340
|
-
attributes["http.response.status_code"] = statusCode;
|
|
341
|
-
}
|
|
342
|
-
if (statusText) {
|
|
343
|
-
attributes[`${prefix}.status_text`] = statusText;
|
|
344
|
-
}
|
|
345
|
-
if (responseUrl) {
|
|
346
|
-
attributes["url.full"] = responseUrl;
|
|
347
|
-
}
|
|
348
|
-
if (contentType) {
|
|
349
|
-
attributes["http.response.header.content-type"] = [contentType];
|
|
350
|
-
}
|
|
351
|
-
if (requestIdHeader) {
|
|
352
|
-
attributes["http.response.header.x-request-id"] = [requestIdHeader];
|
|
353
|
-
}
|
|
354
|
-
if (vercelIdHeader) {
|
|
355
|
-
attributes["http.response.header.x-vercel-id"] = [vercelIdHeader];
|
|
356
|
-
}
|
|
357
|
-
if (responseText) {
|
|
358
|
-
attributes[`${prefix}.response_text_preview`] = responseText;
|
|
359
|
-
attributes[`${prefix}.response_text_length`] = responseText.length;
|
|
360
|
-
}
|
|
361
|
-
if (responseJson) {
|
|
362
|
-
attributes[`${prefix}.response_json_preview`] = responseJson;
|
|
363
|
-
}
|
|
364
|
-
const summaryParts = [];
|
|
365
|
-
if (statusCode !== void 0) {
|
|
366
|
-
summaryParts.push(`status=${statusCode}`);
|
|
367
|
-
}
|
|
368
|
-
if (statusText) {
|
|
369
|
-
summaryParts.push(`statusText=${statusText}`);
|
|
370
|
-
}
|
|
371
|
-
if (responseUrl) {
|
|
372
|
-
summaryParts.push(`url=${responseUrl}`);
|
|
373
|
-
}
|
|
374
|
-
if (requestId) {
|
|
375
|
-
summaryParts.push(`requestId=${requestId}`);
|
|
376
|
-
}
|
|
377
|
-
for (const field of options.extraFields ?? []) {
|
|
378
|
-
const value = toTrimmedString(err[field.sourceKey], previewLimit);
|
|
379
|
-
if (!value) {
|
|
380
|
-
continue;
|
|
381
|
-
}
|
|
382
|
-
attributes[`${prefix}.${field.attributeKey}`] = value;
|
|
383
|
-
summaryParts.push(`${field.summaryKey ?? field.attributeKey}=${value}`);
|
|
384
|
-
}
|
|
385
|
-
if (responseJson) {
|
|
386
|
-
summaryParts.push(`json=${responseJson}`);
|
|
387
|
-
} else if (responseText) {
|
|
388
|
-
summaryParts.push(`text=${responseText}`);
|
|
389
|
-
}
|
|
390
|
-
const searchableText = `${normalizedError.message} ${responseText ?? ""} ${responseJson ?? ""}`.toLowerCase();
|
|
391
|
-
return {
|
|
392
|
-
attributes,
|
|
393
|
-
summary: summaryParts.join(", "),
|
|
394
|
-
searchableText
|
|
395
|
-
};
|
|
396
|
-
}
|
|
397
|
-
|
|
398
|
-
// src/chat/sandbox/errors.ts
|
|
399
|
-
var SANDBOX_ERROR_FIELDS = [
|
|
400
|
-
{
|
|
401
|
-
sourceKey: "sandboxId",
|
|
402
|
-
attributeKey: "sandbox_id",
|
|
403
|
-
summaryKey: "sandboxId"
|
|
404
|
-
}
|
|
405
|
-
];
|
|
406
|
-
function getSandboxErrorDetails(error) {
|
|
407
|
-
return extractHttpErrorDetails(error, {
|
|
408
|
-
attributePrefix: "app.sandbox.api_error",
|
|
409
|
-
extraFields: [...SANDBOX_ERROR_FIELDS]
|
|
410
|
-
});
|
|
411
|
-
}
|
|
412
|
-
function findInErrorChain(error, predicate) {
|
|
413
|
-
const seen = /* @__PURE__ */ new Set();
|
|
414
|
-
let current = error;
|
|
415
|
-
while (current && !seen.has(current)) {
|
|
416
|
-
if (predicate(current)) {
|
|
417
|
-
return true;
|
|
418
|
-
}
|
|
419
|
-
seen.add(current);
|
|
420
|
-
current = typeof current === "object" ? current.cause : void 0;
|
|
421
|
-
}
|
|
422
|
-
return false;
|
|
423
|
-
}
|
|
424
|
-
function isRecord(value) {
|
|
425
|
-
return typeof value === "object" && value !== null;
|
|
426
|
-
}
|
|
427
|
-
function isInvalidSandboxSessionError(error) {
|
|
428
|
-
if (!isRecord(error)) {
|
|
429
|
-
return false;
|
|
430
|
-
}
|
|
431
|
-
if (isRecord(error.json) && error.json.invalidToken === true) {
|
|
432
|
-
return true;
|
|
433
|
-
}
|
|
434
|
-
const response = error.response;
|
|
435
|
-
return isRecord(response) && response.status === 403 && typeof response.url === "string" && response.url.includes("/sandboxes/sessions");
|
|
436
|
-
}
|
|
437
|
-
function getFirstErrorMessage(error) {
|
|
438
|
-
const seen = /* @__PURE__ */ new Set();
|
|
439
|
-
let current = error;
|
|
440
|
-
while (current && !seen.has(current)) {
|
|
441
|
-
if (current instanceof Error) {
|
|
442
|
-
const message = current.message.trim();
|
|
443
|
-
if (message) {
|
|
444
|
-
return message;
|
|
445
|
-
}
|
|
446
|
-
}
|
|
447
|
-
seen.add(current);
|
|
448
|
-
current = typeof current === "object" ? current.cause : void 0;
|
|
449
|
-
}
|
|
450
|
-
return void 0;
|
|
451
|
-
}
|
|
452
|
-
function isAlreadyExistsError(error) {
|
|
453
|
-
const details = getSandboxErrorDetails(error);
|
|
454
|
-
return details.searchableText.includes("already exists") || details.searchableText.includes("file exists") || details.searchableText.includes("eexist");
|
|
455
|
-
}
|
|
456
|
-
function isSandboxUnavailableError(error) {
|
|
457
|
-
return findInErrorChain(error, (candidate) => {
|
|
458
|
-
if (isInvalidSandboxSessionError(candidate)) {
|
|
459
|
-
return true;
|
|
460
|
-
}
|
|
461
|
-
const details = getSandboxErrorDetails(candidate);
|
|
462
|
-
const searchable = `${details.searchableText} ${details.summary}`.toLowerCase();
|
|
463
|
-
return searchable.includes("sandbox_stopped") || searchable.includes("status=410") || searchable.includes("status code 410") || searchable.includes("no longer available") || searchable.includes("stream was closed and is not accepting commands");
|
|
464
|
-
});
|
|
465
|
-
}
|
|
466
|
-
function isSandboxMissingError(error) {
|
|
467
|
-
return findInErrorChain(error, (candidate) => {
|
|
468
|
-
const details = getSandboxErrorDetails(candidate);
|
|
469
|
-
const searchable = `${details.searchableText} ${details.summary}`.toLowerCase();
|
|
470
|
-
return searchable.includes("status=404") || searchable.includes("status code 404") || searchable.includes("snapshot_not_found");
|
|
471
|
-
});
|
|
472
|
-
}
|
|
473
|
-
function isSnapshottingError(error) {
|
|
474
|
-
return findInErrorChain(error, (candidate) => {
|
|
475
|
-
const details = getSandboxErrorDetails(candidate);
|
|
476
|
-
const searchable = `${details.searchableText} ${details.summary}`.toLowerCase();
|
|
477
|
-
return searchable.includes("sandbox_snapshotting") || searchable.includes("creating a snapshot") || searchable.includes("stopped shortly");
|
|
478
|
-
});
|
|
479
|
-
}
|
|
480
|
-
function isSandboxCommandStreamInterruptedError(error) {
|
|
481
|
-
return findInErrorChain(error, (candidate) => {
|
|
482
|
-
if (!(candidate instanceof Error)) {
|
|
483
|
-
return false;
|
|
484
|
-
}
|
|
485
|
-
return candidate.name === "StreamError" && candidate.message.toLowerCase().includes("stream ended before command finished");
|
|
486
|
-
});
|
|
487
|
-
}
|
|
488
|
-
function wrapSandboxSetupError(error) {
|
|
489
|
-
try {
|
|
490
|
-
const details = getSandboxErrorDetails(error);
|
|
491
|
-
if (details.summary) {
|
|
492
|
-
return new Error(`sandbox setup failed (${details.summary})`, {
|
|
493
|
-
cause: error
|
|
494
|
-
});
|
|
495
|
-
}
|
|
496
|
-
} catch {
|
|
497
|
-
}
|
|
498
|
-
let causeMessage;
|
|
499
|
-
try {
|
|
500
|
-
causeMessage = getFirstErrorMessage(error);
|
|
501
|
-
} catch (cause) {
|
|
502
|
-
causeMessage = cause instanceof Error ? cause.message : void 0;
|
|
503
|
-
}
|
|
504
|
-
if (causeMessage && causeMessage.trim() && causeMessage !== "sandbox setup failed") {
|
|
505
|
-
const oneLine = causeMessage.replace(/\s+/g, " ").trim();
|
|
506
|
-
return new Error(`sandbox setup failed (${oneLine})`, { cause: error });
|
|
507
|
-
}
|
|
508
|
-
return new Error("sandbox setup failed", { cause: error });
|
|
509
|
-
}
|
|
510
|
-
function throwSandboxOperationError(action, error, includeMissingPath = false) {
|
|
511
|
-
const details = getSandboxErrorDetails(error);
|
|
512
|
-
setSpanAttributes({
|
|
513
|
-
...details.attributes,
|
|
514
|
-
...includeMissingPath ? {
|
|
515
|
-
"app.sandbox.api_error.missing_path": details.searchableText.includes("no such file") || details.searchableText.includes("enoent")
|
|
516
|
-
} : {},
|
|
517
|
-
"app.sandbox.success": false
|
|
518
|
-
});
|
|
519
|
-
setSpanStatus("error");
|
|
520
|
-
throw new Error(
|
|
521
|
-
details.summary ? `${action} failed (${details.summary})` : `${action} failed`,
|
|
522
|
-
{
|
|
523
|
-
cause: error
|
|
524
|
-
}
|
|
525
|
-
);
|
|
526
|
-
}
|
|
527
|
-
|
|
528
|
-
// src/chat/sandbox/workspace.ts
|
|
529
303
|
function bindSandboxFileSystem(fs, signal) {
|
|
530
304
|
if (!signal) {
|
|
531
305
|
return fs;
|
|
@@ -917,17 +691,12 @@ function isMissingError(error) {
|
|
|
917
691
|
}
|
|
918
692
|
|
|
919
693
|
export {
|
|
920
|
-
isAlreadyExistsError,
|
|
921
|
-
isSandboxUnavailableError,
|
|
922
|
-
isSandboxMissingError,
|
|
923
|
-
isSnapshottingError,
|
|
924
|
-
isSandboxCommandStreamInterruptedError,
|
|
925
|
-
wrapSandboxSetupError,
|
|
926
|
-
throwSandboxOperationError,
|
|
927
|
-
getVercelSandboxCredentials,
|
|
928
694
|
getSandboxResourceConfig,
|
|
929
695
|
setSandboxResourceConfig,
|
|
930
696
|
getSandboxResources,
|
|
697
|
+
setSnapshotSpanAttributes,
|
|
698
|
+
dependencies,
|
|
699
|
+
postinstall,
|
|
931
700
|
bindSandboxFileSystem,
|
|
932
701
|
createSandboxSession,
|
|
933
702
|
stopSession,
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import {
|
|
2
2
|
persistConversationMessages
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-FIDMHAO6.js";
|
|
4
4
|
import {
|
|
5
5
|
JUNIOR_THREAD_STATE_TTL_MS
|
|
6
6
|
} from "./chunk-3Y47VMHV.js";
|
|
7
7
|
import {
|
|
8
8
|
getDb
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-VP4OVRDD.js";
|
|
10
10
|
import {
|
|
11
11
|
juniorLocationConfigurations
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-R6U7N4FS.js";
|
|
13
13
|
import {
|
|
14
14
|
getStateAdapter
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-3TM3FYLQ.js";
|
|
16
16
|
import {
|
|
17
17
|
juniorDestinations
|
|
18
18
|
} from "./chunk-VFUK3X5B.js";
|
|
@@ -20,7 +20,7 @@ import {
|
|
|
20
20
|
isRecord,
|
|
21
21
|
toOptionalNumber,
|
|
22
22
|
toOptionalString
|
|
23
|
-
} from "./chunk-
|
|
23
|
+
} from "./chunk-HQNE5APD.js";
|
|
24
24
|
|
|
25
25
|
// src/chat/conversations/turn-lifecycle.ts
|
|
26
26
|
var ConversationTurnLifecycleService = class {
|
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
} from "./chunk-PDO5BLNM.js";
|
|
4
4
|
import {
|
|
5
5
|
ToolInputError
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-3I7XE3PA.js";
|
|
7
7
|
import {
|
|
8
8
|
agentHistoryItemSchema,
|
|
9
9
|
bindProviderConversation,
|
|
@@ -16,25 +16,25 @@ import {
|
|
|
16
16
|
instructionProvenanceFor,
|
|
17
17
|
sanitizePostgresJson,
|
|
18
18
|
withConversationEventLock
|
|
19
|
-
} from "./chunk-
|
|
19
|
+
} from "./chunk-VP4OVRDD.js";
|
|
20
20
|
import {
|
|
21
21
|
SANDBOX_REPOS_ROOT,
|
|
22
22
|
SANDBOX_WORKSPACE_ROOT,
|
|
23
23
|
sleep
|
|
24
|
-
} from "./chunk-
|
|
24
|
+
} from "./chunk-JMJNFEDC.js";
|
|
25
25
|
import {
|
|
26
26
|
MUTATION_LOCK_TTL_MS,
|
|
27
27
|
fenceLock,
|
|
28
28
|
getStateAdapter,
|
|
29
29
|
withLock
|
|
30
|
-
} from "./chunk-
|
|
30
|
+
} from "./chunk-3TM3FYLQ.js";
|
|
31
31
|
import {
|
|
32
32
|
botConfig,
|
|
33
33
|
completeText,
|
|
34
34
|
escapeXml,
|
|
35
35
|
resolveGatewayModel,
|
|
36
36
|
unwrapCurrentInstruction
|
|
37
|
-
} from "./chunk-
|
|
37
|
+
} from "./chunk-GENV6KF2.js";
|
|
38
38
|
import {
|
|
39
39
|
parseSlackMessageTs,
|
|
40
40
|
toStoredSlackActor
|
|
@@ -44,7 +44,7 @@ import {
|
|
|
44
44
|
logException,
|
|
45
45
|
logWarn,
|
|
46
46
|
setSpanAttributes
|
|
47
|
-
} from "./chunk-
|
|
47
|
+
} from "./chunk-HQNE5APD.js";
|
|
48
48
|
|
|
49
49
|
// src/chat/turn-context-tag.ts
|
|
50
50
|
var TURN_CONTEXT_TAG = "runtime-turn-context";
|
|
@@ -1,17 +1,14 @@
|
|
|
1
1
|
import {
|
|
2
2
|
relayLocalOAuthCallback
|
|
3
3
|
} from "./chunk-FA6POGLH.js";
|
|
4
|
-
import {
|
|
5
|
-
getTurnRequestDeadline
|
|
6
|
-
} from "./chunk-6NZRKJWU.js";
|
|
7
4
|
import {
|
|
8
5
|
buildSentryConversationUrl,
|
|
9
6
|
deleteWebAuthorization
|
|
10
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-FTGD2FBP.js";
|
|
11
8
|
import {
|
|
12
9
|
ensureConversationWake,
|
|
13
10
|
requestConversationWork
|
|
14
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-5IRROPA5.js";
|
|
15
12
|
import {
|
|
16
13
|
buildDeliveredTurnStatePatch,
|
|
17
14
|
finalizeFailedTurnReplyWithEvent,
|
|
@@ -24,7 +21,7 @@ import {
|
|
|
24
21
|
requireTurnFailureEventId,
|
|
25
22
|
resolveTurnSessionRouting,
|
|
26
23
|
scheduleSessionCompletedPluginTasks
|
|
27
|
-
} from "./chunk-
|
|
24
|
+
} from "./chunk-KJLHIHFF.js";
|
|
28
25
|
import {
|
|
29
26
|
ConversationTurnLifecycleService,
|
|
30
27
|
coerceThreadConversationState,
|
|
@@ -33,7 +30,7 @@ import {
|
|
|
33
30
|
getPersistedSandboxState,
|
|
34
31
|
getPersistedThreadState,
|
|
35
32
|
persistThreadStateById
|
|
36
|
-
} from "./chunk-
|
|
33
|
+
} from "./chunk-CJLBLELR.js";
|
|
37
34
|
import {
|
|
38
35
|
getVercelConversationWorkQueue
|
|
39
36
|
} from "./chunk-WR76IVA5.js";
|
|
@@ -47,7 +44,10 @@ import {
|
|
|
47
44
|
lookupSlackUserProfile,
|
|
48
45
|
resolvePluginOAuthAccount,
|
|
49
46
|
runAgentWithTimeout
|
|
50
|
-
} from "./chunk-
|
|
47
|
+
} from "./chunk-Q5B3WTGG.js";
|
|
48
|
+
import {
|
|
49
|
+
getTurnRequestDeadline
|
|
50
|
+
} from "./chunk-4GWXAILB.js";
|
|
51
51
|
import {
|
|
52
52
|
RetryableDeliveryError
|
|
53
53
|
} from "./chunk-RF6J3DIO.js";
|
|
@@ -63,13 +63,13 @@ import {
|
|
|
63
63
|
removeReactionFromMessage,
|
|
64
64
|
resolveBaseUrl,
|
|
65
65
|
truncateStatusText
|
|
66
|
-
} from "./chunk-
|
|
66
|
+
} from "./chunk-2HIPYNQI.js";
|
|
67
67
|
import {
|
|
68
68
|
parseSlackThreadId,
|
|
69
69
|
readSlackRawMessageContext,
|
|
70
70
|
resolveSlackChannelIdFromMessage,
|
|
71
71
|
resolveSlackChannelIdFromThreadId
|
|
72
|
-
} from "./chunk-
|
|
72
|
+
} from "./chunk-FAS6AIMF.js";
|
|
73
73
|
import {
|
|
74
74
|
CooperativeTurnYieldError,
|
|
75
75
|
TurnSliceLimitExceededError,
|
|
@@ -96,7 +96,7 @@ import {
|
|
|
96
96
|
recordTurnSummary,
|
|
97
97
|
saveTurnCheckpoint,
|
|
98
98
|
turnHasReply
|
|
99
|
-
} from "./chunk-
|
|
99
|
+
} from "./chunk-FIDMHAO6.js";
|
|
100
100
|
import {
|
|
101
101
|
SlackActionError,
|
|
102
102
|
getDashboardConversationLink,
|
|
@@ -105,18 +105,18 @@ import {
|
|
|
105
105
|
getSlackClient,
|
|
106
106
|
isDmChannel,
|
|
107
107
|
normalizeSlackConversationId
|
|
108
|
-
} from "./chunk-
|
|
108
|
+
} from "./chunk-3I7XE3PA.js";
|
|
109
109
|
import {
|
|
110
110
|
getConversationEventStore,
|
|
111
111
|
getSqlExecutor,
|
|
112
112
|
requireSlackDestination,
|
|
113
113
|
upsertIdentity,
|
|
114
114
|
upsertLinkedIdentity
|
|
115
|
-
} from "./chunk-
|
|
115
|
+
} from "./chunk-VP4OVRDD.js";
|
|
116
116
|
import {
|
|
117
117
|
acquireActiveLock,
|
|
118
118
|
getStateAdapter
|
|
119
|
-
} from "./chunk-
|
|
119
|
+
} from "./chunk-3TM3FYLQ.js";
|
|
120
120
|
import {
|
|
121
121
|
botConfig,
|
|
122
122
|
escapeXml,
|
|
@@ -124,18 +124,18 @@ import {
|
|
|
124
124
|
getRuntimeMetadata,
|
|
125
125
|
normalizeSlackEmojiName,
|
|
126
126
|
standardModelId
|
|
127
|
-
} from "./chunk-
|
|
127
|
+
} from "./chunk-GENV6KF2.js";
|
|
128
128
|
import {
|
|
129
129
|
discoverSkills
|
|
130
|
-
} from "./chunk-
|
|
130
|
+
} from "./chunk-ZQMG3CL5.js";
|
|
131
131
|
import {
|
|
132
132
|
pluginCatalogRuntime
|
|
133
|
-
} from "./chunk-
|
|
133
|
+
} from "./chunk-YFNAMRGE.js";
|
|
134
134
|
import {
|
|
135
135
|
buildOAuthTokenRequest,
|
|
136
136
|
hasRequiredOAuthScope,
|
|
137
137
|
parseOAuthTokenResponse
|
|
138
|
-
} from "./chunk-
|
|
138
|
+
} from "./chunk-SLGGOASN.js";
|
|
139
139
|
import {
|
|
140
140
|
createSlackResumeActor,
|
|
141
141
|
isUserActor,
|
|
@@ -151,7 +151,7 @@ import {
|
|
|
151
151
|
setTags,
|
|
152
152
|
toOptionalString,
|
|
153
153
|
withLogContext
|
|
154
|
-
} from "./chunk-
|
|
154
|
+
} from "./chunk-HQNE5APD.js";
|
|
155
155
|
import {
|
|
156
156
|
homeDir
|
|
157
157
|
} from "./chunk-H4HBKISO.js";
|
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
toCanonicalInputMessage,
|
|
4
4
|
toCanonicalOutputMessage,
|
|
5
5
|
toGenAiMessagesTraceAttributes
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-XSPSCWLH.js";
|
|
7
7
|
import {
|
|
8
8
|
extractGenAiUsageAttributes,
|
|
9
9
|
logException,
|
|
@@ -11,7 +11,7 @@ import {
|
|
|
11
11
|
normalizeGenAiFinishReason,
|
|
12
12
|
serializeGenAiAttribute,
|
|
13
13
|
withSpan
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-HQNE5APD.js";
|
|
15
15
|
|
|
16
16
|
// src/chat/services/provider-error.ts
|
|
17
17
|
var ProviderError = class extends Error {
|