@oneie/cli 5.7.0 → 5.7.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/dist/package.json +1 -1
- package/dist/src/lib/invoked-as.js +8 -1
- package/dist/src/start.js +8 -4
- package/dist/src/wallet.d.ts +11 -0
- package/dist/src/wallet.js +14 -6
- package/package.json +1 -1
package/dist/package.json
CHANGED
|
@@ -12,6 +12,13 @@
|
|
|
12
12
|
* back to `npx oneie`, which still runs.
|
|
13
13
|
*/
|
|
14
14
|
import { basename } from 'node:path';
|
|
15
|
+
/** A runner's package cache (npx · bunx · pnpm dlx): the bin it started is not on PATH. */
|
|
16
|
+
const EPHEMERAL = /[\\/](_npx|bunx-[^\\/]*|dlx)[\\/]/;
|
|
15
17
|
export function cliPrefix(argv = process.argv) {
|
|
16
|
-
|
|
18
|
+
const bin = argv[1] ?? '';
|
|
19
|
+
// `npx oneie` starts `.bin/one` (measured 2026-11-03 with oneie@5.7.0 — two bins,
|
|
20
|
+
// npx picked `one`), so the bin name alone said `one` in the one case it is wrong.
|
|
21
|
+
if (EPHEMERAL.test(bin))
|
|
22
|
+
return 'npx oneie';
|
|
23
|
+
return basename(bin) === 'one' ? 'one' : 'npx oneie';
|
|
17
24
|
}
|
package/dist/src/start.js
CHANGED
|
@@ -23,11 +23,15 @@ const DEFAULT_API = process.env.ONEIE_BASE_URL ?? 'https://one.ie';
|
|
|
23
23
|
export const START_FLAGS = new Set(['--name', '--email', '--product', '--currency', '--wait', '--api']);
|
|
24
24
|
/** Bare `oneie`, or `oneie` led by a journey flag, runs `start`. Everything else is untouched. */
|
|
25
25
|
export function startArgv(argv) {
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
const
|
|
26
|
+
// `--json` is the program's own flag, so it stays in front of the subcommand:
|
|
27
|
+
// `npx oneie --json` runs the journey in JSON instead of printing Usage.
|
|
28
|
+
const lead = argv[2] === '--json' ? 3 : 2;
|
|
29
|
+
const head = argv.slice(0, lead);
|
|
30
|
+
if (argv.length === lead)
|
|
31
|
+
return [...head, 'start'];
|
|
32
|
+
const first = argv[lead]?.split('=')[0] ?? '';
|
|
29
33
|
if (START_FLAGS.has(first))
|
|
30
|
-
return [
|
|
34
|
+
return [...head, 'start', ...argv.slice(lead)];
|
|
31
35
|
return argv;
|
|
32
36
|
}
|
|
33
37
|
const statePath = (dir) => join(dir, KEY_DIR_NAME, 'journey.json');
|
package/dist/src/wallet.d.ts
CHANGED
|
@@ -3,6 +3,17 @@ import { type Derivation, type GeneratedWallet } from '@oneie/sdk/wallet';
|
|
|
3
3
|
import { type VaultBlob, type SealOpts } from '@oneie/sdk/vault-file';
|
|
4
4
|
import { askPath } from './lib/api-path.js';
|
|
5
5
|
export { askPath };
|
|
6
|
+
type AskEnvelope = {
|
|
7
|
+
outcome?: string;
|
|
8
|
+
result?: Record<string, unknown>;
|
|
9
|
+
error?: string;
|
|
10
|
+
};
|
|
11
|
+
/**
|
|
12
|
+
* The refusal as the server said it. `wallet:send → failure` alone hid the reason —
|
|
13
|
+
* measured 2026-11-03 (text/agent-path.md § Stop 8): the server had answered
|
|
14
|
+
* `forbidden · requires manage_workspace · callerRole agent · "Requires the owner role"`.
|
|
15
|
+
*/
|
|
16
|
+
export declare function refusalMessage(receiver: string, envelope: AskEnvelope): string;
|
|
6
17
|
/**
|
|
7
18
|
* A FRESH mint is born v2 — the same as one.ie (`NEW_MASTER_DERIVATION` in
|
|
8
19
|
* one.ie/web/src/lib/derive-multichain.ts). Before this the CLI minted v1 and the
|
package/dist/src/wallet.js
CHANGED
|
@@ -14,9 +14,18 @@ const DEFAULT_API = process.env.ONEIE_BASE_URL ?? process.env.ONE_API_URL ?? 'ht
|
|
|
14
14
|
// in ./lib/api-path.ts so trade.ts/client.ts/coordinate.ts/catalog.ts can share
|
|
15
15
|
// it instead of each hardcoding /api/ask/<receiver> against DEFAULT_API.
|
|
16
16
|
export { askPath };
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
17
|
+
/**
|
|
18
|
+
* The refusal as the server said it. `wallet:send → failure` alone hid the reason —
|
|
19
|
+
* measured 2026-11-03 (text/agent-path.md § Stop 8): the server had answered
|
|
20
|
+
* `forbidden · requires manage_workspace · callerRole agent · "Requires the owner role"`.
|
|
21
|
+
*/
|
|
22
|
+
export function refusalMessage(receiver, envelope) {
|
|
23
|
+
const r = envelope.result ?? {};
|
|
24
|
+
const why = [r.error ?? envelope.error, r.required && `requires ${String(r.required)}`, r.callerRole && `you are ${String(r.callerRole)}`]
|
|
25
|
+
.filter(Boolean).map(String);
|
|
26
|
+
const hint = typeof r.hint === 'string' ? ` — ${r.hint}` : '';
|
|
27
|
+
return `${receiver} → ${envelope.outcome}${why.length ? `: ${why.join(' · ')}` : ''}${hint}`;
|
|
28
|
+
}
|
|
20
29
|
async function ask(base, key, receiver, data) {
|
|
21
30
|
const res = await fetch(askPath(base, receiver), {
|
|
22
31
|
method: 'POST',
|
|
@@ -28,9 +37,8 @@ async function ask(base, key, receiver, data) {
|
|
|
28
37
|
throw new Error(`${receiver} → ${res.status}\n${body}`);
|
|
29
38
|
}
|
|
30
39
|
const envelope = (await res.json());
|
|
31
|
-
if (envelope.outcome && envelope.outcome !== 'result')
|
|
32
|
-
throw new Error(
|
|
33
|
-
}
|
|
40
|
+
if (envelope.outcome && envelope.outcome !== 'result')
|
|
41
|
+
throw new Error(refusalMessage(receiver, envelope));
|
|
34
42
|
return envelope.result ?? envelope;
|
|
35
43
|
}
|
|
36
44
|
const DEFAULT_PAY = process.env.ONEIE_PAY_URL ?? 'https://pay.one.ie';
|