@ory/argus 1.2.3 → 1.3.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 (52) hide show
  1. package/README.md +25 -0
  2. package/assets/skills/ory-build-agent/SKILL.md +1 -1
  3. package/assets/skills/ory-deploy-agent/SKILL.md +315 -0
  4. package/assets/skills/ory-deploy-openai-e2b/SKILL.md +289 -0
  5. package/assets/skills/ory-e2b-sandbox/SKILL.md +10 -6
  6. package/assets/skills/ory-temporal-worker/SKILL.md +4 -4
  7. package/dist/adapters.d.ts +11 -3
  8. package/dist/adapters.js +55 -13
  9. package/dist/agent-auth.d.ts +18 -7
  10. package/dist/agent-auth.js +120 -10
  11. package/dist/auth-store.d.ts +3 -3
  12. package/dist/auth-store.js +56 -12
  13. package/dist/auth.d.ts +1 -1
  14. package/dist/auth.js +1 -1
  15. package/dist/bash-parser.js +212 -47
  16. package/dist/build-info.json +4 -4
  17. package/dist/cli.js +5 -0
  18. package/dist/client.d.ts +15 -0
  19. package/dist/client.js +24 -7
  20. package/dist/config.d.ts +23 -3
  21. package/dist/config.js +202 -18
  22. package/dist/contract-suite.d.ts +0 -8
  23. package/dist/contract-suite.js +0 -1
  24. package/dist/event-reporter.d.ts +1 -0
  25. package/dist/event-reporter.js +19 -2
  26. package/dist/hook-timeout.d.ts +2 -2
  27. package/dist/hook-timeout.js +2 -2
  28. package/dist/index.d.ts +4 -4
  29. package/dist/index.js +13 -6
  30. package/dist/lifecycle.js +2 -1
  31. package/dist/local/configs.d.ts +2 -4
  32. package/dist/local/configs.js +2 -4
  33. package/dist/local/manager.js +4 -4
  34. package/dist/local/seed.d.ts +4 -4
  35. package/dist/local/seed.js +8 -10
  36. package/dist/permissions.d.ts +3 -3
  37. package/dist/permissions.js +26 -1
  38. package/dist/runtime-credential.d.ts +35 -0
  39. package/dist/runtime-credential.js +252 -1
  40. package/dist/runtime.d.ts +19 -12
  41. package/dist/runtime.js +69 -21
  42. package/dist/setup.js +3 -3
  43. package/dist/skills.d.ts +3 -5
  44. package/dist/skills.js +14 -5
  45. package/dist/subject.d.ts +2 -3
  46. package/dist/subject.js +10 -11
  47. package/dist/testing.d.ts +17 -0
  48. package/dist/testing.js +53 -0
  49. package/dist/tool-catalog.d.ts +17 -15
  50. package/dist/tool-catalog.js +239 -52
  51. package/dist/user-login.js +1 -1
  52. package/package.json +1 -1
package/dist/config.js CHANGED
@@ -33,7 +33,9 @@ var __importStar = (this && this.__importStar) || (function () {
33
33
  };
34
34
  })();
35
35
  Object.defineProperty(exports, "__esModule", { value: true });
36
- exports.LOCAL_AGENT_SECURITY_URL = exports.DEFAULT_AGENT_SECURITY_URL = exports.DEFAULT_OAUTH2_CLIENT_ID = exports.SESSIONLESS_KEY = exports.UNKNOWN_HARNESS_KEY = exports.DELEGATION_NODE_HISTORY = void 0;
36
+ exports.LOCAL_AGENT_SECURITY_URL = exports.DEFAULT_AGENT_SECURITY_URL = exports.DEFAULT_OAUTH2_CLIENT_ID = exports.SESSIONLESS_KEY = exports.UNKNOWN_HARNESS_KEY = exports.AGENT_ROOT_DELEGATION_ENV_VAR = exports.DELEGATION_NODE_HISTORY = void 0;
37
+ exports.validateAgentRootDelegation = validateAgentRootDelegation;
38
+ exports.readAgentRootDelegation = readAgentRootDelegation;
37
39
  exports.getDataDir = getDataDir;
38
40
  exports.getHarnessDataDir = getHarnessDataDir;
39
41
  exports.getConfigPath = getConfigPath;
@@ -43,6 +45,7 @@ exports.registerInstalledHarness = registerInstalledHarness;
43
45
  exports.unregisterInstalledHarness = unregisterInstalledHarness;
44
46
  exports.saveConfig = saveConfig;
45
47
  exports.mutateConfig = mutateConfig;
48
+ exports.mutateConfigAsync = mutateConfigAsync;
46
49
  exports.looksLikeProjectId = looksLikeProjectId;
47
50
  exports.isSecurityConnected = isSecurityConnected;
48
51
  exports.describeSecurityGap = describeSecurityGap;
@@ -51,6 +54,7 @@ exports.configPromptMessage = configPromptMessage;
51
54
  const fs = __importStar(require("node:fs"));
52
55
  const os = __importStar(require("node:os"));
53
56
  const path = __importStar(require("node:path"));
57
+ const node_crypto_1 = require("node:crypto");
54
58
  const cli_invocation_js_1 = require("./cli-invocation.js");
55
59
  /**
56
60
  * How many sessions' delegation node ids to keep per credential. Only the
@@ -58,6 +62,29 @@ const cli_invocation_js_1 = require("./cli-invocation.js");
58
62
  * bounded so a long-lived install's config doesn't grow without limit.
59
63
  */
60
64
  exports.DELEGATION_NODE_HISTORY = 10;
65
+ /** Opaque, administrator-provisioned root delegation node for headless agents. */
66
+ exports.AGENT_ROOT_DELEGATION_ENV_VAR = "ORY_AGENT_ROOT_DELEGATION";
67
+ /** Validate an opaque broker node without interpreting its server-owned format. */
68
+ function validateAgentRootDelegation(raw) {
69
+ if (raw === undefined)
70
+ return {};
71
+ const value = raw.trim();
72
+ if (!value) {
73
+ return { warning: `${exports.AGENT_ROOT_DELEGATION_ENV_VAR} is set but empty; ignoring it.` };
74
+ }
75
+ if (Buffer.byteLength(value, "utf8") > 255 || /[\0\r\n]/.test(raw)) {
76
+ return {
77
+ warning: `${exports.AGENT_ROOT_DELEGATION_ENV_VAR} must be at most 255 UTF-8 bytes and contain no NUL or newline characters; ignoring it.`,
78
+ };
79
+ }
80
+ return { value };
81
+ }
82
+ function readAgentRootDelegation(env = process.env, warnings) {
83
+ const { value, warning } = validateAgentRootDelegation(env[exports.AGENT_ROOT_DELEGATION_ENV_VAR]);
84
+ if (warning)
85
+ warnings?.push(warning);
86
+ return value;
87
+ }
61
88
  /**
62
89
  * Key used when a credential record carries no harness of its own — only
63
90
  * reachable by migrating a config written before credentials were keyed by
@@ -78,7 +105,7 @@ exports.UNKNOWN_HARNESS_KEY = "unknown";
78
105
  exports.SESSIONLESS_KEY = "sessionless";
79
106
  /**
80
107
  * Single OS-agnostic data directory for *all* Ory agent plugin state:
81
- * the shared config file, persisted DCR credentials, and any harness
108
+ * the shared config file, persisted legacy DCR credentials, and any harness
82
109
  * asset directories. One place per platform — never split across
83
110
  * `~/.ory/` and `~/.config/`.
84
111
  *
@@ -118,8 +145,11 @@ function configFile() {
118
145
  function configLockFile() {
119
146
  return configFile() + ".lock";
120
147
  }
121
- /** A lock that is older than this is considered stale and may be broken. */
122
- const LOCK_STALE_MS = 30_000;
148
+ /** Age fallback for malformed or definitely cross-host lock owners. */
149
+ const LOCK_STALE_FALLBACK_MS = 5 * 60_000;
150
+ /** Lease used by nonce-bearing locks; async transactions refresh it. */
151
+ const LOCK_LEASE_MS = 5_000;
152
+ const LOCK_HEARTBEAT_MS = 1_000;
123
153
  /** Polling interval while waiting to acquire the lock. */
