@sentry/junior 0.114.0 → 0.116.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.
Files changed (147) hide show
  1. package/dist/{agent-hooks-WNBUY4OB.js → agent-hooks-67NFITDH.js} +13 -12
  2. package/dist/api/conversations/detail.d.ts +20 -0
  3. package/dist/api/conversations/event-list.d.ts +2 -0
  4. package/dist/api/conversations/event-page.d.ts +1 -1
  5. package/dist/api/conversations/events.d.ts +1 -1
  6. package/dist/api/health.d.ts +7 -0
  7. package/dist/api/people/profile.d.ts +2 -2
  8. package/dist/api/people/shared.d.ts +1 -1
  9. package/dist/api/personal-tokens/create.d.ts +11 -0
  10. package/dist/api/personal-tokens/list.d.ts +12 -0
  11. package/dist/api/personal-tokens/revoke.d.ts +5 -0
  12. package/dist/api/personal-tokens/routes.d.ts +4 -0
  13. package/dist/api/plugin-reports.d.ts +62 -0
  14. package/dist/api/plugins.d.ts +8 -0
  15. package/dist/api/route.d.ts +1 -1
  16. package/dist/api/runtime.d.ts +24 -0
  17. package/dist/api/schema/conversation.d.ts +26 -0
  18. package/dist/api/schema/person.d.ts +3 -3
  19. package/dist/api/schema/personal-token.d.ts +38 -0
  20. package/dist/api/schema.d.ts +4 -2
  21. package/dist/api/schema.js +19 -7
  22. package/dist/api/skills.d.ts +6 -0
  23. package/dist/api.d.ts +1 -0
  24. package/dist/api.js +285 -121
  25. package/dist/app.js +1957 -5677
  26. package/dist/catalog-runtime-CWZY6GTH.js +18 -0
  27. package/dist/chat/agent/request.d.ts +7 -0
  28. package/dist/chat/agent/resume.d.ts +1 -0
  29. package/dist/chat/agent/sandbox.d.ts +3 -0
  30. package/dist/chat/agent/tools.d.ts +3 -0
  31. package/dist/chat/agent-dispatch/context.d.ts +2 -0
  32. package/dist/chat/agent-dispatch/heartbeat.d.ts +11 -5
  33. package/dist/chat/agent-dispatch/signing.d.ts +14 -5
  34. package/dist/chat/agent-dispatch/store.d.ts +36 -15
  35. package/dist/chat/agent-dispatch/types.d.ts +23 -10
  36. package/dist/chat/agent-dispatch/work.d.ts +58 -0
  37. package/dist/chat/app/factory.d.ts +12 -3
  38. package/dist/chat/config.d.ts +2 -0
  39. package/dist/chat/conversations/history.d.ts +291 -290
  40. package/dist/chat/conversations/projection.d.ts +2 -2
  41. package/dist/chat/local/credential-sync.d.ts +5 -0
  42. package/dist/chat/local/oauth-relay.d.ts +4 -0
  43. package/dist/chat/mcp/oauth.d.ts +1 -0
  44. package/dist/chat/mcp/tool-manager.d.ts +2 -1
  45. package/dist/chat/oauth-authorization.d.ts +17 -0
  46. package/dist/chat/oauth-flow.d.ts +9 -0
  47. package/dist/chat/pi/conversation-events.d.ts +6 -2
  48. package/dist/chat/plugins/annotations.d.ts +8 -0
  49. package/dist/chat/plugins/registry.d.ts +0 -3
  50. package/dist/chat/plugins/types.d.ts +0 -2
  51. package/dist/chat/runtime/agent-continue-runner.d.ts +4 -0
  52. package/dist/chat/runtime/reply-executor.d.ts +6 -1
  53. package/dist/chat/runtime/slack-resume.d.ts +5 -1
  54. package/dist/chat/runtime/turn-input.d.ts +3 -0
  55. package/dist/chat/sandbox/egress/schemas.d.ts +46 -0
  56. package/dist/chat/sandbox/egress/signals.d.ts +9 -0
  57. package/dist/chat/sandbox/sandbox.d.ts +4 -1
  58. package/dist/chat/sandbox/session.d.ts +2 -11
  59. package/dist/chat/sandbox/workspace.d.ts +10 -2
  60. package/dist/chat/sentry-payload-filter.d.ts +4 -4
  61. package/dist/chat/services/mcp-auth-orchestration.d.ts +5 -3
  62. package/dist/chat/services/plugin-auth-orchestration.d.ts +2 -0
  63. package/dist/chat/services/turn-session-record.d.ts +14 -1
  64. package/dist/chat/slack/dispatch-turn.d.ts +25 -0
  65. package/dist/chat/slack/message-control.d.ts +2 -0
  66. package/dist/chat/slack/oauth-authorization-message.d.ts +3 -0
  67. package/dist/chat/state/turn-session.d.ts +11 -0
  68. package/dist/chat/task-execution/slack-work.d.ts +2 -0
  69. package/dist/chat/tool-support/text-range-result.d.ts +3 -0
  70. package/dist/chat/tool-support/zod-tool.d.ts +2 -1
  71. package/dist/chat/tools/definition.d.ts +3 -5
  72. package/dist/chat/tools/query-conversation-events.d.ts +68 -0
  73. package/dist/chat/tools/sandbox/file-utils.d.ts +8 -1
  74. package/dist/chat/tools/sandbox/find-files.d.ts +2 -1
  75. package/dist/chat/tools/sandbox/grep.d.ts +2 -1
  76. package/dist/{chunk-OSKEC4XU.js → chunk-25GU5B5E.js} +1 -1
  77. package/dist/{chunk-XLFBQJUO.js → chunk-3H45VOBZ.js} +32 -7
  78. package/dist/{chunk-4FUEG3QY.js → chunk-3JOGUT46.js} +4 -16
  79. package/dist/chunk-4CODA7P5.js +43 -0
  80. package/dist/{chunk-O4GT7LYB.js → chunk-4DD6AOCG.js} +3 -43
  81. package/dist/{chunk-YU6PO42Q.js → chunk-53ZKTQO6.js} +1 -1
  82. package/dist/{chunk-WV4UJBAS.js → chunk-5UNB623T.js} +1282 -2536
  83. package/dist/{chunk-TLGM5X2M.js → chunk-6RQ5GCWH.js} +2 -2
  84. package/dist/{chunk-MIAKQNYX.js → chunk-6ZK6FZIV.js} +1 -1
  85. package/dist/{chunk-W6RDUAO3.js → chunk-BXLS3I4W.js} +1 -1
  86. package/dist/{chunk-RD7EJI7H.js → chunk-CI3VK7X5.js} +69 -3
  87. package/dist/chunk-DIB4GX3G.js +8 -0
  88. package/dist/{chunk-42WRQLJ6.js → chunk-F3B2YJ76.js} +0 -14
  89. package/dist/chunk-FA6POGLH.js +70 -0
  90. package/dist/{chunk-6Y5L4BOM.js → chunk-FXOYURO4.js} +5 -3
  91. package/dist/chunk-HDSDCEPK.js +80 -0
  92. package/dist/{chunk-C4MZ3GP5.js → chunk-HZF5P5UN.js} +1 -1
  93. package/dist/{chunk-K2W4CK7K.js → chunk-JZPQ5K4V.js} +10 -129
  94. package/dist/{chunk-FIGAF6KL.js → chunk-KBNDFU6J.js} +108 -38
  95. package/dist/{chunk-PM3PX42K.js → chunk-MGH5ADQS.js} +1 -2
  96. package/dist/{chunk-5CZ7RETL.js → chunk-N7TMYLF2.js} +1 -1
  97. package/dist/chunk-OB42YVAE.js +16 -0
  98. package/dist/{chunk-6QWPVTMO.js → chunk-OF5FODBL.js} +125 -23
  99. package/dist/{chunk-2ZTTXTSZ.js → chunk-PE44LDDQ.js} +9 -4
  100. package/dist/chunk-PGKWXHYJ.js +1870 -0
  101. package/dist/{chunk-ZGXH3REA.js → chunk-PZGPCOSD.js} +12 -2
  102. package/dist/{chunk-JQFJO5WH.js → chunk-RXRQJF7Y.js} +74 -17
  103. package/dist/{chunk-S4QDH23A.js → chunk-TC4ZEM2D.js} +113 -79
  104. package/dist/{chunk-ABPSDO6M.js → chunk-UEVLIYK5.js} +234 -165
  105. package/dist/chunk-VKZ6WVAY.js +4318 -0
  106. package/dist/{chunk-VNNBSKCO.js → chunk-VZCSLYCE.js} +22 -7
  107. package/dist/chunk-W3U3YQYI.js +71 -0
  108. package/dist/{chunk-SG5WAA7H.js → chunk-WKU7TY22.js} +0 -3
  109. package/dist/cli/chat.js +74 -42
  110. package/dist/cli/check.js +10 -8
  111. package/dist/cli/init.js +1 -0
  112. package/dist/cli/plugins.js +18 -16
  113. package/dist/cli/snapshot-warmup.js +13 -11
  114. package/dist/cli/upgrade.js +12 -10
  115. package/dist/db/schema/api-tokens.d.ts +160 -0
  116. package/dist/db/schema/conversation-annotations.d.ts +142 -0
  117. package/dist/db/schema.d.ts +305 -1
  118. package/dist/{db-4VLP7KBF.js → db-57FHVGGQ.js} +9 -8
  119. package/dist/handlers/agent-dispatch.d.ts +7 -3
  120. package/dist/handlers/sandbox-egress-signals.d.ts +4 -0
  121. package/dist/instrumentation.js +72 -4
  122. package/dist/nitro.js +5 -5
  123. package/dist/oauth-callback-server-PAQRPXZX.js +231 -0
  124. package/dist/oauth-relay-3ZU72UGL.js +9 -0
  125. package/dist/personal-tokens/store.d.ts +27 -0
  126. package/dist/{plugins-PZMDS7AT.js → plugins-IUJA4VBU.js} +1 -1
  127. package/dist/reporting-schema.d.ts +10 -4
  128. package/dist/reporting.d.ts +5 -5
  129. package/dist/{runner-IPXLWQOF.js → runner-4ISZYJEX.js} +141 -74
  130. package/dist/sandbox-egress-signals-CDFAP67O.js +75 -0
  131. package/dist/{skills-QCNZISNF.js → skills-UE2KXQMB.js} +10 -8
  132. package/dist/validation-PO5LHTJT.js +21 -0
  133. package/dist/version.js +1 -1
  134. package/migrations/0008_sticky_rage.sql +14 -0
  135. package/migrations/0009_slippery_harrier.sql +12 -0
  136. package/migrations/0010_native_conversation_history.sql +142 -0
  137. package/migrations/meta/0008_snapshot.json +1076 -0
  138. package/migrations/meta/0009_snapshot.json +1146 -0
  139. package/migrations/meta/0010_snapshot.json +1190 -0
  140. package/migrations/meta/_journal.json +22 -1
  141. package/package.json +6 -7
  142. package/dist/catalog-runtime-6O4M6JGA.js +0 -16
  143. package/dist/chat/agent-dispatch/runner.d.ts +0 -13
  144. package/dist/chat/capabilities/catalog.d.ts +0 -16
  145. package/dist/chat/oauth-authorization-message.d.ts +0 -6
  146. package/dist/validation-I2BW3UHD.js +0 -19
  147. package/dist/{chunk-KNFROR7R.js → chunk-5I6ORJUY.js} +1 -1
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  pluginCatalogRuntime
3
- } from "./chunk-OSKEC4XU.js";
3
+ } from "./chunk-25GU5B5E.js";
4
4
  import {
5
5
  logWarn
6
- } from "./chunk-4FUEG3QY.js";
6
+ } from "./chunk-3JOGUT46.js";
7
7
  import {
8
8
  skillRoots
9
9
  } from "./chunk-3V7OFJZC.js";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  createVercelQueueClient
