cawdev-cli 0.9.0 → 1.0.1-beta
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 +4 -171
- package/lib/cawdev.mjs +1 -1
- package/lib/run-plugin.mjs +40 -0
- package/lib/usage-report.mjs +27 -0
- package/lib/version.mjs +48 -0
- package/mcp/server.mjs +1 -1
- package/package.json +5 -2
- package/runner/README.md +56 -0
- package/runner/attach.mjs +443 -2
- package/runner/banner.mjs +11 -1
- package/runner/bootstrap.mjs +70 -35
- package/runner/cawdev.mjs +216 -20
- package/runner/configure.mjs +412 -0
- package/runner/paths.mjs +254 -0
- package/runner/runner.mjs +834 -136
- package/runner/token-store.mjs +14 -2
package/runner/token-store.mjs
CHANGED
|
@@ -60,6 +60,18 @@ export async function loadToken(url) {
|
|
|
60
60
|
return typeof stored?.token === 'string' && stored.token ? stored.token : null;
|
|
61
61
|
}
|
|
62
62
|
|
|
63
|
+
/**
|
|
64
|
+
* The whole record for one instance — R283, and the reason it exists beside
|
|
65
|
+
* {@link loadToken} rather than replacing it: widening this token's grants
|
|
66
|
+
* (`PUT /api/tokens/{id}/grants`, R173's own mechanism) needs the token's
|
|
67
|
+
* PUBLIC id, which is not the secret and was never stored before this. A
|
|
68
|
+
* record with no `id` — every token minted before R283 — is not an error;
|
|
69
|
+
* the caller falls back to looking it up by label.
|
|
70
|
+
*/
|
|
71
|
+
export async function loadTokenRecord(url) {
|
|
72
|
+
return (await readAll())[key(url)] ?? null;
|
|
73
|
+
}
|
|
74
|
+
|
|
63
75
|
/**
|
|
64
76
|
* The instances this machine holds a token for.
|
|
65
77
|
*
|
|
@@ -79,9 +91,9 @@ export async function storedUrls() {
|
|
|
79
91
|
* that already exists — so asking for 0600 and getting 0644 is the ordinary
|
|
80
92
|
* outcome rather than the unusual one.
|
|
81
93
|
*/
|
|
82
|
-
export async function saveToken(url, token, { name = null } = {}) {
|
|
94
|
+
export async function saveToken(url, token, { name = null, id = null } = {}) {
|
|
83
95
|
const all = await readAll();
|
|
84
|
-
all[key(url)] = { token, name, mintedAt: new Date().toISOString() };
|
|
96
|
+
all[key(url)] = { token, name, id, mintedAt: new Date().toISOString() };
|
|
85
97
|
await mkdir(dirname(tokenFile()), { recursive: true, mode: 0o700 });
|
|
86
98
|
await writeFile(tokenFile(), `${JSON.stringify(all, null, 2)}\n`, { mode: 0o600 });
|
|
87
99
|
await chmod(tokenFile(), 0o600).catch(() => undefined);
|