@ory/argus 0.13.9 → 1.0.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/README.md +31 -45
- package/assets/commands/temporal-up.md +1 -1
- package/assets/skills/auth-setup/SKILL.md +1 -1
- package/assets/skills/local-dev/SKILL.md +17 -7
- package/assets/skills/ory-build-agent/SKILL.md +43 -97
- package/assets/skills/ory-e2b-sandbox/SKILL.md +18 -18
- package/assets/skills/ory-temporal-worker/SKILL.md +38 -42
- package/assets/skills/permissions-onboarding/SKILL.md +131 -104
- package/dist/adapters.d.ts +93 -30
- package/dist/adapters.js +464 -136
- package/dist/agent-auth.d.ts +258 -68
- package/dist/agent-auth.js +998 -202
- package/dist/auth-store.d.ts +37 -2
- package/dist/auth-store.js +37 -3
- package/dist/auth.d.ts +40 -4
- package/dist/auth.js +247 -19
- package/dist/bash-parser.d.ts +98 -0
- package/dist/bash-parser.js +396 -0
- package/dist/branding.d.ts +128 -0
- package/dist/branding.js +151 -0
- package/dist/build-info.json +4 -4
- package/dist/cli-invocation.d.ts +1 -1
- package/dist/cli-invocation.js +2 -1
- package/dist/cli.d.ts +20 -29
- package/dist/cli.js +271 -278
- package/dist/client.d.ts +175 -138
- package/dist/client.js +672 -391
- package/dist/config.d.ts +249 -57
- package/dist/config.js +486 -62
- package/dist/context.d.ts +10 -0
- package/dist/context.js +21 -0
- package/dist/contract-suite.d.ts +8 -8
- package/dist/contract-suite.js +88 -69
- package/dist/denial.d.ts +36 -3
- package/dist/denial.js +79 -10
- package/dist/event-reporter.d.ts +77 -0
- package/dist/event-reporter.js +776 -0
- package/dist/external-registrations-main.d.ts +10 -0
- package/dist/external-registrations-main.js +38 -0
- package/dist/external-registrations.d.ts +79 -0
- package/dist/external-registrations.js +188 -0
- package/dist/help-cli.d.ts +39 -0
- package/dist/help-cli.js +55 -0
- package/dist/hook-timeout.d.ts +64 -0
- package/dist/hook-timeout.js +88 -0
- package/dist/index.d.ts +31 -19
- package/dist/index.js +182 -31
- package/dist/lifecycle.d.ts +3 -3
- package/dist/lifecycle.js +38 -6
- package/dist/local/cli.js +11 -6
- package/dist/local/configs.d.ts +74 -18
- package/dist/local/configs.js +291 -84
- package/dist/local/health.d.ts +14 -0
- package/dist/local/health.js +50 -4
- package/dist/local/index.d.ts +2 -2
- package/dist/local/index.js +24 -10
- package/dist/local/manager.d.ts +20 -1
- package/dist/local/manager.js +160 -39
- package/dist/local/ports.d.ts +158 -0
- package/dist/local/ports.js +443 -0
- package/dist/local/seed.d.ts +22 -25
- package/dist/local/seed.js +88 -56
- package/dist/logger.d.ts +54 -25
- package/dist/logger.js +329 -63
- package/dist/mcp.d.ts +2 -2
- package/dist/mcp.js +10 -5
- package/dist/mirror-bootstrap.d.ts +48 -0
- package/dist/mirror-bootstrap.js +254 -0
- package/dist/opl.d.ts +289 -0
- package/dist/opl.js +446 -0
- package/dist/permission-mode.d.ts +87 -0
- package/dist/permission-mode.js +307 -0
- package/dist/permissions-cli.d.ts +13 -49
- package/dist/permissions-cli.js +154 -348
- package/dist/permissions.d.ts +148 -38
- package/dist/permissions.js +591 -45
- package/dist/post-install.d.ts +33 -0
- package/dist/post-install.js +127 -0
- package/dist/read-credential.d.ts +65 -0
- package/dist/read-credential.js +86 -0
- package/dist/registry/cli.js +5 -2
- package/dist/registry/config.d.ts +0 -17
- package/dist/registry/config.js +0 -23
- package/dist/registry/index.d.ts +1 -1
- package/dist/registry/index.js +2 -2
- package/dist/registry/manager.d.ts +4 -21
- package/dist/registry/manager.js +83 -55
- package/dist/runtime-credential.d.ts +140 -0
- package/dist/runtime-credential.js +572 -0
- package/dist/runtime.d.ts +408 -0
- package/dist/runtime.js +748 -0
- package/dist/setup.d.ts +23 -28
- package/dist/setup.js +57 -84
- package/dist/status-cli.d.ts +29 -13
- package/dist/status-cli.js +124 -144
- package/dist/status-data.d.ts +195 -0
- package/dist/status-data.js +333 -0
- package/dist/status-system.d.ts +24 -0
- package/dist/status-system.js +56 -0
- package/dist/subject.d.ts +126 -20
- package/dist/subject.js +215 -30
- package/dist/testing.d.ts +74 -38
- package/dist/testing.js +185 -68
- package/dist/tool-catalog.d.ts +53 -11
- package/dist/tool-catalog.js +164 -13
- package/dist/tool-metadata.d.ts +7 -6
- package/dist/tool-metadata.js +6 -5
- package/dist/types.d.ts +11 -1
- package/dist/uninstall.d.ts +74 -19
- package/dist/uninstall.js +224 -49
- package/dist/user-login.d.ts +22 -16
- package/dist/user-login.js +67 -96
- package/dist/watch-cli.d.ts +6 -0
- package/dist/watch-cli.js +217 -0
- package/package.json +3 -11
- package/dist/dev.d.ts +0 -103
- package/dist/dev.js +0 -584
- package/dist/interactive-setup.d.ts +0 -165
- package/dist/interactive-setup.js +0 -1546
- package/dist/local/jaeger-main.d.ts +0 -13
- package/dist/local/jaeger-main.js +0 -85
- package/dist/local/jaeger.d.ts +0 -50
- package/dist/local/jaeger.js +0 -162
- package/dist/otel/exporter.d.ts +0 -17
- package/dist/otel/exporter.js +0 -12
- package/dist/otel/index.d.ts +0 -2
- package/dist/otel/index.js +0 -8
- package/dist/otel/otlp.d.ts +0 -103
- package/dist/otel/otlp.js +0 -385
- package/dist/tracer.d.ts +0 -190
- package/dist/tracer.js +0 -481
- package/dist/watch-sandbox.d.ts +0 -9
- package/dist/watch-sandbox.js +0 -81
package/dist/registry/manager.js
CHANGED
|
@@ -7,9 +7,8 @@
|
|
|
7
7
|
* container is started with `--rm` and all state lives under
|
|
8
8
|
* `.ory-dev/registry/` on the host, bind-mounted into the container.
|
|
9
9
|
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
* idempotent start, removal via `docker rm -f`.
|
|
10
|
+
* Uses one detached, auto-removed container with idempotent startup and
|
|
11
|
+
* removal via `docker rm -f`.
|
|
13
12
|
*/
|
|
14
13
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
15
14
|
if (k2 === undefined) k2 = k;
|
|
@@ -46,14 +45,12 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
46
45
|
})();
|
|
47
46
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
48
47
|
exports.getLocalRegistryNpmCacheDir = getLocalRegistryNpmCacheDir;
|
|
49
|
-
exports.getLauncherNpmrcPath = getLauncherNpmrcPath;
|
|
50
|
-
exports.ensureLauncherNpmrc = ensureLauncherNpmrc;
|
|
51
48
|
exports.ensureRegistryRunning = ensureRegistryRunning;
|
|
52
|
-
exports.publishHarnessToLocal = publishHarnessToLocal;
|
|
53
49
|
exports.registryStart = registryStart;
|
|
54
50
|
exports.registryStop = registryStop;
|
|
55
51
|
exports.registryStatus = registryStatus;
|
|
56
52
|
exports.registryPublish = registryPublish;
|
|
53
|
+
exports.registryDev = registryDev;
|
|
57
54
|
exports.registryClean = registryClean;
|
|
58
55
|
exports.registryNpmrc = registryNpmrc;
|
|
59
56
|
const fs = __importStar(require("node:fs"));
|
|
@@ -86,29 +83,15 @@ function getRegistryDir() {
|
|
|
86
83
|
function getLocalRegistryNpmCacheDir() {
|
|
87
84
|
return path.join(getRegistryDir(), "npm-cache");
|
|
88
85
|
}
|
|
89
|
-
/**
|
|
90
|
-
* Path to the userconfig npmrc the dev launcher hands to its subprocesses.
|
|
91
|
-
* See `launcherNpmrcContent` in `./config.ts` for why this exists.
|
|
92
|
-
*/
|
|
93
|
-
function getLauncherNpmrcPath() {
|
|
94
|
-
return path.join(getRegistryDir(), "launcher.npmrc");
|
|
95
|
-
}
|
|
96
|
-
/**
|
|
97
|
-
* Materialize the launcher userconfig npmrc on disk and return its path.
|
|
98
|
-
* Idempotent: rewrites the file every call so any drift in the rendered
|
|
99
|
-
* content (e.g. registry URL change) lands without a clean-and-restart.
|
|
100
|
-
*/
|
|
101
|
-
function ensureLauncherNpmrc() {
|
|
102
|
-
const npmrcPath = getLauncherNpmrcPath();
|
|
103
|
-
ensureDir(path.dirname(npmrcPath));
|
|
104
|
-
fs.writeFileSync(npmrcPath, (0, config_js_1.launcherNpmrcContent)());
|
|
105
|
-
return npmrcPath;
|
|
106
|
-
}
|
|
107
86
|
function ensureDir(dir) {
|
|
108
87
|
if (!fs.existsSync(dir)) {
|
|
109
88
|
fs.mkdirSync(dir, { recursive: true });
|
|
110
89
|
}
|
|
111
90
|
}
|
|
91
|
+
function writeRegistryNpmrc(registryDir) {
|
|
92
|
+
ensureDir(registryDir);
|
|
93
|
+
fs.writeFileSync(path.join(registryDir, ".npmrc"), (0, config_js_1.npmrcContent)());
|
|
94
|
+
}
|
|
112
95
|
function listWorkspaceScopedPackages(workspaceRoot) {
|
|
113
96
|
return listWorkspaceScopedPackageJsons(workspaceRoot)
|
|
114
97
|
.map((file) => readPackageName(file))
|
|
@@ -139,32 +122,72 @@ function readPackageName(pkgJsonPath) {
|
|
|
139
122
|
}
|
|
140
123
|
}
|
|
141
124
|
/**
|
|
142
|
-
*
|
|
143
|
-
*
|
|
125
|
+
* Compute a unique local-dev version for a publish run: the base version's
|
|
126
|
+
* `major.minor.patch` with a `-dev.<timestamp>` prerelease suffix (e.g.
|
|
127
|
+
* `0.13.9-dev.1721710000000`). All `@ory/*` packages share one version (the
|
|
128
|
+
* changesets `fixed` group), so we read the base from the first package and
|
|
129
|
+
* stamp the same value onto every package — keeping `workspace:*` cross-deps
|
|
130
|
+
* resolvable to the just-published version.
|
|
131
|
+
*
|
|
132
|
+
* Why a fresh version every publish: `npx`/pacote cache installed trees and
|
|
133
|
+
* tarballs by `name@version`. Republishing the *same* version over a rebuilt
|
|
134
|
+
* tarball lets a client's `~/.npm/_npx` or `_cacache` serve stale bytes even
|
|
135
|
+
* after Verdaccio has the fresh code. A new version each run guarantees a
|
|
136
|
+
* cache miss so `@latest` always resolves to what we just built.
|
|
137
|
+
*/
|
|
138
|
+
function makeLocalDevVersion(pkgJsonFiles, stamp) {
|
|
139
|
+
let base = "0.0.0";
|
|
140
|
+
for (const file of pkgJsonFiles) {
|
|
141
|
+
try {
|
|
142
|
+
const v = JSON.parse(fs.readFileSync(file, "utf-8")).version;
|
|
143
|
+
if (v) {
|
|
144
|
+
base = v;
|
|
145
|
+
break;
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
catch {
|
|
149
|
+
// ignore unreadable package.json; fall back to the next one
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
// Strip any existing prerelease/build suffix so we don't stack `-dev` tags.
|
|
153
|
+
const core = base.split(/[-+]/)[0];
|
|
154
|
+
return `${core}-dev.${stamp}`;
|
|
155
|
+
}
|
|
156
|
+
/**
|
|
157
|
+
* Prepare every `@ory/*` package.json for a local publish for the duration of
|
|
158
|
+
* `fn`, then restore each file exactly as it was. Two transforms are applied:
|
|
159
|
+
*
|
|
160
|
+
* 1. **Strip `publishConfig.registry` / `publishConfig.provenance`.** The OIDC
|
|
161
|
+
* trusted-publishing release workflow pins each package's
|
|
162
|
+
* `publishConfig.registry` to `https://registry.npmjs.org/` with
|
|
163
|
+
* `provenance: true`. `publishConfig` overrides both the `--registry` CLI
|
|
164
|
+
* flag and the `npm_config_registry` env var, so without this transform a
|
|
165
|
+
* local publish still targets real npmjs.org and fails with `E404
|
|
166
|
+
* undefined` (no auth) / provenance errors.
|
|
144
167
|
*
|
|
145
|
-
*
|
|
146
|
-
*
|
|
147
|
-
*
|
|
148
|
-
*
|
|
149
|
-
*
|
|
150
|
-
*
|
|
151
|
-
* provenance errors. We unset the two fields only on disk for the publish
|
|
152
|
-
* call, then put the files back exactly as they were so the CI release
|
|
153
|
-
* workflow keeps working.
|
|
168
|
+
* 2. **Stamp a unique `-dev.<timestamp>` version** (see
|
|
169
|
+
* {@link makeLocalDevVersion}) so `@latest` changes on every publish and
|
|
170
|
+
* clients can't serve a stale cached tarball for a version we already used.
|
|
171
|
+
*
|
|
172
|
+
* Both are on-disk only for the publish call; the files are put back exactly as
|
|
173
|
+
* they were so the CI release workflow (and git) keep working.
|
|
154
174
|
*/
|
|
155
175
|
async function withLocalPublishConfig(workspaceRoot, fn) {
|
|
156
176
|
const files = listWorkspaceScopedPackageJsons(workspaceRoot);
|
|
177
|
+
const stamp = Date.now();
|
|
178
|
+
const devVersion = makeLocalDevVersion(files, stamp);
|
|
157
179
|
const backups = new Map();
|
|
158
180
|
for (const file of files) {
|
|
159
181
|
const original = fs.readFileSync(file, "utf-8");
|
|
160
182
|
const pkg = JSON.parse(original);
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
183
|
+
const next = { ...pkg, version: devVersion };
|
|
184
|
+
if (pkg.publishConfig) {
|
|
185
|
+
const stripped = { ...pkg.publishConfig };
|
|
186
|
+
delete stripped.registry;
|
|
187
|
+
delete stripped.provenance;
|
|
188
|
+
next.publishConfig = stripped;
|
|
189
|
+
}
|
|
166
190
|
backups.set(file, original);
|
|
167
|
-
const next = { ...pkg, publishConfig: stripped };
|
|
168
191
|
fs.writeFileSync(file, JSON.stringify(next, null, 2) + "\n");
|
|
169
192
|
}
|
|
170
193
|
const restore = () => {
|
|
@@ -372,9 +395,10 @@ async function ensureConfigInSync(quiet) {
|
|
|
372
395
|
* Start the local registry if it isn't already running.
|
|
373
396
|
*/
|
|
374
397
|
async function ensureRegistryRunning() {
|
|
375
|
-
if (isRegistryRunning())
|
|
376
|
-
|
|
377
|
-
|
|
398
|
+
if (!isRegistryRunning()) {
|
|
399
|
+
await registryStart();
|
|
400
|
+
}
|
|
401
|
+
writeRegistryNpmrc(getRegistryDir());
|
|
378
402
|
}
|
|
379
403
|
/**
|
|
380
404
|
* Env vars stripped before invoking the per-package publish, mirroring the
|
|
@@ -461,7 +485,7 @@ async function publishAllOryToLocal(opts = {}) {
|
|
|
461
485
|
const { name, version } = readPackageNameVersion(pkgJsonPath);
|
|
462
486
|
const pkgName = name ?? path.basename(pkgDir);
|
|
463
487
|
if (!opts.quiet) {
|
|
464
|
-
console.log(`Publishing ${pkgName}...`);
|
|
488
|
+
console.log(`Publishing ${pkgName}@${version}...`);
|
|
465
489
|
}
|
|
466
490
|
const packResult = (0, node_child_process_1.spawnSync)("pnpm", ["pack", "--pack-destination", packDir], {
|
|
467
491
|
cwd: pkgDir,
|
|
@@ -495,6 +519,10 @@ async function publishAllOryToLocal(opts = {}) {
|
|
|
495
519
|
config_js_1.REGISTRY_URL,
|
|
496
520
|
...scopeRegistryArg,
|
|
497
521
|
"--access=public",
|
|
522
|
+
// Explicit so a `-dev.<ts>` prerelease still becomes `@latest` in the
|
|
523
|
+
// local registry (some npm versions won't auto-tag prereleases).
|
|
524
|
+
"--tag",
|
|
525
|
+
"latest",
|
|
498
526
|
], {
|
|
499
527
|
cwd: pkgDir,
|
|
500
528
|
stdio: opts.quiet ? "pipe" : "inherit",
|
|
@@ -553,20 +581,12 @@ function emitCapturedOutput(quiet, label, result) {
|
|
|
553
581
|
function stripScheme(url) {
|
|
554
582
|
return url.replace(/^https?:\/\//, "");
|
|
555
583
|
}
|
|
556
|
-
/**
|
|
557
|
-
* Publish all `@ory/*` packages to the local registry — entrypoint used by
|
|
558
|
-
* the dev launcher. The `harnessName` arg is retained for call-site
|
|
559
|
-
* compatibility; we publish the whole scope every time so any harness gets
|
|
560
|
-
* a coherent registry state without needing to compute its dep closure.
|
|
561
|
-
*/
|
|
562
|
-
async function publishHarnessToLocal(_harnessName) {
|
|
563
|
-
await publishAllOryToLocal({ quiet: true });
|
|
564
|
-
}
|
|
565
584
|
// ─── Commands ──────────────────────────────────────────────────────
|
|
566
585
|
async function registryStart() {
|
|
567
586
|
const registryDir = getRegistryDir();
|
|
568
587
|
const storageDir = path.join(registryDir, "storage");
|
|
569
588
|
if (isRegistryRunning()) {
|
|
589
|
+
writeRegistryNpmrc(registryDir);
|
|
570
590
|
console.log(`Local registry is already running (container ${config_js_1.REGISTRY_CONTAINER}).`);
|
|
571
591
|
console.log(` URL: ${config_js_1.REGISTRY_URL}`);
|
|
572
592
|
return;
|
|
@@ -598,7 +618,7 @@ async function registryStart() {
|
|
|
598
618
|
const configPath = path.join(registryDir, "config.yaml");
|
|
599
619
|
fs.writeFileSync(configPath, (0, config_js_1.verdaccioConfigYaml)());
|
|
600
620
|
// .npmrc is consumed by host-side npm/pnpm tooling, not by the container.
|
|
601
|
-
|
|
621
|
+
writeRegistryNpmrc(registryDir);
|
|
602
622
|
// Stale --rm container could only exist if Docker died mid-run; clean it up
|
|
603
623
|
// so the new `docker run --rm` doesn't collide on the container name.
|
|
604
624
|
const state = inspectContainer(config_js_1.REGISTRY_CONTAINER);
|
|
@@ -754,6 +774,14 @@ async function registryPublish() {
|
|
|
754
774
|
console.log("");
|
|
755
775
|
console.log("Published.");
|
|
756
776
|
}
|
|
777
|
+
/** Start the local registry and publish a coherent development package set. */
|
|
778
|
+
async function registryDev() {
|
|
779
|
+
await ensureRegistryRunning();
|
|
780
|
+
await registryPublish();
|
|
781
|
+
console.log("");
|
|
782
|
+
console.log(`Plugin packages are available from ${config_js_1.REGISTRY_URL} at the latest tag.`);
|
|
783
|
+
console.log("Local Lite and Ory Agent Security are expected to be running separately.");
|
|
784
|
+
}
|
|
757
785
|
async function registryClean() {
|
|
758
786
|
// Stop first if running
|
|
759
787
|
await registryStop();
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
/** The broker header a runtime credential must occupy for a request. */
|
|
2
|
+
export type RuntimeAuthorizationHeader = "authorization" | "x-ory-agent-authorization";
|
|
3
|
+
export interface RuntimeAuthenticatedRequest {
|
|
4
|
+
url: string;
|
|
5
|
+
init: RequestInit;
|
|
6
|
+
authorizationHeader: RuntimeAuthorizationHeader;
|
|
7
|
+
/** Default transport. An mTLS authenticator may ignore this and use its own transport. */
|
|
8
|
+
fetch: typeof fetch;
|
|
9
|
+
/** Whether `fetch` is the core's default transport rather than an injected implementation. */
|
|
10
|
+
usesDefaultFetch?: boolean;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Executes one noninteractive Agent Security request. Custom Agent SDK
|
|
14
|
+
* integrations can use this hook to attach a SPIFFE workload identity and run
|
|
15
|
+
* the request over mTLS without exposing key material to Argus.
|
|
16
|
+
*/
|
|
17
|
+
export type RuntimeRequestAuthenticator = (request: RuntimeAuthenticatedRequest) => Promise<Response>;
|
|
18
|
+
export type RuntimeCredentialKind = "talos" | "injected";
|
|
19
|
+
export interface RuntimeCredential {
|
|
20
|
+
kind: RuntimeCredentialKind;
|
|
21
|
+
subject?: string;
|
|
22
|
+
authenticate: RuntimeRequestAuthenticator;
|
|
23
|
+
}
|
|
24
|
+
export interface ResolveRuntimeCredentialOptions {
|
|
25
|
+
env?: NodeJS.ProcessEnv;
|
|
26
|
+
requestAuthenticator?: RuntimeRequestAuthenticator;
|
|
27
|
+
subject?: string;
|
|
28
|
+
fetch?: typeof fetch;
|
|
29
|
+
}
|
|
30
|
+
export interface EnrollTalosRuntimeCredentialOptions {
|
|
31
|
+
projectUrl: string;
|
|
32
|
+
agentSecurityUrl: string;
|
|
33
|
+
userToken: string;
|
|
34
|
+
name: string;
|
|
35
|
+
idempotencyKey: string;
|
|
36
|
+
fetch?: typeof fetch;
|
|
37
|
+
signal?: AbortSignal;
|
|
38
|
+
credentialStore?: TalosCredentialStore;
|
|
39
|
+
identity?: TalosCredentialIdentity;
|
|
40
|
+
/** @internal Injectable seam for testing default-fetch TLS setup. */
|
|
41
|
+
configureSystemCaTrust?: () => void;
|
|
42
|
+
}
|
|
43
|
+
export interface EnrolledRuntimeCredential {
|
|
44
|
+
credential: RuntimeCredential;
|
|
45
|
+
actorId: string;
|
|
46
|
+
warnings: string[];
|
|
47
|
+
}
|
|
48
|
+
export type TalosCredentialIdentity = {
|
|
49
|
+
projectUrl: string;
|
|
50
|
+
harness: string;
|
|
51
|
+
sessionId: string;
|
|
52
|
+
kind: "agent";
|
|
53
|
+
} | {
|
|
54
|
+
projectUrl: string;
|
|
55
|
+
harness: string;
|
|
56
|
+
sessionId: string;
|
|
57
|
+
kind: "subagent";
|
|
58
|
+
subAgentType: string;
|
|
59
|
+
perSpawnId: string;
|
|
60
|
+
};
|
|
61
|
+
export interface StoredTalosCredentialV2 {
|
|
62
|
+
version: 2;
|
|
63
|
+
credential: string;
|
|
64
|
+
actorId: string;
|
|
65
|
+
credentialId?: string;
|
|
66
|
+
expiresAt?: string;
|
|
67
|
+
identity: TalosCredentialIdentity;
|
|
68
|
+
}
|
|
69
|
+
export interface StoredTalosCredentialV1 {
|
|
70
|
+
version: 1;
|
|
71
|
+
credential: string;
|
|
72
|
+
actorId: string;
|
|
73
|
+
}
|
|
74
|
+
export type StoredTalosCredential = StoredTalosCredentialV1 | StoredTalosCredentialV2;
|
|
75
|
+
export type TalosCredentialStoreIdentity = TalosCredentialIdentity | string;
|
|
76
|
+
export interface TalosCredentialStore {
|
|
77
|
+
load(identity: TalosCredentialStoreIdentity): Promise<StoredTalosCredential | undefined>;
|
|
78
|
+
save(identity: TalosCredentialStoreIdentity, secret: StoredTalosCredential): Promise<void>;
|
|
79
|
+
}
|
|
80
|
+
export interface CredentialStoreCommandOptions {
|
|
81
|
+
input?: string;
|
|
82
|
+
}
|
|
83
|
+
export type CredentialStoreCommandRunner = (command: string, args: string[], options?: CredentialStoreCommandOptions) => Promise<{
|
|
84
|
+
stdout: string;
|
|
85
|
+
}>;
|
|
86
|
+
export interface OsTalosCredentialStoreOptions {
|
|
87
|
+
platform?: NodeJS.Platform;
|
|
88
|
+
runCommand?: CredentialStoreCommandRunner;
|
|
89
|
+
}
|
|
90
|
+
export interface NodeTlsCaProvider {
|
|
91
|
+
getCACertificates?: (type?: "default" | "system" | "bundled" | "extra") => string[];
|
|
92
|
+
setDefaultCACertificates?: (certificates: ReadonlyArray<string | NodeJS.ArrayBufferView>) => void;
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* Make subsequent default Node TLS connections trust both Node's existing CA
|
|
96
|
+
* set and the operating system trust store. This is process-local and does not
|
|
97
|
+
* disable certificate verification.
|
|
98
|
+
*/
|
|
99
|
+
export declare function configureSystemCaTrustForDefaultFetch(provider?: NodeTlsCaProvider): boolean;
|
|
100
|
+
export declare class CredentialStoreCommandError extends Error {
|
|
101
|
+
readonly exitCode?: number | undefined;
|
|
102
|
+
readonly causeCode?: string | undefined;
|
|
103
|
+
constructor(message: string, exitCode?: number | undefined, causeCode?: string | undefined);
|
|
104
|
+
}
|
|
105
|
+
export declare const runCredentialStoreCommand: CredentialStoreCommandRunner;
|
|
106
|
+
/** Normalize equivalent project URLs before deriving their credential-store key. */
|
|
107
|
+
export declare function canonicalProjectUrl(projectUrl: string): string;
|
|
108
|
+
export declare function canonicalCredentialIdentity(identity: TalosCredentialStoreIdentity): TalosCredentialIdentity;
|
|
109
|
+
export declare function credentialAccount(identity: TalosCredentialStoreIdentity): string;
|
|
110
|
+
/** OS-backed Talos store. Secrets are never placed in process arguments. */
|
|
111
|
+
export declare function createOsTalosCredentialStore(options?: OsTalosCredentialStoreOptions): TalosCredentialStore;
|
|
112
|
+
export declare function talosRuntimeCredential(apiKey: string, options?: {
|
|
113
|
+
subject?: string;
|
|
114
|
+
fetch?: typeof fetch;
|
|
115
|
+
/** @internal Injectable seam for testing default-fetch TLS setup. */
|
|
116
|
+
configureSystemCaTrust?: () => void;
|
|
117
|
+
}): RuntimeCredential;
|
|
118
|
+
/** Resolve only noninteractive runtime credentials. No persisted state is read. */
|
|
119
|
+
export declare function resolveRuntimeCredential(options?: ResolveRuntimeCredentialOptions): RuntimeCredential | undefined;
|
|
120
|
+
/** Explicitly enroll a Talos credential and optionally persist it in an OS store. */
|
|
121
|
+
export declare function enrollTalosRuntimeCredential(options: EnrollTalosRuntimeCredentialOptions): Promise<EnrolledRuntimeCredential>;
|
|
122
|
+
export interface EnrollTalosChildRuntimeCredentialOptions {
|
|
123
|
+
projectUrl: string;
|
|
124
|
+
agentSecurityUrl: string;
|
|
125
|
+
name: string;
|
|
126
|
+
subAgentType: string;
|
|
127
|
+
idempotencyKey: string;
|
|
128
|
+
parentCredential: RuntimeCredential;
|
|
129
|
+
identity: Extract<TalosCredentialIdentity, {
|
|
130
|
+
kind: "subagent";
|
|
131
|
+
}>;
|
|
132
|
+
fetch?: typeof fetch;
|
|
133
|
+
signal?: AbortSignal;
|
|
134
|
+
credentialStore?: TalosCredentialStore;
|
|
135
|
+
}
|
|
136
|
+
/** Enroll a separately keyed child using the authenticated parent runtime. */
|
|
137
|
+
export declare function enrollTalosChildRuntimeCredential(options: EnrollTalosChildRuntimeCredentialOptions): Promise<EnrolledRuntimeCredential>;
|
|
138
|
+
export declare function authenticatedRuntimeRequest(credential: RuntimeCredential, request: Omit<RuntimeAuthenticatedRequest, "fetch" | "usesDefaultFetch"> & {
|
|
139
|
+
fetch?: typeof fetch;
|
|
140
|
+
}): Promise<Response>;
|