@sudodevstudio/astro-ai 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +114 -0
- package/dist/agent/agent-fallback.d.ts +50 -0
- package/dist/agent/agent-fallback.d.ts.map +1 -0
- package/dist/agent/agent-fallback.js +31 -0
- package/dist/agent/agent-fallback.js.map +1 -0
- package/dist/agent/cli-agent-fallback.d.ts +79 -0
- package/dist/agent/cli-agent-fallback.d.ts.map +1 -0
- package/dist/agent/cli-agent-fallback.js +1056 -0
- package/dist/agent/cli-agent-fallback.js.map +1 -0
- package/dist/integration/index.d.ts +28 -0
- package/dist/integration/index.d.ts.map +1 -0
- package/dist/integration/index.js +389 -0
- package/dist/integration/index.js.map +1 -0
- package/dist/resolver/astro-resolver.d.ts +28 -0
- package/dist/resolver/astro-resolver.d.ts.map +1 -0
- package/dist/resolver/astro-resolver.js +835 -0
- package/dist/resolver/astro-resolver.js.map +1 -0
- package/dist/resolver/types.d.ts +39 -0
- package/dist/resolver/types.d.ts.map +1 -0
- package/dist/resolver/types.js +2 -0
- package/dist/resolver/types.js.map +1 -0
- package/dist/shared/protocol.d.ts +150 -0
- package/dist/shared/protocol.d.ts.map +1 -0
- package/dist/shared/protocol.js +28 -0
- package/dist/shared/protocol.js.map +1 -0
- package/dist/shared/selection-context.d.ts +75 -0
- package/dist/shared/selection-context.d.ts.map +1 -0
- package/dist/shared/selection-context.js +2 -0
- package/dist/shared/selection-context.js.map +1 -0
- package/dist/shared/visual-components.d.ts +15 -0
- package/dist/shared/visual-components.d.ts.map +1 -0
- package/dist/shared/visual-components.js +2 -0
- package/dist/shared/visual-components.js.map +1 -0
- package/dist/toolbar/action-model.d.ts +20 -0
- package/dist/toolbar/action-model.d.ts.map +1 -0
- package/dist/toolbar/action-model.js +49 -0
- package/dist/toolbar/action-model.js.map +1 -0
- package/dist/toolbar/app.d.ts +3 -0
- package/dist/toolbar/app.d.ts.map +1 -0
- package/dist/toolbar/app.js +274 -0
- package/dist/toolbar/app.js.map +1 -0
- package/dist/toolbar/chat-drawer.d.ts +111 -0
- package/dist/toolbar/chat-drawer.d.ts.map +1 -0
- package/dist/toolbar/chat-drawer.js +1575 -0
- package/dist/toolbar/chat-drawer.js.map +1 -0
- package/dist/toolbar/chat-windows.d.ts +62 -0
- package/dist/toolbar/chat-windows.d.ts.map +1 -0
- package/dist/toolbar/chat-windows.js +287 -0
- package/dist/toolbar/chat-windows.js.map +1 -0
- package/dist/toolbar/contextual-actions.d.ts +24 -0
- package/dist/toolbar/contextual-actions.d.ts.map +1 -0
- package/dist/toolbar/contextual-actions.js +371 -0
- package/dist/toolbar/contextual-actions.js.map +1 -0
- package/dist/toolbar/diagnostic-actions.d.ts +22 -0
- package/dist/toolbar/diagnostic-actions.d.ts.map +1 -0
- package/dist/toolbar/diagnostic-actions.js +127 -0
- package/dist/toolbar/diagnostic-actions.js.map +1 -0
- package/dist/toolbar/layers.d.ts +26 -0
- package/dist/toolbar/layers.d.ts.map +1 -0
- package/dist/toolbar/layers.js +31 -0
- package/dist/toolbar/layers.js.map +1 -0
- package/dist/toolbar/overlay.d.ts +40 -0
- package/dist/toolbar/overlay.d.ts.map +1 -0
- package/dist/toolbar/overlay.js +619 -0
- package/dist/toolbar/overlay.js.map +1 -0
- package/dist/visual/capability-resolver.d.ts +11 -0
- package/dist/visual/capability-resolver.d.ts.map +1 -0
- package/dist/visual/capability-resolver.js +69 -0
- package/dist/visual/capability-resolver.js.map +1 -0
- package/dist/visual/command-engine.d.ts +10 -0
- package/dist/visual/command-engine.d.ts.map +1 -0
- package/dist/visual/command-engine.js +199 -0
- package/dist/visual/command-engine.js.map +1 -0
- package/dist/visual/commands.d.ts +36 -0
- package/dist/visual/commands.d.ts.map +1 -0
- package/dist/visual/commands.js +2 -0
- package/dist/visual/commands.js.map +1 -0
- package/dist/visual/patch-transactions.d.ts +57 -0
- package/dist/visual/patch-transactions.d.ts.map +1 -0
- package/dist/visual/patch-transactions.js +259 -0
- package/dist/visual/patch-transactions.js.map +1 -0
- package/dist/vite/build-ai-plugin.d.ts +11 -0
- package/dist/vite/build-ai-plugin.d.ts.map +1 -0
- package/dist/vite/build-ai-plugin.js +45 -0
- package/dist/vite/build-ai-plugin.js.map +1 -0
- package/package.json +85 -0
- package/src/agent/agent-fallback.ts +95 -0
- package/src/agent/cli-agent-fallback.ts +1382 -0
- package/src/integration/index.ts +475 -0
- package/src/resolver/astro-resolver.ts +1024 -0
- package/src/resolver/types.ts +47 -0
- package/src/shared/protocol.ts +181 -0
- package/src/shared/selection-context.ts +91 -0
- package/src/shared/visual-components.ts +16 -0
- package/src/toolbar/action-model.ts +67 -0
- package/src/toolbar/app.ts +294 -0
- package/src/toolbar/chat-drawer.ts +1742 -0
- package/src/toolbar/chat-windows.ts +331 -0
- package/src/toolbar/contextual-actions.ts +401 -0
- package/src/toolbar/diagnostic-actions.ts +151 -0
- package/src/toolbar/layers.ts +32 -0
- package/src/toolbar/overlay.ts +638 -0
- package/src/visual/capability-resolver.ts +83 -0
- package/src/visual/command-engine.ts +250 -0
- package/src/visual/commands.ts +37 -0
- package/src/visual/patch-transactions.ts +270 -0
- package/src/vite/build-ai-plugin.ts +46 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Maninderpreet Singh
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
# @sudodevstudio/astro-ai
|
|
2
|
+
|
|
3
|
+
Development-only visual editing for Astro, with optional Codex or Claude CLI
|
|
4
|
+
support. Source files stay authoritative and all changes render through Vite
|
|
5
|
+
HMR. No editor runtime or metadata is included in production builds.
|
|
6
|
+
|
|
7
|
+
## Install
|
|
8
|
+
|
|
9
|
+
```sh
|
|
10
|
+
npm install --save-dev @sudodevstudio/astro-ai
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
```js
|
|
14
|
+
// astro.config.mjs
|
|
15
|
+
import { defineConfig } from 'astro/config';
|
|
16
|
+
import buildWithAI from '@sudodevstudio/astro-ai';
|
|
17
|
+
|
|
18
|
+
export default defineConfig({
|
|
19
|
+
integrations: [
|
|
20
|
+
buildWithAI({
|
|
21
|
+
agent: 'codex', // or 'claude'
|
|
22
|
+
}),
|
|
23
|
+
],
|
|
24
|
+
});
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
Authenticate the selected CLI before starting Astro:
|
|
28
|
+
|
|
29
|
+
```sh
|
|
30
|
+
codex login
|
|
31
|
+
# or launch `claude` and complete its login flow
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
## Features
|
|
35
|
+
|
|
36
|
+
- Select and inspect source-backed Astro, JSX, and TSX elements.
|
|
37
|
+
- **Click** a selected element to drive the running app while selection mode
|
|
38
|
+
stays on — open a menu or switch a tab, then edit what it reveals.
|
|
39
|
+
- Edit literal text and props without using AI.
|
|
40
|
+
- Reorder, remove, insert, and move compatible source nodes.
|
|
41
|
+
- Multi-select by Shift-click or drag marquee.
|
|
42
|
+
- Undo, redo, conflict recovery, and human-readable diffs.
|
|
43
|
+
- Ask Codex or Claude for explanations and code changes.
|
|
44
|
+
- Attach text, code, or screenshots by picker, drag-and-drop, or clipboard paste.
|
|
45
|
+
- Attach Vite errors and Astro audit findings with **Fix with AI**.
|
|
46
|
+
|
|
47
|
+
## Options
|
|
48
|
+
|
|
49
|
+
```js
|
|
50
|
+
buildWithAI({
|
|
51
|
+
agent: {
|
|
52
|
+
provider: 'codex', // claude
|
|
53
|
+
model: 'your-model',
|
|
54
|
+
// command: '/custom/path/to/codex',
|
|
55
|
+
agentTimeoutMs: 300_000,
|
|
56
|
+
diagnosticsTimeoutMs: 120_000,
|
|
57
|
+
},
|
|
58
|
+
excludeDirectories: ['vendor', 'src/generated'],
|
|
59
|
+
skills: ['AGENTS.md'],
|
|
60
|
+
maxRecoveryFiles: 20,
|
|
61
|
+
visualComponents: [
|
|
62
|
+
{
|
|
63
|
+
name: 'Card',
|
|
64
|
+
layout: 'flow',
|
|
65
|
+
props: {
|
|
66
|
+
tone: { control: 'enum', values: ['neutral', 'accent'] },
|
|
67
|
+
},
|
|
68
|
+
slots: [{ name: 'content', accepts: ['p', 'Button'] }],
|
|
69
|
+
},
|
|
70
|
+
],
|
|
71
|
+
});
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
The isolated agent workspace honors `.gitignore` and the additional
|
|
75
|
+
`excludeDirectories`. `skills` are project-relative convention files included
|
|
76
|
+
with agent context.
|
|
77
|
+
|
|
78
|
+
Toolbar history is stored in the browser tab's `sessionStorage`; it is not
|
|
79
|
+
mirrored into Codex or Claude chat applications. Credentials remain in the CLI
|
|
80
|
+
credential store and are never sent to browser code.
|
|
81
|
+
|
|
82
|
+
### Multiple chat windows
|
|
83
|
+
|
|
84
|
+
Use `+` in a chat header to open another window, and rename a window by
|
|
85
|
+
editing its title — for example one for building and one for reviewing. Up to
|
|
86
|
+
six windows can be open at once, and they are restored on reload.
|
|
87
|
+
|
|
88
|
+
Each window is an independent conversation: it keeps its own turn history,
|
|
89
|
+
attachments, and isolated provider workspace, so context never leaks between
|
|
90
|
+
them. Source history is deliberately shared, because every window edits the
|
|
91
|
+
same project — undo and redo act on one stack and stay in sync everywhere.
|
|
92
|
+
|
|
93
|
+
Runs that can change source are queued so only one applies at a time; a waiting
|
|
94
|
+
window shows a `Queued` step. Answer-only runs never commit, so they continue
|
|
95
|
+
to run concurrently.
|
|
96
|
+
|
|
97
|
+
On a client-side navigation with `<ClientRouter />`, the editor re-establishes
|
|
98
|
+
itself against the new page: the selection is cleared because its elements no
|
|
99
|
+
longer exist, each window drops its stale attachment, insertion zones are
|
|
100
|
+
re-requested for the new route, and the windows are restored and re-fitted to
|
|
101
|
+
the viewport. Conversations and source history are kept.
|
|
102
|
+
|
|
103
|
+
Attached contents are sent only with that CLI request and are not stored in
|
|
104
|
+
chat history. Up to five attachments are supported. Text files are limited to
|
|
105
|
+
256 KB each and screenshots to 5 MB each.
|
|
106
|
+
|
|
107
|
+
For safety, the agent bridge is disabled when Astro listens beyond loopback.
|
|
108
|
+
Only set `allowNetworkAgent: true` on a trusted private network.
|
|
109
|
+
|
|
110
|
+
## License
|
|
111
|
+
|
|
112
|
+
MIT © 2026 Maninderpreet Singh. Free to use, modify, and redistribute when the
|
|
113
|
+
copyright and license notice are retained. Provided as-is, without warranty.
|
|
114
|
+
See [LICENSE](./LICENSE).
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import type { SelectionContext } from '../shared/selection-context.js';
|
|
2
|
+
import type { AgentExternalContext, AgentFileAttachment, AgentRequestMode } from '../shared/protocol.js';
|
|
3
|
+
import type { PatchTransactionStore, PatchTransactionSummary } from '../visual/patch-transactions.js';
|
|
4
|
+
export type AgentFallbackRequest = {
|
|
5
|
+
instruction: string;
|
|
6
|
+
reason: string;
|
|
7
|
+
/** Chat window this run belongs to. Each session keeps its own turns and workspace. */
|
|
8
|
+
sessionId?: string;
|
|
9
|
+
mode?: AgentRequestMode;
|
|
10
|
+
selections?: SelectionContext[];
|
|
11
|
+
/** Project-relative files that the provider may modify. Undefined means project-wide. */
|
|
12
|
+
editableFiles?: string[];
|
|
13
|
+
externalContext?: AgentExternalContext;
|
|
14
|
+
files?: AgentFileAttachment[];
|
|
15
|
+
signal?: AbortSignal;
|
|
16
|
+
onProgress?(state: AgentProgressState, message: string): void;
|
|
17
|
+
};
|
|
18
|
+
export type AgentProgressState = 'queued' | 'reading' | 'editing' | 'validation' | 'diagnostics' | 'tool';
|
|
19
|
+
export type AgentProviderStatus = {
|
|
20
|
+
provider: string;
|
|
21
|
+
available: boolean;
|
|
22
|
+
authenticated: boolean;
|
|
23
|
+
message: string;
|
|
24
|
+
};
|
|
25
|
+
export type AgentFallbackResult = {
|
|
26
|
+
provider?: string;
|
|
27
|
+
response: string;
|
|
28
|
+
transaction?: PatchTransactionSummary;
|
|
29
|
+
};
|
|
30
|
+
/**
|
|
31
|
+
* Boundary for operations rejected by deterministic capability checks.
|
|
32
|
+
* Implementations must apply all proposed file changes through the provided
|
|
33
|
+
* transaction store; browser code never receives provider credentials.
|
|
34
|
+
*/
|
|
35
|
+
export declare abstract class AgentFallback {
|
|
36
|
+
abstract status(): Promise<AgentProviderStatus>;
|
|
37
|
+
dispose(): void | Promise<void>;
|
|
38
|
+
/** Releases the conversation and workspace held for one closed chat window. */
|
|
39
|
+
closeSession(_sessionId: string): void | Promise<void>;
|
|
40
|
+
/** Releases every idle session outside the set the page still has open. */
|
|
41
|
+
retainSessions(_sessionIds: readonly string[]): void | Promise<void>;
|
|
42
|
+
abstract execute(request: AgentFallbackRequest, transactions: PatchTransactionStore): Promise<AgentFallbackResult>;
|
|
43
|
+
}
|
|
44
|
+
export declare class UnavailableAgentFallback extends AgentFallback {
|
|
45
|
+
#private;
|
|
46
|
+
constructor(message?: string);
|
|
47
|
+
status(): Promise<AgentProviderStatus>;
|
|
48
|
+
execute(_request: AgentFallbackRequest, _transactions: PatchTransactionStore): Promise<AgentFallbackResult>;
|
|
49
|
+
}
|
|
50
|
+
//# sourceMappingURL=agent-fallback.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agent-fallback.d.ts","sourceRoot":"","sources":["../../src/agent/agent-fallback.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAC;AACvE,OAAO,KAAK,EACV,oBAAoB,EACpB,mBAAmB,EACnB,gBAAgB,EACjB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,KAAK,EACV,qBAAqB,EACrB,uBAAuB,EACxB,MAAM,iCAAiC,CAAC;AAEzC,MAAM,MAAM,oBAAoB,GAAG;IACjC,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,EAAE,MAAM,CAAC;IACf,uFAAuF;IACvF,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,IAAI,CAAC,EAAE,gBAAgB,CAAC;IACxB,UAAU,CAAC,EAAE,gBAAgB,EAAE,CAAC;IAChC,yFAAyF;IACzF,aAAa,CAAC,EAAE,MAAM,EAAE,CAAC;IACzB,eAAe,CAAC,EAAE,oBAAoB,CAAC;IACvC,KAAK,CAAC,EAAE,mBAAmB,EAAE,CAAC;IAC9B,MAAM,CAAC,EAAE,WAAW,CAAC;IACrB,UAAU,CAAC,CAAC,KAAK,EAAE,kBAAkB,EAAE,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;CAC/D,CAAC;AAEF,MAAM,MAAM,kBAAkB,GAC1B,QAAQ,GACR,SAAS,GACT,SAAS,GACT,YAAY,GACZ,aAAa,GACb,MAAM,CAAC;AAEX,MAAM,MAAM,mBAAmB,GAAG;IAChC,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,OAAO,CAAC;IACnB,aAAa,EAAE,OAAO,CAAC;IACvB,OAAO,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF,MAAM,MAAM,mBAAmB,GAAG;IAChC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,CAAC,EAAE,uBAAuB,CAAC;CACvC,CAAC;AAEF;;;;GAIG;AACH,8BAAsB,aAAa;IACjC,QAAQ,CAAC,MAAM,IAAI,OAAO,CAAC,mBAAmB,CAAC;IAE/C,OAAO,IAAI,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC;IAE/B,+EAA+E;IAC/E,YAAY,CAAC,UAAU,EAAE,MAAM,GAAG,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC;IAEtD,2EAA2E;IAC3E,cAAc,CAAC,WAAW,EAAE,SAAS,MAAM,EAAE,GAAG,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC;IAEpE,QAAQ,CAAC,OAAO,CACd,OAAO,EAAE,oBAAoB,EAC7B,YAAY,EAAE,qBAAqB,GAClC,OAAO,CAAC,mBAAmB,CAAC;CAChC;AAED,qBAAa,wBAAyB,SAAQ,aAAa;;gBAG7C,OAAO,SAAyC;IAK5D,MAAM,IAAI,OAAO,CAAC,mBAAmB,CAAC;IAStC,OAAO,CACL,QAAQ,EAAE,oBAAoB,EAC9B,aAAa,EAAE,qBAAqB,GACnC,OAAO,CAAC,mBAAmB,CAAC;CAKhC"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Boundary for operations rejected by deterministic capability checks.
|
|
3
|
+
* Implementations must apply all proposed file changes through the provided
|
|
4
|
+
* transaction store; browser code never receives provider credentials.
|
|
5
|
+
*/
|
|
6
|
+
export class AgentFallback {
|
|
7
|
+
dispose() { }
|
|
8
|
+
/** Releases the conversation and workspace held for one closed chat window. */
|
|
9
|
+
closeSession(_sessionId) { }
|
|
10
|
+
/** Releases every idle session outside the set the page still has open. */
|
|
11
|
+
retainSessions(_sessionIds) { }
|
|
12
|
+
}
|
|
13
|
+
export class UnavailableAgentFallback extends AgentFallback {
|
|
14
|
+
#message;
|
|
15
|
+
constructor(message = 'No CLI agent provider is configured.') {
|
|
16
|
+
super();
|
|
17
|
+
this.#message = message;
|
|
18
|
+
}
|
|
19
|
+
status() {
|
|
20
|
+
return Promise.resolve({
|
|
21
|
+
provider: 'none',
|
|
22
|
+
available: false,
|
|
23
|
+
authenticated: false,
|
|
24
|
+
message: this.#message,
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
execute(_request, _transactions) {
|
|
28
|
+
return Promise.reject(new Error(this.#message));
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
//# sourceMappingURL=agent-fallback.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agent-fallback.js","sourceRoot":"","sources":["../../src/agent/agent-fallback.ts"],"names":[],"mappings":"AA+CA;;;;GAIG;AACH,MAAM,OAAgB,aAAa;IAGjC,OAAO,KAA0B,CAAC;IAElC,+EAA+E;IAC/E,YAAY,CAAC,UAAkB,IAAyB,CAAC;IAEzD,2EAA2E;IAC3E,cAAc,CAAC,WAA8B,IAAyB,CAAC;CAMxE;AAED,MAAM,OAAO,wBAAyB,SAAQ,aAAa;IAChD,QAAQ,CAAS;IAE1B,YAAY,OAAO,GAAG,sCAAsC;QAC1D,KAAK,EAAE,CAAC;QACR,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAC;IAC1B,CAAC;IAED,MAAM;QACJ,OAAO,OAAO,CAAC,OAAO,CAAC;YACrB,QAAQ,EAAE,MAAM;YAChB,SAAS,EAAE,KAAK;YAChB,aAAa,EAAE,KAAK;YACpB,OAAO,EAAE,IAAI,CAAC,QAAQ;SACvB,CAAC,CAAC;IACL,CAAC;IAED,OAAO,CACL,QAA8B,EAC9B,aAAoC;QAEpC,OAAO,OAAO,CAAC,MAAM,CACnB,IAAI,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,CACzB,CAAC;IACJ,CAAC;CACF"}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import { AgentFallback, type AgentFallbackRequest, type AgentFallbackResult, type AgentProgressState, type AgentProviderStatus } from "./agent-fallback.js";
|
|
2
|
+
import type { PatchTransactionStore } from "../visual/patch-transactions.js";
|
|
3
|
+
export type CliAgentProvider = "codex" | "claude";
|
|
4
|
+
export type CliAgentFallbackOptions = {
|
|
5
|
+
provider: CliAgentProvider;
|
|
6
|
+
projectRoot: string;
|
|
7
|
+
command?: string;
|
|
8
|
+
model?: string;
|
|
9
|
+
excludeDirectories?: string[];
|
|
10
|
+
skills?: string[];
|
|
11
|
+
statusCacheMs?: number;
|
|
12
|
+
maxWorkspaceBytes?: number;
|
|
13
|
+
agentTimeoutMs?: number;
|
|
14
|
+
diagnosticsTimeoutMs?: number;
|
|
15
|
+
};
|
|
16
|
+
type ConversationTurn = {
|
|
17
|
+
instruction: string;
|
|
18
|
+
response: string;
|
|
19
|
+
changedFiles: string[];
|
|
20
|
+
};
|
|
21
|
+
export declare class CliAgentFallback extends AgentFallback {
|
|
22
|
+
#private;
|
|
23
|
+
constructor(options: CliAgentFallbackOptions);
|
|
24
|
+
status(force?: boolean): Promise<AgentProviderStatus>;
|
|
25
|
+
execute(request: AgentFallbackRequest, transactions: PatchTransactionStore): Promise<AgentFallbackResult>;
|
|
26
|
+
dispose(): Promise<void>;
|
|
27
|
+
closeSession(sessionId: string): Promise<void>;
|
|
28
|
+
retainSessions(sessionIds: readonly string[]): Promise<void>;
|
|
29
|
+
/** Live session count, for tests and diagnostics. */
|
|
30
|
+
get sessionCount(): number;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Serializes tasks in submission order. Callers are told when they actually
|
|
34
|
+
* had to wait so a queued chat window can say so instead of looking stalled.
|
|
35
|
+
*/
|
|
36
|
+
export declare class RunQueue {
|
|
37
|
+
#private;
|
|
38
|
+
get depth(): number;
|
|
39
|
+
run<T>(onQueued: () => void, task: () => Promise<T>): Promise<T>;
|
|
40
|
+
}
|
|
41
|
+
export declare function providerArguments(provider: CliAgentProvider, workspace: string, model?: string, imagePaths?: string[]): string[];
|
|
42
|
+
export declare function extractAgentResponse(provider: CliAgentProvider, stdout: string): string | undefined;
|
|
43
|
+
type ProviderStreamUpdate = {
|
|
44
|
+
state?: AgentProgressState;
|
|
45
|
+
message?: string;
|
|
46
|
+
response?: string;
|
|
47
|
+
};
|
|
48
|
+
export declare function providerStreamUpdate(provider: CliAgentProvider, line: string): ProviderStreamUpdate;
|
|
49
|
+
export declare class LineAccumulator {
|
|
50
|
+
#private;
|
|
51
|
+
readonly maxBytes: number;
|
|
52
|
+
readonly onLine: (line: string) => void;
|
|
53
|
+
truncated: boolean;
|
|
54
|
+
constructor(maxBytes: number, onLine?: (line: string) => void);
|
|
55
|
+
push(chunk: Buffer): void;
|
|
56
|
+
end(): void;
|
|
57
|
+
output(): string;
|
|
58
|
+
}
|
|
59
|
+
export declare function createSafeChildEnvironment(source: NodeJS.ProcessEnv): NodeJS.ProcessEnv;
|
|
60
|
+
export declare class GitIgnoreMatcher {
|
|
61
|
+
#private;
|
|
62
|
+
constructor(source: string);
|
|
63
|
+
match(projectPath: string, directory: boolean): boolean | undefined;
|
|
64
|
+
ignores(projectPath: string, directory: boolean): boolean;
|
|
65
|
+
}
|
|
66
|
+
export type GitIgnoreScope = {
|
|
67
|
+
base: string;
|
|
68
|
+
matcher: GitIgnoreMatcher;
|
|
69
|
+
};
|
|
70
|
+
export declare function isIgnoredByGitIgnoreScopes(projectPath: string, directory: boolean, scopes: GitIgnoreScope[]): boolean;
|
|
71
|
+
export declare function resolveExcludedDirectories(additional?: string[]): ReadonlySet<string>;
|
|
72
|
+
export declare function isExcludedDirectory(projectPath: string, directoryBasename: string, excludedDirectories: ReadonlySet<string>): boolean;
|
|
73
|
+
export declare function buildPrompt(request: AgentFallbackRequest, history?: ConversationTurn[], skills?: Array<{
|
|
74
|
+
file: string;
|
|
75
|
+
content: string;
|
|
76
|
+
}>): string;
|
|
77
|
+
export declare function sanitizeWorkspacePaths(output: string, workspace: string): string;
|
|
78
|
+
export {};
|
|
79
|
+
//# sourceMappingURL=cli-agent-fallback.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cli-agent-fallback.d.ts","sourceRoot":"","sources":["../../src/agent/cli-agent-fallback.ts"],"names":[],"mappings":"AAeA,OAAO,EACL,aAAa,EACb,KAAK,oBAAoB,EACzB,KAAK,mBAAmB,EACxB,KAAK,kBAAkB,EACvB,KAAK,mBAAmB,EACzB,MAAM,qBAAqB,CAAC;AAE7B,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,iCAAiC,CAAC;AAE7E,MAAM,MAAM,gBAAgB,GAAG,OAAO,GAAG,QAAQ,CAAC;AAClD,MAAM,MAAM,uBAAuB,GAAG;IACpC,QAAQ,EAAE,gBAAgB,CAAC;IAC3B,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,kBAAkB,CAAC,EAAE,MAAM,EAAE,CAAC;IAC9B,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;IAClB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,oBAAoB,CAAC,EAAE,MAAM,CAAC;CAC/B,CAAC;AAEF,KAAK,gBAAgB,GAAG;IACtB,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,MAAM,CAAC;IACjB,YAAY,EAAE,MAAM,EAAE,CAAC;CACxB,CAAC;AAyCF,qBAAa,gBAAiB,SAAQ,aAAa;;gBAcrC,OAAO,EAAE,uBAAuB;IA2BtC,MAAM,CAAC,KAAK,UAAQ,GA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