@sentry/junior 0.257.0 → 0.259.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{actor-BTtLaeWy.js → actor-tlxzqaRe.js} +3 -6
- package/dist/adapter-Bn0gFVSF.js +270 -0
- package/dist/{admin-DgIkm6Vy.js → admin-C8xz2f10.js} +2 -3
- package/dist/{agent-hooks-BjtTzvru.js → agent-hooks-B00FaKdP.js} +70 -109
- package/dist/{agent-invocations-Bdu3ROfo.js → agent-invocations-Qfz7dWgU.js} +6 -12
- package/dist/{agent-runner-D7OboVb3.js → agent-runner-CPSd7rKm.js} +324 -742
- package/dist/api/schema.d.ts +442 -447
- package/dist/api/schema.js +6 -6
- package/dist/api.d.ts +2 -12
- package/dist/api.js +165 -158
- package/dist/{app-BsU5QNBd.d.ts → app-Bbxrehjf.d.ts} +25 -45
- package/dist/app.d.ts +3 -3
- package/dist/app.js +206 -321
- package/dist/{assistant-reply-CbTPebzL.js → assistant-reply-CqthTerd.js} +3 -5
- package/dist/{automation-CHdlHVZP.js → automation-DWBFBenG.js} +6 -11
- package/dist/{briefs-oLOldnDM.js → briefs-DNYbQ9cD.js} +8 -11
- package/dist/{cadence-D00SCzT1.js → cadence-R7Em4RjE.js} +1 -2
- package/dist/{catalog-runtime-CZzhGQ7F.js → catalog-runtime-B8SuFPGb.js} +3 -4
- package/dist/cli/chat.d.ts +2 -4
- package/dist/cli/chat.js +22 -24
- package/dist/cli/check.d.ts +1 -3
- package/dist/cli/check.js +4 -5
- package/dist/cli/env.d.ts +1 -3
- package/dist/cli/env.js +1 -2
- package/dist/cli/init.d.ts +1 -3
- package/dist/cli/init.js +3 -3
- package/dist/cli/main.d.ts +1 -3
- package/dist/cli/main.js +8 -5
- package/dist/cli/plugins.d.ts +2 -4
- package/dist/cli/plugins.js +7 -8
- package/dist/cli/run.d.ts +3 -3
- package/dist/cli/run.js +3 -3
- package/dist/cli/snapshot-create.d.ts +1 -3
- package/dist/cli/snapshot-create.js +5 -5
- package/dist/cli/upgrade.d.ts +3 -6
- package/dist/cli/upgrade.js +11 -17
- package/dist/{client-D8HnkOQX.js → client-BZdxgKyL.js} +64 -18
- package/dist/{config-CJRnWK9H.js → config-Deqpfpg9.js} +21 -15
- package/dist/{connections-ClYrKzpX.js → connections-9gJkfS85.js} +179 -20
- package/dist/{conversation-CKNLYBJt.js → conversation-DjN3mlog.js} +8 -15
- package/dist/{conversation-privacy-C8b1nphZ.js → conversation-privacy-CFhNKxp-.js} +2 -3
- package/dist/{conversation-work-C6y3T5Hx.js → conversation-work-BaT_T6EB.js} +1 -2
- package/dist/{credential-sync-BXfohNmJ.js → credential-sync-BABGymK3.js} +23 -190
- package/dist/{db-Ca9Nt5ci.d.ts → db-BnRqQ7G5.d.ts} +1 -1
- package/dist/{executor-Do0THDRR.js → executor-Bb3eQb8q.js} +30 -52
- package/dist/{experimental-CQIvMUO7.js → experimental-BNK1l1jv.js} +2 -4
- package/dist/{history-9pO1Zd4Y.js → history-AY8rs-FR.js} +5 -9
- package/dist/{history-DvqWZlYX.d.ts → history-BgI33Kie.d.ts} +12 -20
- package/dist/{images-BN_BiBXF.js → images-BbSdVHC6.js} +5 -6
- package/dist/instrumentation.d.ts +1 -3
- package/dist/instrumentation.js +6 -8
- package/dist/{job-queue-B6SV9uVa.js → job-queue-vdGU-5ge.js} +6 -12
- package/dist/{logging-CWxiIuCF.js → logging-BStXN56b.js} +7 -12
- package/dist/{message-TUOdbSBW.js → message-DRf6m4uO.js} +5 -6
- package/dist/{model-profile-BwU8mqwD.js → model-profile-Bg8EoCKD.js} +2 -4
- package/dist/nitro.d.ts +3 -5
- package/dist/nitro.js +12 -17
- package/dist/{oauth-authorization-BA4Dt6a7.js → oauth-authorization-djQn5Nhy.js} +2 -4
- package/dist/{oauth-callback-server-Dj5UJODo.js → oauth-callback-server-JmOgLcGl.js} +3 -4
- package/dist/{oauth-relay-CdCnu80W.js → oauth-relay-CTygMkNx.js} +2 -3
- package/dist/{package-discovery-BVvSnQBB.js → package-discovery-DJBompdd.js} +17 -21
- package/dist/{pending-auth-s_QFribU.js → pending-auth-rG5U_QS1.js} +92 -83
- package/dist/{plugin-module-CVvEUSMH.js → plugin-module-Cf5gVPWP.js} +1 -2
- package/dist/{plugins-CjfUP5gJ.d.ts → plugins-B_0Cr0MO.d.ts} +5 -5
- package/dist/{plugins-egKWjgue.js → plugins-DOm9Y6qI.js} +2 -3
- package/dist/{private-trace-result-BLvBjy_e.js → private-trace-result-CE7_lEdq.js} +1 -2
- package/dist/{profile-h-72wM78.js → profile-qBM6B_-V.js} +14 -295
- package/dist/{prompt-DyoEj9c2.js → prompt-xgpyMtg7.js} +5 -9
- package/dist/{queue-B5SnqRln.d.ts → queue-C37RbDVc.d.ts} +0 -2
- package/dist/{registry-sLTr-sV9.js → registry-B_M_x_iS.js} +56 -30
- package/dist/{resolve-ncQPZROQ.js → resolve-BzpuLh8c.js} +8 -12
- package/dist/{result-C883vngT.js → result-DEZH_AnZ.js} +13 -17
- package/dist/{rolldown-runtime-B4FMCO8f.js → rolldown-runtime-nwUcYXjP.js} +1 -2
- package/dist/{runner-CzYImdOF.js → runner-BqQlG10t.js} +12 -13
- package/dist/{sandbox-egress-signals-CZbMINHI.js → sandbox-egress-signals-DCq3WLs5.js} +2 -3
- package/dist/{schema-Dy69D4Ge.js → schema-CF9HqNRY.js} +30 -27
- package/dist/{sentry-CgWZM_kV.js → sentry-BBUlHih9.js} +2 -3
- package/dist/service-account-BqTBkyD7.js +120 -0
- package/dist/service-account-BzhW7kXu.js +661 -0
- package/dist/{session-stop-CQjKd4a2.js → session-stop-CV65ZlU3.js} +23 -33
- package/dist/{skills-C22SLruK.js → skills-CiWS5_Ub.js} +9 -9
- package/dist/{spawn-DY9CLXDL.js → spawn-BSAQ7UQZ.js} +4 -5
- package/dist/{store-DXFIQy-G.js → store-B1GES4gC.js} +13 -15
- package/dist/{store-DoewL5mG.d.ts → store-CG0VJyye.d.ts} +0 -14
- package/dist/{task-queue-B17vV0La.js → task-queue-BAeGEMjJ.js} +5 -7
- package/dist/{task-runner-DUjvzYXj.js → task-runner-BlGhcQPi.js} +22 -26
- package/dist/{tasks-D_WIJtvO.js → tasks-DieKX3d4.js} +63 -78
- package/dist/{thread-state-Ch4yuCqG.js → thread-state-DpSWS4Rr.js} +13 -19
- package/dist/{turn-failure-response-C5nBKC4S.js → turn-failure-response-DQljogGJ.js} +16 -22
- package/dist/{turn-lifecycle-CO-ylUmV.js → turn-lifecycle-BLgrkV_L.js} +2 -3
- package/dist/{turn-session-routing-B3LWooK5.js → turn-session-routing-BlajheOU.js} +2 -3
- package/dist/{validation-CXYxaNYx.js → validation-23d7K9tX.js} +3 -4
- package/dist/vercel.d.ts +1 -3
- package/dist/vercel.js +1 -2
- package/dist/{version-BcdZy2zg.js → version-B_XumRx-.js} +3 -5
- package/dist/{version-CnXZ614E.d.ts → version-Cc2OFd9G.d.ts} +0 -2
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -2
- package/dist/{viewer-DSZXygMU.js → viewer-B2_ABsYi.js} +26 -57
- package/dist/{web-input-B9Bv0_lR.js → web-input-BZDyxpzR.js} +101 -158
- package/dist/{web-message-id-xPI_EFSC.js → web-message-id-CJSUiksE.js} +3 -6
- package/dist/{work-nAfDSUFP.js → work-D3QKiV0O.js} +14 -16
- package/dist/{worker-vGXZ6XFT.js → worker-C8mUjYf9.js} +7 -8
- package/package.json +10 -9
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import { T as withSpan, y as setSpanAttributes } from "./logging-
|
|
2
|
-
import {
|
|
1
|
+
import { T as withSpan, y as setSpanAttributes } from "./logging-BStXN56b.js";
|
|
2
|
+
import { E as SANDBOX_WORKSPACE_ROOT, S as sleep, r as isStale, t as create, u as isSandboxUnavailableError, v as getVercelSandboxCredentials, x as runNonInteractiveCommand } from "./profile-qBM6B_-V.js";
|
|
3
|
+
import { r as getStateAdapter } from "./adapter-Bn0gFVSF.js";
|
|
3
4
|
import { z } from "zod";
|
|
4
5
|
import { FileSystem, Sandbox } from "@vercel/sandbox";
|
|
5
|
-
|
|
6
|
+
// src/chat/sandbox/resources.ts
|
|
6
7
|
let configuredResources;
|
|
7
8
|
function resourcesFromEnv() {
|
|
8
9
|
const value = process.env.SANDBOX_VCPUS?.trim();
|
|
@@ -30,8 +31,7 @@ function setSandboxResourceConfig(config) {
|
|
|
30
31
|
function getSandboxResources() {
|
|
31
32
|
return configuredResources ?? resourcesFromEnv();
|
|
32
33
|
}
|
|
33
|
-
|
|
34
|
-
//#region src/chat/sandbox/snapshot/span.ts
|
|
34
|
+
// src/chat/sandbox/snapshot/span.ts
|
|
35
35
|
/** Record the reusable snapshot selected for a new Sandbox. */
|
|
36
36
|
function setSnapshotSpanAttributes(snapshot) {
|
|
37
37
|
setSpanAttributes({
|
|
@@ -47,8 +47,7 @@ function setSnapshotSpanAttributes(snapshot) {
|
|
|
47
47
|
async function trace(name, op, attributes, callback) {
|
|
48
48
|
return await withSpan(name, op, {}, callback, attributes);
|
|
49
49
|
}
|
|
50
|
-
|
|
51
|
-
//#region src/chat/sandbox/snapshot/install.ts
|
|
50
|
+
// src/chat/sandbox/snapshot/install.ts
|
|
52
51
|
async function runOrThrow(sandbox, params, label) {
|
|
53
52
|
const result = await runNonInteractiveCommand(sandbox, params);
|
|
54
53
|
if (result.exitCode === 0) return;
|
|
@@ -225,8 +224,7 @@ async function postinstall(sandbox, commands, signal, timeoutMs) {
|
|
|
225
224
|
}
|
|
226
225
|
});
|
|
227
226
|
}
|
|
228
|
-
|
|
229
|
-
//#region src/chat/sandbox/workspace.ts
|
|
227
|
+
// src/chat/sandbox/workspace.ts
|
|
230
228
|
/** Bind one tool call's cancellation to every sandbox filesystem operation. */
|
|
231
229
|
function bindSandboxFileSystem(fs, signal) {
|
|
232
230
|
if (!signal) return fs;
|
|
@@ -317,8 +315,7 @@ async function stopSession(session) {
|
|
|
317
315
|
await session.stop();
|
|
318
316
|
} catch {}
|
|
319
317
|
}
|
|
320
|
-
|
|
321
|
-
//#region src/chat/sandbox/snapshot/resolve.ts
|
|
318
|
+
// src/chat/sandbox/snapshot/resolve.ts
|
|
322
319
|
const SNAPSHOT_CACHE_PREFIX = "junior:sandbox_snapshot_profile:v2";
|
|
323
320
|
const SNAPSHOT_LOCK_PREFIX = "junior:sandbox_snapshot_lock";
|
|
324
321
|
const SNAPSHOT_CACHE_TTL_MS = 2592e6;
|
|
@@ -542,5 +539,4 @@ function isMissingError(error) {
|
|
|
542
539
|
const searchable = error instanceof Error ? error.message.toLowerCase() : String(error).toLowerCase();
|
|
543
540
|
return searchable.includes("snapshot") && (searchable.includes("not found") || searchable.includes("unknown") || searchable.includes("404"));
|
|
544
541
|
}
|
|
545
|
-
//#endregion
|
|
546
542
|
export { createSandboxSession as a, postinstall as c, getSandboxResources as d, setSandboxResourceConfig as f, bindSandboxFileSystem as i, setSnapshotSpanAttributes as l, isMissingError as n, stopSession as o, resolve as r, dependencies as s, getCachedSnapshot as t, getSandboxResourceConfig as u };
|
|
@@ -1,21 +1,20 @@
|
|
|
1
|
-
import { t as __exportAll } from "./rolldown-runtime-
|
|
2
|
-
import { $ as getAgentInvocation, X as createAgentInvocationFromLatest, ct as isTerminalAgentInvocation, et as getAgentInvocationIdForEvents, ft as markAgentInvocationParentMailboxAppended, it as getAgentInvocationResultMessageId, nt as getAgentInvocationIdForResult, st as getLatestAgentInvocationForConversation, tt as getAgentInvocationIdForMessage } from "./agent-runner-
|
|
3
|
-
import { t as createActor } from "./actor-
|
|
4
|
-
import { f as credentialContextForActor } from "./registry-
|
|
5
|
-
import { Q as listTurnSummaries, Z as getTurnRecord } from "./tasks-
|
|
6
|
-
import { a as EVENT_WAIT_MS, c as timerWatchCredentialSubject, s as isEventMailboxMetadata } from "./session-stop-
|
|
7
|
-
import { a as EVENT_SYSTEM_ACTOR, i as EVENT_MESSAGE_AUTHOR, o as isEventConversationMessage } from "./prompt-
|
|
8
|
-
import { r as appendAndEnqueueInboundMessage } from "./store-
|
|
9
|
-
import { r as enqueueAgentInvocation } from "./work-
|
|
1
|
+
import { t as __exportAll } from "./rolldown-runtime-nwUcYXjP.js";
|
|
2
|
+
import { $ as getAgentInvocation, X as createAgentInvocationFromLatest, ct as isTerminalAgentInvocation, et as getAgentInvocationIdForEvents, ft as markAgentInvocationParentMailboxAppended, it as getAgentInvocationResultMessageId, nt as getAgentInvocationIdForResult, st as getLatestAgentInvocationForConversation, tt as getAgentInvocationIdForMessage } from "./agent-runner-CPSd7rKm.js";
|
|
3
|
+
import { t as createActor } from "./actor-tlxzqaRe.js";
|
|
4
|
+
import { f as credentialContextForActor } from "./registry-B_M_x_iS.js";
|
|
5
|
+
import { Q as listTurnSummaries, Z as getTurnRecord } from "./tasks-DieKX3d4.js";
|
|
6
|
+
import { a as EVENT_WAIT_MS, c as timerWatchCredentialSubject, s as isEventMailboxMetadata } from "./session-stop-CV65ZlU3.js";
|
|
7
|
+
import { a as EVENT_SYSTEM_ACTOR, i as EVENT_MESSAGE_AUTHOR, o as isEventConversationMessage } from "./prompt-xgpyMtg7.js";
|
|
8
|
+
import { r as appendAndEnqueueInboundMessage } from "./store-B1GES4gC.js";
|
|
9
|
+
import { r as enqueueAgentInvocation } from "./work-D3QKiV0O.js";
|
|
10
10
|
import { z } from "zod";
|
|
11
11
|
import { createEventSource, createLocalSource, createWebSource } from "@sentry/junior-plugin-api";
|
|
12
|
-
|
|
12
|
+
// src/chat/task-execution/mailbox-input.ts
|
|
13
13
|
/** Join non-empty mailbox Message text for one Turn. */
|
|
14
14
|
function joinMailboxText(messages) {
|
|
15
15
|
return messages.map((message) => message.input.text.trim()).filter(Boolean).join("\n\n");
|
|
16
16
|
}
|
|
17
|
-
|
|
18
|
-
//#region src/chat/conversations/web-mailbox.ts
|
|
17
|
+
// src/chat/conversations/web-mailbox.ts
|
|
19
18
|
/** Parse web mailbox metadata written before Source and Actor were complete. */
|
|
20
19
|
const legacyWebMailboxMetadataSchema = z.object({
|
|
21
20
|
authorEmail: z.string().email(),
|
|
@@ -25,8 +24,7 @@ const legacyWebMailboxMetadataSchema = z.object({
|
|
|
25
24
|
kind: z.literal("api_turn"),
|
|
26
25
|
messageId: z.string().min(1)
|
|
27
26
|
}).strict();
|
|
28
|
-
|
|
29
|
-
//#region src/chat/task-execution/mailbox-turn.ts
|
|
27
|
+
// src/chat/task-execution/mailbox-turn.ts
|
|
30
28
|
/**
|
|
31
29
|
* Restore Turn input facts, with saved Message fallback for legacy cursors.
|
|
32
30
|
*
|
|
@@ -171,8 +169,7 @@ async function resolveMailboxTurnWork(context) {
|
|
|
171
169
|
turnId
|
|
172
170
|
} : void 0;
|
|
173
171
|
}
|
|
174
|
-
|
|
175
|
-
//#region src/chat/agent-invocations/result.ts
|
|
172
|
+
// src/chat/agent-invocations/result.ts
|
|
176
173
|
var result_exports = /* @__PURE__ */ __exportAll({
|
|
177
174
|
enqueueAgentInvocationResult: () => enqueueAgentInvocationResult,
|
|
178
175
|
enqueueAgentMessageToParent: () => enqueueAgentMessageToParent,
|
|
@@ -459,5 +456,4 @@ async function withAgentInvocationResultActors(work) {
|
|
|
459
456
|
}))
|
|
460
457
|
};
|
|
461
458
|
}
|
|
462
|
-
//#endregion
|
|
463
459
|
export { withAgentInvocationResultActors as a, resolveMailboxTurnWork as c, legacyWebMailboxMetadataSchema as d, joinMailboxText as f, startAgentInvocationsForChildInput as i, sourceFromTurnInput as l, enqueueAgentMessageToParent as n, getAuthPausedConversationTurnId as o, result_exports as r, getEventBatchDelayMs as s, enqueueAgentInvocationResult as t, turnInputFactsFromConversationMessage as u };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import "node:module";
|
|
2
|
-
|
|
2
|
+
// \0rolldown/runtime.js
|
|
3
3
|
var __defProp = Object.defineProperty;
|
|
4
4
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
5
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
@@ -24,5 +24,4 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
24
24
|
return to;
|
|
25
25
|
};
|
|
26
26
|
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
27
|
-
//#endregion
|
|
28
27
|
export { __reExport as n, __exportAll as t };
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import { f as logException, w as withLogContext, x as setTags } from "./logging-
|
|
2
|
-
import {
|
|
3
|
-
import { f as credentialContextForActor } from "./registry-
|
|
4
|
-
import { $t as buildConversationContext, Gt as persistConversationMessages, It as recordAuthorizationCompleted, Wt as hydrateConversationMessages, an as normalizeConversationText, cn as upsertConversationMessage, et as persistWithRetry, in as markConversationMessage, kt as loadProjection, on as recordDeliveredAssistantMessage, q as saveTurnCheckpoint, wt as commitAcceptedReply } from "./tasks-
|
|
5
|
-
import { K as messageCardText } from "./conversation-
|
|
6
|
-
import { f as markTurnFailed, p as startActiveTurn, t as authorizationId } from "./oauth-authorization-
|
|
7
|
-
import { n as getAssistantReplyText } from "./assistant-reply-
|
|
8
|
-
import { n as scheduleSessionCompletedPluginTasks, t as processPluginTask } from "./task-runner-
|
|
9
|
-
import { t as ConversationTurnLifecycleService } from "./turn-lifecycle-
|
|
10
|
-
import { n as getPersistedSandboxState, o as persistThreadStateById, r as getPersistedThreadState, s as coerceThreadConversationState } from "./thread-state-
|
|
11
|
-
import { d as loadPendingMessageCards, i as completeAuthPauseTurn, l as buildDeliveredTurnStatePatch, t as finalizeFailedTurnReplyWithEvent } from "./turn-failure-response-
|
|
1
|
+
import { f as logException, w as withLogContext, x as setTags } from "./logging-BStXN56b.js";
|
|
2
|
+
import { c as getConversationEventStore, u as getConversationStore } from "./viewer-B2_ABsYi.js";
|
|
3
|
+
import { f as credentialContextForActor } from "./registry-B_M_x_iS.js";
|
|
4
|
+
import { $t as buildConversationContext, Gt as persistConversationMessages, It as recordAuthorizationCompleted, Wt as hydrateConversationMessages, an as normalizeConversationText, cn as upsertConversationMessage, et as persistWithRetry, in as markConversationMessage, kt as loadProjection, on as recordDeliveredAssistantMessage, q as saveTurnCheckpoint, wt as commitAcceptedReply } from "./tasks-DieKX3d4.js";
|
|
5
|
+
import { K as messageCardText } from "./conversation-DjN3mlog.js";
|
|
6
|
+
import { f as markTurnFailed, p as startActiveTurn, t as authorizationId } from "./oauth-authorization-djQn5Nhy.js";
|
|
7
|
+
import { n as getAssistantReplyText } from "./assistant-reply-CqthTerd.js";
|
|
8
|
+
import { n as scheduleSessionCompletedPluginTasks, t as processPluginTask } from "./task-runner-BlGhcQPi.js";
|
|
9
|
+
import { t as ConversationTurnLifecycleService } from "./turn-lifecycle-BLgrkV_L.js";
|
|
10
|
+
import { n as getPersistedSandboxState, o as persistThreadStateById, r as getPersistedThreadState, s as coerceThreadConversationState } from "./thread-state-DpSWS4Rr.js";
|
|
11
|
+
import { d as loadPendingMessageCards, i as completeAuthPauseTurn, l as buildDeliveredTurnStatePatch, t as finalizeFailedTurnReplyWithEvent } from "./turn-failure-response-DQljogGJ.js";
|
|
12
12
|
import { randomUUID } from "node:crypto";
|
|
13
13
|
import { createLocalSource, localDestinationSchema } from "@sentry/junior-plugin-api";
|
|
14
|
-
|
|
14
|
+
// src/chat/local/runner.ts
|
|
15
15
|
/**
|
|
16
16
|
* Local agent turn runtime.
|
|
17
17
|
*
|
|
@@ -399,5 +399,4 @@ async function runLocalAgentTurnInContext(input, deps) {
|
|
|
399
399
|
outcome: reply.diagnostics.outcome
|
|
400
400
|
};
|
|
401
401
|
}
|
|
402
|
-
//#endregion
|
|
403
402
|
export { runLocalAgentTurn };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import { jt as sandboxEgressSignalsResponseSchema } from "./agent-runner-CPSd7rKm.js";
|
|
2
|
+
// src/chat/local/sandbox-egress-signals.ts
|
|
3
3
|
const SANDBOX_EGRESS_SIGNALS_PATH = "/api/internal/sandbox-egress/signals";
|
|
4
4
|
const LOCAL_DEV_SERVER_TIMEOUT_MS = 1e3;
|
|
5
5
|
function signalRequest(baseUrl, credentialToken) {
|
|
@@ -42,5 +42,4 @@ function createLocalSandboxEgressSignalTransport(baseUrl) {
|
|
|
42
42
|
}
|
|
43
43
|
};
|
|
44
44
|
}
|
|
45
|
-
//#endregion
|
|
46
45
|
export { createLocalSandboxEgressSignalTransport };
|
|
@@ -1,14 +1,13 @@
|
|
|
1
|
-
import { r as AGENT_INVOCATION_STATUSES, u as juniorDestinationKindSchema } from "./agent-invocations-
|
|
2
|
-
import { D as conversationUsageSchema, E as conversationSummaryReportSchema, M as conversationChildAgentTotalsSchema, l as conversationAuxiliaryCostsSchema, n as actorIdentitySchema, w as conversationStatsItemSchema } from "./conversation-
|
|
3
|
-
import "./automation-
|
|
4
|
-
import { a as fillUtcHours, c as sumUtcHoursIntoSixHours, i as fillUtcDays } from "./web-message-id-
|
|
1
|
+
import { r as AGENT_INVOCATION_STATUSES, u as juniorDestinationKindSchema } from "./agent-invocations-Qfz7dWgU.js";
|
|
2
|
+
import { D as conversationUsageSchema, E as conversationSummaryReportSchema, M as conversationChildAgentTotalsSchema, l as conversationAuxiliaryCostsSchema, n as actorIdentitySchema, w as conversationStatsItemSchema } from "./conversation-DjN3mlog.js";
|
|
3
|
+
import "./automation-DWBFBenG.js";
|
|
4
|
+
import { a as fillUtcHours, c as sumUtcHoursIntoSixHours, i as fillUtcDays } from "./web-message-id-CJSUiksE.js";
|
|
5
5
|
import { z } from "zod";
|
|
6
6
|
import { codeChangeStateSchema } from "@sentry/junior-plugin-api";
|
|
7
|
-
|
|
7
|
+
// src/api/schema/common.ts
|
|
8
8
|
/** Stable error body returned by Junior-owned REST endpoints. */
|
|
9
9
|
const apiErrorSchema = z.object({ error: z.string().min(1) }).strict();
|
|
10
|
-
|
|
11
|
-
//#region src/api/schema/conversation-stop.ts
|
|
10
|
+
// src/api/schema/conversation-stop.ts
|
|
12
11
|
/** One queued web message from the viewer that a stop removed. */
|
|
13
12
|
const stoppedConversationMessageSchema = z.object({
|
|
14
13
|
inboundMessageId: z.string().min(1),
|
|
@@ -27,8 +26,7 @@ const stopConversationTurnResponseSchema = z.object({
|
|
|
27
26
|
stoppedInboundMessageIds: z.array(z.string().min(1)),
|
|
28
27
|
stoppedMessages: z.array(stoppedConversationMessageSchema)
|
|
29
28
|
}).strict();
|
|
30
|
-
|
|
31
|
-
//#region src/api/schema/child-agent.ts
|
|
29
|
+
// src/api/schema/child-agent.ts
|
|
32
30
|
/**
|
|
33
31
|
* One direct child agent of a Conversation, from agent invocation records.
|
|
34
32
|
*
|
|
@@ -64,8 +62,7 @@ const conversationChildAgentsReportSchema = z.object({
|
|
|
64
62
|
agents: z.array(conversationChildAgentSchema),
|
|
65
63
|
conversationId: z.string().min(1)
|
|
66
64
|
}).strict();
|
|
67
|
-
|
|
68
|
-
//#region src/api/schema/code.ts
|
|
65
|
+
// src/api/schema/code.ts
|
|
69
66
|
const codeChangeSummarySchema = z.object({
|
|
70
67
|
closed: z.number().int().nonnegative(),
|
|
71
68
|
costUsd: z.number().nonnegative().optional(),
|
|
@@ -152,8 +149,7 @@ const codePersonReportSchema = z.object({
|
|
|
152
149
|
windowEnd: z.string(),
|
|
153
150
|
windowStart: z.string()
|
|
154
151
|
}).strict();
|
|
155
|
-
|
|
156
|
-
//#region src/api/schema/connection.ts
|
|
152
|
+
// src/api/schema/connection.ts
|
|
157
153
|
const connectionSchema = z.object({
|
|
158
154
|
provider: z.string(),
|
|
159
155
|
displayName: z.string(),
|
|
@@ -168,8 +164,7 @@ const connectionListSchema = z.object({ connections: z.array(connectionSchema) }
|
|
|
168
164
|
const connectionParamsSchema = z.object({ provider: z.string().regex(/^[a-z][a-z0-9-]*$/).max(64) }).strict();
|
|
169
165
|
const startConnectionResponseSchema = z.object({ authorizationUrl: z.string().url() }).strict();
|
|
170
166
|
const disconnectConnectionResponseSchema = z.object({ disconnected: z.literal(true) }).strict();
|
|
171
|
-
|
|
172
|
-
//#region src/api/activity.ts
|
|
167
|
+
// src/api/activity.ts
|
|
173
168
|
const dailyConversationActivitySchema = z.object({
|
|
174
169
|
active: z.number(),
|
|
175
170
|
conversations: z.number(),
|
|
@@ -221,8 +216,7 @@ function activitySixHours(hours, nowMs) {
|
|
|
221
216
|
nowMs
|
|
222
217
|
});
|
|
223
218
|
}
|
|
224
|
-
|
|
225
|
-
//#region src/api/schema/location.ts
|
|
219
|
+
// src/api/schema/location.ts
|
|
226
220
|
const locationParamsSchema = z.object({ locationId: z.string().min(1) }).strict();
|
|
227
221
|
const locationSummaryReportSchema = conversationStatsItemSchema.extend({
|
|
228
222
|
id: z.string(),
|
|
@@ -263,8 +257,7 @@ const locationDetailReportSchema = locationSummaryReportSchema.extend({
|
|
|
263
257
|
windowEnd: z.string(),
|
|
264
258
|
windowStart: z.string()
|
|
265
259
|
}).strict();
|
|
266
|
-
|
|
267
|
-
//#region src/api/schema/person.ts
|
|
260
|
+
// src/api/schema/person.ts
|
|
268
261
|
const personParamsSchema = z.object({ email: z.string().trim().min(1) }).strict();
|
|
269
262
|
const peopleConversationStatsItemSchema = conversationStatsItemSchema.omit({ costUsd: true });
|
|
270
263
|
/** UTC day (`YYYY-MM-DD`) or hour (`YYYY-MM-DDTHH`) activity bucket key. */
|
|
@@ -344,8 +337,7 @@ const personalSpendReportSchema = z.object({
|
|
|
344
337
|
windowEnd: z.string(),
|
|
345
338
|
windowStart: z.string()
|
|
346
339
|
}).strict();
|
|
347
|
-
|
|
348
|
-
//#region src/api/schema/personal-token.ts
|
|
340
|
+
// src/api/schema/personal-token.ts
|
|
349
341
|
const personalTokenMetadataSchema = z.object({
|
|
350
342
|
id: z.string().uuid(),
|
|
351
343
|
name: z.string(),
|
|
@@ -359,8 +351,21 @@ const createPersonalTokenBodySchema = z.object({ name: z.string().trim().min(1).
|
|
|
359
351
|
const createdPersonalTokenSchema = personalTokenMetadataSchema.extend({ token: z.string().startsWith("jr_pat_") }).strict();
|
|
360
352
|
const personalTokenParamsSchema = z.object({ id: z.string().uuid() }).strict();
|
|
361
353
|
const revokePersonalTokenResponseSchema = z.object({ revoked: z.literal(true) }).strict();
|
|
362
|
-
|
|
363
|
-
|
|
354
|
+
// src/api/schema/service-account.ts
|
|
355
|
+
const serviceAccountSchema = z.object({
|
|
356
|
+
provider: z.string(),
|
|
357
|
+
displayName: z.string(),
|
|
358
|
+
userOAuth: z.boolean(),
|
|
359
|
+
tools: z.array(z.string()),
|
|
360
|
+
connected: z.boolean(),
|
|
361
|
+
connectedAt: z.string().optional(),
|
|
362
|
+
connectedBy: z.string().optional()
|
|
363
|
+
}).strict();
|
|
364
|
+
const serviceAccountListSchema = z.object({ serviceAccounts: z.array(serviceAccountSchema) }).strict();
|
|
365
|
+
const serviceAccountParamsSchema = z.object({ provider: z.string().regex(/^[a-z][a-z0-9-]*$/).max(64) }).strict();
|
|
366
|
+
const startServiceAccountSignInResponseSchema = z.object({ authorizationUrl: z.string().url() }).strict();
|
|
367
|
+
const disconnectServiceAccountResponseSchema = z.object({ disconnected: z.literal(true) }).strict();
|
|
368
|
+
// src/api/schema/workspace.ts
|
|
364
369
|
const workspaceRepoInputSchema = z.object({
|
|
365
370
|
provider: z.string(),
|
|
366
371
|
repo: z.string()
|
|
@@ -401,8 +406,7 @@ const workspaceBodySchema = z.object({
|
|
|
401
406
|
}).strict();
|
|
402
407
|
const workspaceParamsSchema = z.object({ id: z.string().uuid() }).strict();
|
|
403
408
|
const deleteWorkspaceResponseSchema = z.object({ deleted: z.literal(true) }).strict();
|
|
404
|
-
|
|
405
|
-
//#region src/api/schema/stats.ts
|
|
409
|
+
// src/api/schema/stats.ts
|
|
406
410
|
const statSchema = z.object({
|
|
407
411
|
count: z.number().int().nonnegative(),
|
|
408
412
|
date: z.string(),
|
|
@@ -416,5 +420,4 @@ const statsReportSchema = z.object({
|
|
|
416
420
|
windowEnd: z.string(),
|
|
417
421
|
windowStart: z.string()
|
|
418
422
|
}).strict();
|
|
419
|
-
|
|
420
|
-
export { connectionSchema as A, codeRepositorySummarySchema as B, locationParamsSchema as C, dailyConversationActivitySchema as D, activitySixHours as E, codeChangeSummarySchema as F, conversationChildAgentsReportSchema as H, codeOverviewReportSchema as I, codePersonReportSchema as L, startConnectionResponseSchema as M, codeActivityDaySchema as N, connectionListSchema as O, codeChangeSummaryReportSchema as P, codeRepositoryParamsSchema as R, locationDirectoryReportSchema as S, activityHours as T, stopConversationTurnResponseSchema as U, conversationChildAgentSchema as V, apiErrorSchema as W, actorProfileReportSchema as _, workspaceBodySchema as a, locationActivityDayReportSchema as b, workspaceRepoSchema as c, createdPersonalTokenSchema as d, personalTokenListSchema as f, actorDirectoryReportSchema as g, revokePersonalTokenResponseSchema as h, deleteWorkspaceResponseSchema as i, disconnectConnectionResponseSchema as j, connectionParamsSchema as k, workspaceSchema as l, personalTokenParamsSchema as m, statsReportSchema as n, workspaceListSchema as o, personalTokenMetadataSchema as p, baselineSnapshotSchema as r, workspaceParamsSchema as s, statSchema as t, createPersonalTokenBodySchema as u, personParamsSchema as v, activityDays as w, locationDetailReportSchema as x, personalSpendReportSchema as y, codeRepositoryReportSchema as z };
|
|
423
|
+
export { activityHours as A, codeChangeSummarySchema as B, personParamsSchema as C, locationDirectoryReportSchema as D, locationDetailReportSchema as E, connectionSchema as F, codeRepositorySummarySchema as G, codePersonReportSchema as H, disconnectConnectionResponseSchema as I, stopConversationTurnResponseSchema as J, conversationChildAgentSchema as K, startConnectionResponseSchema as L, dailyConversationActivitySchema as M, connectionListSchema as N, locationParamsSchema as O, connectionParamsSchema as P, codeActivityDaySchema as R, actorProfileReportSchema as S, locationActivityDayReportSchema as T, codeRepositoryParamsSchema as U, codeOverviewReportSchema as V, codeRepositoryReportSchema as W, apiErrorSchema as Y, personalTokenListSchema as _, workspaceBodySchema as a, revokePersonalTokenResponseSchema as b, workspaceRepoSchema as c, serviceAccountListSchema as d, serviceAccountParamsSchema as f, createdPersonalTokenSchema as g, createPersonalTokenBodySchema as h, deleteWorkspaceResponseSchema as i, activitySixHours as j, activityDays as k, workspaceSchema as l, startServiceAccountSignInResponseSchema as m, statsReportSchema as n, workspaceListSchema as o, serviceAccountSchema as p, conversationChildAgentsReportSchema as q, baselineSnapshotSchema as r, workspaceParamsSchema as s, statSchema as t, disconnectServiceAccountResponseSchema as u, personalTokenMetadataSchema as v, personalSpendReportSchema as w, actorDirectoryReportSchema as x, personalTokenParamsSchema as y, codeChangeSummaryReportSchema as z };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { t as __exportAll } from "./rolldown-runtime-
|
|
1
|
+
import { t as __exportAll } from "./rolldown-runtime-nwUcYXjP.js";
|
|
2
2
|
import { captureException, captureMessage, continueTrace, flush, getActiveSpan, getClient, getGlobalScope, getTraceData, init, logger, setTag, setUser, spanToJSON, startInactiveSpan, startSpan, startSpanManual, vercelAIIntegration, withActiveSpan, withScope, withStreamedSpan } from "@sentry/node";
|
|
3
|
-
|
|
3
|
+
// src/chat/sentry.ts
|
|
4
4
|
var sentry_exports = /* @__PURE__ */ __exportAll({
|
|
5
5
|
captureException: () => captureException,
|
|
6
6
|
captureMessage: () => captureMessage,
|
|
@@ -23,5 +23,4 @@ var sentry_exports = /* @__PURE__ */ __exportAll({
|
|
|
23
23
|
withScope: () => withScope,
|
|
24
24
|
withStreamedSpan: () => withStreamedSpan
|
|
25
25
|
});
|
|
26
|
-
//#endregion
|
|
27
26
|
export { vercelAIIntegration as _, getClient as a, withStreamedSpan as b, init as c, setTag as d, setUser as f, startSpanManual as g, startSpan as h, getActiveSpan as i, logger as l, startInactiveSpan as m, captureMessage as n, getGlobalScope as o, spanToJSON as p, continueTrace as r, getTraceData as s, captureException as t, sentry_exports as u, withActiveSpan as v, withScope as y };
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
import { n as pluginCatalogRuntime } from "./catalog-runtime-B8SuFPGb.js";
|
|
2
|
+
import { t as disconnectStateAdapter } from "./adapter-Bn0gFVSF.js";
|
|
3
|
+
import { n as finishServiceAccountSignIn, o as serviceAccountPlugins, r as getServiceAccountStatus, s as startServiceAccountSignIn, t as disconnectServiceAccount } from "./service-account-BzhW7kXu.js";
|
|
4
|
+
import { CLI_USAGE } from "./cli/run.js";
|
|
5
|
+
import { createServer } from "node:http";
|
|
6
|
+
// src/cli/service-account.ts
|
|
7
|
+
/**
|
|
8
|
+
* Operator CLI for plugin service accounts.
|
|
9
|
+
*
|
|
10
|
+
* Connecting a service account gives everyone who can talk to Junior the
|
|
11
|
+
* access that the plugin's service account policy allows, to what that
|
|
12
|
+
* account can see. The dashboard Admin page is the main way to connect one.
|
|
13
|
+
* This CLI is the out-of-band fallback. It runs against the deployment state
|
|
14
|
+
* store, and Slack never sees the sign-in link or any token.
|
|
15
|
+
*/
|
|
16
|
+
const SIGN_IN_TIMEOUT_MS = 6e5;
|
|
17
|
+
const CALLBACK_PATH = "/oauth/callback";
|
|
18
|
+
/** Listen on a free loopback port for one OAuth redirect. */
|
|
19
|
+
async function listenForCallback() {
|
|
20
|
+
let resolveCallback = () => {};
|
|
21
|
+
const callback = new Promise((resolve) => {
|
|
22
|
+
resolveCallback = resolve;
|
|
23
|
+
});
|
|
24
|
+
const server = createServer((request, response) => {
|
|
25
|
+
const url = new URL(request.url ?? "/", "http://127.0.0.1");
|
|
26
|
+
if (url.pathname !== CALLBACK_PATH) {
|
|
27
|
+
response.writeHead(404).end();
|
|
28
|
+
return;
|
|
29
|
+
}
|
|
30
|
+
response.writeHead(200, {
|
|
31
|
+
Connection: "close",
|
|
32
|
+
"Content-Type": "text/plain; charset=utf-8",
|
|
33
|
+
"Referrer-Policy": "no-referrer"
|
|
34
|
+
}).end("Sign-in received. Return to your terminal.\n");
|
|
35
|
+
resolveCallback(url.searchParams);
|
|
36
|
+
});
|
|
37
|
+
await new Promise((resolve, reject) => {
|
|
38
|
+
server.once("error", reject);
|
|
39
|
+
server.listen(0, "127.0.0.1", () => resolve());
|
|
40
|
+
});
|
|
41
|
+
const { port } = server.address();
|
|
42
|
+
return {
|
|
43
|
+
close: () => server.close(),
|
|
44
|
+
redirectUrl: `http://127.0.0.1:${port}${CALLBACK_PATH}`,
|
|
45
|
+
waitForCallback: async () => {
|
|
46
|
+
let timer;
|
|
47
|
+
try {
|
|
48
|
+
return await Promise.race([callback, new Promise((_, reject) => {
|
|
49
|
+
timer = setTimeout(() => reject(/* @__PURE__ */ new Error("Timed out waiting for the sign-in.")), SIGN_IN_TIMEOUT_MS);
|
|
50
|
+
})]);
|
|
51
|
+
} finally {
|
|
52
|
+
clearTimeout(timer);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
function requireServiceAccountPlugin(name) {
|
|
58
|
+
const plugin = pluginCatalogRuntime.getDefinition(name);
|
|
59
|
+
if (plugin?.manifest.accounts?.serviceAccount) return plugin;
|
|
60
|
+
const supported = serviceAccountPlugins(pluginCatalogRuntime.getProviders()).map((candidate) => candidate.manifest.name);
|
|
61
|
+
console.error(`Plugin "${name}" does not support a service account.` + (supported.length ? ` Supported plugins: ${supported.join(", ")}.` : ""));
|
|
62
|
+
}
|
|
63
|
+
async function runConnect(plugin) {
|
|
64
|
+
const provider = plugin.manifest.name;
|
|
65
|
+
const loopback = await listenForCallback();
|
|
66
|
+
try {
|
|
67
|
+
const { authorizationUrl } = await startServiceAccountSignIn({
|
|
68
|
+
plugin,
|
|
69
|
+
redirectUrl: loopback.redirectUrl
|
|
70
|
+
});
|
|
71
|
+
console.log([
|
|
72
|
+
`Open this URL in a browser on this machine. Sign in as the account Junior should use for ${provider}, not as yourself:`,
|
|
73
|
+
"",
|
|
74
|
+
authorizationUrl.toString(),
|
|
75
|
+
"",
|
|
76
|
+
`Waiting for the redirect to ${loopback.redirectUrl} ...`
|
|
77
|
+
].join("\n"));
|
|
78
|
+
const result = await finishServiceAccountSignIn({
|
|
79
|
+
callback: await loopback.waitForCallback(),
|
|
80
|
+
plugin
|
|
81
|
+
});
|
|
82
|
+
if (!result.ok) {
|
|
83
|
+
console.error(result.message);
|
|
84
|
+
return 1;
|
|
85
|
+
}
|
|
86
|
+
} finally {
|
|
87
|
+
loopback.close();
|
|
88
|
+
}
|
|
89
|
+
const tools = (plugin.manifest.accounts?.serviceAccount?.tools ?? []).join(", ");
|
|
90
|
+
console.log(plugin.manifest.accounts?.userOAuth === false ? `Connected the ${provider} service account. Everyone now uses it for: ${tools}.` : `Connected the ${provider} service account. Actors who have not connected ${provider} now use it for: ${tools}.`);
|
|
91
|
+
return 0;
|
|
92
|
+
}
|
|
93
|
+
async function runStatus(plugin) {
|
|
94
|
+
const status = await getServiceAccountStatus(plugin);
|
|
95
|
+
console.log(status.connectedAt ? `The ${status.provider} service account is connected since ${status.connectedAt}.` : `The ${status.provider} service account is not connected.`);
|
|
96
|
+
return 0;
|
|
97
|
+
}
|
|
98
|
+
async function runDisconnect(plugin) {
|
|
99
|
+
const provider = plugin.manifest.name;
|
|
100
|
+
await disconnectServiceAccount(plugin);
|
|
101
|
+
console.log(`Removed the ${provider} service account from Junior. To revoke the grant, remove Junior's connection in the ${provider} account settings.`);
|
|
102
|
+
return 0;
|
|
103
|
+
}
|
|
104
|
+
/** Run `junior service-account connect|status|disconnect <plugin>`. */
|
|
105
|
+
async function runServiceAccount(argv) {
|
|
106
|
+
const [subcommand, name, ...rest] = argv;
|
|
107
|
+
const run = subcommand === "connect" ? runConnect : subcommand === "status" ? runStatus : subcommand === "disconnect" ? runDisconnect : void 0;
|
|
108
|
+
if (!run || !name?.trim() || rest.length > 0) {
|
|
109
|
+
console.error(CLI_USAGE);
|
|
110
|
+
return 1;
|
|
111
|
+
}
|
|
112
|
+
const plugin = requireServiceAccountPlugin(name.trim());
|
|
113
|
+
if (!plugin) return 1;
|
|
114
|
+
try {
|
|
115
|
+
return await run(plugin);
|
|
116
|
+
} finally {
|
|
117
|
+
await disconnectStateAdapter();
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
export { runServiceAccount };
|