@alisio/alisio-code 0.2.1 → 0.3.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/dist/main.js +7 -2
- package/dist/tui/app.js +5 -1
- package/dist/tui/state.d.ts +2 -0
- package/dist/tui/state.js +11 -0
- package/package.json +7 -7
package/dist/main.js
CHANGED
|
@@ -163,7 +163,11 @@ async function run(cmd, prompt, sessionId) {
|
|
|
163
163
|
}
|
|
164
164
|
const controller = new AbortController();
|
|
165
165
|
const interrupt = () => controller.abort(new Error("Interrupted"));
|
|
166
|
-
|
|
166
|
+
// Same handler for every termination signal: abort the run and close through `finally`, so
|
|
167
|
+
// plugins get their (bounded) `dispose()` also on `kill` and a closed terminal.
|
|
168
|
+
const stopSignals = ["SIGINT", "SIGTERM", "SIGHUP"];
|
|
169
|
+
for (const signal of stopSignals)
|
|
170
|
+
process.on(signal, interrupt);
|
|
167
171
|
// `/name args` runs a prompt template (same syntax as the TUI); refuse before creating a session.
|
|
168
172
|
let template;
|
|
169
173
|
try {
|
|
@@ -278,7 +282,8 @@ async function run(cmd, prompt, sessionId) {
|
|
|
278
282
|
}
|
|
279
283
|
}
|
|
280
284
|
finally {
|
|
281
|
-
|
|
285
|
+
for (const signal of stopSignals)
|
|
286
|
+
process.off(signal, interrupt);
|
|
282
287
|
// Background tasks end with Alisio: `run` waits for none of them, it stops them and says so.
|
|
283
288
|
const live = app.tasks.liveCount();
|
|
284
289
|
await app.close();
|
package/dist/tui/app.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { homedir } from "node:os";
|
|
2
2
|
import { join } from "node:path";
|
|
3
|
-
import { AGENT_TEMPLATES, agentAuthoringGuidance, agentCommandDescriptors, agentIdFromCommand, agentModelCapabilities, agentModelLabels, agentModelOptions, changelogNews, describePermissionStatus, formatChangelogMarkdown, formatReloadReport, generateAgentDraft, goalOptInTools, goalOutcome, goalWaiting, IMPLEMENTATION_AGENT_ID, isTaskLive, loadChangelog, modeFromFlags, NOT_SANDBOXED, nextAgent, PERMISSION_MODE_TABLE, PERMISSION_USAGE, PLAN_QUESTION_ID, PLAN_TEXT_KEY, parseGoalCommand, parsePermissionCommand, ReloadFailedError, ReloadRefusedError, reloadApplication, selectEntries, settlePlanRun, stateHome, toGrantWire, toRef, validateReloadConfig, } from "@alisio/core";
|
|
3
|
+
import { AGENT_TEMPLATES, agentAuthoringGuidance, agentCommandDescriptors, agentIdFromCommand, agentModelCapabilities, agentModelLabels, agentModelOptions, changelogNews, describePermissionStatus, formatChangelogMarkdown, formatDecisionStatsSection, formatReloadReport, generateAgentDraft, goalOptInTools, goalOutcome, goalWaiting, IMPLEMENTATION_AGENT_ID, isTaskLive, loadChangelog, modeFromFlags, NOT_SANDBOXED, nextAgent, PERMISSION_MODE_TABLE, PERMISSION_USAGE, PLAN_QUESTION_ID, PLAN_TEXT_KEY, parseGoalCommand, parsePermissionCommand, ReloadFailedError, ReloadRefusedError, reloadApplication, selectEntries, settlePlanRun, stateHome, toGrantWire, toRef, validateReloadConfig, } from "@alisio/core";
|
|
4
|
+
import { summarizeDecisionEvents } from "@alisio/sdk";
|
|
4
5
|
import { CombinedAutocompleteProvider, Container, Editor, getImageDimensions, getNativeClipboard, Key, MouseRegion, matchesKey, ProcessTerminal, ScrollView, SelectList, TuiAltScreen, truncateToWidth, VStack, } from "@earendil-works/pi-tui";
|
|
5
6
|
import { loadVersion } from "../version.js";
|
|
6
7
|
import { AGENT_PICKER_ACTIONS, agentEditorRows, agentFieldChoices, agentFieldSupported, agentPickerRows, applyDraft, decodeMultiline, emptyAgentForm, encodeMultiline, filterAgentRows, formErrors, formFromDefinition, formFromTemplate, formToInput, parseAgentsArgs, } from "./agent-manager.js";
|
|
@@ -2591,6 +2592,7 @@ export async function runTui(options) {
|
|
|
2591
2592
|
const tools = Object.entries(s.tools)
|
|
2592
2593
|
.map(([name, t]) => `| \`${name}\` | ${t.calls} | ${t.errors} |`)
|
|
2593
2594
|
.join("\n");
|
|
2595
|
+
const decisionSection = formatDecisionStatsSection(summarizeDecisionEvents(s.decisions ?? []));
|
|
2594
2596
|
return [
|
|
2595
2597
|
"**Session statistics**",
|
|
2596
2598
|
"",
|
|
@@ -2603,6 +2605,7 @@ export async function runTui(options) {
|
|
|
2603
2605
|
"",
|
|
2604
2606
|
tools ? `| Tool | Calls | Errors |\n| --- | --- | --- |\n${tools}` : "No tool calls yet.",
|
|
2605
2607
|
"",
|
|
2608
|
+
...(decisionSection ? [decisionSection, ""] : []),
|
|
2606
2609
|
"**Extensions**",
|
|
2607
2610
|
"",
|
|
2608
2611
|
`- mascot: ${app.plugins.extensions.resolve("mascot")?.provider.id ?? "alisio.default"} · startup screen: ${app.plugins.extensions.resolve("startup-screen")?.provider.id ?? "alisio.default"}`,
|
|
@@ -2767,6 +2770,7 @@ export async function runTui(options) {
|
|
|
2767
2770
|
case "stats":
|
|
2768
2771
|
return info(statsReport());
|
|
2769
2772
|
case "tools":
|
|
2773
|
+
case "decisions":
|
|
2770
2774
|
case "sessions": {
|
|
2771
2775
|
// Text-identical core handlers (parity-tested): output comes from the CommandCatalog.
|
|
2772
2776
|
const result = await commandCatalog.execute(name, parsed.args, { sessionId: session });
|
package/dist/tui/state.d.ts
CHANGED
|
@@ -340,6 +340,8 @@ export interface Stats {
|
|
|
340
340
|
models: string[];
|
|
341
341
|
lastRunMs?: number;
|
|
342
342
|
startedAt: number;
|
|
343
|
+
/** The latest `decision_*` events of this process (bounded); `/stats` summarizes them. */
|
|
344
|
+
decisions?: RunEvent[];
|
|
343
345
|
}
|
|
344
346
|
export interface ViewState {
|
|
345
347
|
items: TranscriptItem[];
|
package/dist/tui/state.js
CHANGED
|
@@ -510,6 +510,8 @@ export function editSummary(name, args) {
|
|
|
510
510
|
lines,
|
|
511
511
|
};
|
|
512
512
|
}
|
|
513
|
+
/** Keeps `/stats` memory bounded in very long TUI sessions. */
|
|
514
|
+
const MAX_DECISION_EVENTS = 2000;
|
|
513
515
|
export function initialViewState(model, now = Date.now()) {
|
|
514
516
|
return {
|
|
515
517
|
items: [],
|
|
@@ -822,6 +824,15 @@ function reduceEventItems(state, event) {
|
|
|
822
824
|
? ` (${d.maxOutputTokens} tokens, ${describeOutputLimitSource(d.source)})`
|
|
823
825
|
: ""} — the answer may be incomplete. Raise limits.maxOutputTokens (/settings → Agent max output tokens) to allow longer answers.`,
|
|
824
826
|
});
|
|
827
|
+
case "decision_completed":
|
|
828
|
+
case "decision_fallback":
|
|
829
|
+
return {
|
|
830
|
+
...state,
|
|
831
|
+
stats: {
|
|
832
|
+
...state.stats,
|
|
833
|
+
decisions: [...(state.stats.decisions ?? []), event].slice(-MAX_DECISION_EVENTS),
|
|
834
|
+
},
|
|
835
|
+
};
|
|
825
836
|
case "model_changed":
|
|
826
837
|
return {
|
|
827
838
|
...state,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@alisio/alisio-code",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"description": "Alisio: an extensible, provider-agnostic coding-agent harness for your terminal. TUI, OpenAI-compatible providers, permissioned local tools, context compaction, persistent memory and a typed plugin SDK.",
|
|
5
5
|
"author": "Gustavo Gutiérrez",
|
|
6
6
|
"license": "MIT",
|
|
@@ -45,12 +45,12 @@
|
|
|
45
45
|
"alisio": "./dist/main.js"
|
|
46
46
|
},
|
|
47
47
|
"dependencies": {
|
|
48
|
-
"@alisio/core": "0.
|
|
49
|
-
"@alisio/plugin-memory": "0.
|
|
50
|
-
"@alisio/plugin-openai-compatible": "0.
|
|
51
|
-
"@alisio/plugin-subagents": "0.
|
|
52
|
-
"@alisio/sdk": "0.
|
|
53
|
-
"@alisio/server": "0.
|
|
48
|
+
"@alisio/core": "0.3.0",
|
|
49
|
+
"@alisio/plugin-memory": "0.3.0",
|
|
50
|
+
"@alisio/plugin-openai-compatible": "0.3.0",
|
|
51
|
+
"@alisio/plugin-subagents": "0.3.0",
|
|
52
|
+
"@alisio/sdk": "0.3.0",
|
|
53
|
+
"@alisio/server": "0.3.0",
|
|
54
54
|
"@earendil-works/pi-tui": "0.87.1",
|
|
55
55
|
"commander": "15.0.0"
|
|
56
56
|
},
|