@sentry/junior 0.309.0 → 0.311.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 (117) hide show
  1. package/dist/adapter-B1wujchl.js +259 -0
  2. package/dist/{adapter-context-1YUbMpD3.js → adapter-context-G2M0y6rP.js} +2 -2
  3. package/dist/{admin-u30A8TcD.js → admin-DCiBhUT1.js} +1 -2
  4. package/dist/{agent-runner-sJLhgPQV.js → agent-runner-BVHPUIc8.js} +695 -1817
  5. package/dist/api/schema.d.ts +2 -2
  6. package/dist/api/schema.js +8 -7
  7. package/dist/api.d.ts +21 -3
  8. package/dist/api.js +1479 -372
  9. package/dist/{app-B_7Wn0en.d.ts → app-Cw5Vy6H6.d.ts} +14 -3
  10. package/dist/app.d.ts +2 -2
  11. package/dist/app.js +233 -506
  12. package/dist/{background-compaction-queue-CUJXVKG3.js → background-compaction-queue-CJDnWVOJ.js} +4 -4
  13. package/dist/{briefs-BHi70IR5.js → briefs-BDjnug6Y.js} +3 -3
  14. package/dist/{catalog-runtime-Chc_IP2o.js → catalog-runtime-DMY3VV-D.js} +1 -1
  15. package/dist/cli/chat.js +16 -16
  16. package/dist/cli/check.js +23 -29
  17. package/dist/cli/init.js +1 -6
  18. package/dist/cli/main.js +3 -3
  19. package/dist/cli/plugins.js +8 -7
  20. package/dist/cli/snapshot-create.js +5 -5
  21. package/dist/cli/upgrade.d.ts +1 -1
  22. package/dist/cli/upgrade.js +3 -3
  23. package/dist/{config-BIyIdTtA.js → config-BrXDQefC.js} +239 -5
  24. package/dist/{continue-in-slack-BQJBfiQh.js → continue-in-slack-DNXSC9So.js} +6 -5
  25. package/dist/{conversation-CzrLhdHG.js → conversation-ca__NDQW.js} +48 -9
  26. package/dist/{conversation-feed-B9e3_gxz.js → conversation-feed-DkinDu5o.js} +15 -6
  27. package/dist/{conversation-privacy-CkTW29hd.js → conversation-privacy-DxttrKb9.js} +1 -1
  28. package/dist/{conversation-turn-CZaYQUum.js → conversation-turn-DWw7Xhdr.js} +42 -39
  29. package/dist/{credential-sync-58m_CyIJ.js → credential-sync-Bk8wGb8Y.js} +15 -16
  30. package/dist/{db-B4Hjxr-u.d.ts → db-7ETESH44.d.ts} +3 -1
  31. package/dist/{db-CFUpEZi9.js → db-DTxzH7u5.js} +1618 -1041
  32. package/dist/{executor-DXL0O0MV.js → executor-DqTiYj9S.js} +454 -96
  33. package/dist/{history-N7IVbUom.js → history-CYstOMKX.js} +6 -0
  34. package/dist/{html-CaBu2VbT.js → html-B9Sl4Axb.js} +6 -6
  35. package/dist/{install-DhTBUUov.js → install-Sg4ePfLl.js} +2 -2
  36. package/dist/instrumentation.js +3 -3
  37. package/dist/{lineage-CxtOI2_p.js → lineage-BHAMpNKr.js} +2 -2
  38. package/dist/{logging-BNUovdcX.js → logging-FjclQsXu.js} +47 -9
  39. package/dist/{message-DcUsS2vg.js → message-CJ7_RL50.js} +5 -8
  40. package/dist/{model-input-o3rEqgwM.js → model-input-CMLh4Cwq.js} +3 -3
  41. package/dist/nitro.d.ts +1 -1
  42. package/dist/nitro.js +3 -3
  43. package/dist/{oauth-callback-server-1Fizd1EM.js → oauth-callback-server-RVcbiDjL.js} +2 -2
  44. package/dist/{oauth-relay-DOwngqdM.js → oauth-relay-Bu9kkaQu.js} +1 -1
  45. package/dist/{projection-Ce4pmhKP.js → projection-Cns7XwWa.js} +9206 -5318
  46. package/dist/{prompt-DEqjDVMs.js → prompt-CDqcsDYC.js} +4 -4
  47. package/dist/{registry-CNE4ZBnG.js → registry-BPwuOP2O.js} +5 -8
  48. package/dist/{resolve-qbPg-aC-.js → resolve-BK29bBry.js} +3 -3
  49. package/dist/rule-DAxQY-1h.js +20 -0
  50. package/dist/{runner-eGIxpAMf.js → runner-BcAE-cJm.js} +10 -10
  51. package/dist/{sandbox-egress-signals-DMFB1kCp.js → sandbox-egress-signals-C-q0go5b.js} +1 -1
  52. package/dist/{schedule-Cire6NU7.js → schedule-BLJ476XQ.js} +209 -43
  53. package/dist/{schema-CfIey9Ao.js → schema-BLgSZXcL.js} +255 -49
  54. package/dist/{schema-DriSvB40.d.ts → schema-DYcJeV7d.d.ts} +701 -62
  55. package/dist/{service-account-Cw_LWZ4-.js → service-account-gN0zqf0S.js} +68 -68
  56. package/dist/{service-account-B1VXCTqg.js → service-account-iJoCtkHR.js} +3 -3
  57. package/dist/{skills-Zg8-vrje.js → skills-BoZ80epJ.js} +77 -31
  58. package/dist/{slack-conversation-unfurl-DA51qH0c.js → slack-conversation-unfurl-CogYrITA.js} +8 -10
  59. package/dist/{spawn-DBi4-zD8.js → spawn-Dk92r7mX.js} +5 -6
  60. package/dist/{state-C-Ftk23K.js → state-DH3Cmgp3.js} +4 -4
  61. package/dist/{stop-D9xideLM.js → stop-CYsfc0Ed.js} +1064 -314
  62. package/dist/{store-BjIXA0Al.js → store-DmmMIrQi.js} +5 -5
  63. package/dist/{task-queue-D0_qbnpo.js → task-queue-C_zldF5J.js} +3 -3
  64. package/dist/{task-runner-DQMq4XY0.js → task-runner-C7oCJQIx.js} +21 -14
  65. package/dist/{thread-context-D0i1e-5O.js → thread-context-BW2BsQbH.js} +13 -11
  66. package/dist/{turn-session-routing-C0l68I_O.js → turn-session-routing-Xh_2nSQe.js} +52 -54
  67. package/dist/{validation-CRbvRPvu.js → validation-DrJd0nnq.js} +1 -1
  68. package/dist/{version-BYdVs12p.js → version-CNKZ8owc.js} +1 -1
  69. package/dist/version.js +1 -1
  70. package/dist/{warmup-DN9OHN1-.js → warmup-BWdHew2H.js} +14289 -7197
  71. package/dist/{web-message-id-BT8Mg8LL.js → web-message-id-Ch5dPq-a.js} +32 -144
  72. package/dist/{worker-C9ZfJXmV.js → worker-t9qpu_Zx.js} +7 -8
  73. package/migrations/0124_artifact_visibility.sql +9 -0
  74. package/migrations/0125_artifact_public_sha_index.sql +1 -0
  75. package/migrations/0126_artifact_drop_public.sql +8 -0
  76. package/migrations/0127_artifact_path.sql +4 -0
  77. package/migrations/0128_artifact_path_index.sql +1 -0
  78. package/migrations/0129_review_item_answered_index.sql +1 -0
  79. package/migrations/0130_review_item_status_index.sql +1 -0
  80. package/migrations/0131_brief_outcome_status.sql +1 -0
  81. package/migrations/0132_brief_outcome_status_backfill.sql +7 -0
  82. package/migrations/0133_brief_created_at_index.sql +1 -0
  83. package/migrations/0134_slack_person_search_index.sql +1 -0
  84. package/migrations/0135_code_change_size.sql +3 -0
  85. package/migrations/0136_merge_conflict_notice_dismiss.sql +16 -0
  86. package/migrations/0137_inbox_snoozes.sql +27 -0
  87. package/migrations/0138_code_change_search_index.sql +2 -0
  88. package/migrations/0139_review_item_owner.sql +22 -0
  89. package/migrations/0140_review_item_owner_index.sql +1 -0
  90. package/migrations/0141_memory_core_adoption.sql +89 -0
  91. package/migrations/0142_memory_core_indexes.sql +17 -0
  92. package/migrations/meta/0124_snapshot.json +5516 -0
  93. package/migrations/meta/0125_snapshot.json +5516 -0
  94. package/migrations/meta/0126_snapshot.json +5488 -0
  95. package/migrations/meta/0127_snapshot.json +5519 -0
  96. package/migrations/meta/0128_snapshot.json +5519 -0
  97. package/migrations/meta/0129_snapshot.json +5547 -0
  98. package/migrations/meta/0130_snapshot.json +5563 -0
  99. package/migrations/meta/0131_snapshot.json +5569 -0
  100. package/migrations/meta/0132_snapshot.json +5569 -0
  101. package/migrations/meta/0133_snapshot.json +5590 -0
  102. package/migrations/meta/0134_snapshot.json +5606 -0
  103. package/migrations/meta/0135_snapshot.json +5624 -0
  104. package/migrations/meta/0136_snapshot.json +5624 -0
  105. package/migrations/meta/0137_snapshot.json +5864 -0
  106. package/migrations/meta/0138_snapshot.json +5894 -0
  107. package/migrations/meta/0139_snapshot.json +5898 -0
  108. package/migrations/meta/0140_snapshot.json +5919 -0
  109. package/migrations/meta/0141_snapshot.json +6429 -0
  110. package/migrations/meta/0142_snapshot.json +6457 -0
  111. package/migrations/meta/_journal.json +134 -1
  112. package/package.json +6 -7
  113. package/dist/result-ZGnDzcsb.js +0 -548
  114. package/dist/session-stop-P2XdTiwr.js +0 -4252
  115. package/dist/turn-user-message-nBVvOXjs.js +0 -364
  116. package/dist/users-DdjMjbmM.js +0 -181
  117. package/dist/viewer-DudYrQGj.js +0 -212
