oneie 5.7.6 → 5.8.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +19 -1
- package/dist/package.json +7 -8
- package/dist/src/age-yefbe8pe.js +1 -0
- package/dist/src/evm-tx-ee2q0e3w.js +1 -0
- package/dist/src/hl-run-tgrkrk69.js +1 -0
- package/dist/src/index-0rj9wdk9.js +4 -0
- package/dist/src/index-91y484c2.js +2052 -0
- package/dist/src/index-940y3rnv.js +12 -0
- package/dist/src/index.js +1047 -121
- package/dist/src/message-key-db1xjdkw.js +1 -0
- package/dist/src/message-lock-5vr8079x.js +5 -0
- package/dist/src/sweep-order-c2p6rk8c.js +1 -0
- package/dist/src/sweep-runner-t68xe7vx.js +1 -0
- package/package.json +7 -8
- package/dist/src/agent.d.ts +0 -75
- package/dist/src/agent.js +0 -1334
- package/dist/src/agentverse.d.ts +0 -26
- package/dist/src/agentverse.js +0 -171
- package/dist/src/args.d.ts +0 -9
- package/dist/src/args.js +0 -61
- package/dist/src/auth.d.ts +0 -6
- package/dist/src/auth.js +0 -121
- package/dist/src/balances.d.ts +0 -89
- package/dist/src/balances.js +0 -202
- package/dist/src/banner.d.ts +0 -1
- package/dist/src/banner.js +0 -17
- package/dist/src/broadcast.d.ts +0 -8
- package/dist/src/broadcast.js +0 -175
- package/dist/src/catalog.d.ts +0 -12
- package/dist/src/catalog.js +0 -76
- package/dist/src/chat.d.ts +0 -2
- package/dist/src/chat.js +0 -92
- package/dist/src/client.d.ts +0 -5
- package/dist/src/client.js +0 -157
- package/dist/src/compiler.d.ts +0 -36
- package/dist/src/compiler.js +0 -366
- package/dist/src/config.d.ts +0 -24
- package/dist/src/config.js +0 -70
- package/dist/src/connect.d.ts +0 -2
- package/dist/src/connect.js +0 -64
- package/dist/src/coordinate.d.ts +0 -3
- package/dist/src/coordinate.js +0 -58
- package/dist/src/create.d.ts +0 -2
- package/dist/src/create.js +0 -113
- package/dist/src/deploy.d.ts +0 -2
- package/dist/src/deploy.js +0 -19
- package/dist/src/dev.d.ts +0 -2
- package/dist/src/dev.js +0 -75
- package/dist/src/device-flow.d.ts +0 -57
- package/dist/src/device-flow.js +0 -173
- package/dist/src/doctor.d.ts +0 -26
- package/dist/src/doctor.js +0 -146
- package/dist/src/draw.d.ts +0 -18
- package/dist/src/draw.js +0 -156
- package/dist/src/endpoint.d.ts +0 -2
- package/dist/src/endpoint.js +0 -250
- package/dist/src/env.d.ts +0 -3
- package/dist/src/env.js +0 -37
- package/dist/src/eval.d.ts +0 -2
- package/dist/src/eval.js +0 -43
- package/dist/src/fn.d.ts +0 -2
- package/dist/src/fn.js +0 -70
- package/dist/src/group.d.ts +0 -2
- package/dist/src/group.js +0 -117
- package/dist/src/hl-run.d.ts +0 -119
- package/dist/src/hl-run.js +0 -480
- package/dist/src/hl.d.ts +0 -17
- package/dist/src/hl.js +0 -148
- package/dist/src/index.d.ts +0 -2
- package/dist/src/init.d.ts +0 -76
- package/dist/src/init.js +0 -278
- package/dist/src/join.d.ts +0 -11
- package/dist/src/join.js +0 -293
- package/dist/src/key-publish.d.ts +0 -40
- package/dist/src/key-publish.js +0 -232
- package/dist/src/key-seal.d.ts +0 -21
- package/dist/src/key-seal.js +0 -142
- package/dist/src/key-sweep.d.ts +0 -93
- package/dist/src/key-sweep.js +0 -263
- package/dist/src/key.d.ts +0 -26
- package/dist/src/key.js +0 -338
- package/dist/src/lib/age-plugin.d.ts +0 -51
- package/dist/src/lib/age-plugin.js +0 -130
- package/dist/src/lib/agent-env.d.ts +0 -12
- package/dist/src/lib/agent-env.js +0 -48
- package/dist/src/lib/api-path.d.ts +0 -2
- package/dist/src/lib/api-path.js +0 -40
- package/dist/src/lib/asker.d.ts +0 -34
- package/dist/src/lib/asker.js +0 -126
- package/dist/src/lib/client.d.ts +0 -20
- package/dist/src/lib/client.js +0 -71
- package/dist/src/lib/env-sealed.d.ts +0 -53
- package/dist/src/lib/env-sealed.js +0 -184
- package/dist/src/lib/flow-tag.d.ts +0 -86
- package/dist/src/lib/flow-tag.js +0 -230
- package/dist/src/lib/hl-core/actions.d.ts +0 -99
- package/dist/src/lib/hl-core/actions.js +0 -69
- package/dist/src/lib/hl-core/eip712.d.ts +0 -33
- package/dist/src/lib/hl-core/eip712.js +0 -107
- package/dist/src/lib/hl-core/errors.d.ts +0 -10
- package/dist/src/lib/hl-core/errors.js +0 -15
- package/dist/src/lib/hl-core/exchange.d.ts +0 -24
- package/dist/src/lib/hl-core/exchange.js +0 -47
- package/dist/src/lib/hl-core/index.d.ts +0 -13
- package/dist/src/lib/hl-core/index.js +0 -14
- package/dist/src/lib/hl-core/meta.d.ts +0 -57
- package/dist/src/lib/hl-core/meta.js +0 -110
- package/dist/src/lib/hl-core/msgpack.d.ts +0 -18
- package/dist/src/lib/hl-core/msgpack.js +0 -136
- package/dist/src/lib/hl-core/net.d.ts +0 -2
- package/dist/src/lib/hl-core/net.js +0 -7
- package/dist/src/lib/hl-core/signing.d.ts +0 -103
- package/dist/src/lib/hl-core/signing.js +0 -295
- package/dist/src/lib/hl-core/wire.d.ts +0 -34
- package/dist/src/lib/hl-core/wire.js +0 -81
- package/dist/src/lib/invoked-as.d.ts +0 -2
- package/dist/src/lib/invoked-as.js +0 -24
- package/dist/src/lib/journey-words.d.ts +0 -84
- package/dist/src/lib/journey-words.js +0 -360
- package/dist/src/lib/journey.d.ts +0 -148
- package/dist/src/lib/journey.js +0 -245
- package/dist/src/lib/key-receipt.d.ts +0 -48
- package/dist/src/lib/key-receipt.js +0 -116
- package/dist/src/lib/key-source.d.ts +0 -9
- package/dist/src/lib/key-source.js +0 -33
- package/dist/src/lib/keyfile.d.ts +0 -136
- package/dist/src/lib/keyfile.js +0 -397
- package/dist/src/lib/launch-claude.d.ts +0 -5
- package/dist/src/lib/launch-claude.js +0 -45
- package/dist/src/lib/lock-lookup.d.ts +0 -40
- package/dist/src/lib/lock-lookup.js +0 -92
- package/dist/src/lib/message-seal.d.ts +0 -63
- package/dist/src/lib/message-seal.js +0 -150
- package/dist/src/lib/network.d.ts +0 -15
- package/dist/src/lib/network.js +0 -41
- package/dist/src/lib/paths.d.ts +0 -41
- package/dist/src/lib/paths.js +0 -91
- package/dist/src/lib/plan-draw.d.ts +0 -56
- package/dist/src/lib/plan-draw.js +0 -219
- package/dist/src/lib/plan-live.d.ts +0 -20
- package/dist/src/lib/plan-live.js +0 -192
- package/dist/src/lib/qr.d.ts +0 -21
- package/dist/src/lib/qr.js +0 -402
- package/dist/src/lib/roster.d.ts +0 -20
- package/dist/src/lib/roster.js +0 -79
- package/dist/src/lib/sale-card.d.ts +0 -117
- package/dist/src/lib/sale-card.js +0 -261
- package/dist/src/lib/shop-init.d.ts +0 -62
- package/dist/src/lib/shop-init.js +0 -63
- package/dist/src/lib/sui-grpc-send.d.ts +0 -50
- package/dist/src/lib/sui-grpc-send.js +0 -89
- package/dist/src/lib/swap-core.d.ts +0 -163
- package/dist/src/lib/swap-core.js +0 -405
- package/dist/src/lib/tasks-digest.d.ts +0 -66
- package/dist/src/lib/tasks-digest.js +0 -200
- package/dist/src/lib/tasks-graph.d.ts +0 -79
- package/dist/src/lib/tasks-graph.js +0 -463
- package/dist/src/lib/tasks-lens.d.ts +0 -31
- package/dist/src/lib/tasks-lens.js +0 -47
- package/dist/src/lib/tasks-next.d.ts +0 -25
- package/dist/src/lib/tasks-next.js +0 -103
- package/dist/src/lib/tasks-prove.d.ts +0 -15
- package/dist/src/lib/tasks-prove.js +0 -68
- package/dist/src/lib/tasks-route.d.ts +0 -29
- package/dist/src/lib/tasks-route.js +0 -151
- package/dist/src/lib/tasks-score.d.ts +0 -36
- package/dist/src/lib/tasks-score.js +0 -152
- package/dist/src/lib/tasks-workspace.d.ts +0 -18
- package/dist/src/lib/tasks-workspace.js +0 -73
- package/dist/src/lib/vault-read.d.ts +0 -24
- package/dist/src/lib/vault-read.js +0 -77
- package/dist/src/lib/vaultfile.d.ts +0 -88
- package/dist/src/lib/vaultfile.js +0 -222
- package/dist/src/lib/wallet-money.d.ts +0 -222
- package/dist/src/lib/wallet-money.js +0 -578
- package/dist/src/lib/wallet-request.d.ts +0 -50
- package/dist/src/lib/wallet-request.js +0 -86
- package/dist/src/links.d.ts +0 -5
- package/dist/src/links.js +0 -45
- package/dist/src/media.d.ts +0 -29
- package/dist/src/media.js +0 -487
- package/dist/src/message-receipt.d.ts +0 -25
- package/dist/src/message-receipt.js +0 -71
- package/dist/src/message.d.ts +0 -13
- package/dist/src/message.js +0 -92
- package/dist/src/onboard.d.ts +0 -16
- package/dist/src/onboard.js +0 -149
- package/dist/src/plugin.d.ts +0 -2
- package/dist/src/plugin.js +0 -193
- package/dist/src/push.d.ts +0 -2
- package/dist/src/push.js +0 -115
- package/dist/src/render.d.ts +0 -21
- package/dist/src/render.js +0 -32
- package/dist/src/secrets-device.d.ts +0 -32
- package/dist/src/secrets-device.js +0 -127
- package/dist/src/secrets-give.d.ts +0 -125
- package/dist/src/secrets-give.js +0 -236
- package/dist/src/secrets-list.d.ts +0 -27
- package/dist/src/secrets-list.js +0 -84
- package/dist/src/secrets-run.d.ts +0 -31
- package/dist/src/secrets-run.js +0 -182
- package/dist/src/secrets.d.ts +0 -33
- package/dist/src/secrets.js +0 -200
- package/dist/src/setup.d.ts +0 -6
- package/dist/src/setup.js +0 -127
- package/dist/src/ship.d.ts +0 -2
- package/dist/src/ship.js +0 -18
- package/dist/src/shop.d.ts +0 -10
- package/dist/src/shop.js +0 -110
- package/dist/src/skill-parser.d.ts +0 -14
- package/dist/src/skill-parser.js +0 -113
- package/dist/src/skill.d.ts +0 -2
- package/dist/src/skill.js +0 -493
- package/dist/src/slug.d.ts +0 -2
- package/dist/src/slug.js +0 -6
- package/dist/src/social.d.ts +0 -2
- package/dist/src/social.js +0 -106
- package/dist/src/staff.d.ts +0 -2
- package/dist/src/staff.js +0 -104
- package/dist/src/start.d.ts +0 -15
- package/dist/src/start.js +0 -203
- package/dist/src/status.d.ts +0 -2
- package/dist/src/status.js +0 -52
- package/dist/src/substrate.d.ts +0 -2
- package/dist/src/substrate.js +0 -258
- package/dist/src/swap.d.ts +0 -93
- package/dist/src/swap.js +0 -622
- package/dist/src/tasks.d.ts +0 -2
- package/dist/src/tasks.js +0 -743
- package/dist/src/templates.d.ts +0 -1
- package/dist/src/templates.js +0 -213
- package/dist/src/trade.d.ts +0 -2
- package/dist/src/trade.js +0 -91
- package/dist/src/trail.d.ts +0 -2
- package/dist/src/trail.js +0 -41
- package/dist/src/validate.d.ts +0 -13
- package/dist/src/validate.js +0 -35
- package/dist/src/wallet-money.d.ts +0 -152
- package/dist/src/wallet-money.js +0 -564
- package/dist/src/wallet.d.ts +0 -167
- package/dist/src/wallet.js +0 -855
- package/dist/src/workflow.d.ts +0 -2
- package/dist/src/workflow.js +0 -166
- package/dist/src/write.d.ts +0 -43
- package/dist/src/write.js +0 -180
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* age-plugin.ts — seal to, and open with, an `age1se1…` Secure Enclave lock through the
|
|
3
|
-
* real `age` binary and `age-plugin-se` (text/secrets.md deliverable 3; text/secrets-todo.md § C3).
|
|
4
|
-
*
|
|
5
|
-
* packages/sdk/src/age.ts seals X25519 only, so a file with a Secure Enclave reader is
|
|
6
|
-
* made by `age -e -r <lock> -r <lock>…` — every reader on the one command line, so the
|
|
7
|
-
* file stays ONE age file per value with one stanza per reader (paper X25519 + the
|
|
8
|
-
* plugin's). The SDK still opens it with the paper identity: it skips a stanza it does not
|
|
9
|
-
* know as long as an X25519 one is there.
|
|
10
|
-
*
|
|
11
|
-
* Rules this file keeps:
|
|
12
|
-
* • argv arrays, never a shell; the value goes in on stdin and comes out on stdout —
|
|
13
|
-
* no temp file, no argument, no environment variable ever holds a plaintext.
|
|
14
|
-
* • `age`'s stderr is never read. A failure is an exit code and a FIXED message, because
|
|
15
|
-
* age's own text can echo an input.
|
|
16
|
-
* • A missing binary is a refusal (`no_age_binary` / `no_plugin`), never a silent drop of
|
|
17
|
-
* the device.
|
|
18
|
-
*/
|
|
19
|
-
export type AgePluginCode = 'no_age_binary' | 'no_plugin' | 'seal_failed' | 'open_failed';
|
|
20
|
-
/** A plugin failure: a code and one of the fixed messages above — never age's own text. */
|
|
21
|
-
export declare class AgePluginError extends Error {
|
|
22
|
-
readonly code: AgePluginCode;
|
|
23
|
-
constructor(code: AgePluginCode);
|
|
24
|
-
}
|
|
25
|
-
/** The lock of a Secure Enclave key. */
|
|
26
|
-
export declare const isPluginLock: (lock: string) => boolean;
|
|
27
|
-
/** The shape of an age1se1… lock (bech32 body) — checked before one is handed to `age`. */
|
|
28
|
-
export declare const PLUGIN_LOCK_RE: RegExp;
|
|
29
|
-
/** Test seam: replace the directories searched for the binaries (no PATH, no fallback). `undefined` restores. */
|
|
30
|
-
export declare function setSearchDirs(dirs: string[] | undefined): void;
|
|
31
|
-
/** Absolute path of an executable on PATH, then /opt/homebrew/bin; null when it is nowhere. */
|
|
32
|
-
export declare function findBinary(name: string): string | null;
|
|
33
|
-
/** The two programs, or the refusal that names the missing one. */
|
|
34
|
-
export declare function requireAge(needAge?: boolean): {
|
|
35
|
-
age: string;
|
|
36
|
-
plugin: string;
|
|
37
|
-
} | AgePluginCode;
|
|
38
|
-
/**
|
|
39
|
-
* Seal one value to every lock in a single `age -e` call; the result is one binary age
|
|
40
|
-
* file with a stanza per lock. Plain bytes go in on stdin only.
|
|
41
|
-
*/
|
|
42
|
-
export declare function sealWithAge(plain: Uint8Array, locks: string[]): Uint8Array;
|
|
43
|
-
/**
|
|
44
|
-
* Open one age file with an identity file (`age -d -i`). A Secure Enclave identity made
|
|
45
|
-
* with a biometry rule asks for the finger here. The plaintext comes back on stdout only.
|
|
46
|
-
*/
|
|
47
|
-
export declare function openWithAge(file: Uint8Array, identityPath: string): Uint8Array;
|
|
48
|
-
/** `age-plugin-se keygen --access-control <ac> -o <out>`; true when it exited 0. Output is never read. */
|
|
49
|
-
export declare function keygen(out: string, accessControl: string): boolean | AgePluginCode;
|
|
50
|
-
/** The `age1se1…` lock of an identity file (`age-plugin-se recipients -i`), or null. */
|
|
51
|
-
export declare function recipientOf(identityPath: string): string | null;
|
|
@@ -1,130 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* age-plugin.ts — seal to, and open with, an `age1se1…` Secure Enclave lock through the
|
|
3
|
-
* real `age` binary and `age-plugin-se` (text/secrets.md deliverable 3; text/secrets-todo.md § C3).
|
|
4
|
-
*
|
|
5
|
-
* packages/sdk/src/age.ts seals X25519 only, so a file with a Secure Enclave reader is
|
|
6
|
-
* made by `age -e -r <lock> -r <lock>…` — every reader on the one command line, so the
|
|
7
|
-
* file stays ONE age file per value with one stanza per reader (paper X25519 + the
|
|
8
|
-
* plugin's). The SDK still opens it with the paper identity: it skips a stanza it does not
|
|
9
|
-
* know as long as an X25519 one is there.
|
|
10
|
-
*
|
|
11
|
-
* Rules this file keeps:
|
|
12
|
-
* • argv arrays, never a shell; the value goes in on stdin and comes out on stdout —
|
|
13
|
-
* no temp file, no argument, no environment variable ever holds a plaintext.
|
|
14
|
-
* • `age`'s stderr is never read. A failure is an exit code and a FIXED message, because
|
|
15
|
-
* age's own text can echo an input.
|
|
16
|
-
* • A missing binary is a refusal (`no_age_binary` / `no_plugin`), never a silent drop of
|
|
17
|
-
* the device.
|
|
18
|
-
*/
|
|
19
|
-
import { spawnSync } from 'node:child_process';
|
|
20
|
-
import { accessSync, constants, statSync } from 'node:fs';
|
|
21
|
-
import { delimiter, dirname, join } from 'node:path';
|
|
22
|
-
import { MAX_INPUT_BYTES } from './message-seal.js';
|
|
23
|
-
const MESSAGES = {
|
|
24
|
-
no_age_binary: 'the `age` program is not installed — install it (brew install age) to seal to this Mac',
|
|
25
|
-
no_plugin: 'the `age-plugin-se` program is not installed — install it (brew install age-plugin-se) to use this Mac as a reader',
|
|
26
|
-
seal_failed: 'age could not seal this value to the Secure Enclave lock',
|
|
27
|
-
open_failed: 'age could not open this value with the Secure Enclave identity',
|
|
28
|
-
};
|
|
29
|
-
/** A plugin failure: a code and one of the fixed messages above — never age's own text. */
|
|
30
|
-
export class AgePluginError extends Error {
|
|
31
|
-
code;
|
|
32
|
-
constructor(code) {
|
|
33
|
-
super(MESSAGES[code]);
|
|
34
|
-
this.code = code;
|
|
35
|
-
this.name = 'AgePluginError';
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
/** The lock of a Secure Enclave key. */
|
|
39
|
-
export const isPluginLock = (lock) => lock.startsWith('age1se1');
|
|
40
|
-
/** The shape of an age1se1… lock (bech32 body) — checked before one is handed to `age`. */
|
|
41
|
-
export const PLUGIN_LOCK_RE = /^age1se1[02-9ac-hj-np-z]+$/;
|
|
42
|
-
const FALLBACK_DIRS = ['/opt/homebrew/bin', '/usr/local/bin'];
|
|
43
|
-
let dirsOverride;
|
|
44
|
-
/** Test seam: replace the directories searched for the binaries (no PATH, no fallback). `undefined` restores. */
|
|
45
|
-
export function setSearchDirs(dirs) {
|
|
46
|
-
dirsOverride = dirs;
|
|
47
|
-
}
|
|
48
|
-
function searchDirs() {
|
|
49
|
-
if (dirsOverride)
|
|
50
|
-
return dirsOverride;
|
|
51
|
-
return [...(process.env.PATH ?? '').split(delimiter).filter(Boolean), ...FALLBACK_DIRS];
|
|
52
|
-
}
|
|
53
|
-
/** Absolute path of an executable on PATH, then /opt/homebrew/bin; null when it is nowhere. */
|
|
54
|
-
export function findBinary(name) {
|
|
55
|
-
for (const d of searchDirs()) {
|
|
56
|
-
const p = join(d, name);
|
|
57
|
-
try {
|
|
58
|
-
if (!statSync(p).isFile())
|
|
59
|
-
continue;
|
|
60
|
-
accessSync(p, constants.X_OK);
|
|
61
|
-
return p;
|
|
62
|
-
}
|
|
63
|
-
catch {
|
|
64
|
-
/* next */
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
return null;
|
|
68
|
-
}
|
|
69
|
-
/** The two programs, or the refusal that names the missing one. */
|
|
70
|
-
export function requireAge(needAge = true) {
|
|
71
|
-
const plugin = findBinary('age-plugin-se');
|
|
72
|
-
if (!plugin)
|
|
73
|
-
return 'no_plugin';
|
|
74
|
-
const age = findBinary('age');
|
|
75
|
-
if (needAge && !age)
|
|
76
|
-
return 'no_age_binary';
|
|
77
|
-
return { age: age ?? '', plugin };
|
|
78
|
-
}
|
|
79
|
-
/** `age` finds `age-plugin-se` on PATH, so PATH leads with the directories the two were found in. */
|
|
80
|
-
function childEnv(bins) {
|
|
81
|
-
const dirs = [...new Set([bins.age && dirname(bins.age), dirname(bins.plugin)].filter(Boolean))];
|
|
82
|
-
return { ...process.env, PATH: [...dirs, process.env.PATH ?? ''].join(delimiter) };
|
|
83
|
-
}
|
|
84
|
-
const MAX_BUFFER = MAX_INPUT_BYTES * 2 + 1024 * 1024;
|
|
85
|
-
/**
|
|
86
|
-
* Seal one value to every lock in a single `age -e` call; the result is one binary age
|
|
87
|
-
* file with a stanza per lock. Plain bytes go in on stdin only.
|
|
88
|
-
*/
|
|
89
|
-
export function sealWithAge(plain, locks) {
|
|
90
|
-
const bins = requireAge();
|
|
91
|
-
if (typeof bins === 'string')
|
|
92
|
-
throw new AgePluginError(bins);
|
|
93
|
-
const argv = ['-e', ...locks.flatMap((l) => ['-r', l])];
|
|
94
|
-
const r = spawnSync(bins.age, argv, { input: plain, env: childEnv(bins), stdio: ['pipe', 'pipe', 'ignore'], maxBuffer: MAX_BUFFER });
|
|
95
|
-
if (r.error || r.status !== 0 || !r.stdout || r.stdout.length === 0)
|
|
96
|
-
throw new AgePluginError('seal_failed');
|
|
97
|
-
return new Uint8Array(r.stdout);
|
|
98
|
-
}
|
|
99
|
-
/**
|
|
100
|
-
* Open one age file with an identity file (`age -d -i`). A Secure Enclave identity made
|
|
101
|
-
* with a biometry rule asks for the finger here. The plaintext comes back on stdout only.
|
|
102
|
-
*/
|
|
103
|
-
export function openWithAge(file, identityPath) {
|
|
104
|
-
const bins = requireAge();
|
|
105
|
-
if (typeof bins === 'string')
|
|
106
|
-
throw new AgePluginError(bins);
|
|
107
|
-
const r = spawnSync(bins.age, ['-d', '-i', identityPath], { input: file, env: childEnv(bins), stdio: ['pipe', 'pipe', 'ignore'], maxBuffer: MAX_BUFFER });
|
|
108
|
-
if (r.error || r.status !== 0 || !r.stdout)
|
|
109
|
-
throw new AgePluginError('open_failed');
|
|
110
|
-
return new Uint8Array(r.stdout);
|
|
111
|
-
}
|
|
112
|
-
/** `age-plugin-se keygen --access-control <ac> -o <out>`; true when it exited 0. Output is never read. */
|
|
113
|
-
export function keygen(out, accessControl) {
|
|
114
|
-
const bins = requireAge();
|
|
115
|
-
if (typeof bins === 'string')
|
|
116
|
-
return bins;
|
|
117
|
-
const r = spawnSync(bins.plugin, ['keygen', '--access-control', accessControl, '-o', out], { env: childEnv(bins), stdio: ['ignore', 'ignore', 'ignore'] });
|
|
118
|
-
return !r.error && r.status === 0;
|
|
119
|
-
}
|
|
120
|
-
/** The `age1se1…` lock of an identity file (`age-plugin-se recipients -i`), or null. */
|
|
121
|
-
export function recipientOf(identityPath) {
|
|
122
|
-
const plugin = findBinary('age-plugin-se');
|
|
123
|
-
if (!plugin)
|
|
124
|
-
return null;
|
|
125
|
-
const r = spawnSync(plugin, ['recipients', '-i', identityPath], { stdio: ['ignore', 'pipe', 'ignore'] });
|
|
126
|
-
if (r.error || r.status !== 0)
|
|
127
|
-
return null;
|
|
128
|
-
const lock = r.stdout.toString('utf8').split(/\r?\n/).map((l) => l.trim()).find((l) => PLUGIN_LOCK_RE.test(l));
|
|
129
|
-
return lock ?? null;
|
|
130
|
-
}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
/** The specific coding agent driving this shell, if env vars name one. */
|
|
2
|
-
export declare function agentType(env?: NodeJS.ProcessEnv): string | undefined;
|
|
3
|
-
/** True when stdout isn't a human's terminal (agent shell, CI, piped) or a
|
|
4
|
-
* known agent env var is set — never used to gate a prompt, only the greeting. */
|
|
5
|
-
export declare function isAgentEnvironment(env?: NodeJS.ProcessEnv, isTTY?: boolean): boolean;
|
|
6
|
-
/**
|
|
7
|
-
* Why the 24 recovery words must NOT be written to this stdout, or null when it is
|
|
8
|
-
* a person's terminal. A shell whose env names an agent or CI is refused even with
|
|
9
|
-
* the pipe override: its stdout is a model context and a session log. This is
|
|
10
|
-
* detection, not proof — a pty with no marker set is not caught.
|
|
11
|
-
*/
|
|
12
|
-
export declare function wordsStdoutRefusal(env: NodeJS.ProcessEnv, isTTY: boolean, allowPipe: boolean): string | null;
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
// Port of legacy 3.8.3's agent-detection.js — env-var/TTY checks only, zero
|
|
2
|
-
// deps. Lets the bare `oneie` front door route each audience to its journey
|
|
3
|
-
// instead of dumping --help.
|
|
4
|
-
const AGENT_ENV_MARKERS = {
|
|
5
|
-
CLAUDECODE: 'claude-code',
|
|
6
|
-
CLAUDE_CODE: 'claude-code',
|
|
7
|
-
CURSOR_TRACE_ID: 'cursor',
|
|
8
|
-
WINDSURF: 'windsurf',
|
|
9
|
-
GITHUB_COPILOT_CLI: 'copilot',
|
|
10
|
-
// Codex sets CODEX_SANDBOX (to "seatbelt" on macOS) for the child processes of
|
|
11
|
-
// its sandboxed tool calls. UNDOCUMENTED, and absent when sandboxing is off —
|
|
12
|
-
// so this NAMES a Codex shell when it can and never gates on it. The gate is
|
|
13
|
-
// still the TTY check below, which already answered true for every Codex shell;
|
|
14
|
-
// what was missing was `agentType()` being able to say WHICH agent, which is
|
|
15
|
-
// what the front door routes on.
|
|
16
|
-
CODEX_SANDBOX: 'codex',
|
|
17
|
-
};
|
|
18
|
-
/** The specific coding agent driving this shell, if env vars name one. */
|
|
19
|
-
export function agentType(env = process.env) {
|
|
20
|
-
for (const [marker, name] of Object.entries(AGENT_ENV_MARKERS)) {
|
|
21
|
-
if (env[marker])
|
|
22
|
-
return name;
|
|
23
|
-
}
|
|
24
|
-
if (env.CI)
|
|
25
|
-
return 'ci';
|
|
26
|
-
return undefined;
|
|
27
|
-
}
|
|
28
|
-
/** True when stdout isn't a human's terminal (agent shell, CI, piped) or a
|
|
29
|
-
* known agent env var is set — never used to gate a prompt, only the greeting. */
|
|
30
|
-
export function isAgentEnvironment(env = process.env, isTTY = process.stdout.isTTY) {
|
|
31
|
-
return Boolean(agentType(env)) || !isTTY;
|
|
32
|
-
}
|
|
33
|
-
/**
|
|
34
|
-
* Why the 24 recovery words must NOT be written to this stdout, or null when it is
|
|
35
|
-
* a person's terminal. A shell whose env names an agent or CI is refused even with
|
|
36
|
-
* the pipe override: its stdout is a model context and a session log. This is
|
|
37
|
-
* detection, not proof — a pty with no marker set is not caught.
|
|
38
|
-
*/
|
|
39
|
-
export function wordsStdoutRefusal(env, isTTY, allowPipe) {
|
|
40
|
-
const agent = agentType(env);
|
|
41
|
-
if (agent) {
|
|
42
|
-
return `refusing to print the words: this shell is driven by ${agent}, and its stdout is a model context and a session log. Run it yourself in a terminal no agent drives`;
|
|
43
|
-
}
|
|
44
|
-
if (!isTTY && !allowPipe) {
|
|
45
|
-
return 'refusing to print the words: stdout is not a terminal (a pipe, a file or a log). Pass --yes-print-to-pipe if you are sending them to a printer on purpose';
|
|
46
|
-
}
|
|
47
|
-
return null;
|
|
48
|
-
}
|
package/dist/src/lib/api-path.js
DELETED
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
// The api.one.ie GATEWAY serves substrate ops at the short form (/ask/<receiver>,
|
|
2
|
-
// mapped internally to one-prod's /api/ask/<receiver> — api/src/substrate-binding.ts
|
|
3
|
-
// PATH_MAP). Calling /api/ask/ directly against the gateway 404s (verified live
|
|
4
|
-
// 2026-07-03). one.ie/web itself only answers the long form. Pick the path that
|
|
5
|
-
// matches whichever host --api actually points at, rather than hardcoding one.
|
|
6
|
-
export function askPath(base, receiver) {
|
|
7
|
-
const isGateway = new URL(base).hostname === 'api.one.ie';
|
|
8
|
-
return `${base}${isGateway ? '/ask' : '/api/ask'}/${encodeURIComponent(receiver)}`;
|
|
9
|
-
}
|
|
10
|
-
// The other substrate doors. They were written as one.ie/web's long form (/api/mark/…),
|
|
11
|
-
// which api.one.ie — the default base — answers 404; only /ask knew the host. The map is the
|
|
12
|
-
// inverse of api/src/substrate-binding.ts PATH_MAP, so a path the gateway serves is spelled the
|
|
13
|
-
// way the gateway serves it and every other host keeps the long form.
|
|
14
|
-
const GATEWAY_SHORT = [
|
|
15
|
-
['/api/export/groups', '/groups'],
|
|
16
|
-
['/api/export/actors', '/actors'],
|
|
17
|
-
['/api/export/paths', '/paths'],
|
|
18
|
-
['/api/signal', '/signal'],
|
|
19
|
-
['/api/mark', '/mark'],
|
|
20
|
-
['/api/warn', '/warn'],
|
|
21
|
-
['/api/fade', '/fade'],
|
|
22
|
-
['/api/sub', '/sub'],
|
|
23
|
-
['/api/follow', '/follow'],
|
|
24
|
-
['/api/select', '/select'],
|
|
25
|
-
['/api/things', '/things'],
|
|
26
|
-
['/api/events', '/events'],
|
|
27
|
-
['/api/learning', '/learning'],
|
|
28
|
-
];
|
|
29
|
-
export function substrateUrl(url) {
|
|
30
|
-
const u = new URL(url);
|
|
31
|
-
if (u.hostname !== 'api.one.ie')
|
|
32
|
-
return url;
|
|
33
|
-
for (const [long, short] of GATEWAY_SHORT) {
|
|
34
|
-
if (u.pathname === long || u.pathname.startsWith(`${long}/`)) {
|
|
35
|
-
u.pathname = short + u.pathname.slice(long.length);
|
|
36
|
-
return u.toString();
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
return url;
|
|
40
|
-
}
|
package/dist/src/lib/asker.d.ts
DELETED
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import { type Asker } from '@oneie/sdk/tasks-bulk';
|
|
2
|
-
export interface AskFailure {
|
|
3
|
-
retryable: boolean;
|
|
4
|
-
httpStatus: number;
|
|
5
|
-
error: string;
|
|
6
|
-
}
|
|
7
|
-
/** EX_TEMPFAIL — the exit code a caller can branch on to retry. */
|
|
8
|
-
export declare const RETRYABLE_EXIT = 75;
|
|
9
|
-
export declare class AskError extends Error {
|
|
10
|
-
readonly retryable: boolean;
|
|
11
|
-
readonly httpStatus: number;
|
|
12
|
-
readonly receiver: string;
|
|
13
|
-
constructor(receiver: string, f: AskFailure);
|
|
14
|
-
}
|
|
15
|
-
export declare function isRetryableStatus(status: number): boolean;
|
|
16
|
-
export declare function classifyResponse(receiver: string, status: number, text: string): {
|
|
17
|
-
ok: true;
|
|
18
|
-
body: unknown;
|
|
19
|
-
} | {
|
|
20
|
-
ok: false;
|
|
21
|
-
failure: AskFailure;
|
|
22
|
-
};
|
|
23
|
-
/**
|
|
24
|
-
* The verdict to attach to a message, or none. The CLI keeps the last failure in one
|
|
25
|
-
* slot; a message that does not carry that failure's text is about something else,
|
|
26
|
-
* and a stale 502 must never turn an unrelated refusal into "retry me".
|
|
27
|
-
*/
|
|
28
|
-
export declare function failureFor(msg: string, last: AskFailure | undefined): AskFailure | undefined;
|
|
29
|
-
export declare function exitCodeFor(f: AskFailure | undefined): number;
|
|
30
|
-
export declare function makeAsker(base: string, opts: {
|
|
31
|
-
fetchImpl?: typeof fetch;
|
|
32
|
-
headers: Record<string, string>;
|
|
33
|
-
onFailure?: (f: AskFailure) => void;
|
|
34
|
-
}): Asker;
|
package/dist/src/lib/asker.js
DELETED
|
@@ -1,126 +0,0 @@
|
|
|
1
|
-
import { unwrapAsk } from '@oneie/sdk/tasks-bulk';
|
|
2
|
-
import { askPath } from './api-path.js';
|
|
3
|
-
/** EX_TEMPFAIL — the exit code a caller can branch on to retry. */
|
|
4
|
-
export const RETRYABLE_EXIT = 75;
|
|
5
|
-
export class AskError extends Error {
|
|
6
|
-
retryable;
|
|
7
|
-
httpStatus;
|
|
8
|
-
receiver;
|
|
9
|
-
constructor(receiver, f) {
|
|
10
|
-
super(f.error);
|
|
11
|
-
this.name = 'AskError';
|
|
12
|
-
this.retryable = f.retryable;
|
|
13
|
-
this.httpStatus = f.httpStatus;
|
|
14
|
-
this.receiver = receiver;
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
export function isRetryableStatus(status) {
|
|
18
|
-
if (status === 0 || status === 408 || status === 429)
|
|
19
|
-
return true;
|
|
20
|
-
if (status === 502 || status === 503 || status === 504)
|
|
21
|
-
return true;
|
|
22
|
-
if (status >= 520 && status <= 529)
|
|
23
|
-
return true;
|
|
24
|
-
return false;
|
|
25
|
-
}
|
|
26
|
-
function extractTitleLabel(text) {
|
|
27
|
-
// Remove all HTML tags to get raw text
|
|
28
|
-
const noTags = text.replace(/<[^>]*>/g, '');
|
|
29
|
-
// Collapse whitespace
|
|
30
|
-
const collapsed = noTags.replace(/\s+/g, ' ').trim();
|
|
31
|
-
if (!collapsed)
|
|
32
|
-
return '';
|
|
33
|
-
// Try to extract title from original HTML
|
|
34
|
-
const titleMatch = text.match(/<title[^>]*>([^<]*)<\/title>/i);
|
|
35
|
-
if (titleMatch) {
|
|
36
|
-
const title = titleMatch[1].trim();
|
|
37
|
-
if (title)
|
|
38
|
-
return title.slice(0, 60);
|
|
39
|
-
}
|
|
40
|
-
return collapsed.slice(0, 60);
|
|
41
|
-
}
|
|
42
|
-
export function classifyResponse(receiver, status, text) {
|
|
43
|
-
let body;
|
|
44
|
-
let parseOk = false;
|
|
45
|
-
try {
|
|
46
|
-
body = text.length === 0 ? undefined : JSON.parse(text);
|
|
47
|
-
parseOk = true;
|
|
48
|
-
}
|
|
49
|
-
catch {
|
|
50
|
-
// not JSON
|
|
51
|
-
}
|
|
52
|
-
if (parseOk) {
|
|
53
|
-
// The door's own error envelope ({ ok:false, outcome, retryable, httpStatus },
|
|
54
|
-
// feat/collab-receivers 9623fe50b) carries `outcome` too — read its verdict
|
|
55
|
-
// before the pass-through below mistakes it for a receiver refusal.
|
|
56
|
-
const e = body;
|
|
57
|
-
if (e && typeof e === 'object' && e.ok === false && typeof e.retryable === 'boolean') {
|
|
58
|
-
const httpStatus = typeof e.httpStatus === 'number' ? e.httpStatus : status;
|
|
59
|
-
return { ok: false, failure: { retryable: e.retryable, httpStatus, error: `${receiver} → ${status} ${typeof e.error === 'string' ? e.error : 'error'}` } };
|
|
60
|
-
}
|
|
61
|
-
if (typeof body === 'object' && body !== null && 'outcome' in body) {
|
|
62
|
-
return { ok: true, body };
|
|
63
|
-
}
|
|
64
|
-
if (status >= 200 && status < 300) {
|
|
65
|
-
return { ok: true, body };
|
|
66
|
-
}
|
|
67
|
-
// failure: use body fields if present
|
|
68
|
-
const b = body;
|
|
69
|
-
const retryable = typeof b?.retryable === 'boolean' ? b.retryable : isRetryableStatus(status);
|
|
70
|
-
const httpStatus = typeof b?.httpStatus === 'number' ? b.httpStatus : status;
|
|
71
|
-
const errorMsg = typeof b?.error === 'string' ? b.error : 'error';
|
|
72
|
-
return {
|
|
73
|
-
ok: false,
|
|
74
|
-
failure: { retryable, httpStatus, error: `${receiver} → ${status} ${errorMsg}` },
|
|
75
|
-
};
|
|
76
|
-
}
|
|
77
|
-
// Non-JSON response
|
|
78
|
-
const label = extractTitleLabel(text);
|
|
79
|
-
const error = `${receiver} → ${status} non-JSON response (${label})`;
|
|
80
|
-
// Ensure no raw '<html>' appears
|
|
81
|
-
const cleanError = error.replace(/<html>/gi, '[html]');
|
|
82
|
-
return {
|
|
83
|
-
ok: false,
|
|
84
|
-
failure: { retryable: isRetryableStatus(status), httpStatus: status, error: cleanError },
|
|
85
|
-
};
|
|
86
|
-
}
|
|
87
|
-
/**
|
|
88
|
-
* The verdict to attach to a message, or none. The CLI keeps the last failure in one
|
|
89
|
-
* slot; a message that does not carry that failure's text is about something else,
|
|
90
|
-
* and a stale 502 must never turn an unrelated refusal into "retry me".
|
|
91
|
-
*/
|
|
92
|
-
export function failureFor(msg, last) {
|
|
93
|
-
return last && msg.includes(last.error) ? last : undefined;
|
|
94
|
-
}
|
|
95
|
-
export function exitCodeFor(f) {
|
|
96
|
-
return f?.retryable ? RETRYABLE_EXIT : 1;
|
|
97
|
-
}
|
|
98
|
-
export function makeAsker(base, opts) {
|
|
99
|
-
return async (receiver, data) => {
|
|
100
|
-
const url = askPath(base, receiver);
|
|
101
|
-
let res;
|
|
102
|
-
try {
|
|
103
|
-
res = await (opts.fetchImpl ?? fetch)(url, {
|
|
104
|
-
method: 'POST',
|
|
105
|
-
headers: opts.headers,
|
|
106
|
-
body: JSON.stringify({ data }),
|
|
107
|
-
});
|
|
108
|
-
}
|
|
109
|
-
catch (e) {
|
|
110
|
-
const failure = {
|
|
111
|
-
retryable: true,
|
|
112
|
-
httpStatus: 0,
|
|
113
|
-
error: `${receiver} → network: ${e instanceof Error ? e.message : String(e)}`,
|
|
114
|
-
};
|
|
115
|
-
opts.onFailure?.(failure);
|
|
116
|
-
throw new AskError(receiver, failure);
|
|
117
|
-
}
|
|
118
|
-
const text = await res.text();
|
|
119
|
-
const classified = classifyResponse(receiver, res.status, text);
|
|
120
|
-
if (!classified.ok) {
|
|
121
|
-
opts.onFailure?.(classified.failure);
|
|
122
|
-
throw new AskError(receiver, classified.failure);
|
|
123
|
-
}
|
|
124
|
-
return unwrapAsk(receiver, classified.body);
|
|
125
|
-
};
|
|
126
|
-
}
|
package/dist/src/lib/client.d.ts
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import type { Command } from 'commander';
|
|
2
|
-
/** --api flag > ONE_API_URL (canonical) > ONEIE_BASE_URL (legacy) > fallback. ONE_BASE_URL is retired. */
|
|
3
|
-
export declare function resolveBase(opts?: {
|
|
4
|
-
api?: string;
|
|
5
|
-
}, fallback?: string): string;
|
|
6
|
-
/** ONE_API_KEY (canonical) > ONEIE_API_KEY (legacy) > ~/.config/oneie/key. */
|
|
7
|
-
export declare function resolveKey(opts?: {
|
|
8
|
-
key?: string;
|
|
9
|
-
}): string;
|
|
10
|
-
export declare function authHeaders(opts?: {
|
|
11
|
-
key?: string;
|
|
12
|
-
}): Record<string, string>;
|
|
13
|
-
/** Walks cmd.parent all the way to root — never a fixed depth. ONEIE_JSON env is retired. */
|
|
14
|
-
export declare function jsonMode(cmd: Command): boolean;
|
|
15
|
-
/**
|
|
16
|
-
* ok/error human line (`ok k=v k=v`), or the same data as one JSON line under --json.
|
|
17
|
-
* `ok: false` exits 1 in BOTH modes — the JSON line is for the pipeline, the exit
|
|
18
|
-
* code for `$?`; 5.5.0 skipped it under --json and a refusal read as success.
|
|
19
|
-
*/
|
|
20
|
-
export declare function out(cmd: Command, data: Record<string, unknown>): void;
|
package/dist/src/lib/client.js
DELETED
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
import { readKeyFolder } from './keyfile.js';
|
|
2
|
-
import { readMachineKey } from './paths.js';
|
|
3
|
-
// Every command resolves base URL, key, and --json the same way — this module
|
|
4
|
-
// is the one place that knows the env contract. Composes askPath() from
|
|
5
|
-
// ./api-path.js for the gateway-vs-web path split; does not replace it.
|
|
6
|
-
// Path canon lives in lib/paths.ts — six modules used to each carry their own.
|
|
7
|
-
/** --api flag > ONE_API_URL (canonical) > ONEIE_BASE_URL (legacy) > fallback. ONE_BASE_URL is retired. */
|
|
8
|
-
export function resolveBase(opts = {}, fallback = 'https://one.ie') {
|
|
9
|
-
const base = opts.api ?? process.env.ONE_API_URL ?? process.env.ONEIE_BASE_URL ?? fallback;
|
|
10
|
-
return base.replace(/\/$/, '');
|
|
11
|
-
}
|
|
12
|
-
/** ONE_API_KEY (canonical) > ONEIE_API_KEY (legacy) > ~/.config/oneie/key. */
|
|
13
|
-
export function resolveKey(opts = {}) {
|
|
14
|
-
if (opts.key)
|
|
15
|
-
return opts.key;
|
|
16
|
-
if (process.env.ONE_API_KEY)
|
|
17
|
-
return process.env.ONE_API_KEY;
|
|
18
|
-
if (process.env.ONEIE_API_KEY)
|
|
19
|
-
return process.env.ONEIE_API_KEY;
|
|
20
|
-
// The PROJECT's key outranks the machine's. A folder that carries its own
|
|
21
|
-
// credential is saying "use mine", and `one init --dir .` wrote it there to
|
|
22
|
-
// narrow the blast radius — falling through to ~/.config/oneie/key would hand
|
|
23
|
-
// the command the machine-wide key instead and quietly undo that.
|
|
24
|
-
//
|
|
25
|
-
// Below the env vars on purpose: an explicit ONE_API_KEY in the shell is a
|
|
26
|
-
// deliberate override, and CI sets it that way.
|
|
27
|
-
const folder = readKeyFolder(process.cwd());
|
|
28
|
-
if (folder)
|
|
29
|
-
return folder.apiKey;
|
|
30
|
-
// readMachineKey tries ~/.config/one/key then the pre-rename ~/.config/oneie/key,
|
|
31
|
-
// so an upgrade does not silently log anyone out.
|
|
32
|
-
return readMachineKey();
|
|
33
|
-
}
|
|
34
|
-
export function authHeaders(opts = {}) {
|
|
35
|
-
const h = { 'Content-Type': 'application/json' };
|
|
36
|
-
const k = resolveKey(opts);
|
|
37
|
-
if (k)
|
|
38
|
-
h['Authorization'] = `Bearer ${k}`;
|
|
39
|
-
return h;
|
|
40
|
-
}
|
|
41
|
-
/** Walks cmd.parent all the way to root — never a fixed depth. ONEIE_JSON env is retired. */
|
|
42
|
-
export function jsonMode(cmd) {
|
|
43
|
-
let c = cmd;
|
|
44
|
-
while (c) {
|
|
45
|
-
if (c.opts().json)
|
|
46
|
-
return true;
|
|
47
|
-
c = c.parent ?? undefined;
|
|
48
|
-
}
|
|
49
|
-
return false;
|
|
50
|
-
}
|
|
51
|
-
/**
|
|
52
|
-
* ok/error human line (`ok k=v k=v`), or the same data as one JSON line under --json.
|
|
53
|
-
* `ok: false` exits 1 in BOTH modes — the JSON line is for the pipeline, the exit
|
|
54
|
-
* code for `$?`; 5.5.0 skipped it under --json and a refusal read as success.
|
|
55
|
-
*/
|
|
56
|
-
export function out(cmd, data) {
|
|
57
|
-
if (data.ok === false)
|
|
58
|
-
process.exitCode = 1;
|
|
59
|
-
if (jsonMode(cmd)) {
|
|
60
|
-
process.stdout.write(JSON.stringify(data) + '\n');
|
|
61
|
-
return;
|
|
62
|
-
}
|
|
63
|
-
if (data.ok === false) {
|
|
64
|
-
process.stderr.write(`error ${data.error ?? 'unknown'}\n`);
|
|
65
|
-
return;
|
|
66
|
-
}
|
|
67
|
-
const pairs = Object.entries(data)
|
|
68
|
-
.filter(([k]) => k !== 'ok')
|
|
69
|
-
.map(([k, v]) => `${k}=${JSON.stringify(v)}`);
|
|
70
|
-
process.stdout.write(`ok ${pairs.join(' ')}\n`);
|
|
71
|
-
}
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* env-sealed.ts — parse a plaintext .env, and write and read `.env.sealed` v1
|
|
3
|
-
* (text/secrets-plan.md § Data shape).
|
|
4
|
-
*
|
|
5
|
-
* # one-secrets v1
|
|
6
|
-
* # readers age1… age1…
|
|
7
|
-
* # vault <id> (only when one is known)
|
|
8
|
-
* NAME=age:<base64 of one binary age file>
|
|
9
|
-
*
|
|
10
|
-
* One age file per value, in the .env's own order; comments and blank lines are dropped.
|
|
11
|
-
* Names stay readable, values do not. Nothing here prints, logs or writes a value: every
|
|
12
|
-
* error names a line NUMBER, never a line, because a line of a .env is a secret.
|
|
13
|
-
*
|
|
14
|
-
* The age module loads lazily (same reason as message-seal.ts): `one secrets` is
|
|
15
|
-
* registered from index.ts, and a static `@oneie/sdk/age` import would crash every verb
|
|
16
|
-
* on an installed SDK that predates the export.
|
|
17
|
-
*/
|
|
18
|
-
import type { Fail } from './message-seal.js';
|
|
19
|
-
export declare const SEALED_HEADER = "# one-secrets v1";
|
|
20
|
-
export interface EnvEntry {
|
|
21
|
-
name: string;
|
|
22
|
-
value: string;
|
|
23
|
-
}
|
|
24
|
-
export interface SealedEntry {
|
|
25
|
-
name: string;
|
|
26
|
-
/** One binary age file. */
|
|
27
|
-
file: Uint8Array;
|
|
28
|
-
}
|
|
29
|
-
export interface SealedFile {
|
|
30
|
-
readers: string[];
|
|
31
|
-
vault?: string;
|
|
32
|
-
entries: SealedEntry[];
|
|
33
|
-
}
|
|
34
|
-
export declare const isVaultId: (v: string) => boolean;
|
|
35
|
-
/**
|
|
36
|
-
* Parse a .env the way dotenv reads it: `NAME=value`, an optional `export `, "double"
|
|
37
|
-
* quotes (with \n \r \t \" \\ escapes, may span lines), 'single' quotes (literal, may
|
|
38
|
-
* span lines), and unquoted values that end at whitespace-then-#. A value may hold `=`
|
|
39
|
-
* and `#`. Duplicate names are refused, never merged.
|
|
40
|
-
*/
|
|
41
|
-
export declare function parseEnv(text: string): EnvEntry[] | Fail;
|
|
42
|
-
/** The `.env.sealed` v1 text. */
|
|
43
|
-
export declare function renderSealed(f: SealedFile): string;
|
|
44
|
-
/** Read `.env.sealed` v1 back. Refuses anything that is not exactly the format. */
|
|
45
|
-
export declare function parseSealed(text: string): SealedFile | Fail;
|
|
46
|
-
/** Seal every value to every lock: one binary age file per value. */
|
|
47
|
-
export declare function sealEntries(entries: EnvEntry[], locks: string[]): Promise<SealedEntry[]>;
|
|
48
|
-
/**
|
|
49
|
-
* Open the sealed file's values with one identity and compare them to `expected` byte for
|
|
50
|
-
* byte — same names, same order, same count, every reader on every value. Returns null
|
|
51
|
-
* when it all holds, else a plain failure that names a variable, never a value.
|
|
52
|
-
*/
|
|
53
|
-
export declare function verifySealed(sealed: SealedFile, expected: EnvEntry[], secret: Uint8Array): Promise<Fail | null>;
|