pantheon-cli 0.2.114 → 0.2.117
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/pantheon.mjs +41 -3
- package/package.json +1 -1
package/dist/pantheon.mjs
CHANGED
|
@@ -46406,12 +46406,50 @@ function promptText(body) {
|
|
|
46406
46406
|
]
|
|
46407
46407
|
};
|
|
46408
46408
|
}
|
|
46409
|
+
var toolOutputSchema = external_exports.object({}).catchall(external_exports.unknown()).describe(
|
|
46410
|
+
"Structured Pantheon result. Fields match the JSON object rendered in the text content for backward compatibility."
|
|
46411
|
+
);
|
|
46412
|
+
function structuredToolResult(result) {
|
|
46413
|
+
if (!result || typeof result !== "object") return result;
|
|
46414
|
+
const response = result;
|
|
46415
|
+
if (response.isError || response.structuredContent) return result;
|
|
46416
|
+
const textBlock = response.content?.find(
|
|
46417
|
+
(item) => item.type === "text" && typeof item.text === "string"
|
|
46418
|
+
);
|
|
46419
|
+
if (!textBlock?.text) {
|
|
46420
|
+
return {
|
|
46421
|
+
...response,
|
|
46422
|
+
structuredContent: { content: response.content ?? [] }
|
|
46423
|
+
};
|
|
46424
|
+
}
|
|
46425
|
+
try {
|
|
46426
|
+
const parsed = JSON.parse(textBlock.text);
|
|
46427
|
+
return {
|
|
46428
|
+
...response,
|
|
46429
|
+
structuredContent: parsed && typeof parsed === "object" && !Array.isArray(parsed) ? parsed : { value: parsed }
|
|
46430
|
+
};
|
|
46431
|
+
} catch {
|
|
46432
|
+
return {
|
|
46433
|
+
...response,
|
|
46434
|
+
structuredContent: { text: textBlock.text }
|
|
46435
|
+
};
|
|
46436
|
+
}
|
|
46437
|
+
}
|
|
46409
46438
|
function registerTool(server, name, description, schema, handler) {
|
|
46410
|
-
const
|
|
46411
|
-
run(
|
|
46439
|
+
const register = server.registerTool.bind(server);
|
|
46440
|
+
const run = (registeredName) => register(
|
|
46441
|
+
registeredName,
|
|
46442
|
+
{
|
|
46443
|
+
description,
|
|
46444
|
+
inputSchema: schema,
|
|
46445
|
+
outputSchema: toolOutputSchema
|
|
46446
|
+
},
|
|
46447
|
+
async (...args) => structuredToolResult(await handler(...args))
|
|
46448
|
+
);
|
|
46449
|
+
run(name);
|
|
46412
46450
|
const alias = name === "pantheon_search" ? "search_space" : name.startsWith("pantheon_") ? name.slice("pantheon_".length) : "";
|
|
46413
46451
|
if (alias && alias !== name) {
|
|
46414
|
-
run(alias
|
|
46452
|
+
run(alias);
|
|
46415
46453
|
}
|
|
46416
46454
|
}
|
|
46417
46455
|
function inferResumeSpace(spaces) {
|
package/package.json
CHANGED