pi-ptc-subagents 6.0.2 → 6.0.3
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/index.js +11 -4
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -5123,10 +5123,11 @@ const ROUTE_INDEX_LEAD = {
|
|
|
5123
5123
|
codemode_ptc: "编排写 codemode 脚本;批量派活经脚本内的 pi_task_codemode;要查/停任务用任务面三工具。"
|
|
5124
5124
|
};
|
|
5125
5125
|
function renderRouteIndex(surface, detailBase, nudge = true) {
|
|
5126
|
-
const lines = ROUTES.map((route) => `- ${route.name} — ${route.when}。这面怎么走:${route.how[surface]}。细节:${detailBase ?
|
|
5126
|
+
const lines = ROUTES.map((route) => `- ${route.name} — ${route.when}。这面怎么走:${route.how[surface]}。细节:${detailBase ? route.detail.split("/").pop() : route.detail}`);
|
|
5127
5127
|
let index = [
|
|
5128
5128
|
`<ptc>`,
|
|
5129
5129
|
...nudge ? [ROUTE_INDEX_LEAD[surface]] : [],
|
|
5130
|
+
...detailBase ? [`详情目录:${detailBase}`] : [],
|
|
5130
5131
|
"路由表(一条一行,详情按需 read):",
|
|
5131
5132
|
...lines,
|
|
5132
5133
|
`</ptc>`
|
|
@@ -5312,7 +5313,7 @@ function piPtcEntry(pi) {
|
|
|
5312
5313
|
modeEnabled = rest !== "off";
|
|
5313
5314
|
applyMode();
|
|
5314
5315
|
}
|
|
5315
|
-
cmdCtx.ui.notify(`/ptc:dispatchEnabled=${dispatchEnabled},mode=${modeActive ? "on
|
|
5316
|
+
cmdCtx.ui.notify(`/ptc:dispatchEnabled=${dispatchEnabled},mode=${modeActive ? "on(引导层)" : "off"},whyEnabled=${whyEnabledOverride ?? whyEnabledPersisted}(在飞任务不受影响)`, "info");
|
|
5316
5317
|
}
|
|
5317
5318
|
});
|
|
5318
5319
|
pi.on("session_shutdown", () => {
|
|
@@ -5456,18 +5457,24 @@ function registerChildToolsOnly(pi) {
|
|
|
5456
5457
|
}
|
|
5457
5458
|
function normalizeToolValue(value) {
|
|
5458
5459
|
if (typeof value === "string") return value;
|
|
5459
|
-
if (Array.isArray(value)) return value.map((block) =>
|
|
5460
|
+
if (Array.isArray(value)) return value.map((block) => {
|
|
5461
|
+
if (typeof block === "string") return block;
|
|
5462
|
+
const obj = block;
|
|
5463
|
+
if (obj.type === "image") return "[image]";
|
|
5464
|
+
return obj.text ?? JSON.stringify(block);
|
|
5465
|
+
}).join("\n");
|
|
5460
5466
|
if (value && typeof value === "object") {
|
|
5461
5467
|
const obj = value;
|
|
5462
5468
|
if (typeof obj.content === "string") return obj.content;
|
|
5463
5469
|
if (typeof obj.text === "string") return obj.text;
|
|
5470
|
+
if (obj.type === "image") return typeof obj.note === "string" ? obj.note : "[image]";
|
|
5464
5471
|
}
|
|
5465
5472
|
return value;
|
|
5466
5473
|
}
|
|
5467
5474
|
function createBindingTable(pi, session, getToolContext) {
|
|
5468
5475
|
const active = pi.getActiveTools();
|
|
5469
5476
|
const known = new Set(KNOWN_BINDING_NAMES);
|
|
5470
|
-
const names = resolveBindingNames(active.some((name) => known.has(name)) ?
|
|
5477
|
+
const names = resolveBindingNames(!getToolContext() && !active.some((name) => known.has(name)) ? pi.getAllTools().map((tool) => tool.name) : active);
|
|
5471
5478
|
const table = Object.fromEntries(names.map((name) => [name, async (args, callCtx) => {
|
|
5472
5479
|
const ctx = getToolContext();
|
|
5473
5480
|
if (!ctx?.executeTool) throw new Error(`此 pi 版本没有程序内调用工具的通道(需 pi ≥ 0.99,binding: ${name})`);
|