@alisio/core 0.1.0-alpha.9 → 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/README.md +52 -7
- package/dist/agents/active.d.ts +99 -0
- package/dist/agents/active.js +218 -0
- package/dist/agents/capabilities.d.ts +26 -0
- package/dist/agents/capabilities.js +120 -0
- package/dist/agents/create-agent-skill.d.ts +11 -0
- package/dist/agents/create-agent-skill.js +60 -0
- package/dist/agents/definitions.d.ts +88 -0
- package/dist/agents/definitions.js +404 -0
- package/dist/agents/draft.d.ts +41 -0
- package/dist/agents/draft.js +133 -0
- package/dist/agents/service.d.ts +57 -0
- package/dist/agents/service.js +86 -0
- package/dist/agents/templates.d.ts +8 -0
- package/dist/agents/templates.js +102 -0
- package/dist/analysis/capabilities.d.ts +48 -0
- package/dist/analysis/capabilities.js +90 -0
- package/dist/analysis/data/csv.d.ts +46 -0
- package/dist/analysis/data/csv.js +240 -0
- package/dist/analysis/data/datasets.d.ts +132 -0
- package/dist/analysis/data/datasets.js +441 -0
- package/dist/analysis/data/describe.d.ts +27 -0
- package/dist/analysis/data/describe.js +103 -0
- package/dist/analysis/data/engine-client.d.ts +58 -0
- package/dist/analysis/data/engine-client.js +304 -0
- package/dist/analysis/data/engine-entry.d.ts +1 -0
- package/dist/analysis/data/engine-entry.js +59 -0
- package/dist/analysis/data/engine-source.d.ts +4 -0
- package/dist/analysis/data/engine-source.js +6 -0
- package/dist/analysis/data/engine-types.d.ts +86 -0
- package/dist/analysis/data/engine-types.js +7 -0
- package/dist/analysis/data/infer.d.ts +42 -0
- package/dist/analysis/data/infer.js +118 -0
- package/dist/analysis/data/ingest-worker.d.ts +17 -0
- package/dist/analysis/data/ingest-worker.js +365 -0
- package/dist/analysis/data/json.d.ts +19 -0
- package/dist/analysis/data/json.js +44 -0
- package/dist/analysis/data/query-worker.d.ts +12 -0
- package/dist/analysis/data/query-worker.js +75 -0
- package/dist/analysis/data/rows.d.ts +39 -0
- package/dist/analysis/data/rows.js +120 -0
- package/dist/analysis/data/sql-guard.d.ts +20 -0
- package/dist/analysis/data/sql-guard.js +129 -0
- package/dist/analysis/data/stats.d.ts +18 -0
- package/dist/analysis/data/stats.js +77 -0
- package/dist/analysis/install-hints.d.ts +33 -0
- package/dist/analysis/install-hints.js +144 -0
- package/dist/analysis/janitor.d.ts +60 -0
- package/dist/analysis/janitor.js +264 -0
- package/dist/analysis/jobs.d.ts +94 -0
- package/dist/analysis/jobs.js +165 -0
- package/dist/analysis/oci.d.ts +129 -0
- package/dist/analysis/oci.js +330 -0
- package/dist/analysis/python/sources.d.ts +2 -0
- package/dist/analysis/python/sources.js +10 -0
- package/dist/analysis/requirements.d.ts +32 -0
- package/dist/analysis/requirements.js +73 -0
- package/dist/analysis/rerun.d.ts +40 -0
- package/dist/analysis/rerun.js +136 -0
- package/dist/analysis/runtime-manager.d.ts +146 -0
- package/dist/analysis/runtime-manager.js +472 -0
- package/dist/analysis/status.d.ts +21 -0
- package/dist/analysis/status.js +52 -0
- package/dist/application.d.ts +105 -3
- package/dist/application.js +446 -18
- package/dist/artifacts/kinds.d.ts +35 -0
- package/dist/artifacts/kinds.js +177 -0
- package/dist/artifacts/publisher.d.ts +7 -0
- package/dist/artifacts/publisher.js +29 -0
- package/dist/artifacts/store.d.ts +119 -0
- package/dist/artifacts/store.js +581 -0
- package/dist/background/janitor.d.ts +22 -0
- package/dist/background/janitor.js +62 -0
- package/dist/background/mirror.d.ts +14 -0
- package/dist/background/mirror.js +41 -0
- package/dist/background/notify.d.ts +58 -0
- package/dist/background/notify.js +172 -0
- package/dist/background/output.d.ts +46 -0
- package/dist/background/output.js +179 -0
- package/dist/background/service.d.ts +137 -0
- package/dist/background/service.js +410 -0
- package/dist/background/store.d.ts +103 -0
- package/dist/background/store.js +195 -0
- package/dist/changelog/data.d.ts +6 -0
- package/dist/changelog/data.js +293 -0
- package/dist/changelog/index.d.ts +5 -0
- package/dist/changelog/index.js +7 -0
- package/dist/changelog/parse.d.ts +53 -0
- package/dist/changelog/parse.js +160 -0
- package/dist/commands/builtins.d.ts +10 -0
- package/dist/commands/builtins.js +161 -0
- package/dist/commands/catalog.d.ts +86 -0
- package/dist/commands/catalog.js +304 -0
- package/dist/config.d.ts +206 -6
- package/dist/config.js +426 -20
- package/dist/core/compaction.js +13 -2
- package/dist/core/contracts.d.ts +180 -3
- package/dist/core/opt-in.d.ts +12 -0
- package/dist/core/opt-in.js +12 -0
- package/dist/core/output-limit.d.ts +34 -0
- package/dist/core/output-limit.js +39 -0
- package/dist/core/run-stats.d.ts +16 -0
- package/dist/core/run-stats.js +8 -0
- package/dist/core/runner.d.ts +134 -4
- package/dist/core/runner.js +780 -138
- package/dist/core/timeout.d.ts +15 -0
- package/dist/core/timeout.js +61 -0
- package/dist/core/truncation.d.ts +30 -0
- package/dist/core/truncation.js +83 -0
- package/dist/goal/blockers.d.ts +45 -0
- package/dist/goal/blockers.js +51 -0
- package/dist/goal/budget.d.ts +24 -0
- package/dist/goal/budget.js +53 -0
- package/dist/goal/command.d.ts +36 -0
- package/dist/goal/command.js +98 -0
- package/dist/goal/format.d.ts +19 -0
- package/dist/goal/format.js +102 -0
- package/dist/goal/host.d.ts +29 -0
- package/dist/goal/host.js +42 -0
- package/dist/goal/index.d.ts +9 -0
- package/dist/goal/index.js +9 -0
- package/dist/goal/machine.d.ts +186 -0
- package/dist/goal/machine.js +344 -0
- package/dist/goal/prompts.d.ts +10 -0
- package/dist/goal/prompts.js +75 -0
- package/dist/goal/service.d.ts +113 -0
- package/dist/goal/service.js +273 -0
- package/dist/goal/store.d.ts +59 -0
- package/dist/goal/store.js +184 -0
- package/dist/index.d.ts +50 -5
- package/dist/index.js +49 -4
- package/dist/mcp/connector.js +38 -6
- package/dist/mcp/rich.d.ts +41 -0
- package/dist/mcp/rich.js +362 -0
- package/dist/permissions/modes.d.ts +72 -0
- package/dist/permissions/modes.js +98 -0
- package/dist/plan/exit-plan.d.ts +25 -0
- package/dist/plan/exit-plan.js +130 -0
- package/dist/plan/state.d.ts +102 -0
- package/dist/plan/state.js +165 -0
- package/dist/plugins/host.d.ts +34 -1
- package/dist/plugins/host.js +143 -9
- package/dist/providers/settings.d.ts +15 -0
- package/dist/providers/settings.js +38 -0
- package/dist/reload.d.ts +75 -0
- package/dist/reload.js +204 -0
- package/dist/resources/context.js +6 -1
- package/dist/runtime/access.d.ts +62 -0
- package/dist/runtime/access.js +115 -0
- package/dist/runtime/blobs.d.ts +51 -0
- package/dist/runtime/blobs.js +177 -0
- package/dist/runtime/diff.d.ts +23 -0
- package/dist/runtime/diff.js +154 -0
- package/dist/runtime/ids.d.ts +8 -0
- package/dist/runtime/ids.js +32 -0
- package/dist/runtime/paths.d.ts +11 -0
- package/dist/runtime/paths.js +17 -1
- package/dist/runtime/process.d.ts +22 -0
- package/dist/runtime/process.js +100 -15
- package/dist/runtime/sqlite.d.ts +2 -0
- package/dist/runtime/sqlite.js +18 -0
- package/dist/runtime/store.d.ts +91 -3
- package/dist/runtime/store.js +465 -11
- package/dist/runtime/zip.d.ts +24 -0
- package/dist/runtime/zip.js +126 -0
- package/dist/sessions/children.js +17 -1
- package/dist/sessions/side-questions.d.ts +57 -0
- package/dist/sessions/side-questions.js +161 -0
- package/dist/tools/analysis.d.ts +37 -0
- package/dist/tools/analysis.js +573 -0
- package/dist/tools/artifacts.d.ts +14 -0
- package/dist/tools/artifacts.js +143 -0
- package/dist/tools/background.d.ts +7 -0
- package/dist/tools/background.js +165 -0
- package/dist/tools/data.d.ts +7 -0
- package/dist/tools/data.js +160 -0
- package/dist/tools/execute.d.ts +5 -0
- package/dist/tools/execute.js +15 -3
- package/dist/tools/goal.d.ts +19 -0
- package/dist/tools/goal.js +126 -0
- package/dist/tools/search.d.ts +17 -3
- package/dist/tools/search.js +153 -0
- package/dist/tools/standard.d.ts +4 -1
- package/dist/tools/standard.js +99 -18
- package/dist/version.d.ts +5 -3
- package/dist/version.js +35 -6
- package/package.json +2 -2
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
const ENTRY_HEADING = /^##\s+\[?([^\]\s]+)\]?(?:\s*[-–—·]\s*(\d{4}-\d{2}-\d{2}))?\s*$/;
|
|
2
|
+
const SECTION_HEADING = /^###\s+(.+?)\s*$/;
|
|
3
|
+
const BULLET = /^\s{0,3}[-*]\s+(.*\S)\s*$/;
|
|
4
|
+
const DEFAULT_SECTION = "Changes";
|
|
5
|
+
export const UNRELEASED = "Unreleased";
|
|
6
|
+
export function parseChangelog(markdown) {
|
|
7
|
+
const entries = [];
|
|
8
|
+
let entry;
|
|
9
|
+
let section;
|
|
10
|
+
let item = -1;
|
|
11
|
+
const openSection = (title) => {
|
|
12
|
+
section = { title, items: [] };
|
|
13
|
+
entry?.sections.push(section);
|
|
14
|
+
item = -1;
|
|
15
|
+
};
|
|
16
|
+
for (const raw of markdown.replace(/\r\n?/g, "\n").split("\n")) {
|
|
17
|
+
const heading = ENTRY_HEADING.exec(raw);
|
|
18
|
+
if (heading?.[1]) {
|
|
19
|
+
const version = heading[1].replace(/^v(?=\d)/, "");
|
|
20
|
+
const unreleased = version.toLowerCase() === UNRELEASED.toLowerCase();
|
|
21
|
+
entry = {
|
|
22
|
+
version: unreleased ? UNRELEASED : version,
|
|
23
|
+
...(heading[2] ? { date: heading[2] } : {}),
|
|
24
|
+
...(unreleased ? { unreleased: true } : {}),
|
|
25
|
+
sections: [],
|
|
26
|
+
};
|
|
27
|
+
entries.push(entry);
|
|
28
|
+
section = undefined;
|
|
29
|
+
item = -1;
|
|
30
|
+
continue;
|
|
31
|
+
}
|
|
32
|
+
if (!entry)
|
|
33
|
+
continue;
|
|
34
|
+
const sectionHeading = SECTION_HEADING.exec(raw);
|
|
35
|
+
if (sectionHeading?.[1]) {
|
|
36
|
+
openSection(sectionHeading[1]);
|
|
37
|
+
continue;
|
|
38
|
+
}
|
|
39
|
+
const bullet = BULLET.exec(raw);
|
|
40
|
+
if (bullet?.[1]) {
|
|
41
|
+
if (!section)
|
|
42
|
+
openSection(DEFAULT_SECTION);
|
|
43
|
+
section?.items.push(bullet[1]);
|
|
44
|
+
item = (section?.items.length ?? 0) - 1;
|
|
45
|
+
continue;
|
|
46
|
+
}
|
|
47
|
+
// A non-blank, indented continuation extends the previous bullet.
|
|
48
|
+
if (section && item >= 0 && /^\s{2,}\S/.test(raw))
|
|
49
|
+
section.items[item] = `${section.items[item]} ${raw.trim()}`;
|
|
50
|
+
}
|
|
51
|
+
return entries.map((e) => ({ ...e, sections: e.sections.filter((s) => s.items.length) }));
|
|
52
|
+
}
|
|
53
|
+
const VERSION = /^v?(\d+)\.(\d+)\.(\d+)(?:-([0-9A-Za-z.-]+))?(?:\+[0-9A-Za-z.-]+)?$/;
|
|
54
|
+
function parseVersion(text) {
|
|
55
|
+
const match = VERSION.exec(text.trim());
|
|
56
|
+
if (!match)
|
|
57
|
+
return undefined;
|
|
58
|
+
return {
|
|
59
|
+
core: [Number(match[1]), Number(match[2]), Number(match[3])],
|
|
60
|
+
pre: match[4] ? match[4].split(".") : [],
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
/** Whether `text` is a semantic version (`1.2.3-alpha.4`, with an optional leading `v`). */
|
|
64
|
+
export const isVersion = (text) => parseVersion(text) !== undefined;
|
|
65
|
+
/**
|
|
66
|
+
* Semver order with numeric prerelease identifiers (`alpha.9` < `alpha.10`; a release is above its
|
|
67
|
+
* prereleases). `Unreleased` is above every version; an unparseable text sorts below all of them.
|
|
68
|
+
*/
|
|
69
|
+
export function compareVersions(a, b) {
|
|
70
|
+
const unreleasedA = a === UNRELEASED, unreleasedB = b === UNRELEASED;
|
|
71
|
+
if (unreleasedA || unreleasedB)
|
|
72
|
+
return Number(unreleasedA) - Number(unreleasedB);
|
|
73
|
+
const left = parseVersion(a), right = parseVersion(b);
|
|
74
|
+
if (!left || !right)
|
|
75
|
+
return Math.sign(Number(!!left) - Number(!!right));
|
|
76
|
+
for (let i = 0; i < 3; i++) {
|
|
77
|
+
const diff = (left.core[i] ?? 0) - (right.core[i] ?? 0);
|
|
78
|
+
if (diff)
|
|
79
|
+
return Math.sign(diff);
|
|
80
|
+
}
|
|
81
|
+
if (!left.pre.length || !right.pre.length)
|
|
82
|
+
return Math.sign(right.pre.length - left.pre.length);
|
|
83
|
+
for (let i = 0; i < Math.max(left.pre.length, right.pre.length); i++) {
|
|
84
|
+
const x = left.pre[i], y = right.pre[i];
|
|
85
|
+
if (x === undefined)
|
|
86
|
+
return -1;
|
|
87
|
+
if (y === undefined)
|
|
88
|
+
return 1;
|
|
89
|
+
const numeric = /^\d+$/.test(x) && /^\d+$/.test(y);
|
|
90
|
+
if (numeric) {
|
|
91
|
+
const diff = Number(x) - Number(y);
|
|
92
|
+
if (diff)
|
|
93
|
+
return Math.sign(diff);
|
|
94
|
+
}
|
|
95
|
+
else if (/^\d+$/.test(x) !== /^\d+$/.test(y))
|
|
96
|
+
return /^\d+$/.test(x) ? -1 : 1;
|
|
97
|
+
else if (x !== y)
|
|
98
|
+
return x < y ? -1 : 1;
|
|
99
|
+
}
|
|
100
|
+
return 0;
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* The entries to show: the `limit` newest (default 5), or the one named by `version` (`alpha.4`,
|
|
104
|
+
* `1.2.3-alpha.4` and `v1.2.3-alpha.4` all match). Entries come back newest first.
|
|
105
|
+
*/
|
|
106
|
+
export function selectEntries(entries, options = {}) {
|
|
107
|
+
const sorted = [...entries].sort((a, b) => compareVersions(b.version, a.version));
|
|
108
|
+
const asked = options.version?.trim();
|
|
109
|
+
if (!asked)
|
|
110
|
+
return { entries: sorted.slice(0, Math.max(1, options.limit ?? 5)), found: true };
|
|
111
|
+
const wanted = asked.replace(/^v(?=\d)/, "").toLowerCase();
|
|
112
|
+
const hit = sorted.find((entry) => entry.version.toLowerCase() === wanted ||
|
|
113
|
+
entry.version.toLowerCase().endsWith(`-${wanted}`) ||
|
|
114
|
+
entry.version.toLowerCase().endsWith(`.${wanted}`));
|
|
115
|
+
return hit ? { entries: [hit], found: true } : { entries: [], found: false };
|
|
116
|
+
}
|
|
117
|
+
/**
|
|
118
|
+
* Decides the discreet "Alisio updated" line. A first run (no `lastSeen`) stays silent and records;
|
|
119
|
+
* the same version does nothing; a downgrade or an upgrade without entries records silently;
|
|
120
|
+
* an upgrade with entries in `(lastSeen, current]` shows. `Unreleased` never counts as news and an
|
|
121
|
+
* unparseable `current` (a development build) does nothing.
|
|
122
|
+
*/
|
|
123
|
+
export function changelogNews(input) {
|
|
124
|
+
const { entries, current, lastSeen } = input;
|
|
125
|
+
const none = { show: false, versions: [], record: false };
|
|
126
|
+
if (!isVersion(current))
|
|
127
|
+
return none;
|
|
128
|
+
if (!lastSeen || !isVersion(lastSeen))
|
|
129
|
+
return { ...none, record: true };
|
|
130
|
+
const order = compareVersions(current, lastSeen);
|
|
131
|
+
if (order === 0)
|
|
132
|
+
return none;
|
|
133
|
+
if (order < 0)
|
|
134
|
+
return { ...none, record: true };
|
|
135
|
+
const versions = entries
|
|
136
|
+
.filter((entry) => !entry.unreleased &&
|
|
137
|
+
compareVersions(entry.version, lastSeen) > 0 &&
|
|
138
|
+
compareVersions(entry.version, current) <= 0)
|
|
139
|
+
.map((entry) => entry.version)
|
|
140
|
+
.sort((a, b) => compareVersions(b, a));
|
|
141
|
+
return versions.length
|
|
142
|
+
? { show: true, versions, latest: versions[0], record: true }
|
|
143
|
+
: { ...none, record: true };
|
|
144
|
+
}
|
|
145
|
+
/** Markdown for the entries (one `##` heading per version, bold section titles, bullets). */
|
|
146
|
+
export function formatChangelogMarkdown(entries) {
|
|
147
|
+
if (!entries.length)
|
|
148
|
+
return "No changelog entries.";
|
|
149
|
+
return entries
|
|
150
|
+
.map((entry) => [
|
|
151
|
+
`## ${entry.version}${entry.date ? ` · ${entry.date}` : ""}${entry.unreleased ? " (not released yet)" : ""}`,
|
|
152
|
+
...entry.sections.flatMap((section) => [
|
|
153
|
+
"",
|
|
154
|
+
`**${section.title}**`,
|
|
155
|
+
"",
|
|
156
|
+
...section.items.map((item) => `- ${item}`),
|
|
157
|
+
]),
|
|
158
|
+
].join("\n"))
|
|
159
|
+
.join("\n\n");
|
|
160
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { CommandDescriptor } from "@alisio/sdk";
|
|
2
|
+
/** A built-in slash command: a descriptor without `source`/`owner` (always `builtin`). */
|
|
3
|
+
export type BuiltinCommand = Omit<CommandDescriptor, "source" | "owner">;
|
|
4
|
+
/**
|
|
5
|
+
* Built-in slash commands, in the order the TUI lists them. Names, aliases, descriptions and
|
|
6
|
+
* argument hints are the TUI's `COMMANDS` moved here as data (the TUI re-exports them).
|
|
7
|
+
* `execution: "core"` commands have a handler in `CommandCatalog.execute`; `surface` commands
|
|
8
|
+
* (clipboard, exit, settings/connect wizards, help, `/ask`) are handled by each UI.
|
|
9
|
+
*/
|
|
10
|
+
export declare const BUILTIN_COMMANDS: readonly BuiltinCommand[];
|
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
const ALL = ["tui", "web", "api"];
|
|
2
|
+
const TUI = ["tui"];
|
|
3
|
+
const INTERACTIVE = ["tui", "web"];
|
|
4
|
+
/**
|
|
5
|
+
* Built-in slash commands, in the order the TUI lists them. Names, aliases, descriptions and
|
|
6
|
+
* argument hints are the TUI's `COMMANDS` moved here as data (the TUI re-exports them).
|
|
7
|
+
* `execution: "core"` commands have a handler in `CommandCatalog.execute`; `surface` commands
|
|
8
|
+
* (clipboard, exit, settings/connect wizards, help, `/ask`) are handled by each UI.
|
|
9
|
+
*/
|
|
10
|
+
export const BUILTIN_COMMANDS = [
|
|
11
|
+
{
|
|
12
|
+
name: "help",
|
|
13
|
+
description: "Show commands and keys",
|
|
14
|
+
surfaces: INTERACTIVE,
|
|
15
|
+
execution: "surface",
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
name: "connect",
|
|
19
|
+
description: "Configure a provider and choose its active model",
|
|
20
|
+
surfaces: TUI,
|
|
21
|
+
execution: "surface",
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
name: "model",
|
|
25
|
+
description: "Switch provider and model",
|
|
26
|
+
aliases: ["models"],
|
|
27
|
+
surfaces: ALL,
|
|
28
|
+
execution: "core",
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
name: "compact",
|
|
32
|
+
description: "Summarize older history",
|
|
33
|
+
argumentHint: "[focus]",
|
|
34
|
+
surfaces: ALL,
|
|
35
|
+
execution: "core",
|
|
36
|
+
},
|
|
37
|
+
{ name: "stats", description: "Session statistics", surfaces: ALL, execution: "core" },
|
|
38
|
+
{
|
|
39
|
+
name: "clear",
|
|
40
|
+
description: "Start a new session",
|
|
41
|
+
aliases: ["new"],
|
|
42
|
+
surfaces: ALL,
|
|
43
|
+
execution: "core",
|
|
44
|
+
},
|
|
45
|
+
{ name: "sessions", description: "List recent sessions", surfaces: ALL, execution: "core" },
|
|
46
|
+
{
|
|
47
|
+
name: "resume",
|
|
48
|
+
description: "Resume a session by ID or prefix",
|
|
49
|
+
argumentHint: "<id>",
|
|
50
|
+
surfaces: ALL,
|
|
51
|
+
execution: "core",
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
name: "tools",
|
|
55
|
+
description: "List tools and permission state",
|
|
56
|
+
surfaces: ALL,
|
|
57
|
+
execution: "core",
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
name: "plugins",
|
|
61
|
+
description: "Browse and manage project plugins",
|
|
62
|
+
surfaces: ALL,
|
|
63
|
+
execution: "core",
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
name: "skills",
|
|
67
|
+
description: "Browse and manage effective skills",
|
|
68
|
+
surfaces: ALL,
|
|
69
|
+
execution: "core",
|
|
70
|
+
},
|
|
71
|
+
{ name: "mcps", description: "Browse and manage MCP servers", surfaces: ALL, execution: "core" },
|
|
72
|
+
{
|
|
73
|
+
name: "settings",
|
|
74
|
+
description: "Open the settings menu",
|
|
75
|
+
aliases: ["prefs"],
|
|
76
|
+
surfaces: TUI,
|
|
77
|
+
execution: "surface",
|
|
78
|
+
},
|
|
79
|
+
{
|
|
80
|
+
name: "copy",
|
|
81
|
+
description: "Copy the last assistant response to the clipboard",
|
|
82
|
+
surfaces: TUI,
|
|
83
|
+
execution: "surface",
|
|
84
|
+
},
|
|
85
|
+
{
|
|
86
|
+
name: "agents",
|
|
87
|
+
description: "List and switch the active agent (applies from the next prompt)",
|
|
88
|
+
argumentHint: "[<verb>]",
|
|
89
|
+
surfaces: ALL,
|
|
90
|
+
execution: "core",
|
|
91
|
+
},
|
|
92
|
+
{
|
|
93
|
+
name: "effort",
|
|
94
|
+
description: "Set the reasoning effort level for the active model",
|
|
95
|
+
argumentHint: "[level]",
|
|
96
|
+
surfaces: ALL,
|
|
97
|
+
execution: "core",
|
|
98
|
+
},
|
|
99
|
+
{
|
|
100
|
+
name: "ask",
|
|
101
|
+
description: "Ask the agent to turn your question into a multiple-choice ask_user_question",
|
|
102
|
+
argumentHint: "<question>",
|
|
103
|
+
surfaces: INTERACTIVE,
|
|
104
|
+
execution: "surface",
|
|
105
|
+
},
|
|
106
|
+
{
|
|
107
|
+
name: "btw",
|
|
108
|
+
description: "Ask a side question about the session without adding to the conversation",
|
|
109
|
+
argumentHint: "[question]",
|
|
110
|
+
surfaces: ALL,
|
|
111
|
+
execution: "core",
|
|
112
|
+
},
|
|
113
|
+
{
|
|
114
|
+
name: "artifacts",
|
|
115
|
+
description: "Browse this session's artifacts",
|
|
116
|
+
argumentHint: "[filter]",
|
|
117
|
+
surfaces: INTERACTIVE,
|
|
118
|
+
execution: "surface",
|
|
119
|
+
},
|
|
120
|
+
{
|
|
121
|
+
name: "permission",
|
|
122
|
+
description: "Switch the permission mode (ask, auto, full access), see its status or manage saved permissions",
|
|
123
|
+
aliases: ["permissions"],
|
|
124
|
+
argumentHint: "[ask|auto|full|status]",
|
|
125
|
+
surfaces: INTERACTIVE,
|
|
126
|
+
execution: "surface",
|
|
127
|
+
},
|
|
128
|
+
{
|
|
129
|
+
name: "reload",
|
|
130
|
+
description: "Reload the configuration, agents, skills, prompt templates and MCP servers (between turns)",
|
|
131
|
+
surfaces: INTERACTIVE,
|
|
132
|
+
execution: "surface",
|
|
133
|
+
},
|
|
134
|
+
{
|
|
135
|
+
name: "changelog",
|
|
136
|
+
description: "Show what changed in recent Alisio releases",
|
|
137
|
+
argumentHint: "[version]",
|
|
138
|
+
surfaces: INTERACTIVE,
|
|
139
|
+
execution: "surface",
|
|
140
|
+
},
|
|
141
|
+
{
|
|
142
|
+
name: "tasks",
|
|
143
|
+
description: "Show this session's background tasks (bg_run) with their output, and stop them",
|
|
144
|
+
surfaces: INTERACTIVE,
|
|
145
|
+
execution: "surface",
|
|
146
|
+
},
|
|
147
|
+
{
|
|
148
|
+
name: "goal",
|
|
149
|
+
description: "Start or manage the current Session Goal",
|
|
150
|
+
argumentHint: "[objective | pause | resume | edit | clear | help | budget=<n>]",
|
|
151
|
+
surfaces: INTERACTIVE,
|
|
152
|
+
execution: "surface",
|
|
153
|
+
},
|
|
154
|
+
{
|
|
155
|
+
name: "exit",
|
|
156
|
+
description: "Exit Alisio",
|
|
157
|
+
aliases: ["quit"],
|
|
158
|
+
surfaces: TUI,
|
|
159
|
+
execution: "surface",
|
|
160
|
+
},
|
|
161
|
+
];
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* One catalog of slash commands for every surface (TUI, web, API): built-ins, plugin commands,
|
|
3
|
+
* prompt templates and skills, with the pure core handlers of `execution: "core"` commands.
|
|
4
|
+
* The catalog reads its sources live from the host on each call, so plugin/template/skill
|
|
5
|
+
* changes show up without rebuilding it.
|
|
6
|
+
*/
|
|
7
|
+
import type { CommandDescriptor, ToolDefinition } from "@alisio/sdk";
|
|
8
|
+
import type { PluginCatalogEntry } from "../application.ts";
|
|
9
|
+
import type { SessionStore } from "../core/contracts.ts";
|
|
10
|
+
import type { AgentRunner } from "../core/runner.ts";
|
|
11
|
+
import type { McpServerInfo } from "../mcp/connector.ts";
|
|
12
|
+
import type { PromptTemplate } from "../resources/prompts.ts";
|
|
13
|
+
import type { SkillCatalogEntry } from "../resources/skills.ts";
|
|
14
|
+
import { type SideQuestions } from "../sessions/side-questions.ts";
|
|
15
|
+
import { BUILTIN_COMMANDS, type BuiltinCommand } from "./builtins.ts";
|
|
16
|
+
export { BUILTIN_COMMANDS, type BuiltinCommand };
|
|
17
|
+
export type CommandSurface = CommandDescriptor["surfaces"][number];
|
|
18
|
+
type PluginCommandHandler = (args: string, context?: {
|
|
19
|
+
sessionId?: string;
|
|
20
|
+
}) => Promise<string>;
|
|
21
|
+
/**
|
|
22
|
+
* What the catalog needs from an application. `createApplication()`'s result satisfies it; the
|
|
23
|
+
* optional members only enable the matching sources and handlers.
|
|
24
|
+
*/
|
|
25
|
+
export interface CommandHost {
|
|
26
|
+
workspace: string;
|
|
27
|
+
store: SessionStore;
|
|
28
|
+
runner: Pick<AgentRunner, "policy" | "approvals" | "compact" | "setModel">;
|
|
29
|
+
registry: {
|
|
30
|
+
list(): ToolDefinition[];
|
|
31
|
+
};
|
|
32
|
+
provider: {
|
|
33
|
+
id: string;
|
|
34
|
+
};
|
|
35
|
+
plugins?: {
|
|
36
|
+
commands: ReadonlyMap<string, PluginCommandHandler>;
|
|
37
|
+
commandInfo: ReadonlyMap<string, {
|
|
38
|
+
plugin: string;
|
|
39
|
+
description?: string;
|
|
40
|
+
argumentHint?: string;
|
|
41
|
+
}>;
|
|
42
|
+
pluginState?(plugin: string, key: string): unknown;
|
|
43
|
+
};
|
|
44
|
+
prompts?: {
|
|
45
|
+
templates: ReadonlyMap<string, PromptTemplate>;
|
|
46
|
+
};
|
|
47
|
+
skillCatalog?(): SkillCatalogEntry[];
|
|
48
|
+
pluginCatalog?(): PluginCatalogEntry[];
|
|
49
|
+
mcp?: {
|
|
50
|
+
list(): McpServerInfo[];
|
|
51
|
+
};
|
|
52
|
+
config?: {
|
|
53
|
+
agents: {
|
|
54
|
+
active?: string;
|
|
55
|
+
effort?: string;
|
|
56
|
+
};
|
|
57
|
+
};
|
|
58
|
+
updateSetting?(key: "agents.effort", value: unknown): Promise<string>;
|
|
59
|
+
/** `/btw` side questions (tool-less, outside the conversation). */
|
|
60
|
+
sideQuestions?: Pick<SideQuestions, "ask" | "history">;
|
|
61
|
+
}
|
|
62
|
+
export interface CommandExecutionContext {
|
|
63
|
+
sessionId: string;
|
|
64
|
+
signal?: AbortSignal;
|
|
65
|
+
}
|
|
66
|
+
export interface CommandResult {
|
|
67
|
+
/** Markdown for the user. */
|
|
68
|
+
text?: string;
|
|
69
|
+
/** `notice` is a short status line; `info` (default) a report. */
|
|
70
|
+
tone?: "info" | "notice";
|
|
71
|
+
/** The session the surface should switch to (`clear`/`new`, `resume`). */
|
|
72
|
+
sessionId?: string;
|
|
73
|
+
/** Structured result for programmatic callers (e.g. a `CompactionResult`). */
|
|
74
|
+
data?: unknown;
|
|
75
|
+
}
|
|
76
|
+
export declare class CommandCatalog {
|
|
77
|
+
private readonly host?;
|
|
78
|
+
constructor(host?: CommandHost | undefined);
|
|
79
|
+
private builtins;
|
|
80
|
+
/** Every descriptor (optionally for one surface). Precedence: builtin > plugin > prompt > skill. */
|
|
81
|
+
list(surface?: CommandSurface): CommandDescriptor[];
|
|
82
|
+
/** A command by name or alias (built-in names and aliases are case-insensitive). */
|
|
83
|
+
resolve(name: string): CommandDescriptor | undefined;
|
|
84
|
+
/** Runs an `execution: "core"` command. Surface commands and unknown names throw. */
|
|
85
|
+
execute(name: string, args: string, ctx: CommandExecutionContext): Promise<CommandResult>;
|
|
86
|
+
}
|