duckhunt-runner 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/README.md +376 -16
- package/dist/announced-capabilities.d.ts +2 -0
- package/dist/announced-capabilities.d.ts.map +1 -1
- package/dist/announced-capabilities.js +6 -0
- package/dist/announced-capabilities.js.map +1 -1
- package/dist/audit-cli.d.ts +7 -0
- package/dist/audit-cli.d.ts.map +1 -0
- package/dist/audit-cli.js +84 -0
- package/dist/audit-cli.js.map +1 -0
- package/dist/audit.d.ts +163 -0
- package/dist/audit.d.ts.map +1 -0
- package/dist/audit.js +286 -0
- package/dist/audit.js.map +1 -0
- package/dist/aws.d.ts +10 -1
- package/dist/aws.d.ts.map +1 -1
- package/dist/aws.js +35 -9
- package/dist/aws.js.map +1 -1
- package/dist/browser-cli.d.ts +9 -0
- package/dist/browser-cli.d.ts.map +1 -0
- package/dist/browser-cli.js +200 -0
- package/dist/browser-cli.js.map +1 -0
- package/dist/claim.d.ts +44 -28
- package/dist/claim.d.ts.map +1 -1
- package/dist/claim.js +106 -85
- package/dist/claim.js.map +1 -1
- package/dist/claude.d.ts +1 -0
- package/dist/claude.d.ts.map +1 -1
- package/dist/claude.js +9 -3
- package/dist/claude.js.map +1 -1
- package/dist/config-legacy.d.ts +20 -0
- package/dist/config-legacy.d.ts.map +1 -0
- package/dist/config-legacy.js +253 -0
- package/dist/config-legacy.js.map +1 -0
- package/dist/config.d.ts +38 -9
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +42 -26
- package/dist/config.js.map +1 -1
- package/dist/daemon.d.ts +80 -20
- package/dist/daemon.d.ts.map +1 -1
- package/dist/daemon.js +866 -420
- package/dist/daemon.js.map +1 -1
- package/dist/feed.d.ts +5 -1
- package/dist/feed.d.ts.map +1 -1
- package/dist/feed.js +78 -13
- package/dist/feed.js.map +1 -1
- package/dist/index.js +64 -4
- package/dist/index.js.map +1 -1
- package/dist/local/mcp.d.ts +93 -0
- package/dist/local/mcp.d.ts.map +1 -0
- package/dist/local/mcp.js +170 -0
- package/dist/local/mcp.js.map +1 -0
- package/dist/local/policy.d.ts +39 -0
- package/dist/local/policy.d.ts.map +1 -0
- package/dist/local/policy.js +88 -0
- package/dist/local/policy.js.map +1 -0
- package/dist/local/socket.d.ts +68 -0
- package/dist/local/socket.d.ts.map +1 -0
- package/dist/local/socket.js +140 -0
- package/dist/local/socket.js.map +1 -0
- package/dist/local/store.d.ts +75 -0
- package/dist/local/store.d.ts.map +1 -0
- package/dist/local/store.js +110 -0
- package/dist/local/store.js.map +1 -0
- package/dist/logout.d.ts +10 -11
- package/dist/logout.d.ts.map +1 -1
- package/dist/logout.js +63 -34
- package/dist/logout.js.map +1 -1
- package/dist/machine.d.ts +4 -0
- package/dist/machine.d.ts.map +1 -1
- package/dist/machine.js +35 -0
- package/dist/machine.js.map +1 -1
- package/dist/mcp-stdio.d.ts +19 -0
- package/dist/mcp-stdio.d.ts.map +1 -0
- package/dist/mcp-stdio.js +65 -0
- package/dist/mcp-stdio.js.map +1 -0
- package/dist/oauth.d.ts +31 -3
- package/dist/oauth.d.ts.map +1 -1
- package/dist/oauth.js +64 -31
- package/dist/oauth.js.map +1 -1
- package/dist/paths.d.ts +43 -0
- package/dist/paths.d.ts.map +1 -0
- package/dist/paths.js +136 -0
- package/dist/paths.js.map +1 -0
- package/dist/platform-login.d.ts +19 -0
- package/dist/platform-login.d.ts.map +1 -0
- package/dist/platform-login.js +178 -0
- package/dist/platform-login.js.map +1 -0
- package/dist/platforms/claim-v0.d.ts +44 -0
- package/dist/platforms/claim-v0.d.ts.map +1 -0
- package/dist/platforms/claim-v0.js +243 -0
- package/dist/platforms/claim-v0.js.map +1 -0
- package/dist/platforms/credentials.d.ts +15 -0
- package/dist/platforms/credentials.d.ts.map +1 -0
- package/dist/platforms/credentials.js +40 -0
- package/dist/platforms/credentials.js.map +1 -0
- package/dist/platforms/discovery.d.ts +30 -0
- package/dist/platforms/discovery.d.ts.map +1 -0
- package/dist/platforms/discovery.js +91 -0
- package/dist/platforms/discovery.js.map +1 -0
- package/dist/platforms/duckhunt42.d.ts +33 -0
- package/dist/platforms/duckhunt42.d.ts.map +1 -0
- package/dist/platforms/duckhunt42.js +231 -0
- package/dist/platforms/duckhunt42.js.map +1 -0
- package/dist/platforms/factories.d.ts +3 -0
- package/dist/platforms/factories.d.ts.map +1 -0
- package/dist/platforms/factories.js +10 -0
- package/dist/platforms/factories.js.map +1 -0
- package/dist/platforms/http-transport.d.ts +29 -0
- package/dist/platforms/http-transport.d.ts.map +1 -0
- package/dist/platforms/http-transport.js +88 -0
- package/dist/platforms/http-transport.js.map +1 -0
- package/dist/platforms/local.d.ts +79 -0
- package/dist/platforms/local.d.ts.map +1 -0
- package/dist/platforms/local.js +302 -0
- package/dist/platforms/local.js.map +1 -0
- package/dist/platforms/origin.d.ts +12 -0
- package/dist/platforms/origin.d.ts.map +1 -0
- package/dist/platforms/origin.js +32 -0
- package/dist/platforms/origin.js.map +1 -0
- package/dist/platforms/platform.d.ts +133 -0
- package/dist/platforms/platform.d.ts.map +1 -0
- package/dist/platforms/platform.js +30 -0
- package/dist/platforms/platform.js.map +1 -0
- package/dist/platforms/scheduler.d.ts +32 -0
- package/dist/platforms/scheduler.d.ts.map +1 -0
- package/dist/platforms/scheduler.js +76 -0
- package/dist/platforms/scheduler.js.map +1 -0
- package/dist/platforms/supervisor.d.ts +45 -0
- package/dist/platforms/supervisor.d.ts.map +1 -0
- package/dist/platforms/supervisor.js +112 -0
- package/dist/platforms/supervisor.js.map +1 -0
- package/dist/platforms/types.d.ts +50 -0
- package/dist/platforms/types.d.ts.map +1 -0
- package/dist/platforms/types.js +69 -0
- package/dist/platforms/types.js.map +1 -0
- package/dist/platforms/v0.d.ts +41 -0
- package/dist/platforms/v0.d.ts.map +1 -0
- package/dist/platforms/v0.js +301 -0
- package/dist/platforms/v0.js.map +1 -0
- package/dist/platforms-cli.d.ts +5 -0
- package/dist/platforms-cli.d.ts.map +1 -0
- package/dist/platforms-cli.js +163 -0
- package/dist/platforms-cli.js.map +1 -0
- package/dist/read-shell-guard.d.ts.map +1 -1
- package/dist/read-shell-guard.js +4 -3
- package/dist/read-shell-guard.js.map +1 -1
- package/dist/repo-commands.js +2 -2
- package/dist/repo-commands.js.map +1 -1
- package/dist/repo-key.js +1 -1
- package/dist/repo-key.js.map +1 -1
- package/dist/repos.js +2 -2
- package/dist/repos.js.map +1 -1
- package/dist/resource.d.ts +2 -0
- package/dist/resource.d.ts.map +1 -0
- package/dist/resource.js +91 -0
- package/dist/resource.js.map +1 -0
- package/dist/resources/aws.d.ts +36 -0
- package/dist/resources/aws.d.ts.map +1 -0
- package/dist/resources/aws.js +160 -0
- package/dist/resources/aws.js.map +1 -0
- package/dist/resources/browser/config.d.ts +33 -0
- package/dist/resources/browser/config.d.ts.map +1 -0
- package/dist/resources/browser/config.js +86 -0
- package/dist/resources/browser/config.js.map +1 -0
- package/dist/resources/browser/health.d.ts +48 -0
- package/dist/resources/browser/health.d.ts.map +1 -0
- package/dist/resources/browser/health.js +100 -0
- package/dist/resources/browser/health.js.map +1 -0
- package/dist/resources/browser/odysea-cli.d.ts +41 -0
- package/dist/resources/browser/odysea-cli.d.ts.map +1 -0
- package/dist/resources/browser/odysea-cli.js +122 -0
- package/dist/resources/browser/odysea-cli.js.map +1 -0
- package/dist/resources/browser/origins.d.ts +17 -0
- package/dist/resources/browser/origins.d.ts.map +1 -0
- package/dist/resources/browser/origins.js +72 -0
- package/dist/resources/browser/origins.js.map +1 -0
- package/dist/resources/browser/provider.d.ts +49 -0
- package/dist/resources/browser/provider.d.ts.map +1 -0
- package/dist/resources/browser/provider.js +166 -0
- package/dist/resources/browser/provider.js.map +1 -0
- package/dist/resources/browser/state-filter.d.ts +28 -0
- package/dist/resources/browser/state-filter.d.ts.map +1 -0
- package/dist/resources/browser/state-filter.js +61 -0
- package/dist/resources/browser/state-filter.js.map +1 -0
- package/dist/resources/legacy.d.ts +13 -0
- package/dist/resources/legacy.d.ts.map +1 -0
- package/dist/resources/legacy.js +46 -0
- package/dist/resources/legacy.js.map +1 -0
- package/dist/resources/lifecycle.d.ts +48 -0
- package/dist/resources/lifecycle.d.ts.map +1 -0
- package/dist/resources/lifecycle.js +137 -0
- package/dist/resources/lifecycle.js.map +1 -0
- package/dist/resources/registry.d.ts +20 -0
- package/dist/resources/registry.d.ts.map +1 -0
- package/dist/resources/registry.js +37 -0
- package/dist/resources/registry.js.map +1 -0
- package/dist/{conversation-gc.d.ts → resources/repo/gc.d.ts} +6 -6
- package/dist/resources/repo/gc.d.ts.map +1 -0
- package/dist/{conversation-gc.js → resources/repo/gc.js} +16 -13
- package/dist/resources/repo/gc.js.map +1 -0
- package/dist/{repo-health.d.ts → resources/repo/health.d.ts} +4 -2
- package/dist/resources/repo/health.d.ts.map +1 -0
- package/dist/{repo-health.js → resources/repo/health.js} +14 -9
- package/dist/resources/repo/health.js.map +1 -0
- package/dist/resources/repo/provider.d.ts +14 -0
- package/dist/resources/repo/provider.d.ts.map +1 -0
- package/dist/resources/repo/provider.js +75 -0
- package/dist/resources/repo/provider.js.map +1 -0
- package/dist/{worktree.d.ts → resources/repo/worktree.d.ts} +3 -5
- package/dist/resources/repo/worktree.d.ts.map +1 -0
- package/dist/{worktree.js → resources/repo/worktree.js} +24 -27
- package/dist/resources/repo/worktree.js.map +1 -0
- package/dist/resources/s3-read.d.ts +29 -0
- package/dist/resources/s3-read.d.ts.map +1 -0
- package/dist/resources/s3-read.js +68 -0
- package/dist/resources/s3-read.js.map +1 -0
- package/dist/resources/types.d.ts +106 -0
- package/dist/resources/types.d.ts.map +1 -0
- package/dist/resources/types.js +73 -0
- package/dist/resources/types.js.map +1 -0
- package/dist/run-cli.d.ts +25 -0
- package/dist/run-cli.d.ts.map +1 -0
- package/dist/run-cli.js +432 -0
- package/dist/run-cli.js.map +1 -0
- package/dist/run-id.d.ts +10 -0
- package/dist/run-id.d.ts.map +1 -0
- package/dist/run-id.js +36 -0
- package/dist/run-id.js.map +1 -0
- package/dist/run-lease.d.ts +2 -2
- package/dist/run-mcp-config.d.ts +7 -4
- package/dist/run-mcp-config.d.ts.map +1 -1
- package/dist/run-mcp-config.js +14 -8
- package/dist/run-mcp-config.js.map +1 -1
- package/dist/s3-read-server.d.ts +22 -0
- package/dist/s3-read-server.d.ts.map +1 -0
- package/dist/s3-read-server.js +173 -0
- package/dist/s3-read-server.js.map +1 -0
- package/dist/secret-paths.d.ts +12 -0
- package/dist/secret-paths.d.ts.map +1 -1
- package/dist/secret-paths.js +82 -10
- package/dist/secret-paths.js.map +1 -1
- package/dist/server-state.d.ts +7 -9
- package/dist/server-state.d.ts.map +1 -1
- package/dist/server-state.js +14 -17
- package/dist/server-state.js.map +1 -1
- package/dist/status-report.d.ts +2 -0
- package/dist/status-report.d.ts.map +1 -1
- package/dist/status-report.js.map +1 -1
- package/dist/status.d.ts +5 -1
- package/dist/status.d.ts.map +1 -1
- package/dist/status.js +100 -6
- package/dist/status.js.map +1 -1
- package/dist/toolset/intersect.d.ts +10 -0
- package/dist/toolset/intersect.d.ts.map +1 -0
- package/dist/toolset/intersect.js +36 -0
- package/dist/toolset/intersect.js.map +1 -0
- package/dist/toolset/legacy-render.d.ts +12 -0
- package/dist/toolset/legacy-render.d.ts.map +1 -0
- package/dist/toolset/legacy-render.js +69 -0
- package/dist/toolset/legacy-render.js.map +1 -0
- package/dist/toolset/parse.d.ts +4 -0
- package/dist/toolset/parse.d.ts.map +1 -0
- package/dist/toolset/parse.js +74 -0
- package/dist/toolset/parse.js.map +1 -0
- package/dist/toolset/render.d.ts +28 -0
- package/dist/toolset/render.d.ts.map +1 -0
- package/dist/toolset/render.js +78 -0
- package/dist/toolset/render.js.map +1 -0
- package/dist/toolset/shadow.d.ts +16 -0
- package/dist/toolset/shadow.d.ts.map +1 -0
- package/dist/toolset/shadow.js +61 -0
- package/dist/toolset/shadow.js.map +1 -0
- package/dist/vendor/runner-protocol/aws.d.ts +6 -0
- package/dist/vendor/runner-protocol/aws.d.ts.map +1 -0
- package/dist/vendor/runner-protocol/aws.js +69 -0
- package/dist/vendor/runner-protocol/aws.js.map +1 -0
- package/dist/vendor/runner-protocol/capabilities.d.ts +20 -0
- package/dist/vendor/runner-protocol/capabilities.d.ts.map +1 -0
- package/dist/vendor/runner-protocol/capabilities.js +58 -0
- package/dist/vendor/runner-protocol/capabilities.js.map +1 -0
- package/dist/vendor/runner-protocol/claim.d.ts +112 -0
- package/dist/vendor/runner-protocol/claim.d.ts.map +1 -0
- package/dist/vendor/runner-protocol/claim.js +54 -0
- package/dist/vendor/runner-protocol/claim.js.map +1 -0
- package/dist/vendor/runner-protocol/errors.d.ts +17 -0
- package/dist/vendor/runner-protocol/errors.d.ts.map +1 -0
- package/dist/vendor/runner-protocol/errors.js +19 -0
- package/dist/vendor/runner-protocol/errors.js.map +1 -0
- package/dist/vendor/runner-protocol/events.d.ts +14 -0
- package/dist/vendor/runner-protocol/events.d.ts.map +1 -0
- package/dist/vendor/runner-protocol/events.js +22 -0
- package/dist/vendor/runner-protocol/events.js.map +1 -0
- package/dist/vendor/runner-protocol/index.d.ts +10 -0
- package/dist/vendor/runner-protocol/index.d.ts.map +1 -0
- package/dist/vendor/runner-protocol/index.js +24 -0
- package/dist/vendor/runner-protocol/index.js.map +1 -0
- package/dist/vendor/runner-protocol/limits.d.ts +31 -0
- package/dist/vendor/runner-protocol/limits.d.ts.map +1 -0
- package/dist/vendor/runner-protocol/limits.js +60 -0
- package/dist/vendor/runner-protocol/limits.js.map +1 -0
- package/dist/vendor/runner-protocol/resources.d.ts +35 -0
- package/dist/vendor/runner-protocol/resources.d.ts.map +1 -0
- package/dist/vendor/runner-protocol/resources.js +39 -0
- package/dist/vendor/runner-protocol/resources.js.map +1 -0
- package/dist/vendor/runner-protocol/toolset.d.ts +59 -0
- package/dist/vendor/runner-protocol/toolset.d.ts.map +1 -0
- package/dist/vendor/runner-protocol/toolset.js +50 -0
- package/dist/vendor/runner-protocol/toolset.js.map +1 -0
- package/dist/vendor/runner-protocol/v0.d.ts +277 -0
- package/dist/vendor/runner-protocol/v0.d.ts.map +1 -0
- package/dist/vendor/runner-protocol/v0.js +121 -0
- package/dist/vendor/runner-protocol/v0.js.map +1 -0
- package/package.json +3 -2
- package/dist/aws-env.d.ts +0 -21
- package/dist/aws-env.d.ts.map +0 -1
- package/dist/aws-env.js +0 -80
- package/dist/aws-env.js.map +0 -1
- package/dist/conversation-gc.d.ts.map +0 -1
- package/dist/conversation-gc.js.map +0 -1
- package/dist/repo-health.d.ts.map +0 -1
- package/dist/repo-health.js.map +0 -1
- package/dist/worktree.d.ts.map +0 -1
- package/dist/worktree.js.map +0 -1
package/dist/oauth.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"oauth.d.ts","sourceRoot":"","sources":["../src/oauth.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"oauth.d.ts","sourceRoot":"","sources":["../src/oauth.ts"],"names":[],"mappings":"AAsBA,OAAO,EAA4C,KAAK,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAG9F,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAChE,OAAO,EAAsB,KAAK,eAAe,EAAE,MAAM,4BAA4B,CAAC;AA6BtF;uGACuG;AACvG,qBAAa,uBAAwB,SAAQ,qBAAqB;gBACpD,WAAW,EAAE,MAAM;CAIhC;AAMD,MAAM,WAAW,aAAa;IAC5B,YAAY,EAAE,MAAM,CAAC;IACrB,UAAU,EAAE,MAAM,CAAC;IACnB,aAAa,EAAE,MAAM,CAAC;CACvB;AAgBD;8EAC8E;AAC9E;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG;IAAE,OAAO,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAA;CAAE,CAMlF;AAED;gCACgC;AAChC,MAAM,WAAW,cAAc;IAC7B,YAAY,EAAE,MAAM,CAAC;IACrB,aAAa,EAAE,MAAM,CAAC;IACtB,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,6EAA6E;AAC7E,eAAO,MAAM,WAAW,GAAI,MAAM,MAAM,KAAG,cAMzC,CAAC;AAEH,+FAA+F;AAC/F,eAAO,MAAM,UAAU,GAAI,MAAM,IAAI,CAAC,gBAAgB,EAAE,SAAS,GAAG,eAAe,CAAC,KAAG,MAA8D,CAAC;AAEtJ,8EAA8E;AAC9E,MAAM,MAAM,OAAO,GAAG,CAAC,MAAM,EAAE,MAAM,KAAK,OAAO,CAAC,MAAM,CAAC,CAAC;AAS1D,yHAAyH;AACzH,wBAAsB,eAAe,CAAC,EAAE,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,EAAE,GAAG,GAAE,OAAqB,GAAG,OAAO,CAAC;IAAE,QAAQ,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,aAAa,CAAA;CAAE,CAAC,CAiC9J;AAED,wBAAsB,KAAK,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAgC1E;AAED,MAAM,WAAW,WAAW;IAC1B,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,aAAa;IAC5B,MAAM,EAAE,WAAW,CAAC;IAEpB,UAAU,EAAE,gBAAgB,CAAC;IAG7B,KAAK,EAAE,OAAO,CAAC;CAChB;AAyCD;;qFAEqF;AACrF,wBAAsB,aAAa,CAAC,OAAO,EAAE,gBAAgB,EAAE,KAAK,GAAE,eAAoC,GAAG,OAAO,CAAC,aAAa,CAAC,CAelI"}
|
package/dist/oauth.js
CHANGED
|
@@ -10,16 +10,31 @@
|
|
|
10
10
|
// reemplaza (machine.ts::loginIdentity), y un rechazo del token endpoint (invalid_grant: credencial
|
|
11
11
|
// desvinculada desde duckhunt, revocada por un replay o caducada) es un CredentialRejectedError: el
|
|
12
12
|
// daemon para en vez de reintentar cada 5 s con una credencial que ya no vuelve.
|
|
13
|
+
// plataformas (t#495, M6.3): de dónde se lee y dónde se guarda la credencial es un CredentialStore
|
|
14
|
+
// (platforms/credentials.ts): la de duckhunt en las claves de siempre, la de otra plataforma en su entrada de
|
|
15
|
+
// `platforms`. cada refresh escribe solo la suya.
|
|
16
|
+
// (M6.4) el flujo (dcr + pkce + code pegado) va contra unos OAuthEndpoints: los de duckhunt, fijos bajo su base
|
|
17
|
+
// (legacyOAuth, el `login` de siempre byte a byte), o los que publica la metadata rfc 8414 de otra plataforma
|
|
18
|
+
// (platform-login.ts). el refresh usa el token endpoint de la credencial si lo trae.
|
|
13
19
|
import crypto from 'node:crypto';
|
|
14
20
|
import path from 'node:path';
|
|
15
21
|
import readline from 'node:readline/promises';
|
|
16
|
-
import { configPath, DEFAULT_BASE_URL,
|
|
22
|
+
import { configPath, DEFAULT_BASE_URL, saveConfig } from './config.js';
|
|
17
23
|
import { daemonLockHolder } from './daemon-lock.js';
|
|
18
24
|
import { loginIdentity } from './machine.js';
|
|
25
|
+
import { PlatformRejectedError } from './platforms/platform.js';
|
|
26
|
+
import { LEGACY_CREDENTIALS } from './platforms/credentials.js';
|
|
19
27
|
// path del recurso runner en el server (espejo de canonicalRunnerResourceUrl).
|
|
20
28
|
const RUNNER_RESOURCE_PATH = '/api/runner';
|
|
21
29
|
// redirect out-of-band: página del server que muestra el code para pegar.
|
|
22
30
|
const OOB_REDIRECT_PATH = '/oauth/authorized';
|
|
31
|
+
// endpoints del authorization server de duckhunt bajo su base.
|
|
32
|
+
const REGISTER_PATH = '/oauth/register';
|
|
33
|
+
const AUTHORIZE_PATH = '/oauth/authorize';
|
|
34
|
+
const TOKEN_PATH = '/oauth/token';
|
|
35
|
+
const PKCE_VERIFIER_BYTES = 32;
|
|
36
|
+
const PKCE_METHOD = 'S256';
|
|
37
|
+
const CODE_PROMPT = 'código: ';
|
|
23
38
|
// sin respuesta del token endpoint en este plazo = fallo (un refresh colgado pararía el daemon).
|
|
24
39
|
const TOKEN_TIMEOUT_MS = 30_000;
|
|
25
40
|
// error oauth (rfc 6749) con el que el token endpoint rechaza una credencial que ya no vale.
|
|
@@ -35,8 +50,9 @@ class TokenEndpointError extends Error {
|
|
|
35
50
|
this.name = 'TokenEndpointError';
|
|
36
51
|
}
|
|
37
52
|
}
|
|
38
|
-
/** el token endpoint rechazó el refresh (invalid_grant): desvinculada, revocada o caducada. no se recupera sin
|
|
39
|
-
|
|
53
|
+
/** el token endpoint rechazó el refresh (invalid_grant): desvinculada, revocada o caducada. no se recupera sin
|
|
54
|
+
* `login`. es el rechazo de la plataforma duckhunt (platforms/platform.ts::PlatformRejectedError). */
|
|
55
|
+
export class CredentialRejectedError extends PlatformRejectedError {
|
|
40
56
|
constructor(description) {
|
|
41
57
|
super(`la credencial de esta máquina ya no vale (desvinculada desde duckhunt, revocada o caducada: ${description}): vuelve a hacer \`duckhunt-runner login\``);
|
|
42
58
|
this.name = 'CredentialRejectedError';
|
|
@@ -45,8 +61,8 @@ export class CredentialRejectedError extends Error {
|
|
|
45
61
|
function b64url(buf) {
|
|
46
62
|
return buf.toString('base64url');
|
|
47
63
|
}
|
|
48
|
-
async function postToken(
|
|
49
|
-
const res = await fetch(
|
|
64
|
+
async function postToken(tokenUrl, form) {
|
|
65
|
+
const res = await fetch(tokenUrl, {
|
|
50
66
|
method: 'POST',
|
|
51
67
|
headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
|
|
52
68
|
body: new URLSearchParams(form).toString(),
|
|
@@ -72,46 +88,62 @@ export function parseLoginArgs(rest) {
|
|
|
72
88
|
}
|
|
73
89
|
return { baseUrl: /^https?:\/\//i.test(first) ? first : `https://${first}`, label: second };
|
|
74
90
|
}
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
91
|
+
/** el oauth de duckhunt: todo fijo bajo su base (el contrato de siempre). */
|
|
92
|
+
export const legacyOAuth = (base) => ({
|
|
93
|
+
registration: `${base}${REGISTER_PATH}`,
|
|
94
|
+
authorization: `${base}${AUTHORIZE_PATH}`,
|
|
95
|
+
token: `${base}${TOKEN_PATH}`,
|
|
96
|
+
redirectUri: `${base}${OOB_REDIRECT_PATH}`,
|
|
97
|
+
resource: `${base}${RUNNER_RESOURCE_PATH}`,
|
|
98
|
+
});
|
|
99
|
+
/** token endpoint de una credencial: el suyo si lo trae, el de duckhunt bajo su base si no. */
|
|
100
|
+
export const tokenUrlOf = (cred) => cred.tokenEndpoint ?? `${cred.baseUrl}${TOKEN_PATH}`;
|
|
101
|
+
const askTerminal = async (prompt) => {
|
|
102
|
+
const rl = readline.createInterface({ input: process.stdin, output: process.stdout });
|
|
103
|
+
const answer = await rl.question(prompt);
|
|
104
|
+
rl.close();
|
|
105
|
+
return answer;
|
|
106
|
+
};
|
|
107
|
+
/** dcr de cliente público + pkce S256 + code out-of-band contra `ep`: el client_id y los tokens. lanza si algo falla. */
|
|
108
|
+
export async function authorizeClient(ep, clientName, ask = askTerminal) {
|
|
109
|
+
const reg = await fetch(ep.registration, {
|
|
80
110
|
method: 'POST',
|
|
81
111
|
headers: { 'Content-Type': 'application/json' },
|
|
82
|
-
body: JSON.stringify({ client_name:
|
|
112
|
+
body: JSON.stringify({ client_name: clientName, redirect_uris: [ep.redirectUri] }),
|
|
83
113
|
});
|
|
84
114
|
const client = (await reg.json().catch(() => ({})));
|
|
85
115
|
if (!reg.ok || !client.client_id)
|
|
86
116
|
throw new Error(`dcr falló: http ${reg.status}`);
|
|
87
|
-
const verifier = b64url(crypto.randomBytes(
|
|
117
|
+
const verifier = b64url(crypto.randomBytes(PKCE_VERIFIER_BYTES));
|
|
88
118
|
const challenge = b64url(crypto.createHash('sha256').update(verifier).digest());
|
|
89
|
-
const authorizeUrl = new URL(
|
|
119
|
+
const authorizeUrl = new URL(ep.authorization);
|
|
90
120
|
authorizeUrl.searchParams.set('response_type', 'code');
|
|
91
121
|
authorizeUrl.searchParams.set('client_id', client.client_id);
|
|
92
|
-
authorizeUrl.searchParams.set('redirect_uri', redirectUri);
|
|
122
|
+
authorizeUrl.searchParams.set('redirect_uri', ep.redirectUri);
|
|
93
123
|
authorizeUrl.searchParams.set('code_challenge', challenge);
|
|
94
|
-
authorizeUrl.searchParams.set('code_challenge_method',
|
|
95
|
-
authorizeUrl.searchParams.set('resource', resource);
|
|
124
|
+
authorizeUrl.searchParams.set('code_challenge_method', PKCE_METHOD);
|
|
125
|
+
authorizeUrl.searchParams.set('resource', ep.resource);
|
|
96
126
|
console.log('\nabre esta url en tu navegador, autoriza y pega aquí el código:\n');
|
|
97
127
|
console.log(` ${authorizeUrl.toString()}\n`);
|
|
98
|
-
const
|
|
99
|
-
const code = (await rl.question('código: ')).trim();
|
|
100
|
-
rl.close();
|
|
128
|
+
const code = (await ask(CODE_PROMPT)).trim();
|
|
101
129
|
if (!code)
|
|
102
130
|
throw new Error('código vacío');
|
|
103
|
-
const tokens = await postToken(
|
|
131
|
+
const tokens = await postToken(ep.token, {
|
|
104
132
|
grant_type: 'authorization_code',
|
|
105
133
|
code,
|
|
106
134
|
code_verifier: verifier,
|
|
107
|
-
redirect_uri: redirectUri,
|
|
135
|
+
redirect_uri: ep.redirectUri,
|
|
108
136
|
client_id: client.client_id,
|
|
109
|
-
resource,
|
|
137
|
+
resource: ep.resource,
|
|
110
138
|
});
|
|
139
|
+
return { clientId: client.client_id, tokens };
|
|
140
|
+
}
|
|
141
|
+
export async function login(baseUrl, label) {
|
|
142
|
+
const base = baseUrl.replace(/\/+$/, '');
|
|
143
|
+
const { clientId, tokens } = await authorizeClient(legacyOAuth(base), `duckhunt-runner (${label ?? 'local'})`);
|
|
111
144
|
// solo la credencial, la identidad de la máquina (y la etiqueta si se pasó): mapas, defaults y lo demás
|
|
112
145
|
// del fichero se quedan. replacesClientId ausente = undefined, que el json omite (borra uno viejo).
|
|
113
146
|
const previous = {};
|
|
114
|
-
const clientId = client.client_id;
|
|
115
147
|
saveConfig((current) => {
|
|
116
148
|
previous.baseUrl = current.baseUrl;
|
|
117
149
|
const identity = loginIdentity(current, base);
|
|
@@ -138,10 +170,10 @@ export async function login(baseUrl, label) {
|
|
|
138
170
|
}
|
|
139
171
|
// credencial con la que refrescar: la del fichero si `login` cambió el cliente con el daemon en marcha
|
|
140
172
|
// y es de la misma instancia; si no, la de memoria.
|
|
141
|
-
function credentialToRefresh(current) {
|
|
173
|
+
function credentialToRefresh(current, store) {
|
|
142
174
|
let disk;
|
|
143
175
|
try {
|
|
144
|
-
disk =
|
|
176
|
+
disk = store.load();
|
|
145
177
|
}
|
|
146
178
|
catch (err) {
|
|
147
179
|
console.error(`[runner] ${err.message}: refresco con la credencial en memoria`);
|
|
@@ -159,13 +191,14 @@ function credentialToRefresh(current) {
|
|
|
159
191
|
clientId: disk.clientId,
|
|
160
192
|
refreshToken: disk.refreshToken,
|
|
161
193
|
...(disk.replacesClientId ? { replacesClientId: disk.replacesClientId } : {}),
|
|
194
|
+
...(disk.tokenEndpoint ? { tokenEndpoint: disk.tokenEndpoint } : {}),
|
|
162
195
|
};
|
|
163
196
|
}
|
|
164
197
|
// guarda el refresh token recién rotado si el fichero sigue siendo de su cliente (un `login` hecho
|
|
165
198
|
// durante el refresh gana). false = no se pudo escribir; true = guardado o ya no es de este cliente.
|
|
166
|
-
function persistRefreshToken(cred) {
|
|
199
|
+
function persistRefreshToken(cred, store) {
|
|
167
200
|
try {
|
|
168
|
-
|
|
201
|
+
store.saveRefreshToken(cred);
|
|
169
202
|
return true;
|
|
170
203
|
}
|
|
171
204
|
catch (err) {
|
|
@@ -176,9 +209,9 @@ function persistRefreshToken(cred) {
|
|
|
176
209
|
/** refresca el access token del daemon. la rotación persiste el refresh nuevo AL INSTANTE (perder el
|
|
177
210
|
* refresh rotado invalida la cadena entera), y un fallo al guardarlo no tumba el refresh: el server
|
|
178
211
|
* ya rotó, así que la credencial nueva vuelve igual y el daemon la sigue usando. */
|
|
179
|
-
export async function refreshAccess(current) {
|
|
180
|
-
const cred = credentialToRefresh(current);
|
|
181
|
-
const tokens = await postToken(cred
|
|
212
|
+
export async function refreshAccess(current, store = LEGACY_CREDENTIALS) {
|
|
213
|
+
const cred = credentialToRefresh(current, store);
|
|
214
|
+
const tokens = await postToken(tokenUrlOf(cred), {
|
|
182
215
|
grant_type: 'refresh_token',
|
|
183
216
|
refresh_token: cred.refreshToken,
|
|
184
217
|
client_id: cred.clientId,
|
|
@@ -189,7 +222,7 @@ export async function refreshAccess(current) {
|
|
|
189
222
|
return {
|
|
190
223
|
access: { token: tokens.access_token, expiresAt: Date.now() + tokens.expires_in * 1000 },
|
|
191
224
|
credential,
|
|
192
|
-
saved: persistRefreshToken(credential),
|
|
225
|
+
saved: persistRefreshToken(credential, store),
|
|
193
226
|
};
|
|
194
227
|
}
|
|
195
228
|
//# sourceMappingURL=oauth.js.map
|
package/dist/oauth.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"oauth.js","sourceRoot":"","sources":["../src/oauth.ts"],"names":[],"mappings":"AAAA,2FAA2F;AAC3F,+FAA+F;AAC/F,gGAAgG;AAChG,iCAAiC;AACjC,qGAAqG;AACrG,qGAAqG;AACrG,8FAA8F;AAC9F,qGAAqG;AACrG,yGAAyG;AACzG,oGAAoG;AACpG,oGAAoG;AACpG,iFAAiF;
|
|
1
|
+
{"version":3,"file":"oauth.js","sourceRoot":"","sources":["../src/oauth.ts"],"names":[],"mappings":"AAAA,2FAA2F;AAC3F,+FAA+F;AAC/F,gGAAgG;AAChG,iCAAiC;AACjC,qGAAqG;AACrG,qGAAqG;AACrG,8FAA8F;AAC9F,qGAAqG;AACrG,yGAAyG;AACzG,oGAAoG;AACpG,oGAAoG;AACpG,iFAAiF;AACjF,mGAAmG;AACnG,8GAA8G;AAC9G,kDAAkD;AAClD,gHAAgH;AAChH,8GAA8G;AAC9G,qFAAqF;AAErF,OAAO,MAAM,MAAM,aAAa,CAAC;AACjC,OAAO,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AK,CAAC,CAAC;IACjD,MAAM,MAAM,GAAG,MAAM,SAAS,CAAC,UAAU,CAAC,IAAI,CAAC,EAAE;QAC/C,UAAU,EAAE,eAAe;QAC3B,aAAa,EAAE,IAAI,CAAC,YAAY;QAChC,SAAS,EAAE,IAAI,CAAC,QAAQ;KACzB,CAAC,CAAC,KAAK,CAAC,CAAC,GAAY,EAAE,EAAE;QACxB,MAAM,GAAG,YAAY,kBAAkB,IAAI,GAAG,CAAC,IAAI,KAAK,aAAa,CAAC,CAAC,CAAC,IAAI,uBAAuB,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC;IAC7H,CAAC,CAAC,CAAC;IACH,MAAM,UAAU,GAAG,EAAE,GAAG,IAAI,EAAE,YAAY,EAAE,MAAM,CAAC,aAAa,EAAE,CAAC;IACnE,OAAO;QACL,MAAM,EAAE,EAAE,KAAK,EAAE,MAAM,CAAC,YAAY,EAAE,SAAS,EAAE,IAAI,CAAC,GAAG,EAAE,GAAG,MAAM,CAAC,UAAU,GAAG,IAAI,EAAE;QACxF,UAAU;QACV,KAAK,EAAE,mBAAmB,CAAC,UAAU,EAAE,KAAK,CAAC;KAC9C,CAAC;AACJ,CAAC"}
|
package/dist/paths.d.ts
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
export declare const LEGACY_PLATFORM_ID = "duckhunt";
|
|
2
|
+
export declare const LOCAL_PLATFORM_ID = "local";
|
|
3
|
+
export declare const RESERVED_PLATFORM_IDS: ReadonlySet<string>;
|
|
4
|
+
export declare const PLATFORM_ID_RE: RegExp;
|
|
5
|
+
/** directorio con todas las plataformas no legacy (<runnerHome>/platforms). */
|
|
6
|
+
export declare function platformsRoot(): string;
|
|
7
|
+
/** raíz del estado de una plataforma: runnerHome para la legacy, <runnerHome>/platforms/<id> para el resto. */
|
|
8
|
+
export declare function platformHome(platform: string): string;
|
|
9
|
+
/** ruta del scratch de una plataforma, sin crearlo (el deny del de las demás: secret-paths.ts). */
|
|
10
|
+
export declare function scratchPath(platform: string): string;
|
|
11
|
+
/** cwd FIJO de los runs sin repo de una plataforma: la auto-memory de claude code se indexa por ruta, así el
|
|
12
|
+
* conocimiento de infra (alarmas sin código) acumula entre runs, y no se mezcla con el de otra plataforma. */
|
|
13
|
+
export declare function scratchDir(platform: string): string;
|
|
14
|
+
/** logs de los runs con --verbose. */
|
|
15
|
+
export declare function logsDir(platform: string): string;
|
|
16
|
+
/** directorio 0700 de los mcp-config de los runs (run-mcp-config.ts) y de su aws vacía (resources/aws.ts). hermano
|
|
17
|
+
* del scratch: fuera de todo cwd de un run. un directorio que ya existía con otros permisos se cierra. */
|
|
18
|
+
export declare function runConfigDir(platform: string): string;
|
|
19
|
+
/** los run-config de TODAS las plataformas con estado en disco (la legacy siempre): el deny de Read de todo kit
|
|
20
|
+
* los cubre todos, así el run de una plataforma no lee los tokens per-run de otra. */
|
|
21
|
+
export declare function allRunConfigDirs(): string[];
|
|
22
|
+
/** fichero con lo último que el server de la plataforma dijo de esta máquina (server-state.ts). */
|
|
23
|
+
export declare function serverStatePath(platform: string): string;
|
|
24
|
+
/** raíz de la auditoría local de todas las plataformas (<runnerHome>/audit, audit.ts). */
|
|
25
|
+
export declare function auditRoot(): string;
|
|
26
|
+
/** ruta de la auditoría de una plataforma (<runnerHome>/audit/<id>, también la legacy), sin crearla. */
|
|
27
|
+
export declare function auditPath(platform: string): string;
|
|
28
|
+
/** directorio 0700 de la auditoría de una plataforma (se crea al pedirlo; uno que ya existía se cierra). */
|
|
29
|
+
export declare function auditDir(platform: string): string;
|
|
30
|
+
/** ruta por defecto del vault de sesiones de navegador (<runnerHome>/browser-vault), sin crearlo. */
|
|
31
|
+
export declare function defaultBrowserVaultPath(): string;
|
|
32
|
+
/** crea (o cierra a 0700) el vault de sesiones de navegador `dir` y lo devuelve. */
|
|
33
|
+
export declare function ensureBrowserVault(dir: string): string;
|
|
34
|
+
/** directorio de los worktrees de una plataforma dentro de un checkout. */
|
|
35
|
+
export declare function worktreesDir(repoPath: string, platform: string): string;
|
|
36
|
+
/** patrón de .git/info/exclude (anclado a la raíz del checkout) que esconde los worktrees de la plataforma. */
|
|
37
|
+
export declare function checkoutExcludePattern(platform: string): string;
|
|
38
|
+
/** entradas privadas del estado de una plataforma, relativas a su raíz (directorios con `/` final): todo salvo
|
|
39
|
+
* el scratch, que es el cwd de sus runs sin repo. lo que aún no existe también (lo escribirá). */
|
|
40
|
+
export declare const PLATFORM_PRIVATE_ENTRIES: readonly string[];
|
|
41
|
+
export declare const PLATFORM_SCRATCH_SUBDIR = "scratch";
|
|
42
|
+
export declare const PLATFORMS_DIR_NAME = "platforms";
|
|
43
|
+
//# sourceMappingURL=paths.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"paths.d.ts","sourceRoot":"","sources":["../src/paths.ts"],"names":[],"mappings":"AAkBA,eAAO,MAAM,kBAAkB,aAAa,CAAC;AAE7C,eAAO,MAAM,iBAAiB,UAAU,CAAC;AAEzC,eAAO,MAAM,qBAAqB,EAAE,WAAW,CAAC,MAAM,CAAoD,CAAC;AAC3G,eAAO,MAAM,cAAc,QAA8B,CAAC;AA4B1D,+EAA+E;AAC/E,wBAAgB,aAAa,IAAI,MAAM,CAEtC;AAED,+GAA+G;AAC/G,wBAAgB,YAAY,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAErD;AAOD,mGAAmG;AACnG,wBAAgB,WAAW,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAEpD;AAED;+GAC+G;AAC/G,wBAAgB,UAAU,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAEnD;AAED,sCAAsC;AACtC,wBAAgB,OAAO,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAEhD;AAED;2GAC2G;AAC3G,wBAAgB,YAAY,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAKrD;AAED;uFACuF;AACvF,wBAAgB,gBAAgB,IAAI,MAAM,EAAE,CAS3C;AAED,mGAAmG;AACnG,wBAAgB,eAAe,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAExD;AAED,0FAA0F;AAC1F,wBAAgB,SAAS,IAAI,MAAM,CAElC;AAED,wGAAwG;AACxG,wBAAgB,SAAS,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAElD;AAED,4GAA4G;AAC5G,wBAAgB,QAAQ,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAKjD;AAED,qGAAqG;AACrG,wBAAgB,uBAAuB,IAAI,MAAM,CAEhD;AAED,oFAAoF;AACpF,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAItD;AAED,2EAA2E;AAC3E,wBAAgB,YAAY,CAAC,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,CAIvE;AAED,+GAA+G;AAC/G,wBAAgB,sBAAsB,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAE/D;AAED;mGACmG;AACnG,eAAO,MAAM,wBAAwB,EAAE,SAAS,MAAM,EAAoE,CAAC;AAC3H,eAAO,MAAM,uBAAuB,YAAiB,CAAC;AACtD,eAAO,MAAM,kBAAkB,cAAmB,CAAC"}
|
package/dist/paths.js
ADDED
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
// rutas del runner por plataforma (t#495, M1): todo directorio o fichero que un run o su plataforma usan sale
|
|
2
|
+
// de aquí, en función del id de la plataforma. con varias plataformas cada una tiene su estado (scratch, logs,
|
|
3
|
+
// mcp-config de sus runs, lo último que dijo su server) y su espacio de worktrees dentro de cada checkout.
|
|
4
|
+
// decisiones:
|
|
5
|
+
// - LEGACY_PLATFORM_ID ('duckhunt') son las rutas EXACTAS de hoy: <runnerHome>/{scratch,run-config,logs},
|
|
6
|
+
// <runnerHome>/server-state.json y <checkout>/.duckhunt/worktrees/. una instalación existente no mueve nada.
|
|
7
|
+
// - cualquier otra plataforma vive en <runnerHome>/platforms/<id>/{scratch,run-config,logs,server-state.json}
|
|
8
|
+
// y <checkout>/.runner/worktrees/<id>/ (todas bajo un mismo .runner/, que va una vez a info/exclude).
|
|
9
|
+
// - el id es la clave local e inmutable de la plataforma (PLATFORM_ID_RE: minúsculas, dígitos y '-'): acaba
|
|
10
|
+
// en rutas, así que se valida al construirlas y uno inválido lanza.
|
|
11
|
+
// - la config, el lock del daemon y runnerHome son de la máquina, no de una plataforma: siguen en config.ts.
|
|
12
|
+
// - la auditoría local (t#495, M6.6) es de toda plataforma, la legacy incluida: <runnerHome>/audit/<id>/.
|
|
13
|
+
// - los directorios se crean al pedirlos (como antes en config.ts); run-config, 0700 aunque ya existiera.
|
|
14
|
+
import fs from 'node:fs';
|
|
15
|
+
import path from 'node:path';
|
|
16
|
+
import { runnerHome } from './config.js';
|
|
17
|
+
export const LEGACY_PLATFORM_ID = 'duckhunt';
|
|
18
|
+
// la plataforma local en proceso (`runner run`, por venir).
|
|
19
|
+
export const LOCAL_PLATFORM_ID = 'local';
|
|
20
|
+
// ids que `login --as` no da: la legacy (su `login` es el de siempre) y la local.
|
|
21
|
+
export const RESERVED_PLATFORM_IDS = new Set([LEGACY_PLATFORM_ID, LOCAL_PLATFORM_ID]);
|
|
22
|
+
export const PLATFORM_ID_RE = /^[a-z0-9][a-z0-9-]{0,31}$/;
|
|
23
|
+
const PLATFORMS_SUBDIR = 'platforms';
|
|
24
|
+
const SCRATCH_SUBDIR = 'scratch';
|
|
25
|
+
const LOGS_SUBDIR = 'logs';
|
|
26
|
+
const RUN_CONFIG_SUBDIR = 'run-config';
|
|
27
|
+
const SERVER_STATE_FILE = 'server-state.json';
|
|
28
|
+
// permisos del directorio de los mcp-config de los runs: llevan el token per-run.
|
|
29
|
+
const RUN_CONFIG_DIR_MODE = 0o700;
|
|
30
|
+
// auditoría local por plataforma (t#495, M6.6): <runnerHome>/audit/<id>/, 0700 (lleva qué corrió cada plataforma).
|
|
31
|
+
const AUDIT_SUBDIR = 'audit';
|
|
32
|
+
const AUDIT_DIR_MODE = 0o700;
|
|
33
|
+
// sesiones de navegador guardadas por defecto (t#495, M7): <runnerHome>/browser-vault/, 0700 (cookies y tokens
|
|
34
|
+
// vivos). es de la máquina, no de una plataforma: cada plataforma ve las claves que se le exponen.
|
|
35
|
+
const BROWSER_VAULT_SUBDIR = 'browser-vault';
|
|
36
|
+
const BROWSER_VAULT_DIR_MODE = 0o700;
|
|
37
|
+
// dentro de un checkout: el directorio del daemon legacy y el de toda otra plataforma.
|
|
38
|
+
const LEGACY_CHECKOUT_DIR = '.duckhunt';
|
|
39
|
+
const CHECKOUT_DIR = '.runner';
|
|
40
|
+
const WORKTREES_SUBDIR = 'worktrees';
|
|
41
|
+
function checkedId(platform) {
|
|
42
|
+
if (!PLATFORM_ID_RE.test(platform))
|
|
43
|
+
throw new Error(`id de plataforma inválido: ${JSON.stringify(platform)}`);
|
|
44
|
+
return platform;
|
|
45
|
+
}
|
|
46
|
+
const isLegacy = (platform) => checkedId(platform) === LEGACY_PLATFORM_ID;
|
|
47
|
+
/** directorio con todas las plataformas no legacy (<runnerHome>/platforms). */
|
|
48
|
+
export function platformsRoot() {
|
|
49
|
+
return path.join(runnerHome(), PLATFORMS_SUBDIR);
|
|
50
|
+
}
|
|
51
|
+
/** raíz del estado de una plataforma: runnerHome para la legacy, <runnerHome>/platforms/<id> para el resto. */
|
|
52
|
+
export function platformHome(platform) {
|
|
53
|
+
return isLegacy(platform) ? runnerHome() : path.join(platformsRoot(), platform);
|
|
54
|
+
}
|
|
55
|
+
const ensureDir = (dir) => {
|
|
56
|
+
fs.mkdirSync(dir, { recursive: true });
|
|
57
|
+
return dir;
|
|
58
|
+
};
|
|
59
|
+
/** ruta del scratch de una plataforma, sin crearlo (el deny del de las demás: secret-paths.ts). */
|
|
60
|
+
export function scratchPath(platform) {
|
|
61
|
+
return path.join(platformHome(platform), SCRATCH_SUBDIR);
|
|
62
|
+
}
|
|
63
|
+
/** cwd FIJO de los runs sin repo de una plataforma: la auto-memory de claude code se indexa por ruta, así el
|
|
64
|
+
* conocimiento de infra (alarmas sin código) acumula entre runs, y no se mezcla con el de otra plataforma. */
|
|
65
|
+
export function scratchDir(platform) {
|
|
66
|
+
return ensureDir(scratchPath(platform));
|
|
67
|
+
}
|
|
68
|
+
/** logs de los runs con --verbose. */
|
|
69
|
+
export function logsDir(platform) {
|
|
70
|
+
return ensureDir(path.join(platformHome(platform), LOGS_SUBDIR));
|
|
71
|
+
}
|
|
72
|
+
/** directorio 0700 de los mcp-config de los runs (run-mcp-config.ts) y de su aws vacía (resources/aws.ts). hermano
|
|
73
|
+
* del scratch: fuera de todo cwd de un run. un directorio que ya existía con otros permisos se cierra. */
|
|
74
|
+
export function runConfigDir(platform) {
|
|
75
|
+
const dir = path.join(platformHome(platform), RUN_CONFIG_SUBDIR);
|
|
76
|
+
fs.mkdirSync(dir, { recursive: true, mode: RUN_CONFIG_DIR_MODE });
|
|
77
|
+
fs.chmodSync(dir, RUN_CONFIG_DIR_MODE);
|
|
78
|
+
return dir;
|
|
79
|
+
}
|
|
80
|
+
/** los run-config de TODAS las plataformas con estado en disco (la legacy siempre): el deny de Read de todo kit
|
|
81
|
+
* los cubre todos, así el run de una plataforma no lee los tokens per-run de otra. */
|
|
82
|
+
export function allRunConfigDirs() {
|
|
83
|
+
const others = fs.existsSync(platformsRoot())
|
|
84
|
+
? fs
|
|
85
|
+
.readdirSync(platformsRoot(), { withFileTypes: true })
|
|
86
|
+
.filter((d) => d.isDirectory() && PLATFORM_ID_RE.test(d.name) && d.name !== LEGACY_PLATFORM_ID)
|
|
87
|
+
.map((d) => path.join(platformsRoot(), d.name, RUN_CONFIG_SUBDIR))
|
|
88
|
+
.filter((dir) => fs.existsSync(dir))
|
|
89
|
+
: [];
|
|
90
|
+
return [runConfigDir(LEGACY_PLATFORM_ID), ...others];
|
|
91
|
+
}
|
|
92
|
+
/** fichero con lo último que el server de la plataforma dijo de esta máquina (server-state.ts). */
|
|
93
|
+
export function serverStatePath(platform) {
|
|
94
|
+
return path.join(platformHome(platform), SERVER_STATE_FILE);
|
|
95
|
+
}
|
|
96
|
+
/** raíz de la auditoría local de todas las plataformas (<runnerHome>/audit, audit.ts). */
|
|
97
|
+
export function auditRoot() {
|
|
98
|
+
return path.join(runnerHome(), AUDIT_SUBDIR);
|
|
99
|
+
}
|
|
100
|
+
/** ruta de la auditoría de una plataforma (<runnerHome>/audit/<id>, también la legacy), sin crearla. */
|
|
101
|
+
export function auditPath(platform) {
|
|
102
|
+
return path.join(auditRoot(), checkedId(platform));
|
|
103
|
+
}
|
|
104
|
+
/** directorio 0700 de la auditoría de una plataforma (se crea al pedirlo; uno que ya existía se cierra). */
|
|
105
|
+
export function auditDir(platform) {
|
|
106
|
+
const dir = auditPath(platform);
|
|
107
|
+
fs.mkdirSync(dir, { recursive: true, mode: AUDIT_DIR_MODE });
|
|
108
|
+
fs.chmodSync(dir, AUDIT_DIR_MODE);
|
|
109
|
+
return dir;
|
|
110
|
+
}
|
|
111
|
+
/** ruta por defecto del vault de sesiones de navegador (<runnerHome>/browser-vault), sin crearlo. */
|
|
112
|
+
export function defaultBrowserVaultPath() {
|
|
113
|
+
return path.join(runnerHome(), BROWSER_VAULT_SUBDIR);
|
|
114
|
+
}
|
|
115
|
+
/** crea (o cierra a 0700) el vault de sesiones de navegador `dir` y lo devuelve. */
|
|
116
|
+
export function ensureBrowserVault(dir) {
|
|
117
|
+
fs.mkdirSync(dir, { recursive: true, mode: BROWSER_VAULT_DIR_MODE });
|
|
118
|
+
fs.chmodSync(dir, BROWSER_VAULT_DIR_MODE);
|
|
119
|
+
return dir;
|
|
120
|
+
}
|
|
121
|
+
/** directorio de los worktrees de una plataforma dentro de un checkout. */
|
|
122
|
+
export function worktreesDir(repoPath, platform) {
|
|
123
|
+
return isLegacy(platform)
|
|
124
|
+
? path.join(repoPath, LEGACY_CHECKOUT_DIR, WORKTREES_SUBDIR)
|
|
125
|
+
: path.join(repoPath, CHECKOUT_DIR, WORKTREES_SUBDIR, platform);
|
|
126
|
+
}
|
|
127
|
+
/** patrón de .git/info/exclude (anclado a la raíz del checkout) que esconde los worktrees de la plataforma. */
|
|
128
|
+
export function checkoutExcludePattern(platform) {
|
|
129
|
+
return `/${isLegacy(platform) ? LEGACY_CHECKOUT_DIR : CHECKOUT_DIR}/`;
|
|
130
|
+
}
|
|
131
|
+
/** entradas privadas del estado de una plataforma, relativas a su raíz (directorios con `/` final): todo salvo
|
|
132
|
+
* el scratch, que es el cwd de sus runs sin repo. lo que aún no existe también (lo escribirá). */
|
|
133
|
+
export const PLATFORM_PRIVATE_ENTRIES = [`${LOGS_SUBDIR}/`, `${RUN_CONFIG_SUBDIR}/`, SERVER_STATE_FILE];
|
|
134
|
+
export const PLATFORM_SCRATCH_SUBDIR = SCRATCH_SUBDIR;
|
|
135
|
+
export const PLATFORMS_DIR_NAME = PLATFORMS_SUBDIR;
|
|
136
|
+
//# sourceMappingURL=paths.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"paths.js","sourceRoot":"","sources":["../src/paths.ts"],"names":[],"mappings":"AAAA,8GAA8G;AAC9G,+GAA+G;AAC/G,2GAA2G;AAC3G,cAAc;AACd,0GAA0G;AAC1G,+GAA+G;AAC/G,8GAA8G;AAC9G,wGAAwG;AACxG,4GAA4G;AAC5G,sEAAsE;AACtE,6GAA6G;AAC7G,0GAA0G;AAC1G,0GAA0G;AAE1G,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAEzC,MAAM,CAAC,MAAM,kBAAkB,GAAG,UAAU,CAAC;AAC7C,4DAA4D;AAC5D,MAAM,CAAC,MAAM,iBAAiB,GAAG,OAAO,CAAC;AACzC,kFAAkF;AAClF,MAAM,CAAC,MAAM,qBAAqB,GAAwB,IAAI,GAAG,CAAC,CAAC,kBAAkB,EAAE,iBAAiB,CAAC,CAAC,CAAC;AAC3G,MAAM,CA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";
|
|
4
|
+
readonly name: "--name";
|
|
5
|
+
readonly trusted: "--trusted";
|
|
6
|
+
};
|
|
7
|
+
export interface PlatformLoginArgs {
|
|
8
|
+
baseUrl: string;
|
|
9
|
+
id: string | null;
|
|
10
|
+
name?: string;
|
|
11
|
+
trusted: boolean;
|
|
12
|
+
}
|
|
13
|
+
/** los argumentos de un `login` de plataforma (lleva --as); null = el `login` de siempre. lanza con el uso. */
|
|
14
|
+
export declare function parsePlatformLoginArgs(rest: readonly string[]): PlatformLoginArgs | null;
|
|
15
|
+
/** el id que se deriva del host del issuer (null si no sale uno válido y libre). */
|
|
16
|
+
export declare function platformIdOf(issuer: string): string | null;
|
|
17
|
+
/** `login <url> --as [id]`: discovery, oauth y la plataforma en la config (ver cabecera). lanza con el motivo. */
|
|
18
|
+
export declare function platformLogin(args: PlatformLoginArgs, ask?: AskCode): Promise<void>;
|
|
19
|
+
//# sourceMappingURL=platform-login.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"platform-login.d.ts","sourceRoot":"","sources":["../src/platform-login.ts"],"names":[],"mappings":"AAkBA,OAAO,EAA4C,KAAK,OAAO,EAAuB,MAAM,YAAY,CAAC;AAOzG,eAAO,MAAM,mBAAmB;;;;CAAgE,CAAC;AAejG,MAAM,WAAW,iBAAiB;IAChC,OAAO,EAAE,MAAM,CAAC;IAEhB,EAAE,EAAE,MAAM,GAAG,IAAI,CAAC;IAClB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,OAAO,CAAC;CAClB;AASD,+GAA+G;AAC/G,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,SAAS,MAAM,EAAE,GAAG,iBAAiB,GAAG,IAAI,CAyBxF;AAED,oFAAoF;AACpF,wBAAgB,YAAY,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAI1D;AAoDD,kHAAkH;AAClH,wBAAsB,aAAa,CAAC,IAAI,EAAE,iBAAiB,EAAE,GAAG,CAAC,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC,CA2CzF"}
|