@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
@@ -3,8 +3,9 @@ import {
3
3
  } from "./chunk-UIE3R5XU.js";
4
4
  import {
5
5
  getCurrentConversationPrivacy
6
- } from "./chunk-6Y5L4BOM.js";
7
- import "./chunk-42WRQLJ6.js";
6
+ } from "./chunk-FXOYURO4.js";
7
+ import "./chunk-OB42YVAE.js";
8
+ import "./chunk-F3B2YJ76.js";
8
9
  import {
9
10
  getClient,
10
11
  getGlobalScope,
@@ -15,8 +16,8 @@ import {
15
16
  import {
16
17
  getDeploymentServiceVersion,
17
18
  getDeploymentTelemetryAttributes
18
- } from "./chunk-5CZ7RETL.js";
19
- import "./chunk-PM3PX42K.js";
19
+ } from "./chunk-N7TMYLF2.js";
20
+ import "./chunk-MGH5ADQS.js";
20
21
  import "./chunk-MLKGABMK.js";
21
22
 
22
23
  // src/chat/sentry-payload-filter.ts
@@ -29,6 +30,69 @@ var PAYLOAD_ATTRIBUTE_KEYS = /* @__PURE__ */ new Set([
29
30
  "gen_ai.tool.call.arguments",
30
31
  "gen_ai.tool.call.result"
31
32
  ]);
33
+ var URL_ATTRIBUTE_KEYS = /* @__PURE__ */ new Set([
34
+ "http.target",
35
+ "http.url",
36
+ "url.full",
37
+ "url.path"
38
+ ]);
39
+ var OAUTH_CALLBACK_PATH = "/api/oauth/callback/";
40
+ var LOCAL_CREDENTIAL_PATH = "/api/internal/local-oauth-credentials";
41
+ var SECRET_HEADER_NAMES = /* @__PURE__ */ new Set([
42
+ "x-junior-local-credential-signature",
43
+ "x-junior-sandbox-egress-token"
44
+ ]);
45
+ function stripQuery(value) {
46
+ const queryIndex = value.indexOf("?");
47
+ return queryIndex >= 0 ? value.slice(0, queryIndex) : value;
48
+ }
49
+ function isSecretHeaderAttribute(key) {
50
+ const normalized = key.toLowerCase().replace(/[^a-z0-9]/g, "");
51
+ return normalized.endsWith("xjuniorlocalcredentialsignature") || normalized.endsWith("xjuniorsandboxegresstoken");
52
+ }
53
+ function scrubSensitiveUrlAttributes(attributes) {
54
+ if (!attributes) {
55
+ return;
56
+ }
57
+ delete attributes["url.query"];
58
+ const hasLocalCredentialUrl = [...URL_ATTRIBUTE_KEYS].some((key) => {
59
+ const value = attributes[key];
60
+ return typeof value === "string" && value.includes(LOCAL_CREDENTIAL_PATH);
61
+ });
62
+ for (const key of Object.keys(attributes)) {
63
+ if (isSecretHeaderAttribute(key) || hasLocalCredentialUrl && key === "http.request.body.data") {
64
+ delete attributes[key];
65
+ }
66
+ }
67
+ for (const key of URL_ATTRIBUTE_KEYS) {
68
+ const value = attributes[key];
69
+ if (typeof value !== "string" || !value.includes(OAUTH_CALLBACK_PATH)) {
70
+ continue;
71
+ }
72
+ attributes[key] = stripQuery(value);
73
+ }
74
+ }
75
+ function scrubSensitiveRequest(request) {
76
+ if (!request) {
77
+ return;
78
+ }
79
+ const url = request.url;
80
+ if (url?.includes(OAUTH_CALLBACK_PATH)) {
81
+ request.url = stripQuery(url);
82
+ delete request.query_string;
83
+ }
84
+ if (url?.includes(LOCAL_CREDENTIAL_PATH)) {
85
+ delete request.data;
86
+ }
87
+ if (!request.headers) {
88
+ return;
89
+ }
90
+ for (const key of Object.keys(request.headers)) {
91
+ if (SECRET_HEADER_NAMES.has(key.toLowerCase())) {
92
+ delete request.headers[key];
93
+ }
94
+ }
95
+ }
32
96
  function hasPayloadAttributes(attributes) {
33
97
  return Object.keys(attributes).some((key) => PAYLOAD_ATTRIBUTE_KEYS.has(key));
34
98
  }
@@ -66,10 +130,13 @@ function scrubContainer(container) {
66
130
  }
67
131
  scrubPayloadAttributes(container.data);
68
132
  scrubPayloadAttributes(container.attributes);
133
+ scrubSensitiveUrlAttributes(container.data);
134
+ scrubSensitiveUrlAttributes(container.attributes);
69
135
  }
