sentinelayer-cli 0.44.0 → 0.45.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 (46) hide show
  1. package/README.md +8 -4
  2. package/package.json +1 -1
  3. package/src/agents/jules/tools/aidenid-email.js +7 -9
  4. package/src/agents/jules/tools/frontend-analyze.js +15 -3
  5. package/src/agents/jules/tools/runtime-audit.js +51 -21
  6. package/src/ai/aidenid.js +5 -4
  7. package/src/ai/proxy.js +15 -14
  8. package/src/audit/orchestrator.js +8 -5
  9. package/src/auth/admission-scope.js +5 -3
  10. package/src/auth/credential-destinations.js +221 -0
  11. package/src/auth/gate.js +4 -4
  12. package/src/auth/http.js +22 -5
  13. package/src/auth/service.js +52 -56
  14. package/src/cli.js +14 -6
  15. package/src/commands/ai/provision-governance.js +7 -6
  16. package/src/commands/init.js +25 -16
  17. package/src/commands/scan.js +6 -4
  18. package/src/commands/session.js +33 -45
  19. package/src/commands/spec.js +2 -2
  20. package/src/commands/watch.js +4 -3
  21. package/src/config/service.js +37 -0
  22. package/src/daemon/pulse.js +2 -1
  23. package/src/daemon/watchdog.js +117 -68
  24. package/src/legacy-cli.js +119 -39
  25. package/src/mcp/bridge-inputs.js +223 -0
  26. package/src/mcp/cli-command-tools.js +157 -7
  27. package/src/mcp/registry.js +2 -1
  28. package/src/mcp/session-stdio-server.js +114 -35
  29. package/src/mcp/smoke.js +27 -11
  30. package/src/mcp/token-service.js +7 -9
  31. package/src/memory/retrieval.js +14 -5
  32. package/src/pocket/ring-owner.js +13 -8
  33. package/src/review/ai-review.js +2 -2
  34. package/src/review/dd-report-email-client.js +4 -5
  35. package/src/session/admission-access.js +13 -10
  36. package/src/session/admission-auth.js +95 -16
  37. package/src/session/admission.js +44 -9
  38. package/src/session/checkpoints.js +11 -10
  39. package/src/session/file-locks.js +19 -18
  40. package/src/session/invitations.js +26 -19
  41. package/src/session/live-source.js +13 -13
  42. package/src/session/route-classes.js +107 -0
  43. package/src/session/sync.js +70 -56
  44. package/src/session/tickets.js +21 -19
  45. package/src/session/title-sync.js +4 -3
  46. package/src/telemetry/sync.js +8 -9
package/src/legacy-cli.js CHANGED
@@ -20,6 +20,12 @@ import {
20
20
  listSupportedCodingAgents,
21
21
  resolveCodingAgent,
22
22
  } from "./config/agent-dictionary.js";
23
+ import {
24
+ CredentialDestinationRefused,
25
+ credentialedRequest,
26
+ resolveTrustContext,
27
+ userCredential,
28
+ } from "./auth/credential-destinations.js";
23
29
  import { resolveOutputRoot } from "./config/service.js";
24
30
  import { normalizeAgentEvent } from "./events/schema.js";
25
31
  import { collectCodebaseIngest, formatIngestSummary } from "./ingest/engine.js";
