@pasko70/pibo 1.0.3 → 1.0.5
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/apps/chat/agent-profiles.js +4 -0
- package/dist/apps/chat/agent-store.js +46 -3
- package/dist/apps/chat/web-app.js +42 -1
- package/dist/apps/chat-ui/assets/{dist-BvO6SpaM.js → dist-BGxHKHPX.js} +1 -1
- package/dist/apps/chat-ui/assets/{dist-_oM7g0eh.js → dist-CI0Xj2Cp.js} +1 -1
- package/dist/apps/chat-ui/assets/{dist-L1B-KWZO.js → dist-CNlhGq5i.js} +1 -1
- package/dist/apps/chat-ui/assets/{dist-nFui3f-r.js → dist-CaNOvqMY.js} +1 -1
- package/dist/apps/chat-ui/assets/{dist-D4HhiFWB.js → dist-Di1ScJ22.js} +1 -1
- package/dist/apps/chat-ui/assets/{dist-BPv5MdlL.js → dist-DpmEro5R.js} +1 -1
- package/dist/apps/chat-ui/assets/{dist-B5rcjVCj.js → dist-DrM-H3e1.js} +1 -1
- package/dist/apps/chat-ui/assets/{dist-DHE-yBLH.js → dist-aMr2VYOu.js} +1 -1
- package/dist/apps/chat-ui/assets/{dist-_DPv0-QF.js → dist-u2OzzOTm.js} +1 -1
- package/dist/apps/chat-ui/assets/{dist-laadbMWg.js → dist-wiRpAHIv.js} +1 -1
- package/dist/apps/chat-ui/assets/{dist-CG_gRSwv.js → dist-zgYUl2B-.js} +1 -1
- package/dist/apps/chat-ui/assets/index-B_E935fP.js +151 -0
- package/dist/apps/chat-ui/index.html +1 -1
- package/dist/core/model-defaults.js +53 -0
- package/dist/core/profiles.js +16 -0
- package/dist/core/runtime.js +8 -6
- package/dist/core/session-router.js +2 -0
- package/dist/plugins/registry.js +3 -0
- package/package.json +1 -1
- package/dist/apps/chat-ui/assets/index-BdcqTugD.js +0 -151
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
<meta charset="UTF-8" />
|
|
5
5
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
6
6
|
<title>Pibo Web Chat</title>
|
|
7
|
-
<script type="module" crossorigin src="/apps/chat/assets/index-
|
|
7
|
+
<script type="module" crossorigin src="/apps/chat/assets/index-B_E935fP.js"></script>
|
|
8
8
|
<link rel="modulepreload" crossorigin href="/apps/chat/assets/rolldown-runtime-S-ySWqyJ.js">
|
|
9
9
|
<link rel="modulepreload" crossorigin href="/apps/chat/assets/dist-SVPsM5Oi.js">
|
|
10
10
|
<link rel="stylesheet" crossorigin href="/apps/chat/assets/index-Dk-opWl3.css">
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { existsSync, mkdirSync, readFileSync, writeFileSync } from "node:fs";
|
|
2
|
+
import { dirname, resolve } from "node:path";
|
|
3
|
+
export const DEFAULT_PIBO_MODEL_DEFAULTS_PATH = ".pibo/model-defaults.json";
|
|
4
|
+
export function selectRequestedModelProfile(profile, defaults = {}) {
|
|
5
|
+
if (profile.model)
|
|
6
|
+
return cloneModelProfile(profile.model);
|
|
7
|
+
if (profile.parentSessionId)
|
|
8
|
+
return cloneModelProfile(profile.subagentModel ?? defaults.subagent);
|
|
9
|
+
return cloneModelProfile(profile.mainModel ?? defaults.main);
|
|
10
|
+
}
|
|
11
|
+
export function loadPiboModelDefaults(cwd = process.cwd(), path = DEFAULT_PIBO_MODEL_DEFAULTS_PATH) {
|
|
12
|
+
const resolvedPath = resolve(cwd, path);
|
|
13
|
+
if (!existsSync(resolvedPath))
|
|
14
|
+
return {};
|
|
15
|
+
try {
|
|
16
|
+
const parsed = JSON.parse(readFileSync(resolvedPath, "utf-8"));
|
|
17
|
+
return sanitizePiboModelDefaults(parsed);
|
|
18
|
+
}
|
|
19
|
+
catch {
|
|
20
|
+
return {};
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
export function savePiboModelDefaults(defaults, cwd = process.cwd(), path = DEFAULT_PIBO_MODEL_DEFAULTS_PATH) {
|
|
24
|
+
const sanitized = sanitizePiboModelDefaults(defaults);
|
|
25
|
+
const resolvedPath = resolve(cwd, path);
|
|
26
|
+
mkdirSync(dirname(resolvedPath), { recursive: true });
|
|
27
|
+
writeFileSync(resolvedPath, `${JSON.stringify(sanitized, null, 2)}\n`);
|
|
28
|
+
return sanitized;
|
|
29
|
+
}
|
|
30
|
+
export function sanitizePiboModelDefaults(value) {
|
|
31
|
+
const raw = value && typeof value === "object" && !Array.isArray(value)
|
|
32
|
+
? value
|
|
33
|
+
: {};
|
|
34
|
+
return {
|
|
35
|
+
main: sanitizeModelProfile(raw.main),
|
|
36
|
+
subagent: sanitizeModelProfile(raw.subagent),
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
export function sanitizeModelProfile(value) {
|
|
40
|
+
if (!value || typeof value !== "object" || Array.isArray(value))
|
|
41
|
+
return undefined;
|
|
42
|
+
const raw = value;
|
|
43
|
+
if (typeof raw.provider !== "string" || typeof raw.id !== "string")
|
|
44
|
+
return undefined;
|
|
45
|
+
const provider = raw.provider.trim();
|
|
46
|
+
const id = raw.id.trim();
|
|
47
|
+
if (!provider || !id)
|
|
48
|
+
return undefined;
|
|
49
|
+
return { provider, id };
|
|
50
|
+
}
|
|
51
|
+
function cloneModelProfile(model) {
|
|
52
|
+
return model ? { ...model } : undefined;
|
|
53
|
+
}
|
package/dist/core/profiles.js
CHANGED
|
@@ -4,6 +4,8 @@ export class InitialSessionContext {
|
|
|
4
4
|
sessionId;
|
|
5
5
|
parentSessionId;
|
|
6
6
|
model;
|
|
7
|
+
mainModel;
|
|
8
|
+
subagentModel;
|
|
7
9
|
skills;
|
|
8
10
|
tools;
|
|
9
11
|
subagents;
|
|
@@ -19,6 +21,8 @@ export class InitialSessionContext {
|
|
|
19
21
|
this.sessionId = options.sessionId;
|
|
20
22
|
this.parentSessionId = options.parentSessionId;
|
|
21
23
|
this.model = options.model ? { ...options.model } : undefined;
|
|
24
|
+
this.mainModel = options.mainModel ? { ...options.mainModel } : undefined;
|
|
25
|
+
this.subagentModel = options.subagentModel ? { ...options.subagentModel } : undefined;
|
|
22
26
|
this.skills = [...(options.skills ?? [])];
|
|
23
27
|
this.tools = [...(options.tools ?? [])];
|
|
24
28
|
this.subagents = [...(options.subagents ?? [])];
|
|
@@ -36,6 +40,8 @@ export class InitialSessionContextBuilder {
|
|
|
36
40
|
sessionId;
|
|
37
41
|
parentSessionId;
|
|
38
42
|
model;
|
|
43
|
+
mainModel;
|
|
44
|
+
subagentModel;
|
|
39
45
|
skills = [];
|
|
40
46
|
tools = [];
|
|
41
47
|
subagents = [];
|
|
@@ -61,6 +67,14 @@ export class InitialSessionContextBuilder {
|
|
|
61
67
|
this.model = { ...model };
|
|
62
68
|
return this;
|
|
63
69
|
}
|
|
70
|
+
withMainModel(model) {
|
|
71
|
+
this.mainModel = { ...model };
|
|
72
|
+
return this;
|
|
73
|
+
}
|
|
74
|
+
withSubagentModel(model) {
|
|
75
|
+
this.subagentModel = { ...model };
|
|
76
|
+
return this;
|
|
77
|
+
}
|
|
64
78
|
withBuiltinTools(mode) {
|
|
65
79
|
this.builtinTools = mode;
|
|
66
80
|
return this;
|
|
@@ -131,6 +145,8 @@ export class InitialSessionContextBuilder {
|
|
|
131
145
|
sessionId: this.sessionId,
|
|
132
146
|
parentSessionId: this.parentSessionId,
|
|
133
147
|
model: this.model,
|
|
148
|
+
mainModel: this.mainModel,
|
|
149
|
+
subagentModel: this.subagentModel,
|
|
134
150
|
skills: this.skills,
|
|
135
151
|
tools: this.tools,
|
|
136
152
|
subagents: this.subagents,
|
package/dist/core/runtime.js
CHANGED
|
@@ -2,6 +2,7 @@ import { readFile } from "node:fs/promises";
|
|
|
2
2
|
import { isAbsolute, resolve } from "node:path";
|
|
3
3
|
import { AuthStorage, createAgentSessionFromServices, createAgentSessionRuntime, createAgentSessionServices, createBashToolDefinition, getAgentDir, InteractiveMode, SessionManager, } from "@mariozechner/pi-coding-agent";
|
|
4
4
|
import { DEFAULT_BUILTIN_TOOL_NAMES, } from "./profiles.js";
|
|
5
|
+
import { loadPiboModelDefaults, selectRequestedModelProfile } from "./model-defaults.js";
|
|
5
6
|
import { createDefaultPiboProfile } from "../plugins/builtin.js";
|
|
6
7
|
import { createSubagentToolDefinitions, createSubagentToolName, } from "../subagents/tool.js";
|
|
7
8
|
import { createRunToolDefinitions } from "../runs/tools.js";
|
|
@@ -201,7 +202,7 @@ export async function createPiboRuntime(options = {}) {
|
|
|
201
202
|
services,
|
|
202
203
|
sessionManager: runtimeSessionManager,
|
|
203
204
|
sessionStartEvent,
|
|
204
|
-
model: resolveProfileModel(profile, services),
|
|
205
|
+
model: resolveProfileModel(profile, services, runtimeCwd),
|
|
205
206
|
thinkingLevel: options.thinkingLevel,
|
|
206
207
|
customTools,
|
|
207
208
|
noTools: profile.builtinTools === "disabled" ? "builtin" : undefined,
|
|
@@ -229,15 +230,16 @@ export async function createPiboRuntime(options = {}) {
|
|
|
229
230
|
sessionManager,
|
|
230
231
|
});
|
|
231
232
|
}
|
|
232
|
-
function resolveProfileModel(profile, services) {
|
|
233
|
-
|
|
233
|
+
function resolveProfileModel(profile, services, cwd) {
|
|
234
|
+
const requestedModel = selectRequestedModelProfile(profile, loadPiboModelDefaults(cwd));
|
|
235
|
+
if (!requestedModel)
|
|
234
236
|
return undefined;
|
|
235
|
-
const model = services.modelRegistry.find(
|
|
237
|
+
const model = services.modelRegistry.find(requestedModel.provider, requestedModel.id);
|
|
236
238
|
if (!model) {
|
|
237
|
-
throw new Error(`Profile "${profile.profileName}" requests unknown model ${
|
|
239
|
+
throw new Error(`Profile "${profile.profileName}" requests unknown model ${requestedModel.provider}/${requestedModel.id}.`);
|
|
238
240
|
}
|
|
239
241
|
if (!services.modelRegistry.hasConfiguredAuth(model)) {
|
|
240
|
-
throw new Error(`Profile "${profile.profileName}" requires configured auth for ${
|
|
242
|
+
throw new Error(`Profile "${profile.profileName}" requires configured auth for ${requestedModel.provider}/${requestedModel.id}.`);
|
|
241
243
|
}
|
|
242
244
|
return model;
|
|
243
245
|
}
|
|
@@ -15,6 +15,8 @@ function profileForSession(baseProfile, piSessionId, parentPiSessionId) {
|
|
|
15
15
|
sessionId: piSessionId,
|
|
16
16
|
parentSessionId: parentPiSessionId,
|
|
17
17
|
model: baseProfile.model,
|
|
18
|
+
mainModel: baseProfile.mainModel,
|
|
19
|
+
subagentModel: baseProfile.subagentModel,
|
|
18
20
|
skills: baseProfile.skills,
|
|
19
21
|
tools: baseProfile.tools,
|
|
20
22
|
subagents: baseProfile.subagents,
|
package/dist/plugins/registry.js
CHANGED
|
@@ -155,6 +155,9 @@ export class PiboPluginRegistry {
|
|
|
155
155
|
subagents: sessionContext.subagents.filter((subagent) => subagent.enabled !== false),
|
|
156
156
|
mcpServers: [...sessionContext.mcpServers],
|
|
157
157
|
piPackages: sessionContext.piPackages.filter((pkg) => pkg.enabled !== false).map((pkg) => pkg.id),
|
|
158
|
+
model: sessionContext.model ? { ...sessionContext.model } : undefined,
|
|
159
|
+
mainModel: sessionContext.mainModel ? { ...sessionContext.mainModel } : undefined,
|
|
160
|
+
subagentModel: sessionContext.subagentModel ? { ...sessionContext.subagentModel } : undefined,
|
|
158
161
|
builtinTools: sessionContext.builtinTools,
|
|
159
162
|
builtinToolNames: [...sessionContext.builtinToolNames],
|
|
160
163
|
autoContextFiles: sessionContext.autoContextFiles,
|