3
- } from "./chunk-KNFROR7R.js";
3
+ } from "./chunk-5I6ORJUY.js";
4
4
 
5
5
  // src/chat/task-execution/queue-signing.ts
6
6
  import { createHmac, timingSafeEqual } from "crypto";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  pluginCatalogRuntime
3
- } from "./chunk-OSKEC4XU.js";
3
+ } from "./chunk-25GU5B5E.js";
4
4
 
5
5
  // src/chat/plugins/validation.ts
6
6
  import { isDeepStrictEqual } from "util";
@@ -1,18 +1,82 @@
1
+ import {
2
+ juniorConversationAnnotations
3
+ } from "./chunk-RXRQJF7Y.js";
1
4
  import {
2
5
  sleep
3
6
  } from "./chunk-4ZNGQH7C.js";
4
7
  import {
5
8
  getSlackBotToken
6
- } from "./chunk-ZGXH3REA.js";
9
+ } from "./chunk-PZGPCOSD.js";
7
10
  import {
8
11
  logWarn,
9
12
  setSpanAttributes,
10
13
  setSpanStatus,
11
14
  withSpan
12
- } from "./chunk-4FUEG3QY.js";
15
+ } from "./chunk-3JOGUT46.js";
13
16
  import {
14
17
  parseSlackChannelReferenceId
15
- } from "./chunk-42WRQLJ6.js";
18
+ } from "./chunk-F3B2YJ76.js";
19
+
20
+ // src/chat/plugins/annotations.ts
21
+ import { and, desc, eq } from "drizzle-orm";
22
+ import {
23
+ conversationAnnotationInputSchema
24
+ } from "@sentry/junior-plugin-api";
25
+ function createPluginAnnotations(args) {
26
+ return {
27
+ async upsert(input) {
28
+ const annotation = conversationAnnotationInputSchema.parse(input);
29
+ const now = /* @__PURE__ */ new Date();
30
+ await args.db.insert(juniorConversationAnnotations).values({
31
+ annotation,
32
+ conversationId: args.conversationId,
33
+ createdAt: now,
34
+ key: annotation.key,
35
+ kind: annotation.kind,
36
+ plugin: args.plugin,
37
+ updatedAt: now
38
+ }).onConflictDoUpdate({
39
+ target: [
40
+ juniorConversationAnnotations.conversationId,
41
+ juniorConversationAnnotations.plugin,
42
+ juniorConversationAnnotations.kind,
43
+ juniorConversationAnnotations.key
44
+ ],
45
+ set: { annotation, updatedAt: now }
46
+ });
47
+ },
48
+ async remove(kind, key) {
49
+ await args.db.delete(juniorConversationAnnotations).where(
50
+ and(
51
+ eq(
52
+ juniorConversationAnnotations.conversationId,
53
+ args.conversationId
54
+ ),
55
+ eq(juniorConversationAnnotations.plugin, args.plugin),
56
+ eq(juniorConversationAnnotations.kind, kind),
57
+ eq(juniorConversationAnnotations.key, key)
58
+ )
59
+ );
60
+ },
61
+ async list() {
62
+ return (await listConversationAnnotations(args.db, args.conversationId)).filter((a) => a.plugin === args.plugin);
63
+ }
64
+ };
65
+ }
66
+ async function listConversationAnnotations(db, conversationId) {
67
+ const rows = await db.select().from(juniorConversationAnnotations).where(eq(juniorConversationAnnotations.conversationId, conversationId)).orderBy(desc(juniorConversationAnnotations.updatedAt));
68
+ return rows.flatMap((row) => {
69
+ const parsed = conversationAnnotationInputSchema.safeParse(row.annotation);
70
+ return parsed.success ? [
71
+ {
72
+ ...parsed.data,
73
+ plugin: row.plugin,
74
+ createdAt: row.createdAt.toISOString(),
75
+ updatedAt: row.updatedAt.toISOString()
76
+ }
77
+ ] : [];
78
+ });
79
+ }
16
80
 