@@ -143,6 +149,8 @@ function parseCliArgs(argv) {
143
149
  let interviewFile = "";
144
150
  let nonInteractive = boolFromEnv(process.env.SENTINELAYER_CLI_NON_INTERACTIVE);
145
151
  let skipBrowserOpen = boolFromEnv(process.env.SENTINELAYER_CLI_SKIP_BROWSER_OPEN);
152
+ let injectSecret = false;
153
+ let injectOpenAiKey = false;
146
154
  let showHelp = false;
147
155
  let showVersion = false;
148
156
 
@@ -165,6 +173,14 @@ function parseCliArgs(argv) {
165
173
  skipBrowserOpen = true;
166
174
  continue;
167
175
  }
176
+ if (arg === "--inject-secret") {
177
+ injectSecret = true;
178
+ continue;
179
+ }
180
+ if (arg === "--inject-openai-key") {
181
+ injectOpenAiKey = true;
182
+ continue;
183
+ }
168
184
  if (arg === "--interview-file") {
169
185
  const next = String(argv[i + 1] || "").trim();
170
186
  if (!next) {
@@ -189,6 +205,8 @@ function parseCliArgs(argv) {
189
205
  interviewFile,
190
206
  nonInteractive,
191
207
  skipBrowserOpen,
208
+ injectSecret,
209
+ injectOpenAiKey,
192
210
  showHelp,
193
211
  showVersion,
194
212
  };
@@ -290,6 +308,8 @@ function printUsage() {
290
308
  console.log(" --json Machine-readable JSON output");
291
309
  console.log(" --path PATH Target workspace path");
292
310
  console.log(" --non-interactive Disable prompts (require --interview-file)");
311
+ console.log(" --inject-secret init: set the project token as a GitHub Actions secret on this directory's git remote");
312
+ console.log(" --inject-openai-key init: also set OPENAI_API_KEY from your environment as a secret there");
293
313
  console.log("");
294
314
  console.log("Quickstart:");
295
315
  console.log(" sl auth login && npx create-sentinelayer my-app && cd my-app");
@@ -450,11 +470,18 @@ function sleep(ms) {
450
470
  return new Promise((resolve) => setTimeout(resolve, ms));
451
471
  }
452
472
 
453
- async function requestJson(url, { method = "GET", headers = {}, body, timeoutMs = DEFAULT_REQUEST_TIMEOUT_MS } = {}) {
473
+ async function requestJson(
474
+ url,
475
+ { method = "GET", headers = {}, body, credential = null, timeoutMs = DEFAULT_REQUEST_TIMEOUT_MS } = {},
476
+ ) {
477
+ // Without a credential, nothing here attaches one: a caller-built Authorization header is refused.
478
+ if (Object.keys(headers || {}).some((name) => /^(?:proxy-)?authorization$/i.test(name))) {
479
+ throw new TypeError("requestJson: send a credential with { credential }, not an Authorization header.");
480
+ }
454
481
  const controller = new AbortController();
455
482
  const timeout = setTimeout(() => controller.abort(), timeoutMs);
456
483
  try {
457
- const response = await fetch(url, {
484
+ const init = {
458
485
  method,
459
486
  headers: {
460
487
  "Content-Type": "application/json",
@@ -462,7 +489,9 @@ async function requestJson(url, { method = "GET", headers = {}, body, timeoutMs
462
489
  },
463
490
  body: body === undefined ? undefined : JSON.stringify(body),
464
491
  signal: controller.signal,
465
- });
492
+ };
493
+ // A credential (src/auth/credential-destinations.js) goes only to its own origin.
494
+ const response = credential ? await credentialedRequest(credential, url, init) : await fetch(url, init);
466
495
 
467
496
  const text = await response.text();
468
497
  let payload = null;
@@ -491,7 +520,7 @@ async function requestJson(url, { method = "GET", headers = {}, body, timeoutMs
491
520
  }
492
521
  return payload;
493
522
  } catch (error) {
494
- if (error instanceof SentinelayerApiError) {
523
+ if (error instanceof SentinelayerApiError || error instanceof CredentialDestinationRefused) {
495
524
  throw error;
496
525
  }
497
526
  if (error instanceof Error && error.name === "AbortError") {
@@ -551,26 +580,25 @@ async function pollCliSession({
551
580
  });
552
581
  }
553
582
 
554
- async function generateArtifacts({ apiUrl, authToken, payload }) {
583
+ async function generateArtifacts({ apiUrl, credential, payload }) {
555
584
  return requestJson(`${apiUrl}/api/v1/builder/generate`, {
556
585
  method: "POST",
557
- headers: {
558
- Authorization: `Bearer ${authToken}`,
559
- },
586
+ credential,
560
587
  body: payload,
561
588
  timeoutMs: 180_000,
562
589
  });
563
590
  }
564
591
 
565
- async function issueBootstrapToken({ apiUrl, authToken }) {
592
+ async function issueBootstrapToken({ apiUrl, credential }) {
566
593
  return requestJson(`${apiUrl}/api/v1/builder/bootstrap-token`, {
567
594
  method: "POST",
568
- headers: {
569
- Authorization: `Bearer ${authToken}`,
570
- },
595
+ credential,
571
596
  });
572
597
  }
573
598
 
599
+ // The init flow's credential steps, for tests.
600
+ export const __legacyCredentialFlowForTests = Object.freeze({ pollCliSession, generateArtifacts, issueBootstrapToken, requestJson });
601
+
574
602
  function detectRepoSlug(cwd) {
575
603
  const gitRemote = spawnSync("git", ["config", "--get", "remote.origin.url"], {
576
604
  cwd,
@@ -2748,6 +2776,35 @@ Continue autonomously unless blocked by missing credentials or permissions.`,
2748
2776
  };
2749
2777
  }
2750
2778
 
2779
+ // The repository that receives GitHub Actions secrets is shown, and gh must confirm that the
2780
+ // signed-in user can write to it.
2781
+ function confirmSecretsRepository(repoSlug) {
2782
+ printInfo(`GitHub Actions secrets target: ${repoSlug} (the git remote of ${process.cwd()})`);
2783
+ if (!isValidRepoSlug(repoSlug)) {
2784
+ return { ok: false, reason: "Invalid repo format. Use owner/repo." };
2785
+ }
2786
+ const ghCommand = getGhCommand();
2787
+ try {
2788
+ ensureGhCliAvailable(ghCommand);
2789
+ } catch (error) {
2790
+ return { ok: false, reason: error instanceof Error ? error.message : String(error) };
2791
+ }
2792
+ const view = spawnSync(ghCommand, ["api", `repos/${repoSlug}`], { encoding: "utf-8" });
2793
+ if (view.status !== 0) {
2794
+ return { ok: false, reason: `gh could not read ${repoSlug}: ${String(view.stderr || view.stdout || "").trim()}` };
2795
+ }
2796
+ let permissions = {};
2797
+ try {
2798
+ permissions = JSON.parse(String(view.stdout || "{}")).permissions || {};
2799
+ } catch {
2800
+ // unreadable output: not confirmed
2801
+ }
2802
+ if (!(permissions.admin || permissions.maintain || permissions.push)) {
2803
+ return { ok: false, reason: `the signed-in gh user cannot write to ${repoSlug}.` };
2804
+ }
2805
+ return { ok: true };
2806
+ }
2807
+
2751
2808
  function runGhSecretSet({ repoSlug, secretName, secretValue }) {
2752
2809
  const normalizedRepo = normalizeRepoSlug(repoSlug);
2753
2810
  const ghCommand = getGhCommand();
@@ -3097,8 +3154,10 @@ async function collectInterview({ initialProjectName, detectedRepo, detectedCodi
3097
3154
  {
3098
3155
  type: base.authMode === "sentinelayer" ? "toggle" : null,
3099
3156
  name: "injectSecret",
3100
- message: "Inject SENTINELAYER_TOKEN into GitHub Actions secrets now?",
3101
- initial: true,
3157
+ message: `Set the project token as a GitHub Actions secret on this directory's git remote${
3158
+ detectedRepo ? ` (${detectedRepo})` : ""
3159
+ }?`,
3160
+ initial: false,
3102
3161
  active: "yes",
3103
3162
  inactive: "no",
3104
3163
  },
@@ -3192,6 +3251,9 @@ function printInfo(message) {
3192
3251
 
3193
3252
  export async function runLegacyCli(rawArgs = process.argv.slice(2)) {
3194
3253
  refreshRuntimeDefaults();
3254
+ // The API this flow talks to is the trust context's (environment, then global config): the token
3255
+ // it is issued may only be sent there, and a workspace .sentinelayer.yml does not choose it.
3256
+ DEFAULT_API_URL = (await resolveTrustContext()).apiOrigin;
3195
3257
  const commandExitCode = await tryRunLocalCommandMode(rawArgs);
3196
3258
  if (commandExitCode !== null) {
3197
3259
  if (commandExitCode !== 0) {
@@ -3243,6 +3305,15 @@ export async function runLegacyCli(rawArgs = process.argv.slice(2)) {
3243
3305
  );
3244
3306
  }
3245
3307
  validateInterviewInput(interview);
3308
+ const secretsOptIn = {
3309
+ projectToken: Boolean(args.injectSecret || interview.injectSecret),
3310
+ openAiKey: Boolean(args.injectOpenAiKey),
3311
+ };
3312
+ if ((secretsOptIn.projectToken || secretsOptIn.openAiKey) && process.env.SENTINELAYER_MCP_BRIDGE === "1") {
3313
+ throw new Error(
3314
+ "GitHub Actions secrets are not set through the MCP bridge. Run `sl init --inject-secret` in your own terminal."
3315
+ );
3316
+ }
3246
3317
 
3247
3318
  const workspace = await resolveProjectDirectory({
3248
3319
  cwd: process.cwd(),
@@ -3264,7 +3335,7 @@ export async function runLegacyCli(rawArgs = process.argv.slice(2)) {
3264
3335
  }
3265
3336
 
3266
3337
  const requestedAuthMode = interview.authMode === "byok" ? "byok" : "sentinelayer";
3267
- let authToken = "";
3338
+ let authCredential = null;
3268
3339
 
3269
3340
  printSection("Authentication");
3270
3341
  if (requestedAuthMode === "byok") {
@@ -3304,8 +3375,8 @@ export async function runLegacyCli(rawArgs = process.argv.slice(2)) {
3304
3375
  timeoutMs: DEFAULT_AUTH_TIMEOUT_MS,
3305
3376
  });
3306
3377
 
3307
- authToken = String(approval.auth_token || "").trim();
3308
- if (!authToken) {
3378
+ authCredential = await userCredential(approval.auth_token, { source: "init_approval" });
3379
+ if (!authCredential) {
3309
3380
  throw new Error("Authentication completed but no auth token was returned.");
3310
3381
  }
3311
3382
  }
@@ -3343,7 +3414,7 @@ export async function runLegacyCli(rawArgs = process.argv.slice(2)) {
3343
3414
  } else {
3344
3415
  generated = await generateArtifacts({
3345
3416
  apiUrl: DEFAULT_API_URL,
3346
- authToken,
3417
+ credential: authCredential,
3347
3418
  payload: generatePayload,
3348
3419
  });
3349
3420
 
@@ -3352,7 +3423,7 @@ export async function runLegacyCli(rawArgs = process.argv.slice(2)) {
3352
3423
  try {
3353
3424
  bootstrapToken = await issueBootstrapToken({
3354
3425
  apiUrl: DEFAULT_API_URL,
3355
- authToken,
3426
+ credential: authCredential,
3356
3427
  });
3357
3428
  } catch (error) {
3358
3429
  const message = error instanceof Error ? error.message : String(error);
@@ -3538,24 +3609,30 @@ export async function runLegacyCli(rawArgs = process.argv.slice(2)) {
3538
3609
  repoSlug: interview.connectRepo ? interview.repoSlug : "",
3539
3610
  });
3540
3611
 
3541
- const repoSlugForSecrets = normalizeRepoSlug(interview.repoSlug || detectRepoSlug(projectDir) || "");
3542
- const openAiApiKey = String(process.env.OPENAI_API_KEY || "").trim();
3612
+ // GitHub Actions secrets are set only on an explicit opt-in (--inject-secret, or injectSecret in
3613
+ // the interview, outside the MCP bridge), only on this directory's own git remote (never a slug
3614
+ // from the interview), and only after gh confirms the signed-in user can write to it.
3615
+ // OPENAI_API_KEY is set only with its own --inject-openai-key.
3543
3616
  const secretTargets = [];
3544
- if (sentinelayerToken) {
3617
+ if (sentinelayerToken && secretsOptIn.projectToken) {
3545
3618
  secretTargets.push({
3546
3619
  secretName,
3547
3620
  secretValue: sentinelayerToken,
3548
3621
  placeholder: "<sentinelayer-token>",
3549
3622
  });
3550
3623
  }
3551
- secretTargets.push({
3552
- secretName: "OPENAI_API_KEY",
3553
- secretValue: openAiApiKey,
3554
- placeholder: "<your-openai-api-key>",
3555
- });
3624
+ if (secretsOptIn.openAiKey) {
3625
+ secretTargets.push({
3626
+ secretName: "OPENAI_API_KEY",
3627
+ secretValue: String(process.env.OPENAI_API_KEY || "").trim(),
3628
+ placeholder: "<your-openai-api-key>",
3629
+ });
3630
+ }
3631
+ const repoSlugForSecrets = secretTargets.length > 0 ? normalizeRepoSlug(detectedRepo || "") : "";
3632
+ const secretsRepoCheck = repoSlugForSecrets ? confirmSecretsRepository(repoSlugForSecrets) : null;
3556
3633
 
3557
3634
  const githubSecretResults = [];
3558
- if (repoSlugForSecrets) {
3635
+ if (repoSlugForSecrets && secretsRepoCheck.ok) {
3559
3636
  for (const target of secretTargets) {
3560
3637
  const value = String(target.secretValue || "").trim();
3561
3638
  if (!value) {
@@ -3627,14 +3704,14 @@ export async function runLegacyCli(rawArgs = process.argv.slice(2)) {
3627
3704
  pc.green(`✔ ${codingAgentConfig.agent.name} config scaffolded at ${codingAgentConfig.path}`)
3628
3705
  );
3629
3706
  }
3630
- if (repoSlugForSecrets) {
3707
+ if (repoSlugForSecrets && secretsRepoCheck.ok) {
3631
3708
  for (const result of githubSecretResults) {
3632
3709
  if (result.ok) {
3633
- console.log(pc.green(`✔ ${result.secretName} injected into GitHub repo secret (${repoSlugForSecrets})`));
3710
+ console.log(pc.green(`✔ ${result.secretName} set as a GitHub Actions secret on ${repoSlugForSecrets}`));
3634
3711
  continue;
3635
3712
  }
3636
3713
  const stateLabel = result.skipped ? "skipped" : "failed";
3637
- console.log(pc.yellow(`! GitHub secret injection ${stateLabel} for ${result.secretName}: ${result.reason}`));
3714
+ console.log(pc.yellow(`! GitHub secret ${stateLabel} for ${result.secretName}: ${result.reason}`));
3638
3715
  console.log(
3639
3716
  pc.yellow(
3640
3717
  ` Run manually: gh secret set ${result.secretName} --repo ${repoSlugForSecrets} --body ${result.placeholder}`
@@ -3642,18 +3719,21 @@ export async function runLegacyCli(rawArgs = process.argv.slice(2)) {
3642
3719
  );
3643
3720
  }
3644
3721
  } else if (secretTargets.length > 0) {
3645
- console.log(
3646
- pc.yellow(
3647
- "! GitHub secret auto-injection skipped: no repo slug detected. Connect a repo or run manual secret commands."
3648
- )
3649
- );
3722
+ const reason = repoSlugForSecrets
3723
+ ? secretsRepoCheck.reason
3724
+ : "this directory has no GitHub git remote.";
3725
+ console.log(pc.yellow(`! GitHub Actions secrets not set: ${reason}`));
3650
3726
  for (const target of secretTargets) {
3651
3727
  console.log(
3652
- pc.yellow(
3653
- ` Run manually: gh secret set ${target.secretName} --repo <owner/repo> --body ${target.placeholder}`
3654
- )
3728
+ pc.yellow(` Run manually: gh secret set ${target.secretName} --repo <owner/repo> --body ${target.placeholder}`)
3655
3729
  );
3656
3730
  }
3731
+ } else if (sentinelayerToken) {
3732
+ console.log(
3733
+ pc.gray(
3734
+ `GitHub Actions secrets were not set. To set ${secretName} on this directory's git remote, rerun with --inject-secret, or run: gh secret set ${secretName} --repo <owner/repo>`
3735
+ )
3736
+ );
3657
3737
  }
3658
3738
 
3659
3739
  console.log("\nNext:");
@@ -0,0 +1,223 @@
1
+ // bridge-inputs.js -- the inputs the MCP CLI bridge exposes, command by command.
2
+ //
3
+ // Default-deny. An input not listed for its command is not exposed; a command with no entry,
4
+ // or with an argument or a required option that is not listed, is not exposed at all. Commands
5
+ // the bridge blocks outright (src/mcp/cli-command-tools.js) need no entry. DENIED records each
6
+ // input deliberately left out, and why. A unit test walks the command tree and fails on any
7
+ // input of an exposed command that is in neither list, and on entries that name nothing.
8
+ //
9
+ // Nothing that names where a request goes (a URL, host, origin, endpoint or gateway) is allowed:
10
+ // a tool caller never chooses a destination for this machine's credentials. Those commands use
11
+ // the configured API and pocket gateway. Nor is anything that names a program to run (an
12
+ // executable, binary, shell, command or script) or turns off a safety check (a sandbox, approval
13
+ // or similar bypass): a tool caller never chooses what this machine executes, or how freely.
14
+
15
+ /** Command path (dotted, as in the tool name after "sl.") -> its exposed inputs, space-separated. */
16
+ export const BRIDGE_ALLOWED_INPUTS = Object.freeze({
17
+ "ai.identity.audit": "path outputDir stale json",
18
+ "ai.identity.lineage": "identityId path outputDir apiKey orgId projectId json",
19
+ "ai.identity.list": "path outputDir json",
20
+ "ai.identity.show": "identityId path outputDir json",
21
+ "apply": "plan path outputDir json",
22
+ "audit.architecture": "path registryFile outputDir refresh dryRun json",
23
+ "audit.compliance": "path registryFile outputDir refresh dryRun json",
24
+ "audit.diff": "baseRunId candidateRunId path outputDir json",
25
+ "audit.documentation": "path registryFile outputDir refresh dryRun json",
26
+ "audit.frontend": "path mode maxCost maxTurns provider model apiKey stream refresh skipBaseline skipRuntime outputDir json",
27
+ "audit.local": "path outputDir reuseOmargate json",
28
+ "audit.package": "path runId outputDir json",
29
+ "audit.performance": "path registryFile outputDir refresh dryRun json",
30
+ "audit.registry": "registryFile json",
31
+ "audit.replay": "runId path registryFile outputDir refresh json",
32
+ "audit.security": "path registryFile outputDir refresh dryRun json",
33
+ "audit.testing": "path registryFile outputDir refresh dryRun json",
34
+ "board.check": "file json",
35
+ "chat.ask": "prompt provider model apiKey path outputDir sessionId dryRun stream json",
36
+ "cost.record": "path outputDir sessionId provider model inputTokens outputTokens cacheReadTokens cacheWriteTokens durationMs toolCalls costUsd progressScore maxCost maxTokens maxRuntimeMs maxToolCalls maxNoProgress warnAtPercent json",
37
+ "cost.show": "path outputDir json",
38
+ "daemon.assign.claim": "workItemId path outputDir agent leaseTtlSeconds stage runId jiraIssueKey budgetSnapshotJson json",
39
+ "daemon.assign.heartbeat": "workItemId path outputDir agent leaseTtlSeconds stage runId jiraIssueKey budgetSnapshotJson json",
40
+ "daemon.assign.list": "path outputDir status agent includeExpired limit json",
41
+ "daemon.assign.reassign": "workItemId path outputDir fromAgent toAgent leaseTtlSeconds stage runId jiraIssueKey budgetSnapshotJson json",
42
+ "daemon.assign.release": "workItemId path outputDir agent status stage runId jiraIssueKey reason budgetSnapshotJson json",
43
+ "daemon.budget.check": "workItemId path outputDir usageJson budgetJson nowIso json",
44
+ "daemon.budget.status": "path outputDir workItemId lifecycleState limit json",
45
+ "daemon.control.snapshot": "path outputDir status agent limit nowIso json",
46
+ "daemon.error.queue": "path outputDir status limit json",
47
+ // endpoint: a route label written to the local error intake; nothing is sent to it
48
+ "daemon.error.record": "path outputDir source service endpoint errorCode severity message stack commitSha metadataJson json",
49
+ "daemon.error.worker": "path outputDir maxEvents json",
50
+ "daemon.jira.comment": "path outputDir workItemId issueKey actor type message json",
51
+ "daemon.jira.list": "path outputDir workItemId issueKey status limit json",
52
+ "daemon.jira.open": "workItemId path outputDir summary description labels assignee issueKey issueKeyPrefix actor json",
53
+ "daemon.jira.start": "workItemId plan path outputDir actor assignee summary description labels issueKey issueKeyPrefix json",
54
+ "daemon.jira.transition": "path outputDir workItemId issueKey to actor reason json",
55
+ "daemon.lineage.build": "path outputDir nowIso json",
56
+ "daemon.lineage.list": "path outputDir status workItemId limit json",
57
+ "daemon.lineage.show": "workItemId path outputDir json",
58
+ "daemon.maintenance.off": "path outputDir reason message actor json",
59
+ "daemon.maintenance.on": "path outputDir reason message actor json",
60
+ "daemon.maintenance.status": "path outputDir json",
61
+ "daemon.map.handoff": "workItemId path outputDir runId assignee maxFiles nowIso json",
62
+ "daemon.map.handoff-list": "path outputDir workItemId limit json",
63
+ "daemon.map.handoff-show": "workItemId path outputDir handoffRunId json",
64
+ "daemon.map.list": "path outputDir workItemId limit json",
65
+ "daemon.map.scope": "workItemId path outputDir maxFiles graphDepth nowIso json",
66
+ "daemon.map.show": "workItemId path outputDir runId json",
67
+ "daemon.reliability.run": "path outputDir region timezone simulateFailure checks maintenanceAutoOpen clearMaintenanceOnPass nowIso json",
68
+ "daemon.reliability.status": "path outputDir limit json",
69
+ "daemon.watchdog.run": "path outputDir toolCallSeconds repeatedFileReadsThreshold budgetWarningThreshold turnStallTurns limit execute nowIso json",
70
+ "daemon.watchdog.status": "path outputDir limit json",
71
+ "guide.export": "format path specFile outputFile enrich provider model apiKey maxPhases maxPrsPerPhase json",
72
+ "guide.generate": "path specFile outputFile json",
73
+ "guide.show": "path file plain json",
74
+ "ingest.map": "path outputFile outputDir json",
75
+ "init": "projectName nonInteractive interviewFile skipBrowserOpen",
76
+ "mcp.bridge.init-vscode": "serverId serverConfig path force json",
77
+ "mcp.doctor": "timeoutMs json",
78
+ "mcp.list": "path json",
79
+ "mcp.registry.init-aidenid": "path outputDir force json",
80
+ "mcp.registry.init-aidenid-adapter": "registryFile path outputDir force json",
81
+ "mcp.registry.init-cli": "path outputDir force json",
82
+ "mcp.registry.init-hosted-session-connector": "registryFile path outputDir force json",
83
+ "mcp.registry.init-senti-session": "path outputDir force json",
84
+ "mcp.registry.init-session": "path outputDir force json",
85
+ "mcp.registry.validate": "file json",
86
+ "mcp.registry.validate-aidenid-adapter": "file registryFile json",
87
+ "mcp.registry.validate-hosted-session-connector": "file registryFile json",
88
+ "mcp.schema.show": "json",
89
+ "mcp.schema.write": "path outputDir force json",
90
+ "mcp.server.init": "id registryFile path outputDir force json",
91
+ "mcp.server.validate": "file json",
92
+ "mcp.smoke": "session limit scope ttlSeconds timeoutMs autoRotate json",
93
+ "omargate.deep": "path outputDir ai aiDryRun scopeMode diff staged scanMode maxParallel model provider maxCost notifySession requireUsageLedger persona skipPersona stream json",
94
+ "persona.orchestrator": "mode path outputDir json",
95
+ "persona.run": "personaId mode path files json",
96
+ "plugin.init": "id packType stage path outputDir force json",
97
+ "plugin.list": "path outputDir json",
98
+ "plugin.order": "path stage outputDir json",
99
+ "plugin.validate": "file json",
100
+ "policy.list": "path outputDir json",
101
+ "prompt.generate": "path specFile agent outputFile outputDir refresh json",
102
+ "prompt.preview": "path specFile agent maxLines outputDir refresh plain json",
103
+ "prompt.show": "path file agent plain json",
104
+ "review.accept": "findingId runId path outputDir note actor json",
105
+ "review.defer": "findingId runId path outputDir note actor json",
106
+ "review.diff": "baseRunId candidateRunId path outputDir outputFile json",
107
+ "review.reject": "findingId runId path outputDir note actor json",
108
+ "review.replay": "runId path spec outputDir refresh ai aiDryRun json",
109
+ "review.scan": "mode diff staged path spec outputDir refresh json",
110
+ "ring-owner": "question session kind option whatWeNeed checkpoint idempotencyKey json",
111
+ "scan.init": "path specFile workflowFile secretName hasE2eTests playwrightMode nonInteractive json",
112
+ "scan.precheck": "path specFile outputFile outputDir hasE2eTests playwrightMode provider model apiKey sessionId maxCost maxTokens maxRuntimeMs maxToolCalls maxNoProgress warnAtPercent json",
113
+ "scan.validate": "path specFile workflowFile secretName hasE2eTests playwrightMode json",
114
+ "session.action": "sessionId actionType targetSequence targetCursor targetActionId note agent idempotencyKey path json",
115
+ "session.actions": "json",
116
+ "session.checkpoint.create": "sessionId startSequence endSequence title summary summaryFile kind checkpointId agent tokenStart tokenEnd path json",
117
+ "session.checkpoint.generate": "sessionId minEvents maxEvents catchUp maxCheckpoints operationId agent path json",
118
+ "session.checkpoint.list": "sessionId limit path json",
119
+ "session.checkpoint.show": "sessionId checkpointId contextEvents maxEvents path json",
120
+ "session.comment": "sessionId targetSequenceId message agent idempotencyKey path json",
121
+ "session.continue": "path title json",
122
+ "session.edit": "sessionId target message agent expectedRevision idempotencyKey path json",
123
+ "session.ensure": "path session title ttlSeconds forceNew resume reuseWindowSeconds json",
124
+ "session.guard": "sessionId files agent path json",
125
+ "session.guard-hook": "sessionId agent path",
126
+ "session.guard-install": "sessionId agent path json",
127
+ "session.guard-uninstall": "sessionId agent path json",
128
+ "session.history": "limit preview path json",
129
+ "session.inject-guide": "sessionId path json",
130
+ "session.join": "sessionId name agent inviteToken seatKey idempotencyKey role model path goal deliverable stopWhen scope ttl provider wait waitSeconds cancelAdmission json",
131
+ "session.leave": "sessionId agent reason path json",
132
+ "session.list": "remote includeArchived limit path json",
133
+ "session.listeners": "sessionId path limit maxPages json",
134
+ "session.lock": "sessionId files intent ttl agent path json",
135
+ "session.locks": "sessionId path json",
136
+ "session.observe": "sessionId summary agent model displayName role kind severity owner batch targetSequence targetCursor proposal messageFile stdin path json",
137
+ "session.pins": "sessionId path json",
138
+ "session.post-agent": "sessionId message agent model displayName role to path json",
139
+ "session.react": "sessionId reaction targetSequence targetCursor targetActionId agent idempotencyKey path json",
140
+ "session.read": "sessionId tail follow live remote beforeSequence actions agent view includeControlEvents path json",
141
+ "session.recall": "need session role k path remote includeControlEvents json",
142
+ "session.recap.now": "sessionId session remote agent maxEvents path json",
143
+ "session.renew": "sessionId files ttl agent path json",
144
+ "session.reply": "sessionId targetSequenceId message agent idempotencyKey path json",
145
+ "session.say": "sessionId message agent model displayName role to replyTo replyCursor messageFile stdin forceCliUser localOnly path json",
146
+ "session.search": "sessionId query beforeSequence limit path json",
147
+ "session.set-title": "sessionId title path json",
148
+ "session.setup-guides": "sessionId path json",
149
+ "session.start": "path title template ttlSeconds forceNew force resume reuseWindowSeconds daemon json",
150
+ "session.status": "sessionId path json",
151
+ "session.stop-listener": "sessionId agent path json",
152
+ "session.sync": "sessionId since path json",
153
+ "session.templates": "json",
154
+ "session.ticket.claim": "sessionId ticketId expectedVersion agent path json",
155
+ "session.ticket.events": "sessionId after agent path json",
156
+ "session.ticket.list": "sessionId available agent path json",
157
+ "session.ticket.release": "sessionId ticketId reason agent path json",
158
+ "session.ticket.renew": "sessionId ticketId agent path json",
159
+ "session.ticket.submit": "sessionId ticketId sha evidenceFile agent path json",
160
+ "session.unlock": "sessionId files intent agent path json",
161
+ "session.usage": "sessionId remote recent format out path json",
162
+ "session.wake.codex-notify": "sessionId notificationJson session agent notification path json",
163
+ // host and resumeSession: the local host adapter (claude|codex) and its session to resume
164
+ "session.wake.daemon": "sessionId session agent host resumeSession cwd idleMs maxAttempts once json",
165
+ "spec.generate": "path template description projectType outputFile outputDir refresh ai provider model apiKey sessionId maxCost maxTokens maxRuntimeMs maxToolCalls maxNoProgress warnAtPercent json",
166
+ "spec.list-templates": "json",
167
+ "spec.regenerate": "path file template description projectType refresh dryRun diff plain maxDiffLines preserveManual json",
168
+ "spec.show": "path file plain json",
169
+ "spec.show-template": "templateId json",
170
+ "swarm.create": "path outputDir scenario penTestScenario targetId execute json",
171
+ "swarm.dashboard": "path runId outputDir watch pollSeconds maxIdleSeconds json",
172
+ "swarm.plan": "targetPath path registryFile agents scenario objective maxParallel maxCostUsd maxOutputTokens maxRuntimeMs maxToolCalls warningThresholdPercent outputDir json",
173
+ "swarm.registry": "registryFile json",
174
+ "swarm.report": "path runId planFile outputDir json",
175
+ "swarm.run": "targetPath path planFile playbookFile scenarioFile registryFile agents agent scope identityId scenario objective maxParallel maxSteps engine execute maxCostUsd maxOutputTokens maxRuntimeMs maxToolCalls warningThresholdPercent outputDir json",
176
+ "swarm.scenario.init": "scenarioId path output json",
177
+ "swarm.scenario.validate": "file json",
178
+ "telemetry.record": "path outputDir sessionId runId eventType inputTokens outputTokens cacheReadTokens cacheWriteTokens costUsd durationMs toolCalls stopClass blocking reasonCodes metadataJson json",
179
+ "telemetry.show": "path outputDir json",
180
+ "watch.history": "runId path outputDir limit json",
181
+ "watch.run-events": "runId path outputDir pollSeconds maxIdleSeconds saveArtifacts json",
182
+ });
183
+
184
+ /** Command path -> { input: why it is not exposed }. */
185
+ export const BRIDGE_DENIED_INPUTS = Object.freeze({
186
+ "ai.identity.lineage": {
187
+ apiUrl: "the AIdenID API that receives this command's API key",
188
+ },
189
+ "audit.frontend": {
190
+ url: "a deployed site that this command fetches and audits",
191
+ },
192
+ "init": {
193
+ injectSecret: "sets the project token as a GitHub Actions secret on a repository",
194
+ injectOpenaiKey: "sets OPENAI_API_KEY as a GitHub Actions secret on a repository",
195
+ },
196
+ "mcp.doctor": {
197
+ apiUrl: "the API that this command probes",
198
+ },
199
+ "mcp.smoke": {
200
+ apiUrl: "the API that receives the user's token",
201
+ },
202
+ "ring-owner": {
203
+ gatewayUrl: "the gateway that receives the user's token",
204
+ },
205
+ "swarm.create": {
206
+ target: "the site that this plan tests",
207
+ },
208
+ "swarm.run": {
209
+ startUrl: "the page that the browser opens",
210
+ },
211
+ "swarm.scenario.init": {
212
+ startUrl: "the page that a later swarm run opens",
213
+ },
214
+ "watch.run-events": {
215
+ apiUrl: "the API that receives the user's token",
216
+ },
217
+ });
218
+
219
+ /** The inputs a command exposes through the bridge, or null if it has no entry. */
220
+ export function bridgeAllowedInputs(commandPath) {
221
+ const listed = BRIDGE_ALLOWED_INPUTS[commandPath];
222
+ return typeof listed === "string" ? new Set(listed.split(/\s+/).filter(Boolean)) : null;
223
+ }