@ory/argus 0.12.1 → 0.13.1

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.
@@ -0,0 +1,9 @@
1
+ {
2
+ "repo": "ory-agent-plugins",
3
+ "commit": "8a7c3508e54376b6dda634dc54f8c5891d499a7a",
4
+ "commitShort": "8a7c350",
5
+ "branch": "main",
6
+ "commitDate": "2026-07-14T12:09:14-07:00",
7
+ "dirty": false,
8
+ "builtAt": "2026-07-14T19:13:39.008Z"
9
+ }
package/dist/dev.js CHANGED
@@ -174,15 +174,27 @@ function buildInstallContext(harnessName, sandboxDir, binaryName) {
174
174
  npxCli(args, opts = {}) {
175
175
  const packageName = opts.packageName ?? defaultPackage;
176
176
  const binaryName = opts.binaryName ?? defaultBin;
177
- console.log(`[ory-dev] npx --package=${packageName} ${binaryName} ${args.join(" ")}`);
177
+ // The dev launcher owns Ory configuration itself: it brings up (or
178
+ // reuses) the local Ory stack, seeds identities, and wires the harness
179
+ // env directly in `runDevLauncher`. The install CLI's interactive setup
180
+ // wizard must not run here — it inherits the launcher's real TTY, so it
181
+ // would prompt the developer and (on its local branch) try to stand up a
182
+ // second Ory stack, colliding with the one the launcher bootstraps right
183
+ // after. Force the wizard's `--no-configure` escape hatch on every
184
+ // `install` invocation so the launcher's install step stays
185
+ // non-interactive.
186
+ const finalArgs = args[0] === "install" && !args.includes("--no-configure")
187
+ ? [...args, "--no-configure"]
188
+ : args;
189
+ console.log(`[ory-dev] npx --package=${packageName} ${binaryName} ${finalArgs.join(" ")}`);
178
190
  const result = (0, node_child_process_1.spawnSync)("npx", [
179
191
  "--yes",
180
192
  `--package=${packageName}`,
181
193
  binaryName,
182
- ...args,
194
+ ...finalArgs,
183
195
  ], { cwd: sandboxDir, stdio: "inherit", env: npmEnv() });
184
196
  if (result.status !== 0) {
185
- throw new Error(`npx --package=${packageName} ${binaryName} ${args.join(" ")} failed (exit ${result.status}).`);
197
+ throw new Error(`npx --package=${packageName} ${binaryName} ${finalArgs.join(" ")} failed (exit ${result.status}).`);
186
198
  }
187
199
  },
188
200
  };
package/dist/index.d.ts CHANGED
@@ -13,6 +13,7 @@ export { oryNpx } from "./cli-invocation.js";
13
13
  export { runPermissionsCommand, isUserIdentityCached, maybeAutoBootstrap, printPermissionsOnboardingHelp, } from "./permissions-cli.js";
14
14
  export { runInteractiveSetup, runPostInstall, projectUrlFromSlug, LOOPBACK_REDIRECT_URIS, type OryCliRunner, type OryExecResult, type InteractiveSetupDeps, type InteractiveSetupOutcome, type InteractiveSetupResult, } from "./interactive-setup.js";
15
15
  export { runStatusCommand, printUserIdentitySection, printAgentIdentitySection, printPermissionsSection, type StatusCommandOptions, } from "./status-cli.js";
16
+ export { runVersionCommand, collectVersionInfo, resolveBuildInfo, type BuildInfo, type VersionInfo, type VersionCommandOptions, } from "./version-cli.js";
16
17
  export { parseSetupArgs, readJsonFile, writeJsonFile, isOryHookCommand, resolveHookCommand, matcherHookEntry, mergeMatcherHooks, removeMatcherHooks, flatHookEntry, mergeFlatHooks, removeFlatHooks, printSetupHelp, printNextSteps, nextStepsSink, beginDeferNextSteps, emitDeferredNextSteps, resolveMcpServerCommand, mcpServerEntry, mergeMcpServer, removeMcpServer, registerPlugin, unregisterPlugin, type SetupArgs, type HookCommand, type MatcherEntry, } from "./setup.js";
17
18
  export { runDevLauncher, type DevLauncherConfig, type InstallContext, } from "./dev.js";