17
81
  // src/chat/slack/client.ts
18
82
  import { AsyncLocalStorage as AsyncLocalStorage2 } from "async_hooks";
@@ -435,6 +499,8 @@ async function downloadPrivateSlackFile(url) {
435
499
  }
436
500
 
437
501
  export {
502
+ createPluginAnnotations,
503
+ listConversationAnnotations,
438
504
  runWithWorkspaceTeamId,
439
505
  getWorkspaceTeamId,
440
506
  SlackActionError,
@@ -0,0 +1,8 @@
1
+ // src/chat/oauth-authorization.ts
2
+ function authorizationId(args) {
3
+ return `${args.sessionId}:${args.kind}:${args.provider}`;
4
+ }
5
+
6
+ export {
7
+ authorizationId
8
+ };
@@ -1,14 +1,3 @@
1
- // src/chat/coerce.ts
2
- function toOptionalString(value) {
3
- return typeof value === "string" && value.trim() ? value : void 0;
4
- }
5
- function toOptionalNumber(value) {
6
- return typeof value === "number" && Number.isFinite(value) ? value : void 0;
7
- }
8
- function isRecord(value) {
9
- return typeof value === "object" && value !== null;
10
- }
11
-
12
1
  // src/chat/slack/timestamp.ts
13
2
  import { z } from "zod";
14
3
  var slackMessageTsSchema = z.string().trim().regex(/^\d+(?:\.\d+)?$/).brand();
@@ -60,9 +49,6 @@ function parseSlackUserId(value) {
60
49
  }
61
50
 
62
51
  export {
63
- toOptionalString,
64
- toOptionalNumber,
65
- isRecord,
66
52
  parseSlackMessageTs,
67
53
  parseSlackChannelId,
68
54
  parseSlackChannelReferenceId,
@@ -0,0 +1,70 @@
1
+ // src/chat/local/oauth-relay.ts
2
+ import { randomBytes } from "crypto";
3
+ import { jwtVerify, SignJWT } from "jose";
4
+ import { z } from "zod";
5
+ var LOCAL_OAUTH_STATE_PREFIX = "jr-local";
6
+ var LOCAL_OAUTH_TOKEN_CONTEXT = "junior.local-oauth-relay.v1";
7
+ var LOCAL_OAUTH_TOKEN_TTL = "10m";
8
+ var localOAuthRelayPayloadSchema = z.object({
9
+ aud: z.literal(LOCAL_OAUTH_TOKEN_CONTEXT),
10
+ exp: z.number().int(),
11
+ iss: z.literal(LOCAL_OAUTH_TOKEN_CONTEXT),
12
+ jti: z.string().min(1),
13
+ port: z.number().int().min(1).max(65535)
14
+ }).strict();
15
+ function relayKey() {
16
+ const secret = process.env.JUNIOR_SECRET?.trim();
17
+ if (!secret) {
18
+ throw new Error("Local OAuth requires JUNIOR_SECRET");
19
+ }
20
+ return new TextEncoder().encode(secret);
21
+ }
22
+ async function createLocalOAuthState(port) {
23
+ if (!Number.isSafeInteger(port) || port < 1 || port > 65535) {
24
+ throw new Error("Local OAuth callback port is invalid");
25
+ }
26
+ const token = await new SignJWT({ port }).setProtectedHeader({ alg: "HS256" }).setIssuer(LOCAL_OAUTH_TOKEN_CONTEXT).setAudience(LOCAL_OAUTH_TOKEN_CONTEXT).setJti(randomBytes(24).toString("base64url")).setExpirationTime(LOCAL_OAUTH_TOKEN_TTL).sign(relayKey());
27
+ return `${LOCAL_OAUTH_STATE_PREFIX}.${token}`;
28
+ }
29
+ async function localOAuthRelayPort(state) {
30
+ const prefix = `${LOCAL_OAUTH_STATE_PREFIX}.`;
31
+ if (!state.startsWith(prefix)) {
32
+ return void 0;
33
+ }
34
+ try {
35
+ const { payload } = await jwtVerify(
36
+ state.slice(prefix.length),
37
+ relayKey(),
38
+ {
39
+ algorithms: ["HS256"],
40
+ issuer: LOCAL_OAUTH_TOKEN_CONTEXT,
41
+ audience: LOCAL_OAUTH_TOKEN_CONTEXT
42
+ }
43
+ );
44
+ const parsed = localOAuthRelayPayloadSchema.safeParse(payload);
45
+ return parsed.success ? parsed.data.port : void 0;
46
+ } catch {
47
+ return void 0;
48
+ }
49
+ }
50
+ async function relayLocalOAuthCallback(request) {
51
+ const url = new URL(request.url);
52
+ if (url.searchParams.get("jr_local_relay") === "complete") {
53
+ return void 0;
54
+ }
55
+ const state = url.searchParams.get("state");
56
+ const port = state ? await localOAuthRelayPort(state) : void 0;
57
+ if (!port) {
58
+ return void 0;
59
+ }
60
+ url.protocol = "http:";
61
+ url.hostname = "127.0.0.1";
62
+ url.port = String(port);
63
+ url.searchParams.set("jr_local_relay", "complete");
64
+ return Response.redirect(url, 302);
65
+ }
66
+
67
+ export {
68
+ createLocalOAuthState,
69
+ relayLocalOAuthCallback
70
+ };
@@ -1,9 +1,11 @@
1
+ import {
2
+ toOptionalString
3
+ } from "./chunk-OB42YVAE.js";
1
4
  import {
2
5
  parseSlackChannelId,
3
6
  parseSlackMessageTs,
4
- parseSlackTeamId,
5
- toOptionalString
6
- } from "./chunk-42WRQLJ6.js";
7
+ parseSlackTeamId
8
+ } from "./chunk-F3B2YJ76.js";
7
9
 
8
10
  // src/chat/conversation-privacy.ts
9
11
  import { AsyncLocalStorage } from "async_hooks";
@@ -0,0 +1,80 @@
1
+ import {
2
+ credentialContextSchema
3
+ } from "./chunk-W3U3YQYI.js";
4
+
5
+ // src/chat/sandbox/egress/schemas.ts
6
+ import { z } from "zod";
7
+ import {
8
+ pluginAuthorizationSchema,
9
+ pluginCredentialHeaderTransformSchema,
10
+ pluginGrantSchema,
11
+ pluginProviderAccountSchema
12
+ } from "@sentry/junior-plugin-api";
13
+ var finiteNumberSchema = z.number().refine(Number.isFinite);
14
+ var httpStatusSchema = z.number().int().min(100).max(599);
15
+ var providerNameSchema = z.string().regex(/^[a-z][a-z0-9-]*$/);
16
+ var credentialSignalKindSchema = z.enum(["auth_required", "unavailable"]);
17
+ var sandboxEgressGrantSchema = pluginGrantSchema;
18
+ var sandboxEgressCredentialContextSchema = z.object({
19
+ credentials: credentialContextSchema,
20
+ egressId: z.string().min(1),
21
+ expiresAtMs: finiteNumberSchema,
22
+ contextId: z.string().min(1)
23
+ }).strict();
24
+ var sandboxEgressCredentialLeaseSchema = z.object({
25
+ account: pluginProviderAccountSchema.optional(),
26
+ authorization: pluginAuthorizationSchema.optional(),
27
+ grant: sandboxEgressGrantSchema,
28
+ provider: providerNameSchema,
29
+ expiresAt: z.string().min(1),
30
+ headerTransforms: z.array(pluginCredentialHeaderTransformSchema).min(1)
31
+ }).strict();
32
+ var sandboxEgressAuthRequiredSignalSchema = z.object({
33
+ authorization: pluginAuthorizationSchema.optional(),
34
+ grant: sandboxEgressGrantSchema,
35
+ kind: credentialSignalKindSchema.default("auth_required"),
36
+ provider: providerNameSchema,
37
+ message: z.string().optional(),
38
+ createdAtMs: finiteNumberSchema
39
+ }).strict().superRefine((signal, ctx) => {
40
+ if (signal.authorization && signal.authorization.provider !== signal.provider) {
41
+ ctx.addIssue({
42
+ code: z.ZodIssueCode.custom,
43
+ message: "Auth signal authorization provider must match provider",
44
+ path: ["authorization", "provider"]
45
+ });
46
+ }
47
+ });
48
+ var sandboxEgressPermissionDeniedSignalSchema = z.object({
49
+ account: pluginProviderAccountSchema.optional(),
50
+ acceptedPermissions: z.string().optional(),
51
+ grant: sandboxEgressGrantSchema,
52
+ message: z.string().min(1),
53
+ provider: providerNameSchema,
54
+ source: z.literal("upstream"),
55
+ sso: z.string().optional(),
56
+ status: httpStatusSchema,
57
+ upstreamHost: z.string().min(1),
58
+ upstreamPath: z.string().min(1),
59
+ createdAtMs: finiteNumberSchema
60
+ }).strict();
61
+ var sandboxEgressSignalsResponseSchema = z.object({
62
+ auth_required: sandboxEgressAuthRequiredSignalSchema.optional(),
63
+ permission_denied: sandboxEgressPermissionDeniedSignalSchema.optional()
64
+ }).strict();
65
+ function parseSandboxEgressAuthRequiredSignal(value) {
66
+ const result = sandboxEgressAuthRequiredSignalSchema.safeParse(value);
67
+ return result.success ? result.data : void 0;
68
+ }
69
+ function parseSandboxEgressPermissionDeniedSignal(value) {
70
+ const result = sandboxEgressPermissionDeniedSignalSchema.safeParse(value);
71
+ return result.success ? result.data : void 0;
72
+ }
73
+
74
+ export {
75
+ sandboxEgressCredentialContextSchema,
76
+ sandboxEgressCredentialLeaseSchema,
77
+ sandboxEgressSignalsResponseSchema,
78
+ parseSandboxEgressAuthRequiredSignal,
79
+ parseSandboxEgressPermissionDeniedSignal
80
+ };
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  parseSlackTeamId
3
- } from "./chunk-42WRQLJ6.js";
3
+ } from "./chunk-F3B2YJ76.js";
4
4
 
