@mrpatronz/nexusflow 2.3.0 → 2.3.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/dist/agent/AntigravityCliAdapter.d.ts +14 -1
- package/dist/agent/AntigravityCliAdapter.d.ts.map +1 -1
- package/dist/agent/AntigravityCliAdapter.js +84 -4
- package/dist/agent/AntigravityCliAdapter.js.map +1 -1
- package/dist/agent/AntigravityCliAdapter.test.d.ts +2 -0
- package/dist/agent/AntigravityCliAdapter.test.d.ts.map +1 -0
- package/dist/agent/AntigravityCliAdapter.test.js +222 -0
- package/dist/agent/AntigravityCliAdapter.test.js.map +1 -0
- package/dist/agent/adapters.d.ts.map +1 -1
- package/dist/agent/adapters.js +19 -1
- package/dist/agent/adapters.js.map +1 -1
- package/dist/gui/assets/{AgentsPage-BtrTgIyU.js → AgentsPage-C7wGK7q-.js} +1 -1
- package/dist/gui/assets/{DashboardPage-CeUkMdxc.js → DashboardPage-DqZRdOF3.js} +1 -1
- package/dist/gui/assets/{GettingStartedPage-YwJXpsc6.js → GettingStartedPage-BJvrh67p.js} +1 -1
- package/dist/gui/assets/{ProjectsPage-D8kEHb-m.js → ProjectsPage-B0VFV1vX.js} +1 -1
- package/dist/gui/assets/{ScaffoldRepoInline-ij7JLzmx.js → ScaffoldRepoInline-DSt_6QLb.js} +1 -1
- package/dist/gui/assets/{SettingsPage-BQhAP4go.js → SettingsPage-DO5HasvS.js} +1 -1
- package/dist/gui/assets/{SkillsPage-DJ-dXfcC.js → SkillsPage-CvRIKdsQ.js} +3 -3
- package/dist/gui/assets/StartWorkPage-CK5QF6Oa.js +1 -0
- package/dist/gui/assets/{StrategiesPage-CLOjDRbX.js → StrategiesPage-CWMrYI29.js} +1 -1
- package/dist/gui/assets/{WorkspaceLauncher-CjNI4vqn.js → WorkspaceLauncher-EIY_u44S.js} +1 -1
- package/dist/gui/assets/WorkspacesPage-CHUfqrA6.js +6 -0
- package/dist/gui/assets/{alert-dialog-DjwFcE6b.js → alert-dialog-CroDe9HW.js} +1 -1
- package/dist/gui/assets/index-Bq5NL5AJ.css +2 -0
- package/dist/gui/assets/{index-CfQEnn52.js → index-CcIOIZ24.js} +3 -3
- package/dist/gui/index.html +2 -2
- package/package.json +1 -1
- package/dist/gui/assets/StartWorkPage-DGWZzF4H.js +0 -1
- package/dist/gui/assets/WorkspacesPage-MDzm2JUh.js +0 -6
- package/dist/gui/assets/index-k7inKaui.css +0 -2
|
@@ -1,7 +1,20 @@
|
|
|
1
1
|
import { CliAdapterBase } from './CliAdapterBase.js';
|
|
2
|
+
import { type AgentSession } from './session.js';
|
|
3
|
+
import type { AgentExecutionProfile } from './ProviderRegistry.js';
|
|
4
|
+
export declare function getAntigravityHistoryPath(): string;
|
|
5
|
+
/**
|
|
6
|
+
* Searches Antigravity's history.jsonl for the newest session matching cwd and started at or after turnStartTime.
|
|
7
|
+
*/
|
|
8
|
+
export declare function findAntigravitySessionIdForWorkspace(cwd: string, sinceEpochMs: number, historyPath?: string): string | null;
|
|
9
|
+
export declare function buildAntigravityTurnArgs(isFirstTurn: boolean, prompt: string, session?: AgentSession, executionProfile?: AgentExecutionProfile): string[];
|
|
2
10
|
export declare class AntigravityCliAdapter extends CliAdapterBase {
|
|
3
11
|
protected readonly binary = "agy";
|
|
4
12
|
protected readonly label = "agy CLI";
|
|
5
|
-
|
|
13
|
+
private session?;
|
|
14
|
+
private turnStartTime;
|
|
15
|
+
start(cwd: string, session?: AgentSession): Promise<void>;
|
|
16
|
+
send(data: string, executionProfile?: AgentExecutionProfile): Promise<void>;
|
|
17
|
+
protected finishStdout(_exitCode: number | null): boolean;
|
|
18
|
+
protected buildArgs(isFirstTurn: boolean, prompt: string, executionProfile?: AgentExecutionProfile): string[];
|
|
6
19
|
}
|
|
7
20
|
//# sourceMappingURL=AntigravityCliAdapter.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AntigravityCliAdapter.d.ts","sourceRoot":"","sources":["../../src/agent/AntigravityCliAdapter.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"AntigravityCliAdapter.d.ts","sourceRoot":"","sources":["../../src/agent/AntigravityCliAdapter.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EAAsB,KAAK,YAAY,EAAE,MAAM,cAAc,CAAC;AACrE,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,uBAAuB,CAAC;AAEnE,wBAAgB,yBAAyB,IAAI,MAAM,CAGlD;AAED;;GAEG;AACH,wBAAgB,oCAAoC,CAClD,GAAG,EAAE,MAAM,EACX,YAAY,EAAE,MAAM,EACpB,WAAW,SAA8B,GACxC,MAAM,GAAG,IAAI,CA6Bf;AAED,wBAAgB,wBAAwB,CACtC,WAAW,EAAE,OAAO,EACpB,MAAM,EAAE,MAAM,EACd,OAAO,CAAC,EAAE,YAAY,EACtB,gBAAgB,GAAE,qBAAgC,GACjD,MAAM,EAAE,CAiBV;AAED,qBAAa,qBAAsB,SAAQ,cAAc;IACvD,SAAS,CAAC,QAAQ,CAAC,MAAM,SAAS;IAClC,SAAS,CAAC,QAAQ,CAAC,KAAK,aAAa;IAIrC,OAAO,CAAC,OAAO,CAAC,CAAe;IAC/B,OAAO,CAAC,aAAa,CAAa;IAErB,KAAK,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC;IAMhD,IAAI,CAAC,IAAI,EAAE,MAAM,EAAE,gBAAgB,CAAC,EAAE,qBAAqB,GAAG,OAAO,CAAC,IAAI,CAAC;cAK9E,YAAY,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI,GAAG,OAAO;IAalE,SAAS,CAAC,SAAS,CACjB,WAAW,EAAE,OAAO,EACpB,MAAM,EAAE,MAAM,EACd,gBAAgB,CAAC,EAAE,qBAAqB,GACvC,MAAM,EAAE;CAGZ"}
|
|
@@ -1,13 +1,93 @@
|
|
|
1
|
+
import * as fs from 'node:fs';
|
|
2
|
+
import * as path from 'node:path';
|
|
3
|
+
import * as os from 'node:os';
|
|
1
4
|
import { CliAdapterBase } from './CliAdapterBase.js';
|
|
5
|
+
import { isValidSessionUuid } from './session.js';
|
|
6
|
+
export function getAntigravityHistoryPath() {
|
|
7
|
+
const agDir = process.env.ANTIGRAVITY_HOME || path.join(os.homedir(), '.gemini', 'antigravity-cli');
|
|
8
|
+
return path.join(agDir, 'history.jsonl');
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Searches Antigravity's history.jsonl for the newest session matching cwd and started at or after turnStartTime.
|
|
12
|
+
*/
|
|
13
|
+
export function findAntigravitySessionIdForWorkspace(cwd, sinceEpochMs, historyPath = getAntigravityHistoryPath()) {
|
|
14
|
+
try {
|
|
15
|
+
if (!fs.existsSync(historyPath))
|
|
16
|
+
return null;
|
|
17
|
+
const content = fs.readFileSync(historyPath, 'utf-8');
|
|
18
|
+
const lines = content.split('\n').filter(Boolean);
|
|
19
|
+
const normalize = (p) => path.normalize(p).toLowerCase();
|
|
20
|
+
const normCwd = normalize(cwd);
|
|
21
|
+
// Scan backwards from newest entry
|
|
22
|
+
for (let i = lines.length - 1; i >= 0; i--) {
|
|
23
|
+
try {
|
|
24
|
+
const entry = JSON.parse(lines[i]);
|
|
25
|
+
if (!entry.conversationId || !isValidSessionUuid(entry.conversationId))
|
|
26
|
+
continue;
|
|
27
|
+
if (!entry.workspace)
|
|
28
|
+
continue;
|
|
29
|
+
const normEntryWs = normalize(entry.workspace);
|
|
30
|
+
const matchesWs = normEntryWs === normCwd ||
|
|
31
|
+
normEntryWs.startsWith(normCwd + path.sep) ||
|
|
32
|
+
normCwd.startsWith(normEntryWs + path.sep);
|
|
33
|
+
if (!matchesWs)
|
|
34
|
+
continue;
|
|
35
|
+
const timestamp = typeof entry.timestamp === 'number' ? entry.timestamp : new Date(entry.timestamp).getTime();
|
|
36
|
+
if (!Number.isNaN(timestamp) && timestamp >= sinceEpochMs - 10000) {
|
|
37
|
+
return entry.conversationId;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
catch { }
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
catch { }
|
|
44
|
+
return null;
|
|
45
|
+
}
|
|
46
|
+
export function buildAntigravityTurnArgs(isFirstTurn, prompt, session, executionProfile = 'review') {
|
|
47
|
+
const args = [];
|
|
48
|
+
// --conversation only loads an existing provider-owned conversation. It is
|
|
49
|
+
// not a caller-assigned session id, so a new chat must let agy create one.
|
|
50
|
+
if (session?.resume) {
|
|
51
|
+
args.push('--conversation', session.id);
|
|
52
|
+
}
|
|
53
|
+
else if (!isFirstTurn) {
|
|
54
|
+
args.push('-c');
|
|
55
|
+
}
|
|
56
|
+
// Never inherit agy's persisted global mode. The profile selected for this
|
|
57
|
+
// turn is the authority for whether the harness may edit the workspace.
|
|
58
|
+
args.push('--mode', executionProfile === 'workspace-write' ? 'accept-edits' : 'plan');
|
|
59
|
+
args.push('-p', prompt);
|
|
60
|
+
return args;
|
|
61
|
+
}
|
|
2
62
|
export class AntigravityCliAdapter extends CliAdapterBase {
|
|
3
63
|
binary = 'agy';
|
|
4
64
|
label = 'agy CLI';
|
|
5
65
|
// agy is a native binary: reads the prompt from argv and needs no shell
|
|
6
66
|
// (argv is passed literally, so multi-word prompts are safe without quoting).
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
67
|
+
session;
|
|
68
|
+
turnStartTime = 0;
|
|
69
|
+
async start(cwd, session) {
|
|
70
|
+
this.session = session;
|
|
71
|
+
this.turnStartTime = 0;
|
|
72
|
+
await super.start(cwd);
|
|
73
|
+
}
|
|
74
|
+
async send(data, executionProfile) {
|
|
75
|
+
this.turnStartTime = Date.now();
|
|
76
|
+
return super.send(data, executionProfile);
|
|
77
|
+
}
|
|
78
|
+
finishStdout(_exitCode) {
|
|
79
|
+
if (this.session?.id && this.session.resume) {
|
|
80
|
+
return false;
|
|
81
|
+
}
|
|
82
|
+
const capturedId = findAntigravitySessionIdForWorkspace(this.cwd, this.turnStartTime);
|
|
83
|
+
if (capturedId) {
|
|
84
|
+
this.session = { id: capturedId, resume: true };
|
|
85
|
+
this.emit('session', capturedId);
|
|
86
|
+
}
|
|
87
|
+
return false;
|
|
88
|
+
}
|
|
89
|
+
buildArgs(isFirstTurn, prompt, executionProfile) {
|
|
90
|
+
return buildAntigravityTurnArgs(isFirstTurn, prompt, this.session, executionProfile);
|
|
11
91
|
}
|
|
12
92
|
}
|
|
13
93
|
//# sourceMappingURL=AntigravityCliAdapter.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AntigravityCliAdapter.js","sourceRoot":"","sources":["../../src/agent/AntigravityCliAdapter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"AntigravityCliAdapter.js","sourceRoot":"","sources":["../../src/agent/AntigravityCliAdapter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAC9B,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAClC,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAC9B,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EAAE,kBAAkB,EAAqB,MAAM,cAAc,CAAC;AAGrE,MAAM,UAAU,yBAAyB;IACvC,MAAM,KAAK,GAAG,OAAO,CAAC,GAAG,CAAC,gBAAgB,IAAI,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,OAAO,EAAE,EAAE,SAAS,EAAE,iBAAiB,CAAC,CAAC;IACpG,OAAO,IAAI,CAAC,IAAI,CAAC,KAAK,EAAE,eAAe,CAAC,CAAC;AAC3C,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,oCAAoC,CAClD,GAAW,EACX,YAAoB,EACpB,WAAW,GAAG,yBAAyB,EAAE;IAEz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GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,aAAa,GAAG,CAAC,CAAC;QACvB,MAAM,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IACzB,CAAC;IAEe,KAAK,CAAC,IAAI,CAAC,IAAY,EAAE,gBAAwC;QAC/E,IAAI,CAAC,aAAa,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;QAChC,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,EAAE,gBAAgB,CAAC,CAAC;IAC5C,CAAC;IAEkB,YAAY,CAAC,SAAwB;QACtD,IAAI,IAAI,CAAC,OAAO,EAAE,EAAE,IAAI,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE,CAAC;YAC5C,OAAO,KAAK,CAAC;QACf,CAAC;QAED,MAAM,UAAU,GAAG,oCAAoC,CAAC,IAAI,CAAC,GAAG,EAAE,IAAI,CAAC,aAAa,CAAC,CAAC;QACtF,IAAI,UAAU,EAAE,CAAC;YACf,IAAI,CAAC,OAAO,GAAG,EAAE,EAAE,EAAE,UAAU,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC;YAChD,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,UAAU,CAAC,CAAC;QACnC,CAAC;QACD,OAAO,KAAK,CAAC;IACf,CAAC;IAES,SAAS,CACjB,WAAoB,EACpB,MAAc,EACd,gBAAwC;QAExC,OAAO,wBAAwB,CAAC,WAAW,EAAE,MAAM,EAAE,IAAI,CAAC,OAAO,EAAE,gBAAgB,CAAC,CAAC;IACvF,CAAC;CACF"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AntigravityCliAdapter.test.d.ts","sourceRoot":"","sources":["../../src/agent/AntigravityCliAdapter.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,222 @@
|
|
|
1
|
+
import * as fs from 'node:fs';
|
|
2
|
+
import * as path from 'node:path';
|
|
3
|
+
import * as os from 'node:os';
|
|
4
|
+
import { EventEmitter } from 'node:events';
|
|
5
|
+
import { describe, expect, it, vi, beforeEach, afterEach } from 'vitest';
|
|
6
|
+
import { AntigravityCliAdapter, buildAntigravityTurnArgs, findAntigravitySessionIdForWorkspace, } from './AntigravityCliAdapter.js';
|
|
7
|
+
const SESSION_ID = '123e4567-e89b-42d3-a456-426614174000';
|
|
8
|
+
const CAPTURED_SESSION_ID = '987fcdeb-51a2-43d7-b654-321098765432';
|
|
9
|
+
class FakeChild extends EventEmitter {
|
|
10
|
+
stdin = { write: vi.fn(), end: vi.fn() };
|
|
11
|
+
stdout = new EventEmitter();
|
|
12
|
+
stderr = new EventEmitter();
|
|
13
|
+
killed = false;
|
|
14
|
+
exitCode = null;
|
|
15
|
+
pid;
|
|
16
|
+
}
|
|
17
|
+
class TestAntigravityCliAdapter extends AntigravityCliAdapter {
|
|
18
|
+
processes = [];
|
|
19
|
+
spawnProcess(args) {
|
|
20
|
+
const child = new FakeChild();
|
|
21
|
+
this.processes.push({ args, child });
|
|
22
|
+
return child;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
describe('buildAntigravityTurnArgs', () => {
|
|
26
|
+
it('builds first turn arguments without session', () => {
|
|
27
|
+
expect(buildAntigravityTurnArgs(true, 'hello world')).toEqual([
|
|
28
|
+
'--mode',
|
|
29
|
+
'plan',
|
|
30
|
+
'-p',
|
|
31
|
+
'hello world',
|
|
32
|
+
]);
|
|
33
|
+
});
|
|
34
|
+
it('builds subsequent turn arguments without session', () => {
|
|
35
|
+
expect(buildAntigravityTurnArgs(false, 'next prompt')).toEqual([
|
|
36
|
+
'-c',
|
|
37
|
+
'--mode',
|
|
38
|
+
'plan',
|
|
39
|
+
'-p',
|
|
40
|
+
'next prompt',
|
|
41
|
+
]);
|
|
42
|
+
});
|
|
43
|
+
it('does not treat a caller-provided ID as a new Antigravity conversation', () => {
|
|
44
|
+
expect(buildAntigravityTurnArgs(true, 'hello world', { id: SESSION_ID, resume: false })).toEqual([
|
|
45
|
+
'--mode',
|
|
46
|
+
'plan',
|
|
47
|
+
'-p',
|
|
48
|
+
'hello world',
|
|
49
|
+
]);
|
|
50
|
+
});
|
|
51
|
+
it('builds resumed session arguments', () => {
|
|
52
|
+
expect(buildAntigravityTurnArgs(true, 'resumed prompt', { id: SESSION_ID, resume: true })).toEqual([
|
|
53
|
+
'--conversation',
|
|
54
|
+
SESSION_ID,
|
|
55
|
+
'--mode',
|
|
56
|
+
'plan',
|
|
57
|
+
'-p',
|
|
58
|
+
'resumed prompt',
|
|
59
|
+
]);
|
|
60
|
+
});
|
|
61
|
+
it('applies workspace-write execution profile with session', () => {
|
|
62
|
+
expect(buildAntigravityTurnArgs(true, 'edit prompt', { id: SESSION_ID, resume: true }, 'workspace-write')).toEqual([
|
|
63
|
+
'--conversation',
|
|
64
|
+
SESSION_ID,
|
|
65
|
+
'--mode',
|
|
66
|
+
'accept-edits',
|
|
67
|
+
'-p',
|
|
68
|
+
'edit prompt',
|
|
69
|
+
]);
|
|
70
|
+
});
|
|
71
|
+
it('applies workspace-write execution profile without session', () => {
|
|
72
|
+
expect(buildAntigravityTurnArgs(true, 'edit prompt', undefined, 'workspace-write')).toEqual([
|
|
73
|
+
'--mode',
|
|
74
|
+
'accept-edits',
|
|
75
|
+
'-p',
|
|
76
|
+
'edit prompt',
|
|
77
|
+
]);
|
|
78
|
+
expect(buildAntigravityTurnArgs(false, 'edit prompt 2', undefined, 'workspace-write')).toEqual([
|
|
79
|
+
'-c',
|
|
80
|
+
'--mode',
|
|
81
|
+
'accept-edits',
|
|
82
|
+
'-p',
|
|
83
|
+
'edit prompt 2',
|
|
84
|
+
]);
|
|
85
|
+
});
|
|
86
|
+
});
|
|
87
|
+
describe('findAntigravitySessionIdForWorkspace', () => {
|
|
88
|
+
let tmpDir;
|
|
89
|
+
let historyFile;
|
|
90
|
+
beforeEach(() => {
|
|
91
|
+
tmpDir = fs.mkdtempSync(path.join(os.tmpdir(), 'ag-test-'));
|
|
92
|
+
historyFile = path.join(tmpDir, 'history.jsonl');
|
|
93
|
+
});
|
|
94
|
+
afterEach(() => {
|
|
95
|
+
fs.rmSync(tmpDir, { recursive: true, force: true });
|
|
96
|
+
});
|
|
97
|
+
it('returns null if history file does not exist', () => {
|
|
98
|
+
expect(findAntigravitySessionIdForWorkspace('/my/workspace', Date.now(), historyFile)).toBeNull();
|
|
99
|
+
});
|
|
100
|
+
it('locates the newest session matching the workspace directory within timestamp window', () => {
|
|
101
|
+
const now = Date.now();
|
|
102
|
+
const ws = path.join(tmpDir, 'workspace');
|
|
103
|
+
const lines = [
|
|
104
|
+
JSON.stringify({
|
|
105
|
+
display: 'old session',
|
|
106
|
+
timestamp: now - 50000,
|
|
107
|
+
workspace: ws,
|
|
108
|
+
conversationId: '00000000-0000-0000-0000-000000000001',
|
|
109
|
+
}),
|
|
110
|
+
JSON.stringify({
|
|
111
|
+
display: 'other workspace',
|
|
112
|
+
timestamp: now,
|
|
113
|
+
workspace: path.join(tmpDir, 'other'),
|
|
114
|
+
conversationId: '00000000-0000-0000-0000-000000000002',
|
|
115
|
+
}),
|
|
116
|
+
JSON.stringify({
|
|
117
|
+
display: 'new matching session',
|
|
118
|
+
timestamp: now + 50,
|
|
119
|
+
workspace: ws,
|
|
120
|
+
conversationId: CAPTURED_SESSION_ID,
|
|
121
|
+
}),
|
|
122
|
+
];
|
|
123
|
+
fs.writeFileSync(historyFile, lines.join('\n'), 'utf-8');
|
|
124
|
+
const result = findAntigravitySessionIdForWorkspace(ws, now, historyFile);
|
|
125
|
+
expect(result).toBe(CAPTURED_SESSION_ID);
|
|
126
|
+
});
|
|
127
|
+
it('ignores invalid conversation IDs', () => {
|
|
128
|
+
const now = Date.now();
|
|
129
|
+
const ws = path.join(tmpDir, 'workspace');
|
|
130
|
+
const lines = [
|
|
131
|
+
JSON.stringify({
|
|
132
|
+
display: 'bad id session',
|
|
133
|
+
timestamp: now,
|
|
134
|
+
workspace: ws,
|
|
135
|
+
conversationId: 'not-a-uuid',
|
|
136
|
+
}),
|
|
137
|
+
];
|
|
138
|
+
fs.writeFileSync(historyFile, lines.join('\n'), 'utf-8');
|
|
139
|
+
expect(findAntigravitySessionIdForWorkspace(ws, now, historyFile)).toBeNull();
|
|
140
|
+
});
|
|
141
|
+
});
|
|
142
|
+
describe('AntigravityCliAdapter lifecycle', () => {
|
|
143
|
+
let tmpHome;
|
|
144
|
+
const originalAgHome = process.env.ANTIGRAVITY_HOME;
|
|
145
|
+
beforeEach(() => {
|
|
146
|
+
tmpHome = fs.mkdtempSync(path.join(os.tmpdir(), 'ag-home-'));
|
|
147
|
+
process.env.ANTIGRAVITY_HOME = tmpHome;
|
|
148
|
+
});
|
|
149
|
+
afterEach(() => {
|
|
150
|
+
if (originalAgHome !== undefined) {
|
|
151
|
+
process.env.ANTIGRAVITY_HOME = originalAgHome;
|
|
152
|
+
}
|
|
153
|
+
else {
|
|
154
|
+
delete process.env.ANTIGRAVITY_HOME;
|
|
155
|
+
}
|
|
156
|
+
fs.rmSync(tmpHome, { recursive: true, force: true });
|
|
157
|
+
});
|
|
158
|
+
it('resumes an existing provider-assigned session', async () => {
|
|
159
|
+
const adapter = new TestAntigravityCliAdapter();
|
|
160
|
+
const sessionEvents = [];
|
|
161
|
+
adapter.on('session', (id) => sessionEvents.push(id));
|
|
162
|
+
await adapter.start('/workspace', { id: SESSION_ID, resume: true });
|
|
163
|
+
await adapter.send('first message', 'workspace-write');
|
|
164
|
+
expect(sessionEvents).toHaveLength(0);
|
|
165
|
+
expect(adapter.processes).toHaveLength(1);
|
|
166
|
+
expect(adapter.processes[0].args).toEqual([
|
|
167
|
+
'--conversation',
|
|
168
|
+
SESSION_ID,
|
|
169
|
+
'--mode',
|
|
170
|
+
'accept-edits',
|
|
171
|
+
'-p',
|
|
172
|
+
'first message',
|
|
173
|
+
]);
|
|
174
|
+
});
|
|
175
|
+
it('starts a new conversation, captures session identity from history, and pins turn 2 to --conversation', async () => {
|
|
176
|
+
const adapter = new TestAntigravityCliAdapter();
|
|
177
|
+
const sessionEvents = [];
|
|
178
|
+
adapter.on('session', (id) => sessionEvents.push(id));
|
|
179
|
+
const workspaceDir = path.join(tmpHome, 'workspace');
|
|
180
|
+
await adapter.start(workspaceDir);
|
|
181
|
+
await adapter.send('first message');
|
|
182
|
+
expect(adapter.processes[0].args).toEqual(['--mode', 'plan', '-p', 'first message']);
|
|
183
|
+
// Simulate agy writing to history.jsonl during turn 1
|
|
184
|
+
const historyFile = path.join(tmpHome, 'history.jsonl');
|
|
185
|
+
fs.writeFileSync(historyFile, JSON.stringify({
|
|
186
|
+
display: 'first message',
|
|
187
|
+
timestamp: Date.now(),
|
|
188
|
+
workspace: workspaceDir,
|
|
189
|
+
conversationId: CAPTURED_SESSION_ID,
|
|
190
|
+
}), 'utf-8');
|
|
191
|
+
// Complete turn 1
|
|
192
|
+
adapter.processes[0].child.emit('close', 0);
|
|
193
|
+
// Should have captured and emitted the session ID
|
|
194
|
+
expect(sessionEvents).toEqual([CAPTURED_SESSION_ID]);
|
|
195
|
+
// Second turn must now use --conversation <CAPTURED_SESSION_ID>
|
|
196
|
+
await adapter.send('second message');
|
|
197
|
+
expect(adapter.processes).toHaveLength(2);
|
|
198
|
+
expect(adapter.processes[1].args).toEqual([
|
|
199
|
+
'--conversation',
|
|
200
|
+
CAPTURED_SESSION_ID,
|
|
201
|
+
'--mode',
|
|
202
|
+
'plan',
|
|
203
|
+
'-p',
|
|
204
|
+
'second message',
|
|
205
|
+
]);
|
|
206
|
+
});
|
|
207
|
+
it('gracefully falls back to -c on turn 2 if history is absent', async () => {
|
|
208
|
+
const adapter = new TestAntigravityCliAdapter();
|
|
209
|
+
const sessionEvents = [];
|
|
210
|
+
adapter.on('session', (id) => sessionEvents.push(id));
|
|
211
|
+
await adapter.start('/workspace');
|
|
212
|
+
await adapter.send('first message');
|
|
213
|
+
expect(sessionEvents).toHaveLength(0);
|
|
214
|
+
expect(adapter.processes[0].args).toEqual(['--mode', 'plan', '-p', 'first message']);
|
|
215
|
+
// Complete turn 1 without writing history
|
|
216
|
+
adapter.processes[0].child.emit('close', 0);
|
|
217
|
+
// Second turn uses -c
|
|
218
|
+
await adapter.send('second message');
|
|
219
|
+
expect(adapter.processes[1].args).toEqual(['-c', '--mode', 'plan', '-p', 'second message']);
|
|
220
|
+
});
|
|
221
|
+
});
|
|
222
|
+
//# sourceMappingURL=AntigravityCliAdapter.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AntigravityCliAdapter.test.js","sourceRoot":"","sources":["../../src/agent/AntigravityCliAdapter.test.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAC9B,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAClC,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAE9B,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAC3C,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,EAAE,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAC;AAEzE,OAAO,EACL,qBAAqB,EACrB,wBAAwB,EACxB,oCAAoC,GACrC,MAAM,4BAA4B,CAAC;AAEpC,MAAM,UAAU,GAAG,sCAAsC,CAAC;AAC1D,MAAM,mBAAmB,GAAG,sCAAsC,CAAC;AAEnE,MAAM,SAAU,SAAQ,YAAY;IAClC,KAAK,GAAG,EAAE,KAAK,EAAE,EAAE,CAAC,EAAE,EAAE,EAAE,GAAG,EAAE,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC;IACzC,MAAM,GAAG,IAAI,YAAY,EAAE,CAAC;IAC5B,MAAM,GAAG,IAAI,YAAY,EAAE,CAAC;IAC5B,MAAM,GAAG,KAAK,CAAC;IACf,QAAQ,GAAkB,IAAI,CAAC;IAC/B,GAAG,CAAqB;CACzB;AAED,MAAM,yBAA0B,SAAQ,qBAAqB;IAClD,SAAS,GAAgD,EAAE,CAAC;IAE3D,YAAY,CAAC,IAAc;QACnC,MAAM,KAAK,GAAG,IAAI,SAAS,EAA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CAAC,CAAC,CAuBrF;
|
|
1
|
+
{"version":3,"file":"adapters.d.ts","sourceRoot":"","sources":["../../src/agent/adapters.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAA0B,MAAM,uBAAuB,CAAC;AAiDjF;;;;;;;;;;;GAWG;AACH,MAAM,MAAM,kBAAkB,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,GAAG;IAAE,UAAU,IAAI,IAAI,CAAA;CAAE,CAAC;AAEvE,wBAAgB,YAAY,CAAC,CAAC,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,KAAK,SAAQ,GAAG,kBAAkB,CAAC,CAAC,CAAC,CAuBrF;AAuHD,OAAO,EAAE,gBAAgB,EAAE,CAAC"}
|
package/dist/agent/adapters.js
CHANGED
|
@@ -108,9 +108,27 @@ ProviderRegistry.register({
|
|
|
108
108
|
name: 'Antigravity (Local CLI)',
|
|
109
109
|
icon: 'Terminal',
|
|
110
110
|
accessLabel: 'Harness-managed access',
|
|
111
|
-
|
|
111
|
+
executionProfiles: [
|
|
112
|
+
{ id: 'review', label: 'Review only', description: 'Reads and plans; no source edits.' },
|
|
113
|
+
{
|
|
114
|
+
id: 'workspace-write',
|
|
115
|
+
label: 'Edit workspace',
|
|
116
|
+
description: 'Auto-accepts in-workspace file edits and common filesystem actions.',
|
|
117
|
+
},
|
|
118
|
+
],
|
|
119
|
+
defaultExecutionProfile: 'review',
|
|
120
|
+
capabilities: {
|
|
121
|
+
transport: 'cli-print',
|
|
122
|
+
// agy assigns ids for new conversations; --conversation only resumes an
|
|
123
|
+
// id that already exists in the provider's workspace-scoped history.
|
|
124
|
+
sessionIdentity: 'provider-assigned',
|
|
125
|
+
workspaceAccess: 'harness-managed',
|
|
126
|
+
sessionIdFormat: 'uuid',
|
|
127
|
+
},
|
|
112
128
|
isConfigured: () => antigravityCliStatus().usable,
|
|
113
129
|
getStatusMessage: () => antigravityCliStatus().message,
|
|
130
|
+
getSetupHelp: () => setupHelp(antigravityCliStatus()),
|
|
131
|
+
invalidateStatus: () => antigravityCliStatus.invalidate(),
|
|
114
132
|
createInstance: () => new AntigravityCliAdapter()
|
|
115
133
|
});
|
|
116
134
|
ProviderRegistry.register({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"adapters.js","sourceRoot":"","sources":["../../src/agent/adapters.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAA0B,MAAM,uBAAuB,CAAC;AACjF,OAAO,EAEL,0BAA0B,EAC1B,qBAAqB,EACrB,oBAAoB,EACpB,sBAAsB,GACvB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAC3D,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC/C,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAC3D,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AACzD,OAAO,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AACnE,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAE3D,gBAAgB,CAAC,QAAQ,CAAC;IACxB,EAAE,EAAE,eAAe;IACnB,IAAI,EAAE,QAAQ;IACd,IAAI,EAAE,KAAK;IACX,WAAW,EAAE,iBAAiB;IAC9B,YAAY,EAAE,EAAE,SAAS,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,EAAE,eAAe,EAAE,WAAW,EAAE;IAChG,YAAY,EAAE,GAAG,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,iBAAiB;IACnD,gBAAgB,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,GAAG,CAAC,iBAAiB,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,2DAA2D;IAC/H,cAAc,EAAE,GAAG,EAAE,CAAC,IAAI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,CAAC,IAAI,iBAAiB,EAAE;CAC9C,CAAC,CAAC;AAEH,OAAO,EAAE,gBAAgB,EAAE,CAAC"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{_ as e,b as t,g as n,h as r,m as i,t as a}from"./button-cPldH5S4.js";import{t as ee,xt as o}from"./spinner-BCEaGbib.js";import{t as s}from"./bot-wH0FKlic.js";import{a as te,c,i as l,n as ne,o as re,r as ie,s as ae,t as oe}from"./alert-dialog-DjwFcE6b.js";import{t as se}from"./search-ChVovkOL.js";import{t as ce}from"./trash-2-Da8F2gKd.js";import{B as le,Ct as u,G as ue,R as de,Tt as fe,Y as pe,d,dt as me,et as he,f,ft as ge,g as p,h as m,kt as _e,mt as ve,p as h,u as g}from"./index-CfQEnn52.js";import{t as _}from"./badge-BnkhqVEF.js";import{t as ye}from"./card-82INhRRE.js";import{a as v,i as be,n as y,r as b,t as x}from"./empty-DWyDwDYB.js";import{t as S}from"./label-JFgMNsTn.js";import{t as C}from"./textarea-D3-elOAa.js";var xe=r(`file-up`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M12 12v6`,key:`3ahymv`}],[`path`,{d:`m15 15-3-3-3 3`,key:`15xj92`}]]),w=t(e(),1),T=n(),E={id:``,name:``,category:`general`,description:``,developerInstructions:``};function D(e){return e.toLowerCase().trim().replace(/[^a-z0-9]+/g,`-`).replace(/^-+|-+$/g,``)}function O({showToast:e}){let[t,n]=(0,w.useState)(`global`),[r,O]=(0,w.useState)(``),[Se,k]=(0,w.useState)(!1),[A,j]=(0,w.useState)(!1),[M,N]=(0,w.useState)(null),[P,F]=(0,w.useState)(E),[I,L]=(0,w.useState)(``),[R,z]=(0,w.useState)(null),[B,V]=(0,w.useState)(null),{data:H=[],isLoading:Ce,isError:we}=de(),{data:U=[]}=ge(),W=me(t===`global`?``:t),G=he(),K=pe(),q=ue(),J=le(),Y=t!==`global`,Te=U.find(e=>e.id===t),X=!Y||Te?.assistants?.includes(`codex`),Z=Y&&X&&!W.isLoading&&!W.isError&&!!W.data;(0,w.useEffect)(()=>{if(!Y){z(null);return}W.data&&z([...W.data.enabledAgents??[]])},[Y,t,W.data]);let Q=(0,w.useMemo)(()=>{let e=r.trim().toLowerCase();return e?H.filter(t=>[t.name,t.description,t.category].some(t=>t.toLowerCase().includes(e))):H},[H,r]),Ee=new Set(R??W.data?.enabledAgents??[]);function $(){N(null),F(E),k(!0)}function De(e){N(e.id),F({id:e.id,name:e.name,category:e.category,description:e.description,developerInstructions:e.developerInstructions,model:e.model,modelReasoningEffort:e.modelReasoningEffort,sandboxMode:e.sandboxMode}),k(!0)}async function Oe(){try{let t=M??D(P.name);await G.mutateAsync({...P,id:t,name:t}),k(!1),e?.(`Codex agent saved`,`success`)}catch(t){e?.(t instanceof Error?t.message:`Failed to save agent`,`error`)}}async function ke(){try{await K.mutateAsync({toml:I,category:`general`}),j(!1),L(``),e?.(`Codex agent imported`,`success`)}catch(t){e?.(t instanceof Error?t.message:`Failed to import agent`,`error`)}}async function Ae(){if(B)try{await q.mutateAsync(B.id),V(null),e?.(`Agent deleted from the personal catalog`,`info`)}catch(t){e?.(t instanceof Error?t.message:`Failed to delete agent`,`error`)}}function je(e){if(!Z||R===null)return;let t=new Set(R);t.has(e)?t.delete(e):t.add(e),z([...t])}async function Me(){if(!(!W.data||R===null))try{await J.mutateAsync({workspaceId:t,expectedRevision:W.data.revision??0,enabledSkills:W.data.enabledSkills,enabledAgents:R,enabledCategories:W.data.enabledCategories??[]}),e?.(`Agent selection saved. Refresh the workspace to apply it.`,`success`)}catch(t){e?.(t instanceof Error?t.message:`Failed to save agent selection`,`error`)}}return(0,T.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col`,children:[(0,T.jsxs)(`header`,{className:`flex flex-wrap items-center justify-between gap-4 border-b border-border px-6 py-5`,children:[(0,T.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,T.jsx)(`div`,{className:`rounded-lg bg-primary/10 p-2 text-primary`,children:(0,T.jsx)(s,{className:`h-5 w-5`})}),(0,T.jsxs)(`div`,{children:[(0,T.jsx)(`h1`,{className:`text-xl font-bold tracking-tight`,children:`Codex Agent Library`}),(0,T.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Create and reuse project-scoped Codex custom agents.`})]})]}),(0,T.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,T.jsx)(a,{render:(0,T.jsx)(ve,{to:`/skills`}),variant:`outline`,size:`sm`,children:`Skills`}),(0,T.jsxs)(`div`,{className:`flex items-center gap-2 rounded-lg border border-border bg-muted/50 px-3 py-1.5`,children:[(0,T.jsx)(fe,{className:`h-4 w-4 text-muted-foreground`}),(0,T.jsx)(S,{htmlFor:`agent-scope`,className:`text-xs text-muted-foreground`,children:`Scope`}),(0,T.jsxs)(`select`,{id:`agent-scope`,value:t,onChange:e=>n(e.target.value),className:`cursor-pointer bg-transparent text-xs font-semibold text-foreground focus:outline-none`,children:[(0,T.jsx)(`option`,{value:`global`,children:`Personal catalog`}),U.map(e=>(0,T.jsx)(`option`,{value:e.id,children:e.id},e.id))]})]}),Y?(0,T.jsx)(a,{size:`sm`,onClick:Me,disabled:!Z||J.isPending,children:J.isPending?`Saving…`:`Save selection`}):(0,T.jsxs)(T.Fragment,{children:[(0,T.jsxs)(a,{variant:`outline`,size:`sm`,onClick:()=>j(!0),children:[(0,T.jsx)(xe,{className:`mr-1.5 h-4 w-4`}),`Import TOML`]}),(0,T.jsxs)(a,{size:`sm`,onClick:$,children:[(0,T.jsx)(u,{className:`mr-1.5 h-4 w-4`}),`New agent`]})]})]})]}),(0,T.jsx)(`div`,{className:`border-b border-border/60 bg-muted/20 px-6 py-3`,children:(0,T.jsxs)(`div`,{className:`relative max-w-md`,children:[(0,T.jsx)(se,{className:`absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground`}),(0,T.jsx)(o,{value:r,onChange:e=>O(e.target.value),placeholder:`Search agents…`,className:`pl-9`})]})}),(0,T.jsx)(`main`,{className:`min-h-0 flex-1 overflow-auto p-6`,children:Ce||Y&&W.isLoading?(0,T.jsx)(`div`,{className:`flex justify-center p-12`,children:(0,T.jsx)(ee,{})}):we||Y&&W.isError?(0,T.jsx)(x,{className:`border border-dashed py-12`,children:(0,T.jsxs)(b,{children:[(0,T.jsx)(v,{children:`Resources could not be loaded`}),(0,T.jsx)(y,{children:`Assignment controls remain disabled to protect the saved selection.`})]})}):Y&&!X?(0,T.jsx)(x,{className:`border border-dashed py-12`,children:(0,T.jsxs)(b,{children:[(0,T.jsx)(v,{children:`Codex is not enabled for this workspace`}),(0,T.jsx)(y,{children:`Add Codex to the workspace before assigning Codex-native agents.`})]})}):Q.length===0?(0,T.jsxs)(x,{className:`border border-dashed py-12`,children:[(0,T.jsx)(be,{children:(0,T.jsx)(s,{className:`h-8 w-8 text-muted-foreground`})}),(0,T.jsxs)(b,{children:[(0,T.jsx)(v,{children:`No Codex agents found`}),(0,T.jsx)(y,{children:`Create an agent or import a native TOML definition.`})]}),!Y&&(0,T.jsxs)(a,{size:`sm`,onClick:$,children:[(0,T.jsx)(u,{className:`mr-1.5 h-4 w-4`}),`New agent`]})]}):(0,T.jsx)(`div`,{className:`mx-auto grid max-w-6xl grid-cols-1 gap-4 md:grid-cols-2 xl:grid-cols-3`,children:Q.map(e=>{let t=Ee.has(e.id);return(0,T.jsxs)(ye,{className:i(`flex flex-col gap-4 p-4`,Y&&!t&&`opacity-60`),children:[(0,T.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,T.jsxs)(`div`,{children:[(0,T.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,T.jsx)(`h2`,{className:`font-semibold`,children:e.name}),(0,T.jsx)(_,{variant:`outline`,children:`Codex`})]}),(0,T.jsx)(`p`,{className:`mt-2 text-sm text-muted-foreground`,children:e.description})]}),Y?(0,T.jsxs)(a,{variant:t?`default`:`outline`,size:`sm`,onClick:()=>je(e.id),disabled:!Z,children:[(0,T.jsx)(_e,{className:i(`mr-1 h-3.5 w-3.5`,!t&&`opacity-0`)}),t?`Enabled`:`Disabled`]}):(0,T.jsxs)(`div`,{className:`flex gap-1`,children:[(0,T.jsx)(a,{variant:`ghost`,size:`icon`,"aria-label":`Edit ${e.name}`,onClick:()=>De(e),children:(0,T.jsx)(c,{className:`h-4 w-4`})}),(0,T.jsx)(a,{variant:`ghost`,size:`icon`,"aria-label":`Delete ${e.name}`,onClick:()=>V(e),children:(0,T.jsx)(ce,{className:`h-4 w-4`})})]})]}),(0,T.jsxs)(`div`,{className:`flex flex-wrap gap-2 text-xs text-muted-foreground`,children:[e.sandboxMode&&(0,T.jsx)(_,{variant:`secondary`,children:e.sandboxMode}),e.modelReasoningEffort&&(0,T.jsx)(_,{variant:`secondary`,children:e.modelReasoningEffort}),e.model&&(0,T.jsx)(_,{variant:`secondary`,children:e.model})]})]},e.id)})})}),(0,T.jsx)(g,{open:Se,onOpenChange:k,children:(0,T.jsxs)(m,{className:`max-w-2xl`,children:[(0,T.jsxs)(h,{children:[(0,T.jsx)(p,{children:M?`Edit Codex agent`:`Create Codex agent`}),(0,T.jsx)(d,{children:`Only the current stable native fields are managed. Omitted settings inherit from Codex.`})]}),(0,T.jsxs)(`div`,{className:`grid gap-4 py-2`,children:[(0,T.jsxs)(`div`,{className:`grid gap-2`,children:[(0,T.jsx)(S,{htmlFor:`agent-name`,children:`Name`}),(0,T.jsx)(o,{id:`agent-name`,value:P.name,disabled:!!M,onChange:e=>F({...P,name:D(e.target.value)}),placeholder:`code-reviewer`})]}),(0,T.jsxs)(`div`,{className:`grid gap-2`,children:[(0,T.jsx)(S,{htmlFor:`agent-description`,children:`Description`}),(0,T.jsx)(o,{id:`agent-description`,value:P.description,onChange:e=>F({...P,description:e.target.value}),placeholder:`Use when reviewing a fixed diff for correctness and security.`})]}),(0,T.jsxs)(`div`,{className:`grid gap-2`,children:[(0,T.jsx)(S,{htmlFor:`agent-instructions`,children:`Developer instructions`}),(0,T.jsx)(C,{id:`agent-instructions`,value:P.developerInstructions,onChange:e=>F({...P,developerInstructions:e.target.value}),className:`min-h-48 font-mono`})]}),(0,T.jsxs)(`div`,{className:`grid grid-cols-1 gap-3 sm:grid-cols-3`,children:[(0,T.jsxs)(`div`,{className:`grid gap-2`,children:[(0,T.jsx)(S,{htmlFor:`agent-model`,children:`Model override`}),(0,T.jsx)(o,{id:`agent-model`,value:P.model??``,onChange:e=>F({...P,model:e.target.value||void 0}),placeholder:`Inherit`})]}),(0,T.jsxs)(`div`,{className:`grid gap-2`,children:[(0,T.jsx)(S,{htmlFor:`agent-effort`,children:`Reasoning`}),(0,T.jsxs)(`select`,{id:`agent-effort`,value:P.modelReasoningEffort??``,onChange:e=>F({...P,modelReasoningEffort:e.target.value||void 0}),className:`h-9 rounded-md border border-input bg-background px-3 text-sm`,children:[(0,T.jsx)(`option`,{value:``,children:`Inherit`}),(0,T.jsx)(`option`,{value:`low`,children:`Low`}),(0,T.jsx)(`option`,{value:`medium`,children:`Medium`}),(0,T.jsx)(`option`,{value:`high`,children:`High`}),(0,T.jsx)(`option`,{value:`xhigh`,children:`XHigh`}),(0,T.jsx)(`option`,{value:`max`,children:`Max`}),(0,T.jsx)(`option`,{value:`ultra`,children:`Ultra`})]})]}),(0,T.jsxs)(`div`,{className:`grid gap-2`,children:[(0,T.jsx)(S,{htmlFor:`agent-sandbox`,children:`Sandbox`}),(0,T.jsxs)(`select`,{id:`agent-sandbox`,value:P.sandboxMode??``,onChange:e=>F({...P,sandboxMode:e.target.value||void 0}),className:`h-9 rounded-md border border-input bg-background px-3 text-sm`,children:[(0,T.jsx)(`option`,{value:``,children:`Inherit`}),(0,T.jsx)(`option`,{value:`read-only`,children:`Read only`}),(0,T.jsx)(`option`,{value:`workspace-write`,children:`Workspace write`})]})]})]})]}),(0,T.jsxs)(f,{children:[(0,T.jsx)(a,{variant:`outline`,onClick:()=>k(!1),children:`Cancel`}),(0,T.jsx)(a,{onClick:Oe,disabled:G.isPending||!P.name||!P.description||!P.developerInstructions,children:G.isPending?`Saving…`:`Save agent`})]})]})}),(0,T.jsx)(g,{open:A,onOpenChange:j,children:(0,T.jsxs)(m,{className:`max-w-2xl`,children:[(0,T.jsxs)(h,{children:[(0,T.jsx)(p,{children:`Import Codex agent TOML`}),(0,T.jsx)(d,{children:`The import accepts the required native fields and supported model, reasoning, and sandbox overrides.`})]}),(0,T.jsx)(C,{value:I,onChange:e=>L(e.target.value),className:`min-h-72 font-mono`,placeholder:`name = "reviewer"
|
|
1
|
+
import{_ as e,b as t,g as n,h as r,m as i,t as a}from"./button-cPldH5S4.js";import{t as ee,xt as o}from"./spinner-BCEaGbib.js";import{t as s}from"./bot-wH0FKlic.js";import{a as te,c,i as l,n as ne,o as re,r as ie,s as ae,t as oe}from"./alert-dialog-CroDe9HW.js";import{t as se}from"./search-ChVovkOL.js";import{t as ce}from"./trash-2-Da8F2gKd.js";import{At as le,B as ue,Ct as u,Et as de,G as fe,R as pe,Y as me,d,dt as he,et as ge,f,ft as _e,g as p,h as m,mt as ve,p as h,u as g}from"./index-CcIOIZ24.js";import{t as _}from"./badge-BnkhqVEF.js";import{t as ye}from"./card-82INhRRE.js";import{a as v,i as be,n as y,r as b,t as x}from"./empty-DWyDwDYB.js";import{t as S}from"./label-JFgMNsTn.js";import{t as C}from"./textarea-D3-elOAa.js";var xe=r(`file-up`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M12 12v6`,key:`3ahymv`}],[`path`,{d:`m15 15-3-3-3 3`,key:`15xj92`}]]),w=t(e(),1),T=n(),E={id:``,name:``,category:`general`,description:``,developerInstructions:``};function D(e){return e.toLowerCase().trim().replace(/[^a-z0-9]+/g,`-`).replace(/^-+|-+$/g,``)}function O({showToast:e}){let[t,n]=(0,w.useState)(`global`),[r,O]=(0,w.useState)(``),[Se,k]=(0,w.useState)(!1),[A,j]=(0,w.useState)(!1),[M,N]=(0,w.useState)(null),[P,F]=(0,w.useState)(E),[I,L]=(0,w.useState)(``),[R,z]=(0,w.useState)(null),[B,V]=(0,w.useState)(null),{data:H=[],isLoading:Ce,isError:we}=pe(),{data:U=[]}=_e(),W=he(t===`global`?``:t),G=ge(),K=me(),q=fe(),J=ue(),Y=t!==`global`,Te=U.find(e=>e.id===t),X=!Y||Te?.assistants?.includes(`codex`),Z=Y&&X&&!W.isLoading&&!W.isError&&!!W.data;(0,w.useEffect)(()=>{if(!Y){z(null);return}W.data&&z([...W.data.enabledAgents??[]])},[Y,t,W.data]);let Q=(0,w.useMemo)(()=>{let e=r.trim().toLowerCase();return e?H.filter(t=>[t.name,t.description,t.category].some(t=>t.toLowerCase().includes(e))):H},[H,r]),Ee=new Set(R??W.data?.enabledAgents??[]);function $(){N(null),F(E),k(!0)}function De(e){N(e.id),F({id:e.id,name:e.name,category:e.category,description:e.description,developerInstructions:e.developerInstructions,model:e.model,modelReasoningEffort:e.modelReasoningEffort,sandboxMode:e.sandboxMode}),k(!0)}async function Oe(){try{let t=M??D(P.name);await G.mutateAsync({...P,id:t,name:t}),k(!1),e?.(`Codex agent saved`,`success`)}catch(t){e?.(t instanceof Error?t.message:`Failed to save agent`,`error`)}}async function ke(){try{await K.mutateAsync({toml:I,category:`general`}),j(!1),L(``),e?.(`Codex agent imported`,`success`)}catch(t){e?.(t instanceof Error?t.message:`Failed to import agent`,`error`)}}async function Ae(){if(B)try{await q.mutateAsync(B.id),V(null),e?.(`Agent deleted from the personal catalog`,`info`)}catch(t){e?.(t instanceof Error?t.message:`Failed to delete agent`,`error`)}}function je(e){if(!Z||R===null)return;let t=new Set(R);t.has(e)?t.delete(e):t.add(e),z([...t])}async function Me(){if(!(!W.data||R===null))try{await J.mutateAsync({workspaceId:t,expectedRevision:W.data.revision??0,enabledSkills:W.data.enabledSkills,enabledAgents:R,enabledCategories:W.data.enabledCategories??[]}),e?.(`Agent selection saved. Refresh the workspace to apply it.`,`success`)}catch(t){e?.(t instanceof Error?t.message:`Failed to save agent selection`,`error`)}}return(0,T.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col`,children:[(0,T.jsxs)(`header`,{className:`flex flex-wrap items-center justify-between gap-4 border-b border-border px-6 py-5`,children:[(0,T.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,T.jsx)(`div`,{className:`rounded-lg bg-primary/10 p-2 text-primary`,children:(0,T.jsx)(s,{className:`h-5 w-5`})}),(0,T.jsxs)(`div`,{children:[(0,T.jsx)(`h1`,{className:`text-xl font-bold tracking-tight`,children:`Codex Agent Library`}),(0,T.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Create and reuse project-scoped Codex custom agents.`})]})]}),(0,T.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,T.jsx)(a,{render:(0,T.jsx)(ve,{to:`/skills`}),variant:`outline`,size:`sm`,children:`Skills`}),(0,T.jsxs)(`div`,{className:`flex items-center gap-2 rounded-lg border border-border bg-muted/50 px-3 py-1.5`,children:[(0,T.jsx)(de,{className:`h-4 w-4 text-muted-foreground`}),(0,T.jsx)(S,{htmlFor:`agent-scope`,className:`text-xs text-muted-foreground`,children:`Scope`}),(0,T.jsxs)(`select`,{id:`agent-scope`,value:t,onChange:e=>n(e.target.value),className:`cursor-pointer bg-transparent text-xs font-semibold text-foreground focus:outline-none`,children:[(0,T.jsx)(`option`,{value:`global`,children:`Personal catalog`}),U.map(e=>(0,T.jsx)(`option`,{value:e.id,children:e.id},e.id))]})]}),Y?(0,T.jsx)(a,{size:`sm`,onClick:Me,disabled:!Z||J.isPending,children:J.isPending?`Saving…`:`Save selection`}):(0,T.jsxs)(T.Fragment,{children:[(0,T.jsxs)(a,{variant:`outline`,size:`sm`,onClick:()=>j(!0),children:[(0,T.jsx)(xe,{className:`mr-1.5 h-4 w-4`}),`Import TOML`]}),(0,T.jsxs)(a,{size:`sm`,onClick:$,children:[(0,T.jsx)(u,{className:`mr-1.5 h-4 w-4`}),`New agent`]})]})]})]}),(0,T.jsx)(`div`,{className:`border-b border-border/60 bg-muted/20 px-6 py-3`,children:(0,T.jsxs)(`div`,{className:`relative max-w-md`,children:[(0,T.jsx)(se,{className:`absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground`}),(0,T.jsx)(o,{value:r,onChange:e=>O(e.target.value),placeholder:`Search agents…`,className:`pl-9`})]})}),(0,T.jsx)(`main`,{className:`min-h-0 flex-1 overflow-auto p-6`,children:Ce||Y&&W.isLoading?(0,T.jsx)(`div`,{className:`flex justify-center p-12`,children:(0,T.jsx)(ee,{})}):we||Y&&W.isError?(0,T.jsx)(x,{className:`border border-dashed py-12`,children:(0,T.jsxs)(b,{children:[(0,T.jsx)(v,{children:`Resources could not be loaded`}),(0,T.jsx)(y,{children:`Assignment controls remain disabled to protect the saved selection.`})]})}):Y&&!X?(0,T.jsx)(x,{className:`border border-dashed py-12`,children:(0,T.jsxs)(b,{children:[(0,T.jsx)(v,{children:`Codex is not enabled for this workspace`}),(0,T.jsx)(y,{children:`Add Codex to the workspace before assigning Codex-native agents.`})]})}):Q.length===0?(0,T.jsxs)(x,{className:`border border-dashed py-12`,children:[(0,T.jsx)(be,{children:(0,T.jsx)(s,{className:`h-8 w-8 text-muted-foreground`})}),(0,T.jsxs)(b,{children:[(0,T.jsx)(v,{children:`No Codex agents found`}),(0,T.jsx)(y,{children:`Create an agent or import a native TOML definition.`})]}),!Y&&(0,T.jsxs)(a,{size:`sm`,onClick:$,children:[(0,T.jsx)(u,{className:`mr-1.5 h-4 w-4`}),`New agent`]})]}):(0,T.jsx)(`div`,{className:`mx-auto grid max-w-6xl grid-cols-1 gap-4 md:grid-cols-2 xl:grid-cols-3`,children:Q.map(e=>{let t=Ee.has(e.id);return(0,T.jsxs)(ye,{className:i(`flex flex-col gap-4 p-4`,Y&&!t&&`opacity-60`),children:[(0,T.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,T.jsxs)(`div`,{children:[(0,T.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,T.jsx)(`h2`,{className:`font-semibold`,children:e.name}),(0,T.jsx)(_,{variant:`outline`,children:`Codex`})]}),(0,T.jsx)(`p`,{className:`mt-2 text-sm text-muted-foreground`,children:e.description})]}),Y?(0,T.jsxs)(a,{variant:t?`default`:`outline`,size:`sm`,onClick:()=>je(e.id),disabled:!Z,children:[(0,T.jsx)(le,{className:i(`mr-1 h-3.5 w-3.5`,!t&&`opacity-0`)}),t?`Enabled`:`Disabled`]}):(0,T.jsxs)(`div`,{className:`flex gap-1`,children:[(0,T.jsx)(a,{variant:`ghost`,size:`icon`,"aria-label":`Edit ${e.name}`,onClick:()=>De(e),children:(0,T.jsx)(c,{className:`h-4 w-4`})}),(0,T.jsx)(a,{variant:`ghost`,size:`icon`,"aria-label":`Delete ${e.name}`,onClick:()=>V(e),children:(0,T.jsx)(ce,{className:`h-4 w-4`})})]})]}),(0,T.jsxs)(`div`,{className:`flex flex-wrap gap-2 text-xs text-muted-foreground`,children:[e.sandboxMode&&(0,T.jsx)(_,{variant:`secondary`,children:e.sandboxMode}),e.modelReasoningEffort&&(0,T.jsx)(_,{variant:`secondary`,children:e.modelReasoningEffort}),e.model&&(0,T.jsx)(_,{variant:`secondary`,children:e.model})]})]},e.id)})})}),(0,T.jsx)(g,{open:Se,onOpenChange:k,children:(0,T.jsxs)(m,{className:`max-w-2xl`,children:[(0,T.jsxs)(h,{children:[(0,T.jsx)(p,{children:M?`Edit Codex agent`:`Create Codex agent`}),(0,T.jsx)(d,{children:`Only the current stable native fields are managed. Omitted settings inherit from Codex.`})]}),(0,T.jsxs)(`div`,{className:`grid gap-4 py-2`,children:[(0,T.jsxs)(`div`,{className:`grid gap-2`,children:[(0,T.jsx)(S,{htmlFor:`agent-name`,children:`Name`}),(0,T.jsx)(o,{id:`agent-name`,value:P.name,disabled:!!M,onChange:e=>F({...P,name:D(e.target.value)}),placeholder:`code-reviewer`})]}),(0,T.jsxs)(`div`,{className:`grid gap-2`,children:[(0,T.jsx)(S,{htmlFor:`agent-description`,children:`Description`}),(0,T.jsx)(o,{id:`agent-description`,value:P.description,onChange:e=>F({...P,description:e.target.value}),placeholder:`Use when reviewing a fixed diff for correctness and security.`})]}),(0,T.jsxs)(`div`,{className:`grid gap-2`,children:[(0,T.jsx)(S,{htmlFor:`agent-instructions`,children:`Developer instructions`}),(0,T.jsx)(C,{id:`agent-instructions`,value:P.developerInstructions,onChange:e=>F({...P,developerInstructions:e.target.value}),className:`min-h-48 font-mono`})]}),(0,T.jsxs)(`div`,{className:`grid grid-cols-1 gap-3 sm:grid-cols-3`,children:[(0,T.jsxs)(`div`,{className:`grid gap-2`,children:[(0,T.jsx)(S,{htmlFor:`agent-model`,children:`Model override`}),(0,T.jsx)(o,{id:`agent-model`,value:P.model??``,onChange:e=>F({...P,model:e.target.value||void 0}),placeholder:`Inherit`})]}),(0,T.jsxs)(`div`,{className:`grid gap-2`,children:[(0,T.jsx)(S,{htmlFor:`agent-effort`,children:`Reasoning`}),(0,T.jsxs)(`select`,{id:`agent-effort`,value:P.modelReasoningEffort??``,onChange:e=>F({...P,modelReasoningEffort:e.target.value||void 0}),className:`h-9 rounded-md border border-input bg-background px-3 text-sm`,children:[(0,T.jsx)(`option`,{value:``,children:`Inherit`}),(0,T.jsx)(`option`,{value:`low`,children:`Low`}),(0,T.jsx)(`option`,{value:`medium`,children:`Medium`}),(0,T.jsx)(`option`,{value:`high`,children:`High`}),(0,T.jsx)(`option`,{value:`xhigh`,children:`XHigh`}),(0,T.jsx)(`option`,{value:`max`,children:`Max`}),(0,T.jsx)(`option`,{value:`ultra`,children:`Ultra`})]})]}),(0,T.jsxs)(`div`,{className:`grid gap-2`,children:[(0,T.jsx)(S,{htmlFor:`agent-sandbox`,children:`Sandbox`}),(0,T.jsxs)(`select`,{id:`agent-sandbox`,value:P.sandboxMode??``,onChange:e=>F({...P,sandboxMode:e.target.value||void 0}),className:`h-9 rounded-md border border-input bg-background px-3 text-sm`,children:[(0,T.jsx)(`option`,{value:``,children:`Inherit`}),(0,T.jsx)(`option`,{value:`read-only`,children:`Read only`}),(0,T.jsx)(`option`,{value:`workspace-write`,children:`Workspace write`})]})]})]})]}),(0,T.jsxs)(f,{children:[(0,T.jsx)(a,{variant:`outline`,onClick:()=>k(!1),children:`Cancel`}),(0,T.jsx)(a,{onClick:Oe,disabled:G.isPending||!P.name||!P.description||!P.developerInstructions,children:G.isPending?`Saving…`:`Save agent`})]})]})}),(0,T.jsx)(g,{open:A,onOpenChange:j,children:(0,T.jsxs)(m,{className:`max-w-2xl`,children:[(0,T.jsxs)(h,{children:[(0,T.jsx)(p,{children:`Import Codex agent TOML`}),(0,T.jsx)(d,{children:`The import accepts the required native fields and supported model, reasoning, and sandbox overrides.`})]}),(0,T.jsx)(C,{value:I,onChange:e=>L(e.target.value),className:`min-h-72 font-mono`,placeholder:`name = "reviewer"
|
|
2
2
|
description = "Use for code review."
|
|
3
3
|
developer_instructions = "Review the fixed diff."`}),(0,T.jsxs)(f,{children:[(0,T.jsx)(a,{variant:`outline`,onClick:()=>j(!1),children:`Cancel`}),(0,T.jsx)(a,{onClick:ke,disabled:K.isPending||!I.trim(),children:K.isPending?`Importing…`:`Import agent`})]})]})}),(0,T.jsx)(oe,{open:B!==null,onOpenChange:e=>!e&&V(null),children:(0,T.jsxs)(re,{children:[(0,T.jsxs)(te,{children:[(0,T.jsxs)(ae,{children:[`Delete “`,B?.name,`”?`]}),(0,T.jsx)(ie,{children:`This removes the agent from the personal catalog. Existing workspace copies remain until the workspace is refreshed.`})]}),(0,T.jsxs)(l,{children:[(0,T.jsx)(ne,{render:(0,T.jsx)(a,{variant:`outline`,children:`Cancel`})}),(0,T.jsx)(a,{variant:`destructive`,onClick:Ae,disabled:q.isPending,children:q.isPending?`Deleting…`:`Delete agent`})]})]})})]})}export{O as AgentsPage};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{g as e,t}from"./button-cPldH5S4.js";import{t as n}from"./git-branch-Dw55pQWa.js";import{Ct as r,
|
|
1
|
+
import{g as e,t}from"./button-cPldH5S4.js";import{t as n}from"./git-branch-Dw55pQWa.js";import{Ct as r,Et as i,Nt as a,St as o,c as s,l as c,wt as l,yt as u}from"./index-CcIOIZ24.js";import{n as d,t as f}from"./card-82INhRRE.js";import{a as p,i as m,n as h,r as g,t as _}from"./empty-DWyDwDYB.js";import{t as v}from"./skeleton-CCPbfn1L.js";var y=e();function b({icon:e,label:t,value:n,tone:r}){return(0,y.jsxs)(d,{className:`gap-3.5 p-4`,children:[(0,y.jsx)(`div`,{className:`grid h-9 w-9 shrink-0 place-items-center rounded-md ${r}`,children:e}),(0,y.jsxs)(`div`,{className:`min-w-0`,children:[(0,y.jsx)(`div`,{className:`text-xl font-bold leading-none text-foreground`,children:n}),(0,y.jsx)(`div`,{className:`mt-1 text-xs text-muted-foreground`,children:t})]})]})}function x({workspaces:e,workspaceStatuses:x,workspacesLoading:S,statusesLoading:C,onOpenWorkspace:w,onNewWorkspace:T}){let E=Object.values(x),D=E.filter(e=>e.changedFiles>0).length,O=E.reduce((e,t)=>e+t.runningServices,0),k=E.filter(e=>e.pendingValidation).length;return(0,y.jsxs)(`div`,{className:`mx-auto max-w-6xl animate-fade-in`,children:[(0,y.jsxs)(`header`,{className:`mb-6`,children:[(0,y.jsx)(`h1`,{className:`text-xl font-semibold text-foreground`,children:`Overview`}),(0,y.jsx)(`p`,{className:`mt-1 text-sm text-muted-foreground`,children:`Your multi-repo environment at a glance.`})]}),(0,y.jsxs)(`div`,{className:`mb-8 grid grid-cols-2 gap-3 lg:grid-cols-4`,children:[(0,y.jsx)(b,{icon:(0,y.jsx)(i,{size:18,className:`text-primary`}),tone:`bg-primary/10`,label:`Workspaces`,value:e.length}),(0,y.jsx)(b,{icon:(0,y.jsx)(n,{size:18,className:`text-warning`}),tone:`bg-warning/10`,label:`With uncommitted changes`,value:D}),(0,y.jsx)(b,{icon:(0,y.jsx)(l,{size:18,className:`text-running`}),tone:`bg-running/10`,label:`Running services`,value:O}),(0,y.jsx)(b,{icon:(0,y.jsx)(u,{size:18,className:`text-warning`}),tone:`bg-warning/10`,label:`Need validation`,value:k})]}),(0,y.jsx)(`div`,{className:`mb-3 flex items-center justify-between`,children:(0,y.jsx)(`h2`,{className:`text-sm font-semibold uppercase tracking-wider text-muted-foreground`,children:`Workspaces`})}),S?(0,y.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,y.jsx)(v,{className:`h-20`}),(0,y.jsx)(v,{className:`h-20`}),(0,y.jsx)(v,{className:`h-20`})]}):e.length===0?(0,y.jsx)(f,{className:`border-dashed`,children:(0,y.jsxs)(_,{children:[(0,y.jsxs)(g,{children:[(0,y.jsx)(m,{variant:`icon`,children:(0,y.jsx)(i,{})}),(0,y.jsx)(p,{children:`No workspaces yet`}),(0,y.jsx)(h,{children:`Create a feature workspace to group repositories and give your AI assistants shared context.`})]}),(0,y.jsxs)(t,{onClick:T,children:[(0,y.jsx)(r,{size:16}),` New workspace`]})]})}):(0,y.jsx)(`div`,{className:`flex flex-col gap-2`,children:e.map(e=>{let t=x[e.branchName],n=t?s(t.syncStatus):null;return(0,y.jsxs)(d,{className:`group cursor-pointer gap-4 p-4 transition-colors hover:border-foreground/15 hover:bg-accent/50`,onClick:()=>w(e.branchName),children:[(0,y.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,y.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,y.jsx)(`span`,{className:`truncate font-mono text-sm font-semibold text-foreground`,children:e.branchName}),(0,y.jsxs)(`span`,{className:`shrink-0 text-xs text-muted-foreground`,children:[e.repos.length,` repos`]})]}),e.description&&(0,y.jsx)(`p`,{className:`mt-0.5 truncate text-xs text-muted-foreground`,children:e.description})]}),(0,y.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1.5`,children:[!t&&C?(0,y.jsx)(v,{className:`h-5 w-40`}):t?(0,y.jsxs)(y.Fragment,{children:[t.changedFiles>0?(0,y.jsxs)(c,{tone:`warning`,dot:!0,children:[t.changedFiles,` changed`]}):(0,y.jsx)(c,{tone:`idle`,dot:!0,children:`Clean`}),t.runningServices>0&&(0,y.jsxs)(c,{tone:`running`,dot:!0,children:[t.runningServices,` running`]}),n&&(0,y.jsxs)(c,{tone:n.tone,children:[(0,y.jsx)(o,{size:11}),` `,n.label]})]}):null,(0,y.jsx)(a,{size:16,className:`text-muted-foreground transition-transform group-hover:translate-x-0.5 group-hover:text-foreground`})]})]},e.id)})})]})}export{x as DashboardPage};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{g as e,t}from"./button-cPldH5S4.js";import{t as n}from"./circle-plus-C0PNc7h4.js";import{xt as r}from"./index-
|
|
1
|
+
import{g as e,t}from"./button-cPldH5S4.js";import{t as n}from"./circle-plus-C0PNc7h4.js";import{xt as r}from"./index-CcIOIZ24.js";var i=e();function a({config:e,onCreateWorkspace:a,onModifySettings:o}){return(0,i.jsxs)(`div`,{className:`max-w-4xl mx-auto animate-fade-in`,children:[(0,i.jsxs)(`header`,{className:`mb-10`,children:[(0,i.jsx)(`div`,{className:`inline-flex items-center gap-1.5 px-3 py-1 rounded-full bg-primary/10 text-primary border border-primary/20 text-xs font-semibold uppercase tracking-wider mb-4`,children:`Getting Started Guide`}),(0,i.jsx)(`h1`,{className:`text-3xl font-bold tracking-tight text-foreground mb-2`,children:`Welcome to NexusFlow`}),(0,i.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`NexusFlow orchestrates multi-repository developer environments. It combines isolated Git worktrees, automatic code analyzer sweeps, and background process running into a single dashboard.`})]}),(0,i.jsxs)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 gap-8 mb-10`,children:[(0,i.jsxs)(`div`,{className:`bg-card border border-border rounded-xl p-6 shadow-sm space-y-6`,children:[(0,i.jsx)(`h2`,{className:`text-lg font-semibold text-foreground mb-4`,children:`NexusFlow Workflows`}),(0,i.jsxs)(`div`,{className:`flex gap-4`,children:[(0,i.jsx)(`div`,{className:`flex size-8 shrink-0 items-center justify-center rounded-full bg-primary/10 border border-primary/20 text-primary font-bold text-sm`,children:`1`}),(0,i.jsxs)(`div`,{children:[(0,i.jsx)(`h3`,{className:`text-sm font-semibold text-foreground`,children:`Configure Folders`}),(0,i.jsxs)(`p`,{className:`text-xs text-muted-foreground mt-1`,children:[`Specify your Development folder (where repositories live) and Workspaces folder. These are currently set to:`,(0,i.jsx)(`code`,{className:`block mt-1 text-[10px] text-primary break-all`,children:e.devDir||`Not Configured`})]})]})]}),(0,i.jsxs)(`div`,{className:`flex gap-4`,children:[(0,i.jsx)(`div`,{className:`flex size-8 shrink-0 items-center justify-center rounded-full bg-primary/10 border border-primary/20 text-primary font-bold text-sm`,children:`2`}),(0,i.jsxs)(`div`,{children:[(0,i.jsx)(`h3`,{className:`text-sm font-semibold text-foreground`,children:`Build Workspaces`}),(0,i.jsx)(`p`,{className:`text-xs text-muted-foreground mt-1`,children:`Choose repositories and feature branch. NexusFlow checks out dependencies under a unified workspace directory using Git Worktrees, keeping original projects clean.`})]})]}),(0,i.jsxs)(`div`,{className:`flex gap-4`,children:[(0,i.jsx)(`div`,{className:`flex size-8 shrink-0 items-center justify-center rounded-full bg-primary/10 border border-primary/20 text-primary font-bold text-sm`,children:`3`}),(0,i.jsxs)(`div`,{children:[(0,i.jsx)(`h3`,{className:`text-sm font-semibold text-foreground`,children:`Align AI Context`}),(0,i.jsxs)(`p`,{className:`text-xs text-muted-foreground mt-1`,children:[`NexusFlow writes files like `,(0,i.jsx)(`code`,{children:`CLAUDE.md`}),`, `,(0,i.jsx)(`code`,{children:`.cursorrules`}),`, `,(0,i.jsx)(`code`,{children:`AGENTS.md`}),` prompting the LLM to inspect project relations and list key assumptions and questions before coding.`]})]})]})]}),(0,i.jsxs)(`div`,{className:`bg-card border border-border rounded-xl p-6 shadow-sm flex flex-col justify-between`,children:[(0,i.jsxs)(`div`,{children:[(0,i.jsx)(`h2`,{className:`text-lg font-semibold text-foreground mb-4`,children:`Current Configuration`}),(0,i.jsxs)(`div`,{className:`space-y-3 text-xs`,children:[(0,i.jsxs)(`div`,{className:`flex justify-between py-1.5 border-b border-border`,children:[(0,i.jsx)(`span`,{className:`text-muted-foreground`,children:`Dev Folder:`}),(0,i.jsx)(`span`,{className:`text-foreground font-mono text-[10px] truncate max-w-[200px]`,children:e.devDir})]}),(0,i.jsxs)(`div`,{className:`flex justify-between py-1.5 border-b border-border`,children:[(0,i.jsx)(`span`,{className:`text-muted-foreground`,children:`Workspaces Folder:`}),(0,i.jsx)(`span`,{className:`text-foreground font-mono text-[10px] truncate max-w-[200px]`,children:e.workspacesDir})]}),(0,i.jsxs)(`div`,{className:`flex justify-between py-1.5 border-b border-border`,children:[(0,i.jsx)(`span`,{className:`text-muted-foreground`,children:`Preferred AI:`}),(0,i.jsx)(`span`,{className:`text-primary font-semibold uppercase`,children:e.defaultAssistant||`None`})]}),(0,i.jsxs)(`div`,{className:`flex justify-between py-1.5`,children:[(0,i.jsx)(`span`,{className:`text-muted-foreground`,children:`Scan Depth:`}),(0,i.jsxs)(`span`,{className:`text-foreground font-semibold`,children:[e.scanDepth,` levels`]})]})]})]}),(0,i.jsxs)(`div`,{className:`pt-6 border-t border-border flex flex-col gap-2`,children:[(0,i.jsxs)(t,{className:`w-full gap-2`,onClick:a,children:[(0,i.jsx)(n,{size:14}),` Create a Workspace`]}),(0,i.jsxs)(t,{variant:`outline`,className:`w-full gap-2`,onClick:o,children:[(0,i.jsx)(r,{size:14,className:`text-muted-foreground`}),` Modify Settings`]})]})]})]})]})}export{a as GettingStartedPage};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{_ as e,b as t,g as n,t as r}from"./button-cPldH5S4.js";import{t as i,xt as a}from"./spinner-BCEaGbib.js";import{n as o,t as s}from"./ScaffoldRepoInline-
|
|
1
|
+
import{_ as e,b as t,g as n,t as r}from"./button-cPldH5S4.js";import{t as i,xt as a}from"./spinner-BCEaGbib.js";import{n as o,t as s}from"./ScaffoldRepoInline-DSt_6QLb.js";import{a as c,c as l,i as u,n as d,o as f,r as p,s as m,t as h}from"./alert-dialog-CroDe9HW.js";import{t as g}from"./trash-2-Da8F2gKd.js";import{$ as _,Ct as v,Et as y,H as b,K as x,Z as S,d as ee,f as C,ft as w,g as T,gt as E,h as D,m as O,ot as k,p as A,u as j,wt as M}from"./index-CcIOIZ24.js";import{t as N}from"./badge-BnkhqVEF.js";import{a as P,i as F,n as I,r as L,t as te}from"./empty-DWyDwDYB.js";var R=t(e(),1),z=n(),B={editingId:null,name:``,description:``,repoPaths:[]};function V(){let e=E(),t=S(),n=_(),V=w(),H=b(),U=k(),W=x(),[G,K]=(0,R.useState)(null),[q,J]=(0,R.useState)(null),[Y,X]=(0,R.useState)(null),Z=(0,R.useMemo)(()=>{let e={};for(let t of V.data??[])t.projectId&&(e[t.projectId]=(e[t.projectId]??0)+1);return e},[V.data]),Q=()=>{J(null),K(B)},ne=e=>{J(null),K({editingId:e.id,name:e.name,description:e.description??``,repoPaths:e.repos.map(e=>e.path)})},re=e=>{K(t=>t&&{...t,repoPaths:t.repoPaths.includes(e.path)?t.repoPaths.filter(t=>t!==e.path):[...t.repoPaths,e.path]})},ie=async()=>{if(G){J(null);try{G.editingId?await U.mutateAsync({id:G.editingId,name:G.name,description:G.description||null,repos:G.repoPaths}):await H.mutateAsync({name:G.name,description:G.description||void 0,repos:G.repoPaths}),K(null)}catch(e){J(e instanceof Error?e.message:String(e))}}},ae=async()=>{if(Y)try{await W.mutateAsync(Y.id)}finally{X(null)}},oe=!!(G&&G.name.trim()&&G.repoPaths.length>0),$=H.isPending||U.isPending;return(0,z.jsxs)(`div`,{className:`mx-auto max-w-4xl animate-fade-in`,children:[(0,z.jsxs)(`header`,{className:`mb-6 flex items-center justify-between gap-4`,children:[(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`h1`,{className:`text-xl font-semibold`,children:`Projects`}),(0,z.jsx)(`p`,{className:`mt-1 text-sm text-muted-foreground`,children:`Named groups of repositories you start work from. Registered once, reused for every feature.`})]}),(0,z.jsxs)(r,{onClick:Q,children:[(0,z.jsx)(v,{}),` New project`]})]}),t.isLoading?(0,z.jsx)(`div`,{className:`flex justify-center py-20`,children:(0,z.jsx)(i,{className:`size-6`})}):(t.data??[]).length===0?(0,z.jsxs)(te,{className:`border border-border border-dashed`,children:[(0,z.jsxs)(L,{children:[(0,z.jsx)(F,{variant:`icon`,children:(0,z.jsx)(y,{})}),(0,z.jsx)(P,{children:`No projects yet`}),(0,z.jsx)(I,{children:`Register your first project to start work without re-picking repositories every time.`})]}),(0,z.jsxs)(r,{onClick:Q,children:[(0,z.jsx)(v,{}),` New project`]})]}):(0,z.jsx)(`ul`,{className:`flex flex-col gap-3`,children:(t.data??[]).map(t=>(0,z.jsx)(`li`,{className:`rounded-xl border border-border bg-card p-4 transition-colors hover:border-foreground/15`,children:(0,z.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[(0,z.jsxs)(`div`,{className:`min-w-0`,children:[(0,z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,z.jsx)(`h2`,{className:`truncate text-sm font-semibold`,children:t.name}),(Z[t.id]??0)>0&&(0,z.jsxs)(N,{variant:`secondary`,children:[Z[t.id],` workspace`,Z[t.id]===1?``:`s`]})]}),t.description&&(0,z.jsx)(`p`,{className:`mt-0.5 truncate text-sm text-muted-foreground`,children:t.description}),(0,z.jsx)(`ul`,{className:`mt-2 flex flex-col gap-0.5`,children:t.repos.map(e=>(0,z.jsxs)(`li`,{className:`truncate font-mono text-xs text-muted-foreground`,children:[e.path,(0,z.jsxs)(`span`,{className:`ml-2 text-muted-foreground/60`,children:[`[`,e.defaultBranch,`]`]})]},e.path))})]}),(0,z.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1.5`,children:[(0,z.jsxs)(r,{size:`sm`,onClick:()=>e(`/new?project=${encodeURIComponent(t.id)}`),children:[(0,z.jsx)(M,{}),` Start work`]}),(0,z.jsx)(r,{size:`icon-sm`,variant:`ghost`,"aria-label":`Edit ${t.name}`,onClick:()=>ne(t),children:(0,z.jsx)(l,{})}),(0,z.jsx)(r,{size:`icon-sm`,variant:`ghost`,"aria-label":`Remove ${t.name}`,onClick:()=>X(t),children:(0,z.jsx)(g,{})})]})]})},t.id))}),(0,z.jsx)(j,{open:G!==null,onOpenChange:e=>!e&&K(null),children:(0,z.jsxs)(D,{className:`max-w-lg`,children:[(0,z.jsxs)(A,{children:[(0,z.jsx)(T,{children:G?.editingId?`Edit project`:`New project`}),(0,z.jsx)(ee,{children:`A project is a reusable group of source repositories. Removing one later never touches disk.`})]}),(0,z.jsxs)(O,{className:`space-y-4`,children:[(0,z.jsxs)(`label`,{className:`block`,children:[(0,z.jsx)(`span`,{className:`mb-1 block text-sm font-medium`,children:`Name`}),(0,z.jsx)(a,{value:G?.name??``,onChange:e=>K(t=>t&&{...t,name:e.target.value}),placeholder:`e.g. Hogia Billing`,autoFocus:!0})]}),(0,z.jsxs)(`label`,{className:`block`,children:[(0,z.jsxs)(`span`,{className:`mb-1 block text-sm font-medium`,children:[`Description `,(0,z.jsx)(`span`,{className:`font-normal text-muted-foreground`,children:`(optional)`})]}),(0,z.jsx)(a,{value:G?.description??``,onChange:e=>K(t=>t&&{...t,description:e.target.value}),placeholder:`What this group of repos is for`})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`span`,{className:`mb-1 block text-sm font-medium`,children:`Repositories`}),(0,z.jsx)(o,{repos:n.data??[],selectedPaths:G?.repoPaths??[],onToggle:re,loading:n.isLoading,emptyHint:`No repositories found in your dev directory.`}),(0,z.jsx)(s,{onCreated:e=>K(t=>t&&{...t,repoPaths:[...t.repoPaths,e.path]})})]}),q&&(0,z.jsx)(`p`,{className:`text-sm text-destructive-foreground`,children:q})]}),(0,z.jsxs)(C,{children:[(0,z.jsx)(r,{variant:`outline`,onClick:()=>K(null),children:`Cancel`}),(0,z.jsxs)(r,{onClick:ie,disabled:!oe||$,children:[$?(0,z.jsx)(i,{}):null,G?.editingId?`Save changes`:`Create project`]})]})]})}),(0,z.jsx)(h,{open:Y!==null,onOpenChange:e=>!e&&X(null),children:(0,z.jsxs)(f,{children:[(0,z.jsxs)(c,{children:[(0,z.jsxs)(m,{children:[`Remove “`,Y?.name,`”?`]}),(0,z.jsx)(p,{children:`This only removes the project from the registry — repositories and workspaces on disk are not touched.`})]}),(0,z.jsxs)(u,{children:[(0,z.jsx)(d,{render:(0,z.jsx)(r,{variant:`outline`,children:`Cancel`})}),(0,z.jsxs)(r,{variant:`destructive`,onClick:ae,disabled:W.isPending,children:[W.isPending?(0,z.jsx)(i,{}):null,`Remove project`]})]})]})})]})}export{V as ProjectsPage};
|