18
19
  export { renderOrySkills, renderOryCommands, commandToSkill, commandToToml, commandToFrontmatterMarkdown, commandToPlainMarkdown, toSkillMarkdown, writeSkillTree, removeSkillDirs, ORY_SKILL_NAMES, ORY_COMMAND_SKILL_NAMES, ORY_COMMAND_SLUGS, type RenderedSkill, type RenderedCommand, type RenderProfileOptions, } from "./skills.js";
package/dist/index.js CHANGED
@@ -1,9 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.runConfigureCommand = exports.clearCredentialsForUninstall = exports.AGENT_TOKEN_EXPIRY_SKEW_SEC = exports.revokeAgentDynamicClient = exports.clearSubAgentDynamicCredentials = exports.saveSubAgentDynamicCredentials = exports.loadSubAgentDynamicCredentials = exports.clearAgentDynamicCredentials = exports.saveAgentDynamicCredentials = exports.loadAgentDynamicCredentials = exports.registerAgentClient = exports.fetchClientCredentialsToken = exports.ensureSubAgentIdentity = exports.ensureAgentIdentity = 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.DEFAULT_LOGIN_TIMEOUT_MS = exports.LOOPBACK_PORTS = exports.buildAuthorizeUrl = exports.sha256Base64Url = exports.generateCodeVerifier = exports.detectHeadless = exports.refreshAccessToken = exports.pkceLogin = exports.getHarnessDataDir = exports.getDataDir = exports.getConfigPath = exports.mutateConfig = exports.resolveConfig = exports.saveConfig = exports.loadConfig = exports.watchTraceFile = exports.formatSpan = exports.deriveTraceId = exports.ActiveSpan = exports.Tracer = exports.redactLogData = exports.DebugLogger = exports.OryAgentClient = void 0;
4
- exports.commandToSkill = exports.renderOryCommands = exports.renderOrySkills = exports.runDevLauncher = exports.unregisterPlugin = exports.registerPlugin = exports.removeMcpServer = exports.mergeMcpServer = exports.mcpServerEntry = exports.resolveMcpServerCommand = exports.emitDeferredNextSteps = exports.beginDeferNextSteps = exports.nextStepsSink = exports.printNextSteps = exports.printSetupHelp = exports.removeFlatHooks = exports.mergeFlatHooks = exports.flatHookEntry = exports.removeMatcherHooks = exports.mergeMatcherHooks = exports.matcherHookEntry = exports.resolveHookCommand = exports.isOryHookCommand = exports.writeJsonFile = exports.readJsonFile = exports.parseSetupArgs = exports.printPermissionsSection = exports.printAgentIdentitySection = exports.printUserIdentitySection = exports.runStatusCommand = exports.LOOPBACK_REDIRECT_URIS = exports.projectUrlFromSlug = exports.runPostInstall = exports.runInteractiveSetup = exports.printPermissionsOnboardingHelp = exports.maybeAutoBootstrap = exports.isUserIdentityCached = exports.runPermissionsCommand = exports.oryNpx = exports.interactiveConfigPrompt = exports.promptForProjectUrl = exports.promptOnTty = exports.isTtyAvailable = exports.runWatchCommand = exports.printTraceTail = exports.printEnvHelp = exports.printLogTail = exports.printEnvironment = exports.printOryConfig = exports.runAgentCommand = void 0;
5
- exports.sessionStart = exports.resolveNamespace = exports.parseKeyValueList = exports.otlpExporterFromEnv = exports.OtlpExporter = exports.summarizeToolOutput = exports.summarizeToolInput = exports.OryDenialError = exports.alertAttributes = exports.formatAlertSummary = exports.formatAlertMessage = exports.formatDenialSummary = exports.formatDenialMessage = 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.isInteractiveTool = exports.getInteractiveToolCatalog = exports.INTERACTIVE_TOOL_CATALOG = exports.getToolCatalog = exports.ALL_TOOLS = exports.KNOWN_HARNESSES = exports.HARNESS_TOOL_CATALOG = exports.gateToolCall = exports.applyPermissionMode = exports.checkAndDecide = exports.runRegistryCommand = exports.DEV_JAEGER_CONTAINER = exports.stopDevJaeger = exports.ensureDevJaeger = 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 = void 0;
6
- exports.wrapTool = exports.registerSubagent = exports.complete = exports.gate = void 0;
4
+ exports.runDevLauncher = exports.unregisterPlugin = exports.registerPlugin = exports.removeMcpServer = exports.mergeMcpServer = exports.mcpServerEntry = exports.resolveMcpServerCommand = exports.emitDeferredNextSteps = exports.beginDeferNextSteps = exports.nextStepsSink = exports.printNextSteps = exports.printSetupHelp = exports.removeFlatHooks = exports.mergeFlatHooks = exports.flatHookEntry = exports.removeMatcherHooks = exports.mergeMatcherHooks = exports.matcherHookEntry = exports.resolveHookCommand = exports.isOryHookCommand = exports.writeJsonFile = exports.readJsonFile = exports.parseSetupArgs = exports.resolveBuildInfo = exports.collectVersionInfo = exports.runVersionCommand = exports.printPermissionsSection = exports.printAgentIdentitySection = exports.printUserIdentitySection = exports.runStatusCommand = exports.LOOPBACK_REDIRECT_URIS = exports.projectUrlFromSlug = exports.runPostInstall = exports.runInteractiveSetup = exports.printPermissionsOnboardingHelp = exports.maybeAutoBootstrap = exports.isUserIdentityCached = exports.runPermissionsCommand = exports.oryNpx = exports.interactiveConfigPrompt = exports.promptForProjectUrl = exports.promptOnTty = exports.isTtyAvailable = exports.runWatchCommand = exports.printTraceTail = exports.printEnvHelp = exports.printLogTail = exports.printEnvironment = exports.printOryConfig = exports.runAgentCommand = void 0;
5
+ exports.otlpExporterFromEnv = exports.OtlpExporter = exports.summarizeToolOutput = exports.summarizeToolInput = exports.OryDenialError = exports.alertAttributes = exports.formatAlertSummary = exports.formatAlertMessage = exports.formatDenialSummary = exports.formatDenialMessage = 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.isInteractiveTool = exports.getInteractiveToolCatalog = exports.INTERACTIVE_TOOL_CATALOG = exports.getToolCatalog = exports.ALL_TOOLS = exports.KNOWN_HARNESSES = exports.HARNESS_TOOL_CATALOG = exports.gateToolCall = exports.applyPermissionMode = exports.checkAndDecide = exports.runRegistryCommand = exports.DEV_JAEGER_CONTAINER = exports.stopDevJaeger = exports.ensureDevJaeger = 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 = void 0;
6
+ exports.wrapTool = exports.registerSubagent = exports.complete = exports.gate = exports.sessionStart = exports.resolveNamespace = exports.parseKeyValueList = void 0;
7
7
  var client_js_1 = require("./client.js");
