pikiloom 0.4.32 → 0.4.33
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/agent/drivers/codex.js +2 -0
- package/dist/agent/stream.js +12 -2
- package/dist/agent/utils.js +2 -0
- package/dist/bot/bot.js +4 -1
- package/dist/bot/render-shared.js +3 -2
- package/dist/channels/feishu/render.js +2 -0
- package/dist/channels/telegram/render.js +2 -0
- package/dist/model/injector.js +0 -2
- package/dist/model/responses-bridge.js +29 -4
- package/package.json +1 -1
|
@@ -746,6 +746,7 @@ function createCodexStreamState(opts) {
|
|
|
746
746
|
? opts.byokContextWindow
|
|
747
747
|
: null;
|
|
748
748
|
const byokProvider = opts.byokProviderName || null;
|
|
749
|
+
const byokProfile = opts.byokProfileName || null;
|
|
749
750
|
return {
|
|
750
751
|
sessionId: opts.sessionId,
|
|
751
752
|
text: '', thinking: '', activity: '', msgs: [], thinkParts: [],
|
|
@@ -755,6 +756,7 @@ function createCodexStreamState(opts) {
|
|
|
755
756
|
contextWindow: byokWindow, contextUsedTokens: null,
|
|
756
757
|
byokContextWindow: byokWindow,
|
|
757
758
|
byokProviderName: byokProvider,
|
|
759
|
+
byokProfileName: byokProfile,
|
|
758
760
|
codexCumulative: null,
|
|
759
761
|
turnId: null, turnStatus: null, turnError: null,
|
|
760
762
|
messagePhases: new Map(),
|
package/dist/agent/stream.js
CHANGED
|
@@ -167,6 +167,7 @@ export async function run(cmd, opts, parseLine, parseStderrLine) {
|
|
|
167
167
|
contextWindow: byokWindow,
|
|
168
168
|
byokContextWindow: byokWindow,
|
|
169
169
|
byokProviderName: byokProvider,
|
|
170
|
+
byokProfileName: (opts.byokProfileName || null),
|
|
170
171
|
contextUsedTokens: null,
|
|
171
172
|
codexCumulative: null,
|
|
172
173
|
stopReason: null, activity: '',
|
|
@@ -473,8 +474,13 @@ export async function doStream(opts) {
|
|
|
473
474
|
agentLog(`[byok] ${injection.detail}`);
|
|
474
475
|
}
|
|
475
476
|
const activeProfile = getActiveProfile(prepared.agent);
|
|
476
|
-
if (activeProfile
|
|
477
|
-
|
|
477
|
+
if (activeProfile) {
|
|
478
|
+
if (activeProfile.effort)
|
|
479
|
+
prepared.thinkingEffort = activeProfile.effort;
|
|
480
|
+
const profileLabel = activeProfile.name?.trim();
|
|
481
|
+
if (profileLabel && profileLabel !== activeProfile.modelId) {
|
|
482
|
+
prepared.byokProfileName = profileLabel;
|
|
483
|
+
}
|
|
478
484
|
}
|
|
479
485
|
}
|
|
480
486
|
catch (e) {
|
|
@@ -500,6 +506,8 @@ export async function doStream(opts) {
|
|
|
500
506
|
await awaitAgentUpdateIdle(prepared.agent, AGENT_UPDATE_TIMEOUTS.spawnWait);
|
|
501
507
|
const result = await driver.doStream(prepared);
|
|
502
508
|
const finalized = finalizeStreamResult(result, opts.workdir, opts.prompt, session, opts.claudeWorkflowEnabled);
|
|
509
|
+
finalized.byokProviderName = prepared.byokProviderName ?? null;
|
|
510
|
+
finalized.byokProfileName = prepared.byokProfileName ?? null;
|
|
503
511
|
if (opts.forkOf && finalized.sessionId) {
|
|
504
512
|
try {
|
|
505
513
|
recordFork(opts.workdir, {
|
|
@@ -537,6 +545,8 @@ export async function doStream(opts) {
|
|
|
537
545
|
incomplete: true,
|
|
538
546
|
activity: null,
|
|
539
547
|
plan: null,
|
|
548
|
+
byokProviderName: prepared.byokProviderName ?? null,
|
|
549
|
+
byokProfileName: prepared.byokProfileName ?? null,
|
|
540
550
|
};
|
|
541
551
|
const failureDisplayPrompt = collapseSkillPrompt(opts.prompt) ?? opts.prompt;
|
|
542
552
|
session.record.lastQuestion = shortValue(failureDisplayPrompt, 500);
|
package/dist/agent/utils.js
CHANGED
|
@@ -223,6 +223,8 @@ export function buildStreamPreviewMeta(s) {
|
|
|
223
223
|
meta.turnOutputTokens = turnOutput;
|
|
224
224
|
if (s.byokProviderName)
|
|
225
225
|
meta.providerName = s.byokProviderName;
|
|
226
|
+
if (s.byokProfileName)
|
|
227
|
+
meta.profileName = s.byokProfileName;
|
|
226
228
|
if (s.subAgents && s.subAgents.size > 0)
|
|
227
229
|
meta.subAgents = Array.from(s.subAgents.values());
|
|
228
230
|
if (s.generatingImages && s.generatingImages > 0)
|
package/dist/bot/bot.js
CHANGED
|
@@ -4,7 +4,7 @@ import { execSync, spawn } from 'node:child_process';
|
|
|
4
4
|
import { getActiveUserConfig, loadWorkspaces, onUserConfigChange, resolveUserWorkdir, setUserWorkdir, updateUserConfig } from '../core/config/user-config.js';
|
|
5
5
|
import { doStream, ensureManagedSession, findManagedThreadSession, getSessionStoredConfig, getUsage, initializeProjectSkills, listAgents, resolveAgentModels, resolveDefaultAgent, listSkills, stageSessionFiles, reconcileOrphanedRunningSessions, getAgentBoundModelId, setAgentBoundModelId, collapseSkillPrompt, readGoal, accountTurn, shouldContinueAfterTurn, renderContinuationPrompt, renderBudgetLimitPrompt, bumpContinuationCount, pauseGoal, resumeGoal, setGoal as setGoalState, clearGoal as clearGoalState, setCodexGoal, getCodexGoal, clearCodexGoal, pauseCodexGoal, resumeCodexGoal, getClaudeNativeGoal, buildClaudeSetGoalPrompt, buildClaudeClearGoalPrompt, deliverArtifact, attachmentUrl, isPendingSessionId, } from '../agent/index.js';
|
|
6
6
|
import { compactForHandover, describeHandoverRef } from '../agent/handover.js';
|
|
7
|
-
import { getActiveProfileId, setActiveProfile } from '../model/index.js';
|
|
7
|
+
import { getActiveProfileId, getActiveProfile, setActiveProfile } from '../model/index.js';
|
|
8
8
|
import { querySessions, querySessionTail, updateSession, } from './session-hub.js';
|
|
9
9
|
import { getDriver, hasDriver, allDriverIds, getDriverCapabilities } from '../agent/driver.js';
|
|
10
10
|
import { resolveGuiIntegrationConfig } from '../agent/mcp/bridge.js';
|
|
@@ -1689,6 +1689,9 @@ export class Bot {
|
|
|
1689
1689
|
this.log(`workflow ${enabled ? 'enabled' : 'disabled'} for ${cs.agent} chat=${chatId}`);
|
|
1690
1690
|
}
|
|
1691
1691
|
modelForAgent(agent) {
|
|
1692
|
+
const profile = getActiveProfile(agent);
|
|
1693
|
+
if (profile?.modelId)
|
|
1694
|
+
return profile.modelId;
|
|
1692
1695
|
if (agent === 'hermes') {
|
|
1693
1696
|
const bound = getAgentBoundModelId('hermes');
|
|
1694
1697
|
if (bound)
|
|
@@ -48,8 +48,9 @@ function compactModelLabel(model) {
|
|
|
48
48
|
}
|
|
49
49
|
export function formatFooterParts(agent, elapsedMs, meta, contextPercent, decorations) {
|
|
50
50
|
const identityParts = [agent];
|
|
51
|
-
|
|
52
|
-
|
|
51
|
+
const modelLabel = decorations?.profileName ?? meta?.profileName ?? decorations?.model ?? null;
|
|
52
|
+
if (modelLabel)
|
|
53
|
+
identityParts.push(compactModelLabel(modelLabel));
|
|
53
54
|
const runtimeParts = [];
|
|
54
55
|
if (decorations?.effort)
|
|
55
56
|
runtimeParts.push(decorations.effort);
|
|
@@ -232,6 +232,8 @@ export function buildFinalReplyRender(agent, result) {
|
|
|
232
232
|
const footerText = `\n\n${formatFinalFooter(data.footerStatus, agent, data.elapsedMs, result.contextPercent ?? null, {
|
|
233
233
|
model: result.model,
|
|
234
234
|
effort: result.thinkingEffort,
|
|
235
|
+
provider: result.byokProviderName,
|
|
236
|
+
profileName: result.byokProfileName,
|
|
235
237
|
})}`;
|
|
236
238
|
let activityText = '';
|
|
237
239
|
let activityNoteText = '';
|
|
@@ -372,6 +372,8 @@ export function buildFinalReplyRender(agent, result) {
|
|
|
372
372
|
const footerHtml = `\n\n${formatFinalFooterHtml(data.footerStatus, agent, data.elapsedMs, result.contextPercent ?? null, {
|
|
373
373
|
model: result.model,
|
|
374
374
|
effort: result.thinkingEffort,
|
|
375
|
+
provider: result.byokProviderName,
|
|
376
|
+
profileName: result.byokProfileName,
|
|
375
377
|
})}`;
|
|
376
378
|
let activityHtml = '';
|
|
377
379
|
let activityNoteHtml = '';
|
package/dist/model/injector.js
CHANGED
|
@@ -174,8 +174,6 @@ function isResponsesNativeProvider(provider) {
|
|
|
174
174
|
const host = providerHost(provider);
|
|
175
175
|
if (host.includes('openrouter'))
|
|
176
176
|
return true;
|
|
177
|
-
if (host.includes('volces') || host.includes('volcengine') || host.includes('doubao'))
|
|
178
|
-
return true;
|
|
179
177
|
return false;
|
|
180
178
|
}
|
|
181
179
|
function codexLocalProvider(provider) {
|
|
@@ -274,7 +274,7 @@ function asText(content) {
|
|
|
274
274
|
}
|
|
275
275
|
return '';
|
|
276
276
|
}
|
|
277
|
-
function toChatRequest(body) {
|
|
277
|
+
export function toChatRequest(body) {
|
|
278
278
|
const messages = [];
|
|
279
279
|
if (typeof body.instructions === 'string' && body.instructions.trim()) {
|
|
280
280
|
messages.push({ role: 'system', content: body.instructions });
|
|
@@ -315,9 +315,7 @@ function toChatRequest(body) {
|
|
|
315
315
|
else if (type === 'reasoning') {
|
|
316
316
|
}
|
|
317
317
|
}
|
|
318
|
-
const tools = Array.isArray(body.tools)
|
|
319
|
-
? body.tools.map(toChatTool).filter((t) => t)
|
|
320
|
-
: undefined;
|
|
318
|
+
const tools = Array.isArray(body.tools) ? flattenResponsesTools(body.tools) : undefined;
|
|
321
319
|
const req = { model: body.model, messages, stream: true, stream_options: { include_usage: true } };
|
|
322
320
|
if (tools && tools.length)
|
|
323
321
|
req.tools = tools;
|
|
@@ -333,6 +331,33 @@ function toChatRequest(body) {
|
|
|
333
331
|
req.parallel_tool_calls = body.parallel_tool_calls;
|
|
334
332
|
return req;
|
|
335
333
|
}
|
|
334
|
+
function flattenResponsesTools(rawTools) {
|
|
335
|
+
const out = [];
|
|
336
|
+
const seen = new Set();
|
|
337
|
+
const push = (t) => {
|
|
338
|
+
const chat = toChatTool(t);
|
|
339
|
+
if (!chat)
|
|
340
|
+
return;
|
|
341
|
+
const name = chat.function?.name;
|
|
342
|
+
if (typeof name === 'string') {
|
|
343
|
+
if (seen.has(name))
|
|
344
|
+
return;
|
|
345
|
+
seen.add(name);
|
|
346
|
+
}
|
|
347
|
+
out.push(chat);
|
|
348
|
+
};
|
|
349
|
+
for (const t of rawTools) {
|
|
350
|
+
if (!t || typeof t !== 'object')
|
|
351
|
+
continue;
|
|
352
|
+
if (t.type === 'namespace' && Array.isArray(t.tools)) {
|
|
353
|
+
for (const nested of t.tools)
|
|
354
|
+
push(nested);
|
|
355
|
+
continue;
|
|
356
|
+
}
|
|
357
|
+
push(t);
|
|
358
|
+
}
|
|
359
|
+
return out.length ? out : undefined;
|
|
360
|
+
}
|
|
336
361
|
function toChatTool(t) {
|
|
337
362
|
if (!t)
|
|
338
363
|
return null;
|
package/package.json
CHANGED