@@ -1,12 +1,13 @@
1
- import { K as isRecord, b as setSpanAttributes, h as logWarn } from "./logging-BNUovdcX.js";
2
- import { i as resolvePluginHeaderEnvRefs, l as fetchWithBoundedOAuthErrorBodies } from "./registry-CNE4ZBnG.js";
3
- import { Ot as parseDestination, at as fenceLock, et as getStateAdapter, ot as withLock, rt as MUTATION_LOCK_TTL_MS } from "./db-CFUpEZi9.js";
4
- import { n as readEncryptedState, r as findLegacyWebActorUserId, t as createEncryptedState } from "./state-C-Ftk23K.js";
1
+ import { b as setSpanAttributes, h as logWarn } from "./logging-FjclQsXu.js";
2
+ import { i as resolvePluginHeaderEnvRefs, l as fetchWithBoundedOAuthErrorBodies } from "./registry-BPwuOP2O.js";
3
+ import { i as getStateAdapter } from "./adapter-B1wujchl.js";
4
+ import { B as withLock, L as MUTATION_LOCK_TTL_MS, n as botConfig, z as fenceLock } from "./config-BrXDQefC.js";
5
+ import { n as readEncryptedState, r as findLegacyWebActorUserId, t as createEncryptedState } from "./state-DH3Cmgp3.js";
5
6
  import { t as mapBounded } from "./fan-out-Cod-yEHG.js";
