@tickernelz/paperclip-pro-adapter-codex-local 2026.925.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/LICENSE +22 -0
- package/dist/cli/format-event.d.ts +2 -0
- package/dist/cli/format-event.d.ts.map +1 -0
- package/dist/cli/format-event.js +218 -0
- package/dist/cli/format-event.js.map +1 -0
- package/dist/cli/index.d.ts +2 -0
- package/dist/cli/index.d.ts.map +1 -0
- package/dist/cli/index.js +2 -0
- package/dist/cli/index.js.map +1 -0
- package/dist/cli/quota-probe.d.ts +3 -0
- package/dist/cli/quota-probe.d.ts.map +1 -0
- package/dist/cli/quota-probe.js +104 -0
- package/dist/cli/quota-probe.js.map +1 -0
- package/dist/index.d.ts +21 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +155 -0
- package/dist/index.js.map +1 -0
- package/dist/index.test.d.ts +2 -0
- package/dist/index.test.d.ts.map +1 -0
- package/dist/index.test.js +58 -0
- package/dist/index.test.js.map +1 -0
- package/dist/server/acp.d.ts +30 -0
- package/dist/server/acp.d.ts.map +1 -0
- package/dist/server/acp.js +532 -0
- package/dist/server/acp.js.map +1 -0
- package/dist/server/acp.test.d.ts +2 -0
- package/dist/server/acp.test.d.ts.map +1 -0
- package/dist/server/acp.test.js +1087 -0
- package/dist/server/acp.test.js.map +1 -0
- package/dist/server/adapter-auth-promotion.d.ts +102 -0
- package/dist/server/adapter-auth-promotion.d.ts.map +1 -0
- package/dist/server/adapter-auth-promotion.js +210 -0
- package/dist/server/adapter-auth-promotion.js.map +1 -0
- package/dist/server/adapter-auth-promotion.test.d.ts +2 -0
- package/dist/server/adapter-auth-promotion.test.d.ts.map +1 -0
- package/dist/server/adapter-auth-promotion.test.js +658 -0
- package/dist/server/adapter-auth-promotion.test.js.map +1 -0
- package/dist/server/auth-check.d.ts +8 -0
- package/dist/server/auth-check.d.ts.map +1 -0
- package/dist/server/auth-check.js +8 -0
- package/dist/server/auth-check.js.map +1 -0
- package/dist/server/auth-precedence.d.ts +16 -0
- package/dist/server/auth-precedence.d.ts.map +1 -0
- package/dist/server/auth-precedence.js +20 -0
- package/dist/server/auth-precedence.js.map +1 -0
- package/dist/server/auth-precedence.test.d.ts +2 -0
- package/dist/server/auth-precedence.test.d.ts.map +1 -0
- package/dist/server/auth-precedence.test.js +100 -0
- package/dist/server/auth-precedence.test.js.map +1 -0
- package/dist/server/codex-args.d.ts +13 -0
- package/dist/server/codex-args.d.ts.map +1 -0
- package/dist/server/codex-args.js +76 -0
- package/dist/server/codex-args.js.map +1 -0
- package/dist/server/codex-args.test.d.ts +2 -0
- package/dist/server/codex-args.test.d.ts.map +1 -0
- package/dist/server/codex-args.test.js +243 -0
- package/dist/server/codex-args.test.js.map +1 -0
- package/dist/server/codex-auth-cache.d.ts +206 -0
- package/dist/server/codex-auth-cache.d.ts.map +1 -0
- package/dist/server/codex-auth-cache.js +501 -0
- package/dist/server/codex-auth-cache.js.map +1 -0
- package/dist/server/codex-auth-cache.test.d.ts +2 -0
- package/dist/server/codex-auth-cache.test.d.ts.map +1 -0
- package/dist/server/codex-auth-cache.test.js +497 -0
- package/dist/server/codex-auth-cache.test.js.map +1 -0
- package/dist/server/codex-auth-copyback.d.ts +53 -0
- package/dist/server/codex-auth-copyback.d.ts.map +1 -0
- package/dist/server/codex-auth-copyback.js +123 -0
- package/dist/server/codex-auth-copyback.js.map +1 -0
- package/dist/server/codex-auth-copyback.test.d.ts +2 -0
- package/dist/server/codex-auth-copyback.test.d.ts.map +1 -0
- package/dist/server/codex-auth-copyback.test.js +507 -0
- package/dist/server/codex-auth-copyback.test.js.map +1 -0
- package/dist/server/codex-auth-merge-decision.cjs +170 -0
- package/dist/server/codex-auth-merge-decision.d.ts +22 -0
- package/dist/server/codex-auth-merge-decision.d.ts.map +1 -0
- package/dist/server/codex-auth-merge-decision.js +58 -0
- package/dist/server/codex-auth-merge-decision.js.map +1 -0
- package/dist/server/codex-auth-merge-decision.test.d.ts +2 -0
- package/dist/server/codex-auth-merge-decision.test.d.ts.map +1 -0
- package/dist/server/codex-auth-merge-decision.test.js +230 -0
- package/dist/server/codex-auth-merge-decision.test.js.map +1 -0
- package/dist/server/codex-auth-merge-extract.sh +73 -0
- package/dist/server/codex-auth-merge-scripts.d.ts +21 -0
- package/dist/server/codex-auth-merge-scripts.d.ts.map +1 -0
- package/dist/server/codex-auth-merge-scripts.js +40 -0
- package/dist/server/codex-auth-merge-scripts.js.map +1 -0
- package/dist/server/codex-auth-merge.test.d.ts +2 -0
- package/dist/server/codex-auth-merge.test.d.ts.map +1 -0
- package/dist/server/codex-auth-merge.test.js +714 -0
- package/dist/server/codex-auth-merge.test.js.map +1 -0
- package/dist/server/codex-auth-seed-write.d.ts +30 -0
- package/dist/server/codex-auth-seed-write.d.ts.map +1 -0
- package/dist/server/codex-auth-seed-write.js +41 -0
- package/dist/server/codex-auth-seed-write.js.map +1 -0
- package/dist/server/codex-home.d.ts +162 -0
- package/dist/server/codex-home.d.ts.map +1 -0
- package/dist/server/codex-home.js +771 -0
- package/dist/server/codex-home.js.map +1 -0
- package/dist/server/codex-home.test.d.ts +2 -0
- package/dist/server/codex-home.test.d.ts.map +1 -0
- package/dist/server/codex-home.test.js +1183 -0
- package/dist/server/codex-home.test.js.map +1 -0
- package/dist/server/config-schema.d.ts +3 -0
- package/dist/server/config-schema.d.ts.map +1 -0
- package/dist/server/config-schema.js +67 -0
- package/dist/server/config-schema.js.map +1 -0
- package/dist/server/device-login-export.d.ts +56 -0
- package/dist/server/device-login-export.d.ts.map +1 -0
- package/dist/server/device-login-export.js +230 -0
- package/dist/server/device-login-export.js.map +1 -0
- package/dist/server/device-login-export.test.d.ts +2 -0
- package/dist/server/device-login-export.test.d.ts.map +1 -0
- package/dist/server/device-login-export.test.js +245 -0
- package/dist/server/device-login-export.test.js.map +1 -0
- package/dist/server/device-login-parse.d.ts +20 -0
- package/dist/server/device-login-parse.d.ts.map +1 -0
- package/dist/server/device-login-parse.js +155 -0
- package/dist/server/device-login-parse.js.map +1 -0
- package/dist/server/device-login-parse.test.d.ts +2 -0
- package/dist/server/device-login-parse.test.d.ts.map +1 -0
- package/dist/server/device-login-parse.test.js +269 -0
- package/dist/server/device-login-parse.test.js.map +1 -0
- package/dist/server/device-login-runner.d.ts +69 -0
- package/dist/server/device-login-runner.d.ts.map +1 -0
- package/dist/server/device-login-runner.js +109 -0
- package/dist/server/device-login-runner.js.map +1 -0
- package/dist/server/device-login-runner.test.d.ts +2 -0
- package/dist/server/device-login-runner.test.d.ts.map +1 -0
- package/dist/server/device-login-runner.test.js +201 -0
- package/dist/server/device-login-runner.test.js.map +1 -0
- package/dist/server/engine-availability.test.d.ts +2 -0
- package/dist/server/engine-availability.test.d.ts.map +1 -0
- package/dist/server/engine-availability.test.js +41 -0
- package/dist/server/engine-availability.test.js.map +1 -0
- package/dist/server/execute.acp-fallback.test.d.ts +2 -0
- package/dist/server/execute.acp-fallback.test.d.ts.map +1 -0
- package/dist/server/execute.acp-fallback.test.js +123 -0
- package/dist/server/execute.acp-fallback.test.js.map +1 -0
- package/dist/server/execute.auth-precedence.test.d.ts +2 -0
- package/dist/server/execute.auth-precedence.test.d.ts.map +1 -0
- package/dist/server/execute.auth-precedence.test.js +137 -0
- package/dist/server/execute.auth-precedence.test.js.map +1 -0
- package/dist/server/execute.auth.test.d.ts +2 -0
- package/dist/server/execute.auth.test.d.ts.map +1 -0
- package/dist/server/execute.auth.test.js +197 -0
- package/dist/server/execute.auth.test.js.map +1 -0
- package/dist/server/execute.d.ts +40 -0
- package/dist/server/execute.d.ts.map +1 -0
- package/dist/server/execute.js +1290 -0
- package/dist/server/execute.js.map +1 -0
- package/dist/server/execute.remote.test.d.ts +2 -0
- package/dist/server/execute.remote.test.d.ts.map +1 -0
- package/dist/server/execute.remote.test.js +556 -0
- package/dist/server/execute.remote.test.js.map +1 -0
- package/dist/server/execute.stderr-error.test.d.ts +2 -0
- package/dist/server/execute.stderr-error.test.d.ts.map +1 -0
- package/dist/server/execute.stderr-error.test.js +142 -0
- package/dist/server/execute.stderr-error.test.js.map +1 -0
- package/dist/server/execute.test.d.ts +2 -0
- package/dist/server/execute.test.d.ts.map +1 -0
- package/dist/server/execute.test.js +240 -0
- package/dist/server/execute.test.js.map +1 -0
- package/dist/server/index.d.ts +18 -0
- package/dist/server/index.d.ts.map +1 -0
- package/dist/server/index.js +71 -0
- package/dist/server/index.js.map +1 -0
- package/dist/server/output-inactivity-monitor.d.ts +62 -0
- package/dist/server/output-inactivity-monitor.d.ts.map +1 -0
- package/dist/server/output-inactivity-monitor.integration.test.d.ts +2 -0
- package/dist/server/output-inactivity-monitor.integration.test.d.ts.map +1 -0
- package/dist/server/output-inactivity-monitor.integration.test.js +136 -0
- package/dist/server/output-inactivity-monitor.integration.test.js.map +1 -0
- package/dist/server/output-inactivity-monitor.js +112 -0
- package/dist/server/output-inactivity-monitor.js.map +1 -0
- package/dist/server/output-inactivity-monitor.test.d.ts +2 -0
- package/dist/server/output-inactivity-monitor.test.d.ts.map +1 -0
- package/dist/server/output-inactivity-monitor.test.js +284 -0
- package/dist/server/output-inactivity-monitor.test.js.map +1 -0
- package/dist/server/parse.d.ts +51 -0
- package/dist/server/parse.d.ts.map +1 -0
- package/dist/server/parse.js +261 -0
- package/dist/server/parse.js.map +1 -0
- package/dist/server/parse.test.d.ts +2 -0
- package/dist/server/parse.test.d.ts.map +1 -0
- package/dist/server/parse.test.js +186 -0
- package/dist/server/parse.test.js.map +1 -0
- package/dist/server/process-activity-monitor.d.ts +21 -0
- package/dist/server/process-activity-monitor.d.ts.map +1 -0
- package/dist/server/process-activity-monitor.js +103 -0
- package/dist/server/process-activity-monitor.js.map +1 -0
- package/dist/server/process-activity-monitor.test.d.ts +2 -0
- package/dist/server/process-activity-monitor.test.d.ts.map +1 -0
- package/dist/server/process-activity-monitor.test.js +82 -0
- package/dist/server/process-activity-monitor.test.js.map +1 -0
- package/dist/server/quota-spawn-error.test.d.ts +2 -0
- package/dist/server/quota-spawn-error.test.d.ts.map +1 -0
- package/dist/server/quota-spawn-error.test.js +174 -0
- package/dist/server/quota-spawn-error.test.js.map +1 -0
- package/dist/server/quota.d.ts +66 -0
- package/dist/server/quota.d.ts.map +1 -0
- package/dist/server/quota.js +511 -0
- package/dist/server/quota.js.map +1 -0
- package/dist/server/runtime-config.d.ts +11 -0
- package/dist/server/runtime-config.d.ts.map +1 -0
- package/dist/server/runtime-config.js +380 -0
- package/dist/server/runtime-config.js.map +1 -0
- package/dist/server/runtime-config.test.d.ts +2 -0
- package/dist/server/runtime-config.test.d.ts.map +1 -0
- package/dist/server/runtime-config.test.js +367 -0
- package/dist/server/runtime-config.test.js.map +1 -0
- package/dist/server/skills.d.ts +8 -0
- package/dist/server/skills.d.ts.map +1 -0
- package/dist/server/skills.js +26 -0
- package/dist/server/skills.js.map +1 -0
- package/dist/server/test.d.ts +3 -0
- package/dist/server/test.d.ts.map +1 -0
- package/dist/server/test.js +458 -0
- package/dist/server/test.js.map +1 -0
- package/dist/server/test.remote.test.d.ts +2 -0
- package/dist/server/test.remote.test.d.ts.map +1 -0
- package/dist/server/test.remote.test.js +396 -0
- package/dist/server/test.remote.test.js.map +1 -0
- package/dist/ui/build-config.d.ts +5 -0
- package/dist/ui/build-config.d.ts.map +1 -0
- package/dist/ui/build-config.js +229 -0
- package/dist/ui/build-config.js.map +1 -0
- package/dist/ui/build-config.test.d.ts +2 -0
- package/dist/ui/build-config.test.d.ts.map +1 -0
- package/dist/ui/build-config.test.js +272 -0
- package/dist/ui/build-config.test.js.map +1 -0
- package/dist/ui/index.d.ts +4 -0
- package/dist/ui/index.d.ts.map +1 -0
- package/dist/ui/index.js +8 -0
- package/dist/ui/index.js.map +1 -0
- package/dist/ui/parse-stdout.d.ts +3 -0
- package/dist/ui/parse-stdout.d.ts.map +1 -0
- package/dist/ui/parse-stdout.js +265 -0
- package/dist/ui/parse-stdout.js.map +1 -0
- package/dist/ui/parse-stdout.test.d.ts +2 -0
- package/dist/ui/parse-stdout.test.d.ts.map +1 -0
- package/dist/ui/parse-stdout.test.js +77 -0
- package/dist/ui/parse-stdout.test.js.map +1 -0
- package/package.json +61 -0
- package/skills/agentmail/SKILL.md +70 -0
- package/skills/paperclip/SKILL.md +712 -0
- package/skills/paperclip/references/api-reference.md +1675 -0
- package/skills/paperclip/references/artifacts.md +158 -0
- package/skills/paperclip/references/cases.md +295 -0
- package/skills/paperclip/references/company-skills.md +266 -0
- package/skills/paperclip/references/issue-workspaces.md +80 -0
- package/skills/paperclip/references/routines.md +231 -0
- package/skills/paperclip/references/workflows.md +141 -0
- package/skills/paperclip/scripts/paperclip-upload-artifact.sh +592 -0
- package/skills/paperclip-board/SKILL.md +619 -0
- package/skills/paperclip-converting-plans-to-tasks/SKILL.md +60 -0
- package/skills/paperclip-create-agent/SKILL.md +179 -0
- package/skills/paperclip-create-agent/references/agent-instruction-templates.md +123 -0
- package/skills/paperclip-create-agent/references/agents/coder.md +64 -0
- package/skills/paperclip-create-agent/references/agents/qa.md +88 -0
- package/skills/paperclip-create-agent/references/agents/securityengineer.md +135 -0
- package/skills/paperclip-create-agent/references/agents/uxdesigner.md +115 -0
- package/skills/paperclip-create-agent/references/api-reference.md +110 -0
- package/skills/paperclip-create-agent/references/baseline-role-guide.md +168 -0
- package/skills/paperclip-create-agent/references/draft-review-checklist.md +95 -0
- package/skills/para-memory-files/SKILL.md +100 -0
- package/skills/para-memory-files/references/schemas.md +35 -0
- package/skills/slack/SKILL.md +65 -0
|
@@ -0,0 +1,206 @@
|
|
|
1
|
+
export declare const CODEX_AUTH_CACHE_OFF_SWITCH_ENV = "PAPERCLIP_CODEX_AUTH_CACHE";
|
|
2
|
+
/**
|
|
3
|
+
* True when the cache is enabled. The cache is on by default. It turns off only
|
|
4
|
+
* when {@link CODEX_AUTH_CACHE_OFF_SWITCH_ENV} is an explicit falsy value
|
|
5
|
+
* (`0`, `false`, `no`, or `off`).
|
|
6
|
+
*/
|
|
7
|
+
export declare function isCodexAuthCacheEnabled(env?: NodeJS.ProcessEnv): boolean;
|
|
8
|
+
/**
|
|
9
|
+
* Sanitizes an `account_id` to one safe path segment. Rejects an empty value, a
|
|
10
|
+
* relative segment (`.` or `..`), a path separator, and a NUL byte, so a raw
|
|
11
|
+
* `account_id` can never become a path traversal. Returns the trimmed, safe
|
|
12
|
+
* segment. (Security condition 3.)
|
|
13
|
+
*/
|
|
14
|
+
export declare function toCacheKey(accountId: string): string;
|
|
15
|
+
/**
|
|
16
|
+
* Resolves the company-scoped cache root under the same isolation boundary as
|
|
17
|
+
* the managed Codex home (`resolveManagedCodexHomeDir`). The root is always
|
|
18
|
+
* company-scoped, so a Codex credential can never cross a company boundary.
|
|
19
|
+
* There is no instance-global fallback root: `companyId` is required, and an
|
|
20
|
+
* empty value is a fail-loud error. `companyId` is sanitized to a single safe
|
|
21
|
+
* path segment, so a traversal value (`..`, `/etc`, `a/b`) can never make the
|
|
22
|
+
* cache root escape the `companies/` directory. Every downstream path (the
|
|
23
|
+
* entry path, the vend, and the clear) inherits this guard. (Security
|
|
24
|
+
* condition 1.)
|
|
25
|
+
*/
|
|
26
|
+
export declare function resolveCodexAuthCacheDir(env: NodeJS.ProcessEnv | undefined, companyId: string): string;
|
|
27
|
+
/**
|
|
28
|
+
* True when `homePath` sits inside the per-identity credential store of ANY
|
|
29
|
+
* company: `<instanceRoot>/companies/<id>/codex-auth-cache/…` (or is a store
|
|
30
|
+
* root itself). These directories are identity-anchored slots owned by the
|
|
31
|
+
* device-login promotion, the vend, and the copy-back, each under its own
|
|
32
|
+
* lock. The managed-home seeding pass consults this to refuse to symlink,
|
|
33
|
+
* heal, or overwrite an entry's `auth.json`: an agent may bind `CODEX_HOME`
|
|
34
|
+
* to an entry (through the login's account-home secret), and seeding it like
|
|
35
|
+
* an ordinary managed home would silently swap the bound account's durable
|
|
36
|
+
* credential for the host login.
|
|
37
|
+
*/
|
|
38
|
+
export declare function isCodexAuthCachePath(env: NodeJS.ProcessEnv, homePath: string): boolean;
|
|
39
|
+
/**
|
|
40
|
+
* Resolves the entry path for one identity: `<cacheRoot>/<safeAccountId>/auth.json`.
|
|
41
|
+
* The `account_id` is validated first by {@link toAccountHandle} (a strict
|
|
42
|
+
* allowlist), the entry point of this function, then sanitized again by
|
|
43
|
+
* {@link toCacheKey} (a denylist) as a second, independent layer. After the
|
|
44
|
+
* join, this verifies the resolved entry path stays under the cache root and
|
|
45
|
+
* ends at exactly `<safeAccountId>/auth.json`. This function does no filesystem
|
|
46
|
+
* work; it is safe for a read path (the vend and the clear). (Security
|
|
47
|
+
* condition 3.)
|
|
48
|
+
*/
|
|
49
|
+
export declare function resolveCodexAuthCacheEntryPath(env: NodeJS.ProcessEnv | undefined, accountId: string, companyId: string): string;
|
|
50
|
+
/**
|
|
51
|
+
* Resolves the entry path and creates the cache root and the entry directory
|
|
52
|
+
* private (mode 0700), each guarded by `lstat`. The `account_id` is validated
|
|
53
|
+
* at the entry point of this function through {@link resolveCodexAuthCacheEntryPath}.
|
|
54
|
+
* Use this on the write path before the entry is written.
|
|
55
|
+
*/
|
|
56
|
+
export declare function ensureCodexAuthCacheEntryDir(env: NodeJS.ProcessEnv | undefined, accountId: string, companyId: string): Promise<string>;
|
|
57
|
+
export interface EnsureCodexAuthCacheEntryDirExclusiveResult {
|
|
58
|
+
/** The entry path: `<accountHomeDir>/auth.json`. */
|
|
59
|
+
entryPath: string;
|
|
60
|
+
/** True only when this exact call found the account's own home directory
|
|
61
|
+
* absent and created it. */
|
|
62
|
+
created: boolean;
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Same as {@link ensureCodexAuthCacheEntryDir}, but the absence check and the
|
|
66
|
+
* directory creation run inside one lock keyed to the company-scoped cache
|
|
67
|
+
* root. Two different logins for the SAME Codex account can promote at the
|
|
68
|
+
* same time (each login owns its own promotion slot), so a plain
|
|
69
|
+
* check-then-create sequence lets both concurrent callers see the slot as
|
|
70
|
+
* absent and both report `created: true`. Under this lock, only the caller
|
|
71
|
+
* that truly finds the slot absent gets `created: true`; the other caller
|
|
72
|
+
* correctly reports `created: false` and so never deletes a home the first
|
|
73
|
+
* caller's login already wrote to and named with a company secret.
|
|
74
|
+
*/
|
|
75
|
+
export declare function ensureCodexAuthCacheEntryDirExclusive(env: NodeJS.ProcessEnv | undefined, accountId: string, companyId: string): Promise<EnsureCodexAuthCacheEntryDirExclusiveResult>;
|
|
76
|
+
/**
|
|
77
|
+
* Serializes one company's whole device-login promotion sequence: the
|
|
78
|
+
* account-home directory create-or-reuse decision, the credential write, and
|
|
79
|
+
* the secret bind or cleanup that follows. Two different logins for the SAME
|
|
80
|
+
* Codex account run this sequence one at a time under this lock, so no login
|
|
81
|
+
* can decide to delete the shared account-home directory while another
|
|
82
|
+
* login's flow is still mid-way through writing its credential or binding
|
|
83
|
+
* its own secret to that same directory.
|
|
84
|
+
*
|
|
85
|
+
* `ensureCodexAuthCacheEntryDirExclusive` alone is not enough: it locks only
|
|
86
|
+
* the short directory-creation step, so its lock is already released by the
|
|
87
|
+
* time a login reaches the secret bind. A second login can then write its
|
|
88
|
+
* credential and be about to bind its own secret while the first login's
|
|
89
|
+
* later, unrelated secret-write failure decides to remove the directory both
|
|
90
|
+
* logins now share, deleting a credential home the second login still needs.
|
|
91
|
+
* Holding this lock across the full sequence for every login closes that
|
|
92
|
+
* window: a login that must clean up its own directory always finishes that
|
|
93
|
+
* cleanup, including the directory-recreation of any later login that lands
|
|
94
|
+
* on the now-empty slot, before the next login's sequence starts.
|
|
95
|
+
*/
|
|
96
|
+
export declare function withCodexAccountHomePromotionLock<T>(env: NodeJS.ProcessEnv | undefined, companyId: string, fn: () => Promise<T>): Promise<T>;
|
|
97
|
+
/**
|
|
98
|
+
* Serializes one company's writes to the literal value of any
|
|
99
|
+
* `local_encrypted` company secret against the account-home cleanup's
|
|
100
|
+
* claimant scan in {@link withCodexAccountHomePromotionLock}'s caller. Only a
|
|
101
|
+
* `local_encrypted` secret can hold a literal directory path, so this is the
|
|
102
|
+
* one provider a cleanup claimant scan must trust. Without this lock, a
|
|
103
|
+
* secret create or rotation can commit its new value after the scan's last
|
|
104
|
+
* pass finds no claimant but before the cleanup deletes the directory: the
|
|
105
|
+
* scan and the write never observe each other, so the write's new value
|
|
106
|
+
* survives past a directory the delete has already removed.
|
|
107
|
+
*
|
|
108
|
+
* The secrets service holds this lock for the full duration of a
|
|
109
|
+
* `local_encrypted` secret's create or rotate call. A cleanup claimant scan
|
|
110
|
+
* holds it for the full duration of its final check-and-delete step. The two
|
|
111
|
+
* critical sections can then never interleave: a write that starts first
|
|
112
|
+
* finishes (and becomes visible to the scan) before the scan's lock-holding
|
|
113
|
+
* check runs, and a write that starts after the scan's lock-holding check
|
|
114
|
+
* finishes only commits once the scan (and any delete it decided on) is
|
|
115
|
+
* done, so it can never name a directory the delete just removed without the
|
|
116
|
+
* scan having had a chance to see it first.
|
|
117
|
+
*
|
|
118
|
+
* This is a separate lock directory from
|
|
119
|
+
* {@link withCodexAccountHomePromotionLock}'s, so a device-login promotion
|
|
120
|
+
* (which holds that lock for its whole sequence, including its own secret
|
|
121
|
+
* create) can still call into a secrets-service write that takes this lock
|
|
122
|
+
* without deadlocking on itself.
|
|
123
|
+
*/
|
|
124
|
+
export declare function withAccountHomeSecretMutationLock<T>(env: NodeJS.ProcessEnv | undefined, companyId: string, fn: () => Promise<T>): Promise<T>;
|
|
125
|
+
/**
|
|
126
|
+
* Confirms a `local_encrypted` secret value that names a directory under this
|
|
127
|
+
* company's Codex account-home cache root still exists on disk. Call this
|
|
128
|
+
* inside {@link withAccountHomeSecretMutationLock}, before a create or a
|
|
129
|
+
* rotate commits the value.
|
|
130
|
+
*
|
|
131
|
+
* The lock alone stops a write and the account-home cleanup's
|
|
132
|
+
* check-and-delete from interleaving; it does not stop them from running in
|
|
133
|
+
* either order. When the cleanup's check-and-delete runs first — it finds no
|
|
134
|
+
* secret names the directory, because this write had not committed yet, and
|
|
135
|
+
* removes the directory — a write that was only queued behind the lock still
|
|
136
|
+
* goes on, once the lock frees, to commit the very directory the cleanup
|
|
137
|
+
* just removed. That would leave an active secret naming a directory that
|
|
138
|
+
* does not exist. This check closes that window: a write whose value would
|
|
139
|
+
* name a directory the cleanup already removed fails instead of committing.
|
|
140
|
+
*
|
|
141
|
+
* A value outside this company's cache root is left alone. Only a value
|
|
142
|
+
* under the cache root can ever be an account-home directory, so this never
|
|
143
|
+
* rejects an unrelated `local_encrypted` secret write, such as an API key or
|
|
144
|
+
* a hand-typed token.
|
|
145
|
+
*/
|
|
146
|
+
export declare function assertAccountHomeCacheDirStillValid(env: NodeJS.ProcessEnv | undefined, companyId: string, value: string): Promise<void>;
|
|
147
|
+
/**
|
|
148
|
+
* Reads the usable subscription `account_id` from an `auth.json` payload. Returns
|
|
149
|
+
* `null` for an absent, unusable, or api-key credential (no subscription
|
|
150
|
+
* identity). This mirrors `parseAuth` in `codex-auth-merge-decision.cjs`; keep
|
|
151
|
+
* the two in step when the auth format changes.
|
|
152
|
+
*
|
|
153
|
+
* The returned value is the exact, untrimmed `account_id` string. A caller
|
|
154
|
+
* passes it on to {@link toAccountHandle} unchanged: that function is the
|
|
155
|
+
* one place that decides whether surrounding whitespace is acceptable, and it
|
|
156
|
+
* must see the raw value to reject an identifier that differs from another
|
|
157
|
+
* one only by whitespace. Trimming here, before that check runs, would let
|
|
158
|
+
* two distinct identifiers collapse onto the same account handle.
|
|
159
|
+
*/
|
|
160
|
+
export declare function readSubscriptionAccountId(bytes: Buffer): string | null;
|
|
161
|
+
export type WriteCodexAuthCacheEntryOutcome = "written" | "kept-slot";
|
|
162
|
+
/**
|
|
163
|
+
* Writes `sandboxAuthBytes` into its per-identity cache slot when the slot is
|
|
164
|
+
* absent, or when the source is a strictly-newer same-identity subscription
|
|
165
|
+
* credential (seed mode). The mutation runs under the merge lock on the slot
|
|
166
|
+
* directory, through the shared {@link writeCredentialSeedOrNewer} writer. Never
|
|
167
|
+
* logs token bytes or a raw `account_id`.
|
|
168
|
+
*/
|
|
169
|
+
export declare function writeCodexAuthCacheEntry(input: {
|
|
170
|
+
sandboxAuthBytes: Buffer;
|
|
171
|
+
cacheEntryPath: string;
|
|
172
|
+
log: (line: string) => void | Promise<void>;
|
|
173
|
+
/** Environment for the merge lock root. Defaults to `process.env`. */
|
|
174
|
+
env?: NodeJS.ProcessEnv;
|
|
175
|
+
}): Promise<WriteCodexAuthCacheEntryOutcome>;
|
|
176
|
+
export type VendCodexAuthOutcome = "vended" | "kept-host" | "no-host-identity";
|
|
177
|
+
/**
|
|
178
|
+
* Refreshes the identity the host already holds with a strictly-newer cached
|
|
179
|
+
* credential of the same `account_id`. Identity-anchored:
|
|
180
|
+
*
|
|
181
|
+
* 1. Read the host identity from `sharedHomeAuthPath` first.
|
|
182
|
+
* 2. When the host holds no usable subscription identity, do nothing. The vend
|
|
183
|
+
* never picks a credential from the cache at random (matrix rows 3, 4).
|
|
184
|
+
* 3. Resolve ONLY that exact identity's cache slot. The vend never scans the
|
|
185
|
+
* cache root. (Security condition 4.)
|
|
186
|
+
* 4. Run the DEFAULT-mode predicate (cache slot as source, shared home as
|
|
187
|
+
* destination). Install the cache copy only when it is strictly newer for the
|
|
188
|
+
* same identity.
|
|
189
|
+
*
|
|
190
|
+
* The vend never changes identity and never stages a spent single-use refresh
|
|
191
|
+
* token (the strictly-newer rule guards it). Never logs token bytes or a raw
|
|
192
|
+
* `account_id`.
|
|
193
|
+
*/
|
|
194
|
+
export declare function selectVendCredential(sharedHomeAuthPath: string, resolveCacheEntryPath: (accountId: string) => string, log: (line: string) => void | Promise<void>, env?: NodeJS.ProcessEnv): Promise<VendCodexAuthOutcome>;
|
|
195
|
+
/**
|
|
196
|
+
* Removes exactly one identity slot from the cache. The `account_id` is
|
|
197
|
+
* sanitized by {@link toCacheKey}, so the removal can never escape the cache
|
|
198
|
+
* root. A missing slot is a benign no-op. Any other removal error is fail-loud.
|
|
199
|
+
*/
|
|
200
|
+
export declare function clearCodexAuthCacheEntry(env: NodeJS.ProcessEnv | undefined, accountId: string, companyId: string): Promise<void>;
|
|
201
|
+
/**
|
|
202
|
+
* Removes every slot in the company-scoped cache root. A missing cache root is a
|
|
203
|
+
* benign no-op.
|
|
204
|
+
*/
|
|
205
|
+
export declare function clearCodexAuthCache(env: NodeJS.ProcessEnv | undefined, companyId: string): Promise<void>;
|
|
206
|
+
//# sourceMappingURL=codex-auth-cache.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"codex-auth-cache.d.ts","sourceRoot":"","sources":["../../src/server/codex-auth-cache.ts"],"names":[],"mappings":"AA6BA,eAAO,MAAM,+BAA+B,+BAA+B,CAAC;AAc5E;;;;GAIG;AACH,wBAAgB,uBAAuB,CAAC,GAAG,GAAE,MAAM,CAAC,UAAwB,GAAG,OAAO,CAIrF;AA4BD;;;;;GAKG;AACH,wBAAgB,UAAU,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CAEpD;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,wBAAwB,CACtC,GAAG,EAAE,MAAM,CAAC,UAAU,YAAc,EACpC,SAAS,EAAE,MAAM,GAChB,MAAM,CAQR;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,oBAAoB,CAClC,GAAG,EAAE,MAAM,CAAC,UAAU,EACtB,QAAQ,EAAE,MAAM,GACf,OAAO,CAWT;AAED;;;;;;;;;GASG;AACH,wBAAgB,8BAA8B,CAC5C,GAAG,EAAE,MAAM,CAAC,UAAU,YAAc,EACpC,SAAS,EAAE,MAAM,EACjB,SAAS,EAAE,MAAM,GAChB,MAAM,CAkBR;AAqBD;;;;;GAKG;AACH,wBAAsB,4BAA4B,CAChD,GAAG,EAAE,MAAM,CAAC,UAAU,YAAc,EACpC,SAAS,EAAE,MAAM,EACjB,SAAS,EAAE,MAAM,GAChB,OAAO,CAAC,MAAM,CAAC,CAKjB;AAED,MAAM,WAAW,2CAA2C;IAC1D,oDAAoD;IACpD,SAAS,EAAE,MAAM,CAAC;IAClB;iCAC6B;IAC7B,OAAO,EAAE,OAAO,CAAC;CAClB;AAED;;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