@ory/argus 0.12.0 → 0.13.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.
- package/dist/build-info.json +9 -0
- package/dist/cli-invocation.js +2 -2
- package/dist/dev.js +15 -3
- package/dist/index.d.ts +1 -0
- package/dist/index.js +7 -3
- package/dist/local/configs.d.ts +18 -6
- package/dist/local/configs.js +52 -24
- package/dist/local/manager.js +1 -1
- package/dist/version-cli.d.ts +52 -0
- package/dist/version-cli.js +224 -0
- package/package.json +4 -3
package/dist/cli-invocation.js
CHANGED
|
@@ -30,12 +30,12 @@ const BIN_TO_PACKAGE = {
|
|
|
30
30
|
"ory-gemini": "@ory/gemini-cli",
|
|
31
31
|
"ory-openclaw": "@ory/openclaw",
|
|
32
32
|
"ory-opencode": "@ory/opencode",
|
|
33
|
-
"ory-
|
|
33
|
+
"ory-cn": "@ory/continue",
|
|
34
34
|
"ory-goose": "@ory/goose",
|
|
35
35
|
"ory-cline": "@ory/cline",
|
|
36
36
|
"ory-amp": "@ory/amp",
|
|
37
37
|
"ory-pi": "@ory/pi",
|
|
38
|
-
"ory-
|
|
38
|
+
"ory-agy": "@ory/antigravity",
|
|
39
39
|
};
|
|
40
40
|
/**
|
|
41
41
|
* Render a copy-pasteable `npx` invocation prefix for a harness bin.
|
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
|
-
|
|
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
|
-
...
|
|
194
|
+
...finalArgs,
|
|
183
195
|
], { cwd: sandboxDir, stdio: "inherit", env: npmEnv() });
|
|
184
196
|
if (result.status !== 0) {
|
|
185
|
-
throw new Error(`npx --package=${packageName} ${binaryName} ${
|
|
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.
|
|
5
|
-
exports.
|
|
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; } });
|
package/dist/local/configs.d.ts
CHANGED
|
@@ -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
|
-
/**
|
|
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
|
-
/**
|
|
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
|
|
49
|
-
*
|
|
50
|
-
*
|
|
51
|
-
*
|
|
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
|
/**
|
package/dist/local/configs.js
CHANGED
|
@@ -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
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
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
|
|
135
|
-
*
|
|
136
|
-
*
|
|
137
|
-
*
|
|
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
|
|
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
|
-
|
|
146
|
-
|
|
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
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
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
|
|
189
|
+
return consoleConfig(buildContext, dockerfile, elementsContext, buildMode, source);
|
|
162
190
|
}
|
|
163
191
|
// ─── Docker Compose ────────────────────────────────────────────────
|
|
164
192
|
function nginxGatewayService() {
|
package/dist/local/manager.js
CHANGED
|
@@ -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 '
|
|
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,52 @@
|
|
|
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
|
+
export interface VersionInfo {
|
|
30
|
+
plugin: {
|
|
31
|
+
name: string;
|
|
32
|
+
version: string;
|
|
33
|
+
};
|
|
34
|
+
core: {
|
|
35
|
+
name: string;
|
|
36
|
+
version: string;
|
|
37
|
+
};
|
|
38
|
+
node: string;
|
|
39
|
+
build: BuildInfo;
|
|
40
|
+
}
|
|
41
|
+
/** Assemble the full version report as structured data. */
|
|
42
|
+
export declare function collectVersionInfo(packageRoot: string): VersionInfo;
|
|
43
|
+
export interface VersionCommandOptions {
|
|
44
|
+
/** The plugin package root — `path.resolve(__dirname, "..", "..")` from `dist/cli/main.js`. */
|
|
45
|
+
packageRoot: string;
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Render the `version` output. Supports `--json` for machine-readable
|
|
49
|
+
* output. Returns a numeric exit code (always 0 today) to match the shape
|
|
50
|
+
* of the other async CLI helpers.
|
|
51
|
+
*/
|
|
52
|
+
export declare function runVersionCommand(binName: string, args: string[], options: VersionCommandOptions): number;
|
|
@@ -0,0 +1,224 @@
|
|
|
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.collectVersionInfo = collectVersionInfo;
|
|
38
|
+
exports.runVersionCommand = runVersionCommand;
|
|
39
|
+
/**
|
|
40
|
+
* Unified `version` CLI implementation. Each harness's `cli/main.ts`
|
|
41
|
+
* `version` subcommand delegates here so `ory-<harness> version` prints a
|
|
42
|
+
* consistent report: the plugin package version, the `@ory/argus` core
|
|
43
|
+
* version, the Node runtime, and — the point of the command — the git
|
|
44
|
+
* commit of the internal `ory-agent-plugins` monorepo the build came from.
|
|
45
|
+
*
|
|
46
|
+
* The commit is *not* recovered by shelling out to `git` at runtime. A
|
|
47
|
+
* published npm package carries no `.git`, and running `git` from inside a
|
|
48
|
+
* user's `node_modules` would report the *user's* repo — the wrong commit.
|
|
49
|
+
* Instead the commit is embedded at build time into
|
|
50
|
+
* `@ory/argus`'s `dist/build-info.json` (see `scripts/gen-build-info.mjs`)
|
|
51
|
+
* and read back here. Because every `@ory/*` package releases in lockstep,
|
|
52
|
+
* core's embedded commit is authoritative for the whole monorepo release,
|
|
53
|
+
* so each plugin reads it through its `@ory/argus` dependency.
|
|
54
|
+
*/
|
|
55
|
+
const node_child_process_1 = require("node:child_process");
|
|
56
|
+
const fs = __importStar(require("node:fs"));
|
|
57
|
+
const path = __importStar(require("node:path"));
|
|
58
|
+
/**
|
|
59
|
+
* Read the build-info embedded in `@ory/argus`'s `dist/`. This module
|
|
60
|
+
* compiles to `dist/version-cli.js`, so the sibling `dist/build-info.json`
|
|
61
|
+
* is `path.join(__dirname, "build-info.json")`.
|
|
62
|
+
*/
|
|
63
|
+
function readEmbeddedBuildInfo() {
|
|
64
|
+
try {
|
|
65
|
+
const file = path.join(__dirname, "build-info.json");
|
|
66
|
+
if (!fs.existsSync(file))
|
|
67
|
+
return undefined;
|
|
68
|
+
const raw = JSON.parse(fs.readFileSync(file, "utf8"));
|
|
69
|
+
if (!raw.commit && !raw.builtAt)
|
|
70
|
+
return undefined;
|
|
71
|
+
return {
|
|
72
|
+
commit: raw.commit ?? null,
|
|
73
|
+
commitShort: raw.commitShort ?? null,
|
|
74
|
+
branch: raw.branch ?? null,
|
|
75
|
+
commitDate: raw.commitDate ?? null,
|
|
76
|
+
dirty: raw.dirty ?? null,
|
|
77
|
+
builtAt: raw.builtAt ?? null,
|
|
78
|
+
source: "embedded",
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
catch {
|
|
82
|
+
return undefined;
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
function git(args) {
|
|
86
|
+
try {
|
|
87
|
+
return ((0, node_child_process_1.execFileSync)("git", args, {
|
|
88
|
+
cwd: __dirname,
|
|
89
|
+
timeout: 500,
|
|
90
|
+
stdio: ["ignore", "pipe", "ignore"],
|
|
91
|
+
encoding: "utf8",
|
|
92
|
+
}).trim() || null);
|
|
93
|
+
}
|
|
94
|
+
catch {
|
|
95
|
+
return null;
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* Live git fallback for when no embedded build-info exists (a bare `tsc`
|
|
100
|
+
* build in a checkout). Guarded: we only trust the result when the
|
|
101
|
+
* enclosing git repo is confirmed to be `ory-agent-plugins`, so a
|
|
102
|
+
* published package accidentally sitting inside a user's repo never
|
|
103
|
+
* reports that repo's commit.
|
|
104
|
+
*/
|
|
105
|
+
function liveGitBuildInfo() {
|
|
106
|
+
const toplevel = git(["rev-parse", "--show-toplevel"]);
|
|
107
|
+
if (!toplevel)
|
|
108
|
+
return undefined;
|
|
109
|
+
try {
|
|
110
|
+
const rootPkg = path.join(toplevel, "package.json");
|
|
111
|
+
if (!fs.existsSync(rootPkg))
|
|
112
|
+
return undefined;
|
|
113
|
+
const name = JSON.parse(fs.readFileSync(rootPkg, "utf8")).name;
|
|
114
|
+
if (name !== "ory-agent-plugins")
|
|
115
|
+
return undefined;
|
|
116
|
+
}
|
|
117
|
+
catch {
|
|
118
|
+
return undefined;
|
|
119
|
+
}
|
|
120
|
+
const commit = git(["rev-parse", "HEAD"]);
|
|
121
|
+
if (!commit)
|
|
122
|
+
return undefined;
|
|
123
|
+
const statusOut = git(["status", "--porcelain"]);
|
|
124
|
+
return {
|
|
125
|
+
commit,
|
|
126
|
+
commitShort: git(["rev-parse", "--short", "HEAD"]),
|
|
127
|
+
branch: git(["rev-parse", "--abbrev-ref", "HEAD"]),
|
|
128
|
+
commitDate: git(["show", "-s", "--format=%cI", "HEAD"]),
|
|
129
|
+
dirty: statusOut !== null && statusOut.length > 0,
|
|
130
|
+
builtAt: null,
|
|
131
|
+
source: "git",
|
|
132
|
+
};
|
|
133
|
+
}
|
|
134
|
+
/**
|
|
135
|
+
* Resolve the ory-agent-plugins build/commit metadata: prefer the
|
|
136
|
+
* build-time embedded file (authoritative for published packages), fall
|
|
137
|
+
* back to a live git probe of a confirmed monorepo checkout, else report
|
|
138
|
+
* `unknown`.
|
|
139
|
+
*/
|
|
140
|
+
function resolveBuildInfo() {
|
|
141
|
+
return (readEmbeddedBuildInfo() ??
|
|
142
|
+
liveGitBuildInfo() ?? {
|
|
143
|
+
commit: null,
|
|
144
|
+
commitShort: null,
|
|
145
|
+
branch: null,
|
|
146
|
+
commitDate: null,
|
|
147
|
+
dirty: null,
|
|
148
|
+
builtAt: null,
|
|
149
|
+
source: "unknown",
|
|
150
|
+
});
|
|
151
|
+
}
|
|
152
|
+
function readPackageMeta(packageRoot) {
|
|
153
|
+
try {
|
|
154
|
+
const pkg = JSON.parse(fs.readFileSync(path.join(packageRoot, "package.json"), "utf8"));
|
|
155
|
+
return { name: pkg.name ?? "unknown", version: pkg.version ?? "0.0.0" };
|
|
156
|
+
}
|
|
157
|
+
catch {
|
|
158
|
+
return { name: "unknown", version: "0.0.0" };
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
/** Resolve the `@ory/argus` core version from this module's own package.json. */
|
|
162
|
+
function resolveCoreVersion() {
|
|
163
|
+
let dir = __dirname;
|
|
164
|
+
for (let i = 0; i < 5; i++) {
|
|
165
|
+
const candidate = path.join(dir, "package.json");
|
|
166
|
+
try {
|
|
167
|
+
if (fs.existsSync(candidate)) {
|
|
168
|
+
const pkg = JSON.parse(fs.readFileSync(candidate, "utf8"));
|
|
169
|
+
if (pkg.version)
|
|
170
|
+
return pkg.version;
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
catch {
|
|
174
|
+
/* keep walking */
|
|
175
|
+
}
|
|
176
|
+
const parent = path.dirname(dir);
|
|
177
|
+
if (parent === dir)
|
|
178
|
+
break;
|
|
179
|
+
dir = parent;
|
|
180
|
+
}
|
|
181
|
+
return "unknown";
|
|
182
|
+
}
|
|
183
|
+
/** Assemble the full version report as structured data. */
|
|
184
|
+
function collectVersionInfo(packageRoot) {
|
|
185
|
+
return {
|
|
186
|
+
plugin: readPackageMeta(packageRoot),
|
|
187
|
+
core: { name: "@ory/argus", version: resolveCoreVersion() },
|
|
188
|
+
node: process.version,
|
|
189
|
+
build: resolveBuildInfo(),
|
|
190
|
+
};
|
|
191
|
+
}
|
|
192
|
+
function formatCommitLine(build) {
|
|
193
|
+
if (!build.commit)
|
|
194
|
+
return "unknown (git metadata was not embedded at build time)";
|
|
195
|
+
const short = build.commitShort ?? build.commit.slice(0, 7);
|
|
196
|
+
const dirty = build.dirty ? " (with uncommitted changes)" : "";
|
|
197
|
+
return `${short}${dirty}`;
|
|
198
|
+
}
|
|
199
|
+
/**
|
|
200
|
+
* Render the `version` output. Supports `--json` for machine-readable
|
|
201
|
+
* output. Returns a numeric exit code (always 0 today) to match the shape
|
|
202
|
+
* of the other async CLI helpers.
|
|
203
|
+
*/
|
|
204
|
+
function runVersionCommand(binName, args, options) {
|
|
205
|
+
const info = collectVersionInfo(options.packageRoot);
|
|
206
|
+
if (args.includes("--json")) {
|
|
207
|
+
console.log(JSON.stringify(info, null, 2));
|
|
208
|
+
return 0;
|
|
209
|
+
}
|
|
210
|
+
const { plugin, core, build } = info;
|
|
211
|
+
console.log(`${plugin.name} ${plugin.version}`);
|
|
212
|
+
console.log(` core (@ory/argus): ${core.version}`);
|
|
213
|
+
console.log(` node: ${info.node}`);
|
|
214
|
+
console.log("");
|
|
215
|
+
console.log("ory-agent-plugins build:");
|
|
216
|
+
console.log(` short: ${formatCommitLine(build)}`);
|
|
217
|
+
if (build.commitDate)
|
|
218
|
+
console.log(` date: ${build.commitDate}`);
|
|
219
|
+
if (build.builtAt)
|
|
220
|
+
console.log(` built: ${build.builtAt}`);
|
|
221
|
+
console.log("");
|
|
222
|
+
console.log(`Run "${binName} version --json" for machine-readable output.`);
|
|
223
|
+
return 0;
|
|
224
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ory/argus",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.13.0",
|
|
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",
|
|
@@ -72,13 +72,14 @@
|
|
|
72
72
|
"@opentelemetry/resources": "^2.8.0",
|
|
73
73
|
"@opentelemetry/sdk-trace-base": "^2.8.0",
|
|
74
74
|
"@ory/client": "^1.22.37",
|
|
75
|
-
"open": "^11.0.0"
|
|
75
|
+
"open": "^11.0.0",
|
|
76
|
+
"reo-census": "^1.2.8"
|
|
76
77
|
},
|
|
77
78
|
"engines": {
|
|
78
79
|
"node": ">=22"
|
|
79
80
|
},
|
|
80
81
|
"scripts": {
|
|
81
|
-
"build": "tsc",
|
|
82
|
+
"build": "tsc && node ./scripts/gen-build-info.mjs",
|
|
82
83
|
"clean": "rm -rf dist *.tsbuildinfo",
|
|
83
84
|
"test": "vitest run",
|
|
84
85
|
"test:watch": "vitest",
|