70
136
  function scrubPrivateSentryEvent(event) {
71
137
  const eventRecord = event;
72
138
  scrubContainer(eventRecord);
139
+ scrubSensitiveRequest(event.request);
73
140
  scrubContainer(event.contexts?.trace);
74
141
  for (const breadcrumb of event.breadcrumbs ?? []) {
75
142
  scrubContainer(breadcrumb);
@@ -79,6 +146,7 @@ function scrubPrivateSentryEvent(event) {
79
146
  function scrubPrivateSentryTransaction(event) {
80
147
  const eventRecord = event;
81
148
  scrubContainer(eventRecord);
149
+ scrubSensitiveRequest(event.request);
82
150
  scrubContainer(event.contexts?.trace);
83
151
  for (const span of event.spans ?? []) {
84
152
  scrubContainer(span);
package/dist/nitro.js CHANGED
@@ -1,13 +1,13 @@
1
1
  import {
2
2
  resolveConversationWorkQueueTopic
3
- } from "./chunk-MIAKQNYX.js";
3
+ } from "./chunk-6ZK6FZIV.js";
4
4
  import {
5
5
  PLUGIN_TASK_QUEUE_TOPIC
6
- } from "./chunk-KNFROR7R.js";
6
+ } from "./chunk-5I6ORJUY.js";
7
7
  import {
8
8
  pluginCatalogConfigFromPluginSet,
9
9
  pluginRuntimeRegistrationsFromPluginSet
10
- } from "./chunk-SG5WAA7H.js";
10
+ } from "./chunk-WKU7TY22.js";
11
11
  import {
12
12
  loadPluginSetFromModule,
13
13
  resolvePluginModule
@@ -25,8 +25,8 @@ import {
25
25
  JUNIOR_PLUGIN_TASK_CALLBACK_ROUTE,
26
26
  JUNIOR_RETENTION_CRON_SCHEDULE,
27
27
  JUNIOR_RETENTION_ROUTE
28
- } from "./chunk-5CZ7RETL.js";
29
- import "./chunk-PM3PX42K.js";
28
+ } from "./chunk-N7TMYLF2.js";
29
+ import "./chunk-MGH5ADQS.js";
30
30
  import "./chunk-MLKGABMK.js";
31
31
 
32
32
  // src/nitro.ts
@@ -0,0 +1,231 @@
1
+ import {
2
+ GET,
3
+ GET2,
4
+ syncLocalOAuthCredential
5
+ } from "./chunk-VKZ6WVAY.js";
6
+ import "./chunk-FA6POGLH.js";
7
+ import "./chunk-UEVLIYK5.js";
8
+ import "./chunk-4CODA7P5.js";
9
+ import "./chunk-6ZK6FZIV.js";
10
+ import "./chunk-5I6ORJUY.js";
11
+ import {
12
+ createUserTokenStore
13
+ } from "./chunk-PGKWXHYJ.js";
14
+ import "./chunk-OF5FODBL.js";
15
+ import "./chunk-MU6HHZEN.js";
16
+ import "./chunk-PDO5BLNM.js";
17
+ import "./chunk-VZCSLYCE.js";
18
+ import "./chunk-53ZKTQO6.js";
19
+ import "./chunk-CI3VK7X5.js";
20
+ import "./chunk-KBNDFU6J.js";
21
+ import "./chunk-RXRQJF7Y.js";
22
+ import "./chunk-4ZNGQH7C.js";
23
+ import "./chunk-PZGPCOSD.js";
24
+ import "./chunk-VFUK3X5B.js";
25
+ import "./chunk-FXOYURO4.js";
26
+ import "./chunk-6RQ5GCWH.js";
27
+ import "./chunk-25GU5B5E.js";
28
+ import "./chunk-JZPQ5K4V.js";
29
+ import "./chunk-W3U3YQYI.js";
30
+ import "./chunk-HZF5P5UN.js";
31
+ import "./chunk-3JOGUT46.js";
32
+ import "./chunk-OB42YVAE.js";
33
+ import "./chunk-F3B2YJ76.js";
34
+ import "./chunk-6GWA276C.js";
35
+ import "./chunk-B3IT5END.js";
36
+ import "./chunk-3V7OFJZC.js";
37
+ import "./chunk-N7TMYLF2.js";
38
+ import "./chunk-MGH5ADQS.js";
39
+ import "./chunk-MLKGABMK.js";
40
+
41
+ // src/chat/local/oauth-callback-server.ts
42
+ import { createServer } from "http";
43
+ var LOCAL_OAUTH_TIMEOUT_MS = 10 * 60 * 1e3;
44
+ var LOCAL_OAUTH_CALLBACK_TIMEOUT_MS = 60 * 1e3;
45
+ function decodeProvider(value) {
46
+ if (!value) {
47
+ return void 0;
48
+ }
49
+ try {
50
+ const provider = decodeURIComponent(value);
51
+ return /^[a-z][a-z0-9-]*$/.test(provider) ? provider : void 0;
52
+ } catch {
53
+ return void 0;
54
+ }
55
+ }
56
+ async function startLocalOAuthCallbackServer(agentRunner) {
57
+ let pendingAuthorization;
58
+ const completeAuthorization = (authorization, result) => {
59
+ if (authorization.settled) {
60
+ return;
61
+ }
62
+ authorization.settled = true;
63
+ clearTimeout(authorization.timeout);
64
+ authorization.finish(result);
65
+ };
66
+ const cancelAuthorization = () => {
67
+ const authorization = pendingAuthorization;
68
+ if (!authorization) {
69
+ return;
70
+ }
71
+ pendingAuthorization = void 0;
72
+ completeAuthorization(
73
+ authorization,
74
+ new Error("Local OAuth authorization canceled")
75
+ );
76
+ };
77
+ const server = createServer(async (incoming, outgoing) => {
78
+ const host = incoming.headers.host ?? "127.0.0.1";
79
+ let requestUrl;
80
+ try {
81
+ requestUrl = new URL(incoming.url ?? "/", `http://${host}`);
82
+ } catch {
83
+ outgoing.writeHead(400).end("Invalid callback request");
84
+ return;
85
+ }
86
+ const mcpMatch = requestUrl.pathname.match(
87
+ /^\/api\/oauth\/callback\/mcp\/([^/]+)$/
88
+ );
89
+ const pluginMatch = requestUrl.pathname.match(
90
+ /^\/api\/oauth\/callback\/([^/]+)$/
91
+ );
92
+ const provider = decodeProvider(mcpMatch?.[1] ?? pluginMatch?.[1]);
93
+ if (!provider) {
94
+ outgoing.writeHead(404).end("Not found");
95
+ return;
96
+ }
97
+ const authorization = pendingAuthorization;
98
+ if (!authorization || authorization.callbackStarted || authorization.settled || requestUrl.searchParams.get("state") !== authorization.state) {
99
+ outgoing.writeHead(409).end("No matching authorization request");
100
+ return;
101
+ }
102
+ authorization.callbackStarted = true;
103
+ clearTimeout(authorization.timeout);
104
+ authorization.timeout = setTimeout(() => {
105
+ if (!outgoing.headersSent) {
106
+ outgoing.writeHead(504).end("Authorization callback timed out");
107
+ }
108
+ completeAuthorization(
109
+ authorization,
110
+ new Error("Timed out completing OAuth authorization")
111
+ );
112
+ }, LOCAL_OAUTH_CALLBACK_TIMEOUT_MS);
113
+ const backgroundTasks = [];
114
+ const waitUntil = (task) => {
115
+ backgroundTasks.push(
116
+ typeof task === "function" ? Promise.resolve().then(task) : task
117
+ );
118
+ };
119
+ try {
120
+ const request = new Request(requestUrl, { method: "GET" });
121
+ const response = mcpMatch ? await GET(request, provider, waitUntil, {
122
+ agentRunner
123
+ }) : await GET2(request, provider, waitUntil, {
124
+ agentRunner
125
+ });
126
+ const body = Buffer.from(await response.arrayBuffer());
127
+ await Promise.all(backgroundTasks);
128
+ if (response.ok) {
129
+ if (!mcpMatch) {
130
+ const tokens = await createUserTokenStore().get(
131
+ "local-cli",
132
+ provider
133
+ );
134
+ if (!tokens) {
135
+ throw new Error(
136
+ `${provider} authorization completed without a stored credential`
137
+ );
138
+ }
139
+ await syncLocalOAuthCredential(provider, tokens);
140
+ }
141
+ }
142
+ if (authorization.settled) {
143
+ return;
144
+ }
145
+ if (response.ok) {
146
+ completeAuthorization(authorization, true);
147
+ } else {
148
+ completeAuthorization(
149
+ authorization,
150
+ new Error(
151
+ `${provider} authorization callback failed with HTTP ${response.status}`
152
+ )
153
+ );
154
+ }
155
+ outgoing.writeHead(
156
+ response.status,
157
+ Object.fromEntries(response.headers.entries())
158
+ );
159
+ outgoing.end(body);
160
+ } catch (error) {
161
+ if (!outgoing.headersSent) {
162
+ outgoing.writeHead(500).end("Authorization callback failed");
163
+ }
164
+ completeAuthorization(
165
+ authorization,
166
+ error instanceof Error ? error : new Error(String(error))
167
+ );
168
+ }
169
+ });
170
+ await new Promise((resolve, reject) => {
171
+ server.once("error", reject);
172
+ server.listen(0, "127.0.0.1", () => {
173
+ server.off("error", reject);
174
+ resolve();
175
+ });
176
+ });
177
+ const address = server.address();
178
+ return {
179
+ beginAuthorization: (authorizationUrl) => {
180
+ if (pendingAuthorization) {
181
+ throw new Error("Local OAuth already has an active authorization");
182
+ }
183
+ const state = new URL(authorizationUrl).searchParams.get("state");
184
+ if (!state) {
185
+ throw new Error("Local OAuth authorization URL is missing state");
186
+ }
187
+ let finish = () => void 0;
188
+ const result = new Promise((resolve) => {
189
+ finish = resolve;
190
+ });
191
+ const authorization = {
192
+ callbackStarted: false,
193
+ finish,
194
+ result,
195
+ settled: false,
196
+ state,
197
+ timeout: setTimeout(() => {
198
+ completeAuthorization(
199
+ authorization,
200
+ new Error("Timed out waiting for OAuth authorization")
201
+ );
202
+ }, LOCAL_OAUTH_TIMEOUT_MS)
203
+ };
204
+ pendingAuthorization = authorization;
205
+ },
206
+ cancelAuthorization,
207
+ port: address.port,
208
+ waitForAuthorization: async () => {
209
+ const authorization = pendingAuthorization;
210
+ if (!authorization) {
211
+ throw new Error("Local OAuth has no active authorization");
212
+ }
213
+ const result = await authorization.result;
214
+ if (pendingAuthorization === authorization) {
215
+ pendingAuthorization = void 0;
216
+ }
217
+ if (result instanceof Error) {
218
+ throw result;
219
+ }
220
+ },
221
+ close: async () => {
222
+ cancelAuthorization();
223
+ await new Promise((resolve, reject) => {
224
+ server.close((error) => error ? reject(error) : resolve());
225
+ });
226
+ }
227
+ };
228
+ }
229
+ export {
230
+ startLocalOAuthCallbackServer
231
+ };
@@ -0,0 +1,9 @@
1
+ import {
2
+ createLocalOAuthState,
3
+ relayLocalOAuthCallback
4
+ } from "./chunk-FA6POGLH.js";
5
+ import "./chunk-MLKGABMK.js";
6
+ export {
7
+ createLocalOAuthState,
8
+ relayLocalOAuthCallback
9
+ };
@@ -0,0 +1,27 @@
1
+ export interface PersonalTokenMetadata {
2
+ id: string;
3
+ name: string;
4
+ tokenSuffix: string;
5
+ createdAt: string;
6
+ expiresAt: string;
7
+ lastUsedAt: string | null;
8
+ }
9
+ export interface CreatedPersonalToken extends PersonalTokenMetadata {
10
+ token: string;
11
+ }
12
+ /** Create a personal token and return its plaintext value exactly once. */
13
+ export declare function createPersonalToken(args: {
14
+ email: string;
15
+ name: string;
16
+ now?: Date;
17
+ }): Promise<CreatedPersonalToken>;
18
+ /** List active personal tokens owned by one verified user. */
19
+ export declare function listPersonalTokens(email: string, now?: Date): Promise<PersonalTokenMetadata[]>;
20
+ /** Revoke a personal token owned by one verified user. */
21
+ export declare function revokePersonalToken(args: {
22
+ email: string;
23
+ id: string;
24
+ now?: Date;
25
+ }): Promise<boolean>;
26
+ /** Resolve an active personal bearer token to its verified owner email. */
27
+ export declare function authenticatePersonalToken(token: string, now?: Date): Promise<string | undefined>;
@@ -4,7 +4,7 @@ import {
4
4
  pluginCatalogConfigFromPluginSet,
5
5
  pluginCliRegistrationsFromPluginSet,
6
6
  pluginRuntimeRegistrationsFromPluginSet
7
- } from "./chunk-SG5WAA7H.js";
7
+ } from "./chunk-WKU7TY22.js";
8
8
  import "./chunk-MLKGABMK.js";
9
9
  export {
10
10
  defineJuniorPlugins,
@@ -4,10 +4,16 @@ export declare const healthReportSchema: z.ZodObject<{
4
4
  service: z.ZodString;
5
5
  timestamp: z.ZodString;
6
6
  }, z.core.$strict>;
7
- export declare const pluginReportSchema: z.ZodObject<{
7
+ export declare const pluginSchema: z.ZodObject<{
8
+ configKeys: z.ZodArray<z.ZodString>;
9
+ description: z.ZodString;
10
+ displayName: z.ZodString;
8
11
  name: z.ZodString;
9
12
  }, z.core.$strict>;
10
- export declare const pluginReportsSchema: z.ZodArray<z.ZodObject<{
13
+ export declare const pluginsSchema: z.ZodArray<z.ZodObject<{
14
+ configKeys: z.ZodArray<z.ZodString>;
15
+ description: z.ZodString;
16
+ displayName: z.ZodString;
11
17
  name: z.ZodString;
12
18
  }, z.core.$strict>>;
13
19
  export declare const skillReportSchema: z.ZodObject<{
@@ -175,8 +181,8 @@ export declare const pluginOperationalReportFeedSchema: z.ZodObject<{
175
181
  source: z.ZodLiteral<"plugins">;
176
182
  }, z.core.$strict>;
177
183
  export type HealthReport = z.infer<typeof healthReportSchema>;
178
- export type PluginReport = z.infer<typeof pluginReportSchema>;
179
- export type PluginReports = z.infer<typeof pluginReportsSchema>;
184
+ export type Plugin = z.infer<typeof pluginSchema>;
185
+ export type Plugins = z.infer<typeof pluginsSchema>;
180
186
  export type SkillReport = z.infer<typeof skillReportSchema>;
181
187
  export type SkillReports = z.infer<typeof skillReportsSchema>;
182
188
  export type RuntimeInfoReport = z.infer<typeof runtimeInfoReportSchema>;
@@ -1,11 +1,11 @@
1
- import type { PluginOperationalReportFeed, PluginReport, RuntimeInfoReport, SkillReport } from "./reporting-schema";
2
- export { healthReportSchema, pluginOperationalReportFeedSchema, pluginOperationalReportSchema, pluginPackageContentItemReportSchema, pluginPackageContentReportSchema, pluginReportSchema, pluginReportsSchema, runtimeInfoReportSchema, skillReportSchema, skillReportsSchema, } from "./reporting-schema";
1
+ import type { PluginOperationalReportFeed, Plugin, RuntimeInfoReport, SkillReport } from "./reporting-schema";
2
+ export { healthReportSchema, pluginOperationalReportFeedSchema, pluginOperationalReportSchema, pluginPackageContentItemReportSchema, pluginPackageContentReportSchema, pluginSchema, pluginsSchema, runtimeInfoReportSchema, skillReportSchema, skillReportsSchema, } from "./reporting-schema";
3
3
  export { readHealthReport } from "./handlers/health";
4
- export type { HealthReport, PluginOperationalReport, PluginOperationalReportFeed, PluginPackageContentItemReport, PluginPackageContentReport, PluginReport, PluginReports, RuntimeInfoReport, SkillReport, SkillReports, } from "./reporting-schema";
4
+ export type { HealthReport, PluginOperationalReport, PluginOperationalReportFeed, PluginPackageContentItemReport, PluginPackageContentReport, Plugin, Plugins, RuntimeInfoReport, SkillReport, SkillReports, } from "./reporting-schema";
5
5
  /** Read discovered skill names for authenticated runtime diagnostics. */
6
6
  export declare function readSkillReports(): Promise<SkillReport[]>;
7
- /** Read configured plugin names for authenticated runtime diagnostics. */
8
- export declare function readPluginReports(): Promise<PluginReport[]>;
7
+ /** Read safe configured plugin metadata for authenticated runtime diagnostics. */
8
+ export declare function readPlugins(): Promise<Plugin[]>;
9
9
  /** Read authenticated runtime discovery data. */
10
10
  export declare function readRuntimeInfoReport(): Promise<RuntimeInfoReport>;
11
11
  /** Read sanitized operational summaries contributed by plugins. */