124
154
  const LOCK_POLL_MS = 25;
125
155
  /** Maximum total time to wait for the lock before giving up. */
@@ -507,6 +537,7 @@ function parseOAuth2(value) {
507
537
  refreshToken: typeof v.refreshToken === "string" ? v.refreshToken : undefined,
508
538
  expiresAt: v.expiresAt,
509
539
  subject: typeof v.subject === "string" ? v.subject : undefined,
540
+ clientId: typeof v.clientId === "string" ? v.clientId : undefined,
510
541
  };
511
542
  }
512
543
  /**
@@ -540,6 +571,25 @@ function mutateConfig(mutator) {
540
571
  releaseLock(lock);
541
572
  }
542
573
  }
574
+ /**
575
+ * Async read-modify-write transaction using the same config.json.lock as
576
+ * mutateConfig. The lock remains held while the callback awaits, which lets
577
+ * token refresh serialize its read/check/network/write sequence across
578
+ * JavaScript and Go processes without blocking the JavaScript event loop.
579
+ */
580
+ async function mutateConfigAsync(mutator) {
581
+ ensureConfigDir();
582
+ const lock = await acquireLockAsync();
583
+ try {
584
+ const mutation = await mutator(loadConfig());
585
+ if (mutation.config)
586
+ writeConfigAtomic(mutation.config);
587
+ return mutation.value;
588
+ }
589
+ finally {
590
+ releaseLock(lock);
591
+ }
592
+ }
543
593
  function mergeConfig(existing, update) {
544
594
  const result = { ...existing };
545
595
  for (const key of Object.keys(update)) {
@@ -568,23 +618,16 @@ function acquireLock() {
568
618
  for (;;) {
569
619
  try {
570
620
  const fd = fs.openSync(lockPath, "wx", 0o600);
571
- fs.writeSync(fd, String(process.pid));
572
- return { fd };
621
+ const nonce = (0, node_crypto_1.randomBytes)(16).toString("hex");
622
+ fs.writeSync(fd, configLockOwner(nonce));
623
+ return { fd, nonce };
573
624
  }
574
625
  catch (err) {
575
626
  if (err.code !== "EEXIST")
576
627
  throw err;
577
- // Lock exists — check if it's stale.
578
628
  try {
579
- const stat = fs.statSync(lockPath);
580
- if (Date.now() - stat.mtimeMs > LOCK_STALE_MS) {
581
- // Best-effort break; if another process beats us, we'll retry.
582
- try {
583
- fs.unlinkSync(lockPath);
584
- }
585
- catch {
586
- /* ignore */
587
- }
629
+ const observed = inspectConfigLock(lockPath);
630
+ if (observed.stale && removeObservedLock(lockPath, observed)) {
588
631
  continue;
589
632
  }
590
633
  }
@@ -606,6 +649,142 @@ function acquireLock() {
606
649
  }
607
650
  }
608
651
  }
652
+ async function acquireLockAsync() {
653
+ const deadline = Date.now() + LOCK_TIMEOUT_MS;
654
+ const lockPath = configLockFile();
655
+ for (;;) {
656
+ try {
657
+ const fd = fs.openSync(lockPath, "wx", 0o600);
658
+ const nonce = (0, node_crypto_1.randomBytes)(16).toString("hex");
659
+ fs.writeSync(fd, configLockOwner(nonce));
660
+ const lock = { fd, nonce };
661
+ lock.heartbeat = setInterval(() => heartbeatLock(lock), LOCK_HEARTBEAT_MS);
662
+ lock.heartbeat.unref?.();
663
+ return lock;
664
+ }
665
+ catch (err) {
666
+ if (err.code !== "EEXIST")
667
+ throw err;
668
+ try {
669
+ const observed = inspectConfigLock(lockPath);
670
+ if (observed.stale && removeObservedLock(lockPath, observed)) {
671
+ continue;
672
+ }
673
+ }
674
+ catch {
675
+ continue;
676
+ }
677
+ if (Date.now() > deadline) {
678
+ throw new Error(`Timed out waiting for config lock at ${lockPath}. ` +
679
+ "Another process may be holding it; remove the file if you are sure no other process is running.");
680
+ }
681
+ await new Promise((resolve) => setTimeout(resolve, LOCK_POLL_MS));
682
+ }
683
+ }
684
+ }
685
+ function configLockOwner(nonce, now = Date.now()) {
686
+ return `${process.pid} ${os.hostname()} ${nonce} ${now + LOCK_LEASE_MS}`;
687
+ }
688
+ function inspectConfigLock(lockPath) {
689
+ const stat = fs.statSync(lockPath);
690
+ let raw = "";
691
+ try {
692
+ raw = fs.readFileSync(lockPath, "utf8").trim();
693
+ }
694
+ catch {
695
+ return {
696
+ stale: Date.now() - stat.mtimeMs > LOCK_STALE_FALLBACK_MS,
697
+ raw,
698
+ dev: stat.dev,
699
+ ino: stat.ino,
700
+ };
701
+ }
702
+ const [pidText, hostname, nonce, leaseText] = raw.split(/\s+/, 4);
703
+ const pid = Number.parseInt(pidText ?? "", 10);
704
+ const leaseExpiresAt = Number.parseInt(leaseText ?? "", 10);
705
+ const hasLease = Boolean(nonce) && Number.isFinite(leaseExpiresAt);
706
+ if (hasLease && Date.now() > leaseExpiresAt) {
707
+ return { stale: true, raw, dev: stat.dev, ino: stat.ino };
708
+ }
709
+ if (Number.isInteger(pid) && pid > 0 && (!hostname || hostname === os.hostname())) {
710
+ try {
711
+ process.kill(pid, 0);
712
+ return {
713
+ stale: !hasLease && Date.now() - stat.mtimeMs > LOCK_STALE_FALLBACK_MS,
714
+ raw,
715
+ dev: stat.dev,
716
+ ino: stat.ino,
717
+ };
718
+ }
719
+ catch (err) {
720
+ if (err.code === "EPERM") {
721
+ return {
722
+ stale: !hasLease && Date.now() - stat.mtimeMs > LOCK_STALE_FALLBACK_MS,
723
+ raw,
724
+ dev: stat.dev,
725
+ ino: stat.ino,
726
+ };
727
+ }
728
+ if (err.code === "ESRCH") {
729
+ return { stale: true, raw, dev: stat.dev, ino: stat.ino };
730
+ }
731
+ }
732
+ }
733
+ return {
734
+ stale: Date.now() - stat.mtimeMs > LOCK_STALE_FALLBACK_MS,
735
+ raw,
736
+ dev: stat.dev,
737
+ ino: stat.ino,
738
+ };
739
+ }
740
+ function removeObservedLock(lockPath, observed) {
741
+ try {
742
+ const stat = fs.statSync(lockPath);
743
+ if (stat.dev !== observed.dev || stat.ino !== observed.ino)
744
+ return false;
745
+ if (fs.readFileSync(lockPath, "utf8").trim() !== observed.raw)
746
+ return false;
747
+ fs.unlinkSync(lockPath);
748
+ return true;
749
+ }
750
+ catch {
751
+ return false;
752
+ }
753
+ }
754
+ function ownsLock(lock) {
755
+ if (lock.fd === null || !lock.nonce)
756
+ return false;
757
+ try {
758
+ const held = fs.fstatSync(lock.fd);
759
+ const current = fs.statSync(configLockFile());
760
+ if (held.dev !== current.dev || held.ino !== current.ino)
761
+ return false;
762
+ const [, , nonce] = fs.readFileSync(configLockFile(), "utf8").trim().split(/\s+/, 4);
763
+ return nonce === lock.nonce;
764
+ }
765
+ catch {
766
+ return false;
767
+ }
768
+ }
769
+ function heartbeatLock(lock) {
770
+ if (lock.fd === null || !lock.nonce || !ownsLock(lock)) {
771
+ if (lock.heartbeat)
772
+ clearInterval(lock.heartbeat);
773
+ lock.heartbeat = undefined;
774
+ return;
775
+ }
776
+ const record = configLockOwner(lock.nonce);
777
+ try {
778
+ fs.ftruncateSync(lock.fd, 0);
779
+ fs.writeSync(lock.fd, record, 0, "utf8");
780
+ fs.fsyncSync(lock.fd);
781
+ }
782
+ catch {
783
+ if (lock.heartbeat)
784
+ clearInterval(lock.heartbeat);
785
+ lock.heartbeat = undefined;
786
+ }
787
+ }
609
788
  /**
610
789
  * Lazily initialized buffer for `Atomics.wait`-based synchronous sleep.
611
790
  * `undefined` = not yet probed; `null` = unavailable on this runtime.
@@ -637,14 +816,18 @@ function sleepSync(ms) {
637
816
  function releaseLock(lock) {
638
817
  if (lock.fd === null)
639
818
  return; // lock-less fallback: nothing to release
819
+ if (lock.heartbeat)
820
+ clearInterval(lock.heartbeat);
821
+ lock.heartbeat = undefined;
640
822
  try {
641
- fs.closeSync(lock.fd);
823
+ if (ownsLock(lock))
824
+ fs.unlinkSync(configLockFile());
642
825
  }
643
826
  catch {
644
827
  /* ignore */
645
828
  }
646
829
  try {
647
- fs.unlinkSync(configLockFile());
830
+ fs.closeSync(lock.fd);
648
831
  }
649
832
  catch {
650
833
  /* ignore */
@@ -672,6 +855,7 @@ function compactPersistedConfig(config) {
672
855
  ...(userTokens.refreshToken ? { refreshToken: userTokens.refreshToken } : {}),
673
856
  expiresAt: userTokens.expiresAt,
674
857
  ...(userTokens.subject ? { subject: userTokens.subject } : {}),
858
+ ...(userTokens.clientId ? { clientId: userTokens.clientId } : {}),
675
859
  },
676
860
  }
677
861
  : undefined;
@@ -17,7 +17,6 @@
17
17
  * runHarnessContractSuite({
18
18
  * harness: "claude-code",
19
19
  * tool: "Bash",
20
- * sessionCanBlock: true,
21
20
  * sessionStart: async ({ client, gates }) => {
22
21
  * const out = await handleHookEvent(sessionInput(), client, gates);
23
22
  * return { blocked: out.decision === "block", reason: out.reason };
@@ -60,13 +59,6 @@ export interface HarnessContractAdapter {
60
59
  harness: string;
61
60
  /** A real, non-interactive tool from this harness's catalog. */
62
61
  tool: string;
63
- /**
64
- * @deprecated Ignored. Session start is now uniformly non-blocking on every
65
- * harness (authentication never blocks; enforcement is governed by
66
- * `permissionMode` at tool-call time). Kept optional so existing adapters
67
- * that still pass it type-check.
68
- */
69
- sessionCanBlock?: boolean;
70
62
  /** Whether the tool gate can hard-block. Defaults to true. */
71
63
  toolCanBlock?: boolean;
72
64
  /** Drive the session-start phase through the plugin's real entry point. */
@@ -18,7 +18,6 @@
18
18
  * runHarnessContractSuite({
19
19
  * harness: "claude-code",
20
20
  * tool: "Bash",
21
- * sessionCanBlock: true,
22
21
  * sessionStart: async ({ client, gates }) => {
23
22
  * const out = await handleHookEvent(sessionInput(), client, gates);
24
23
  * return { blocked: out.decision === "block", reason: out.reason };
@@ -49,6 +49,7 @@ export declare class AgentSecurityEventReporter {
49
49
  private readonly retryBaseMs;
50
50
  private readonly retryMaxMs;
51
51
  private readonly random;
52
+ private readonly reportedAuthFailures;
52
53
  constructor(options: EventReporterOptions);
53
54
  get pending(): number;
54
55
  get pendingScopes(): ReadonlyArray<PendingEventScope>;
@@ -105,6 +105,7 @@ class AgentSecurityEventReporter {
105
105
  retryBaseMs;
106
106
  retryMaxMs;
107
107
  random;
108
+ reportedAuthFailures = new Set();
108
109
  constructor(options) {
109
110
  this.options = options;
110
111
  this.fetcher = options.fetch ?? globalThis.fetch;
@@ -328,14 +329,27 @@ class AgentSecurityEventReporter {
328
329
  this.diagnostic("events.batch_rejected", new Error(`HTTP ${response.status}`));
329
330
  return "reject";
330
331
  }
331
- if (response.status === 401) {
332
+ if (response.status === 401 || response.status === 403) {
332
333
  try {
333
- if (token)
334
+ if (response.status === 401 && token) {
334
335
  this.options.onUnauthorized?.(scope.sessionId, scope.principalKey, token);
336
+ }
335
337
  }
336
338
  catch (error) {
337
339
  this.diagnostic("events.credential_invalidation_failed", error);
338
340
  }
341
+ const failureKey = `${scopeKey(scope)}:${response.status}`;
342
+ if (!this.reportedAuthFailures.has(failureKey)) {
343
+ this.reportedAuthFailures.add(failureKey);
344
+ this.options.logger?.activity("events.record", "error", {
345
+ sessionId: scope.sessionId,
346
+ attributes: {
347
+ failureType: "authentication",
348
+ reasonCode: response.status === 401 ? "session_inactive" : "forbidden",
349
+ count: batch.length,
350
+ },
351
+ });
352
+ }
339
353
  return "retain";
340
354
  }
341
355
  if (response.status === 429 || (response.status >= 500 && response.status <= 599)) {
@@ -359,6 +373,9 @@ class AgentSecurityEventReporter {
359
373
  this.diagnostic("events.invalid_response", new Error("response event IDs did not match request order"));
360
374
  return "retain";
361
375
  }
376
+ const acceptedScope = scopeKey(scope);
377
+ this.reportedAuthFailures.delete(`${acceptedScope}:401`);
378
+ this.reportedAuthFailures.delete(`${acceptedScope}:403`);
362
379
  return "accepted";
363
380
  }
364
381
  finally {
@@ -29,8 +29,8 @@
29
29
  * can be given — which is why the login window has to fit inside 120s.
30
30
  */
31
31
  /**
32
- * Wall-clock budget for a session-start hook: the interactive login, plus the
33
- * agent DCR registration and delegation record that follow it.
32
+ * Wall-clock budget for a session-start hook: the interactive login, plus Talos
33
+ * credential loading or enrollment and the delegation record that follow it.
34
34
  *
35
35
  * Generous on purpose. It is an upper bound on a hook that is *waiting*, not a
36
36
  * latency target — nothing is spinning, and the login gives up on its own well
@@ -35,8 +35,8 @@ exports.sessionStartHookTimeout = sessionStartHookTimeout;
35
35
  exports.toolHookTimeout = toolHookTimeout;
36
36
  const auth_js_1 = require("./auth.js");
37
37
  /**
38
- * Wall-clock budget for a session-start hook: the interactive login, plus the
39
- * agent DCR registration and delegation record that follow it.
38
+ * Wall-clock budget for a session-start hook: the interactive login, plus Talos
39
+ * credential loading or enrollment and the delegation record that follow it.
40
40
  *
41
41
  * Generous on purpose. It is an upper bound on a hook that is *waiting*, not a
42
42
  * latency target — nothing is spinning, and the login gives up on its own well
package/dist/index.d.ts CHANGED
@@ -1,9 +1,9 @@
1
- export { OryAgentClient, type OryAgentConfig, type PrincipalIdentity, type RecordDelegationInput, type RecordDelegationResult, } from "./client.js";
2
- export { authenticatedRuntimeRequest, canonicalCredentialIdentity, canonicalProjectUrl, credentialAccount, configureSystemCaTrustForDefaultFetch, createOsTalosCredentialStore, enrollTalosChildRuntimeCredential, enrollTalosRuntimeCredential, resolveRuntimeCredential, runCredentialStoreCommand, talosRuntimeCredential, type CredentialStoreCommandOptions, type CredentialStoreCommandRunner, type ResolveRuntimeCredentialOptions, type EnrollTalosChildRuntimeCredentialOptions, type EnrollTalosRuntimeCredentialOptions, type EnrolledRuntimeCredential, type OsTalosCredentialStoreOptions, type NodeTlsCaProvider, type StoredTalosCredential, type TalosCredentialStore, type TalosCredentialIdentity, type RuntimeAuthenticatedRequest, type RuntimeAuthorizationHeader, type RuntimeCredential, type RuntimeCredentialKind, type RuntimeRequestAuthenticator, } from "./runtime-credential.js";
1
+ export { OryAgentClient, type OryAgentConfig, type PrincipalIdentity, type RecordDelegationInput, type RecordDelegationResult, type RuntimeContext, } from "./client.js";
2
+ export { authenticatedRuntimeRequest, canonicalCredentialIdentity, canonicalProjectUrl, credentialAccount, configureSystemCaTrustForDefaultFetch, createSpiffeFileRequestAuthenticator, createOsTalosCredentialStore, enrollTalosChildRuntimeCredential, enrollTalosRuntimeCredential, resolveRuntimeCredential, runCredentialStoreCommand, talosRuntimeCredential, type CredentialStoreCommandOptions, type CredentialStoreCommandRunner, type ResolveRuntimeCredentialOptions, type SpiffeFileRequestAuthenticatorOptions, type EnrollTalosChildRuntimeCredentialOptions, type EnrollTalosRuntimeCredentialOptions, type EnrolledRuntimeCredential, type OsTalosCredentialStoreOptions, type NodeTlsCaProvider, type StoredTalosCredential, type TalosCredentialStore, type TalosCredentialIdentity, type RuntimeAuthenticatedRequest, type RuntimeAuthorizationHeader, type RuntimeCredential, type RuntimeCredentialKind, type RuntimeRequestAuthenticator, } from "./runtime-credential.js";
3
3
  export { DebugLogger, ActiveActivity, redactLogData, formatLogEntry, withQuietStderr, type LogEntry, type LogLevel, type ActivityEntry, type ActivityStatus, type UnifiedLogEntry, type ActivityEnricher, type ActivitySink, } from "./logger.js";
4
4
  export { AgentSecurityEventReporter, SERVER_ACTIVITY_EVENTS, projectActivityEntry, type EventReporterOptions, type ServerActivityEvent, } from "./event-reporter.js";
5
5
  export { currentSessionContext, withSessionContext, setSessionContext, clearSessionContext, type SessionContext, } from "./context.js";
6
- export { loadConfig, saveConfig, resolveConfig, isSecurityConnected, describeSecurityGap, type SecurityConnection, mutateConfig, getConfigPath, getDataDir, getHarnessDataDir, listInstalledHarnesses, registerInstalledHarness, unregisterInstalledHarness, UNKNOWN_HARNESS_KEY, SESSIONLESS_KEY, type OryPluginConfig, type OryOAuth2Tokens, type OryUserCredentials, type OryAgentCredentialsBlock, type OryAgentDynamicCredentials, type OryDelegationRecord, type PermissionMode, type PermissionModeCache, } from "./config.js";
6
+ export { loadConfig, saveConfig, resolveConfig, isSecurityConnected, describeSecurityGap, readAgentRootDelegation, validateAgentRootDelegation, AGENT_ROOT_DELEGATION_ENV_VAR, type SecurityConnection, mutateConfig, mutateConfigAsync, getConfigPath, getDataDir, getHarnessDataDir, listInstalledHarnesses, registerInstalledHarness, unregisterInstalledHarness, UNKNOWN_HARNESS_KEY, SESSIONLESS_KEY, type OryPluginConfig, type AsyncConfigMutation, type OryOAuth2Tokens, type OryUserCredentials, type OryAgentCredentialsBlock, type OryAgentDynamicCredentials, type OryDelegationRecord, type PermissionMode, type PermissionModeCache, } from "./config.js";
7
7
  export { resolvePermissionMode, warmPermissionModeCache, resetPermissionModeCache, type PermissionModeSource, type ResolvedPermissionMode, type ModeSubject, } from "./permission-mode.js";
8
8
  export { pkceLogin, refreshAccessToken, detectHeadless, generateCodeVerifier, sha256Base64Url, buildAuthorizeUrl, LOOPBACK_PORTS, DEFAULT_LOGIN_TIMEOUT_MS, type PkceLoginOptions, type PkceLoginOutcome, type PkceDeclineReason, } from "./auth.js";
9
9
  export { wantsHelp, shouldPrintHelp } from "./help-cli.js";
@@ -11,7 +11,7 @@ export { loadExternalRegistrations, recordExternalRegistration, clearExternalReg
11
11
  export { SESSION_START_HOOK_WINDOW_MS, TOOL_HOOK_WINDOW_MS, HOOK_TIMEOUT_MAX_MS, sessionStartHookTimeout, toolHookTimeout, type HookTimeoutUnit, } from "./hook-timeout.js";
12
12
  export { loadTokens, saveTokens, clearTokens, isExpired, refreshAndSave, tryAcquirePkceFlightLock, clearPkceFlightLock, waitForPeerTokens, waitForPeerTokensSync, TOKEN_EXPIRY_SKEW_SEC, type PkceFlightLock, } from "./auth-store.js";
13
13
  export { ensureUserAuthenticated, ensureAuthenticated, type UserLoginDecision, type UserLoginMode, type UserLoginOptions, } from "./user-login.js";
14
- export { resolveAgentCredentials, resolveRuntimeAgentCredentials, ensureAgentIdentity, ensureSubAgentIdentity, fetchClientCredentialsToken, registerAgentClient, loadAgentDynamicCredentials, loadAgentDynamicCredentialsByHarness, saveAgentDynamicCredentials, clearAgentDynamicCredentials, latestAgentRegistration, latestSubAgentSession, countAgentSessions, claimAgentDynamicCredentials, loadSubAgentDynamicCredentials, loadAllSubAgentDynamicCredentials, loadSubAgentDynamicCredentialsByHarness, saveSubAgentDynamicCredentials, clearSubAgentDynamicCredentials, clearSubAgentDynamicCredentialsForHarness, claimSubAgentDynamicCredentials, loadDelegationNodeId, saveDelegationNodeId, loadRetiredCredentials, clearRetiredCredentials, retireAgentSessions, sessionRetention, revokeAgentDynamicClient, AGENT_TOKEN_EXPIRY_SKEW_SEC, DEFAULT_SESSION_RETENTION, type AgentRegistrationClaim, type AgentCredentials, type AgentCredentialKind, type ResolveAgentCredentialsOptions, type ResolveRuntimeAgentCredentialsOptions, type EnsureAgentIdentityOptions, type RegisterAgentClientArgs, type DelegationInput, type RevokeAgentClientResult, type SubAgentIdentity, type EnsureSubAgentIdentityOptions, } from "./agent-auth.js";
14
+ export { resolveAgentCredentials, resolvePreprovisionedRuntimeContext, resolveRuntimeAgentCredentials, ensureAgentIdentity, ensureSubAgentIdentity, fetchClientCredentialsToken, registerAgentClient, loadAgentDynamicCredentials, loadAgentDynamicCredentialsByHarness, saveAgentDynamicCredentials, clearAgentDynamicCredentials, latestAgentRegistration, latestSubAgentSession, countAgentSessions, claimAgentDynamicCredentials, loadSubAgentDynamicCredentials, loadAllSubAgentDynamicCredentials, loadSubAgentDynamicCredentialsByHarness, saveSubAgentDynamicCredentials, clearSubAgentDynamicCredentials, clearSubAgentDynamicCredentialsForHarness, claimSubAgentDynamicCredentials, loadDelegationNodeId, resolvePreprovisionedRootDelegation, saveDelegationNodeId, loadRetiredCredentials, clearRetiredCredentials, retireAgentSessions, sessionRetention, revokeAgentDynamicClient, AGENT_TOKEN_EXPIRY_SKEW_SEC, DEFAULT_SESSION_RETENTION, type AgentRegistrationClaim, type AgentCredentials, type AgentCredentialKind, type ResolveAgentCredentialsOptions, type ResolveRuntimeAgentCredentialsOptions, type EnsureAgentIdentityOptions, type RegisterAgentClientArgs, type DelegationInput, type RevokeAgentClientResult, type SubAgentIdentity, type EnsureSubAgentIdentityOptions, } from "./agent-auth.js";
15
15
  export { ensureReadCredential, resetReadCredentialBackoff, READ_CREDENTIAL_RETRY_MS, type EnsureReadCredentialOptions, type ReadCredentialOutcome, } from "./read-credential.js";
16
16
  export { clearCredentialsForUninstall, resolveInstalledHarnesses, type ClearCredentialsOptions, type ClearCredentialsResult, } from "./uninstall.js";
17
17
  export { type SessionInfo, type OAuth2TokenInfo, type PermissionCheck, type PermissionResult, type BatchPermissionResult, type OryError, type OryErrorCode, } from "./types.js";
package/dist/index.js CHANGED
@@ -1,11 +1,11 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.wantsHelp = exports.DEFAULT_LOGIN_TIMEOUT_MS = exports.LOOPBACK_PORTS = exports.buildAuthorizeUrl = exports.sha256Base64Url = exports.generateCodeVerifier = exports.detectHeadless = exports.refreshAccessToken = exports.pkceLogin = exports.resetPermissionModeCache = exports.warmPermissionModeCache = exports.resolvePermissionMode = exports.SESSIONLESS_KEY = exports.UNKNOWN_HARNESS_KEY = exports.unregisterInstalledHarness = exports.registerInstalledHarness = exports.listInstalledHarnesses = exports.getHarnessDataDir = exports.getDataDir = exports.getConfigPath = exports.mutateConfig = exports.describeSecurityGap = exports.isSecurityConnected = exports.resolveConfig = exports.saveConfig = exports.loadConfig = exports.clearSessionContext = exports.setSessionContext = exports.withSessionContext = exports.currentSessionContext = exports.projectActivityEntry = exports.SERVER_ACTIVITY_EVENTS = exports.AgentSecurityEventReporter = exports.withQuietStderr = exports.formatLogEntry = exports.redactLogData = exports.ActiveActivity = exports.DebugLogger = exports.talosRuntimeCredential = exports.runCredentialStoreCommand = exports.resolveRuntimeCredential = exports.enrollTalosRuntimeCredential = exports.enrollTalosChildRuntimeCredential = exports.createOsTalosCredentialStore = exports.configureSystemCaTrustForDefaultFetch = exports.credentialAccount = exports.canonicalProjectUrl = exports.canonicalCredentialIdentity = exports.authenticatedRuntimeRequest = exports.OryAgentClient = void 0;
4
- exports.clearRetiredCredentials = exports.loadRetiredCredentials = exports.saveDelegationNodeId = exports.loadDelegationNodeId = exports.claimSubAgentDynamicCredentials = exports.clearSubAgentDynamicCredentialsForHarness = exports.clearSubAgentDynamicCredentials = exports.saveSubAgentDynamicCredentials = exports.loadSubAgentDynamicCredentialsByHarness = exports.loadAllSubAgentDynamicCredentials = exports.loadSubAgentDynamicCredentials = exports.claimAgentDynamicCredentials = exports.countAgentSessions = exports.latestSubAgentSession = exports.latestAgentRegistration = exports.clearAgentDynamicCredentials = exports.saveAgentDynamicCredentials = exports.loadAgentDynamicCredentialsByHarness = exports.loadAgentDynamicCredentials = exports.registerAgentClient = exports.fetchClientCredentialsToken = exports.ensureSubAgentIdentity = exports.ensureAgentIdentity = exports.resolveRuntimeAgentCredentials = exports.resolveAgentCredentials = exports.ensureAuthenticated = exports.ensureUserAuthenticated = exports.TOKEN_EXPIRY_SKEW_SEC = exports.waitForPeerTokensSync = exports.waitForPeerTokens = exports.clearPkceFlightLock = exports.tryAcquirePkceFlightLock = exports.refreshAndSave = exports.isExpired = exports.clearTokens = exports.saveTokens = exports.loadTokens = exports.toolHookTimeout = exports.sessionStartHookTimeout = exports.HOOK_TIMEOUT_MAX_MS = exports.TOOL_HOOK_WINDOW_MS = exports.SESSION_START_HOOK_WINDOW_MS = exports.describeDanglingRegistration = exports.findDanglingRegistration = exports.deregisterExternalRegistrations = exports.clearAllExternalRegistrations = exports.clearExternalRegistration = exports.recordExternalRegistration = exports.loadExternalRegistrations = exports.shouldPrintHelp = void 0;
5
- exports.mergeMcpServer = exports.mcpServerEntry = exports.emitDeferredNextSteps = exports.beginDeferNextSteps = exports.nextStepsSink = exports.printNextSteps = exports.printSetupHelp = exports.removeFlatHooks = exports.mergeFlatHooks = exports.flatHookEntry = exports.removeMatcherHooks = exports.mergeMatcherHooks = exports.matcherHookEntry = exports.isOryHookCommand = exports.writeJsonFile = exports.readJsonFile = exports.parseSetupArgs = exports.resolveBuildInfo = exports.collectVersionInfo = exports.runVersionCommand = exports.probePermissionsCoverage = exports.collectStatusReport = exports.printPermissionsSection = exports.printAgentIdentitySection = exports.printUserIdentitySection = exports.runStatusCommand = exports.runPostInstall = exports.runWatchCommand = exports.runPermissionsCommand = exports.oryNpx = exports.interactiveConfigPrompt = exports.promptForProjectUrl = exports.promptOnTty = exports.isTtyAvailable = exports.printEnvHelp = exports.printLogTail = exports.printEnvironment = exports.printOryConfig = exports.runAgentCommand = exports.runConfigureCommand = exports.resolveInstalledHarnesses = exports.clearCredentialsForUninstall = exports.READ_CREDENTIAL_RETRY_MS = exports.resetReadCredentialBackoff = exports.ensureReadCredential = exports.DEFAULT_SESSION_RETENTION = exports.AGENT_TOKEN_EXPIRY_SKEW_SEC = exports.revokeAgentDynamicClient = exports.sessionRetention = exports.retireAgentSessions = void 0;
6
- exports.decomposeAndCheck = exports.gateToolCall = exports.applyPermissionMode = exports.checkAndDecide = exports.REGISTRY_URL = exports.runRegistryCommand = exports.runLocalCommand = exports.ORY_COMMAND_SLUGS = exports.ORY_COMMAND_SKILL_NAMES = exports.ORY_SKILL_NAMES = exports.removeSkillDirs = exports.writeSkillTree = exports.toSkillMarkdown = exports.commandToPlainMarkdown = exports.commandToFrontmatterMarkdown = exports.commandToToml = exports.commandToSkill = exports.renderOryCommands = exports.renderOrySkills = exports.renderMirrorBootstrap = exports.MCP_SERVER_PACKAGE = exports.defaultNpmInstaller = exports.describeRuntimeHealth = exports.checkRuntimeHealth = exports.pruneRuntimeStores = exports.removeRuntimeWiring = exports.getRuntimeWiring = exports.recordRuntimeWiring = exports.readRuntimeManifest = exports.getMcpShimPath = exports.getHookShimPath = exports.getShimDir = exports.getRuntimeStoreDir = exports.getRuntimeRoot = exports.moduleSpecifier = exports.requireHookCommand = exports.isOryRuntimeCommand = exports.mcpCommand = exports.hookCommand = exports.writeMcpShim = exports.writeHookShim = exports.resolveMcpRuntimeEntry = exports.resolveRuntimeEntry = exports.linkedRuntime = exports.materializeRuntime = exports.resolveRuntimeForInstall = exports.wireRuntime = exports.unregisterPlugin = exports.registerPlugin = exports.removeMcpServer = void 0;
7
- exports.isUserFacingPhase = exports.classifyLifecycle = exports.extractShellCommand = exports.resolveShellCommandNamespace = exports.getShellCommandCatalog = exports.SHELL_COMMAND_CATALOG = exports.isShellTool = exports.getShellToolCatalog = exports.SHELL_TOOL_CATALOG = exports.isInteractiveTool = exports.getInteractiveToolCatalog = exports.INTERACTIVE_TOOL_CATALOG = exports.getToolCatalog = exports.ALL_TOOLS = exports.KNOWN_HARNESSES = exports.HARNESS_TOOL_CATALOG = exports.DEFAULT_SHELL_NAMESPACE = exports.DEFAULT_NAMESPACE = exports.PERMIT_USE = exports.ENROLLMENT_NAMESPACE = exports.AGENT_ROLE_NAMESPACE = exports.DELEGATION_NAMESPACE = exports.PERMISSION_MODE_NAMESPACE = exports.PROJECT_POSTURE_OBJECT = exports.AUTO_ENROLL_OBJECT = exports.PERMISSION_MODE_OBJECT = exports.RELATION_OPTED_OUT_SUBJECTS = exports.RELATION_MEMBERS = exports.RELATION_ENFORCED_SUBJECTS = exports.RELATION_CREDENTIALS = exports.RELATION_DELEGATES = exports.RELATION_BLOCKED_SUBJECTS = exports.RELATION_USERS = exports.SUBAGENT_NODE_NAMESPACE = exports.AGENT_NODE_NAMESPACE = exports.NODE_REFERENCE_NAMESPACES = exports.PRINCIPAL_NAMESPACES = exports.OPL_IMPORT_SYMBOLS = exports.OPL_IMPORT_MODULE = exports.renderOplImport = exports.renderPrincipalClass = exports.renderEnrollmentNamespaceClass = exports.renderAgentRoleNamespaceClass = exports.renderPermissionModeNamespaceClass = exports.renderDelegationNamespaceClass = exports.renderToolNamespaceClass = exports.buildAgentSecurityOpl = exports.extractBashCommandWords = exports.extractShellCommands = exports.resolveCheckRelation = void 0;
8
- exports.collectSystemServices = exports.wrapTool = exports.writeAgentDelegatesSubagent = exports.writeUserDelegatesAgent = exports.registerSubagent = exports.fail = exports.complete = exports.gate = exports.decideTool = exports.withHookContext = exports.createSessionStarter = exports.sessionStart = exports.resolveNamespace = exports.summarizeToolOutput = exports.summarizeToolInput = exports.OryDenialError = exports.shellDenialFields = exports.alertAttributes = exports.formatAlertSummary = exports.formatAlertMessage = exports.formatDenialSummary = exports.formatDenialMessage = exports.DEFAULT_USER_SUBJECT_NAMESPACE = exports.SESSION_NAMESPACE = exports.SUBAGENT_NAMESPACE = exports.AGENT_NAMESPACE = exports.resolveSubAgentSpawnSubject = exports.resolveSubAgentSubject = exports.resolveAgentSessionSubject = exports.resolveAgentSubject = exports.subjectLabel = exports.runWithUserSubject = exports.resolveUserSubject = exports.checkMcpPermission = exports.parseMcpToolGeneric = exports.parseGeminiMcpTool = exports.parseClaudeCodeMcpTool = exports.TOOL_EXECUTION_PHASES = exports.USER_FACING_PHASES = exports.HARNESS_LIFECYCLE_MAP = exports.isToolExecutionPhase = void 0;
3
+ exports.generateCodeVerifier = exports.detectHeadless = exports.refreshAccessToken = exports.pkceLogin = exports.resetPermissionModeCache = exports.warmPermissionModeCache = exports.resolvePermissionMode = exports.SESSIONLESS_KEY = exports.UNKNOWN_HARNESS_KEY = exports.unregisterInstalledHarness = exports.registerInstalledHarness = exports.listInstalledHarnesses = exports.getHarnessDataDir = exports.getDataDir = exports.getConfigPath = exports.mutateConfigAsync = exports.mutateConfig = exports.AGENT_ROOT_DELEGATION_ENV_VAR = exports.validateAgentRootDelegation = exports.readAgentRootDelegation = exports.describeSecurityGap = exports.isSecurityConnected = exports.resolveConfig = exports.saveConfig = exports.loadConfig = exports.clearSessionContext = exports.setSessionContext = exports.withSessionContext = exports.currentSessionContext = exports.projectActivityEntry = exports.SERVER_ACTIVITY_EVENTS = exports.AgentSecurityEventReporter = exports.withQuietStderr = exports.formatLogEntry = exports.redactLogData = exports.ActiveActivity = exports.DebugLogger = exports.talosRuntimeCredential = exports.runCredentialStoreCommand = exports.resolveRuntimeCredential = exports.enrollTalosRuntimeCredential = exports.enrollTalosChildRuntimeCredential = exports.createOsTalosCredentialStore = exports.createSpiffeFileRequestAuthenticator = exports.configureSystemCaTrustForDefaultFetch = exports.credentialAccount = exports.canonicalProjectUrl = exports.canonicalCredentialIdentity = exports.authenticatedRuntimeRequest = exports.OryAgentClient = void 0;
4
+ exports.clearSubAgentDynamicCredentials = exports.saveSubAgentDynamicCredentials = exports.loadSubAgentDynamicCredentialsByHarness = exports.loadAllSubAgentDynamicCredentials = exports.loadSubAgentDynamicCredentials = exports.claimAgentDynamicCredentials = exports.countAgentSessions = exports.latestSubAgentSession = exports.latestAgentRegistration = exports.clearAgentDynamicCredentials = exports.saveAgentDynamicCredentials = exports.loadAgentDynamicCredentialsByHarness = exports.loadAgentDynamicCredentials = exports.registerAgentClient = exports.fetchClientCredentialsToken = exports.ensureSubAgentIdentity = exports.ensureAgentIdentity = exports.resolveRuntimeAgentCredentials = exports.resolvePreprovisionedRuntimeContext = exports.resolveAgentCredentials = exports.ensureAuthenticated = exports.ensureUserAuthenticated = exports.TOKEN_EXPIRY_SKEW_SEC = exports.waitForPeerTokensSync = exports.waitForPeerTokens = exports.clearPkceFlightLock = exports.tryAcquirePkceFlightLock = exports.refreshAndSave = exports.isExpired = exports.clearTokens = exports.saveTokens = exports.loadTokens = exports.toolHookTimeout = exports.sessionStartHookTimeout = exports.HOOK_TIMEOUT_MAX_MS = exports.TOOL_HOOK_WINDOW_MS = exports.SESSION_START_HOOK_WINDOW_MS = exports.describeDanglingRegistration = exports.findDanglingRegistration = exports.deregisterExternalRegistrations = exports.clearAllExternalRegistrations = exports.clearExternalRegistration = exports.recordExternalRegistration = exports.loadExternalRegistrations = exports.shouldPrintHelp = exports.wantsHelp = exports.DEFAULT_LOGIN_TIMEOUT_MS = exports.LOOPBACK_PORTS = exports.buildAuthorizeUrl = exports.sha256Base64Url = void 0;
5
+ exports.removeFlatHooks = exports.mergeFlatHooks = exports.flatHookEntry = exports.removeMatcherHooks = exports.mergeMatcherHooks = exports.matcherHookEntry = exports.isOryHookCommand = exports.writeJsonFile = exports.readJsonFile = exports.parseSetupArgs = exports.resolveBuildInfo = exports.collectVersionInfo = exports.runVersionCommand = exports.probePermissionsCoverage = exports.collectStatusReport = exports.printPermissionsSection = exports.printAgentIdentitySection = exports.printUserIdentitySection = exports.runStatusCommand = exports.runPostInstall = exports.runWatchCommand = exports.runPermissionsCommand = exports.oryNpx = exports.interactiveConfigPrompt = exports.promptForProjectUrl = exports.promptOnTty = exports.isTtyAvailable = exports.printEnvHelp = exports.printLogTail = exports.printEnvironment = exports.printOryConfig = exports.runAgentCommand = exports.runConfigureCommand = exports.resolveInstalledHarnesses = exports.clearCredentialsForUninstall = exports.READ_CREDENTIAL_RETRY_MS = exports.resetReadCredentialBackoff = exports.ensureReadCredential = exports.DEFAULT_SESSION_RETENTION = exports.AGENT_TOKEN_EXPIRY_SKEW_SEC = exports.revokeAgentDynamicClient = exports.sessionRetention = exports.retireAgentSessions = exports.clearRetiredCredentials = exports.loadRetiredCredentials = exports.saveDelegationNodeId = exports.resolvePreprovisionedRootDelegation = exports.loadDelegationNodeId = exports.claimSubAgentDynamicCredentials = exports.clearSubAgentDynamicCredentialsForHarness = void 0;
6
+ exports.ORY_COMMAND_SLUGS = exports.ORY_COMMAND_SKILL_NAMES = exports.ORY_SKILL_NAMES = exports.removeSkillDirs = exports.writeSkillTree = exports.toSkillMarkdown = exports.commandToPlainMarkdown = exports.commandToFrontmatterMarkdown = exports.commandToToml = exports.commandToSkill = exports.renderOryCommands = exports.renderOrySkills = exports.renderMirrorBootstrap = exports.MCP_SERVER_PACKAGE = exports.defaultNpmInstaller = exports.describeRuntimeHealth = exports.checkRuntimeHealth = exports.pruneRuntimeStores = exports.removeRuntimeWiring = exports.getRuntimeWiring = exports.recordRuntimeWiring = exports.readRuntimeManifest = exports.getMcpShimPath = exports.getHookShimPath = exports.getShimDir = exports.getRuntimeStoreDir = exports.getRuntimeRoot = exports.moduleSpecifier = exports.requireHookCommand = exports.isOryRuntimeCommand = exports.mcpCommand = exports.hookCommand = exports.writeMcpShim = exports.writeHookShim = exports.resolveMcpRuntimeEntry = exports.resolveRuntimeEntry = exports.linkedRuntime = exports.materializeRuntime = exports.resolveRuntimeForInstall = exports.wireRuntime = exports.unregisterPlugin = exports.registerPlugin = exports.removeMcpServer = exports.mergeMcpServer = exports.mcpServerEntry = exports.emitDeferredNextSteps = exports.beginDeferNextSteps = exports.nextStepsSink = exports.printNextSteps = exports.printSetupHelp = void 0;
7
+ exports.getShellToolCatalog = exports.SHELL_TOOL_CATALOG = exports.isInteractiveTool = exports.getInteractiveToolCatalog = exports.INTERACTIVE_TOOL_CATALOG = exports.getToolCatalog = exports.ALL_TOOLS = exports.KNOWN_HARNESSES = exports.HARNESS_TOOL_CATALOG = exports.DEFAULT_SHELL_NAMESPACE = exports.DEFAULT_NAMESPACE = exports.PERMIT_USE = exports.ENROLLMENT_NAMESPACE = exports.AGENT_ROLE_NAMESPACE = exports.DELEGATION_NAMESPACE = exports.PERMISSION_MODE_NAMESPACE = exports.PROJECT_POSTURE_OBJECT = exports.AUTO_ENROLL_OBJECT = exports.PERMISSION_MODE_OBJECT = exports.RELATION_OPTED_OUT_SUBJECTS = exports.RELATION_MEMBERS = exports.RELATION_ENFORCED_SUBJECTS = exports.RELATION_CREDENTIALS = exports.RELATION_DELEGATES = exports.RELATION_BLOCKED_SUBJECTS = exports.RELATION_USERS = exports.SUBAGENT_NODE_NAMESPACE = exports.AGENT_NODE_NAMESPACE = exports.NODE_REFERENCE_NAMESPACES = exports.PRINCIPAL_NAMESPACES = exports.OPL_IMPORT_SYMBOLS = exports.OPL_IMPORT_MODULE = exports.renderOplImport = exports.renderPrincipalClass = exports.renderEnrollmentNamespaceClass = exports.renderAgentRoleNamespaceClass = exports.renderPermissionModeNamespaceClass = exports.renderDelegationNamespaceClass = exports.renderToolNamespaceClass = exports.buildAgentSecurityOpl = exports.extractBashCommandWords = exports.extractShellCommands = exports.resolveCheckRelation = exports.decomposeAndCheck = exports.gateToolCall = exports.applyPermissionMode = exports.checkAndDecide = exports.REGISTRY_URL = exports.runRegistryCommand = exports.runLocalCommand = void 0;
8
+ exports.collectSystemServices = exports.wrapTool = exports.writeAgentDelegatesSubagent = exports.writeUserDelegatesAgent = exports.registerSubagent = exports.fail = exports.complete = exports.gate = exports.decideTool = exports.withHookContext = exports.createSessionStarter = exports.sessionStart = exports.resolveNamespace = exports.summarizeToolOutput = exports.summarizeToolInput = exports.OryDenialError = exports.shellDenialFields = exports.alertAttributes = exports.formatAlertSummary = exports.formatAlertMessage = exports.formatDenialSummary = exports.formatDenialMessage = exports.DEFAULT_USER_SUBJECT_NAMESPACE = exports.SESSION_NAMESPACE = exports.SUBAGENT_NAMESPACE = exports.AGENT_NAMESPACE = exports.resolveSubAgentSpawnSubject = exports.resolveSubAgentSubject = exports.resolveAgentSessionSubject = exports.resolveAgentSubject = exports.subjectLabel = exports.runWithUserSubject = exports.resolveUserSubject = exports.checkMcpPermission = exports.parseMcpToolGeneric = exports.parseGeminiMcpTool = exports.parseClaudeCodeMcpTool = exports.TOOL_EXECUTION_PHASES = exports.USER_FACING_PHASES = exports.HARNESS_LIFECYCLE_MAP = exports.isToolExecutionPhase = exports.isUserFacingPhase = exports.classifyLifecycle = exports.extractShellCommand = exports.resolveShellCommandNamespace = exports.getShellCommandCatalog = exports.SHELL_COMMAND_CATALOG = exports.isShellTool = void 0;
9
9
  var client_js_1 = require("./client.js");
10
10
  Object.defineProperty(exports, "OryAgentClient", { enumerable: true, get: function () { return client_js_1.OryAgentClient; } });
11
11
  var runtime_credential_js_1 = require("./runtime-credential.js");
@@ -14,6 +14,7 @@ Object.defineProperty(exports, "canonicalCredentialIdentity", { enumerable: true
14
14
  Object.defineProperty(exports, "canonicalProjectUrl", { enumerable: true, get: function () { return runtime_credential_js_1.canonicalProjectUrl; } });
15
15
  Object.defineProperty(exports, "credentialAccount", { enumerable: true, get: function () { return runtime_credential_js_1.credentialAccount; } });
16
16
  Object.defineProperty(exports, "configureSystemCaTrustForDefaultFetch", { enumerable: true, get: function () { return runtime_credential_js_1.configureSystemCaTrustForDefaultFetch; } });
17
+ Object.defineProperty(exports, "createSpiffeFileRequestAuthenticator", { enumerable: true, get: function () { return runtime_credential_js_1.createSpiffeFileRequestAuthenticator; } });
17
18
  Object.defineProperty(exports, "createOsTalosCredentialStore", { enumerable: true, get: function () { return runtime_credential_js_1.createOsTalosCredentialStore; } });
18
19
  Object.defineProperty(exports, "enrollTalosChildRuntimeCredential", { enumerable: true, get: function () { return runtime_credential_js_1.enrollTalosChildRuntimeCredential; } });
19
20
  Object.defineProperty(exports, "enrollTalosRuntimeCredential", { enumerable: true, get: function () { return runtime_credential_js_1.enrollTalosRuntimeCredential; } });
@@ -41,7 +42,11 @@ Object.defineProperty(exports, "saveConfig", { enumerable: true, get: function (
41
42
  Object.defineProperty(exports, "resolveConfig", { enumerable: true, get: function () { return config_js_1.resolveConfig; } });
42
43
  Object.defineProperty(exports, "isSecurityConnected", { enumerable: true, get: function () { return config_js_1.isSecurityConnected; } });
43
44
  Object.defineProperty(exports, "describeSecurityGap", { enumerable: true, get: function () { return config_js_1.describeSecurityGap; } });
45
+ Object.defineProperty(exports, "readAgentRootDelegation", { enumerable: true, get: function () { return config_js_1.readAgentRootDelegation; } });
46
+ Object.defineProperty(exports, "validateAgentRootDelegation", { enumerable: true, get: function () { return config_js_1.validateAgentRootDelegation; } });
47
+ Object.defineProperty(exports, "AGENT_ROOT_DELEGATION_ENV_VAR", { enumerable: true, get: function () { return config_js_1.AGENT_ROOT_DELEGATION_ENV_VAR; } });
44
48
  Object.defineProperty(exports, "mutateConfig", { enumerable: true, get: function () { return config_js_1.mutateConfig; } });
49
+ Object.defineProperty(exports, "mutateConfigAsync", { enumerable: true, get: function () { return config_js_1.mutateConfigAsync; } });
45
50
  Object.defineProperty(exports, "getConfigPath", { enumerable: true, get: function () { return config_js_1.getConfigPath; } });
46
51
  Object.defineProperty(exports, "getDataDir", { enumerable: true, get: function () { return config_js_1.getDataDir; } });
47
52
  Object.defineProperty(exports, "getHarnessDataDir", { enumerable: true, get: function () { return config_js_1.getHarnessDataDir; } });
@@ -96,6 +101,7 @@ Object.defineProperty(exports, "ensureUserAuthenticated", { enumerable: true, ge
96
101
  Object.defineProperty(exports, "ensureAuthenticated", { enumerable: true, get: function () { return user_login_js_1.ensureAuthenticated; } });
97
102
  var agent_auth_js_1 = require("./agent-auth.js");
98
103
  Object.defineProperty(exports, "resolveAgentCredentials", { enumerable: true, get: function () { return agent_auth_js_1.resolveAgentCredentials; } });
104
+ Object.defineProperty(exports, "resolvePreprovisionedRuntimeContext", { enumerable: true, get: function () { return agent_auth_js_1.resolvePreprovisionedRuntimeContext; } });
99
105
  Object.defineProperty(exports, "resolveRuntimeAgentCredentials", { enumerable: true, get: function () { return agent_auth_js_1.resolveRuntimeAgentCredentials; } });
100
106
  Object.defineProperty(exports, "ensureAgentIdentity", { enumerable: true, get: function () { return agent_auth_js_1.ensureAgentIdentity; } });
101
107
  Object.defineProperty(exports, "ensureSubAgentIdentity", { enumerable: true, get: function () { return agent_auth_js_1.ensureSubAgentIdentity; } });
@@ -117,6 +123,7 @@ Object.defineProperty(exports, "clearSubAgentDynamicCredentials", { enumerable:
117
123
  Object.defineProperty(exports, "clearSubAgentDynamicCredentialsForHarness", { enumerable: true, get: function () { return agent_auth_js_1.clearSubAgentDynamicCredentialsForHarness; } });
118
124
  Object.defineProperty(exports, "claimSubAgentDynamicCredentials", { enumerable: true, get: function () { return agent_auth_js_1.claimSubAgentDynamicCredentials; } });
119
125
  Object.defineProperty(exports, "loadDelegationNodeId", { enumerable: true, get: function () { return agent_auth_js_1.loadDelegationNodeId; } });
126
+ Object.defineProperty(exports, "resolvePreprovisionedRootDelegation", { enumerable: true, get: function () { return agent_auth_js_1.resolvePreprovisionedRootDelegation; } });
120
127
  Object.defineProperty(exports, "saveDelegationNodeId", { enumerable: true, get: function () { return agent_auth_js_1.saveDelegationNodeId; } });
121
128
  Object.defineProperty(exports, "loadRetiredCredentials", { enumerable: true, get: function () { return agent_auth_js_1.loadRetiredCredentials; } });
122
129
  Object.defineProperty(exports, "clearRetiredCredentials", { enumerable: true, get: function () { return agent_auth_js_1.clearRetiredCredentials; } });
package/dist/lifecycle.js CHANGED
@@ -160,7 +160,8 @@ exports.HARNESS_LIFECYCLE_MAP = {
160
160
  },
161
161
  // Cursor (editor + CLI). Subprocess hooks read from `.cursor/hooks.json`.
162
162
  // `preToolUse` is the single permission gate — it already fires for every
163
- // tool category (Shell, Read, Write, MCP, Task). The more specific
163
+ // documented tool category (Shell, Read, Write, Grep, Delete, Task) and
164
+ // dynamic MCP calls. The more specific
164
165
  // `beforeShellExecution` / `beforeMCPExecution` / `beforeReadFile` hooks and
165
166
  // their `after*` counterparts surface activity to the user and are
166
167
  // activity-only (`user.interaction`), so shell/MCP/file access isn't gated
@@ -76,10 +76,8 @@ export interface OathkeeperConfig {
76
76
  * contract: an Oathkeeper service configured like the hosted
77
77
  * `ory-corp:cloud:keto:read:user-token` rule — `oauth2_introspection`
78
78
  * authenticator against Hydra, `allow` authorizer, `noop` mutator, `strip_path:/user`
79
- * upstream to keto-read — so a valid plugin OAuth2 access token is *required* to
80
- * read permissions locally, exactly as it is on a hosted Ory project. (The
81
- * plugin's agent DCR / user PKCE tokens are populated before any permission read
82
- * runs, so this is transparent in the normal flow.)
79
+ * upstream to keto-read — so a valid OAuth2 access token is *required* to use
80
+ * this direct local read path, exactly as it is on a hosted Ory project.
83
81
  *
84
82
  * Set `ORY_LOCAL_OATHKEEPER=0` (also `false`/`no`/`off`) to opt out and fall back
85
83
  * to a transparent nginx passthrough that strips `/user` and forwards straight to
@@ -201,10 +201,8 @@ function getConsoleConfig(projectRoot) {
201
201
  * contract: an Oathkeeper service configured like the hosted
202
202
  * `ory-corp:cloud:keto:read:user-token` rule — `oauth2_introspection`
203
203
  * authenticator against Hydra, `allow` authorizer, `noop` mutator, `strip_path:/user`
204
- * upstream to keto-read — so a valid plugin OAuth2 access token is *required* to
205
- * read permissions locally, exactly as it is on a hosted Ory project. (The
206
- * plugin's agent DCR / user PKCE tokens are populated before any permission read
207
- * runs, so this is transparent in the normal flow.)
204
+ * upstream to keto-read — so a valid OAuth2 access token is *required* to use
205
+ * this direct local read path, exactly as it is on a hosted Ory project.
208
206
  *
209
207
  * Set `ORY_LOCAL_OATHKEEPER=0` (also `false`/`no`/`off`) to opt out and fall back
210
208
  * to a transparent nginx passthrough that strips `/user` and forwards straight to
@@ -843,7 +843,7 @@ function printSeedResult(result) {
843
843
  console.log("Seed complete!");
844
844
  console.log("==============");
845
845
  console.log("");
846
- console.log(` Agent identity: self-registers on first run via DCR (nothing seeded)`);
846
+ console.log(` Agent identity: Talos enrollment runs at session start (nothing seeded)`);
847
847
  console.log("");
848
848
  console.log(` User identity: ${result.user.identity.email} (${result.user.identity.id})`);
849
849
  console.log(` User password: ${result.user.password}`);
@@ -860,9 +860,9 @@ function printSeedResult(result) {
860
860
  console.log(` export ORY_USER_SUBJECT_ID=${result.user.identity.id}`);
861
861
  console.log("");
862
862
  console.log("The user gate runs PKCE in the browser — sign in with the email and");
863
- console.log("password printed above. The agent OAuth2 client is registered");
864
- console.log("automatically via Dynamic Client Registration (RFC 7591) on first");
865
- console.log("session using the user's bearer as the initial access token.");
863
+ console.log("password printed above. At first session start, the authenticated user");
864
+ console.log("enrolls an actor-bound Talos credential. It is stored in the native OS");
865
+ console.log("credential store; tool hooks only load the existing credential.");
866
866
  console.log("");
867
867
  console.log("Or save the project URL to the shared config (persists across sessions):");
868
868
  console.log("");
@@ -7,10 +7,10 @@
7
7
  * redirect URIs. The launcher always runs the real PKCE browser flow; the
8
8
  * user types these credentials into the login UI to complete the flow.
9
9
  *
10
- * No agent principal is seeded: the harness self-registers a DCR OAuth2
11
- * client for the agent on first session start (using the user's bearer as
12
- * the initial access token), and permission checks are made against the
13
- * user subject — so a pre-seeded agent Kratos identity would be unused.
10
+ * No agent principal is seeded: Agent Security enrolls a Talos runtime
11
+ * credential at session start using the authenticated user's bearer, and
12
+ * permission checks are made against the user subject. A pre-seeded agent
13
+ * Kratos identity would be unused.
14
14
  *
15
15
  * Permission tuples are written as SubjectSet `User:<identity.id>` so
16
16
  * the Console's *Add relationship* dialog (which always emits SubjectSet