@opvs-ai/cli 0.16.1 → 0.21.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 +61 -3
- package/dist/.build-stamp.json +5 -5
- package/dist/commands/agent.js +6 -5
- package/dist/commands/agent.js.map +1 -1
- package/dist/commands/auth.js +230 -74
- package/dist/commands/auth.js.map +1 -1
- package/dist/commands/boards.js +21 -13
- package/dist/commands/boards.js.map +1 -1
- package/dist/commands/code.d.ts +23 -0
- package/dist/commands/code.js +90 -0
- package/dist/commands/code.js.map +1 -0
- package/dist/commands/columns.d.ts +1 -0
- package/dist/commands/columns.js +48 -2
- package/dist/commands/columns.js.map +1 -1
- package/dist/commands/docs.js +6 -4
- package/dist/commands/docs.js.map +1 -1
- package/dist/commands/env.d.ts +2 -0
- package/dist/commands/env.js +61 -0
- package/dist/commands/env.js.map +1 -0
- package/dist/commands/markers.js +13 -3
- package/dist/commands/markers.js.map +1 -1
- package/dist/commands/projects.js +57 -12
- package/dist/commands/projects.js.map +1 -1
- package/dist/commands/tasks.js +5 -2
- package/dist/commands/tasks.js.map +1 -1
- package/dist/commands/tools.js +29 -3
- package/dist/commands/tools.js.map +1 -1
- package/dist/index.js +4 -0
- package/dist/index.js.map +1 -1
- package/dist/lib/auth-poll.d.ts +25 -3
- package/dist/lib/auth-poll.js +39 -6
- package/dist/lib/auth-poll.js.map +1 -1
- package/dist/lib/health.d.ts +131 -1
- package/dist/lib/health.js +192 -3
- package/dist/lib/health.js.map +1 -1
- package/dist/lib/pending-auth.d.ts +41 -0
- package/dist/lib/pending-auth.js +69 -0
- package/dist/lib/pending-auth.js.map +1 -0
- package/package.json +3 -3
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A PAT request that is still waiting for a human to approve it (PC-252).
|
|
3
|
+
*
|
|
4
|
+
* The server keeps a request approvable for an hour, because the person who
|
|
5
|
+
* approves is usually someone else, reading email on a phone. The CLI must not
|
|
6
|
+
* sit polling for that hour — an agent's shell call is killed long before, and
|
|
7
|
+
* an hour of silent polling is a hang, not a feature. So `auth request` waits a
|
|
8
|
+
* bounded time (`--wait`, default 5 min) and then hands off: this file keeps
|
|
9
|
+
* what is needed to collect the token later with `opvs auth resume`.
|
|
10
|
+
*
|
|
11
|
+
* It is written BEFORE the first poll, so a process killed mid-wait (a tool-call
|
|
12
|
+
* timeout) still leaves a request that can be resumed. It holds the poll token —
|
|
13
|
+
* a bearer secret that fetches the PAT once approved — so it is written 0600,
|
|
14
|
+
* like a key file, and removed the moment the request settles either way.
|
|
15
|
+
*
|
|
16
|
+
* One pending request at a time: a new `auth request` replaces the old one,
|
|
17
|
+
* which matches what the approver is told — "approve the newest email".
|
|
18
|
+
*/
|
|
19
|
+
export interface PendingAuth {
|
|
20
|
+
request_id: string;
|
|
21
|
+
poll_token: string;
|
|
22
|
+
api_url: string;
|
|
23
|
+
/** ISO timestamp from the server — when the request stops being approvable. */
|
|
24
|
+
expires_at: string;
|
|
25
|
+
/** Who was emailed, so a resume can say whose inbox to check. */
|
|
26
|
+
owner_email: string;
|
|
27
|
+
/** `-w <slug>` flow: the workspace the token is saved under. `null` for the email-only flow. */
|
|
28
|
+
workspace_slug: string | null;
|
|
29
|
+
/** Email-only flow: the workspaces the server matched (fallback slug for a single-token answer). */
|
|
30
|
+
brands: Array<{
|
|
31
|
+
brand_slug: string;
|
|
32
|
+
brand_name?: string;
|
|
33
|
+
brand_id?: number;
|
|
34
|
+
}>;
|
|
35
|
+
created_at: string;
|
|
36
|
+
}
|
|
37
|
+
export declare function pendingAuthPath(): string;
|
|
38
|
+
export declare function savePendingAuth(pending: PendingAuth, path?: string): void;
|
|
39
|
+
/** The saved request, or `null` when there is none — or it is unreadable, which is the same thing to a caller. */
|
|
40
|
+
export declare function loadPendingAuth(path?: string): PendingAuth | null;
|
|
41
|
+
export declare function clearPendingAuth(path?: string): void;
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A PAT request that is still waiting for a human to approve it (PC-252).
|
|
3
|
+
*
|
|
4
|
+
* The server keeps a request approvable for an hour, because the person who
|
|
5
|
+
* approves is usually someone else, reading email on a phone. The CLI must not
|
|
6
|
+
* sit polling for that hour — an agent's shell call is killed long before, and
|
|
7
|
+
* an hour of silent polling is a hang, not a feature. So `auth request` waits a
|
|
8
|
+
* bounded time (`--wait`, default 5 min) and then hands off: this file keeps
|
|
9
|
+
* what is needed to collect the token later with `opvs auth resume`.
|
|
10
|
+
*
|
|
11
|
+
* It is written BEFORE the first poll, so a process killed mid-wait (a tool-call
|
|
12
|
+
* timeout) still leaves a request that can be resumed. It holds the poll token —
|
|
13
|
+
* a bearer secret that fetches the PAT once approved — so it is written 0600,
|
|
14
|
+
* like a key file, and removed the moment the request settles either way.
|
|
15
|
+
*
|
|
16
|
+
* One pending request at a time: a new `auth request` replaces the old one,
|
|
17
|
+
* which matches what the approver is told — "approve the newest email".
|
|
18
|
+
*/
|
|
19
|
+
import { chmodSync, mkdirSync, readFileSync, rmSync, writeFileSync } from "node:fs";
|
|
20
|
+
import { dirname, join } from "node:path";
|
|
21
|
+
import { getConfigPath } from "@opvs-ai/core";
|
|
22
|
+
export function pendingAuthPath() {
|
|
23
|
+
return join(dirname(getConfigPath()), "pending-auth.json");
|
|
24
|
+
}
|
|
25
|
+
export function savePendingAuth(pending, path = pendingAuthPath()) {
|
|
26
|
+
mkdirSync(dirname(path), { recursive: true, mode: 0o700 });
|
|
27
|
+
writeFileSync(path, JSON.stringify(pending, null, 2) + "\n", { mode: 0o600 });
|
|
28
|
+
// `mode` above applies only when the file is created; a file left by an older
|
|
29
|
+
// run keeps whatever bits it had.
|
|
30
|
+
chmodSync(path, 0o600);
|
|
31
|
+
}
|
|
32
|
+
/** The saved request, or `null` when there is none — or it is unreadable, which is the same thing to a caller. */
|
|
33
|
+
export function loadPendingAuth(path = pendingAuthPath()) {
|
|
34
|
+
let raw;
|
|
35
|
+
try {
|
|
36
|
+
raw = readFileSync(path, "utf8");
|
|
37
|
+
}
|
|
38
|
+
catch {
|
|
39
|
+
return null;
|
|
40
|
+
}
|
|
41
|
+
let p;
|
|
42
|
+
try {
|
|
43
|
+
p = JSON.parse(raw);
|
|
44
|
+
}
|
|
45
|
+
catch {
|
|
46
|
+
return null;
|
|
47
|
+
}
|
|
48
|
+
if (!p ||
|
|
49
|
+
typeof p.request_id !== "string" ||
|
|
50
|
+
typeof p.poll_token !== "string" ||
|
|
51
|
+
typeof p.api_url !== "string" ||
|
|
52
|
+
typeof p.expires_at !== "string") {
|
|
53
|
+
return null;
|
|
54
|
+
}
|
|
55
|
+
return {
|
|
56
|
+
request_id: p.request_id,
|
|
57
|
+
poll_token: p.poll_token,
|
|
58
|
+
api_url: p.api_url,
|
|
59
|
+
expires_at: p.expires_at,
|
|
60
|
+
owner_email: typeof p.owner_email === "string" ? p.owner_email : "",
|
|
61
|
+
workspace_slug: typeof p.workspace_slug === "string" ? p.workspace_slug : null,
|
|
62
|
+
brands: Array.isArray(p.brands) ? p.brands : [],
|
|
63
|
+
created_at: typeof p.created_at === "string" ? p.created_at : "",
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
export function clearPendingAuth(path = pendingAuthPath()) {
|
|
67
|
+
rmSync(path, { force: true });
|
|
68
|
+
}
|
|
69
|
+
//# sourceMappingURL=pending-auth.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pending-auth.js","sourceRoot":"","sources":["../../src/lib/pending-auth.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AACpF,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAiB9C,MAAM,UAAU,eAAe;IAC7B,OAAO,IAAI,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AC,CAAC,OAAO;QAClB,UAAU,EAAE,CAAC,CAAC,UAAU;QACxB,WAAW,EAAE,OAAO,CAAC,CAAC,WAAW,KAAK,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,EAAE;QACnE,cAAc,EAAE,OAAO,CAAC,CAAC,cAAc,KAAK,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC,CAAC,IAAI;QAC9E,MAAM,EAAE,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE;QAC/C,UAAU,EAAE,OAAO,CAAC,CAAC,UAAU,KAAK,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,EAAE;KACjE,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,gBAAgB,CAAC,OAAe,eAAe,EAAE;IAC/D,MAAM,CAAC,IAAI,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;AAChC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@opvs-ai/cli",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"description": "OPVS CLI
|
|
3
|
+
"version": "0.21.0",
|
|
4
|
+
"description": "OPVS CLI — Terminal access to AgentBoard + AgentDocs for AI coding agents",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
7
7
|
"opvs": "dist/index.js"
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
"test:watch": "vitest"
|
|
15
15
|
},
|
|
16
16
|
"dependencies": {
|
|
17
|
-
"@opvs-ai/core": "^0.4.
|
|
17
|
+
"@opvs-ai/core": "^0.4.9",
|
|
18
18
|
"commander": "^12.1.0"
|
|
19
19
|
},
|
|
20
20
|
"devDependencies": {
|