@travisennis/acai 0.0.8 → 0.0.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +34 -2
- package/dist/agent/index.d.ts.map +1 -1
- package/dist/agent/index.js +31 -0
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +2 -1
- package/dist/commands/generate-rules/index.js +2 -1
- package/dist/commands/manager.d.ts.map +1 -1
- package/dist/commands/manager.js +2 -0
- package/dist/commands/prompt/index.d.ts.map +1 -1
- package/dist/commands/prompt/index.js +0 -4
- package/dist/commands/session/index.d.ts.map +1 -1
- package/dist/commands/session/index.js +35 -2
- package/dist/commands/session/types.d.ts +7 -0
- package/dist/commands/session/types.d.ts.map +1 -1
- package/dist/commands/share/html-renderer.d.ts +25 -0
- package/dist/commands/share/html-renderer.d.ts.map +1 -0
- package/dist/commands/share/html-renderer.js +384 -0
- package/dist/commands/share/index.d.ts +3 -0
- package/dist/commands/share/index.d.ts.map +1 -0
- package/dist/commands/share/index.js +122 -0
- package/dist/index.js +61 -25
- package/dist/models/openai-provider.d.ts +4 -1
- package/dist/models/openai-provider.d.ts.map +1 -1
- package/dist/models/openai-provider.js +39 -0
- package/dist/models/opencode-zen-provider.d.ts +2 -1
- package/dist/models/opencode-zen-provider.d.ts.map +1 -1
- package/dist/models/opencode-zen-provider.js +19 -1
- package/dist/models/openrouter-provider.d.ts +2 -1
- package/dist/models/openrouter-provider.d.ts.map +1 -1
- package/dist/models/openrouter-provider.js +13 -0
- package/dist/models/providers.d.ts +1 -1
- package/dist/models/providers.d.ts.map +1 -1
- package/dist/prompts.d.ts +12 -1
- package/dist/prompts.d.ts.map +1 -1
- package/dist/prompts.js +21 -8
- package/dist/repl-new.d.ts +3 -0
- package/dist/repl-new.d.ts.map +1 -1
- package/dist/repl-new.js +11 -1
- package/dist/sessions/manager.d.ts.map +1 -1
- package/dist/sessions/manager.js +2 -0
- package/dist/stdin.d.ts +9 -0
- package/dist/stdin.d.ts.map +1 -0
- package/dist/stdin.js +26 -0
- package/dist/terminal/control.d.ts +1 -1
- package/dist/terminal/control.d.ts.map +1 -1
- package/dist/terminal/control.js +28 -7
- package/dist/tools/bash.d.ts.map +1 -1
- package/dist/tools/bash.js +35 -0
- package/dist/tui/components/editor.d.ts +5 -0
- package/dist/tui/components/editor.d.ts.map +1 -1
- package/dist/tui/components/editor.js +19 -1
- package/dist/tui/components/notification.d.ts.map +1 -1
- package/dist/tui/components/notification.js +1 -0
- package/dist/tui/editor-launcher.d.ts +13 -0
- package/dist/tui/editor-launcher.d.ts.map +1 -0
- package/dist/tui/editor-launcher.js +39 -0
- package/dist/tui/index.d.ts +3 -1
- package/dist/tui/index.d.ts.map +1 -1
- package/dist/tui/index.js +1 -0
- package/dist/tui/terminal.d.ts +27 -0
- package/dist/tui/terminal.d.ts.map +1 -1
- package/dist/tui/terminal.js +134 -13
- package/dist/tui/tui.d.ts +1 -0
- package/dist/tui/tui.d.ts.map +1 -1
- package/dist/tui/tui.js +16 -1
- package/dist/utils/filesystem/security.d.ts.map +1 -1
- package/dist/utils/filesystem/security.js +4 -1
- package/package.json +12 -12
package/README.md
CHANGED
|
@@ -16,12 +16,13 @@ Acai is a powerful **AI-driven command-line interface (CLI) tool** designed to a
|
|
|
16
16
|
* **Extensible Tooling:** Utilizes a suite of internal tools (e.g., `bash`, `codeInterpreter`, `webSearch`) to perform actions.
|
|
17
17
|
* **Multi-Model Support:** Seamlessly switch between various AI providers (e.g., OpenAI, Google, Anthropic, DeepSeek, Groq, OpenRouter).
|
|
18
18
|
* **Context Management:** Automatically incorporates relevant file content, clipboard data, and conversation history into AI prompts.
|
|
19
|
-
* **
|
|
19
|
+
* **Piped Input Support:** Pipe text directly to acai via stdin for REPL mode (`echo "prompt" | acai`) or as context with `-p` flag (`echo "context" | acai -p "prompt"). Includes size limits (50KB warning, 200KB max).
|
|
20
20
|
* **Terminal User Interface:** Modern TUI with modal dialogs, autocomplete, and rich text formatting.
|
|
21
21
|
|
|
22
22
|
## ✨ Features
|
|
23
23
|
|
|
24
24
|
* **Conversational REPL/TUI:** Intuitive command-line interface and modern terminal UI for interacting with the AI.
|
|
25
|
+
* **Piped Input Support:** Pipe text directly to acai via stdin. Works in REPL mode (`echo "prompt" | acai`) or as additional context with `-p` flag (`echo "context" | acai -p "prompt"). Includes input size limits with graceful handling.
|
|
25
26
|
* **File System Operations:** Read, write, edit, move, and delete files.
|
|
26
27
|
* **File & Directory Mentions:** Include file contents and entire directories in prompts using `@filename` and `@dirname` syntax.
|
|
27
28
|
* **Code Navigation & Analysis:** Advanced file searching and code analysis capabilities.
|
|
@@ -176,9 +177,12 @@ acai --model anthropic:sonnet
|
|
|
176
177
|
# CLI mode (one-shot execution)
|
|
177
178
|
acai -p "What files contain the term 'toolCallRepair'?"
|
|
178
179
|
|
|
179
|
-
# Pipe input
|
|
180
|
+
# Pipe input for REPL mode (immediately processes, then becomes interactive)
|
|
180
181
|
echo "How many TypeScript files are in this project?" | acai
|
|
181
182
|
|
|
183
|
+
# Pipe input as context with CLI mode
|
|
184
|
+
echo "Context information here" | acai -p "Process this context"
|
|
185
|
+
|
|
182
186
|
# Disable skills discovery
|
|
183
187
|
acai --no-skills
|
|
184
188
|
|
|
@@ -276,6 +280,33 @@ echo 'Analyze the following code: {{INPUT}}' > .acai/prompts/analyze.md
|
|
|
276
280
|
|
|
277
281
|
**Note:** Using `-p/--prompt` runs in CLI mode (one-shot execution), while running without a prompt starts interactive REPL mode.
|
|
278
282
|
|
|
283
|
+
### Piped Input
|
|
284
|
+
|
|
285
|
+
You can pipe text directly to acai via stdin for flexible input scenarios:
|
|
286
|
+
|
|
287
|
+
```bash
|
|
288
|
+
# REPL mode: piped text becomes the initial prompt, processed immediately
|
|
289
|
+
echo "What can you do?" | acai
|
|
290
|
+
# Acai starts, processes the prompt, displays response,
|
|
291
|
+
# then enters interactive mode for continued conversation
|
|
292
|
+
|
|
293
|
+
# CLI mode: piped text becomes additional context
|
|
294
|
+
echo "Codebase overview: 50 files, TypeScript project" | acai -p "Summarize this project"
|
|
295
|
+
# Piped content is added as context, -p value is the main prompt
|
|
296
|
+
# Runs in single-shot CLI mode and exits
|
|
297
|
+
|
|
298
|
+
# Multiple inputs
|
|
299
|
+
echo "Large context file" | acai -p "Analyze and improve"
|
|
300
|
+
```
|
|
301
|
+
|
|
302
|
+
**Input size limits:**
|
|
303
|
+
- **Soft limit (50KB):** Warning logged to stderr, processing continues
|
|
304
|
+
- **Hard limit (200KB):** Error displayed, process exits with code 1
|
|
305
|
+
|
|
306
|
+
**Empty input handling:**
|
|
307
|
+
- Empty stdin without `-p` flag: Prints message and exits with code 0
|
|
308
|
+
- Empty stdin with `-p` flag: Proceeds normally (no context added)
|
|
309
|
+
|
|
279
310
|
For a list of available commands, type `/help` within the REPL.
|
|
280
311
|
|
|
281
312
|
## Interactive CLI Commands
|
|
@@ -300,6 +331,7 @@ For a list of available commands, type `/help` within the REPL.
|
|
|
300
331
|
- `/history` - View and manage conversation history
|
|
301
332
|
- `/pickup` - Resume a previous conversation
|
|
302
333
|
- `/handoff` - Hand off conversation to another agent
|
|
334
|
+
- `/share` - Share the current session as a GitHub Gist for viewing in a web browser
|
|
303
335
|
- `/shell` - Execute shell commands
|
|
304
336
|
|
|
305
337
|
**Note**: Some commands mentioned in older documentation may no longer be available. Use `/help` to see current commands.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../source/agent/index.ts"],"names":[],"mappings":"AAmBA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACzD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAC5D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAC7D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACzD,OAAO,KAAK,EACV,iBAAiB,EACjB,eAAe,EAEhB,MAAM,mBAAmB,CAA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AAU,EAAE,UAAU,CAAC;IACvB,UAAU,EAAE;QACV,KAAK,EAAE,MAAM,CAAC;QACd,IAAI,EAAE,MAAM,CAAC;KACd,CAAC;CACH,CAAC;AAEF,qBAAa,KAAK;IAChB,OAAO,CAAC,IAAI,CAAe;IAC3B,OAAO,CAAC,MAAM,CAAa;IAC3B,OAAO,CAAC,eAAe,CAAkB;gBAE7B,IAAI,EAAE,YAAY;IAM9B,IAAI,KAAK,eAER;IAED,IAAI,WAAW,gBAEd;IAEM,GAAG,CAAC,IAAI,EAAE,UAAU,GAAG,cAAc,CAAC,UAAU,CAAC;IAoXxD,KAAK;IAML,UAAU;IAmDV,OAAO,CAAC,gBAAgB;CAyBzB"}
|
package/dist/agent/index.js
CHANGED
|
@@ -172,6 +172,37 @@ export class Agent {
|
|
|
172
172
|
resultOutput = `No executor for tool ${toolName}`;
|
|
173
173
|
}
|
|
174
174
|
else {
|
|
175
|
+
// Pre-validate tool input to catch malformed JSON early
|
|
176
|
+
if (typeof call.input === "string") {
|
|
177
|
+
// If input is a string, try to validate it's proper JSON
|
|
178
|
+
try {
|
|
179
|
+
JSON.parse(call.input);
|
|
180
|
+
}
|
|
181
|
+
catch {
|
|
182
|
+
// Malformed JSON detected - emit error and skip execution
|
|
183
|
+
const errorMsg = `Invalid tool input: malformed JSON. Received: "${call.input.slice(0, 50)}${call.input.length > 50 ? "..." : ""}". Expected a JSON object.`;
|
|
184
|
+
yield this.processToolEvent(toolsCalled, {
|
|
185
|
+
type: "tool-call-error",
|
|
186
|
+
name: toolName,
|
|
187
|
+
toolCallId: call.toolCallId,
|
|
188
|
+
msg: errorMsg,
|
|
189
|
+
args: null,
|
|
190
|
+
});
|
|
191
|
+
continue;
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
else if (call.input === null || call.input === undefined) {
|
|
195
|
+
// Null/undefined input
|
|
196
|
+
const errorMsg = "Invalid tool input: received null/undefined. Expected a JSON object matching the schema.";
|
|
197
|
+
yield this.processToolEvent(toolsCalled, {
|
|
198
|
+
type: "tool-call-error",
|
|
199
|
+
name: toolName,
|
|
200
|
+
toolCallId: call.toolCallId,
|
|
201
|
+
msg: errorMsg,
|
|
202
|
+
args: null,
|
|
203
|
+
});
|
|
204
|
+
continue;
|
|
205
|
+
}
|
|
175
206
|
const toolExec = iTool.execute;
|
|
176
207
|
try {
|
|
177
208
|
const output = await toolExec(call.input, {
|
package/dist/cli.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../source/cli.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAGnD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAE1D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAQxD,UAAU,UAAU;IAClB,cAAc,EAAE,cAAc,CAAC;IAC/B,aAAa,EAAE,aAAa,CAAC;IAC7B,YAAY,EAAE,YAAY,CAAC;IAC3B,YAAY,EAAE,YAAY,CAAC;IAC3B,YAAY,EAAE,YAAY,CAAC;IAC3B,SAAS,EAAE,gBAAgB,CAAC;IAC5B,aAAa,CAAC,EAAE,OAAO,CAAC;CACzB;AAUD,qBAAa,GAAG;IACd,OAAO,CAAC,OAAO,CAAa;IAC5B,OAAO,CAAC,aAAa,CAAU;gBACnB,OAAO,EAAE,UAAU;IAKzB,GAAG;
|
|
1
|
+
{"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../source/cli.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAGnD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAE1D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAQxD,UAAU,UAAU;IAClB,cAAc,EAAE,cAAc,CAAC;IAC/B,aAAa,EAAE,aAAa,CAAC;IAC7B,YAAY,EAAE,YAAY,CAAC;IAC3B,YAAY,EAAE,YAAY,CAAC;IAC3B,YAAY,EAAE,YAAY,CAAC;IAC3B,SAAS,EAAE,gBAAgB,CAAC;IAC5B,aAAa,CAAC,EAAE,OAAO,CAAC;CACzB;AAUD,qBAAa,GAAG;IACd,OAAO,CAAC,OAAO,CAAa;IAC5B,OAAO,CAAC,aAAa,CAAU;gBACnB,OAAO,EAAE,UAAU;IAKzB,GAAG;CAuHV"}
|
package/dist/cli.js
CHANGED
|
@@ -36,11 +36,12 @@ export class Cli {
|
|
|
36
36
|
const userPrompt = promptManager.get();
|
|
37
37
|
const userMsg = promptManager.getUserMessage();
|
|
38
38
|
messageHistory.appendUserMessage(userMsg);
|
|
39
|
-
const
|
|
39
|
+
const finalSystemPromptResult = await systemPrompt({
|
|
40
40
|
activeTools,
|
|
41
41
|
allowedDirs: this.options.workspace.allowedDirs,
|
|
42
42
|
skillsEnabled: this.skillsEnabled,
|
|
43
43
|
});
|
|
44
|
+
const finalSystemPrompt = finalSystemPromptResult.prompt;
|
|
44
45
|
const aiConfig = new AiConfig({
|
|
45
46
|
modelMetadata: modelConfig,
|
|
46
47
|
prompt: userPrompt,
|
|
@@ -122,11 +122,12 @@ ${learnedRules}
|
|
|
122
122
|
}
|
|
123
123
|
async function createSystemPrompt(configManager, workspace) {
|
|
124
124
|
const projectConfig = await configManager.getConfig();
|
|
125
|
-
const
|
|
125
|
+
const sysResult = await systemPrompt({
|
|
126
126
|
activeTools: projectConfig.tools.activeTools,
|
|
127
127
|
includeRules: true,
|
|
128
128
|
allowedDirs: workspace.allowedDirs,
|
|
129
129
|
});
|
|
130
|
+
const sys = sysResult.prompt;
|
|
130
131
|
return `You are an expert analyst reviewing conversations between a coding agent and a software engineer. Your goal is to identify instances where the engineer corrected the agent's approach or understanding in a way that reveals a *generalizable principle* for improving the agent's future behavior across *different* tasks.
|
|
131
132
|
|
|
132
133
|
**Your Task:**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"manager.d.ts","sourceRoot":"","sources":["../../source/commands/manager.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAEV,SAAS,EACT,MAAM,EACN,YAAY,EACZ,GAAG,EACJ,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"manager.d.ts","sourceRoot":"","sources":["../../source/commands/manager.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAEV,SAAS,EACT,MAAM,EACN,YAAY,EACZ,GAAG,EACJ,MAAM,iBAAiB,CAAC;AA0BzB,OAAO,KAAK,EAAE,cAAc,EAAe,MAAM,YAAY,CAAC;AAE9D,qBAAa,cAAc;IACzB,OAAO,CAAC,QAAQ,CAA2B;IAC3C,OAAO,CAAC,aAAa,CAAmB;IACxC,OAAO,CAAC,YAAY,CAAe;IACnC,OAAO,CAAC,cAAc,CAAiB;IACvC,OAAO,CAAC,YAAY,CAAe;IACnC,OAAO,CAAC,MAAM,CAAgB;IAC9B,OAAO,CAAC,YAAY,CAAe;IACnC,OAAO,CAAC,aAAa,CAAW;IAChC,OAAO,CAAC,SAAS,CAAmB;IACpC,OAAO,CAAC,WAAW,CAAU;gBAEjB,EACV,aAAa,EACb,YAAY,EACZ,cAAc,EAAE,cAAc,EAC9B,YAAY,EACZ,MAAM,EACN,YAAY,EACZ,aAAa,EACb,SAAS,GACV,EAAE,cAAc;IAaX,mBAAmB;IAsFzB,OAAO,CAAC,iBAAiB;IAQnB,cAAc,IAAI,OAAO,CAAC,YAAY,EAAE,CAAC;IAuB/C,WAAW;IAKL,cAAc,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC;IAKlD,MAAM,CACV,EAAE,SAAS,EAAE,EAAE;QAAE,SAAS,EAAE,MAAM,CAAA;KAAE,EACpC,OAAO,EAAE;QACP,GAAG,EAAE,GAAG,CAAC;QACT,SAAS,EAAE,SAAS,CAAC;QACrB,cAAc,EAAE,SAAS,CAAC;QAC1B,MAAM,EAAE,MAAM,CAAC;KAChB;;;;CA8BJ"}
|
package/dist/commands/manager.js
CHANGED
|
@@ -21,6 +21,7 @@ import { resourcesCommand } from "./resources/index.js";
|
|
|
21
21
|
import { reviewCommand } from "./review/index.js";
|
|
22
22
|
import { saveCommand } from "./save/index.js";
|
|
23
23
|
import { sessionCommand } from "./session/index.js";
|
|
24
|
+
import { shareCommand } from "./share/index.js";
|
|
24
25
|
import { shellCommand } from "./shell/index.js";
|
|
25
26
|
export class CommandManager {
|
|
26
27
|
commands;
|
|
@@ -84,6 +85,7 @@ export class CommandManager {
|
|
|
84
85
|
copyCommand(options),
|
|
85
86
|
listToolsCommand(options),
|
|
86
87
|
resourcesCommand(options),
|
|
88
|
+
shareCommand(options),
|
|
87
89
|
shellCommand(options),
|
|
88
90
|
];
|
|
89
91
|
// Add help command with access to all commands
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../source/commands/prompt/index.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC/D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAOjD,wBAAsB,WAAW,CAAC,MAAM,EAAE,cAAc,CAAC,QAAQ,CAAC,wCA0DjE;AAED,eAAO,MAAM,aAAa,GAAI,oEAM3B,cAAc,KAAG,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../source/commands/prompt/index.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC/D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAOjD,wBAAsB,WAAW,CAAC,MAAM,EAAE,cAAc,CAAC,QAAQ,CAAC,wCA0DjE;AAED,eAAO,MAAM,aAAa,GAAI,oEAM3B,cAAc,KAAG,WA4GnB,CAAC"}
|
|
@@ -98,10 +98,6 @@ export const promptCommand = ({ modelManager, promptManager, config, promptHisto
|
|
|
98
98
|
const inputArgs = args.slice(1);
|
|
99
99
|
promptContent = replaceArgumentPlaceholders(promptContent, inputArgs);
|
|
100
100
|
container.addChild(new Spacer(1));
|
|
101
|
-
container.addChild(new Text(`Loaded ${promptResult.type} prompt: ${style.blue(promptName)}`, 1, 0));
|
|
102
|
-
if (inputArgs.length > 0) {
|
|
103
|
-
container.addChild(new Text(`Input: "${inputArgs.join(" ")}"`, 2, 0));
|
|
104
|
-
}
|
|
105
101
|
const processedPrompt = await processPrompt(promptContent.trim(), {
|
|
106
102
|
baseDir: workspace.primaryDir,
|
|
107
103
|
model: modelManager.getModelMetadata("repl"),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../source/commands/session/index.ts"],"names":[],"mappings":"AAuBA,OAAO,KAAK,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAI/D,wBAAgB,cAAc,CAAC,EAC7B,MAAM,EACN,YAAY,EACZ,YAAY,EACZ,cAAc,EAAE,cAAc,EAC9B,SAAS,EACT,YAAY,GACb,EAAE,cAAc,GAAG,WAAW,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../source/commands/session/index.ts"],"names":[],"mappings":"AAuBA,OAAO,KAAK,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAI/D,wBAAgB,cAAc,CAAC,EAC7B,MAAM,EACN,YAAY,EACZ,YAAY,EACZ,cAAc,EAAE,cAAc,EAC9B,SAAS,EACT,YAAY,GACb,EAAE,cAAc,GAAG,WAAW,CAkR9B"}
|
|
@@ -16,12 +16,19 @@ export function sessionCommand({ config, tokenCounter, modelManager, sessionMana
|
|
|
16
16
|
const meta = modelManager.getModelMetadata("repl");
|
|
17
17
|
const window = meta.contextWindow;
|
|
18
18
|
const projectConfig = await config.getConfig();
|
|
19
|
-
const
|
|
19
|
+
const sysResult = await systemPrompt({
|
|
20
20
|
activeTools: projectConfig.tools.activeTools,
|
|
21
21
|
allowedDirs: workspace.allowedDirs,
|
|
22
22
|
includeRules: true,
|
|
23
23
|
});
|
|
24
|
-
const systemPromptTokens = tokenCounter.count(
|
|
24
|
+
const systemPromptTokens = tokenCounter.count(sysResult.prompt);
|
|
25
|
+
const systemPromptBreakdown = {
|
|
26
|
+
core: tokenCounter.count(sysResult.components.core),
|
|
27
|
+
userAgentsMd: tokenCounter.count(sysResult.components.userAgentsMd),
|
|
28
|
+
cwdAgentsMd: tokenCounter.count(sysResult.components.cwdAgentsMd),
|
|
29
|
+
learnedRules: tokenCounter.count(sysResult.components.learnedRules),
|
|
30
|
+
skills: tokenCounter.count(sysResult.components.skills),
|
|
31
|
+
};
|
|
25
32
|
let toolsTokens = 0;
|
|
26
33
|
try {
|
|
27
34
|
const tools = await initTools({
|
|
@@ -46,6 +53,7 @@ export function sessionCommand({ config, tokenCounter, modelManager, sessionMana
|
|
|
46
53
|
const usedPercentage = window > 0 ? (used / window) * 100 : 0;
|
|
47
54
|
const breakdown = {
|
|
48
55
|
systemPrompt: systemPromptTokens,
|
|
56
|
+
systemPromptBreakdown,
|
|
49
57
|
tools: toolsTokens,
|
|
50
58
|
messages: messagesTokens,
|
|
51
59
|
totalUsed: used,
|
|
@@ -107,6 +115,31 @@ export function sessionCommand({ config, tokenCounter, modelManager, sessionMana
|
|
|
107
115
|
formatNumber(breakdown.systemPrompt),
|
|
108
116
|
formatPercentage(breakdown.systemPrompt, window),
|
|
109
117
|
],
|
|
118
|
+
[
|
|
119
|
+
" Core Instructions",
|
|
120
|
+
formatNumber(breakdown.systemPromptBreakdown.core),
|
|
121
|
+
formatPercentage(breakdown.systemPromptBreakdown.core, window),
|
|
122
|
+
],
|
|
123
|
+
[
|
|
124
|
+
" ~/.acai/AGENTS.md",
|
|
125
|
+
formatNumber(breakdown.systemPromptBreakdown.userAgentsMd),
|
|
126
|
+
formatPercentage(breakdown.systemPromptBreakdown.userAgentsMd, window),
|
|
127
|
+
],
|
|
128
|
+
[
|
|
129
|
+
" ./AGENTS.md",
|
|
130
|
+
formatNumber(breakdown.systemPromptBreakdown.cwdAgentsMd),
|
|
131
|
+
formatPercentage(breakdown.systemPromptBreakdown.cwdAgentsMd, window),
|
|
132
|
+
],
|
|
133
|
+
[
|
|
134
|
+
" Learned Rules",
|
|
135
|
+
formatNumber(breakdown.systemPromptBreakdown.learnedRules),
|
|
136
|
+
formatPercentage(breakdown.systemPromptBreakdown.learnedRules, window),
|
|
137
|
+
],
|
|
138
|
+
[
|
|
139
|
+
" Skills",
|
|
140
|
+
formatNumber(breakdown.systemPromptBreakdown.skills),
|
|
141
|
+
formatPercentage(breakdown.systemPromptBreakdown.skills, window),
|
|
142
|
+
],
|
|
110
143
|
[
|
|
111
144
|
"System Tools",
|
|
112
145
|
formatNumber(breakdown.tools),
|
|
@@ -1,6 +1,13 @@
|
|
|
1
1
|
import type { ModelMessage } from "ai";
|
|
2
2
|
export type Breakdown = {
|
|
3
3
|
systemPrompt: number;
|
|
4
|
+
systemPromptBreakdown: {
|
|
5
|
+
core: number;
|
|
6
|
+
userAgentsMd: number;
|
|
7
|
+
cwdAgentsMd: number;
|
|
8
|
+
learnedRules: number;
|
|
9
|
+
skills: number;
|
|
10
|
+
};
|
|
4
11
|
tools: number;
|
|
5
12
|
messages: number;
|
|
6
13
|
totalUsed: number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../source/commands/session/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,IAAI,CAAC;AAEvC,MAAM,MAAM,SAAS,GAAG;IACtB,YAAY,EAAE,MAAM,CAAC;IACrB,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;CACd,CAAC;AAEF,wBAAgB,kBAAkB,CAChC,QAAQ,EAAE,YAAY,EAAE,EACxB,OAAO,EAAE;IAAE,KAAK,EAAE,CAAC,CAAC,EAAE,MAAM,KAAK,MAAM,CAAA;CAAE,GACxC,MAAM,CAOR"}
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../source/commands/session/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,IAAI,CAAC;AAEvC,MAAM,MAAM,SAAS,GAAG;IACtB,YAAY,EAAE,MAAM,CAAC;IACrB,qBAAqB,EAAE;QACrB,IAAI,EAAE,MAAM,CAAC;QACb,YAAY,EAAE,MAAM,CAAC;QACrB,WAAW,EAAE,MAAM,CAAC;QACpB,YAAY,EAAE,MAAM,CAAC;QACrB,MAAM,EAAE,MAAM,CAAC;KAChB,CAAC;IACF,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;CACd,CAAC;AAEF,wBAAgB,kBAAkB,CAChC,QAAQ,EAAE,YAAY,EAAE,EACxB,OAAO,EAAE;IAAE,KAAK,EAAE,CAAC,CAAC,EAAE,MAAM,KAAK,MAAM,CAAA;CAAE,GACxC,MAAM,CAOR"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { ModelMessage } from "ai";
|
|
2
|
+
export interface SessionData {
|
|
3
|
+
sessionId: string;
|
|
4
|
+
title: string;
|
|
5
|
+
modelId: string;
|
|
6
|
+
project: string;
|
|
7
|
+
createdAt: Date;
|
|
8
|
+
updatedAt: Date;
|
|
9
|
+
messages: ModelMessage[];
|
|
10
|
+
}
|
|
11
|
+
export declare function escapeHtml(text: string): string;
|
|
12
|
+
export declare function renderSessionHtml(session: SessionData): string;
|
|
13
|
+
export declare function getSessionData(sessionManager: {
|
|
14
|
+
get: () => ModelMessage[];
|
|
15
|
+
getSessionId: () => string;
|
|
16
|
+
getTitle: () => string;
|
|
17
|
+
getModelId: () => string;
|
|
18
|
+
getCreatedAt: () => Date;
|
|
19
|
+
getUpdatedAt: () => Date;
|
|
20
|
+
}, project?: string): SessionData;
|
|
21
|
+
export declare function estimateSessionSize(session: SessionData): {
|
|
22
|
+
messageCount: number;
|
|
23
|
+
contentSizeBytes: number;
|
|
24
|
+
};
|
|
25
|
+
//# sourceMappingURL=html-renderer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"html-renderer.d.ts","sourceRoot":"","sources":["../../../source/commands/share/html-renderer.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAA0C,MAAM,IAAI,CAAC;AAE/E,MAAM,WAAW,WAAW;IAC1B,SAAS,EAAE,MAAM,CAAC;IAClB,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,IAAI,CAAC;IAChB,SAAS,EAAE,IAAI,CAAC;IAChB,QAAQ,EAAE,YAAY,EAAE,CAAC;CAC1B;AAED,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAO/C;AAiJD,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,WAAW,GAAG,MAAM,CAwO9D;AAED,wBAAgB,cAAc,CAC5B,cAAc,EAAE;IACd,GAAG,EAAE,MAAM,YAAY,EAAE,CAAC;IAC1B,YAAY,EAAE,MAAM,MAAM,CAAC;IAC3B,QAAQ,EAAE,MAAM,MAAM,CAAC;IACvB,UAAU,EAAE,MAAM,MAAM,CAAC;IACzB,YAAY,EAAE,MAAM,IAAI,CAAC;IACzB,YAAY,EAAE,MAAM,IAAI,CAAC;CAC1B,EACD,OAAO,CAAC,EAAE,MAAM,GACf,WAAW,CAUb;AAED,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,WAAW,GAAG;IACzD,YAAY,EAAE,MAAM,CAAC;IACrB,gBAAgB,EAAE,MAAM,CAAC;CAC1B,CAMA"}
|