5
5
  // src/chat/actor.ts
6
6
  import { z } from "zod";
@@ -1,11 +1,11 @@
1
1
  import {
2
- parseActorUserId
3
- } from "./chunk-C4MZ3GP5.js";
2
+ credentialUserSubjectId
3
+ } from "./chunk-W3U3YQYI.js";
4
4
  import {
5
5
  logInfo,
6
6
  logWarn,
7
7
  setSpanAttributes
8
- } from "./chunk-4FUEG3QY.js";
8
+ } from "./chunk-3JOGUT46.js";
9
9
  import {
10
10
  discoverInstalledPluginPackageContent,
11
11
  normalizePluginPackageNames
@@ -105,11 +105,6 @@ function inlineManifestSource(manifest) {
105
105
  setDefined(result, "name", manifest.name);
106
106
  setDefined(result, "display-name", manifest.displayName);
107
107
  setDefined(result, "description", manifest.description);
108
- setDefined(
109
- result,
110
- "capabilities",
111
- inlineTokenListSource(manifest.name, manifest.capabilities)
112
- );
113
108
  setDefined(
114
109
  result,
115
110
  "config-keys",
@@ -138,7 +133,6 @@ function inlineManifestSource(manifest) {
138
133
 
139
134
  // src/chat/plugins/manifest.ts
140
135
  var PLUGIN_NAME_RE = /^[a-z][a-z0-9-]*$/;
141
- var SHORT_CAPABILITY_RE = /^[a-z0-9-]+(\.[a-z0-9-]+)*$/;
142
136
  var SHORT_CONFIG_KEY_RE = /^[a-z0-9]+(\.[a-z0-9-]+)*$/;
143
137
  var TARGET_FLAG_RE = /^-{1,2}[A-Za-z0-9][A-Za-z0-9-]*$/;
144
138
  var AUTH_TOKEN_ENV_RE = /^[A-Z][A-Z0-9_]*$/;
@@ -321,9 +315,6 @@ var manifestSourceSchema = z.object({
321
315
  }),
322
316
  "display-name": nonEmptyTrimmedString,
323
317
  description: nonEmptyTrimmedString,
324
- capabilities: z.array(z.string(), {
325
- error: "must be an array when provided"
326
- }).optional(),
327
318
  "config-keys": z.array(z.string(), {
328
319
  error: "must be an array when provided"
329
320
  }).optional(),
@@ -361,7 +352,6 @@ function manifestConfigPatch(config) {
361
352
  const result = {};
362
353
  setDefined2(result, "display-name", config.displayName);
363
354
  setDefined2(result, "description", config.description);
364
- setDefined2(result, "capabilities", config.capabilities);
365
355
  setDefined2(result, "config-keys", config.configKeys);
366
356
  setDefined2(result, "domains", config.domains);
367
357
  setDefined2(result, "api-headers", config.apiHeaders);
@@ -854,11 +844,6 @@ function parseManifestSource(parsedSource, dir, config, options) {
854
844
  if (path2 === "description") {
855
845
  throw new Error(`Invalid plugin description in ${dir}`);
856
846
  }
857
- if (path2 === "capabilities") {
858
- throw new Error(
859
- `Plugin ${String(parsedSource.name ?? "unknown")} capabilities must be an array when provided`
860
- );
861
- }
862
847
  if (path2 === "config-keys") {
863
848
  throw new Error(
864
849
  `Plugin ${String(parsedSource.name ?? "unknown")} config-keys must be an array when provided`
@@ -917,14 +902,6 @@ function parseManifestSource(parsedSource, dir, config, options) {
917
902
  throw new Error(issue?.message ?? `Invalid plugin manifest in ${dir}`);
918
903
  }
919
904
  const data = sourceResult.data;
920
- const capabilities = (data.capabilities ?? []).map((cap) => {
921
- if (!SHORT_CAPABILITY_RE.test(cap)) {
922
- throw new Error(
923
- `Invalid capability token "${cap}" in plugin ${data.name}`
924
- );
925
- }
926
- return `${data.name}.${cap}`;
927
- });
928
905
  const configKeys = (data["config-keys"] ?? []).map((key) => {
929
906
  if (!SHORT_CONFIG_KEY_RE.test(key)) {
930
907
  throw new Error(`Invalid config key "${key}" in plugin ${data.name}`);
@@ -959,7 +936,6 @@ function parseManifestSource(parsedSource, dir, config, options) {
959
936
  name: data.name,
960
937
  displayName: data["display-name"],
961
938
  description: data.description,
962
- capabilities,
963
939
  configKeys,
964
940
  ...domains ? { domains } : {},
965
941
  ...apiHeaders ? { apiHeaders } : {},
@@ -1083,68 +1059,6 @@ var CredentialUnavailableError = class extends Error {
1083
1059
  }
1084
1060
  };
1085
1061
 
1086
- // src/chat/credentials/context.ts
1087
- import { z as z2 } from "zod";
1088
- var exactActorIdSchema = z2.string().refine((value) => parseActorUserId(value) === value);
1089
- var exactNonBlankStringSchema = z2.string().min(1).refine((value) => value === value.trim());
1090
- var slackDirectCredentialSubjectBindingSchema = z2.object({
1091
- type: z2.literal("slack-direct-conversation"),
1092
- teamId: z2.string().min(1),
1093
- channelId: z2.string().min(1),
1094
- signature: z2.string().min(1)
1095
- }).strict();
1096
- var scheduledTaskCredentialSubjectBindingSchema = z2.object({
1097
- type: z2.literal("scheduled-task"),
1098
- plugin: z2.string().min(1),
1099
- taskId: exactNonBlankStringSchema,
1100
- signature: z2.string().min(1)
1101
- }).strict();
1102
- var credentialSubjectBindingSchema = z2.discriminatedUnion("type", [
1103
- slackDirectCredentialSubjectBindingSchema,
1104
- scheduledTaskCredentialSubjectBindingSchema
1105
- ]);
1106
- var credentialUserActorSchema = z2.object({
1107
- type: z2.literal("user"),
1108
- userId: exactActorIdSchema
1109
- }).strict();
1110
- var credentialSystemActorSchema = z2.object({
1111
- platform: z2.literal("system"),
1112
- name: exactActorIdSchema
1113
- }).strict();
1114
- var credentialSubjectSchema = z2.discriminatedUnion("allowedWhen", [
1115
- z2.object({
1116
- type: z2.literal("user"),
1117
- userId: exactActorIdSchema,
1118
- allowedWhen: z2.literal("private-direct-conversation"),
1119
- binding: slackDirectCredentialSubjectBindingSchema
1120
- }).strict(),
1121
- z2.object({
1122
- type: z2.literal("user"),
1123
- userId: exactActorIdSchema,
1124
- allowedWhen: z2.literal("scheduled-task"),
1125
- taskId: exactNonBlankStringSchema,
1126
- binding: scheduledTaskCredentialSubjectBindingSchema
1127
- }).strict().refine((subject) => subject.binding.taskId === subject.taskId, {
1128
- message: "Scheduled task credential subject requires task binding",
1129
- path: ["binding"]
1130
- })
1131
- ]);
1132
- var credentialContextSchema = z2.union([
1133
- z2.object({
1134
- actor: credentialUserActorSchema
1135
- }).strict(),
1136
- z2.object({
1137
- actor: credentialSystemActorSchema,
1138
- subject: credentialSubjectSchema.optional()
1139
- }).strict()
1140
- ]);
1141
- function credentialUserSubjectId(context) {
1142
- if ("type" in context.actor) {
1143
- return context.actor.userId;
1144
- }
1145
- return "subject" in context ? context.subject?.userId : void 0;
1146
- }
1147
-
1148
1062
  // src/chat/credentials/header-transforms.ts
1149
1063
  function mergeHeaderTransforms(transforms) {
1150
1064
  const byDomain = /* @__PURE__ */ new Map();
@@ -1277,7 +1191,7 @@ function createApiHeadersBroker(manifest) {
1277
1191
  }
1278
1192
 
1279
1193
  // src/chat/plugins/auth/oauth-request.ts
1280
- import { z as z3 } from "zod";
1194
+ import { z as z2 } from "zod";
1281
1195
  var DEFAULT_TOKEN_CONTENT_TYPE = "application/x-www-form-urlencoded";
1282
1196
  function requireNonEmptyTokenField(data, field) {
1283
1197
  const value = data[field];
@@ -1292,12 +1206,12 @@ function requireTokenResponseObject(data) {
1292
1206
  }
1293
1207
  return data;
1294
1208
  }
1295
- var parsedOAuthTokenResponseSchema = z3.object({
1296
- accessToken: z3.string().min(1),
1297
- refreshToken: z3.string().min(1),
1298
- expiresAt: z3.number().positive().optional(),
1299
- refreshTokenExpiresAt: z3.number().positive().optional(),
1300
- scope: z3.string().min(1).optional()
1209
+ var parsedOAuthTokenResponseSchema = z2.object({
1210
+ accessToken: z2.string().min(1),
1211
+ refreshToken: z2.string().min(1),
1212
+ expiresAt: z2.number().positive().optional(),
1213
+ refreshTokenExpiresAt: z2.number().positive().optional(),
1214
+ scope: z2.string().min(1).optional()
1301
1215
  }).strict();
1302
1216
  function contentTypeToBody(contentType, payload) {
1303
1217
  const mediaType = contentType.split(";", 1)[0]?.trim().toLowerCase();
@@ -1612,7 +1526,6 @@ function createLoadedPluginState(signature) {
1612
1526
  signature,
1613
1527
  pluginDefinitions: [],
1614
1528
  pluginMigrationRoots: /* @__PURE__ */ new Map(),
1615
- capabilityToPlugin: /* @__PURE__ */ new Map(),
1616
1529
  domainToPlugin: /* @__PURE__ */ new Map(),
1617
1530
  pluginConfigKeys: /* @__PURE__ */ new Set(),
1618
1531
  pluginsByName: /* @__PURE__ */ new Map(),
@@ -1631,13 +1544,6 @@ function registerPluginManifest(state, manifest, pluginDir, skillsDir, migration
1631
1544
  if (state.pluginsByName.has(manifest.name)) {
1632
1545
  throw new Error(`Duplicate plugin name "${manifest.name}"`);
1633
1546
  }
1634
- for (const cap of manifest.capabilities) {
1635
- if (state.capabilityToPlugin.has(cap)) {
1636
- throw new Error(
1637
- `Duplicate capability "${cap}" in plugin "${manifest.name}"`
1638
- );
1639
- }
1640
- }
1641
1547
  for (const domain of providerDomains(manifest)) {
1642
1548
  const owner = state.domainToPlugin.get(domain);
1643
1549
  if (owner) {
@@ -1657,9 +1563,6 @@ function registerPluginManifest(state, manifest, pluginDir, skillsDir, migration
1657
1563
  if (definition.migrationsDir) {
1658
1564
  state.pluginMigrationRoots.set(manifest.name, definition.migrationsDir);
1659
1565
  }
1660
- for (const cap of manifest.capabilities) {
1661
- state.capabilityToPlugin.set(cap, definition);
1662
- }
1663
1566
  for (const key of manifest.configKeys) {
1664
1567
  state.pluginConfigKeys.add(key);
1665
1568
  }
@@ -1879,7 +1782,6 @@ function logLoadedPlugins(state) {
1879
1782
  {},
1880
1783
  {
1881
1784
  "app.plugin.name": plugin.manifest.name,
1882
- "app.plugin.capability_count": plugin.manifest.capabilities.length,
1883
1785
  "app.plugin.config_key_count": plugin.manifest.configKeys.length,
1884
1786
  "app.plugin.has_mcp": Boolean(plugin.manifest.mcp),
1885
1787
  "file.directory": plugin.dir,
@@ -1916,20 +1818,6 @@ function createPluginCatalogRuntime() {
1916
1818
  getSignature() {
1917
1819
  return ensurePluginsLoaded(runtime).signature;
1918
1820
  },
1919
- getCapabilityProviders() {
1920
- const state = ensurePluginsLoaded(runtime);
1921
- return state.pluginDefinitions.map((plugin) => ({
1922
- provider: plugin.manifest.name,
1923
- capabilities: [...plugin.manifest.capabilities],
1924
- configKeys: [...plugin.manifest.configKeys],
1925
- ...plugin.manifest.target ? {
1926
- target: {
1927
- ...plugin.manifest.target,
1928
- ...plugin.manifest.target.commandFlags ? { commandFlags: [...plugin.manifest.target.commandFlags] } : {}
1929
- }
1930
- } : {}
1931
- }));
1932
- },
1933
1821
  getProviders() {
1934
1822
  return [...ensurePluginsLoaded(runtime).pluginDefinitions];
1935
1823
  },
@@ -2033,9 +1921,6 @@ function createPluginCatalogRuntime() {
2033
1921
  isProvider(provider) {
2034
1922
  return ensurePluginsLoaded(runtime).pluginsByName.has(provider);
2035
1923
  },
2036
- isCapability(capability) {
2037
- return ensurePluginsLoaded(runtime).capabilityToPlugin.has(capability);
2038
- },
2039
1924
  isConfigKey(key) {
2040
1925
  return ensurePluginsLoaded(runtime).pluginConfigKeys.has(key);
2041
1926
  },
@@ -2058,7 +1943,6 @@ function createPluginCatalogRuntime() {
2058
1943
  }
2059
1944
  setSpanAttributes({
2060
1945
  "app.plugin.name": name,
2061
- "app.plugin.capabilities": plugin.manifest.capabilities,
2062
1946
  "app.plugin.has_oauth": Boolean(plugin.manifest.oauth)
2063
1947
  });
2064
1948
  return broker;
@@ -2070,9 +1954,6 @@ export {
2070
1954
  parsePluginManifest,
2071
1955
  parseInlinePluginManifest,
2072
1956
  CredentialUnavailableError,
2073
- credentialSubjectSchema,
2074
- credentialContextSchema,
2075
- credentialUserSubjectId,
2076
1957
  hasRequiredOAuthScope,
2077
1958
  resolvePluginCommandEnv,
2078
1959
  resolveAuthTokenPlaceholder,