@sentry/junior 0.258.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/adapter-Bn0gFVSF.js +270 -0
- package/dist/{admin-My1SLGVO.js → admin-C8xz2f10.js} +1 -1
- package/dist/{agent-hooks-BJ_5mlRH.js → agent-hooks-B00FaKdP.js} +9 -8
- package/dist/{agent-runner-DGsFQw72.js → agent-runner-CPSd7rKm.js} +87 -308
- package/dist/api/schema.d.ts +29 -0
- package/dist/api/schema.js +2 -2
- package/dist/api.js +93 -22
- package/dist/{app-PX2H1PxU.d.ts → app-Bbxrehjf.d.ts} +5 -2
- package/dist/app.d.ts +2 -2
- package/dist/app.js +30 -28
- package/dist/{assistant-reply-H1M-91oF.js → assistant-reply-CqthTerd.js} +1 -1
- package/dist/{briefs-vYoK85rJ.js → briefs-DNYbQ9cD.js} +2 -2
- package/dist/{catalog-runtime-BN4DVxco.js → catalog-runtime-B8SuFPGb.js} +1 -1
- package/dist/cli/chat.d.ts +1 -1
- package/dist/cli/chat.js +15 -15
- package/dist/cli/check.js +3 -3
- package/dist/cli/main.js +6 -2
- package/dist/cli/plugins.d.ts +1 -1
- package/dist/cli/plugins.js +4 -4
- package/dist/cli/run.d.ts +2 -1
- package/dist/cli/run.js +2 -1
- package/dist/cli/snapshot-create.js +4 -3
- package/dist/cli/upgrade.d.ts +1 -1
- package/dist/cli/upgrade.js +3 -3
- package/dist/{client-DbyHuMFU.js → client-BZdxgKyL.js} +57 -4
- package/dist/{config-_WO_AjCB.js → config-Deqpfpg9.js} +5 -2
- package/dist/{connections-ag_1JOhB.js → connections-9gJkfS85.js} +174 -10
- package/dist/{conversation-privacy-DHP_xnVj.js → conversation-privacy-CFhNKxp-.js} +1 -1
- package/dist/{credential-sync-B-CPX_ag.js → credential-sync-BABGymK3.js} +15 -177
- package/dist/{executor-RvG6kVe1.js → executor-Bb3eQb8q.js} +2 -2
- package/dist/{images-C2J_bj2g.js → images-BbSdVHC6.js} +2 -2
- package/dist/instrumentation.js +2 -2
- package/dist/{job-queue-DVe37it2.js → job-queue-vdGU-5ge.js} +1 -1
- package/dist/{logging-DsHONhVm.js → logging-BStXN56b.js} +1 -1
- package/dist/{message-DyitL8no.js → message-DRf6m4uO.js} +3 -3
- package/dist/nitro.d.ts +2 -2
- package/dist/nitro.js +3 -3
- package/dist/{oauth-callback-server-CDby-pCn.js → oauth-callback-server-JmOgLcGl.js} +2 -2
- package/dist/{pending-auth-D8J1uJUS.js → pending-auth-rG5U_QS1.js} +62 -62
- package/dist/{plugins-B11Mfkmv.d.ts → plugins-B_0Cr0MO.d.ts} +5 -1
- package/dist/{profile-DpYjfKke.js → profile-qBM6B_-V.js} +4 -273
- package/dist/{registry-Du566MtJ.js → registry-B_M_x_iS.js} +41 -2
- package/dist/{resolve-ClCIgh8E.js → resolve-BzpuLh8c.js} +3 -2
- package/dist/{result-BBbKA61B.js → result-DEZH_AnZ.js} +6 -6
- package/dist/{runner-CCuqFSqx.js → runner-BqQlG10t.js} +9 -9
- package/dist/{sandbox-egress-signals-DY1mbKF4.js → sandbox-egress-signals-DCq3WLs5.js} +1 -1
- package/dist/{schema-DrMh3NtR.js → schema-CF9HqNRY.js} +15 -1
- package/dist/service-account-BqTBkyD7.js +120 -0
- package/dist/service-account-BzhW7kXu.js +661 -0
- package/dist/{session-stop-CIoFiwwe.js → session-stop-CV65ZlU3.js} +10 -10
- package/dist/{skills-DyQBLIrK.js → skills-CiWS5_Ub.js} +2 -2
- package/dist/{spawn-Dqfeo7XP.js → spawn-BSAQ7UQZ.js} +2 -2
- package/dist/{store-DJLwq4x8.js → store-B1GES4gC.js} +6 -6
- package/dist/{task-queue-BzW4MaWU.js → task-queue-BAeGEMjJ.js} +3 -3
- package/dist/{task-runner-D3qJh4fK.js → task-runner-BlGhcQPi.js} +10 -10
- package/dist/{tasks-CEXKTASS.js → tasks-DieKX3d4.js} +9 -8
- package/dist/{thread-state-W3f6kAtz.js → thread-state-DpSWS4Rr.js} +6 -6
- package/dist/{turn-failure-response-CWx7aNIh.js → turn-failure-response-DQljogGJ.js} +7 -7
- package/dist/{turn-lifecycle-C9JFst7-.js → turn-lifecycle-BLgrkV_L.js} +1 -1
- package/dist/{turn-session-routing-CUxtfpr7.js → turn-session-routing-BlajheOU.js} +1 -1
- package/dist/{validation-BHRxa5G4.js → validation-23d7K9tX.js} +1 -1
- package/dist/{version-C0U6rHg0.js → version-B_XumRx-.js} +1 -1
- package/dist/version.js +1 -1
- package/dist/{viewer-CGvvRqKp.js → viewer-B2_ABsYi.js} +3 -3
- package/dist/{web-input-Keb5GRWj.js → web-input-BZDyxpzR.js} +29 -29
- package/dist/{work-DRcsJ3hV.js → work-D3QKiV0O.js} +9 -9
- package/dist/{worker-Cjo-QqPq.js → worker-C8mUjYf9.js} +5 -5
- package/package.json +7 -7
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { f as logException, w as withLogContext, x as setTags } from "./logging-
|
|
2
|
-
import { c as getConversationEventStore, u as getConversationStore } from "./viewer-
|
|
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-
|
|
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
5
|
import { K as messageCardText } from "./conversation-DjN3mlog.js";
|
|
6
6
|
import { f as markTurnFailed, p as startActiveTurn, t as authorizationId } from "./oauth-authorization-djQn5Nhy.js";
|
|
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-
|
|
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
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { jt as sandboxEgressSignalsResponseSchema } from "./agent-runner-CPSd7rKm.js";
|
|
2
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;
|
|
@@ -351,6 +351,20 @@ const createPersonalTokenBodySchema = z.object({ name: z.string().trim().min(1).
|
|
|
351
351
|
const createdPersonalTokenSchema = personalTokenMetadataSchema.extend({ token: z.string().startsWith("jr_pat_") }).strict();
|
|
352
352
|
const personalTokenParamsSchema = z.object({ id: z.string().uuid() }).strict();
|
|
353
353
|
const revokePersonalTokenResponseSchema = z.object({ revoked: z.literal(true) }).strict();
|
|
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();
|
|
354
368
|
// src/api/schema/workspace.ts
|
|
355
369
|
const workspaceRepoInputSchema = z.object({
|
|
356
370
|
provider: z.string(),
|
|
@@ -406,4 +420,4 @@ const statsReportSchema = z.object({
|
|
|
406
420
|
windowEnd: z.string(),
|
|
407
421
|
windowStart: z.string()
|
|
408
422
|
}).strict();
|
|
409
|
-
export {
|
|
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 };
|
|
@@ -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 };
|