@cotal-ai/cli 0.3.2 → 0.4.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 +11 -0
- package/dist/command.d.ts.map +1 -1
- package/dist/command.js +4 -2
- package/dist/command.js.map +1 -1
- package/dist/commands/completion.d.ts +8 -0
- package/dist/commands/completion.d.ts.map +1 -0
- package/dist/commands/completion.js +74 -0
- package/dist/commands/completion.js.map +1 -0
- package/dist/commands/join.d.ts.map +1 -1
- package/dist/commands/join.js +16 -9
- package/dist/commands/join.js.map +1 -1
- package/dist/commands/mint.d.ts.map +1 -1
- package/dist/commands/mint.js +20 -12
- package/dist/commands/mint.js.map +1 -1
- package/dist/commands/personas.d.ts +5 -0
- package/dist/commands/personas.d.ts.map +1 -0
- package/dist/commands/personas.js +170 -0
- package/dist/commands/personas.js.map +1 -0
- package/dist/commands/send.d.ts.map +1 -1
- package/dist/commands/send.js +21 -10
- package/dist/commands/send.js.map +1 -1
- package/dist/commands/setup.js +7 -3
- package/dist/commands/setup.js.map +1 -1
- package/dist/commands/spawn.d.ts +4 -13
- package/dist/commands/spawn.d.ts.map +1 -1
- package/dist/commands/spawn.js +88 -7
- package/dist/commands/spawn.js.map +1 -1
- package/dist/commands/up.d.ts +1 -0
- package/dist/commands/up.d.ts.map +1 -1
- package/dist/commands/up.js +11 -7
- package/dist/commands/up.js.map +1 -1
- package/dist/console/commands.d.ts +1 -1
- package/dist/console/commands.d.ts.map +1 -1
- package/dist/console/commands.js +32 -6
- package/dist/console/commands.js.map +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +27 -1
- package/dist/index.js.map +1 -1
- package/dist/lib/personas.d.ts +24 -0
- package/dist/lib/personas.d.ts.map +1 -0
- package/dist/lib/personas.js +35 -0
- package/dist/lib/personas.js.map +1 -0
- package/dist/web/app.js +1 -1
- package/package.json +3 -2
package/dist/index.js
CHANGED
|
@@ -7,7 +7,9 @@ import { watch } from "./commands/watch.js";
|
|
|
7
7
|
import { console_ } from "./commands/console.js";
|
|
8
8
|
import { demo } from "./commands/demo.js";
|
|
9
9
|
import { web } from "./commands/web.js";
|
|
10
|
-
import { spawn } from "./commands/spawn.js";
|
|
10
|
+
import { spawn, spawnComplete } from "./commands/spawn.js";
|
|
11
|
+
import { personas, personasComplete } from "./commands/personas.js";
|
|
12
|
+
import { completion, completionComplete, complete } from "./commands/completion.js";
|
|
11
13
|
import { mint } from "./commands/mint.js";
|
|
12
14
|
import { signer } from "./commands/signer.js";
|
|
13
15
|
import { channels } from "./commands/channels.js";
|
|
@@ -112,6 +114,30 @@ const baseCommands = [
|
|
|
112
114
|
group: "Agents",
|
|
113
115
|
summary: "launch an agent in this terminal from a file — spawn <name-or-path> | --name <n> --config <path> [--agent <a>] [--role <r>]",
|
|
114
116
|
run: spawn,
|
|
117
|
+
complete: spawnComplete,
|
|
118
|
+
},
|
|
119
|
+
{
|
|
120
|
+
kind: "command",
|
|
121
|
+
name: "personas",
|
|
122
|
+
group: "Agents",
|
|
123
|
+
summary: "list/manage local personas (.cotal/agents) — personas <list [-v] | show <name> | new <name> (--prompt <t>|--from <f>) [--role <r>] [--model <m>] | rm <name> --force>",
|
|
124
|
+
run: personas,
|
|
125
|
+
complete: personasComplete,
|
|
126
|
+
},
|
|
127
|
+
{
|
|
128
|
+
kind: "command",
|
|
129
|
+
name: "completion",
|
|
130
|
+
group: "Agents",
|
|
131
|
+
summary: "print a shell-completion script — completion <bash|zsh|fish|powershell>",
|
|
132
|
+
run: completion,
|
|
133
|
+
complete: completionComplete,
|
|
134
|
+
},
|
|
135
|
+
{
|
|
136
|
+
kind: "command",
|
|
137
|
+
name: "__complete",
|
|
138
|
+
group: "Agents",
|
|
139
|
+
summary: "(internal) emit completion candidates for the current command line",
|
|
140
|
+
run: complete,
|
|
115
141
|
},
|
|
116
142
|
{
|
|
117
143
|
kind: "command",
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAgB,MAAM,gBAAgB,CAAC;AACxD,OAAO,EAAE,EAAE,EAAE,MAAM,kBAAkB,CAAC;AACtC,OAAO,EAAE,IAAI,EAAE,MAAM,oBAAoB,CAAC;AAC1C,OAAO,EAAE,KAAK,EAAE,EAAE,EAAE,MAAM,qBAAqB,CAAC;AAChD,OAAO,EAAE,IAAI,EAAE,MAAM,oBAAoB,CAAC;AAC1C,OAAO,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAC;AAC5C,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AACjD,OAAO,EAAE,IAAI,EAAE,MAAM,oBAAoB,CAAC;AAC1C,OAAO,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AACxC,OAAO,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAgB,MAAM,gBAAgB,CAAC;AACxD,OAAO,EAAE,EAAE,EAAE,MAAM,kBAAkB,CAAC;AACtC,OAAO,EAAE,IAAI,EAAE,MAAM,oBAAoB,CAAC;AAC1C,OAAO,EAAE,KAAK,EAAE,EAAE,EAAE,MAAM,qBAAqB,CAAC;AAChD,OAAO,EAAE,IAAI,EAAE,MAAM,oBAAoB,CAAC;AAC1C,OAAO,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAC;AAC5C,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AACjD,OAAO,EAAE,IAAI,EAAE,MAAM,oBAAoB,CAAC;AAC1C,OAAO,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AACxC,OAAO,EAAE,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAC3D,OAAO,EAAE,QAAQ,EAAE,gBAAgB,EAAE,MA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,KAAK,EAAE,QAAQ;QACf,OAAO,EAAE,yEAAyE;QAClF,GAAG,EAAE,UAAU;QACf,QAAQ,EAAE,kBAAkB;KAC7B;IACD;QACE,IAAI,EAAE,SAAS;QACf,IAAI,EAAE,YAAY;QAClB,KAAK,EAAE,QAAQ;QACf,OAAO,EAAE,oEAAoE;QAC7E,GAAG,EAAE,QAAQ;KACd;IACD;QACE,IAAI,EAAE,SAAS;QACf,IAAI,EAAE,MAAM;QACZ,KAAK,EAAE,MAAM;QACb,OAAO,EAAE,mGAAmG;QAC5G,GAAG,EAAE,IAAI;KACV;IACD;QACE,IAAI,EAAE,SAAS;QACf,IAAI,EAAE,QAAQ;QACd,KAAK,EAAE,MAAM;QACb,OAAO,EACL,qIAAqI;QACvI,GAAG,EAAE,MAAM;KACZ;IACD;QACE,IAAI,EAAE,SAAS;QACf,IAAI,EAAE,UAAU;QAChB,KAAK,EAAE,MAAM;QACb,OAAO,EACL,qJAAqJ;QACvJ,GAAG,EAAE,QAAQ;KACd;IACD;QACE,IAAI,EAAE,SAAS;QACf,IAAI,EAAE,SAAS;QACf,KAAK,EAAE,MAAM;QACb,OAAO,EAAE,8EAA8E;QACvF,GAAG,EAAE,OAAO;KACb;IACD;QACE,IAAI,EAAE,SAAS;QACf,IAAI,EAAE,UAAU;QAChB,KAAK,EAAE,MAAM;QACb,OAAO,EACL,sJAAsJ;QACxJ,GAAG,EAAE,QAAQ;KACd;CACF,CAAC;AAEF,QAAQ,CAAC,QAAQ,CAAC,GAAG,YAAY,CAAC,CAAC;AAEnC,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AACtC,OAAO,EAAE,CAAC,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { type AgentDef } from "@cotal-ai/core";
|
|
2
|
+
/**
|
|
3
|
+
* The persona catalog: the local `.cotal/agents/*.md` files an operator manages with
|
|
4
|
+
* `cotal personas` and spawns by name. Filesystem-only and side-effect-free — it never
|
|
5
|
+
* touches the mesh — so it is safe to call from a <TAB> completion as well as from `list`.
|
|
6
|
+
* The single source of truth for "what personas exist", shared by both surfaces.
|
|
7
|
+
*/
|
|
8
|
+
export interface PersonaEntry {
|
|
9
|
+
/** The filename stem (`.cotal/agents/<name>.md`), which is also the spawn name. */
|
|
10
|
+
name: string;
|
|
11
|
+
path: string;
|
|
12
|
+
/** Parsed definition, or undefined when the file failed to parse (see `error`). */
|
|
13
|
+
def?: AgentDef;
|
|
14
|
+
/** Parse error message, if the file is malformed — surfaced rather than crashing the list. */
|
|
15
|
+
error?: string;
|
|
16
|
+
}
|
|
17
|
+
/** The directory persona files live in: `<root>/.cotal/agents`. */
|
|
18
|
+
export declare function personasDir(root?: string): string;
|
|
19
|
+
/** List the persona files, each parsed (a malformed file becomes an entry with `error`, not a
|
|
20
|
+
* throw). Returns `[]` when the directory is absent. Filesystem-only — no mesh, no network. */
|
|
21
|
+
export declare function listPersonas(root?: string): PersonaEntry[];
|
|
22
|
+
/** Just the persona names — the completion source for `cotal spawn` and `personas show/rm`. */
|
|
23
|
+
export declare function listPersonaNames(root?: string): string[];
|
|
24
|
+
//# sourceMappingURL=personas.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"personas.d.ts","sourceRoot":"","sources":["../../src/lib/personas.ts"],"names":[],"mappings":"AAEA,OAAO,EAAiB,KAAK,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAG9D;;;;;GAKG;AACH,MAAM,WAAW,YAAY;IAC3B,mFAAmF;IACnF,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,mFAAmF;IACnF,GAAG,CAAC,EAAE,QAAQ,CAAC;IACf,8FAA8F;IAC9F,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,mEAAmE;AACnE,wBAAgB,WAAW,CAAC,IAAI,SAAc,GAAG,MAAM,CAEtD;AAED;gGACgG;AAChG,wBAAgB,YAAY,CAAC,IAAI,SAAc,GAAG,YAAY,EAAE,CAiB/D;AAED,+FAA+F;AAC/F,wBAAgB,gBAAgB,CAAC,IAAI,SAAc,GAAG,MAAM,EAAE,CAE7D"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { readdirSync } from "node:fs";
|
|
2
|
+
import { join } from "node:path";
|
|
3
|
+
import { loadAgentFile } from "@cotal-ai/core";
|
|
4
|
+
import { cotalRoot } from "./paths.js";
|
|
5
|
+
/** The directory persona files live in: `<root>/.cotal/agents`. */
|
|
6
|
+
export function personasDir(root = cotalRoot()) {
|
|
7
|
+
return join(root, ".cotal", "agents");
|
|
8
|
+
}
|
|
9
|
+
/** List the persona files, each parsed (a malformed file becomes an entry with `error`, not a
|
|
10
|
+
* throw). Returns `[]` when the directory is absent. Filesystem-only — no mesh, no network. */
|
|
11
|
+
export function listPersonas(root = cotalRoot()) {
|
|
12
|
+
const dir = personasDir(root);
|
|
13
|
+
let files;
|
|
14
|
+
try {
|
|
15
|
+
files = readdirSync(dir).filter((f) => f.endsWith(".md"));
|
|
16
|
+
}
|
|
17
|
+
catch {
|
|
18
|
+
return []; // no .cotal/agents yet — an empty catalog, not an error
|
|
19
|
+
}
|
|
20
|
+
return files.sort().map((f) => {
|
|
21
|
+
const name = f.slice(0, -3);
|
|
22
|
+
const path = join(dir, f);
|
|
23
|
+
try {
|
|
24
|
+
return { name, path, def: loadAgentFile(path) };
|
|
25
|
+
}
|
|
26
|
+
catch (e) {
|
|
27
|
+
return { name, path, error: e.message };
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
/** Just the persona names — the completion source for `cotal spawn` and `personas show/rm`. */
|
|
32
|
+
export function listPersonaNames(root = cotalRoot()) {
|
|
33
|
+
return listPersonas(root).map((p) => p.name);
|
|
34
|
+
}
|
|
35
|
+
//# sourceMappingURL=personas.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"personas.js","sourceRoot":"","sources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rD,CAAC;IACH,CAAC,CAAC,CAAC;AACL,CAAC;AAED,+FAA+F;AAC/F,MAAM,UAAU,gBAAgB,CAAC,IAAI,GAAG,SAAS,EAAE;IACjD,OAAO,YAAY,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;AAC/C,CAAC"}
|
package/dist/web/app.js
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
|
|
10
10
|
const $ = (id) => document.getElementById(id);
|
|
11
11
|
const STATUS = ["working", "waiting", "idle", "offline"];
|
|
12
|
-
// Status as shape *and* colour (never colour alone)
|
|
12
|
+
// Status as shape *and* colour (never colour alone).
|
|
13
13
|
const GLYPH = { working: "●", waiting: "◐", idle: "○", offline: "⊘" };
|
|
14
14
|
const MODES = ["chat", "unicast", "anycast"];
|
|
15
15
|
const isDemo = new URLSearchParams(location.search).has("demo");
|
package/package.json
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cotal-ai/cli",
|
|
3
|
-
"
|
|
3
|
+
"description": "Cotal mesh CLI: up, join, watch, console, web, spawn, mint, channels, history.",
|
|
4
|
+
"version": "0.4.0",
|
|
4
5
|
"license": "Apache-2.0",
|
|
5
6
|
"repository": {
|
|
6
7
|
"type": "git",
|
|
@@ -20,7 +21,7 @@
|
|
|
20
21
|
"@clack/prompts": "^1.0.0",
|
|
21
22
|
"ink": "^6.0.0",
|
|
22
23
|
"react": "^19.0.0",
|
|
23
|
-
"@cotal-ai/core": "0.
|
|
24
|
+
"@cotal-ai/core": "0.4.0"
|
|
24
25
|
},
|
|
25
26
|
"optionalDependencies": {
|
|
26
27
|
"@eplightning/nats-server-darwin-arm64": "^2.14.0",
|