6
- import { n as botConfig } from "./config-BIyIdTtA.js";
7
+ import * as z from "zod";
7
8
  import { AsyncLocalStorage } from "node:async_hooks";
8
9
  import { randomUUID } from "node:crypto";
9
- import { sourceSchema } from "@sentry/junior-plugin-api";
10
+ import { destinationSchema, sourceSchema } from "@sentry/junior-plugin-api";
10
11
  import { UnauthorizedError, auth } from "@modelcontextprotocol/sdk/client/auth.js";
11
12
  import { Client } from "@modelcontextprotocol/sdk/client";
12
13
  import { StreamableHTTPClientTransport, StreamableHTTPError } from "@modelcontextprotocol/sdk/client/streamableHttp.js";
@@ -117,60 +118,55 @@ function parseSessionIndex(value) {
117
118
  return [];
118
119
  }
119
120
  }
121
+ const optionalStoredString = z.string().optional().catch(void 0);
122
+ const mcpAuthSessionSchema = z.object({
123
+ schemaVersion: z.literal(2),
124
+ authSessionId: z.string(),
125
+ provider: z.string(),
126
+ userId: z.string(),
127
+ conversationId: z.string(),
128
+ destination: destinationSchema.optional(),
129
+ source: sourceSchema.optional(),
130
+ sessionId: z.string(),
131
+ userMessage: z.string(),
132
+ channelId: optionalStoredString,
133
+ threadTs: optionalStoredString,
134
+ toolChannelId: optionalStoredString,
135
+ configuration: z.record(z.string(), z.unknown()).optional().catch(void 0),
136
+ authorizationUrl: optionalStoredString,
137
+ codeVerifier: optionalStoredString,
138
+ createdAtMs: z.number(),
139
+ updatedAtMs: z.number()
140
+ });
120
141
  function parseMcpAuthSession(value) {
121
- if (!isRecord(value)) return;
122
- try {
123
- const parsed = value;
124
- if (parsed["schemaVersion"] !== 2 || typeof parsed["authSessionId"] !== "string" || typeof parsed["provider"] !== "string" || typeof parsed["userId"] !== "string" || typeof parsed["conversationId"] !== "string" || typeof parsed["sessionId"] !== "string" || typeof parsed["userMessage"] !== "string" || typeof parsed["createdAtMs"] !== "number" || typeof parsed["updatedAtMs"] !== "number") return;
125
- const destination = parsed["destination"] === void 0 ? void 0 : parseDestination(parsed["destination"]);
126
- if (parsed["destination"] !== void 0 && !destination) return;
127
- const source = parsed["source"] === void 0 ? void 0 : sourceSchema.safeParse(parsed["source"]);
128
- if (parsed["source"] !== void 0 && (!source || !source.success)) return;
129
- return {
130
- schemaVersion: 2,
131
- authSessionId: parsed["authSessionId"],
132
- provider: parsed["provider"],
133
- userId: parsed["userId"],
134
- conversationId: parsed["conversationId"],
135
- ...destination ? { destination } : void 0,
136
- ...source?.success ? { source: source.data } : void 0,
137
- sessionId: parsed["sessionId"],
138
- userMessage: parsed["userMessage"],
139
- createdAtMs: parsed["createdAtMs"],
140
- updatedAtMs: parsed["updatedAtMs"],
141
- ...typeof parsed["channelId"] === "string" ? { channelId: parsed["channelId"] } : void 0,
142
- ...typeof parsed["threadTs"] === "string" ? { threadTs: parsed["threadTs"] } : void 0,
143
- ...typeof parsed["toolChannelId"] === "string" ? { toolChannelId: parsed["toolChannelId"] } : void 0,
144
- ...isRecord(parsed["configuration"]) ? { configuration: parsed["configuration"] } : void 0,
145
- ...typeof parsed["authorizationUrl"] === "string" ? { authorizationUrl: parsed["authorizationUrl"] } : void 0,
146
- ...typeof parsed["codeVerifier"] === "string" ? { codeVerifier: parsed["codeVerifier"] } : void 0
147
- };
148
- } catch {
149
- return;
150
- }
142
+ const parsed = mcpAuthSessionSchema.safeParse(value);
143
+ return parsed.success ? parsed.data : void 0;
151
144
  }
