@ignitionai/cogitator 0.5.0 → 0.5.1
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 +16 -1
- package/dist/src/cli.js +2 -3
- package/dist/src/durable/manager.js +2 -2
- package/dist/src/host-pi.js +61 -0
- package/dist/src/provider-login.js +2 -2
- package/dist/src/registry.js +4 -4
- package/package.json +6 -2
- package/web/dist/assets/BrandLogo3D-BvZPXohP.js +4035 -0
- package/web/dist/assets/index-7Dyl-4v7.css +1 -0
- package/web/dist/assets/index-CdqzcBU-.js +83 -0
- package/web/dist/index.html +2 -2
- package/web/dist/assets/index-C3tRuOTh.js +0 -83
- package/web/dist/assets/index-DMQqB0r1.css +0 -1
package/README.md
CHANGED
|
@@ -19,11 +19,26 @@ The entire application interface is available in **English and French**. Use the
|
|
|
19
19
|
|
|
20
20
|
User content, agent responses, editable agent presets, code, files, and technical identifiers are preserved as authored. Cogitator’s controls and diagnostic explanations are translated; external diagnostic details remain available in their original form. The documentation is in English.
|
|
21
21
|
|
|
22
|
+
## Prerequisites
|
|
23
|
+
|
|
24
|
+
- **Node.js ≥ 22.19.0**
|
|
25
|
+
- [pi](https://pi.dev), installed with one of the two official methods from pi.dev:
|
|
26
|
+
|
|
27
|
+
```sh
|
|
28
|
+
curl -fsSL https://pi.dev/install.sh | sh
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
or
|
|
32
|
+
|
|
33
|
+
```sh
|
|
34
|
+
npm install -g --ignore-scripts @earendil-works/pi-coding-agent
|
|
35
|
+
```
|
|
36
|
+
|
|
22
37
|
## Install the pi extension
|
|
23
38
|
|
|
24
39
|
Cogitator ships as a [pi package](https://pi.dev/packages). `pi install` **does not start the app**. It only registers an extension: a `/cogitator` slash command, loaded the next time you open pi. The extension itself stays idle until you run that command (it must not spawn a server just because pi started).
|
|
25
40
|
|
|
26
|
-
|
|
41
|
+
Once the [prerequisites](#prerequisites) are in place:
|
|
27
42
|
|
|
28
43
|
```sh
|
|
29
44
|
pi install npm:@ignitionai/cogitator
|
package/dist/src/cli.js
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { EventEmitter } from "node:events";
|
|
3
3
|
import { createServer } from "node:http";
|
|
4
|
-
import {
|
|
5
|
-
import { getPackageDir, RpcClient } from "@earendil-works/pi-coding-agent";
|
|
4
|
+
import { piCliPath, piCodingAgent } from "./host-pi.js";
|
|
6
5
|
import { authenticationRequired, HOST, PORT } from "./config.js";
|
|
7
6
|
import { CronService } from "./cron.js";
|
|
8
7
|
import { setConversationStatus } from "./conversations.js";
|
|
@@ -51,7 +50,7 @@ async function start(explicit) {
|
|
|
51
50
|
seedDefaultAgents(db, paths);
|
|
52
51
|
const catalog = db;
|
|
53
52
|
const pool = new PiPool({
|
|
54
|
-
factory: (opts) => new RpcClient({ cliPath:
|
|
53
|
+
factory: (opts) => new piCodingAgent.RpcClient({ cliPath: piCliPath, cwd: opts.cwd, args: opts.args, env: opts.env }),
|
|
55
54
|
callbacks: { onStatus: (convId, status) => setConversationStatus(catalog, convId, status) },
|
|
56
55
|
});
|
|
57
56
|
const events = new EventEmitter();
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
* le serveur branche sur le SSE de la conversation.
|
|
14
14
|
*/
|
|
15
15
|
import { EventEmitter } from "node:events";
|
|
16
|
-
import {
|
|
16
|
+
import { piAiProviders } from "../host-pi.js";
|
|
17
17
|
import { createRegistry } from "@earendil-works/pi-durable";
|
|
18
18
|
import { homedir } from "node:os";
|
|
19
19
|
import { join } from "node:path";
|
|
@@ -88,7 +88,7 @@ export class DurableRuntimeManager {
|
|
|
88
88
|
cwd: workspaceDir,
|
|
89
89
|
model: { provider: spawn.provider ?? conv.provider, modelId: spawn.model ?? conv.model },
|
|
90
90
|
presetDigest: digest(conv.spawn_args || "{}"),
|
|
91
|
-
models: (this.opts.modelsFactory ?? (() => builtinModels()))(),
|
|
91
|
+
models: (this.opts.modelsFactory ?? (() => piAiProviders.builtinModels()))(),
|
|
92
92
|
registry: (this.opts.registryFactory ?? (() => createRegistry()))(),
|
|
93
93
|
agentExtensions: this.opts.agentExtensions ?? [],
|
|
94
94
|
toolchain: {
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { execFileSync } from "node:child_process";
|
|
2
|
+
import { existsSync, readFileSync, realpathSync } from "node:fs";
|
|
3
|
+
import { dirname, join } from "node:path";
|
|
4
|
+
import { fileURLToPath, pathToFileURL } from "node:url";
|
|
5
|
+
/**
|
|
6
|
+
* Les packages pi viennent de l'installation hôte (le `pi` du PATH), jamais d'une copie
|
|
7
|
+
* figée : une copie décalée fait diverger le catalogue providers, les logins et les
|
|
8
|
+
* payloads de raisonnement de ce que le binaire exécute réellement.
|
|
9
|
+
* Repli sur les copies locales uniquement en dev/tests (pas de `pi` sur le PATH).
|
|
10
|
+
*/
|
|
11
|
+
function manifestName(dir) {
|
|
12
|
+
const file = join(dir, "package.json");
|
|
13
|
+
return existsSync(file) ? JSON.parse(readFileSync(file, "utf8")).name : undefined;
|
|
14
|
+
}
|
|
15
|
+
function findPackageUp(name, from) {
|
|
16
|
+
for (let dir = from;; dir = dirname(dir)) {
|
|
17
|
+
if (manifestName(dir) === name)
|
|
18
|
+
return dir;
|
|
19
|
+
if (dirname(dir) === dir)
|
|
20
|
+
return null;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
/** Dossier du package `name` selon la résolution node depuis `from`. */
|
|
24
|
+
function findPackage(name, from) {
|
|
25
|
+
for (let dir = from;; dir = dirname(dir)) {
|
|
26
|
+
const candidate = join(dir, "node_modules", name);
|
|
27
|
+
if (existsSync(join(candidate, "package.json")))
|
|
28
|
+
return candidate;
|
|
29
|
+
if (dirname(dir) === dir)
|
|
30
|
+
return null;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
function hostBase() {
|
|
34
|
+
try {
|
|
35
|
+
const bins = execFileSync(process.platform === "win32" ? "where" : "which", process.platform === "win32" ? ["pi"] : ["-a", "pi"], { encoding: "utf8", stdio: ["ignore", "pipe", "ignore"] }).trim().split("\n").map((line) => line.trim());
|
|
36
|
+
// Un pi sous node_modules/.bin est le devDependency d'un projet, pas l'installation de l'utilisateur.
|
|
37
|
+
const bin = bins.find((path) => !/node_modules[\\/]\.bin[\\/]/.test(path)) ?? bins[0];
|
|
38
|
+
return bin ? findPackageUp("@earendil-works/pi-coding-agent", dirname(realpathSync(bin))) : null;
|
|
39
|
+
}
|
|
40
|
+
catch {
|
|
41
|
+
return null;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
const bases = [hostBase(), findPackageUp("@ignitionai/cogitator", dirname(fileURLToPath(import.meta.url)))].filter((base) => base !== null);
|
|
45
|
+
function root(pkg) {
|
|
46
|
+
for (const base of bases) {
|
|
47
|
+
const found = findPackage(pkg, base);
|
|
48
|
+
if (found)
|
|
49
|
+
return found;
|
|
50
|
+
}
|
|
51
|
+
throw new Error(`package pi introuvable: ${pkg}`);
|
|
52
|
+
}
|
|
53
|
+
export const codingAgentRoot = root("@earendil-works/pi-coding-agent");
|
|
54
|
+
// Ces packages n'exposent qu'une condition "import" : chargement ESM dynamique.
|
|
55
|
+
const load = (...segments) => import(pathToFileURL(join(...segments)).href);
|
|
56
|
+
export const piAiRoot = root("@earendil-works/pi-ai");
|
|
57
|
+
export const piCodingAgent = await load(codingAgentRoot, "dist/index.js");
|
|
58
|
+
export const piAi = await load(piAiRoot, "dist/index.js");
|
|
59
|
+
export const piAiProviders = await load(piAiRoot, "dist/providers/all.js");
|
|
60
|
+
/** Entrée CLI exécutée en mode rpc (celle de l'hôte quand elle existe). */
|
|
61
|
+
export const piCliPath = join(codingAgentRoot, "dist/cli.js");
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { randomUUID } from "node:crypto";
|
|
2
|
-
import {
|
|
2
|
+
import { piAiProviders } from "./host-pi.js";
|
|
3
3
|
import { atomicWriteJson, readJson } from "./json-files.js";
|
|
4
4
|
function fileCredentialStore(path) {
|
|
5
5
|
let queue = Promise.resolve();
|
|
@@ -60,7 +60,7 @@ export class ProviderLogins {
|
|
|
60
60
|
for (const listener of session.listeners)
|
|
61
61
|
listener(event);
|
|
62
62
|
};
|
|
63
|
-
const models = builtinModels({ credentials: fileCredentialStore(this.paths.piAuthJson) });
|
|
63
|
+
const models = piAiProviders.builtinModels({ credentials: fileCredentialStore(this.paths.piAuthJson) });
|
|
64
64
|
void models.login(providerId, type, {
|
|
65
65
|
signal: abort.signal,
|
|
66
66
|
notify: (event) => emit(event),
|
package/dist/src/registry.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { execFile } from "node:child_process";
|
|
2
2
|
import { existsSync, readdirSync, readFileSync } from "node:fs";
|
|
3
3
|
import { join } from "node:path";
|
|
4
|
-
import { builtinProviders, getBuiltinModels, getBuiltinProviders } from "@earendil-works/pi-ai/providers/all";
|
|
5
4
|
import { readJson, atomicWriteJson } from "./json-files.js";
|
|
5
|
+
import { piAiProviders } from "./host-pi.js";
|
|
6
6
|
import { MCP_NAME, PROVIDER_ID } from "./schemas.js";
|
|
7
7
|
export const API_PROTOCOLS = [
|
|
8
8
|
"openai-completions",
|
|
@@ -49,8 +49,8 @@ export function readCatalog(paths) {
|
|
|
49
49
|
const store = readJson(join(paths.piAgentDir, "models-store.json"), {});
|
|
50
50
|
const customs = readJson(paths.piModelsJson, {}).providers ?? {};
|
|
51
51
|
const out = new Map();
|
|
52
|
-
for (const id of getBuiltinProviders()) {
|
|
53
|
-
out.set(id, getBuiltinModels(id).map((m) => ({ id: m.id, name: m.name, reasoning: m.reasoning })));
|
|
52
|
+
for (const id of piAiProviders.getBuiltinProviders()) {
|
|
53
|
+
out.set(id, piAiProviders.getBuiltinModels(id).map((m) => ({ id: m.id, name: m.name, reasoning: m.reasoning })));
|
|
54
54
|
}
|
|
55
55
|
for (const [id, entry] of Object.entries(store)) {
|
|
56
56
|
if (!entry.models?.length)
|
|
@@ -72,7 +72,7 @@ let authMethodsCache;
|
|
|
72
72
|
export function authMethodsFor(id) {
|
|
73
73
|
if (!authMethodsCache) {
|
|
74
74
|
authMethodsCache = new Map();
|
|
75
|
-
for (const provider of builtinProviders()) {
|
|
75
|
+
for (const provider of piAiProviders.builtinProviders()) {
|
|
76
76
|
const methods = [];
|
|
77
77
|
if (provider.auth.oauth)
|
|
78
78
|
methods.push({ type: "oauth", name: provider.auth.oauth.loginLabel ?? provider.auth.oauth.name });
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ignitionai/cogitator",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.1",
|
|
4
4
|
"description": "A web control panel for pi: composable agents, workspaces, interactive conversations, and scheduled tasks. A pi package.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"keywords": [
|
|
@@ -49,26 +49,30 @@
|
|
|
49
49
|
"image": "https://raw.githubusercontent.com/IgnitionAI/cogitator/dev/web/public/icon.png"
|
|
50
50
|
},
|
|
51
51
|
"peerDependencies": {
|
|
52
|
+
"@earendil-works/pi-ai": "*",
|
|
52
53
|
"@earendil-works/pi-coding-agent": "*"
|
|
53
54
|
},
|
|
54
55
|
"dependencies": {
|
|
55
56
|
"@earendil-works/chord": "1.1.0",
|
|
56
|
-
"@earendil-works/pi-ai": "1.1.0",
|
|
57
57
|
"@earendil-works/pi-durable": "1.1.0",
|
|
58
58
|
"@fontsource/inter": "^5.3.0",
|
|
59
59
|
"@modelcontextprotocol/sdk": "^1.32.1",
|
|
60
|
+
"@react-three/fiber": "^9.8.2",
|
|
60
61
|
"better-auth": "1.7.7",
|
|
61
62
|
"better-sqlite3": "^12.11.1",
|
|
62
63
|
"cron-parser": "^5.10.1",
|
|
64
|
+
"three": "^0.181.2",
|
|
63
65
|
"zod": "^4.6.5"
|
|
64
66
|
},
|
|
65
67
|
"devDependencies": {
|
|
66
68
|
"@better-auth/utils": "0.4.2",
|
|
69
|
+
"@earendil-works/pi-ai": "1.1.0",
|
|
67
70
|
"@earendil-works/pi-coding-agent": "^1.0.4",
|
|
68
71
|
"@types/better-sqlite3": "^9.6.0",
|
|
69
72
|
"@types/node": "^24.0.0",
|
|
70
73
|
"@types/react": "^19.3.0",
|
|
71
74
|
"@types/react-dom": "^19.3.0",
|
|
75
|
+
"@types/three": "^0.186.0",
|
|
72
76
|
"@vitejs/plugin-react": "^6.1.2",
|
|
73
77
|
"react": "^19.3.0",
|
|
74
78
|
"react-dom": "^19.3.0",
|