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
package/dist/src/staff.js
DELETED
|
@@ -1,104 +0,0 @@
|
|
|
1
|
-
import { Command } from 'commander';
|
|
2
|
-
import { authHeaders, out, resolveBase, resolveKey } from './lib/client.js';
|
|
3
|
-
import { askPath } from './lib/api-path.js';
|
|
4
|
-
const DEFAULT_API = resolveBase({}, 'https://one.ie');
|
|
5
|
-
const VALID_ROLES = ['owner', 'admin', 'member', 'viewer'];
|
|
6
|
-
export function staffCmd() {
|
|
7
|
-
const cmd = new Command('staff').description('Workspace staff management');
|
|
8
|
-
cmd
|
|
9
|
-
.command('invite [email]')
|
|
10
|
-
.description('Invite a human to your workspace; omit email to get an invite URL without sending mail')
|
|
11
|
-
.option('--role <role>', `Role to assign: ${VALID_ROLES.join('|')}`, 'admin')
|
|
12
|
-
.option('--workspace <slug>', 'Workspace slug (defaults to authenticated workspace)')
|
|
13
|
-
.option('--dry-run', 'Print plan without sending invite')
|
|
14
|
-
.option('--api <url>', 'API base URL', DEFAULT_API)
|
|
15
|
-
.action(async (email, opts) => {
|
|
16
|
-
const role = opts.role;
|
|
17
|
-
if (!VALID_ROLES.includes(role)) {
|
|
18
|
-
out(cmd, { ok: false, error: `--role must be one of: ${VALID_ROLES.join(', ')}` });
|
|
19
|
-
return;
|
|
20
|
-
}
|
|
21
|
-
if (opts.dryRun) {
|
|
22
|
-
out(cmd, { ok: true, dry_run: true, email: email ?? '(url-only)', role, workspace: opts.workspace ?? '(authenticated)' });
|
|
23
|
-
return;
|
|
24
|
-
}
|
|
25
|
-
const key = resolveKey();
|
|
26
|
-
if (!key) {
|
|
27
|
-
out(cmd, { ok: false, error: 'no API key — set ONEIE_API_KEY or run: oneie auth login' });
|
|
28
|
-
return;
|
|
29
|
-
}
|
|
30
|
-
const base = opts.api.replace(/\/$/, '');
|
|
31
|
-
const body = { role };
|
|
32
|
-
if (email)
|
|
33
|
-
body.email = email;
|
|
34
|
-
if (opts.workspace)
|
|
35
|
-
body.workspace = opts.workspace;
|
|
36
|
-
const res = await fetch(askPath(base, 'world:invite-member'), {
|
|
37
|
-
method: 'POST',
|
|
38
|
-
headers: authHeaders({ key }),
|
|
39
|
-
body: JSON.stringify({ data: body }),
|
|
40
|
-
});
|
|
41
|
-
if (!res.ok) {
|
|
42
|
-
const text = await res.text().catch(() => '');
|
|
43
|
-
out(cmd, { ok: false, error: `${res.status}: ${text}` });
|
|
44
|
-
return;
|
|
45
|
-
}
|
|
46
|
-
const json = (await res.json());
|
|
47
|
-
if (json.error) {
|
|
48
|
-
out(cmd, { ok: false, error: json.error });
|
|
49
|
-
return;
|
|
50
|
-
}
|
|
51
|
-
const inviteUrl = json.inviteUrl ?? (json.token ? `${base}/join?token=${encodeURIComponent(json.token)}` : undefined);
|
|
52
|
-
out(cmd, { ok: true, email: email ?? '(url-only)', role, invite_url: inviteUrl ?? '(sent)' });
|
|
53
|
-
});
|
|
54
|
-
cmd
|
|
55
|
-
.command('add-agent <name>')
|
|
56
|
-
.description('Create an agent in your workspace and print its key once')
|
|
57
|
-
.option('--role <role>', `Role to assign: ${VALID_ROLES.join('|')}`, 'member')
|
|
58
|
-
.option('--workspace <slug>', 'Workspace slug (defaults to authenticated workspace)')
|
|
59
|
-
.option('--api <url>', 'API base URL', DEFAULT_API)
|
|
60
|
-
.action(async (name, opts) => {
|
|
61
|
-
const role = opts.role;
|
|
62
|
-
if (!VALID_ROLES.includes(role)) {
|
|
63
|
-
out(cmd, { ok: false, error: `--role must be one of: ${VALID_ROLES.join(', ')}` });
|
|
64
|
-
return;
|
|
65
|
-
}
|
|
66
|
-
const key = resolveKey();
|
|
67
|
-
if (!key) {
|
|
68
|
-
out(cmd, { ok: false, error: 'no API key — set ONEIE_API_KEY or run: oneie auth login' });
|
|
69
|
-
return;
|
|
70
|
-
}
|
|
71
|
-
const base = opts.api.replace(/\/$/, '');
|
|
72
|
-
const body = { name, role };
|
|
73
|
-
if (opts.workspace)
|
|
74
|
-
body.workspace = opts.workspace;
|
|
75
|
-
const res = await fetch(askPath(base, 'world:invite-agent'), {
|
|
76
|
-
method: 'POST',
|
|
77
|
-
headers: authHeaders({ key }),
|
|
78
|
-
body: JSON.stringify({ data: body }),
|
|
79
|
-
});
|
|
80
|
-
if (!res.ok) {
|
|
81
|
-
const text = await res.text().catch(() => '');
|
|
82
|
-
out(cmd, { ok: false, error: `${res.status}: ${text}` });
|
|
83
|
-
return;
|
|
84
|
-
}
|
|
85
|
-
const json = (await res.json());
|
|
86
|
-
if (json.error) {
|
|
87
|
-
out(cmd, { ok: false, error: json.error });
|
|
88
|
-
return;
|
|
89
|
-
}
|
|
90
|
-
const result = json.result ?? json;
|
|
91
|
-
// The ask door answers a refusal INSIDE result (`{outcome:"failure", result:{error,reason}}`)
|
|
92
|
-
// with HTTP 200 — read it, or a forbidden prints `aid=undefined key=undefined` as ok.
|
|
93
|
-
if (result.error) {
|
|
94
|
-
out(cmd, { ok: false, error: result.reason ?? result.error });
|
|
95
|
-
return;
|
|
96
|
-
}
|
|
97
|
-
if (!result.aid || !result.key) {
|
|
98
|
-
out(cmd, { ok: false, error: 'door answered without aid/key' });
|
|
99
|
-
return;
|
|
100
|
-
}
|
|
101
|
-
out(cmd, { ok: true, name, role, aid: result.aid, key: result.key });
|
|
102
|
-
});
|
|
103
|
-
return cmd;
|
|
104
|
-
}
|
package/dist/src/start.d.ts
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* `oneie start`, and bare `npx oneie`: the whole journey in the current folder —
|
|
3
|
-
* key → products → test sale → handover link. The logic is `lib/journey.ts`;
|
|
4
|
-
* this file is the wiring: disk, network, Keychain, and the printed receipt.
|
|
5
|
-
*
|
|
6
|
-
* The journey's key lives in THIS folder (`.one/agent.key`, 0600, git-ignored
|
|
7
|
-
* before it is written) and never in ~/.config/one/key — a stray run must not
|
|
8
|
-
* replace the machine key someone already logs in with.
|
|
9
|
-
*/
|
|
10
|
-
import { Command } from 'commander';
|
|
11
|
-
/** The flags bare `npx oneie --email …` hands to `start` — the journey's own, nothing else. */
|
|
12
|
-
export declare const START_FLAGS: Set<string>;
|
|
13
|
-
/** Bare `oneie`, or `oneie` led by a journey flag, runs `start`. Everything else is untouched. */
|
|
14
|
-
export declare function startArgv(argv: string[]): string[];
|
|
15
|
-
export declare function startCmd(): Command;
|
package/dist/src/start.js
DELETED
|
@@ -1,203 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* `oneie start`, and bare `npx oneie`: the whole journey in the current folder —
|
|
3
|
-
* key → products → test sale → handover link. The logic is `lib/journey.ts`;
|
|
4
|
-
* this file is the wiring: disk, network, Keychain, and the printed receipt.
|
|
5
|
-
*
|
|
6
|
-
* The journey's key lives in THIS folder (`.one/agent.key`, 0600, git-ignored
|
|
7
|
-
* before it is written) and never in ~/.config/one/key — a stray run must not
|
|
8
|
-
* replace the machine key someone already logs in with.
|
|
9
|
-
*/
|
|
10
|
-
import { Command } from 'commander';
|
|
11
|
-
import { chmodSync, existsSync, readFileSync, renameSync, writeFileSync } from 'node:fs';
|
|
12
|
-
import { join } from 'node:path';
|
|
13
|
-
import { askPath } from './lib/api-path.js';
|
|
14
|
-
import { jsonMode } from './lib/client.js';
|
|
15
|
-
import { KEY_DIR_NAME, KEY_FILE_NAME, LEGACY_KEY_DIR_NAME, META_FILE_NAME, readKeyFolder, writeKeyFolder } from './lib/keyfile.js';
|
|
16
|
-
import { keychainAvailable, readVaultFolder, vaultPath } from './lib/vaultfile.js';
|
|
17
|
-
import { cliPrefix } from './lib/invoked-as.js';
|
|
18
|
-
import { agentType } from './lib/agent-env.js';
|
|
19
|
-
import { provisionLocalWallet } from './init.js';
|
|
20
|
-
import { promptSecret, registerSealedWallet } from './wallet.js';
|
|
21
|
-
import { parseProductSpec, runJourney, } from './lib/journey.js';
|
|
22
|
-
import { asciiOf, haveNow, journeyIntro, journeyResume, journeyWords } from './lib/journey-words.js';
|
|
23
|
-
import { learnNetwork } from './lib/network.js';
|
|
24
|
-
const DEFAULT_API = process.env.ONEIE_BASE_URL ?? 'https://one.ie';
|
|
25
|
-
/** The flags bare `npx oneie --email …` hands to `start` — the journey's own, nothing else. */
|
|
26
|
-
export const START_FLAGS = new Set(['--name', '--email', '--product', '--currency', '--wait', '--api']);
|
|
27
|
-
/** Bare `oneie`, or `oneie` led by a journey flag, runs `start`. Everything else is untouched. */
|
|
28
|
-
export function startArgv(argv) {
|
|
29
|
-
// `--json` is the program's own flag, so it stays in front of the subcommand:
|
|
30
|
-
// `npx oneie --json` runs the journey in JSON instead of printing Usage.
|
|
31
|
-
const lead = argv[2] === '--json' ? 3 : 2;
|
|
32
|
-
const head = argv.slice(0, lead);
|
|
33
|
-
if (argv.length === lead)
|
|
34
|
-
return [...head, 'start'];
|
|
35
|
-
const first = argv[lead]?.split('=')[0] ?? '';
|
|
36
|
-
if (START_FLAGS.has(first))
|
|
37
|
-
return [...head, 'start', ...argv.slice(lead)];
|
|
38
|
-
return argv;
|
|
39
|
-
}
|
|
40
|
-
const statePath = (dir) => join(dir, KEY_DIR_NAME, 'journey.json');
|
|
41
|
-
function loadState(dir) {
|
|
42
|
-
const p = statePath(dir);
|
|
43
|
-
if (!existsSync(p))
|
|
44
|
-
return null;
|
|
45
|
-
try {
|
|
46
|
-
const s = JSON.parse(readFileSync(p, 'utf8'));
|
|
47
|
-
return s && s.v === 1 && typeof s.workspace === 'string' ? s : null;
|
|
48
|
-
}
|
|
49
|
-
catch {
|
|
50
|
-
return null;
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
/** 0600 and atomic: the state carries the owner link, which is a bearer credential. */
|
|
54
|
-
function saveState(dir, s) {
|
|
55
|
-
const p = statePath(dir);
|
|
56
|
-
const tmp = `${p}.${process.pid}.tmp`;
|
|
57
|
-
writeFileSync(tmp, JSON.stringify(s, null, 2) + '\n', { mode: 0o600 });
|
|
58
|
-
chmodSync(tmp, 0o600);
|
|
59
|
-
renameSync(tmp, p);
|
|
60
|
-
}
|
|
61
|
-
/**
|
|
62
|
-
* Keychain where there is one (Touch ID opens it, nothing is typed); a
|
|
63
|
-
* passphrase only at a real terminal. An agent shell elsewhere is refused by
|
|
64
|
-
* name — never downgraded to a plaintext file.
|
|
65
|
-
*/
|
|
66
|
-
async function walletStore(dir) {
|
|
67
|
-
if (keychainAvailable())
|
|
68
|
-
return { kind: 'keychain', dir };
|
|
69
|
-
if (!process.stdin.isTTY) {
|
|
70
|
-
return { error: 'no Apple Keychain here and no terminal to type a passphrase into — run `npx oneie wallet new` in your own terminal, then `npx oneie wallet register --kind agent`' };
|
|
71
|
-
}
|
|
72
|
-
const passphrase = await promptSecret('Choose a passphrase to lock your agent\'s wallet (8 characters or more): ');
|
|
73
|
-
if (passphrase !== (await promptSecret('Type it again: ')))
|
|
74
|
-
return { error: 'the two passphrases did not match, so no wallet was made. Run it again and type the same one twice' };
|
|
75
|
-
if (passphrase.length < 8)
|
|
76
|
-
return { error: 'that passphrase is shorter than 8 characters, so no wallet was made. Run it again with a longer one' };
|
|
77
|
-
return { kind: 'vault', dir, passphrase };
|
|
78
|
-
}
|
|
79
|
-
function deps(dir, api, say) {
|
|
80
|
-
return {
|
|
81
|
-
load: () => loadState(dir),
|
|
82
|
-
save: (s) => saveState(dir, s),
|
|
83
|
-
key: () => {
|
|
84
|
-
const f = readKeyFolder(dir);
|
|
85
|
-
if (!f)
|
|
86
|
-
return null;
|
|
87
|
-
const reg = f.meta.regKey;
|
|
88
|
-
return typeof reg === 'string' && reg ? reg : f.apiKey;
|
|
89
|
-
},
|
|
90
|
-
existingKey: () => {
|
|
91
|
-
for (const d of [KEY_DIR_NAME, LEGACY_KEY_DIR_NAME]) {
|
|
92
|
-
if (!existsSync(join(dir, d, KEY_FILE_NAME)))
|
|
93
|
-
continue;
|
|
94
|
-
try {
|
|
95
|
-
const meta = JSON.parse(readFileSync(join(dir, d, META_FILE_NAME), 'utf8'));
|
|
96
|
-
return typeof meta.workspace === 'string' ? meta.workspace : '';
|
|
97
|
-
}
|
|
98
|
-
catch {
|
|
99
|
-
return '';
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
return null;
|
|
103
|
-
},
|
|
104
|
-
provision: async (body) => {
|
|
105
|
-
say('Making your agent\'s key and its own group on one.ie…');
|
|
106
|
-
const res = await fetch(`${api}/api/provision/agent`, {
|
|
107
|
-
method: 'POST',
|
|
108
|
-
headers: { 'Content-Type': 'application/json' },
|
|
109
|
-
body: JSON.stringify(body),
|
|
110
|
-
});
|
|
111
|
-
const json = (await res.json().catch(() => ({})));
|
|
112
|
-
return { ok: res.ok, status: res.status, json };
|
|
113
|
-
},
|
|
114
|
-
saveKey: (p) => writeKeyFolder({ dir, api, ...p }),
|
|
115
|
-
wallet: async ({ key, workspace }) => {
|
|
116
|
-
// A wallet sealed on an earlier run whose registration did not land: open it
|
|
117
|
-
// (Touch ID for a Keychain seal) and register THAT one — minting again would
|
|
118
|
-
// be refused, and would leave the first wallet's addresses orphaned.
|
|
119
|
-
if (existsSync(vaultPath(dir))) {
|
|
120
|
-
say('Opening the wallet made on an earlier run. Touch ID may ask you to confirm…');
|
|
121
|
-
const r = await registerSealedWallet({ base: api, key, workspace, actor: workspace, dir });
|
|
122
|
-
return r.ok
|
|
123
|
-
? { ok: true, file: vaultPath(dir), keychain: readVaultFolder(dir)?.wrap === 'keychain', addresses: (r.addresses ?? {}) }
|
|
124
|
-
: { ok: false, file: vaultPath(dir), error: `${String(r.error ?? 'wallet:create refused')} — the sealed wallet is kept; run \`npx oneie\` again to retry` };
|
|
125
|
-
}
|
|
126
|
-
const store = await walletStore(dir);
|
|
127
|
-
if ('error' in store)
|
|
128
|
-
return { ok: false, error: store.error };
|
|
129
|
-
say(store.kind === 'keychain'
|
|
130
|
-
? 'Locking your agent\'s wallet in your Apple Keychain. Touch ID may ask you to confirm…'
|
|
131
|
-
: 'Locking your agent\'s wallet with your passphrase…');
|
|
132
|
-
return provisionLocalWallet({ api, key, workspace, store });
|
|
133
|
-
},
|
|
134
|
-
ask: async (key, receiver, data) => {
|
|
135
|
-
const res = await fetch(askPath(api, receiver), {
|
|
136
|
-
method: 'POST',
|
|
137
|
-
headers: { 'Content-Type': 'application/json', Authorization: `Bearer ${key}` },
|
|
138
|
-
body: JSON.stringify({ data }),
|
|
139
|
-
});
|
|
140
|
-
const body = (await res.json().catch(() => ({})));
|
|
141
|
-
// A transport-level refusal is its own outcome — never read as an empty success.
|
|
142
|
-
if (!res.ok)
|
|
143
|
-
return { outcome: `http_${res.status}`, error: String(body.error ?? body.detail ?? '') };
|
|
144
|
-
return body;
|
|
145
|
-
},
|
|
146
|
-
sleep: (ms) => new Promise((r) => setTimeout(r, ms)),
|
|
147
|
-
now: () => Date.now(),
|
|
148
|
-
};
|
|
149
|
-
}
|
|
150
|
-
export function startCmd() {
|
|
151
|
-
const cmd = new Command('start')
|
|
152
|
-
.description('Walk the whole path in this folder: your key, a product, a test sale, then one link that hands it over. Bare `npx oneie` runs it; run it again to pick up where you left off')
|
|
153
|
-
.option('--name <name>', 'Group / agent display name', 'My Shop')
|
|
154
|
-
.option('--email <email>', "The new owner's email — the handover link is sent there as well as printed")
|
|
155
|
-
.option('--product <name=price>', 'A product in major units, e.g. "Mug=12.50" (repeatable; default one Test product at 1.00)', (v, acc) => [...acc, v], [])
|
|
156
|
-
.option('--currency <iso>', 'ISO 4217 for --product prices', 'usd')
|
|
157
|
-
.option('--wait <seconds>', 'Keep reading back the test sale this long before stopping at pending (default: a re-run waits 20 s, a first run reads once)')
|
|
158
|
-
.option('--api <url>', 'API base URL', DEFAULT_API)
|
|
159
|
-
.action(async (opts, sub) => {
|
|
160
|
-
const products = [];
|
|
161
|
-
for (const raw of opts.product) {
|
|
162
|
-
const p = parseProductSpec(raw, opts.currency);
|
|
163
|
-
if (!p.ok) {
|
|
164
|
-
if (jsonMode(sub))
|
|
165
|
-
process.stdout.write(JSON.stringify({ ok: false, error: p.error }) + '\n');
|
|
166
|
-
else
|
|
167
|
-
process.stderr.write(`✗ ${p.error}\n`);
|
|
168
|
-
process.exitCode = 1;
|
|
169
|
-
return;
|
|
170
|
-
}
|
|
171
|
-
products.push(p.product);
|
|
172
|
-
}
|
|
173
|
-
const api = opts.api.replace(/\/$/, '');
|
|
174
|
-
const json = jsonMode(sub);
|
|
175
|
-
const cli = cliPrefix();
|
|
176
|
-
// A pipe, a log or NO_COLOR gets plain ASCII: the same words, no box or glyph it cannot draw.
|
|
177
|
-
const plain = !process.stdout.isTTY || 'NO_COLOR' in process.env;
|
|
178
|
-
const fmt = (text) => (plain ? asciiOf(text) : text);
|
|
179
|
-
if (!json) {
|
|
180
|
-
const earlier = loadState(process.cwd());
|
|
181
|
-
process.stdout.write(fmt(earlier ? journeyResume(earlier.workspace) : journeyIntro(cli)));
|
|
182
|
-
}
|
|
183
|
-
// The network shapes the words and `have.network`; asked now, in parallel with the walk, never blocking it.
|
|
184
|
-
const netP = learnNetwork(api);
|
|
185
|
-
const say = json ? () => { } : (line) => process.stderr.write(` ${fmt(line)}\n`);
|
|
186
|
-
const report = await runJourney(deps(process.cwd(), api, say), {
|
|
187
|
-
api,
|
|
188
|
-
name: opts.name,
|
|
189
|
-
...(opts.email ? { email: opts.email } : {}),
|
|
190
|
-
products,
|
|
191
|
-
...(opts.wait !== undefined ? { waitSeconds: Math.max(0, Number(opts.wait) || 0) } : {}),
|
|
192
|
-
});
|
|
193
|
-
const net = await netP;
|
|
194
|
-
// `have` is additive: every fact the panel prints, in full, beside the report's own keys.
|
|
195
|
-
if (json)
|
|
196
|
-
process.stdout.write(JSON.stringify({ ...report, have: haveNow(report, cli, { net }) }) + '\n');
|
|
197
|
-
else
|
|
198
|
-
process.stdout.write(fmt('\n' + journeyWords(report, cli, { agent: agentType(), net })));
|
|
199
|
-
if (!report.ok)
|
|
200
|
-
process.exitCode = 1;
|
|
201
|
-
});
|
|
202
|
-
return cmd;
|
|
203
|
-
}
|
package/dist/src/status.d.ts
DELETED
package/dist/src/status.js
DELETED
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
import { Command } from 'commander';
|
|
2
|
-
import { mergeEnv } from './env.js';
|
|
3
|
-
import { renderStatus } from './render.js';
|
|
4
|
-
import { askPath } from './lib/api-path.js';
|
|
5
|
-
const DEFAULT_API = process.env.ONEIE_BASE_URL ?? process.env.ONE_API_URL ?? 'https://one.ie';
|
|
6
|
-
export function statusCmd() {
|
|
7
|
-
return new Command('status')
|
|
8
|
-
.description('Agency P&L dashboard (pool, margin, per-client burns)')
|
|
9
|
-
.option('--api <url>', 'API base URL', DEFAULT_API)
|
|
10
|
-
.option('--key <key>', 'API key (overrides ONEIE_API_KEY env)')
|
|
11
|
-
.option('--json', 'Output raw JSON')
|
|
12
|
-
.action(async (opts) => {
|
|
13
|
-
const dir = process.cwd();
|
|
14
|
-
const env = mergeEnv(dir);
|
|
15
|
-
const key = opts.key ?? env.ONEIE_API_KEY ?? env.ONE_API_KEY ?? '';
|
|
16
|
-
if (!key || !env.AGENCY_SLUG) {
|
|
17
|
-
process.stderr.write('not set up — run `one setup` first\n');
|
|
18
|
-
process.exit(1);
|
|
19
|
-
}
|
|
20
|
-
const base = opts.api.replace(/\/$/, '');
|
|
21
|
-
// slug is required for staff/owner keys — without it the receiver resolves
|
|
22
|
-
// the key's personal workspace and returns an empty portfolio.
|
|
23
|
-
const res = await fetch(askPath(base, 'billing:clients'), {
|
|
24
|
-
method: 'POST',
|
|
25
|
-
headers: { 'Content-Type': 'application/json', Authorization: `Bearer ${key}` },
|
|
26
|
-
body: JSON.stringify({ data: { slug: env.AGENCY_SLUG } }),
|
|
27
|
-
});
|
|
28
|
-
if (!res.ok) {
|
|
29
|
-
process.stderr.write(`billing:clients → ${res.status}\n`);
|
|
30
|
-
process.exit(1);
|
|
31
|
-
}
|
|
32
|
-
const json = await res.json();
|
|
33
|
-
if (json.outcome === 'failure') {
|
|
34
|
-
const result = (json.result ?? {});
|
|
35
|
-
const details = Object.entries(result)
|
|
36
|
-
.map(([k, v]) => `${k}=${typeof v === 'string' ? v : JSON.stringify(v)}`)
|
|
37
|
-
.join(' ');
|
|
38
|
-
process.stderr.write(`billing:clients → forbidden: ${details}\n`);
|
|
39
|
-
process.exit(1);
|
|
40
|
-
}
|
|
41
|
-
if (opts.json) {
|
|
42
|
-
process.stdout.write(JSON.stringify(json, null, 2) + '\n');
|
|
43
|
-
return;
|
|
44
|
-
}
|
|
45
|
-
// Receiver replies in the four-outcome envelope: { outcome, result: { agency, clients } }.
|
|
46
|
-
// Unwrap it (keep the bare-shape fallback for older hosts).
|
|
47
|
-
const payload = (json.result ?? json);
|
|
48
|
-
const agency = (payload.agency ?? { slug: env.AGENCY_SLUG, name: env.AGENCY_NAME ?? null, markup_pct: 0, pool: 0, plan: 'free' });
|
|
49
|
-
const clients = (payload.clients ?? []);
|
|
50
|
-
process.stdout.write(renderStatus(agency, clients) + '\n');
|
|
51
|
-
});
|
|
52
|
-
}
|
package/dist/src/substrate.d.ts
DELETED
package/dist/src/substrate.js
DELETED
|
@@ -1,258 +0,0 @@
|
|
|
1
|
-
import { authHeaders, resolveBase, resolveKey } from './lib/client.js';
|
|
2
|
-
import { askPath, substrateUrl } from './lib/api-path.js';
|
|
3
|
-
import { sendMessage } from './message.js';
|
|
4
|
-
const DEFAULT_API = resolveBase({}, 'https://api.one.ie');
|
|
5
|
-
function base(opts) {
|
|
6
|
-
return resolveBase(opts, 'https://api.one.ie');
|
|
7
|
-
}
|
|
8
|
-
async function api(url, init) {
|
|
9
|
-
const res = await fetch(substrateUrl(url), { headers: authHeaders(), ...init });
|
|
10
|
-
if (!res.ok) {
|
|
11
|
-
const body = await res.text().catch(() => '');
|
|
12
|
-
process.stderr.write(`${init?.method ?? 'GET'} ${url} → ${res.status}\n${body}\n`);
|
|
13
|
-
process.exit(1);
|
|
14
|
-
}
|
|
15
|
-
const ct = res.headers.get('content-type') ?? '';
|
|
16
|
-
return ct.includes('json') ? res.json() : res.text();
|
|
17
|
-
}
|
|
18
|
-
function out(data) {
|
|
19
|
-
process.stdout.write(JSON.stringify(data, null, 2) + '\n');
|
|
20
|
-
}
|
|
21
|
-
function parseJson(raw, flag) {
|
|
22
|
-
try {
|
|
23
|
-
return JSON.parse(raw);
|
|
24
|
-
}
|
|
25
|
-
catch {
|
|
26
|
-
process.stderr.write(`error: ${flag} must be valid JSON\n`);
|
|
27
|
-
process.exit(1);
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
async function readStdin() {
|
|
31
|
-
return new Promise((resolve) => {
|
|
32
|
-
let buf = '';
|
|
33
|
-
process.stdin.setEncoding('utf8');
|
|
34
|
-
process.stdin.on('data', (chunk) => { buf += chunk; });
|
|
35
|
-
process.stdin.on('end', () => resolve(buf.trim()));
|
|
36
|
-
});
|
|
37
|
-
}
|
|
38
|
-
export function substrateCommands(program) {
|
|
39
|
-
program
|
|
40
|
-
.command('signal <receiver>')
|
|
41
|
-
.description('Fire-and-forget signal to any receiver')
|
|
42
|
-
.option('--data <json>', 'Signal data as JSON. Use "-" to read from stdin.')
|
|
43
|
-
.option('--api <url>', 'API base URL', DEFAULT_API)
|
|
44
|
-
.action(async (receiver, opts) => {
|
|
45
|
-
let data;
|
|
46
|
-
if (opts.data === '-')
|
|
47
|
-
data = parseJson(await readStdin(), '--data');
|
|
48
|
-
else if (opts.data)
|
|
49
|
-
data = parseJson(opts.data, '--data');
|
|
50
|
-
out(await api(`${base(opts)}/api/signal/${encodeURIComponent(receiver)}`, {
|
|
51
|
-
method: 'POST',
|
|
52
|
-
body: JSON.stringify({ data }),
|
|
53
|
-
}));
|
|
54
|
-
});
|
|
55
|
-
program
|
|
56
|
-
.command('ask <receiver>')
|
|
57
|
-
.description('Signal + wait for outcome (result | timeout | dissolved | failure)')
|
|
58
|
-
.option('--data <json>', 'Signal data as JSON. Use "-" to read from stdin.')
|
|
59
|
-
.option('--timeout <ms>', 'Timeout in milliseconds', '10000')
|
|
60
|
-
.option('--api <url>', 'API base URL', DEFAULT_API)
|
|
61
|
-
.action(async (receiver, opts) => {
|
|
62
|
-
let data;
|
|
63
|
-
if (opts.data === '-')
|
|
64
|
-
data = parseJson(await readStdin(), '--data');
|
|
65
|
-
else if (opts.data)
|
|
66
|
-
data = parseJson(opts.data, '--data');
|
|
67
|
-
out(await api(askPath(base(opts), receiver), {
|
|
68
|
-
method: 'POST',
|
|
69
|
-
body: JSON.stringify({ data, timeoutMs: Number(opts.timeout) }),
|
|
70
|
-
}));
|
|
71
|
-
});
|
|
72
|
-
program
|
|
73
|
-
.command('message <text...>')
|
|
74
|
-
.description('Say anything — the router picks who answers, the answer prints here')
|
|
75
|
-
.option('--json', 'Print the whole reply as JSON')
|
|
76
|
-
.option('--api <url>', 'API base URL', DEFAULT_API)
|
|
77
|
-
.action(async (words, opts) => {
|
|
78
|
-
const code = await sendMessage(words.join(' '), {
|
|
79
|
-
fetch, key: resolveKey(), base: base(opts),
|
|
80
|
-
stdout: (s) => process.stdout.write(s), stderr: (s) => process.stderr.write(s + '\n'),
|
|
81
|
-
}, { json: opts.json });
|
|
82
|
-
process.exit(code);
|
|
83
|
-
});
|
|
84
|
-
program
|
|
85
|
-
.command('mark <edge>')
|
|
86
|
-
.description('Strengthen a path. Edge format: source>target')
|
|
87
|
-
.option('--strength <n>', 'Strength value', '1')
|
|
88
|
-
.option('--api <url>', 'API base URL', DEFAULT_API)
|
|
89
|
-
.action(async (edge, opts) => {
|
|
90
|
-
out(await api(`${base(opts)}/api/mark/${encodeURIComponent(edge)}`, {
|
|
91
|
-
method: 'POST',
|
|
92
|
-
body: JSON.stringify({ strength: Number(opts.strength) }),
|
|
93
|
-
}));
|
|
94
|
-
});
|
|
95
|
-
program
|
|
96
|
-
.command('warn <edge>')
|
|
97
|
-
.description('Raise resistance on a path. Edge format: source>target')
|
|
98
|
-
.option('--strength <n>', 'Strength value', '1')
|
|
99
|
-
.option('--api <url>', 'API base URL', DEFAULT_API)
|
|
100
|
-
.action(async (edge, opts) => {
|
|
101
|
-
out(await api(`${base(opts)}/api/warn/${encodeURIComponent(edge)}`, {
|
|
102
|
-
method: 'POST',
|
|
103
|
-
body: JSON.stringify({ strength: Number(opts.strength) }),
|
|
104
|
-
}));
|
|
105
|
-
});
|
|
106
|
-
program
|
|
107
|
-
.command('fade')
|
|
108
|
-
.description('Asymmetric decay of all paths')
|
|
109
|
-
.option('--rate <n>', 'Decay rate 0–1')
|
|
110
|
-
.option('--api <url>', 'API base URL', DEFAULT_API)
|
|
111
|
-
.action(async (opts) => {
|
|
112
|
-
out(await api(`${base(opts)}/api/fade`, {
|
|
113
|
-
method: 'POST',
|
|
114
|
-
body: JSON.stringify({ rate: opts.rate !== undefined ? Number(opts.rate) : undefined }),
|
|
115
|
-
}));
|
|
116
|
-
});
|
|
117
|
-
program
|
|
118
|
-
.command('sub <tag> <actor>')
|
|
119
|
-
.description('Subscribe an actor to a tag')
|
|
120
|
-
.option('--scope <scope>', 'private | public', 'private')
|
|
121
|
-
.option('--api <url>', 'API base URL', DEFAULT_API)
|
|
122
|
-
.action(async (tag, actor, opts) => {
|
|
123
|
-
out(await api(`${base(opts)}/api/sub`, {
|
|
124
|
-
method: 'POST',
|
|
125
|
-
body: JSON.stringify({ receiver: actor, tags: [tag], scope: opts.scope }),
|
|
126
|
-
}));
|
|
127
|
-
});
|
|
128
|
-
program
|
|
129
|
-
.command('follow <type>')
|
|
130
|
-
.description('Deterministic path selection — strongest path for a type')
|
|
131
|
-
.option('--api <url>', 'API base URL', DEFAULT_API)
|
|
132
|
-
.action(async (type, opts) => {
|
|
133
|
-
out(await api(`${base(opts)}/api/follow?tag=${encodeURIComponent(type)}`));
|
|
134
|
-
});
|
|
135
|
-
program
|
|
136
|
-
.command('select <type>')
|
|
137
|
-
.description('Probabilistic path selection (strength-weighted)')
|
|
138
|
-
.option('--exploration <n>', 'Exploration factor 0–1')
|
|
139
|
-
.option('--api <url>', 'API base URL', DEFAULT_API)
|
|
140
|
-
.action(async (type, opts) => {
|
|
141
|
-
// The route reads `tag` (api/select.ts:11); sending `type` was silently ignored.
|
|
142
|
-
const q = new URLSearchParams({ tag: type });
|
|
143
|
-
if (opts.exploration)
|
|
144
|
-
q.set('exploration', opts.exploration);
|
|
145
|
-
out(await api(`${base(opts)}/api/select?${q}`));
|
|
146
|
-
});
|
|
147
|
-
program
|
|
148
|
-
.command('groups')
|
|
149
|
-
.description('List groups (dimension 1 — containers)')
|
|
150
|
-
.option('--type <type>')
|
|
151
|
-
.option('--limit <n>', 'Max results', '20')
|
|
152
|
-
.option('--after <cursor>', 'Pagination cursor')
|
|
153
|
-
.option('--api <url>', 'API base URL', DEFAULT_API)
|
|
154
|
-
.action(async (opts) => {
|
|
155
|
-
const q = new URLSearchParams({ limit: opts.limit });
|
|
156
|
-
if (opts.type)
|
|
157
|
-
q.set('type', opts.type);
|
|
158
|
-
if (opts.after)
|
|
159
|
-
q.set('after', opts.after);
|
|
160
|
-
out(await api(`${base(opts)}/api/export/groups?${q}`));
|
|
161
|
-
});
|
|
162
|
-
program
|
|
163
|
-
.command('actors')
|
|
164
|
-
.description('List actors (dimension 2 — humans, agents, bots)')
|
|
165
|
-
.option('--type <type>')
|
|
166
|
-
.option('--tag <tag>')
|
|
167
|
-
.option('--limit <n>', 'Max results', '20')
|
|
168
|
-
.option('--after <cursor>')
|
|
169
|
-
.option('--api <url>', 'API base URL', DEFAULT_API)
|
|
170
|
-
.action(async (opts) => {
|
|
171
|
-
const q = new URLSearchParams({ limit: opts.limit });
|
|
172
|
-
if (opts.type)
|
|
173
|
-
q.set('type', opts.type);
|
|
174
|
-
if (opts.tag)
|
|
175
|
-
q.set('tag', opts.tag);
|
|
176
|
-
if (opts.after)
|
|
177
|
-
q.set('after', opts.after);
|
|
178
|
-
out(await api(`${base(opts)}/api/export/actors?${q}`));
|
|
179
|
-
});
|
|
180
|
-
program
|
|
181
|
-
.command('things')
|
|
182
|
-
.description('List things (dimension 3 — skills, tasks, tokens)')
|
|
183
|
-
.option('--type <type>')
|
|
184
|
-
.option('--tag <tag>')
|
|
185
|
-
.option('--limit <n>', 'Max results', '20')
|
|
186
|
-
.option('--after <cursor>')
|
|
187
|
-
.option('--api <url>', 'API base URL', DEFAULT_API)
|
|
188
|
-
.action(async (opts) => {
|
|
189
|
-
const q = new URLSearchParams({ limit: opts.limit });
|
|
190
|
-
if (opts.type)
|
|
191
|
-
q.set('type', opts.type);
|
|
192
|
-
if (opts.tag)
|
|
193
|
-
q.set('tag', opts.tag);
|
|
194
|
-
if (opts.after)
|
|
195
|
-
q.set('after', opts.after);
|
|
196
|
-
out(await api(`${base(opts)}/api/things?${q}`));
|
|
197
|
-
});
|
|
198
|
-
program
|
|
199
|
-
.command('paths')
|
|
200
|
-
.description('List paths (dimension 4 — weighted connections)')
|
|
201
|
-
.option('--source <source>')
|
|
202
|
-
.option('--target <target>')
|
|
203
|
-
.option('--min-strength <n>', 'Minimum strength filter')
|
|
204
|
-
.option('--limit <n>', 'Max results', '20')
|
|
205
|
-
.option('--after <cursor>')
|
|
206
|
-
.option('--api <url>', 'API base URL', DEFAULT_API)
|
|
207
|
-
.action(async (opts) => {
|
|
208
|
-
const q = new URLSearchParams({ limit: opts.limit });
|
|
209
|
-
if (opts.source)
|
|
210
|
-
q.set('source', opts.source);
|
|
211
|
-
if (opts.target)
|
|
212
|
-
q.set('target', opts.target);
|
|
213
|
-
if (opts.minStrength)
|
|
214
|
-
q.set('minStrength', opts.minStrength);
|
|
215
|
-
if (opts.after)
|
|
216
|
-
q.set('after', opts.after);
|
|
217
|
-
out(await api(`${base(opts)}/api/export/paths?${q}`));
|
|
218
|
-
});
|
|
219
|
-
program
|
|
220
|
-
.command('events')
|
|
221
|
-
.description('List events (dimension 5 — signals, payments)')
|
|
222
|
-
.option('--actor <actor>')
|
|
223
|
-
.option('--tag <tag>')
|
|
224
|
-
.option('--from <iso>', 'ISO timestamp filter from')
|
|
225
|
-
.option('--to <iso>', 'ISO timestamp filter to')
|
|
226
|
-
.option('--limit <n>', 'Max results', '20')
|
|
227
|
-
.option('--api <url>', 'API base URL', DEFAULT_API)
|
|
228
|
-
.action(async (opts) => {
|
|
229
|
-
const q = new URLSearchParams({ limit: opts.limit });
|
|
230
|
-
if (opts.actor)
|
|
231
|
-
q.set('actor', opts.actor);
|
|
232
|
-
if (opts.tag)
|
|
233
|
-
q.set('tag', opts.tag);
|
|
234
|
-
if (opts.from)
|
|
235
|
-
q.set('from', opts.from);
|
|
236
|
-
if (opts.to)
|
|
237
|
-
q.set('to', opts.to);
|
|
238
|
-
out(await api(`${base(opts)}/api/events?${q}`));
|
|
239
|
-
});
|
|
240
|
-
program
|
|
241
|
-
.command('learning')
|
|
242
|
-
.description('List hypotheses (dimension 6 — what was discovered)')
|
|
243
|
-
.option('--status <status>', 'pending | testing | confirmed | rejected')
|
|
244
|
-
.option('--actor <actor>')
|
|
245
|
-
.option('--tag <tag>')
|
|
246
|
-
.option('--limit <n>', 'Max results', '20')
|
|
247
|
-
.option('--api <url>', 'API base URL', DEFAULT_API)
|
|
248
|
-
.action(async (opts) => {
|
|
249
|
-
const q = new URLSearchParams({ limit: opts.limit });
|
|
250
|
-
if (opts.status)
|
|
251
|
-
q.set('status', opts.status);
|
|
252
|
-
if (opts.actor)
|
|
253
|
-
q.set('actor', opts.actor);
|
|
254
|
-
if (opts.tag)
|
|
255
|
-
q.set('tag', opts.tag);
|
|
256
|
-
out(await api(`${base(opts)}/api/learning?${q}`));
|
|
257
|
-
});
|
|
258
|
-
}
|