145
+ const serverSessionSchema = z.object({
146
+ sessionId: z.string(),
147
+ updatedAtMs: z.number()
148
+ });
152
149
  function parseServerSession(value) {
153
150
  if (typeof value !== "string") return;
154
151
  try {
155
- const parsed = JSON.parse(value);
156
- if (!isRecord(parsed) || typeof parsed["sessionId"] !== "string" || typeof parsed["updatedAtMs"] !== "number") return;
157
- return {
158
- sessionId: parsed["sessionId"],
159
- updatedAtMs: parsed["updatedAtMs"]
160
- };
152
+ const parsed = serverSessionSchema.safeParse(JSON.parse(value));
153
+ return parsed.success ? parsed.data : void 0;
161
154
  } catch {
162
155
  return;
163
156
  }
164
157
  }
158
+ const storedOAuthClientInformationSchema$1 = z.custom((value) => typeof value === "object" && value !== null);
159
+ const storedOAuthDiscoveryStateSchema$1 = z.custom((value) => typeof value === "object" && value !== null);
160
+ const storedOAuthTokensSchema$1 = z.custom((value) => typeof value === "object" && value !== null);
161
+ const storedCredentialsSchema = z.object({
162
+ clientInformation: storedOAuthClientInformationSchema$1.optional().catch(void 0),
163
+ discoveryState: storedOAuthDiscoveryStateSchema$1.optional().catch(void 0),
164
+ tokens: storedOAuthTokensSchema$1.optional().catch(void 0)
165
+ });
165
166
  function parseStoredCredentials(value) {
166
167
  try {
167
- const parsed = typeof value === "string" ? JSON.parse(value) : value;
168
- if (!isRecord(parsed)) return;
169
- return {
170
- ...isRecord(parsed["clientInformation"]) ? { clientInformation: parsed["clientInformation"] } : void 0,
171
- ...isRecord(parsed["discoveryState"]) ? { discoveryState: parsed.discoveryState } : void 0,
172
- ...isRecord(parsed["tokens"]) ? { tokens: parsed["tokens"] } : void 0
173
- };
168
+ const parsed = storedCredentialsSchema.safeParse(typeof value === "string" ? JSON.parse(value) : value);
169
+ return parsed.success ? parsed.data : void 0;
174
170
  } catch {
175
171
  return;
176
172
  }
@@ -566,18 +562,21 @@ function serviceAccountKey(provider) {
566
562
  function updateLockKey(provider) {
567
563
  return `${serviceAccountKey(provider)}:update`;
568
564
  }
565
+ const storedOAuthClientInformationSchema = z.custom((value) => typeof value === "object" && value !== null);
566
+ const storedOAuthDiscoveryStateSchema = z.custom((value) => typeof value === "object" && value !== null);
567
+ const storedOAuthTokensSchema = z.custom((value) => typeof value === "object" && value !== null);
568
+ const credentialsSchema = z.object({
569
+ clientInformation: storedOAuthClientInformationSchema,
570
+ connectedAtMs: z.number(),
571
+ connectedBy: z.string().optional().catch(void 0),
572
+ discoveryState: storedOAuthDiscoveryStateSchema.optional().catch(void 0),
573
+ redirectUrl: z.string(),
574
+ tokens: storedOAuthTokensSchema
575
+ });
569
576
  function parseCredentials(value) {
570
577
  try {
571
- const parsed = typeof value === "string" ? JSON.parse(value) : value;
572
- if (!isRecord(parsed) || !isRecord(parsed["clientInformation"]) || !isRecord(parsed["tokens"]) || typeof parsed["connectedAtMs"] !== "number" || typeof parsed["redirectUrl"] !== "string") return;
573
- return {
574
- clientInformation: parsed["clientInformation"],
575
- connectedAtMs: parsed["connectedAtMs"],
576
- ...typeof parsed["connectedBy"] === "string" ? { connectedBy: parsed["connectedBy"] } : void 0,
577
- ...isRecord(parsed["discoveryState"]) ? { discoveryState: parsed.discoveryState } : void 0,
578
- redirectUrl: parsed["redirectUrl"],
579
- tokens: parsed["tokens"]
580
- };
578
+ const parsed = credentialsSchema.safeParse(typeof value === "string" ? JSON.parse(value) : value);
579
+ return parsed.success ? parsed.data : void 0;
581
580
  } catch {
582
581
  return;
583
582
  }
@@ -710,16 +709,17 @@ function createMcpServiceAccountClientProvider(provider, connected) {
710
709
  function signInKey(state) {
711
710
  return `${SIGN_IN_KEY_PREFIX}:${state}`;
712
711
  }
712
+ const signInSchema = z.object({
713
+ clientInformation: storedOAuthClientInformationSchema,
714
+ codeVerifier: z.string(),
715
+ discoveryState: storedOAuthDiscoveryStateSchema.optional().catch(void 0),
716
+ provider: z.string(),
717
+ redirectUrl: z.string(),
718
+ startedBy: z.string().optional().catch(void 0)
719
+ });
713
720
  function parseSignIn(value) {
714
- if (!isRecord(value) || !isRecord(value["clientInformation"]) || typeof value["codeVerifier"] !== "string" || typeof value["provider"] !== "string" || typeof value["redirectUrl"] !== "string") return;
715
- return {
716
- clientInformation: value["clientInformation"],
717
- codeVerifier: value["codeVerifier"],
718
- ...isRecord(value["discoveryState"]) ? { discoveryState: value.discoveryState } : void 0,
719
- provider: value["provider"],
720
- redirectUrl: value["redirectUrl"],
721
- ...typeof value["startedBy"] === "string" ? { startedBy: value["startedBy"] } : void 0
722
- };
721
+ const parsed = signInSchema.safeParse(value);
722
+ return parsed.success ? parsed.data : void 0;
723
723
  }
724
724
  /** Build an OAuth client provider that keeps sign-in state in memory. */
725
725
  function signInProvider(input) {
@@ -1,6 +1,6 @@
1
- import { n as finishServiceAccountSignIn, o as serviceAccountPlugins, r as getServiceAccountStatus, s as startServiceAccountSignIn, t as disconnectServiceAccount } from "./service-account-Cw_LWZ4-.js";
2
- import { n as pluginCatalogRuntime } from "./catalog-runtime-Chc_IP2o.js";
3
- import { Q as disconnectStateAdapter } from "./db-CFUpEZi9.js";
1
+ import { n as finishServiceAccountSignIn, o as serviceAccountPlugins, r as getServiceAccountStatus, s as startServiceAccountSignIn, t as disconnectServiceAccount } from "./service-account-gN0zqf0S.js";
2
+ import { n as pluginCatalogRuntime } from "./catalog-runtime-DMY3VV-D.js";
3
+ import { n as disconnectStateAdapter } from "./adapter-B1wujchl.js";
4
4
  import { CLI_USAGE } from "./cli/run.js";
5
5
  import { createServer } from "node:http";
6
6
  // src/cli/service-account.ts
@@ -1,7 +1,7 @@
1
1
  import { t as __exportAll } from "./rolldown-runtime-BKpuH2hG.js";
2
2
  import { s as skillRoots } from "./package-discovery-DD9vencX.js";
3
- import { h as logWarn } from "./logging-BNUovdcX.js";
4
- import { n as pluginCatalogRuntime } from "./catalog-runtime-Chc_IP2o.js";
3
+ import { h as logWarn } from "./logging-FjclQsXu.js";
4
+ import { n as pluginCatalogRuntime } from "./catalog-runtime-DMY3VV-D.js";
5
5
  import { t as mapBounded } from "./fan-out-Cod-yEHG.js";
6
6
  import * as z from "zod";
7
7
  import path from "node:path";
@@ -19,20 +19,36 @@ function isCommonEnvironmentVariable(name) {
19
19
  "TERM",
20
20
  "TMP",
21
21
  "TMPDIR",
22
- "USER",
23
- "XDG_CONFIG_HOME"
22
+ "USER"
24
23
  ].includes(name.toUpperCase());
25
24
  }
25
+ const DOLLAR_REFERENCE = /(?<![a-z0-9$])\$([a-z0-9]+(?:-[a-z0-9]+)*)(?![a-z0-9]|[-_][a-z0-9])/gi;
26
+ const SLASH_REFERENCE = /(?:^|\s)\/([a-z0-9]+(?:-[a-z0-9]+)*)(?![a-z0-9/-])/gi;
27
+ function referenceMatches(text, pattern) {
28
+ return [...text.matchAll(pattern)].flatMap((match) => match[1] ? [{
29
+ index: match.index,
30
+ name: match[1].toLowerCase()
31
+ }] : []);
32
+ }
33
+ function dollarReferenceMatches(text) {
34
+ return referenceMatches(text, DOLLAR_REFERENCE).filter(({ name }) => !isCommonEnvironmentVariable(name));
35
+ }
26
36
  /**
27
- * Return the skills that `text` references explicitly, in order: each
28
- * `$name`, then each `/name`. Only these two forms reference a skill.
37
+ * Return the skills that a person's `text` references explicitly, once each,
38
+ * in the order they appear. `$name` is the reference form; `/name` is
39
+ * accepted as older input.
29
40
  */
30
41
  function skillReferences(text, availableSkills) {
31
- const isSkill = (name) => availableSkills.some((skill) => skill.name === name);
32
- const dollarPattern = /(?<![\w$])\$([a-z0-9]+(?:-[a-z0-9]+)*)/gi;
33
- const slashPattern = /(?:^|\s)\/([a-z0-9]+(?:-[a-z0-9]+)*)(?![a-z0-9/-])/gi;
34
- const names = (pattern) => [...text.matchAll(pattern)].flatMap((match) => match[1] ? [match[1].toLowerCase()] : []);
35
- return [...names(dollarPattern).filter((name) => !isCommonEnvironmentVariable(name)), ...names(slashPattern)].filter(isSkill);
42
+ const names = [...dollarReferenceMatches(text), ...referenceMatches(text, SLASH_REFERENCE)].sort((left, right) => left.index - right.index).map(({ name }) => name).filter((name) => availableSkills.some((skill) => skill.name === name));
43
+ return [...new Set(names)];
44
+ }
45
+ /**
46
+ * Return the names that a SKILL.md body references as `$name`, once each, in
47
+ * the order they appear, whether or not a skill has that name. A body has no
48
+ * `/name` form, so a path such as `/brief` unlocks nothing.
49
+ */
50
+ function skillBodyReferences(body) {
51
+ return [...new Set(dollarReferenceMatches(body).map(({ name }) => name))];
36
52
  }
37
53
  // src/chat/skills.ts
38
54
  var skills_exports = /* @__PURE__ */ __exportAll({
@@ -208,6 +224,43 @@ function buildPluginRuntimeBoundary(manifest) {
208
224
  function applyPluginRuntimeBoundary(plugin, body) {
209
225
  return plugin ? `${buildPluginRuntimeBoundary(plugin.manifest)}\n\n${body}` : body;
210
226
  }
227
+ /**
228
+ * Codex's `agents/openai.yaml` makes a skill manual-only with
229
+ * `policy.allow_implicit_invocation: false`. Junior treats it the same as
230
+ * `disable-model-invocation: true`.
231
+ */
232
+ const openAiSkillPolicySchema = z.object({ policy: z.object({ allow_implicit_invocation: z.boolean().optional() }).optional() });
233
+ /**
234
+ * Return whether the text of a skill's `agents/openai.yaml` makes the skill
235
+ * manual-only. Invalid YAML leaves the skill model-invocable.
236
+ */
237
+ function openAiPolicyDisablesImplicitInvocation(raw, filePath) {
238
+ let parsed;
239
+ try {
240
+ parsed = parse(raw);
241
+ } catch (error) {
242
+ logWarn("skill.openai_yaml.invalid", {
243
+ "file.path": filePath,
244
+ "exception.message": error instanceof Error ? error.message : String(error)
245
+ });
246
+ }
247
+ const result = openAiSkillPolicySchema.safeParse(parsed);
248
+ return result.success && result.data.policy?.allow_implicit_invocation === false;
249
+ }
250
+ async function openAiImplicitInvocationDisabled(skillDir) {
251
+ const policyFile = path.join(skillDir, "agents", "openai.yaml");
252
+ let raw;
253
+ try {
254
+ raw = await fs.readFile(policyFile, "utf8");
255
+ } catch (error) {
256
+ if (!(error instanceof Error && "code" in error && error.code === "ENOENT")) logWarn("skill.openai_yaml.invalid", {
257
+ "file.path": policyFile,
258
+ "exception.message": error instanceof Error ? error.message : String(error)
259
+ });
260
+ return false;
261
+ }
262
+ return openAiPolicyDisablesImplicitInvocation(raw, policyFile);
263
+ }
211
264
  async function readSkillDirectory(skillDir) {
212
265
  const skillFile = path.join(skillDir, "SKILL.md");
213
266
  try {
@@ -219,15 +272,18 @@ async function readSkillDirectory(skillDir) {
219
272
  });
220
273
  return null;
221
274
  }
222
- const { name, description, allowedTools, disableModelInvocation } = parsed.skill;
275
+ const { name, description, allowedTools } = parsed.skill;
276
+ const disableModelInvocation = parsed.skill.disableModelInvocation === true || await openAiImplicitInvocationDisabled(skillDir);
223
277
  const plugin = pluginCatalogRuntime.getForSkillPath(skillDir);
278
+ const references = skillBodyReferences(parsed.skill.body);
224
279
  return {
225
280
  name,
226
281
  description,
227
282
  skillPath: skillDir,
228
283
  ...plugin ? { pluginProvider: plugin.manifest.name } : void 0,
229
284
  ...allowedTools ? { allowedTools } : void 0,
230
- ...disableModelInvocation ? { disableModelInvocation } : void 0
285
+ ...disableModelInvocation ? { disableModelInvocation } : void 0,
286
+ ...references.length > 0 ? { references } : void 0
231
287
  };
232
288
  } catch (error) {
233
289
  logWarn("skill.directory.read.failed", {
@@ -268,24 +324,14 @@ async function discoverSkills(options) {
268
324
  };
269
325
  return sorted;
270
326
  }
327
+ /** Most skills one message can invoke, like Claude Code. */
328
+ const MAX_INVOKED_SKILLS = 6;
271
329
  /**
272
- * Extract an explicit skill invocation from a user message. `$name` is the
273
- * canonical form; `/name` still works for older messages and automations.
330
+ * Return the skills that a message invokes with `$name`, in message order,
331
+ * once each. `/name` still works as older input.
274
332
  */
275
- function parseSkillInvocation(messageText, availableSkills) {
276
- const trimmed = messageText.trim();
277
- const escapePattern = (value) => value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
278
- const [referencedSkill] = skillReferences(trimmed, availableSkills);
279
- if (referencedSkill) return { skillName: referencedSkill };
280
- const namedSkill = availableSkills.find((skill) => {
281
- if (skill.disableModelInvocation !== true) return false;
282
- const skillPattern = escapePattern(skill.name);
283
- const explicitUse = new RegExp(`\\b(?:use|run|load|call|invoke)\\s+(?:the\\s+)?${skillPattern}(?:\\s+skill)?\\b`, "i");
284
- const negatedUse = new RegExp(`\\b(?:do\\s+not|don't|dont|never)\\s+(?:use|run|load|call|invoke)\\s+(?:the\\s+)?${skillPattern}(?:\\s+skill)?\\b`, "i");
285
- return explicitUse.test(trimmed) && !negatedUse.test(trimmed);
286
- });
287
- if (!namedSkill) return null;
288
- return { skillName: namedSkill.name };
333
+ function parseSkillInvocations(messageText, availableSkills) {
334
+ return skillReferences(messageText, availableSkills).slice(0, MAX_INVOKED_SKILLS);
289
335
  }
290
336
  /** Look up a skill by name from the available set. */
291
337
  function findSkillByName(skillName, available) {
@@ -305,10 +351,10 @@ async function loadSkillsByName(skillNames, available) {
305
351
  skillPath: meta.skillPath,
306
352
  ...plugin ? { pluginProvider: plugin.manifest.name } : void 0,
307
353
  ...parsed.skill.allowedTools ? { allowedTools: parsed.skill.allowedTools } : void 0,
308
- ...parsed.skill.disableModelInvocation ? { disableModelInvocation: parsed.skill.disableModelInvocation } : void 0,
354
+ ...parsed.skill.disableModelInvocation || meta.disableModelInvocation ? { disableModelInvocation: true } : void 0,
309
355
  body: applyPluginRuntimeBoundary(plugin, parsed.skill.body)
310
356
  };
311
357
  };
312
358
  return await mapBounded(available.filter((meta) => selected.has(meta.name)), loadSkill);
313
359
  }
314
- export { parseSkillInvocation as a, parseSkillFile as i, findSkillByName as n, skills_exports as o, loadSkillsByName as r, skillReferences as s, discoverSkills as t };
360
+ export { parseSkillFile as a, openAiPolicyDisablesImplicitInvocation as i, findSkillByName as n, parseSkillInvocations as o, loadSkillsByName as r, skills_exports as s, discoverSkills as t };
@@ -1,16 +1,14 @@
1
1
  import { t as __exportAll } from "./rolldown-runtime-BKpuH2hG.js";
2
- import { Ct as deferConversationMove, Ja as readConversationAccessFromSql, Ls as escapeSlackMrkdwnText, Ps as getWorkspaceTeamId, Rs as formatSlackLink, fs as postSlackEphemeralMessage, hs as unfurlSlackLinks, ro as readLatestConversationBrief, uc as parseDashboardConversationLink } from "./projection-Ce4pmhKP.js";
2
+ import { Pt as readActorIdentity, a as getConversationStore, hn as readConversationAccessFromSql, o as getDb, s as getSqlExecutor, z as getConversationIdByProviderConversation } from "./db-DTxzH7u5.js";
3
3
  import { _ as slackUserIdSchema, b as slackMessageTsSchema, f as parseSlackTeamId, g as slackTeamIdSchema, h as slackChannelIdSchema, m as slackBotIdSchema, n as createSlackActor, p as parseSlackUserId, s as parseActorUserId, u as parseSlackChannelId } from "./actor-BsBdxDXQ.js";
4
- import { Z as createCache, a as getConversationStore, ct as getConversationIdByProviderConversation, o as getDb, s as getSqlExecutor } from "./db-CFUpEZi9.js";
5
- import { i as lookupSlackUserProfile, n as lookupSlackBot } from "./users-DdjMjbmM.js";
6
- import { E as withSpan } from "./logging-BNUovdcX.js";
7
- import { i as readActorIdentity } from "./viewer-DudYrQGj.js";
8
- import { t as runWithSlackInstallation } from "./adapter-context-1YUbMpD3.js";
9
- import { a as isMovableToSlack, i as continueConversationInSlack, n as alreadyContinuesInSlackMessage, t as BUSY } from "./continue-in-slack-BQJBfiQh.js";
10
- import { pr as checkSlackChannelReadAccess } from "./warmup-DN9OHN1-.js";
11
- import "./store-BjIXA0Al.js";
4
+ import { Ho as unfurlSlackLinks, Ls as parseDashboardConversationLink, Tt as deferConversationMove, ds as formatSlackLink, ja as readLatestConversationBrief, ss as getWorkspaceTeamId, us as escapeSlackMrkdwnText, zo as postSlackEphemeralMessage } from "./projection-Cns7XwWa.js";
5
+ import { Hi as checkSlackChannelReadAccess, hn as lookupSlackUserProfile, mn as lookupSlackBot } from "./warmup-BWdHew2H.js";
6
+ import { F as createCache, n as botConfig } from "./config-BrXDQefC.js";
7
+ import { E as withSpan } from "./logging-FjclQsXu.js";
8
+ import { t as runWithSlackInstallation } from "./adapter-context-G2M0y6rP.js";
9
+ import { a as isMovableToSlack, i as continueConversationInSlack, n as alreadyContinuesInSlackMessage, t as BUSY } from "./continue-in-slack-DNXSC9So.js";
10
+ import "./store-DmmMIrQi.js";
12
11
  import { t as mapBounded } from "./fan-out-Cod-yEHG.js";
13
- import { n as botConfig } from "./config-BIyIdTtA.js";
14
12
  import * as z from "zod";
15
13
  // src/chat/ingress/workspace-membership.ts
16
14
  const MEMBER_TTL_MS = 3e5;
@@ -1,10 +1,9 @@
1
1
  import { t as __exportAll } from "./rolldown-runtime-BKpuH2hG.js";
2
- import { F as actorFromRun, I as toolInvocationDestination } from "./agent-runner-sJLhgPQV.js";
3
- import { n as botConfig } from "./config-BIyIdTtA.js";
4
- import { t as readConversationLineage } from "./lineage-CxtOI2_p.js";
5
- import { _ as getConversationWorkState } from "./store-BjIXA0Al.js";
6
- import { Ht as getAgentInvocation, Tn as getAgentBinding, cn as createAndEnqueueAgentInvocation, xn as AgentDepthLimitError } from "./warmup-DN9OHN1-.js";
7
- import { A as getAgentInvocationMessageId, E as getAgentInvocationId, L as getUnnamedAgentConversationId } from "./turn-user-message-nBVvOXjs.js";
2
+ import { N as actorFromRun, P as toolInvocationDestination } from "./agent-runner-BVHPUIc8.js";
3
+ import { n as botConfig } from "./config-BrXDQefC.js";
4
+ import { t as readConversationLineage } from "./lineage-BHAMpNKr.js";
5
+ import { _ as getConversationWorkState } from "./store-DmmMIrQi.js";
6
+ import { Br as getAgentInvocationId, Fn as createAndEnqueueAgentInvocation, Hr as getUnnamedAgentConversationId, Vr as getAgentInvocationMessageId, Yn as getAgentInvocation, ar as getAgentBinding, tr as AgentDepthLimitError } from "./warmup-BWdHew2H.js";
8
7
  // src/chat/agent-invocations/spawn.ts
9
8
  var spawn_exports = /* @__PURE__ */ __exportAll({ bindSpawnAgent: () => bindSpawnAgent });
10
9
  /**
@@ -1,7 +1,7 @@
1
- import { i as getChatConfig } from "./config-BIyIdTtA.js";
2
- import { h as logWarn } from "./logging-BNUovdcX.js";
3
- import { o as getDb } from "./db-CFUpEZi9.js";
4
- import { B as juniorUsers } from "./executor-DXL0O0MV.js";
1
+ import { i as getChatConfig } from "./config-BrXDQefC.js";
2
+ import { h as logWarn } from "./logging-FjclQsXu.js";
3
+ import { o as getDb } from "./db-DTxzH7u5.js";
4
+ import { K as juniorUsers } from "./executor-DqTiYj9S.js";
5
5
  import { createCipheriv, createDecipheriv, createHash, randomBytes } from "node:crypto";
6
6
  import { eq } from "drizzle-orm";
7
7
  // src/chat/conversations/legacy-web-actor-id.ts