8
8
  Object.defineProperty(exports, "OryAgentClient", { enumerable: true, get: function () { return client_js_1.OryAgentClient; } });
9
9
  var logger_js_1 = require("./logger.js");
@@ -92,6 +92,10 @@ Object.defineProperty(exports, "runStatusCommand", { enumerable: true, get: func
92
92
  Object.defineProperty(exports, "printUserIdentitySection", { enumerable: true, get: function () { return status_cli_js_1.printUserIdentitySection; } });
93
93
  Object.defineProperty(exports, "printAgentIdentitySection", { enumerable: true, get: function () { return status_cli_js_1.printAgentIdentitySection; } });
94
94
  Object.defineProperty(exports, "printPermissionsSection", { enumerable: true, get: function () { return status_cli_js_1.printPermissionsSection; } });
95
+ var version_cli_js_1 = require("./version-cli.js");
96
+ Object.defineProperty(exports, "runVersionCommand", { enumerable: true, get: function () { return version_cli_js_1.runVersionCommand; } });
97
+ Object.defineProperty(exports, "collectVersionInfo", { enumerable: true, get: function () { return version_cli_js_1.collectVersionInfo; } });
98
+ Object.defineProperty(exports, "resolveBuildInfo", { enumerable: true, get: function () { return version_cli_js_1.resolveBuildInfo; } });
95
99
  var setup_js_1 = require("./setup.js");
96
100
  Object.defineProperty(exports, "parseSetupArgs", { enumerable: true, get: function () { return setup_js_1.parseSetupArgs; } });
97
101
  Object.defineProperty(exports, "readJsonFile", { enumerable: true, get: function () { return setup_js_1.readJsonFile; } });
@@ -83,6 +83,7 @@ const tool_catalog_js_1 = require("./tool-catalog.js");
83
83
  const index_js_1 = require("./local/index.js");
84
84
  const subject_js_1 = require("./subject.js");
85
85
  const permissions_cli_js_1 = require("./permissions-cli.js");
86
+ const version_cli_js_1 = require("./version-cli.js");
86
87
  const ui = __importStar(require("./ui.js"));
87
88
  /** Loopback redirect URIs the PKCE user login expects on the OAuth2 client. */
88
89
  exports.LOOPBACK_REDIRECT_URIS = auth_js_1.LOOPBACK_PORTS.map((port) => `http://127.0.0.1:${port}/callback`);
@@ -155,6 +156,17 @@ async function installOryCli() {
155
156
  * open-coded as a local `postInstallPermissions` helper.
156
157
  */
157
158
  async function runPostInstall(binName, harness, args = [], deps = {}) {
159
+ // Surface the running CLI version up front. `npx -p @ory/<harness>` (no
160
+ // version pin) will happily reuse a previously-cached install rather than
161
+ // re-resolve to latest, so a user can silently be running an old CLI whose
162
+ // install flow predates newer behavior (e.g. the interactive setup wizard)
163
+ // while believing they're on the current release. Printing the version makes
164
+ // that mismatch visible at a glance; the README's troubleshooting note
165
+ // explains how to clear a stale npx cache.
166
+ const cliVersion = (0, version_cli_js_1.resolveCoreVersion)();
167
+ if (cliVersion !== "unknown") {
168
+ ui.info(`${binName} v${cliVersion}`);
169
+ }
158
170
  const result = await runInteractiveSetup(binName, harness, args, deps);
159
171
  // The Ory Network wizard path bootstraps permissions itself (via the
160
172
  // admin-authenticated `ory` CLI). Only fall back to the DCR-token bootstrap
@@ -12,9 +12,17 @@ export interface GatewayConfig {
12
12
  export interface ConsoleConfig {
13
13
  /** True when Console Lite source is available and the UI will be built. */
14
14
  enabled: boolean;
15
- /** Build context for `docker compose build` (Console Lite only). */
15
+ /**
16
+ * Build context for `docker compose build` (Console Lite only). This is the
17
+ * cloud **monorepo root**, not the console app dir — the Dockerfile copies
18
+ * workspace files (`package.json`, `sdk/packages`, `console/console`, …)
19
+ * from the context root.
20
+ */
16
21
  buildContext?: string;
17
- /** Dockerfile path relative to buildContext (Console Lite only). */
22
+ /**
23
+ * Dockerfile path relative to buildContext (Console Lite only). Because the
24
+ * build context is the monorepo root, this is `console/console/<Dockerfile>`.
25
+ */
18
26
  dockerfile?: string;
19
27
  /**
20
28
  * Absolute path to the `elements` workspace, passed to docker as a named
@@ -45,10 +53,14 @@ export declare function getGatewayConfig(): GatewayConfig;
45
53
  * `repoRoot` is the outermost `.git` ancestor of the given `projectRoot`).
46
54
  * Disabled when that path is missing or unreadable.
47
55
  *
48
- * `ORY_CONSOLE_LITE_PATH` is an explicit override. When set it must
49
- * point at a usable build context; downstream validation surfaces a hard
50
- * error if the path doesn't exist. Relative paths are resolved against
51
- * pnpm's `INIT_CWD` so they match the user's shell cwd.
56
+ * `ORY_CONSOLE_LITE_PATH` is an explicit override pointing at the console app
57
+ * source tree (`<monorepo>/console/console`). When set it must point at a
58
+ * usable tree; downstream validation surfaces a hard error if the derived
59
+ * build context or Dockerfile doesn't exist. Relative paths are resolved
60
+ * against pnpm's `INIT_CWD` so they match the user's shell cwd.
61
+ *
62
+ * In all cases the docker build context is the console app tree's **monorepo
63
+ * root** (two levels up) — see {@link monorepoRootForConsoleApp}.
52
64
  */
53
65
  export declare function getConsoleConfig(projectRoot?: string): ConsoleConfig;
54
66
  /**
@@ -58,11 +58,21 @@ exports.DEFAULT_CONSOLE_LITE_SUBPATH = path.join("..", "cloud", "console", "cons
58
58
  * `ENV PORT=3000`). Bound to the host on CONSOLE_PORT.
59
59
  */
60
60
  const CONSOLE_LITE_INTERNAL_PORT = 3000;
61
- function defaultElementsPath(buildContext) {
62
- // Dockerfile expects `--build-context elements=<elements-dir>`, located at
63
- // `<console-lite>/../../elements` (i.e. sibling of console/ inside the
64
- // cloud monorepo).
65
- return path.resolve(buildContext, "..", "..", "elements");
61
+ /**
62
+ * The Console Lite Dockerfile builds from the **cloud monorepo root**, not the
63
+ * console app dir: it `COPY`s `package.json`, `pnpm-workspace.yaml`,
64
+ * `sdk/packages`, and `console/console` from the build-context root. Given the
65
+ * console app source tree (`<monorepo>/console/console`), the docker build
66
+ * context is two levels up.
67
+ */
68
+ function monorepoRootForConsoleApp(consoleAppDir) {
69
+ return path.resolve(consoleAppDir, "..", "..");
70
+ }
71
+ function defaultElementsPath(monorepoRoot) {
72
+ // Dockerfile expects `--build-context elements=<elements-dir>`; the elements
73
+ // workspace lives at the monorepo root as `elements/` and is referenced via
74
+ // `COPY --from=elements`.
75
+ return path.resolve(monorepoRoot, "elements");
66
76
  }
67
77
  function consoleLiteUsable(buildContext, dockerfile, elementsContext) {
68
78
  try {
@@ -131,34 +141,52 @@ function getGatewayConfig() {
131
141
  * `repoRoot` is the outermost `.git` ancestor of the given `projectRoot`).
132
142
  * Disabled when that path is missing or unreadable.
133
143
  *
134
- * `ORY_CONSOLE_LITE_PATH` is an explicit override. When set it must
135
- * point at a usable build context; downstream validation surfaces a hard
136
- * error if the path doesn't exist. Relative paths are resolved against
137
- * pnpm's `INIT_CWD` so they match the user's shell cwd.
144
+ * `ORY_CONSOLE_LITE_PATH` is an explicit override pointing at the console app
145
+ * source tree (`<monorepo>/console/console`). When set it must point at a
146
+ * usable tree; downstream validation surfaces a hard error if the derived
147
+ * build context or Dockerfile doesn't exist. Relative paths are resolved
148
+ * against pnpm's `INIT_CWD` so they match the user's shell cwd.
149
+ *
150
+ * In all cases the docker build context is the console app tree's **monorepo
151
+ * root** (two levels up) — see {@link monorepoRootForConsoleApp}.
138
152
  */
139
153
  function getConsoleConfig(projectRoot) {
140
- const dockerfile = process.env.ORY_CONSOLE_LITE_DOCKERFILE?.trim() || "Dockerfile";
154
+ const dockerfileName = process.env.ORY_CONSOLE_LITE_DOCKERFILE?.trim() || "Dockerfile";
141
155
  const elementsOverride = process.env.ORY_CONSOLE_LITE_ELEMENTS_PATH?.trim();
142
156
  const buildMode = process.env.ORY_CONSOLE_LITE_BUILD_MODE?.trim() || "oss";
157
+ // Resolve the console app source tree (`<monorepo>/console/console`) — what
158
+ // ORY_CONSOLE_LITE_PATH and the default sibling-checkout layout point at.
159
+ let consoleAppDir;
160
+ let source;
143
161
  const explicit = process.env.ORY_CONSOLE_LITE_PATH?.trim();
144
162
  if (explicit) {
145
- const buildContext = resolveUserPath(explicit);
146
- const elementsContext = elementsOverride
147
- ? resolveUserPath(elementsOverride)
148
- : defaultElementsPath(buildContext);
149
- return consoleConfig(buildContext, dockerfile, elementsContext, buildMode, "env");
163
+ consoleAppDir = resolveUserPath(explicit);
164
+ source = "env";
150
165
  }
151
- if (projectRoot) {
166
+ else if (projectRoot) {
152
167
  const repoRoot = findOutermostGitAncestor(projectRoot);
153
- const def = path.resolve(repoRoot, exports.DEFAULT_CONSOLE_LITE_SUBPATH);
154
- const elementsContext = elementsOverride
155
- ? resolveUserPath(elementsOverride)
156
- : defaultElementsPath(def);
157
- if (consoleLiteUsable(def, dockerfile, elementsContext)) {
158
- return consoleConfig(def, dockerfile, elementsContext, buildMode, "default");
159
- }
168
+ consoleAppDir = path.resolve(repoRoot, exports.DEFAULT_CONSOLE_LITE_SUBPATH);
169
+ source = "default";
170
+ }
171
+ else {
172
+ return { enabled: false };
173
+ }
174
+ // The Dockerfile builds from the monorepo root, so the docker build context
175
+ // is two levels up and the Dockerfile is addressed relative to that root
176
+ // (e.g. `console/console/Dockerfile`).
177
+ const buildContext = monorepoRootForConsoleApp(consoleAppDir);
178
+ const dockerfile = path.join(path.relative(buildContext, consoleAppDir), dockerfileName);
179
+ const elementsContext = elementsOverride
180
+ ? resolveUserPath(elementsOverride)
181
+ : defaultElementsPath(buildContext);
182
+ // Auto-detected (default) Console is silently disabled when its inputs are
183
+ // absent; an explicit override is always enabled so validation can surface a
184
+ // hard error pointing the operator at the misconfiguration.
185
+ if (source === "default" &&
186
+ !consoleLiteUsable(buildContext, dockerfile, elementsContext)) {
187
+ return { enabled: false };
160
188
  }
161
- return { enabled: false };
189
+ return consoleConfig(buildContext, dockerfile, elementsContext, buildMode, source);
162
190
  }
163
191
  // ─── Docker Compose ────────────────────────────────────────────────
164
192
  function nginxGatewayService() {
@@ -100,7 +100,7 @@ function validateConsoleConfig(cfg) {
100
100
  }
101
101
  if (!fs.existsSync(elements)) {
102
102
  return (`Elements context not found at ${elements}. ` +
103
- `Console Lite's Dockerfile expects '../../elements' relative to the console dir; ` +
103
+ `Console Lite's Dockerfile expects an 'elements' workspace at the monorepo root; ` +
104
104
  `set ORY_CONSOLE_LITE_ELEMENTS_PATH to override.`);
105
105
  }
106
106
  return null;
@@ -0,0 +1,59 @@
1
+ /** Git + build metadata captured when `@ory/argus` was built. */
2
+ export interface BuildInfo {
3
+ /** Full 40-char commit SHA, or `null` when git was unavailable at build. */
4
+ commit: string | null;
5
+ /** Abbreviated commit SHA. */
6
+ commitShort: string | null;
7
+ /** Branch the build was cut from. */
8
+ branch: string | null;
9
+ /** ISO-8601 commit date. */
10
+ commitDate: string | null;
11
+ /** Whether the working tree had uncommitted changes at build time. */
12
+ dirty: boolean | null;
13
+ /** ISO-8601 timestamp of when the build ran. */
14
+ builtAt: string | null;
15
+ /**
16
+ * Where the info came from: `embedded` (build-time file, authoritative
17
+ * for a release), `git` (live probe of a confirmed ory-agent-plugins
18
+ * checkout — dev/local), or `unknown` (neither available).
19
+ */
20
+ source: "embedded" | "git" | "unknown";
21
+ }
22
+ /**
23
+ * Resolve the ory-agent-plugins build/commit metadata: prefer the
24
+ * build-time embedded file (authoritative for published packages), fall
25
+ * back to a live git probe of a confirmed monorepo checkout, else report
26
+ * `unknown`.
27
+ */
28
+ export declare function resolveBuildInfo(): BuildInfo;
29
+ /**
30
+ * Resolve the `@ory/argus` core version from this module's own package.json.
31
+ * Exported so the install flow can surface the running CLI version — every
32
+ * `@ory/*` package releases in lockstep, so the core version is the release
33
+ * version of whatever plugin CLI is executing.
34
+ */
35
+ export declare function resolveCoreVersion(): string;
36
+ export interface VersionInfo {
37
+ plugin: {
38
+ name: string;
39
+ version: string;
40
+ };
41
+ core: {
42
+ name: string;
43
+ version: string;
44
+ };
45
+ node: string;
46
+ build: BuildInfo;
47
+ }
48
+ /** Assemble the full version report as structured data. */
49
+ export declare function collectVersionInfo(packageRoot: string): VersionInfo;
50
+ export interface VersionCommandOptions {
51
+ /** The plugin package root — `path.resolve(__dirname, "..", "..")` from `dist/cli/main.js`. */
52
+ packageRoot: string;
53
+ }
54
+ /**
55
+ * Render the `version` output. Supports `--json` for machine-readable
56
+ * output. Returns a numeric exit code (always 0 today) to match the shape
57
+ * of the other async CLI helpers.
58
+ */
59
+ export declare function runVersionCommand(binName: string, args: string[], options: VersionCommandOptions): number;
@@ -0,0 +1,230 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ exports.resolveBuildInfo = resolveBuildInfo;
37
+ exports.resolveCoreVersion = resolveCoreVersion;
38
+ exports.collectVersionInfo = collectVersionInfo;
39
+ exports.runVersionCommand = runVersionCommand;
40
+ /**
41
+ * Unified `version` CLI implementation. Each harness's `cli/main.ts`
42
+ * `version` subcommand delegates here so `ory-<harness> version` prints a
43
+ * consistent report: the plugin package version, the `@ory/argus` core
44
+ * version, the Node runtime, and — the point of the command — the git
45
+ * commit of the internal `ory-agent-plugins` monorepo the build came from.
46
+ *
47
+ * The commit is *not* recovered by shelling out to `git` at runtime. A
48
+ * published npm package carries no `.git`, and running `git` from inside a
49
+ * user's `node_modules` would report the *user's* repo — the wrong commit.
50
+ * Instead the commit is embedded at build time into
51
+ * `@ory/argus`'s `dist/build-info.json` (see `scripts/gen-build-info.mjs`)
52
+ * and read back here. Because every `@ory/*` package releases in lockstep,
53
+ * core's embedded commit is authoritative for the whole monorepo release,
54
+ * so each plugin reads it through its `@ory/argus` dependency.
55
+ */
56
+ const node_child_process_1 = require("node:child_process");
57
+ const fs = __importStar(require("node:fs"));
58
+ const path = __importStar(require("node:path"));
59
+ /**
60
+ * Read the build-info embedded in `@ory/argus`'s `dist/`. This module
61
+ * compiles to `dist/version-cli.js`, so the sibling `dist/build-info.json`
62
+ * is `path.join(__dirname, "build-info.json")`.
63
+ */
64
+ function readEmbeddedBuildInfo() {
65
+ try {
66
+ const file = path.join(__dirname, "build-info.json");
67
+ if (!fs.existsSync(file))
68
+ return undefined;
69
+ const raw = JSON.parse(fs.readFileSync(file, "utf8"));
70
+ if (!raw.commit && !raw.builtAt)
71
+ return undefined;
72
+ return {
73
+ commit: raw.commit ?? null,
74
+ commitShort: raw.commitShort ?? null,
75
+ branch: raw.branch ?? null,
76
+ commitDate: raw.commitDate ?? null,
77
+ dirty: raw.dirty ?? null,
78
+ builtAt: raw.builtAt ?? null,
79
+ source: "embedded",
80
+ };
81
+ }
82
+ catch {
83
+ return undefined;
84
+ }
85
+ }
86
+ function git(args) {
87
+ try {
88
+ return ((0, node_child_process_1.execFileSync)("git", args, {
89
+ cwd: __dirname,
90
+ timeout: 500,
91
+ stdio: ["ignore", "pipe", "ignore"],
92
+ encoding: "utf8",
93
+ }).trim() || null);
94
+ }
95
+ catch {
96
+ return null;
97
+ }
98
+ }
99
+ /**
100
+ * Live git fallback for when no embedded build-info exists (a bare `tsc`
101
+ * build in a checkout). Guarded: we only trust the result when the
102
+ * enclosing git repo is confirmed to be `ory-agent-plugins`, so a
103
+ * published package accidentally sitting inside a user's repo never
104
+ * reports that repo's commit.
105
+ */
106
+ function liveGitBuildInfo() {
107
+ const toplevel = git(["rev-parse", "--show-toplevel"]);
108
+ if (!toplevel)
109
+ return undefined;
110
+ try {
111
+ const rootPkg = path.join(toplevel, "package.json");
112
+ if (!fs.existsSync(rootPkg))
113
+ return undefined;
114
+ const name = JSON.parse(fs.readFileSync(rootPkg, "utf8")).name;
115
+ if (name !== "ory-agent-plugins")
116
+ return undefined;
117
+ }
118
+ catch {
119
+ return undefined;
120
+ }
121
+ const commit = git(["rev-parse", "HEAD"]);
122
+ if (!commit)
123
+ return undefined;
124
+ const statusOut = git(["status", "--porcelain"]);
125
+ return {
126
+ commit,
127
+ commitShort: git(["rev-parse", "--short", "HEAD"]),
128
+ branch: git(["rev-parse", "--abbrev-ref", "HEAD"]),
129
+ commitDate: git(["show", "-s", "--format=%cI", "HEAD"]),
130
+ dirty: statusOut !== null && statusOut.length > 0,
131
+ builtAt: null,
132
+ source: "git",
133
+ };
134
+ }
135
+ /**
136
+ * Resolve the ory-agent-plugins build/commit metadata: prefer the
137
+ * build-time embedded file (authoritative for published packages), fall
138
+ * back to a live git probe of a confirmed monorepo checkout, else report
139
+ * `unknown`.
140
+ */
141
+ function resolveBuildInfo() {
142
+ return (readEmbeddedBuildInfo() ??
143
+ liveGitBuildInfo() ?? {
144
+ commit: null,
145
+ commitShort: null,
146
+ branch: null,
147
+ commitDate: null,
148
+ dirty: null,
149
+ builtAt: null,
150
+ source: "unknown",
151
+ });
152
+ }
153
+ function readPackageMeta(packageRoot) {
154
+ try {
155
+ const pkg = JSON.parse(fs.readFileSync(path.join(packageRoot, "package.json"), "utf8"));
156
+ return { name: pkg.name ?? "unknown", version: pkg.version ?? "0.0.0" };
157
+ }
158
+ catch {
159
+ return { name: "unknown", version: "0.0.0" };
160
+ }
161
+ }
162
+ /**
163
+ * Resolve the `@ory/argus` core version from this module's own package.json.
164
+ * Exported so the install flow can surface the running CLI version — every
165
+ * `@ory/*` package releases in lockstep, so the core version is the release
166
+ * version of whatever plugin CLI is executing.
167
+ */
168
+ function resolveCoreVersion() {
169
+ let dir = __dirname;
170
+ for (let i = 0; i < 5; i++) {
171
+ const candidate = path.join(dir, "package.json");
172
+ try {
173
+ if (fs.existsSync(candidate)) {
174
+ const pkg = JSON.parse(fs.readFileSync(candidate, "utf8"));
175
+ if (pkg.version)
176
+ return pkg.version;
177
+ }
178
+ }
179
+ catch {
180
+ /* keep walking */
181
+ }
182
+ const parent = path.dirname(dir);
183
+ if (parent === dir)
184
+ break;
185
+ dir = parent;
186
+ }
187
+ return "unknown";
188
+ }
189
+ /** Assemble the full version report as structured data. */
190
+ function collectVersionInfo(packageRoot) {
191
+ return {
192
+ plugin: readPackageMeta(packageRoot),
193
+ core: { name: "@ory/argus", version: resolveCoreVersion() },
194
+ node: process.version,
195
+ build: resolveBuildInfo(),
196
+ };
197
+ }
198
+ function formatCommitLine(build) {
199
+ if (!build.commit)
200
+ return "unknown (git metadata was not embedded at build time)";
201
+ const short = build.commitShort ?? build.commit.slice(0, 7);
202
+ const dirty = build.dirty ? " (with uncommitted changes)" : "";
203
+ return `${short}${dirty}`;
204
+ }
205
+ /**
206
+ * Render the `version` output. Supports `--json` for machine-readable
207
+ * output. Returns a numeric exit code (always 0 today) to match the shape
208
+ * of the other async CLI helpers.
209
+ */
210
+ function runVersionCommand(binName, args, options) {
211
+ const info = collectVersionInfo(options.packageRoot);
212
+ if (args.includes("--json")) {
213
+ console.log(JSON.stringify(info, null, 2));
214
+ return 0;
215
+ }
216
+ const { plugin, core, build } = info;
217
+ console.log(`${plugin.name} ${plugin.version}`);
218
+ console.log(` core (@ory/argus): ${core.version}`);
219
+ console.log(` node: ${info.node}`);
220
+ console.log("");
221
+ console.log("ory-agent-plugins build:");
222
+ console.log(` short: ${formatCommitLine(build)}`);
223
+ if (build.commitDate)
224
+ console.log(` date: ${build.commitDate}`);
225
+ if (build.builtAt)
226
+ console.log(` built: ${build.builtAt}`);
227
+ console.log("");
228
+ console.log(`Run "${binName} version --json" for machine-readable output.`);
229
+ return 0;
230
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ory/argus",
3
- "version": "0.12.1",
3
+ "version": "0.13.1",
4
4
  "description": "Ory Argus: the core API for building authentication, authorization, and audit into AI agent harness plugins, extensions, and custom integrations",
5
5
  "license": "Apache-2.0",
6
6
  "homepage": "https://ory.com",
@@ -79,7 +79,7 @@
79
79
  "node": ">=22"
80
80
  },
81
81
  "scripts": {
82
- "build": "tsc",
82
+ "build": "tsc && node ./scripts/gen-build-info.mjs",
83
83
  "clean": "rm -rf dist *.tsbuildinfo",
84
84
  "test": "vitest run",
85
85
  "test:watch": "vitest",