gsd-pi 2.39.0 → 2.40.0-dev.4a93031
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/resource-loader.js +66 -2
- package/dist/resources/extensions/async-jobs/index.js +10 -0
- package/dist/resources/extensions/get-secrets-from-user.js +1 -1
- package/dist/resources/extensions/gsd/auto-dashboard.js +7 -0
- package/dist/resources/extensions/gsd/auto-loop.js +761 -673
- package/dist/resources/extensions/gsd/auto-post-unit.js +10 -2
- package/dist/resources/extensions/gsd/auto-prompts.js +3 -3
- package/dist/resources/extensions/gsd/auto-start.js +6 -1
- package/dist/resources/extensions/gsd/auto.js +6 -4
- package/dist/resources/extensions/gsd/bootstrap/agent-end-recovery.js +126 -0
- package/dist/resources/extensions/gsd/bootstrap/db-tools.js +233 -0
- package/dist/resources/extensions/gsd/bootstrap/dynamic-tools.js +59 -0
- package/dist/resources/extensions/gsd/bootstrap/register-extension.js +38 -0
- package/dist/resources/extensions/gsd/bootstrap/register-hooks.js +156 -0
- package/dist/resources/extensions/gsd/bootstrap/register-shortcuts.js +46 -0
- package/dist/resources/extensions/gsd/bootstrap/system-context.js +300 -0
- package/dist/resources/extensions/gsd/bootstrap/write-gate.js +38 -0
- package/dist/resources/extensions/gsd/commands/catalog.js +278 -0
- package/dist/resources/extensions/gsd/commands/context.js +84 -0
- package/dist/resources/extensions/gsd/commands/dispatcher.js +21 -0
- package/dist/resources/extensions/gsd/commands/handlers/auto.js +72 -0
- package/dist/resources/extensions/gsd/commands/handlers/core.js +246 -0
- package/dist/resources/extensions/gsd/commands/handlers/ops.js +166 -0
- package/dist/resources/extensions/gsd/commands/handlers/parallel.js +94 -0
- package/dist/resources/extensions/gsd/commands/handlers/workflow.js +102 -0
- package/dist/resources/extensions/gsd/commands/index.js +11 -0
- package/dist/resources/extensions/gsd/commands-handlers.js +1 -1
- package/dist/resources/extensions/gsd/commands.js +8 -1190
- package/dist/resources/extensions/gsd/dashboard-overlay.js +9 -0
- package/dist/resources/extensions/gsd/doctor-proactive.js +80 -10
- package/dist/resources/extensions/gsd/doctor.js +32 -2
- package/dist/resources/extensions/gsd/export-html.js +46 -0
- package/dist/resources/extensions/gsd/files.js +1 -1
- package/dist/resources/extensions/gsd/health-widget.js +1 -1
- package/dist/resources/extensions/gsd/index.js +4 -1115
- package/dist/resources/extensions/gsd/progress-score.js +20 -1
- package/dist/resources/extensions/gsd/prompts/forensics.md +121 -46
- package/dist/resources/extensions/gsd/visualizer-data.js +26 -1
- package/dist/resources/extensions/gsd/visualizer-views.js +52 -0
- package/dist/welcome-screen.d.ts +3 -2
- package/dist/welcome-screen.js +66 -22
- package/package.json +1 -1
- package/packages/pi-coding-agent/dist/core/agent-session.d.ts +12 -0
- package/packages/pi-coding-agent/dist/core/agent-session.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/core/agent-session.js +107 -24
- package/packages/pi-coding-agent/dist/core/agent-session.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/skill-tool.test.d.ts +2 -0
- package/packages/pi-coding-agent/dist/core/skill-tool.test.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/core/skill-tool.test.js +70 -0
- package/packages/pi-coding-agent/dist/core/skill-tool.test.js.map +1 -0
- package/packages/pi-coding-agent/dist/core/skills.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/core/skills.js +2 -1
- package/packages/pi-coding-agent/dist/core/skills.js.map +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/controllers/chat-controller.d.ts +17 -0
- package/packages/pi-coding-agent/dist/modes/interactive/controllers/chat-controller.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/modes/interactive/controllers/chat-controller.js +244 -0
- package/packages/pi-coding-agent/dist/modes/interactive/controllers/chat-controller.js.map +1 -0
- package/packages/pi-coding-agent/dist/modes/interactive/controllers/extension-ui-controller.d.ts +3 -0
- package/packages/pi-coding-agent/dist/modes/interactive/controllers/extension-ui-controller.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/modes/interactive/controllers/extension-ui-controller.js +58 -0
- package/packages/pi-coding-agent/dist/modes/interactive/controllers/extension-ui-controller.js.map +1 -0
- package/packages/pi-coding-agent/dist/modes/interactive/controllers/input-controller.d.ts +12 -0
- package/packages/pi-coding-agent/dist/modes/interactive/controllers/input-controller.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/modes/interactive/controllers/input-controller.js +54 -0
- package/packages/pi-coding-agent/dist/modes/interactive/controllers/input-controller.js.map +1 -0
- package/packages/pi-coding-agent/dist/modes/interactive/controllers/model-controller.d.ts +6 -0
- package/packages/pi-coding-agent/dist/modes/interactive/controllers/model-controller.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/modes/interactive/controllers/model-controller.js +63 -0
- package/packages/pi-coding-agent/dist/modes/interactive/controllers/model-controller.js.map +1 -0
- package/packages/pi-coding-agent/dist/modes/interactive/interactive-mode-state.d.ts +38 -0
- package/packages/pi-coding-agent/dist/modes/interactive/interactive-mode-state.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/modes/interactive/interactive-mode-state.js +2 -0
- package/packages/pi-coding-agent/dist/modes/interactive/interactive-mode-state.js.map +1 -0
- package/packages/pi-coding-agent/dist/modes/interactive/interactive-mode.d.ts +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/interactive-mode.js +15 -457
- package/packages/pi-coding-agent/dist/modes/interactive/interactive-mode.js.map +1 -1
- package/packages/pi-coding-agent/package.json +1 -1
- package/packages/pi-coding-agent/src/core/agent-session.ts +122 -23
- package/packages/pi-coding-agent/src/core/skill-tool.test.ts +89 -0
- package/packages/pi-coding-agent/src/core/skills.ts +2 -1
- package/packages/pi-coding-agent/src/modes/interactive/controllers/chat-controller.ts +302 -0
- package/packages/pi-coding-agent/src/modes/interactive/controllers/extension-ui-controller.ts +59 -0
- package/packages/pi-coding-agent/src/modes/interactive/controllers/input-controller.ts +68 -0
- package/packages/pi-coding-agent/src/modes/interactive/controllers/model-controller.ts +71 -0
- package/packages/pi-coding-agent/src/modes/interactive/interactive-mode-state.ts +37 -0
- package/packages/pi-coding-agent/src/modes/interactive/interactive-mode.ts +18 -510
- package/pkg/package.json +1 -1
- package/src/resources/extensions/async-jobs/index.ts +11 -0
- package/src/resources/extensions/get-secrets-from-user.ts +1 -1
- package/src/resources/extensions/gsd/auto-dashboard.ts +10 -0
- package/src/resources/extensions/gsd/auto-loop.ts +1075 -921
- package/src/resources/extensions/gsd/auto-post-unit.ts +10 -2
- package/src/resources/extensions/gsd/auto-prompts.ts +3 -3
- package/src/resources/extensions/gsd/auto-start.ts +6 -1
- package/src/resources/extensions/gsd/auto.ts +13 -10
- package/src/resources/extensions/gsd/bootstrap/agent-end-recovery.ts +142 -0
- package/src/resources/extensions/gsd/bootstrap/db-tools.ts +238 -0
- package/src/resources/extensions/gsd/bootstrap/dynamic-tools.ts +90 -0
- package/src/resources/extensions/gsd/bootstrap/register-extension.ts +46 -0
- package/src/resources/extensions/gsd/bootstrap/register-hooks.ts +167 -0
- package/src/resources/extensions/gsd/bootstrap/register-shortcuts.ts +55 -0
- package/src/resources/extensions/gsd/bootstrap/system-context.ts +340 -0
- package/src/resources/extensions/gsd/bootstrap/write-gate.ts +51 -0
- package/src/resources/extensions/gsd/commands/catalog.ts +301 -0
- package/src/resources/extensions/gsd/commands/context.ts +101 -0
- package/src/resources/extensions/gsd/commands/dispatcher.ts +32 -0
- package/src/resources/extensions/gsd/commands/handlers/auto.ts +74 -0
- package/src/resources/extensions/gsd/commands/handlers/core.ts +274 -0
- package/src/resources/extensions/gsd/commands/handlers/ops.ts +169 -0
- package/src/resources/extensions/gsd/commands/handlers/parallel.ts +118 -0
- package/src/resources/extensions/gsd/commands/handlers/workflow.ts +109 -0
- package/src/resources/extensions/gsd/commands/index.ts +14 -0
- package/src/resources/extensions/gsd/commands-handlers.ts +1 -1
- package/src/resources/extensions/gsd/commands.ts +10 -1329
- package/src/resources/extensions/gsd/dashboard-overlay.ts +10 -0
- package/src/resources/extensions/gsd/doctor-proactive.ts +106 -10
- package/src/resources/extensions/gsd/doctor.ts +47 -3
- package/src/resources/extensions/gsd/export-html.ts +51 -0
- package/src/resources/extensions/gsd/files.ts +1 -1
- package/src/resources/extensions/gsd/health-widget.ts +2 -1
- package/src/resources/extensions/gsd/index.ts +12 -1314
- package/src/resources/extensions/gsd/progress-score.ts +23 -0
- package/src/resources/extensions/gsd/prompts/forensics.md +121 -46
- package/src/resources/extensions/gsd/tests/auto-loop.test.ts +13 -9
- package/src/resources/extensions/gsd/tests/doctor-proactive.test.ts +3 -3
- package/src/resources/extensions/gsd/tests/provider-errors.test.ts +16 -16
- package/src/resources/extensions/gsd/tests/skill-activation.test.ts +4 -4
- package/src/resources/extensions/gsd/tests/visualizer-data.test.ts +10 -10
- package/src/resources/extensions/gsd/visualizer-data.ts +51 -1
- package/src/resources/extensions/gsd/visualizer-views.ts +58 -0
- /package/dist/resources/extensions/{env-utils.js → gsd/env-utils.js} +0 -0
- /package/src/resources/extensions/{env-utils.ts → gsd/env-utils.ts} +0 -0
|
@@ -15,6 +15,7 @@
|
|
|
15
15
|
import { readFileSync } from "node:fs";
|
|
16
16
|
import { basename, dirname, join } from "node:path";
|
|
17
17
|
import { modelsAreEqual, resetApiProviders, supportsXhigh } from "@gsd/pi-ai";
|
|
18
|
+
import { Type } from "@sinclair/typebox";
|
|
18
19
|
import { getDocsPath } from "../config.js";
|
|
19
20
|
import { getErrorMessage } from "../utils/error.js";
|
|
20
21
|
import { theme } from "../modes/interactive/theme/theme.js";
|
|
@@ -494,9 +495,10 @@ export class AgentSession {
|
|
|
494
495
|
* Changes take effect on the next agent turn.
|
|
495
496
|
*/
|
|
496
497
|
setActiveToolsByName(toolNames) {
|
|
498
|
+
const requestedToolNames = [...new Set([...toolNames, ...this._getBuiltinToolNames()])];
|
|
497
499
|
const tools = [];
|
|
498
500
|
const validToolNames = [];
|
|
499
|
-
for (const name of
|
|
501
|
+
for (const name of requestedToolNames) {
|
|
500
502
|
const tool = this._toolRegistry.get(name);
|
|
501
503
|
if (tool) {
|
|
502
504
|
tools.push(tool);
|
|
@@ -602,6 +604,42 @@ export class AgentSession {
|
|
|
602
604
|
}
|
|
603
605
|
return Array.from(unique);
|
|
604
606
|
}
|
|
607
|
+
_findSkillByName(skillName) {
|
|
608
|
+
return this.resourceLoader.getSkills().skills.find((skill) => skill.name === skillName);
|
|
609
|
+
}
|
|
610
|
+
_formatMissingSkillMessage(skillName) {
|
|
611
|
+
const availableSkills = this.resourceLoader.getSkills().skills.map((skill) => skill.name).join(", ") || "(none)";
|
|
612
|
+
return `Skill "${skillName}" not found. Available skills: ${availableSkills}`;
|
|
613
|
+
}
|
|
614
|
+
_emitSkillExpansionError(skillFilePath, err) {
|
|
615
|
+
this._extensionRunner?.emitError({
|
|
616
|
+
extensionPath: skillFilePath,
|
|
617
|
+
event: "skill_expansion",
|
|
618
|
+
error: getErrorMessage(err),
|
|
619
|
+
});
|
|
620
|
+
}
|
|
621
|
+
_renderSkillInvocation(skill, args) {
|
|
622
|
+
const content = readFileSync(skill.filePath, "utf-8");
|
|
623
|
+
const body = stripFrontmatter(content).trim();
|
|
624
|
+
const skillBlock = `<skill name="${skill.name}" location="${skill.filePath}">\nReferences are relative to ${skill.baseDir}.\n\n${body}\n</skill>`;
|
|
625
|
+
return args && args.trim() ? `${skillBlock}\n\n${args.trim()}` : skillBlock;
|
|
626
|
+
}
|
|
627
|
+
_expandSkillByName(skillName, args) {
|
|
628
|
+
const skill = this._findSkillByName(skillName);
|
|
629
|
+
if (!skill) {
|
|
630
|
+
throw new Error(this._formatMissingSkillMessage(skillName));
|
|
631
|
+
}
|
|
632
|
+
try {
|
|
633
|
+
return this._renderSkillInvocation(skill, args);
|
|
634
|
+
}
|
|
635
|
+
catch (err) {
|
|
636
|
+
this._emitSkillExpansionError(skill.filePath, err);
|
|
637
|
+
throw err;
|
|
638
|
+
}
|
|
639
|
+
}
|
|
640
|
+
_formatSkillInvocation(skillName, args) {
|
|
641
|
+
return this._expandSkillByName(skillName, args);
|
|
642
|
+
}
|
|
605
643
|
_rebuildSystemPrompt(toolNames) {
|
|
606
644
|
const validToolNames = toolNames.filter((name) => this._toolRegistry.has(name));
|
|
607
645
|
const toolSnippets = {};
|
|
@@ -809,25 +847,69 @@ export class AgentSession {
|
|
|
809
847
|
const spaceIndex = text.indexOf(" ");
|
|
810
848
|
const skillName = spaceIndex === -1 ? text.slice(7) : text.slice(7, spaceIndex);
|
|
811
849
|
const args = spaceIndex === -1 ? "" : text.slice(spaceIndex + 1).trim();
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
return text; // Unknown skill, pass through
|
|
850
|
+
if (!this._findSkillByName(skillName))
|
|
851
|
+
return text;
|
|
815
852
|
try {
|
|
816
|
-
|
|
817
|
-
const body = stripFrontmatter(content).trim();
|
|
818
|
-
const skillBlock = `<skill name="${skill.name}" location="${skill.filePath}">\nReferences are relative to ${skill.baseDir}.\n\n${body}\n</skill>`;
|
|
819
|
-
return args ? `${skillBlock}\n\n${args}` : skillBlock;
|
|
853
|
+
return this._formatSkillInvocation(skillName, args);
|
|
820
854
|
}
|
|
821
|
-
catch
|
|
822
|
-
|
|
823
|
-
this._extensionRunner?.emitError({
|
|
824
|
-
extensionPath: skill.filePath,
|
|
825
|
-
event: "skill_expansion",
|
|
826
|
-
error: getErrorMessage(err),
|
|
827
|
-
});
|
|
828
|
-
return text; // Return original on error
|
|
855
|
+
catch {
|
|
856
|
+
return text;
|
|
829
857
|
}
|
|
830
858
|
}
|
|
859
|
+
_createBuiltInSkillTool() {
|
|
860
|
+
const skillSchema = Type.Object({
|
|
861
|
+
skill: Type.String({ description: "The skill name. E.g., 'commit', 'review-pr', or 'pdf'" }),
|
|
862
|
+
args: Type.Optional(Type.String({ description: "Optional arguments for the skill" })),
|
|
863
|
+
});
|
|
864
|
+
return {
|
|
865
|
+
name: "Skill",
|
|
866
|
+
label: "Skill",
|
|
867
|
+
description: "Execute a skill within the main conversation. Use this tool when users ask for a slash command or reference a skill by name. Returns the expanded skill block and appends args after it.",
|
|
868
|
+
parameters: skillSchema,
|
|
869
|
+
execute: async (_toolCallId, params) => {
|
|
870
|
+
const input = params;
|
|
871
|
+
try {
|
|
872
|
+
return {
|
|
873
|
+
content: [
|
|
874
|
+
{
|
|
875
|
+
type: "text",
|
|
876
|
+
text: this._expandSkillByName(input.skill, input.args),
|
|
877
|
+
},
|
|
878
|
+
],
|
|
879
|
+
details: undefined,
|
|
880
|
+
};
|
|
881
|
+
}
|
|
882
|
+
catch (err) {
|
|
883
|
+
return {
|
|
884
|
+
content: [{ type: "text", text: getErrorMessage(err) }],
|
|
885
|
+
details: undefined,
|
|
886
|
+
};
|
|
887
|
+
}
|
|
888
|
+
},
|
|
889
|
+
};
|
|
890
|
+
}
|
|
891
|
+
_getBuiltinToolNames() {
|
|
892
|
+
return this._getBuiltinTools().map((tool) => tool.name);
|
|
893
|
+
}
|
|
894
|
+
_getBuiltinTools() {
|
|
895
|
+
return [this._createBuiltInSkillTool()];
|
|
896
|
+
}
|
|
897
|
+
_getRegisteredToolDefinitions() {
|
|
898
|
+
const registeredTools = this._extensionRunner?.getAllRegisteredTools() ?? [];
|
|
899
|
+
return registeredTools.map((tool) => tool.definition);
|
|
900
|
+
}
|
|
901
|
+
_getBuiltinToolDefinitions() {
|
|
902
|
+
return this._getBuiltinTools().map((tool) => ({
|
|
903
|
+
name: tool.name,
|
|
904
|
+
label: tool.label,
|
|
905
|
+
description: tool.description,
|
|
906
|
+
parameters: tool.parameters,
|
|
907
|
+
execute: async () => ({ content: [], details: undefined }),
|
|
908
|
+
}));
|
|
909
|
+
}
|
|
910
|
+
getRenderableToolDefinition(toolName) {
|
|
911
|
+
return [...this._getBuiltinToolDefinitions(), ...this._getRegisteredToolDefinitions()].find((tool) => tool.name === toolName);
|
|
912
|
+
}
|
|
831
913
|
/**
|
|
832
914
|
* Queue a steering message to interrupt the agent mid-run.
|
|
833
915
|
* Delivered after current tool execution, skips remaining tools.
|
|
@@ -1553,7 +1635,11 @@ export class AgentSession {
|
|
|
1553
1635
|
const wrappedExtensionTools = this._extensionRunner
|
|
1554
1636
|
? wrapRegisteredTools(allCustomTools, this._extensionRunner)
|
|
1555
1637
|
: [];
|
|
1638
|
+
const builtinTools = this._getBuiltinTools();
|
|
1556
1639
|
const toolRegistry = new Map(this._baseToolRegistry);
|
|
1640
|
+
for (const tool of builtinTools) {
|
|
1641
|
+
toolRegistry.set(tool.name, tool);
|
|
1642
|
+
}
|
|
1557
1643
|
for (const tool of wrappedExtensionTools) {
|
|
1558
1644
|
toolRegistry.set(tool.name, tool);
|
|
1559
1645
|
}
|
|
@@ -2171,14 +2257,11 @@ export class AgentSession {
|
|
|
2171
2257
|
*/
|
|
2172
2258
|
async exportToHtml(outputPath) {
|
|
2173
2259
|
const themeName = this.settingsManager.getTheme();
|
|
2174
|
-
// Create tool renderer
|
|
2175
|
-
|
|
2176
|
-
|
|
2177
|
-
|
|
2178
|
-
|
|
2179
|
-
theme,
|
|
2180
|
-
});
|
|
2181
|
-
}
|
|
2260
|
+
// Create tool renderer for extension and built-in tool HTML rendering
|
|
2261
|
+
const toolRenderer = createToolHtmlRenderer({
|
|
2262
|
+
getToolDefinition: (name) => this.getRenderableToolDefinition(name),
|
|
2263
|
+
theme,
|
|
2264
|
+
});
|
|
2182
2265
|
return await exportSessionToHtml(this.sessionManager, this.state, {
|
|
2183
2266
|
outputPath,
|
|
2184
2267
|
themeName,
|