@sentry/junior 0.258.0 → 0.260.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-Dj5BTJRd.js +270 -0
- package/dist/{admin-My1SLGVO.js → admin-tzkZDqrH.js} +1 -1
- package/dist/{agent-hooks-BJ_5mlRH.js → agent-hooks-V4Hfc2tB.js} +711 -697
- package/dist/{agent-runner-DGsFQw72.js → agent-runner-DvTUyGTY.js} +751 -2508
- package/dist/api/schema.d.ts +239 -54
- package/dist/api/schema.js +4 -4
- package/dist/api.js +218 -57
- package/dist/{app-PX2H1PxU.d.ts → app-BsBUs3rF.d.ts} +6 -3
- package/dist/app.d.ts +2 -2
- package/dist/app.js +31 -31
- package/dist/{assistant-reply-H1M-91oF.js → assistant-reply-CEOMzsWy.js} +1 -1
- package/dist/{automation-DWBFBenG.js → automation-DrpcA-SX.js} +3 -0
- package/dist/{briefs-vYoK85rJ.js → briefs-BSCkyYqs.js} +4 -4
- package/dist/{catalog-runtime-BN4DVxco.js → catalog-runtime-Bpcs2b2L.js} +1 -1
- package/dist/cli/chat.d.ts +1 -1
- package/dist/cli/chat.js +16 -16
- 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-JeyzRwsT.js} +57 -4
- package/dist/{config-_WO_AjCB.js → config-ULs6Zl9b.js} +5 -2
- package/dist/{connections-ag_1JOhB.js → connections-CZ7HhEmN.js} +174 -10
- package/dist/{conversation-DjN3mlog.js → conversation-CvuKJ3tA.js} +108 -155
- package/dist/{conversation-privacy-DHP_xnVj.js → conversation-privacy-BQSlZXgV.js} +1 -1
- package/dist/{credential-sync-B-CPX_ag.js → credential-sync-BKcv5rBe.js} +14 -177
- package/dist/{executor-RvG6kVe1.js → executor-BoGNVEDn.js} +3 -2
- package/dist/{images-C2J_bj2g.js → images-BBmDXQCB.js} +3 -3
- package/dist/instrumentation.js +2 -2
- package/dist/{job-queue-DVe37it2.js → job-queue-CbdVyaCo.js} +1 -1
- package/dist/{logging-DsHONhVm.js → logging-DSMmkHXG.js} +1 -1
- package/dist/{message-DyitL8no.js → message-zaj5gBbS.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-yYFG8Own.js} +2 -2
- package/dist/{plugins-B11Mfkmv.d.ts → plugins-B_0Cr0MO.d.ts} +5 -1
- package/dist/{profile-DpYjfKke.js → profile-ByWkAY7L.js} +24 -293
- package/dist/{prompt-xgpyMtg7.js → prompt-DeVax2qO.js} +1 -1
- package/dist/{registry-Du566MtJ.js → registry-BL-osYWN.js} +41 -2
- package/dist/{resolve-ClCIgh8E.js → resolve-HuPG2VMB.js} +9 -4
- package/dist/{result-BBbKA61B.js → result-DS7V4a3-.js} +9 -14
- package/dist/{runner-CCuqFSqx.js → runner-Cba_OfGl.js} +11 -11
- package/dist/{sandbox-egress-signals-DY1mbKF4.js → sandbox-egress-signals-C7NcPzea.js} +1 -1
- package/dist/{schema-DrMh3NtR.js → schema-OzL8Zw4H.js} +82 -3
- package/dist/service-account-DqwHhwJA.js +120 -0
- package/dist/service-account-Ko1Xs--F.js +661 -0
- package/dist/{session-stop-CIoFiwwe.js → session-stop-HfKx-pky.js} +180 -22
- package/dist/{skills-DyQBLIrK.js → skills-D6_bcAuW.js} +2 -2
- package/dist/{spawn-Dqfeo7XP.js → spawn-BWqK6EwM.js} +2 -2
- package/dist/{store-DJLwq4x8.js → store-DzRbd5VT.js} +6 -6
- package/dist/{task-queue-BzW4MaWU.js → task-queue-9LICOzcL.js} +3 -3
- package/dist/{task-runner-D3qJh4fK.js → task-runner-DGnd_B5X.js} +10 -10
- package/dist/{tasks-CEXKTASS.js → tasks-CjrS098O.js} +4928 -2389
- package/dist/thread-state-CqkYowEz.js +184 -0
- package/dist/{turn-failure-response-CWx7aNIh.js → turn-failure-response-BkKmGqFt.js} +8 -9
- package/dist/{turn-lifecycle-C9JFst7-.js → turn-lifecycle-DYv8IV6w.js} +1 -1
- package/dist/{turn-session-routing-CUxtfpr7.js → turn-session-routing-TaVhKmdz.js} +1 -1
- package/dist/{validation-BHRxa5G4.js → validation-BrXMYPyo.js} +1 -1
- package/dist/{version-C0U6rHg0.js → version-Ct049vav.js} +1 -1
- package/dist/version.js +1 -1
- package/dist/{viewer-CGvvRqKp.js → viewer-C-J0ewlH.js} +19 -10
- package/dist/{web-input-Keb5GRWj.js → web-input-C_xB3RXp.js} +41 -37
- package/dist/{work-DRcsJ3hV.js → work-D829Ue7k.js} +9 -10
- package/dist/{worker-Cjo-QqPq.js → worker-BRTYzlpk.js} +5 -5
- package/migrations/0061_workspace_vcpus.sql +1 -0
- package/migrations/meta/0061_snapshot.json +3471 -0
- package/migrations/meta/_journal.json +7 -0
- package/package.json +6 -6
- package/dist/experimental-BNK1l1jv.js +0 -49
- package/dist/oauth-authorization-djQn5Nhy.js +0 -97
- package/dist/pending-auth-D8J1uJUS.js +0 -442
- package/dist/thread-state-W3f6kAtz.js +0 -426
|
@@ -1,12 +1,73 @@
|
|
|
1
1
|
import { r as AGENT_INVOCATION_STATUSES, u as juniorDestinationKindSchema } from "./agent-invocations-Qfz7dWgU.js";
|
|
2
|
-
import {
|
|
3
|
-
import "./automation-
|
|
2
|
+
import { E as conversationUsageSchema, T as conversationSummaryReportSchema, j as conversationChildAgentTotalsSchema, l as conversationAuxiliaryCostsSchema, n as actorIdentitySchema } from "./conversation-CvuKJ3tA.js";
|
|
3
|
+
import "./automation-DrpcA-SX.js";
|
|
4
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
|
+
// src/api/schema/conversation-stats.ts
|
|
11
|
+
const conversationStatsItemSchema = z.object({
|
|
12
|
+
active: z.number(),
|
|
13
|
+
conversations: z.number(),
|
|
14
|
+
durationMs: z.number(),
|
|
15
|
+
failed: z.number(),
|
|
16
|
+
label: z.string(),
|
|
17
|
+
costUsd: z.number().optional(),
|
|
18
|
+
tokens: z.number().optional()
|
|
19
|
+
}).strict();
|
|
20
|
+
/** UTC day (`YYYY-MM-DD`) or hour (`YYYY-MM-DDTHH`) activity bucket key. */
|
|
21
|
+
const conversationMetricBucketSchema = z.string().regex(/^\d{4}-\d{2}-\d{2}(T\d{2})?$/);
|
|
22
|
+
const conversationMetricDaySchema = z.object({
|
|
23
|
+
cachedInputTokens: z.number().optional(),
|
|
24
|
+
cacheCreationTokens: z.number().optional(),
|
|
25
|
+
conversations: z.number(),
|
|
26
|
+
costUsd: z.number().optional(),
|
|
27
|
+
date: conversationMetricBucketSchema,
|
|
28
|
+
durationMs: z.number(),
|
|
29
|
+
inputTokens: z.number().optional(),
|
|
30
|
+
tokens: z.number().optional()
|
|
31
|
+
}).strict();
|
|
32
|
+
const guardianMetricDaySchema = z.object({
|
|
33
|
+
allow: z.number(),
|
|
34
|
+
ask: z.number(),
|
|
35
|
+
costUsd: z.number().optional(),
|
|
36
|
+
date: conversationMetricBucketSchema,
|
|
37
|
+
deny: z.number(),
|
|
38
|
+
requests: z.number()
|
|
39
|
+
}).strict();
|
|
40
|
+
const guardianStatsSchema = z.object({
|
|
41
|
+
allow: z.number(),
|
|
42
|
+
ask: z.number(),
|
|
43
|
+
costUsd: z.number().optional(),
|
|
44
|
+
deny: z.number(),
|
|
45
|
+
metricDays: z.array(guardianMetricDaySchema),
|
|
46
|
+
metricHours: z.array(guardianMetricDaySchema).optional(),
|
|
47
|
+
metricSixHours: z.array(guardianMetricDaySchema).optional(),
|
|
48
|
+
requests: z.number()
|
|
49
|
+
}).strict();
|
|
50
|
+
const conversationStatsReportSchema = z.object({
|
|
51
|
+
active: z.number(),
|
|
52
|
+
cachedInputTokens: z.number().optional(),
|
|
53
|
+
cacheCreationTokens: z.number().optional(),
|
|
54
|
+
conversations: z.number(),
|
|
55
|
+
durationMs: z.number(),
|
|
56
|
+
failed: z.number(),
|
|
57
|
+
generatedAt: z.string(),
|
|
58
|
+
guardian: guardianStatsSchema,
|
|
59
|
+
metricDays: z.array(conversationMetricDaySchema),
|
|
60
|
+
metricHours: z.array(conversationMetricDaySchema).optional(),
|
|
61
|
+
metricSixHours: z.array(conversationMetricDaySchema).optional(),
|
|
62
|
+
locations: z.array(conversationStatsItemSchema),
|
|
63
|
+
actors: z.array(conversationStatsItemSchema),
|
|
64
|
+
source: z.literal("conversation_index"),
|
|
65
|
+
costUsd: z.number().optional(),
|
|
66
|
+
inputTokens: z.number().optional(),
|
|
67
|
+
tokens: z.number().optional(),
|
|
68
|
+
windowEnd: z.string(),
|
|
69
|
+
windowStart: z.string()
|
|
70
|
+
}).strict();
|
|
10
71
|
// src/api/schema/conversation-stop.ts
|
|
11
72
|
/** One queued web message from the viewer that a stop removed. */
|
|
12
73
|
const stoppedConversationMessageSchema = z.object({
|
|
@@ -351,6 +412,20 @@ const createPersonalTokenBodySchema = z.object({ name: z.string().trim().min(1).
|
|
|
351
412
|
const createdPersonalTokenSchema = personalTokenMetadataSchema.extend({ token: z.string().startsWith("jr_pat_") }).strict();
|
|
352
413
|
const personalTokenParamsSchema = z.object({ id: z.string().uuid() }).strict();
|
|
353
414
|
const revokePersonalTokenResponseSchema = z.object({ revoked: z.literal(true) }).strict();
|
|
415
|
+
// src/api/schema/service-account.ts
|
|
416
|
+
const serviceAccountSchema = z.object({
|
|
417
|
+
provider: z.string(),
|
|
418
|
+
displayName: z.string(),
|
|
419
|
+
userOAuth: z.boolean(),
|
|
420
|
+
tools: z.array(z.string()),
|
|
421
|
+
connected: z.boolean(),
|
|
422
|
+
connectedAt: z.string().optional(),
|
|
423
|
+
connectedBy: z.string().optional()
|
|
424
|
+
}).strict();
|
|
425
|
+
const serviceAccountListSchema = z.object({ serviceAccounts: z.array(serviceAccountSchema) }).strict();
|
|
426
|
+
const serviceAccountParamsSchema = z.object({ provider: z.string().regex(/^[a-z][a-z0-9-]*$/).max(64) }).strict();
|
|
427
|
+
const startServiceAccountSignInResponseSchema = z.object({ authorizationUrl: z.string().url() }).strict();
|
|
428
|
+
const disconnectServiceAccountResponseSchema = z.object({ disconnected: z.literal(true) }).strict();
|
|
354
429
|
// src/api/schema/workspace.ts
|
|
355
430
|
const workspaceRepoInputSchema = z.object({
|
|
356
431
|
provider: z.string(),
|
|
@@ -378,16 +453,20 @@ const workspaceSchema = z.object({
|
|
|
378
453
|
id: z.string().uuid(),
|
|
379
454
|
name: z.string(),
|
|
380
455
|
setupScript: z.string(),
|
|
456
|
+
vcpus: z.number().int().positive().nullable(),
|
|
381
457
|
repos: z.array(workspaceRepoSchema),
|
|
382
458
|
snapshot: workspaceSnapshotSchema.nullable()
|
|
383
459
|
}).strict();
|
|
384
460
|
const workspaceListSchema = z.object({
|
|
385
461
|
baselineSnapshot: baselineSnapshotSchema.nullable(),
|
|
462
|
+
/** App-level Sandbox vCPUs. Null means the Vercel default. */
|
|
463
|
+
defaultVcpus: z.number().int().positive().nullable(),
|
|
386
464
|
workspaces: z.array(workspaceSchema)
|
|
387
465
|
}).strict();
|
|
388
466
|
const workspaceBodySchema = z.object({
|
|
389
467
|
name: z.string(),
|
|
390
468
|
setupScript: z.string().optional(),
|
|
469
|
+
vcpus: z.number().int().positive().nullable().optional(),
|
|
391
470
|
repos: z.array(workspaceRepoInputSchema)
|
|
392
471
|
}).strict();
|
|
393
472
|
const workspaceParamsSchema = z.object({ id: z.string().uuid() }).strict();
|
|
@@ -406,4 +485,4 @@ const statsReportSchema = z.object({
|
|
|
406
485
|
windowEnd: z.string(),
|
|
407
486
|
windowStart: z.string()
|
|
408
487
|
}).strict();
|
|
409
|
-
export {
|
|
488
|
+
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 X, conversationStatsReportSchema 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-Bpcs2b2L.js";
|
|
2
|
+
import { t as disconnectStateAdapter } from "./adapter-Dj5BTJRd.js";
|
|
3
|
+
import { n as finishServiceAccountSignIn, o as serviceAccountPlugins, r as getServiceAccountStatus, s as startServiceAccountSignIn, t as disconnectServiceAccount } from "./service-account-Ko1Xs--F.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 };
|