@haven_ai/cli 0.1.34-alpha.0 → 0.1.35-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +269 -10
- package/dist/cli.cjs +872 -128
- package/dist/cli.cjs.map +1 -1
- package/dist/cli.js +872 -128
- package/dist/cli.js.map +1 -1
- package/dist/index.cjs +854 -119
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +62 -1
- package/dist/index.d.ts +62 -1
- package/dist/index.js +854 -119
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.d.cts
CHANGED
|
@@ -1,6 +1,15 @@
|
|
|
1
1
|
declare class CliApiError extends Error {
|
|
2
2
|
status: number;
|
|
3
|
-
|
|
3
|
+
/**
|
|
4
|
+
* The parsed response body, when there was one (#2526).
|
|
5
|
+
*
|
|
6
|
+
* The message is built FROM `body.error` for humans, and the device flow
|
|
7
|
+
* needs the same value as DATA: `authorization_pending` and `slow_down` are
|
|
8
|
+
* control signals in a poll loop, and branching on them by matching the
|
|
9
|
+
* message string would make the loop depend on prose that is free to change.
|
|
10
|
+
*/
|
|
11
|
+
body?: unknown;
|
|
12
|
+
constructor(message: string, status: number, body?: unknown);
|
|
4
13
|
}
|
|
5
14
|
interface CliApi {
|
|
6
15
|
get<T>(path: string): Promise<T>;
|
|
@@ -47,11 +56,23 @@ declare function sessionPath(homeDir?: string): string;
|
|
|
47
56
|
/** File-backed session store, owner-only perms (0600 file in a 0700 dir). */
|
|
48
57
|
declare function createSessionStore(homeDir?: string): SessionStore;
|
|
49
58
|
|
|
59
|
+
interface Spawner {
|
|
60
|
+
(command: string, args: string[], onStderr: (chunk: string) => void): Promise<{
|
|
61
|
+
stdout: string;
|
|
62
|
+
stderr: string;
|
|
63
|
+
exitCode: number;
|
|
64
|
+
}>;
|
|
65
|
+
}
|
|
66
|
+
|
|
50
67
|
interface RunDeps {
|
|
51
68
|
sessionStore?: SessionStore;
|
|
52
69
|
/** Build an API client; injected so tests can stub the backend. */
|
|
53
70
|
makeApi?: (baseUrl: string, token?: string) => CliApi;
|
|
54
71
|
promptPassword?: () => Promise<string>;
|
|
72
|
+
/** #2526: injected so the device poll loop is testable without real time. */
|
|
73
|
+
sleep?: (ms: number) => Promise<void>;
|
|
74
|
+
/** #2527: injected so `--run` is testable without spawning a real process. */
|
|
75
|
+
spawner?: Spawner;
|
|
55
76
|
out?: (line: string) => void;
|
|
56
77
|
err?: (line: string) => void;
|
|
57
78
|
env?: NodeJS.ProcessEnv;
|
|
@@ -66,6 +87,20 @@ interface ParsedArgs {
|
|
|
66
87
|
flags: {
|
|
67
88
|
json: boolean;
|
|
68
89
|
help: boolean;
|
|
90
|
+
/** #2526: print the code and exit instead of polling for approval. */
|
|
91
|
+
noWait: boolean;
|
|
92
|
+
/** #2527: run the printed connector command as a child process. */
|
|
93
|
+
run: boolean;
|
|
94
|
+
/** #2527: poll `agents connect --status` until it settles. */
|
|
95
|
+
wait: boolean;
|
|
96
|
+
/**
|
|
97
|
+
* #2612: list the delegation HASHES on `budget show`, which is the only
|
|
98
|
+
* thing `budget revoke` accepts as its second argument. Behind a flag
|
|
99
|
+
* because `budget show --json` has emitted a bare allowances array since
|
|
100
|
+
* the first CLI scaffold, and a second shape on the same command would
|
|
101
|
+
* break every existing consumer of it.
|
|
102
|
+
*/
|
|
103
|
+
hashes: boolean;
|
|
69
104
|
version: boolean;
|
|
70
105
|
yes: boolean;
|
|
71
106
|
api?: string;
|
|
@@ -79,6 +114,32 @@ interface ParsedArgs {
|
|
|
79
114
|
from?: string;
|
|
80
115
|
to?: string;
|
|
81
116
|
company?: string;
|
|
117
|
+
/** #2527 */
|
|
118
|
+
name?: string;
|
|
119
|
+
budget?: string;
|
|
120
|
+
token?: string;
|
|
121
|
+
period?: number;
|
|
122
|
+
status?: string;
|
|
123
|
+
/**
|
|
124
|
+
* #2539: the budget magnitude for `budget grant`, in whole tokens as you
|
|
125
|
+
* would say it (`25` is 25 USDC) — parsed to atomic units with decimals
|
|
126
|
+
* read from the backend, exactly like `agents connect`'s --budget. Named
|
|
127
|
+
* --amount because the issue's command sketch does, and because a grant
|
|
128
|
+
* is not the same decision as a connect.
|
|
129
|
+
*/
|
|
130
|
+
amount?: string;
|
|
131
|
+
/**
|
|
132
|
+
* #2539: optional recipient pin for `budget grant`. An ADDRESS the budget
|
|
133
|
+
* may pay and nobody else — the caveat enforcer set at build time. Absent
|
|
134
|
+
* means an open budget, exactly like the dashboard form's blank field.
|
|
135
|
+
*/
|
|
136
|
+
recipient?: string;
|
|
137
|
+
/**
|
|
138
|
+
* #2539: optional expiry (unix seconds) for `budget grant`. Absent lets
|
|
139
|
+
* the backend default (now + 90 days), the same default the dashboard's
|
|
140
|
+
* builds get.
|
|
141
|
+
*/
|
|
142
|
+
expires?: number;
|
|
82
143
|
};
|
|
83
144
|
}
|
|
84
145
|
/**
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,15 @@
|
|
|
1
1
|
declare class CliApiError extends Error {
|
|
2
2
|
status: number;
|
|
3
|
-
|
|
3
|
+
/**
|
|
4
|
+
* The parsed response body, when there was one (#2526).
|
|
5
|
+
*
|
|
6
|
+
* The message is built FROM `body.error` for humans, and the device flow
|
|
7
|
+
* needs the same value as DATA: `authorization_pending` and `slow_down` are
|
|
8
|
+
* control signals in a poll loop, and branching on them by matching the
|
|
9
|
+
* message string would make the loop depend on prose that is free to change.
|
|
10
|
+
*/
|
|
11
|
+
body?: unknown;
|
|
12
|
+
constructor(message: string, status: number, body?: unknown);
|
|
4
13
|
}
|
|
5
14
|
interface CliApi {
|
|
6
15
|
get<T>(path: string): Promise<T>;
|
|
@@ -47,11 +56,23 @@ declare function sessionPath(homeDir?: string): string;
|
|
|
47
56
|
/** File-backed session store, owner-only perms (0600 file in a 0700 dir). */
|
|
48
57
|
declare function createSessionStore(homeDir?: string): SessionStore;
|
|
49
58
|
|
|
59
|
+
interface Spawner {
|
|
60
|
+
(command: string, args: string[], onStderr: (chunk: string) => void): Promise<{
|
|
61
|
+
stdout: string;
|
|
62
|
+
stderr: string;
|
|
63
|
+
exitCode: number;
|
|
64
|
+
}>;
|
|
65
|
+
}
|
|
66
|
+
|
|
50
67
|
interface RunDeps {
|
|
51
68
|
sessionStore?: SessionStore;
|
|
52
69
|
/** Build an API client; injected so tests can stub the backend. */
|
|
53
70
|
makeApi?: (baseUrl: string, token?: string) => CliApi;
|
|
54
71
|
promptPassword?: () => Promise<string>;
|
|
72
|
+
/** #2526: injected so the device poll loop is testable without real time. */
|
|
73
|
+
sleep?: (ms: number) => Promise<void>;
|
|
74
|
+
/** #2527: injected so `--run` is testable without spawning a real process. */
|
|
75
|
+
spawner?: Spawner;
|
|
55
76
|
out?: (line: string) => void;
|
|
56
77
|
err?: (line: string) => void;
|
|
57
78
|
env?: NodeJS.ProcessEnv;
|
|
@@ -66,6 +87,20 @@ interface ParsedArgs {
|
|
|
66
87
|
flags: {
|
|
67
88
|
json: boolean;
|
|
68
89
|
help: boolean;
|
|
90
|
+
/** #2526: print the code and exit instead of polling for approval. */
|
|
91
|
+
noWait: boolean;
|
|
92
|
+
/** #2527: run the printed connector command as a child process. */
|
|
93
|
+
run: boolean;
|
|
94
|
+
/** #2527: poll `agents connect --status` until it settles. */
|
|
95
|
+
wait: boolean;
|
|
96
|
+
/**
|
|
97
|
+
* #2612: list the delegation HASHES on `budget show`, which is the only
|
|
98
|
+
* thing `budget revoke` accepts as its second argument. Behind a flag
|
|
99
|
+
* because `budget show --json` has emitted a bare allowances array since
|
|
100
|
+
* the first CLI scaffold, and a second shape on the same command would
|
|
101
|
+
* break every existing consumer of it.
|
|
102
|
+
*/
|
|
103
|
+
hashes: boolean;
|
|
69
104
|
version: boolean;
|
|
70
105
|
yes: boolean;
|
|
71
106
|
api?: string;
|
|
@@ -79,6 +114,32 @@ interface ParsedArgs {
|
|
|
79
114
|
from?: string;
|
|
80
115
|
to?: string;
|
|
81
116
|
company?: string;
|
|
117
|
+
/** #2527 */
|
|
118
|
+
name?: string;
|
|
119
|
+
budget?: string;
|
|
120
|
+
token?: string;
|
|
121
|
+
period?: number;
|
|
122
|
+
status?: string;
|
|
123
|
+
/**
|
|
124
|
+
* #2539: the budget magnitude for `budget grant`, in whole tokens as you
|
|
125
|
+
* would say it (`25` is 25 USDC) — parsed to atomic units with decimals
|
|
126
|
+
* read from the backend, exactly like `agents connect`'s --budget. Named
|
|
127
|
+
* --amount because the issue's command sketch does, and because a grant
|
|
128
|
+
* is not the same decision as a connect.
|
|
129
|
+
*/
|
|
130
|
+
amount?: string;
|
|
131
|
+
/**
|
|
132
|
+
* #2539: optional recipient pin for `budget grant`. An ADDRESS the budget
|
|
133
|
+
* may pay and nobody else — the caveat enforcer set at build time. Absent
|
|
134
|
+
* means an open budget, exactly like the dashboard form's blank field.
|
|
135
|
+
*/
|
|
136
|
+
recipient?: string;
|
|
137
|
+
/**
|
|
138
|
+
* #2539: optional expiry (unix seconds) for `budget grant`. Absent lets
|
|
139
|
+
* the backend default (now + 90 days), the same default the dashboard's
|
|
140
|
+
* builds get.
|
|
141
|
+
*/
|
|
142
|
+
expires?: number;
|
|
82
143
|
};
|
|
83
144
|
}
|
|
84
145
|
/**
|