@agent-deck/cli 2.5.0 → 2.5.2
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/agent-harness.js +4 -4
- package/dist/agent-harness.js.map +1 -1
- package/dist/bin.js +0 -0
- package/dist/codex-plugin.d.ts +23 -26
- package/dist/codex-plugin.d.ts.map +1 -1
- package/dist/codex-plugin.js +113 -58
- package/dist/codex-plugin.js.map +1 -1
- package/dist/coordinator.d.ts +2 -0
- package/dist/coordinator.d.ts.map +1 -0
- package/dist/coordinator.js +153 -0
- package/dist/coordinator.js.map +1 -0
- package/dist/cursor-mcp-inspect.d.ts.map +1 -1
- package/dist/cursor-mcp-inspect.js +32 -4
- package/dist/cursor-mcp-inspect.js.map +1 -1
- package/dist/default-deck.d.ts +38 -0
- package/dist/default-deck.d.ts.map +1 -0
- package/dist/default-deck.js +129 -0
- package/dist/default-deck.js.map +1 -0
- package/dist/grant-issue.d.ts +39 -0
- package/dist/grant-issue.d.ts.map +1 -0
- package/dist/grant-issue.js +133 -0
- package/dist/grant-issue.js.map +1 -0
- package/dist/grant-store.d.ts +35 -0
- package/dist/grant-store.d.ts.map +1 -0
- package/dist/grant-store.js +302 -0
- package/dist/grant-store.js.map +1 -0
- package/dist/host-connection.d.ts +199 -0
- package/dist/host-connection.d.ts.map +1 -0
- package/dist/host-connection.js +626 -0
- package/dist/host-connection.js.map +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +6 -1
- package/dist/index.js.map +1 -1
- package/dist/launcher-migration.d.ts +45 -2
- package/dist/launcher-migration.d.ts.map +1 -1
- package/dist/launcher-migration.js +134 -25
- package/dist/launcher-migration.js.map +1 -1
- package/dist/mcp-config.d.ts +4 -142
- package/dist/mcp-config.d.ts.map +1 -1
- package/dist/mcp-config.js +17 -649
- package/dist/mcp-config.js.map +1 -1
- package/dist/menubar.d.ts +13 -2
- package/dist/menubar.d.ts.map +1 -1
- package/dist/menubar.js +42 -4
- package/dist/menubar.js.map +1 -1
- package/dist/muse-skills/agent-deck-session/SKILL.md +12 -10
- package/dist/muse-skills/agent-deck-setup/SKILL.md +21 -21
- package/dist/run-adapter.d.ts +100 -0
- package/dist/run-adapter.d.ts.map +1 -0
- package/dist/run-adapter.js +73 -0
- package/dist/run-adapter.js.map +1 -0
- package/dist/run-claude.d.ts +41 -0
- package/dist/run-claude.d.ts.map +1 -0
- package/dist/run-claude.js +91 -0
- package/dist/run-claude.js.map +1 -0
- package/dist/run-codex.d.ts +75 -0
- package/dist/run-codex.d.ts.map +1 -0
- package/dist/run-codex.js +337 -0
- package/dist/run-codex.js.map +1 -0
- package/dist/run-cursor.d.ts +79 -0
- package/dist/run-cursor.d.ts.map +1 -0
- package/dist/run-cursor.js +455 -0
- package/dist/run-cursor.js.map +1 -0
- package/dist/run-muse.d.ts +127 -0
- package/dist/run-muse.d.ts.map +1 -0
- package/dist/run-muse.js +499 -0
- package/dist/run-muse.js.map +1 -0
- package/dist/start.d.ts +2 -2
- package/dist/start.d.ts.map +1 -1
- package/dist/start.js +28 -4
- package/dist/start.js.map +1 -1
- package/dist/stop.d.ts +40 -1
- package/dist/stop.d.ts.map +1 -1
- package/dist/stop.js +275 -28
- package/dist/stop.js.map +1 -1
- package/dist/strip-ansi.d.ts +5 -4
- package/dist/strip-ansi.d.ts.map +1 -1
- package/dist/strip-ansi.js +19 -21
- package/dist/strip-ansi.js.map +1 -1
- package/dist/upgrade-scan.d.ts +20 -0
- package/dist/upgrade-scan.d.ts.map +1 -0
- package/dist/upgrade-scan.js +113 -0
- package/dist/upgrade-scan.js.map +1 -0
- package/dist/upgrade.d.ts.map +1 -1
- package/dist/upgrade.js +76 -20
- package/dist/upgrade.js.map +1 -1
- package/dist/use.d.ts.map +1 -1
- package/dist/use.js +4 -20
- package/dist/use.js.map +1 -1
- package/package.json +3 -3
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"grant-issue.js","sourceRoot":"","sources":["../src/grant-issue.ts"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;IAC/F,MAAM,QAAQ,GAAG,MAAM,KAAK,CAC1B,GAAG,UAAU,yCAAyC,kBAAkB,CAAC,KAAK,CAAC,OAAO,CAAC,iBAAiB,EACxG;QACE,MAAM,EAAE,MAAM;QACd,OAAO,EAAE;YACP,aAAa,EAAE,IAAI,CAAC,aAAa;YACjC,cAAc,EAAE,kBAAkB;SACnC;QACD,IAAI,EAAE,IAAI;KACX,CACF,CAAC;IAEF,IAAI,CAAC,QAAQ,CAAC,EAAE,EAAE,CAAC;QACjB,MAAM,OAAO,GAAG,MAAM,eAAe,CAAC,QAAQ,CAAC,CAAC;QAChD,OAAO;YACL,KAAK,EAAE,wBAAwB,CAC7B,QAAQ,CAAC,MAAM,EACf,OAAO,EACP,6BAA6B,CAC9B;SACF,CAAC;IACJ,CAAC;AACH,CAAC;AAED,SAAgB,eAAe,CAC7B,MAAmB,EACnB,MAAc,EACd,QAA6B,MAAM;IAEnC,OAAO;QACL,OAAO,EAAE,CAAC;QACV,YAAY,EAAE,MAAM,CAAC,YAAY;QACjC,OAAO,EAAE,MAAM,CAAC,OAAO;QACvB,MAAM,EAAE,MAAM,CAAC,MAAM;QACrB,MAAM,EAAE,MAAM,CAAC,MAAM;QACrB,QAAQ,EAAE,MAAM,CAAC,QAAQ;QACzB,MAAM;QACN,KAAK;QACL,SAAS,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;KACpC,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import type { WorkspaceGrantManifest } from '@agent-deck/shared';
|
|
2
|
+
export type GrantStoreKind = 'file' | 'keychain';
|
|
3
|
+
export interface GrantStore {
|
|
4
|
+
kind: GrantStoreKind;
|
|
5
|
+
read(): Promise<WorkspaceGrantManifest | null>;
|
|
6
|
+
stage(manifest: WorkspaceGrantManifest): Promise<void>;
|
|
7
|
+
activate(): Promise<void>;
|
|
8
|
+
rollback(): Promise<void>;
|
|
9
|
+
clear(): Promise<void>;
|
|
10
|
+
}
|
|
11
|
+
export declare class FileGrantStore implements GrantStore {
|
|
12
|
+
private readonly workspaceRoot;
|
|
13
|
+
readonly kind: GrantStoreKind;
|
|
14
|
+
constructor(workspaceRoot: string);
|
|
15
|
+
read(): Promise<WorkspaceGrantManifest | null>;
|
|
16
|
+
stage(manifest: WorkspaceGrantManifest): Promise<void>;
|
|
17
|
+
activate(): Promise<void>;
|
|
18
|
+
rollback(): Promise<void>;
|
|
19
|
+
clear(): Promise<void>;
|
|
20
|
+
}
|
|
21
|
+
export declare class KeychainGrantStore implements GrantStore {
|
|
22
|
+
private readonly workspaceRoot;
|
|
23
|
+
readonly kind: GrantStoreKind;
|
|
24
|
+
constructor(workspaceRoot: string);
|
|
25
|
+
private account;
|
|
26
|
+
private runSecurity;
|
|
27
|
+
read(): Promise<WorkspaceGrantManifest | null>;
|
|
28
|
+
stage(manifest: WorkspaceGrantManifest): Promise<void>;
|
|
29
|
+
activate(): Promise<void>;
|
|
30
|
+
rollback(): Promise<void>;
|
|
31
|
+
clear(): Promise<void>;
|
|
32
|
+
}
|
|
33
|
+
export declare function resolveGrantStore(workspaceRoot: string, prefer?: GrantStoreKind): GrantStore;
|
|
34
|
+
export declare function readWorkspaceGrant(workspaceRoot: string, prefer?: GrantStoreKind): Promise<WorkspaceGrantManifest | null>;
|
|
35
|
+
//# sourceMappingURL=grant-store.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"grant-store.d.ts","sourceRoot":"","sources":["../src/grant-store.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAC;AAOjE,MAAM,MAAM,cAAc,GAAG,MAAM,GAAG,UAAU,CAAC;AAEjD,MAAM,WAAW,UAAU;IACzB,IAAI,EAAE,cAAc,CAAC;IACrB,IAAI,IAAI,OAAO,CAAC,sBAAsB,GAAG,IAAI,CAAC,CAAC;IAC/C,KAAK,CAAC,QAAQ,EAAE,sBAAsB,GAAG,OAA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AAG,IAAI,CAAC,CAaxC"}
|
|
@@ -0,0 +1,302 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
36
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
37
|
+
};
|
|
38
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
+
exports.KeychainGrantStore = exports.FileGrantStore = void 0;
|
|
40
|
+
exports.resolveGrantStore = resolveGrantStore;
|
|
41
|
+
exports.readWorkspaceGrant = readWorkspaceGrant;
|
|
42
|
+
const promises_1 = __importDefault(require("node:fs/promises"));
|
|
43
|
+
const node_path_1 = __importDefault(require("node:path"));
|
|
44
|
+
const shared_1 = require("@agent-deck/shared");
|
|
45
|
+
const MANIFEST_FILENAME = 'use.json';
|
|
46
|
+
const MANIFEST_BACKUP = 'use.json.bak';
|
|
47
|
+
const MANIFEST_STAGING = 'use.json.staging';
|
|
48
|
+
function manifestPath(workspaceRoot) {
|
|
49
|
+
return node_path_1.default.join(workspaceRoot, '.agent-deck', MANIFEST_FILENAME);
|
|
50
|
+
}
|
|
51
|
+
function stagingPath(workspaceRoot) {
|
|
52
|
+
return node_path_1.default.join(workspaceRoot, '.agent-deck', MANIFEST_STAGING);
|
|
53
|
+
}
|
|
54
|
+
function backupPath(workspaceRoot) {
|
|
55
|
+
return node_path_1.default.join(workspaceRoot, '.agent-deck', MANIFEST_BACKUP);
|
|
56
|
+
}
|
|
57
|
+
async function ensureAgentDeckDir(workspaceRoot) {
|
|
58
|
+
const dir = node_path_1.default.join(workspaceRoot, '.agent-deck');
|
|
59
|
+
await promises_1.default.mkdir(dir, { recursive: true, mode: 0o700 });
|
|
60
|
+
return dir;
|
|
61
|
+
}
|
|
62
|
+
class FileGrantStore {
|
|
63
|
+
workspaceRoot;
|
|
64
|
+
kind = 'file';
|
|
65
|
+
constructor(workspaceRoot) {
|
|
66
|
+
this.workspaceRoot = workspaceRoot;
|
|
67
|
+
}
|
|
68
|
+
async read() {
|
|
69
|
+
try {
|
|
70
|
+
const raw = await promises_1.default.readFile(manifestPath(this.workspaceRoot), 'utf8');
|
|
71
|
+
const parsed = shared_1.WorkspaceGrantManifestSchema.parse(JSON.parse(raw));
|
|
72
|
+
return parsed;
|
|
73
|
+
}
|
|
74
|
+
catch (error) {
|
|
75
|
+
const nodeError = error;
|
|
76
|
+
if (nodeError.code === 'ENOENT') {
|
|
77
|
+
return null;
|
|
78
|
+
}
|
|
79
|
+
// Legacy v1 use.json or corrupt manifest — caller falls back to readUseManifest.
|
|
80
|
+
return null;
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
async stage(manifest) {
|
|
84
|
+
await ensureAgentDeckDir(this.workspaceRoot);
|
|
85
|
+
const target = manifestPath(this.workspaceRoot);
|
|
86
|
+
try {
|
|
87
|
+
await promises_1.default.copyFile(target, backupPath(this.workspaceRoot));
|
|
88
|
+
}
|
|
89
|
+
catch (error) {
|
|
90
|
+
const nodeError = error;
|
|
91
|
+
if (nodeError.code !== 'ENOENT') {
|
|
92
|
+
throw error;
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
await promises_1.default.writeFile(stagingPath(this.workspaceRoot), `${JSON.stringify(manifest, null, 2)}\n`, {
|
|
96
|
+
encoding: 'utf8',
|
|
97
|
+
mode: 0o600,
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
async activate() {
|
|
101
|
+
const staging = stagingPath(this.workspaceRoot);
|
|
102
|
+
const target = manifestPath(this.workspaceRoot);
|
|
103
|
+
await promises_1.default.rename(staging, target);
|
|
104
|
+
await promises_1.default.chmod(target, 0o600);
|
|
105
|
+
}
|
|
106
|
+
async rollback() {
|
|
107
|
+
const staging = stagingPath(this.workspaceRoot);
|
|
108
|
+
try {
|
|
109
|
+
await promises_1.default.unlink(staging);
|
|
110
|
+
}
|
|
111
|
+
catch (error) {
|
|
112
|
+
const nodeError = error;
|
|
113
|
+
if (nodeError.code !== 'ENOENT') {
|
|
114
|
+
throw error;
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
const backup = backupPath(this.workspaceRoot);
|
|
118
|
+
const target = manifestPath(this.workspaceRoot);
|
|
119
|
+
try {
|
|
120
|
+
await promises_1.default.copyFile(backup, target);
|
|
121
|
+
await promises_1.default.chmod(target, 0o600);
|
|
122
|
+
}
|
|
123
|
+
catch (error) {
|
|
124
|
+
const nodeError = error;
|
|
125
|
+
if (nodeError.code === 'ENOENT') {
|
|
126
|
+
try {
|
|
127
|
+
await promises_1.default.unlink(target);
|
|
128
|
+
}
|
|
129
|
+
catch {
|
|
130
|
+
// no prior grant
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
else {
|
|
134
|
+
throw error;
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
async clear() {
|
|
139
|
+
try {
|
|
140
|
+
await promises_1.default.unlink(manifestPath(this.workspaceRoot));
|
|
141
|
+
}
|
|
142
|
+
catch {
|
|
143
|
+
// ignore
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
exports.FileGrantStore = FileGrantStore;
|
|
148
|
+
class KeychainGrantStore {
|
|
149
|
+
workspaceRoot;
|
|
150
|
+
kind = 'keychain';
|
|
151
|
+
constructor(workspaceRoot) {
|
|
152
|
+
this.workspaceRoot = workspaceRoot;
|
|
153
|
+
}
|
|
154
|
+
account() {
|
|
155
|
+
return `workspace-grant:${this.workspaceRoot}`;
|
|
156
|
+
}
|
|
157
|
+
async runSecurity(args) {
|
|
158
|
+
const { execFile } = await Promise.resolve().then(() => __importStar(require('node:child_process')));
|
|
159
|
+
const { promisify } = await Promise.resolve().then(() => __importStar(require('node:util')));
|
|
160
|
+
const execFileAsync = promisify(execFile);
|
|
161
|
+
const result = await execFileAsync('security', args, { encoding: 'utf8' });
|
|
162
|
+
return String(result.stdout ?? '').trim();
|
|
163
|
+
}
|
|
164
|
+
async read() {
|
|
165
|
+
if (process.platform !== 'darwin') {
|
|
166
|
+
return null;
|
|
167
|
+
}
|
|
168
|
+
try {
|
|
169
|
+
const raw = await this.runSecurity([
|
|
170
|
+
'find-generic-password',
|
|
171
|
+
'-s',
|
|
172
|
+
'agent-deck-workspace-grant',
|
|
173
|
+
'-a',
|
|
174
|
+
this.account(),
|
|
175
|
+
'-w',
|
|
176
|
+
]);
|
|
177
|
+
if (!raw) {
|
|
178
|
+
return null;
|
|
179
|
+
}
|
|
180
|
+
return shared_1.WorkspaceGrantManifestSchema.parse(JSON.parse(raw));
|
|
181
|
+
}
|
|
182
|
+
catch {
|
|
183
|
+
return null;
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
async stage(manifest) {
|
|
187
|
+
if (process.platform !== 'darwin') {
|
|
188
|
+
throw new Error('Keychain grant store requires macOS');
|
|
189
|
+
}
|
|
190
|
+
const payload = JSON.stringify(manifest);
|
|
191
|
+
try {
|
|
192
|
+
await this.runSecurity([
|
|
193
|
+
'delete-generic-password',
|
|
194
|
+
'-s',
|
|
195
|
+
'agent-deck-workspace-grant-staging',
|
|
196
|
+
'-a',
|
|
197
|
+
this.account(),
|
|
198
|
+
]);
|
|
199
|
+
}
|
|
200
|
+
catch {
|
|
201
|
+
// may not exist
|
|
202
|
+
}
|
|
203
|
+
await this.runSecurity([
|
|
204
|
+
'add-generic-password',
|
|
205
|
+
'-s',
|
|
206
|
+
'agent-deck-workspace-grant-staging',
|
|
207
|
+
'-a',
|
|
208
|
+
this.account(),
|
|
209
|
+
'-w',
|
|
210
|
+
payload,
|
|
211
|
+
'-U',
|
|
212
|
+
]);
|
|
213
|
+
}
|
|
214
|
+
async activate() {
|
|
215
|
+
const staging = await this.runSecurity([
|
|
216
|
+
'find-generic-password',
|
|
217
|
+
'-s',
|
|
218
|
+
'agent-deck-workspace-grant-staging',
|
|
219
|
+
'-a',
|
|
220
|
+
this.account(),
|
|
221
|
+
'-w',
|
|
222
|
+
]);
|
|
223
|
+
try {
|
|
224
|
+
await this.runSecurity([
|
|
225
|
+
'delete-generic-password',
|
|
226
|
+
'-s',
|
|
227
|
+
'agent-deck-workspace-grant',
|
|
228
|
+
'-a',
|
|
229
|
+
this.account(),
|
|
230
|
+
]);
|
|
231
|
+
}
|
|
232
|
+
catch {
|
|
233
|
+
// may not exist
|
|
234
|
+
}
|
|
235
|
+
await this.runSecurity([
|
|
236
|
+
'add-generic-password',
|
|
237
|
+
'-s',
|
|
238
|
+
'agent-deck-workspace-grant',
|
|
239
|
+
'-a',
|
|
240
|
+
this.account(),
|
|
241
|
+
'-w',
|
|
242
|
+
staging,
|
|
243
|
+
'-U',
|
|
244
|
+
]);
|
|
245
|
+
await this.runSecurity([
|
|
246
|
+
'delete-generic-password',
|
|
247
|
+
'-s',
|
|
248
|
+
'agent-deck-workspace-grant-staging',
|
|
249
|
+
'-a',
|
|
250
|
+
this.account(),
|
|
251
|
+
]);
|
|
252
|
+
}
|
|
253
|
+
async rollback() {
|
|
254
|
+
if (process.platform !== 'darwin') {
|
|
255
|
+
return;
|
|
256
|
+
}
|
|
257
|
+
try {
|
|
258
|
+
await this.runSecurity([
|
|
259
|
+
'delete-generic-password',
|
|
260
|
+
'-s',
|
|
261
|
+
'agent-deck-workspace-grant-staging',
|
|
262
|
+
'-a',
|
|
263
|
+
this.account(),
|
|
264
|
+
]);
|
|
265
|
+
}
|
|
266
|
+
catch {
|
|
267
|
+
// ignore
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
async clear() {
|
|
271
|
+
if (process.platform !== 'darwin') {
|
|
272
|
+
return;
|
|
273
|
+
}
|
|
274
|
+
await this.runSecurity([
|
|
275
|
+
'delete-generic-password',
|
|
276
|
+
'-s',
|
|
277
|
+
'agent-deck-workspace-grant',
|
|
278
|
+
'-a',
|
|
279
|
+
this.account(),
|
|
280
|
+
]);
|
|
281
|
+
}
|
|
282
|
+
}
|
|
283
|
+
exports.KeychainGrantStore = KeychainGrantStore;
|
|
284
|
+
function resolveGrantStore(workspaceRoot, prefer = 'file') {
|
|
285
|
+
if (prefer === 'keychain' && process.platform === 'darwin') {
|
|
286
|
+
return new KeychainGrantStore(workspaceRoot);
|
|
287
|
+
}
|
|
288
|
+
return new FileGrantStore(workspaceRoot);
|
|
289
|
+
}
|
|
290
|
+
async function readWorkspaceGrant(workspaceRoot, prefer = 'file') {
|
|
291
|
+
const fileStore = new FileGrantStore(workspaceRoot);
|
|
292
|
+
const fromFile = await fileStore.read();
|
|
293
|
+
if (fromFile) {
|
|
294
|
+
return fromFile;
|
|
295
|
+
}
|
|
296
|
+
if (prefer === 'keychain' || process.platform === 'darwin') {
|
|
297
|
+
const keychainStore = new KeychainGrantStore(workspaceRoot);
|
|
298
|
+
return keychainStore.read();
|
|
299
|
+
}
|
|
300
|
+
return null;
|
|
301
|
+
}
|
|
302
|
+
//# sourceMappingURL=grant-store.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"grant-store.js","sourceRoot":"","sources":["../src/grant-store.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA4QA,8CAKC;AAED,gDAgBC;AAnSD,gEAAkC;AAClC,0DAA6B;AAG7B,+CAAkE;AAElE,MAAM,iBAAiB,GAAG,UAAU,CAAC;AACrC,MAAM,eAAe,GAAG,cAAc,CAAC;AACvC,MAAM,gBAAgB,GAAG,kBAAkB,CAAC;AAa5C,SAAS,YAAY,CAAC,aAAqB;IACzC,OAAO,mBAAI,CAAC,IAAI,CAAC,aAAa,EAAE,aAAa,EAAE,iBAAiB,CAAC,CAAC;AACpE,CAAC;AAED,SAAS,WAAW,CAAC,aAAqB;IACxC,OAAO,mBAAI,CAAC,IAAI,CAAC,aAAa,EAAE,aAAa,EAAE,gBAAgB,CAAC,CAAC;AACnE,CAAC;AAED,SAAS,UAAU,CAAC,aAAqB;IACvC,OAAO,mBAAI,CAAC,IAAI,CAAC,aAAa,EAAE,aAAa,EAAE,eAAe,CAAC,CAAC;AAClE,CAAC;AAED,KAAK,UAAU,kBAAkB,CAAC,aAAqB;IACrD,MAAM,GAAG,GAAG,mBAAI,CAAC,IAAI,CAAC,aAAa,EAAE,aAAa,CAAC,CAAC;IACpD,MAAM,kBAAE,CAAC,KAAK,CAAC,GAAG,EAAE,EAAE,SAAS,EAAE,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,CAAC,CAAC;IAC/C,CAAC;IACD,OAAO,IAAI,cAAc,CAAC,aAAa,CAAC,CAAC;AAC3C,CAAC;AAEM,KAAK,UAAU,kBAAkB,CACtC,aAAqB,EACrB,SAAyB,MAAM;IAE/B,MAAM,SAAS,GAAG,IAAI,cAAc,CAAC,aAAa,CAAC,CAAC;IACpD,MAAM,QAAQ,GAAG,MAAM,SAAS,CAAC,IAAI,EAAE,CAAC;IACxC,IAAI,QAAQ,EAAE,CAAC;QACb,OAAO,QAAQ,CAAC;IAClB,CAAC;IAED,IAAI,MAAM,KAAK,UAAU,IAAI,OAAO,CAAC,QAAQ,KAAK,QAAQ,EAAE,CAAC;QAC3D,MAAM,aAAa,GAAG,IAAI,kBAAkB,CAAC,aAAa,CAAC,CAAC;QAC5D,OAAO,aAAa,CAAC,IAAI,EAAE,CAAC;IAC9B,CAAC;IAED,OAAO,IAAI,CAAC;AACd,CAAC"}
|
|
@@ -0,0 +1,199 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pure-MCP host connection classifier (NOT-574).
|
|
3
|
+
*
|
|
4
|
+
* Per host and folder, reports the real connection state instead of
|
|
5
|
+
* install state: whether an Agent Deck entry exists, whether the daemon
|
|
6
|
+
* is up, whether a live session for this host and folder was observed,
|
|
7
|
+
* and — for the hosts that gate project config — whether the folder is
|
|
8
|
+
* trusted (and, for Muse, whether the folder is inside a git repository
|
|
9
|
+
* and whether a stale same-name stdio entry conflicts with the HTTP
|
|
10
|
+
* entry).
|
|
11
|
+
*
|
|
12
|
+
* Daemon health is `up` (`backendUp && mcpUp` from `probeAgentDeck`)
|
|
13
|
+
* plus the live-session list from the read-only
|
|
14
|
+
* `GET /api/scope/bindings` (same source as the menu bar). A session
|
|
15
|
+
* counts toward a host and folder only when its MCP `clientName`
|
|
16
|
+
* identifies that host and its `workspaceRoot` is this folder or
|
|
17
|
+
* absent (folder-less sessions come from global headerless entries and
|
|
18
|
+
* cannot contradict any folder). A session from another folder or
|
|
19
|
+
* another host never reads as connected.
|
|
20
|
+
*/
|
|
21
|
+
export type HostId = 'codex' | 'claude' | 'cursor' | 'muse';
|
|
22
|
+
export type HostConnectionState = 'no-entry' | 'entry-daemon-down' | 'entry-daemon-up-no-session' | 'connected' | 'folder-not-trusted' | 'folder-not-repository' | 'stale-conflicting-entry';
|
|
23
|
+
/**
|
|
24
|
+
* Live MCP session as `GET /api/scope/bindings` reports it — the subset
|
|
25
|
+
* the classifier attributes. Both fields are optional on the wire:
|
|
26
|
+
* `clientName` is the MCP `clientInfo.name` the host sent at
|
|
27
|
+
* initialize, and `workspaceRoot` is absent for folder-less sessions
|
|
28
|
+
* (global headerless entries that never bound a folder).
|
|
29
|
+
*/
|
|
30
|
+
export interface HostLiveSession {
|
|
31
|
+
workspaceRoot?: string;
|
|
32
|
+
clientName?: string;
|
|
33
|
+
}
|
|
34
|
+
export interface DaemonHealth {
|
|
35
|
+
up: boolean;
|
|
36
|
+
sessions: HostLiveSession[];
|
|
37
|
+
}
|
|
38
|
+
export interface HostConnectionInput {
|
|
39
|
+
host: HostId;
|
|
40
|
+
/** Folder the connection state is reported for (session attribution). */
|
|
41
|
+
folder: string;
|
|
42
|
+
hasProjectEntry: boolean;
|
|
43
|
+
hasGlobalEntry: boolean;
|
|
44
|
+
/** Meaningful only when a project entry exists; otherwise ignored. */
|
|
45
|
+
folderTrusted: boolean;
|
|
46
|
+
/** Muse only; other hosts pass true. */
|
|
47
|
+
folderInRepository: boolean;
|
|
48
|
+
/** Muse only; other hosts pass false. */
|
|
49
|
+
hasStaleConflict: boolean;
|
|
50
|
+
daemonUp: boolean;
|
|
51
|
+
/** Live sessions from `/api/scope/bindings`, attributed per host and folder. */
|
|
52
|
+
sessions: HostLiveSession[];
|
|
53
|
+
}
|
|
54
|
+
export interface HostConnectionResult {
|
|
55
|
+
host: HostId;
|
|
56
|
+
state: HostConnectionState;
|
|
57
|
+
remedy: string;
|
|
58
|
+
detail: string;
|
|
59
|
+
}
|
|
60
|
+
/** Host a live session's `clientName` identifies, or undefined when unknown. */
|
|
61
|
+
export declare function hostIdForClientName(clientName: string | undefined): HostId | undefined;
|
|
62
|
+
/**
|
|
63
|
+
* True when a live session belongs to this host and folder: the
|
|
64
|
+
* `clientName` must identify the host, and the `workspaceRoot` must be
|
|
65
|
+
* this folder (canonically compared, so `/tmp/x` matches
|
|
66
|
+
* `/private/tmp/x`) or absent — a folder-less session comes from a
|
|
67
|
+
* global headerless entry and cannot contradict any folder.
|
|
68
|
+
*/
|
|
69
|
+
export declare function sessionMatchesHostFolder(session: HostLiveSession, host: HostId, folder: string): boolean;
|
|
70
|
+
/** Live sessions attributed to this host and folder. */
|
|
71
|
+
export declare function countMatchingSessions(sessions: HostLiveSession[], host: HostId, folder: string): number;
|
|
72
|
+
/**
|
|
73
|
+
* Pure classifier: the Muse stale-conflict and repository gates first
|
|
74
|
+
* (they block even with the daemon up), then daemon reachability, then
|
|
75
|
+
* the trust gate, then the attributed live-session count. Daemon-down
|
|
76
|
+
* takes precedence over folder-not-trusted for every host: a trust
|
|
77
|
+
* remedy cannot help while the daemon is stopped. Trust and repository
|
|
78
|
+
* gates apply only when a project entry exists — the global headerless
|
|
79
|
+
* fallback needs neither.
|
|
80
|
+
*/
|
|
81
|
+
export declare function classifyHostConnection(input: HostConnectionInput): HostConnectionResult;
|
|
82
|
+
/** One-line remedy per host and state. */
|
|
83
|
+
export declare function remedyFor(host: HostId, state: HostConnectionState): string;
|
|
84
|
+
export declare function formatHostConnectionLine(result: HostConnectionResult): string;
|
|
85
|
+
/** Canonical folder for trust comparisons (`/tmp` vs `/private/tmp` on macOS). */
|
|
86
|
+
export declare function canonicalFolder(folder: string): string;
|
|
87
|
+
/**
|
|
88
|
+
* Raw `agent-deck` entry from a JSON MCP config, or undefined when the
|
|
89
|
+
* file is missing, unparsable, or holds no such key. Any defined object
|
|
90
|
+
* counts as an entry — HTTP, legacy launcher, or custom — since only
|
|
91
|
+
* presence gates the classifier; shape matters solely for the Muse
|
|
92
|
+
* stale-conflict check.
|
|
93
|
+
*/
|
|
94
|
+
export declare function readJsonAgentDeckEntry(configPath: string): unknown;
|
|
95
|
+
/** True for a stdio entry: an explicit command, or `type: 'stdio'`. */
|
|
96
|
+
export declare function isStdioAgentDeckEntry(entry: unknown): boolean;
|
|
97
|
+
/**
|
|
98
|
+
* Muse merges a same-name project entry with the user entry field by
|
|
99
|
+
* field, so a stdio entry on one side and an HTTP entry on the other
|
|
100
|
+
* rejects the server as `invalid_transport_combination`. True only for
|
|
101
|
+
* that mismatched pair — a single legacy entry still connects.
|
|
102
|
+
*/
|
|
103
|
+
export declare function hasMuseStaleConflict(projectEntry: unknown, globalEntry: unknown): boolean;
|
|
104
|
+
/** True when `folder` sits inside a git working tree (`.git` here or above). */
|
|
105
|
+
export declare function isInsideGitRepository(folder: string): boolean;
|
|
106
|
+
/** Every `[projects."<path>"]` path whose body sets `trust_level = "trusted"`. */
|
|
107
|
+
export declare function parseCodexTrustedProjects(userToml: string): string[];
|
|
108
|
+
/**
|
|
109
|
+
* Codex trusts a folder only via the user `config.toml` projects table —
|
|
110
|
+
* a `-c` override is not enough. A trusted ancestor covers its children.
|
|
111
|
+
*/
|
|
112
|
+
export declare function isCodexFolderTrusted(userToml: string, folder: string): boolean;
|
|
113
|
+
/**
|
|
114
|
+
* Claude approves a project `.mcp.json` server per folder: the server
|
|
115
|
+
* name lands in `~/.claude.json` projects[<folder>].enabledMcpjsonServers
|
|
116
|
+
* once approved. `enableAllProjectMcpServers` in user or project
|
|
117
|
+
* settings auto-approves. A folder whose trust dialog was never accepted
|
|
118
|
+
* (`hasTrustDialogAccepted === false`) is not trusted.
|
|
119
|
+
*/
|
|
120
|
+
export declare function isClaudeProjectApproved(home: string, folder: string): boolean;
|
|
121
|
+
/**
|
|
122
|
+
* Cursor's per-folder approval slug: the canonical path with every run
|
|
123
|
+
* of non-alphanumeric characters collapsed to one `-`, trimmed. E.g.
|
|
124
|
+
* `/Users/x/y` → `Users-x-y`, `/private/tmp/smoke` → `private-tmp-smoke`.
|
|
125
|
+
*/
|
|
126
|
+
export declare function cursorProjectSlug(folder: string): string;
|
|
127
|
+
/**
|
|
128
|
+
* Cursor approves a project server per folder in
|
|
129
|
+
* `~/.cursor/projects/<slug>/mcp-approvals.json`, a JSON array holding
|
|
130
|
+
* `agent-deck-<hash>` once approved. Any `agent-deck`-prefixed entry
|
|
131
|
+
* counts — the hash suffix is Cursor-internal.
|
|
132
|
+
*/
|
|
133
|
+
export declare function isCursorProjectApproved(home: string, folder: string): boolean;
|
|
134
|
+
export declare function museTrustPath(home: string, xdgConfigHome?: string): string;
|
|
135
|
+
export declare function museGlobalSettingsPath(home: string, xdgConfigHome?: string): string;
|
|
136
|
+
/**
|
|
137
|
+
* Muse trusts a folder via `trust.json` projects[<canonical>].decision —
|
|
138
|
+
* a trusted ancestor covers its children. Canonical paths only:
|
|
139
|
+
* `/private/tmp/...`, never `/tmp/...`.
|
|
140
|
+
*/
|
|
141
|
+
export declare function isMuseFolderTrusted(home: string, folder: string, xdgConfigHome?: string): boolean;
|
|
142
|
+
export interface InspectHostConnectionOptions {
|
|
143
|
+
home?: string;
|
|
144
|
+
/** Overrides $XDG_CONFIG_HOME for the Muse paths (tests). */
|
|
145
|
+
xdgConfigHome?: string;
|
|
146
|
+
/** Overrides $CODEX_HOME for the Codex user config (tests). */
|
|
147
|
+
codexHome?: string;
|
|
148
|
+
daemon: DaemonHealth;
|
|
149
|
+
}
|
|
150
|
+
/**
|
|
151
|
+
* Read-only inspection for one host and folder: config presence from
|
|
152
|
+
* the host's own files, trust/approval from the host's own store, repo
|
|
153
|
+
* membership for Muse, and the caller-supplied daemon health. Never
|
|
154
|
+
* writes and never launches a host CLI.
|
|
155
|
+
*/
|
|
156
|
+
export declare function inspectHostConnection(host: HostId, folder: string, options: InspectHostConnectionOptions): HostConnectionResult;
|
|
157
|
+
/** Inspect all four pure-MCP hosts for one folder (doctor order). */
|
|
158
|
+
export declare function inspectAllHostConnections(folder: string, options: InspectHostConnectionOptions): HostConnectionResult[];
|
|
159
|
+
/**
|
|
160
|
+
* Which deck source a new session in a folder would use (NOT-602).
|
|
161
|
+
*
|
|
162
|
+
* Same strict precedence the daemon resolves in `resolveHeaderDeck`
|
|
163
|
+
* (`packages/backend/src/mcp-server.ts`): an explicit launch deck
|
|
164
|
+
* header wins, else the folder assignment, else the user default deck,
|
|
165
|
+
* else the session lands unassigned (`none`). The assignment read is
|
|
166
|
+
* the same v3-only `readUseManifest` the daemon uses, so a legacy v1
|
|
167
|
+
* or grant-based v2 `use.json` does not count as an assignment here
|
|
168
|
+
* either — a folder carrying only one is effectively unbound for a new
|
|
169
|
+
* headerless session.
|
|
170
|
+
*/
|
|
171
|
+
export type DeckSourceKind = 'launch-header' | 'folder-assignment' | 'default-deck' | 'none';
|
|
172
|
+
export interface DeckSourceDeck {
|
|
173
|
+
deckId: string;
|
|
174
|
+
deckName?: string;
|
|
175
|
+
}
|
|
176
|
+
export interface DeckSourceInput {
|
|
177
|
+
/** Explicit launch deck (`x-agent-deck-deck-id`) the new session would send, if known. */
|
|
178
|
+
launchDeck?: DeckSourceDeck | null;
|
|
179
|
+
/** v3 folder assignment (`<folder>/.agent-deck/use.json`), if present. */
|
|
180
|
+
assignment?: DeckSourceDeck | null;
|
|
181
|
+
/** User default deck (`$AGENT_DECK_HOME/default-deck.json`), if set. */
|
|
182
|
+
defaultDeck?: DeckSourceDeck | null;
|
|
183
|
+
}
|
|
184
|
+
export interface DeckSourceResult {
|
|
185
|
+
source: DeckSourceKind;
|
|
186
|
+
deck?: DeckSourceDeck;
|
|
187
|
+
}
|
|
188
|
+
/** Pure precedence: launch header, then folder assignment, then default deck, then none. */
|
|
189
|
+
export declare function resolveDeckSource(input: DeckSourceInput): DeckSourceResult;
|
|
190
|
+
/**
|
|
191
|
+
* Read-only deck-source inspection for one folder: the v3 assignment on
|
|
192
|
+
* disk plus the user default deck through the pure precedence above. A
|
|
193
|
+
* new interactive session sends no deck header, so doctor never reports
|
|
194
|
+
* `launch-header` — the branch exists so the precedence stays complete
|
|
195
|
+
* and unit-testable.
|
|
196
|
+
*/
|
|
197
|
+
export declare function inspectFolderDeckSource(folder: string): DeckSourceResult;
|
|
198
|
+
export declare function formatDeckSourceLine(resolved: DeckSourceResult): string;
|
|
199
|
+
//# sourceMappingURL=host-connection.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"host-connection.d.ts","sourceRoot":"","sources":["../src/host-connection.ts"],"names":[],"mappings":"AAWA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,MAAM,MAAM,MAAM,GAAG,OAAO,GAAG,QAAQ,GAAG,QAAQ,GAAG,MAAM,CAAC;AAE5D,MAAM,MAAM,mBAAmB,GAC3B,UAAU,GACV,mBAAmB,GACnB,4BAA4B,GAC5B,WAAW,GACX,oBAAoB,GACpB,uBAAuB,GACvB,yBAAyB,CAAC;AAE9B;;;;;;GAMG;AACH,MAAM,WAAW,eAAe;IAC9B,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,YAAY;IAC3B,EAAE,EAAE,OAAO,CAAC;IACZ,QAAQ,EAAE,eAAe,EAAE,CAAC;CAC7B;AAED,MAAM,WAAW,mBAAmB;IAClC,IAAI,EAAE,MAAM,CAAC;IACb,yEAAyE;IACzE,MAAM,EAAE,MAAM,CAAC;IACf,eAAe,EAAE,OAAO,CAAC;IACzB,cAAc,EAAE,OAAO,CAAC;IACxB,sEAAsE;IACtE,aAAa,EAAE,OAAO,CAAC;IACvB,wCAAwC;IACxC,kBAAkB,EAAE,OAAO,CAAC;IAC5B,yCAAyC;IACzC,gBAAgB,EAAE,OAAO,CAAC;IAC1B,QAAQ,EAAE,OAAO,CAAC;IAClB,gFAAgF;IAChF,QAAQ,EAAE,eAAe,EAAE,CAAC;CAC7B;AAED,MAAM,WAAW,oBAAoB;IACnC,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,mBAAmB,C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