gsd-pi 2.74.0-dev.14c45ac → 2.74.0-dev.20f79a8
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/resources/extensions/gsd/auto-post-unit.js +7 -3
- package/dist/resources/extensions/gsd/bootstrap/register-extension.js +10 -1
- package/dist/resources/extensions/gsd/bootstrap/register-hooks.js +45 -4
- package/dist/resources/extensions/gsd/ecosystem/gsd-extension-api.js +144 -0
- package/dist/resources/extensions/gsd/ecosystem/loader.js +145 -0
- package/dist/tsconfig.extensions.tsbuildinfo +1 -1
- package/dist/web/standalone/.next/BUILD_ID +1 -1
- package/dist/web/standalone/.next/app-path-routes-manifest.json +16 -16
- package/dist/web/standalone/.next/build-manifest.json +2 -2
- package/dist/web/standalone/.next/prerender-manifest.json +3 -3
- package/dist/web/standalone/.next/required-server-files.json +1 -1
- package/dist/web/standalone/.next/server/app/_global-error.html +1 -1
- package/dist/web/standalone/.next/server/app/_global-error.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_global-error.segments/_global-error/__PAGE__.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_global-error.segments/_global-error.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_not-found.html +1 -1
- package/dist/web/standalone/.next/server/app/_not-found.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_not-found.segments/_full.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_not-found.segments/_head.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_not-found.segments/_index.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_not-found.segments/_not-found.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_not-found.segments/_tree.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/api/onboarding/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/terminal/input/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/terminal/resize/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/terminal/sessions/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/terminal/stream/route.js +1 -1
- package/dist/web/standalone/.next/server/app/index.html +1 -1
- package/dist/web/standalone/.next/server/app/index.rsc +1 -1
- package/dist/web/standalone/.next/server/app/index.segments/__PAGE__.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/index.segments/_full.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/index.segments/_head.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/index.segments/_index.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/index.segments/_tree.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app-paths-manifest.json +16 -16
- package/dist/web/standalone/.next/server/chunks/6897.js +3 -3
- package/dist/web/standalone/.next/server/middleware-build-manifest.js +1 -1
- package/dist/web/standalone/.next/server/middleware-manifest.json +5 -5
- package/dist/web/standalone/.next/server/pages/404.html +1 -1
- package/dist/web/standalone/.next/server/pages/500.html +1 -1
- package/dist/web/standalone/.next/server/server-reference-manifest.json +1 -1
- package/dist/web/standalone/server.js +1 -1
- package/package.json +1 -1
- package/packages/pi-agent-core/tsconfig.tsbuildinfo +1 -1
- package/packages/pi-ai/dist/index.d.ts +1 -9
- package/packages/pi-ai/dist/index.d.ts.map +1 -1
- package/packages/pi-ai/dist/index.js +1 -9
- package/packages/pi-ai/dist/index.js.map +1 -1
- package/packages/pi-ai/dist/models/capability-patches.d.ts +19 -0
- package/packages/pi-ai/dist/models/capability-patches.d.ts.map +1 -0
- package/packages/pi-ai/dist/models/capability-patches.js +36 -0
- package/packages/pi-ai/dist/models/capability-patches.js.map +1 -0
- package/packages/pi-ai/dist/{models.custom.d.ts → models/custom.d.ts} +1 -1
- package/packages/pi-ai/dist/models/custom.d.ts.map +1 -0
- package/packages/pi-ai/dist/{models.custom.js → models/custom.js} +4 -4
- package/packages/pi-ai/dist/models/custom.js.map +1 -0
- package/packages/pi-ai/dist/models/generated/amazon-bedrock.d.ts +1482 -0
- package/packages/pi-ai/dist/models/generated/amazon-bedrock.d.ts.map +1 -0
- package/packages/pi-ai/dist/models/generated/amazon-bedrock.js +1484 -0
- package/packages/pi-ai/dist/models/generated/amazon-bedrock.js.map +1 -0
- package/packages/pi-ai/dist/models/generated/anthropic.d.ts +377 -0
- package/packages/pi-ai/dist/models/generated/anthropic.d.ts.map +1 -0
- package/packages/pi-ai/dist/models/generated/anthropic.js +379 -0
- package/packages/pi-ai/dist/models/generated/anthropic.js.map +1 -0
- package/packages/pi-ai/dist/models/generated/azure-openai-responses.d.ts +700 -0
- package/packages/pi-ai/dist/models/generated/azure-openai-responses.d.ts.map +1 -0
- package/packages/pi-ai/dist/models/generated/azure-openai-responses.js +702 -0
- package/packages/pi-ai/dist/models/generated/azure-openai-responses.js.map +1 -0
- package/packages/pi-ai/dist/models/generated/cerebras.d.ts +71 -0
- package/packages/pi-ai/dist/models/generated/cerebras.d.ts.map +1 -0
- package/packages/pi-ai/dist/models/generated/cerebras.js +73 -0
- package/packages/pi-ai/dist/models/generated/cerebras.js.map +1 -0
- package/packages/pi-ai/dist/models/generated/github-copilot.d.ts +590 -0
- package/packages/pi-ai/dist/models/generated/github-copilot.d.ts.map +1 -0
- package/packages/pi-ai/dist/models/generated/github-copilot.js +444 -0
- package/packages/pi-ai/dist/models/generated/github-copilot.js.map +1 -0
- package/packages/pi-ai/dist/models/generated/google-antigravity.d.ts +156 -0
- package/packages/pi-ai/dist/models/generated/google-antigravity.d.ts.map +1 -0
- package/packages/pi-ai/dist/models/generated/google-antigravity.js +158 -0
- package/packages/pi-ai/dist/models/generated/google-antigravity.js.map +1 -0
- package/packages/pi-ai/dist/models/generated/google-gemini-cli.d.ts +105 -0
- package/packages/pi-ai/dist/models/generated/google-gemini-cli.d.ts.map +1 -0
- package/packages/pi-ai/dist/models/generated/google-gemini-cli.js +107 -0
- package/packages/pi-ai/dist/models/generated/google-gemini-cli.js.map +1 -0
- package/packages/pi-ai/dist/models/generated/google-vertex.d.ts +207 -0
- package/packages/pi-ai/dist/models/generated/google-vertex.d.ts.map +1 -0
- package/packages/pi-ai/dist/models/generated/google-vertex.js +209 -0
- package/packages/pi-ai/dist/models/generated/google-vertex.js.map +1 -0
- package/packages/pi-ai/dist/models/generated/google.d.ts +462 -0
- package/packages/pi-ai/dist/models/generated/google.d.ts.map +1 -0
- package/packages/pi-ai/dist/models/generated/google.js +464 -0
- package/packages/pi-ai/dist/models/generated/google.js.map +1 -0
- package/packages/pi-ai/dist/models/generated/groq.d.ts +309 -0
- package/packages/pi-ai/dist/models/generated/groq.d.ts.map +1 -0
- package/packages/pi-ai/dist/models/generated/groq.js +311 -0
- package/packages/pi-ai/dist/models/generated/groq.js.map +1 -0
- package/packages/pi-ai/dist/models/generated/huggingface.d.ts +383 -0
- package/packages/pi-ai/dist/models/generated/huggingface.d.ts.map +1 -0
- package/packages/pi-ai/dist/models/generated/huggingface.js +347 -0
- package/packages/pi-ai/dist/models/generated/huggingface.js.map +1 -0
- package/packages/pi-ai/dist/{models.generated.d.ts → models/generated/index.d.ts} +1 -1
- package/packages/pi-ai/dist/{models.generated.d.ts.map → models/generated/index.d.ts.map} +1 -1
- package/packages/pi-ai/dist/models/generated/index.js +51 -0
- package/packages/pi-ai/dist/models/generated/index.js.map +1 -0
- package/packages/pi-ai/dist/models/generated/kimi-coding.d.ts +37 -0
- package/packages/pi-ai/dist/models/generated/kimi-coding.d.ts.map +1 -0
- package/packages/pi-ai/dist/models/generated/kimi-coding.js +39 -0
- package/packages/pi-ai/dist/models/generated/kimi-coding.js.map +1 -0
- package/packages/pi-ai/dist/models/generated/minimax-cn.d.ts +105 -0
- package/packages/pi-ai/dist/models/generated/minimax-cn.d.ts.map +1 -0
- package/packages/pi-ai/dist/models/generated/minimax-cn.js +107 -0
- package/packages/pi-ai/dist/models/generated/minimax-cn.js.map +1 -0
- package/packages/pi-ai/dist/models/generated/minimax.d.ts +105 -0
- package/packages/pi-ai/dist/models/generated/minimax.d.ts.map +1 -0
- package/packages/pi-ai/dist/models/generated/minimax.js +107 -0
- package/packages/pi-ai/dist/models/generated/minimax.js.map +1 -0
- package/packages/pi-ai/dist/models/generated/mistral.d.ts +445 -0
- package/packages/pi-ai/dist/models/generated/mistral.d.ts.map +1 -0
- package/packages/pi-ai/dist/models/generated/mistral.js +447 -0
- package/packages/pi-ai/dist/models/generated/mistral.js.map +1 -0
- package/packages/pi-ai/dist/models/generated/openai-codex.d.ts +139 -0
- package/packages/pi-ai/dist/models/generated/openai-codex.d.ts.map +1 -0
- package/packages/pi-ai/dist/models/generated/openai-codex.js +141 -0
- package/packages/pi-ai/dist/models/generated/openai-codex.js.map +1 -0
- package/packages/pi-ai/dist/models/generated/openai.d.ts +700 -0
- package/packages/pi-ai/dist/models/generated/openai.d.ts.map +1 -0
- package/packages/pi-ai/dist/models/generated/openai.js +702 -0
- package/packages/pi-ai/dist/models/generated/openai.js.map +1 -0
- package/packages/pi-ai/dist/models/generated/opencode-go.d.ts +122 -0
- package/packages/pi-ai/dist/models/generated/opencode-go.d.ts.map +1 -0
- package/packages/pi-ai/dist/models/generated/opencode-go.js +124 -0
- package/packages/pi-ai/dist/models/generated/opencode-go.js.map +1 -0
- package/packages/pi-ai/dist/models/generated/opencode.d.ts +530 -0
- package/packages/pi-ai/dist/models/generated/opencode.d.ts.map +1 -0
- package/packages/pi-ai/dist/models/generated/opencode.js +532 -0
- package/packages/pi-ai/dist/models/generated/opencode.js.map +1 -0
- package/packages/pi-ai/dist/models/generated/openrouter.d.ts +4270 -0
- package/packages/pi-ai/dist/models/generated/openrouter.d.ts.map +1 -0
- package/packages/pi-ai/dist/models/generated/openrouter.js +4272 -0
- package/packages/pi-ai/dist/models/generated/openrouter.js.map +1 -0
- package/packages/pi-ai/dist/models/generated/vercel-ai-gateway.d.ts +2604 -0
- package/packages/pi-ai/dist/models/generated/vercel-ai-gateway.d.ts.map +1 -0
- package/packages/pi-ai/dist/models/generated/vercel-ai-gateway.js +2606 -0
- package/packages/pi-ai/dist/models/generated/vercel-ai-gateway.js.map +1 -0
- package/packages/pi-ai/dist/models/generated/xai.d.ts +411 -0
- package/packages/pi-ai/dist/models/generated/xai.d.ts.map +1 -0
- package/packages/pi-ai/dist/models/generated/xai.js +413 -0
- package/packages/pi-ai/dist/models/generated/xai.js.map +1 -0
- package/packages/pi-ai/dist/models/generated/zai.d.ts +276 -0
- package/packages/pi-ai/dist/models/generated/zai.d.ts.map +1 -0
- package/packages/pi-ai/dist/models/generated/zai.js +239 -0
- package/packages/pi-ai/dist/models/generated/zai.js.map +1 -0
- package/packages/pi-ai/dist/models/index.d.ts +27 -0
- package/packages/pi-ai/dist/models/index.d.ts.map +1 -0
- package/packages/pi-ai/dist/models/index.js +80 -0
- package/packages/pi-ai/dist/models/index.js.map +1 -0
- package/packages/pi-ai/dist/models.d.ts +1 -36
- package/packages/pi-ai/dist/models.d.ts.map +1 -1
- package/packages/pi-ai/dist/models.generated.test.js +1 -2
- package/packages/pi-ai/dist/models.generated.test.js.map +1 -1
- package/packages/pi-ai/dist/models.js +3 -112
- package/packages/pi-ai/dist/models.js.map +1 -1
- package/packages/pi-ai/dist/models.test.js +6 -5
- package/packages/pi-ai/dist/models.test.js.map +1 -1
- package/packages/pi-ai/scripts/generate-models.ts +74 -40
- package/packages/pi-ai/src/index.ts +1 -9
- package/packages/pi-ai/src/models/capability-patches.ts +40 -0
- package/packages/pi-ai/src/{models.custom.ts → models/custom.ts} +4 -4
- package/packages/pi-ai/src/models/generated/amazon-bedrock.ts +1486 -0
- package/packages/pi-ai/src/models/generated/anthropic.ts +381 -0
- package/packages/pi-ai/src/models/generated/azure-openai-responses.ts +704 -0
- package/packages/pi-ai/src/models/generated/cerebras.ts +75 -0
- package/packages/pi-ai/src/models/generated/github-copilot.ts +446 -0
- package/packages/pi-ai/src/models/generated/google-antigravity.ts +160 -0
- package/packages/pi-ai/src/models/generated/google-gemini-cli.ts +109 -0
- package/packages/pi-ai/src/models/generated/google-vertex.ts +211 -0
- package/packages/pi-ai/src/models/generated/google.ts +466 -0
- package/packages/pi-ai/src/models/generated/groq.ts +313 -0
- package/packages/pi-ai/src/models/generated/huggingface.ts +349 -0
- package/packages/pi-ai/src/models/generated/index.ts +52 -0
- package/packages/pi-ai/src/models/generated/kimi-coding.ts +41 -0
- package/packages/pi-ai/src/models/generated/minimax-cn.ts +109 -0
- package/packages/pi-ai/src/models/generated/minimax.ts +109 -0
- package/packages/pi-ai/src/models/generated/mistral.ts +449 -0
- package/packages/pi-ai/src/models/generated/openai-codex.ts +143 -0
- package/packages/pi-ai/src/models/generated/openai.ts +704 -0
- package/packages/pi-ai/src/models/generated/opencode-go.ts +126 -0
- package/packages/pi-ai/src/models/generated/opencode.ts +534 -0
- package/packages/pi-ai/src/models/generated/openrouter.ts +4274 -0
- package/packages/pi-ai/src/models/generated/vercel-ai-gateway.ts +2608 -0
- package/packages/pi-ai/src/models/generated/xai.ts +415 -0
- package/packages/pi-ai/src/models/generated/zai.ts +241 -0
- package/packages/pi-ai/src/models/index.ts +106 -0
- package/packages/pi-ai/src/models.generated.test.ts +1 -2
- package/packages/pi-ai/src/models.test.ts +6 -5
- package/packages/pi-ai/src/models.ts +3 -153
- package/packages/pi-ai/tsconfig.tsbuildinfo +1 -1
- package/packages/pi-coding-agent/dist/core/agent-session.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/core/agent-session.js +8 -2
- package/packages/pi-coding-agent/dist/core/agent-session.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/chat-controller-ordering.test.js +284 -10
- package/packages/pi-coding-agent/dist/core/chat-controller-ordering.test.js.map +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/components/assistant-message.d.ts +1 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/assistant-message.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/components/assistant-message.js +23 -9
- package/packages/pi-coding-agent/dist/modes/interactive/components/assistant-message.js.map +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/components/chat-frame.d.ts +11 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/chat-frame.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/chat-frame.js +47 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/chat-frame.js.map +1 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/user-message.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/components/user-message.js +22 -22
- package/packages/pi-coding-agent/dist/modes/interactive/components/user-message.js.map +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/controllers/chat-controller.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/controllers/chat-controller.js +171 -24
- package/packages/pi-coding-agent/dist/modes/interactive/controllers/chat-controller.js.map +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/interactive-mode-ordering.test.d.ts +2 -0
- package/packages/pi-coding-agent/dist/modes/interactive/interactive-mode-ordering.test.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/modes/interactive/interactive-mode-ordering.test.js +38 -0
- package/packages/pi-coding-agent/dist/modes/interactive/interactive-mode-ordering.test.js.map +1 -0
- package/packages/pi-coding-agent/dist/modes/interactive/interactive-mode.d.ts +13 -0
- 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 +53 -6
- package/packages/pi-coding-agent/dist/modes/interactive/interactive-mode.js.map +1 -1
- package/packages/pi-coding-agent/src/core/agent-session.ts +12 -6
- package/packages/pi-coding-agent/src/core/chat-controller-ordering.test.ts +357 -10
- package/packages/pi-coding-agent/src/modes/interactive/components/assistant-message.ts +25 -10
- package/packages/pi-coding-agent/src/modes/interactive/components/chat-frame.ts +67 -0
- package/packages/pi-coding-agent/src/modes/interactive/components/user-message.ts +23 -26
- package/packages/pi-coding-agent/src/modes/interactive/controllers/chat-controller.ts +232 -47
- package/packages/pi-coding-agent/src/modes/interactive/interactive-mode-ordering.test.ts +44 -0
- package/packages/pi-coding-agent/src/modes/interactive/interactive-mode.ts +73 -6
- package/packages/pi-coding-agent/tsconfig.tsbuildinfo +1 -1
- package/src/resources/extensions/gsd/auto-post-unit.ts +7 -3
- package/src/resources/extensions/gsd/bootstrap/register-extension.ts +15 -1
- package/src/resources/extensions/gsd/bootstrap/register-hooks.ts +56 -3
- package/src/resources/extensions/gsd/ecosystem/gsd-extension-api.ts +228 -0
- package/src/resources/extensions/gsd/ecosystem/loader.ts +201 -0
- package/src/resources/extensions/gsd/tests/health-widget.test.ts +1 -1
- package/src/resources/extensions/gsd/tests/register-hooks-depth-verification.test.ts +1 -1
- package/src/resources/extensions/gsd/types.ts +13 -0
- package/src/resources/extensions/gsd/workflow-logger.ts +2 -1
- package/packages/pi-ai/dist/models.custom.d.ts.map +0 -1
- package/packages/pi-ai/dist/models.custom.js.map +0 -1
- package/packages/pi-ai/dist/models.generated.js +0 -14343
- package/packages/pi-ai/dist/models.generated.js.map +0 -1
- package/packages/pi-ai/src/models.generated.ts +0 -14345
- /package/dist/web/standalone/.next/static/{ZMKM0OI0CrTgzKWbgfPOg → ZDXqgjuglsRoazETSKw1J}/_buildManifest.js +0 -0
- /package/dist/web/standalone/.next/static/{ZMKM0OI0CrTgzKWbgfPOg → ZDXqgjuglsRoazETSKw1J}/_ssgManifest.js +0 -0
|
@@ -940,10 +940,14 @@ export async function postUnitPostVerification(pctx) {
|
|
|
940
940
|
unitId: currentUnit.id,
|
|
941
941
|
});
|
|
942
942
|
}
|
|
943
|
-
// Notify UI
|
|
943
|
+
// Notify UI — surface actionable details (#4259)
|
|
944
944
|
if (result.status === "fail") {
|
|
945
|
-
const
|
|
946
|
-
|
|
945
|
+
const blockingChecks = result.checks.filter(c => !c.passed && c.blocking);
|
|
946
|
+
const blockingCount = blockingChecks.length;
|
|
947
|
+
const details = blockingChecks.slice(0, 3).map(c => ` \u2022 ${c.message}`).join("\n");
|
|
948
|
+
const suffix = blockingChecks.length > 3 ? `\n \u2022 ...and ${blockingChecks.length - 3} more` : "";
|
|
949
|
+
const evidenceNote = `\nSee ${sid}-PRE-EXEC-VERIFY.json for full details.`;
|
|
950
|
+
ctx.ui.notify(`Pre-execution checks failed: ${blockingCount} blocking issue${blockingCount === 1 ? "" : "s"} found\n${details}${suffix}${evidenceNote}`, "error");
|
|
947
951
|
preExecPauseNeeded = true;
|
|
948
952
|
}
|
|
949
953
|
else if (result.status === "warn") {
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
// GSD2 — Extension registration: wires all GSD tools, commands, and hooks into pi
|
|
2
2
|
import { registerExitCommand } from "../exit-command.js";
|
|
3
3
|
import { registerWorktreeCommand } from "../worktree-command.js";
|
|
4
|
+
import { loadEcosystemExtensions } from "../ecosystem/loader.js";
|
|
4
5
|
import { registerDbTools } from "./db-tools.js";
|
|
5
6
|
import { registerDynamicTools } from "./dynamic-tools.js";
|
|
6
7
|
import { registerJournalTools } from "./journal-tools.js";
|
|
@@ -57,6 +58,9 @@ export function registerGsdExtension(pi) {
|
|
|
57
58
|
registerWorktreeCommand(pi);
|
|
58
59
|
registerExitCommand(pi);
|
|
59
60
|
installEpipeGuard();
|
|
61
|
+
// Ecosystem handlers captured by the GSDExtensionAPI wrapper for the
|
|
62
|
+
// GSD-owned `before_agent_start` dispatch step (#3338).
|
|
63
|
+
const ecosystemHandlers = [];
|
|
60
64
|
pi.registerCommand("kill", {
|
|
61
65
|
description: "Exit GSD immediately (no cleanup)",
|
|
62
66
|
handler: async (_args, _ctx) => {
|
|
@@ -71,7 +75,12 @@ export function registerGsdExtension(pi) {
|
|
|
71
75
|
["journal-tools", () => registerJournalTools(pi)],
|
|
72
76
|
["query-tools", () => registerQueryTools(pi)],
|
|
73
77
|
["shortcuts", () => registerShortcuts(pi)],
|
|
74
|
-
["hooks", () => registerHooks(pi)],
|
|
78
|
+
["hooks", () => registerHooks(pi, ecosystemHandlers)],
|
|
79
|
+
["ecosystem", () => {
|
|
80
|
+
void loadEcosystemExtensions(pi, ecosystemHandlers).catch((err) => {
|
|
81
|
+
logWarning("ecosystem", `loader failed: ${err instanceof Error ? err.message : String(err)}`);
|
|
82
|
+
});
|
|
83
|
+
}],
|
|
75
84
|
];
|
|
76
85
|
for (const [name, register] of nonCriticalRegistrations) {
|
|
77
86
|
try {
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { join } from "node:path";
|
|
2
2
|
import { isToolCallEventType } from "@gsd/pi-coding-agent";
|
|
3
|
+
import { updateSnapshot } from "../ecosystem/gsd-extension-api.js";
|
|
4
|
+
import { getEcosystemReadyPromise } from "../ecosystem/loader.js";
|
|
3
5
|
import { buildMilestoneFileName, resolveMilestonePath, resolveSliceFile, resolveSlicePath } from "../paths.js";
|
|
4
6
|
import { buildBeforeAgentStartResult } from "./system-context.js";
|
|
5
7
|
import { handleAgentEnd } from "./agent-end-recovery.js";
|
|
@@ -29,7 +31,7 @@ async function syncServiceTierStatus(ctx) {
|
|
|
29
31
|
const { getEffectiveServiceTier, formatServiceTierFooterStatus } = await import("../service-tier.js");
|
|
30
32
|
ctx.ui.setStatus("gsd-fast", formatServiceTierFooterStatus(getEffectiveServiceTier(), ctx.model?.id));
|
|
31
33
|
}
|
|
32
|
-
export function registerHooks(pi) {
|
|
34
|
+
export function registerHooks(pi, ecosystemHandlers) {
|
|
33
35
|
pi.on("session_start", async (_event, ctx) => {
|
|
34
36
|
initNotificationStore(process.cwd());
|
|
35
37
|
installNotifyInterceptor(ctx);
|
|
@@ -85,7 +87,44 @@ export function registerHooks(pi) {
|
|
|
85
87
|
loadToolApiKeys();
|
|
86
88
|
});
|
|
87
89
|
pi.on("before_agent_start", async (event, ctx) => {
|
|
88
|
-
|
|
90
|
+
// Wait for ecosystem loader to finish (no-op after first turn).
|
|
91
|
+
await getEcosystemReadyPromise();
|
|
92
|
+
// GSD's own context injection (existing behavior — unchanged).
|
|
93
|
+
const gsdResult = await buildBeforeAgentStartResult(event, ctx);
|
|
94
|
+
// Refresh the snapshot used by ecosystem getPhase()/getActiveUnit().
|
|
95
|
+
// deriveState has its own ~100ms cache so this is cheap on repeat calls.
|
|
96
|
+
try {
|
|
97
|
+
const state = await deriveState(process.cwd());
|
|
98
|
+
updateSnapshot(state);
|
|
99
|
+
}
|
|
100
|
+
catch {
|
|
101
|
+
updateSnapshot(null);
|
|
102
|
+
}
|
|
103
|
+
// Chain ecosystem handlers using pi's runner.ts chaining protocol:
|
|
104
|
+
// each handler sees the systemPrompt mutated by prior handlers.
|
|
105
|
+
let currentSystemPrompt = gsdResult?.systemPrompt ?? event.systemPrompt;
|
|
106
|
+
// `any` because pi's BeforeAgentStartEventResult.message uses an internal
|
|
107
|
+
// CustomMessage type that's not re-exported (see ecosystem/gsd-extension-api.ts).
|
|
108
|
+
let lastMessage = gsdResult?.message;
|
|
109
|
+
for (const handler of ecosystemHandlers) {
|
|
110
|
+
try {
|
|
111
|
+
const r = await handler({ ...event, systemPrompt: currentSystemPrompt }, ctx);
|
|
112
|
+
if (r?.systemPrompt !== undefined)
|
|
113
|
+
currentSystemPrompt = r.systemPrompt;
|
|
114
|
+
if (r?.message)
|
|
115
|
+
lastMessage = r.message;
|
|
116
|
+
}
|
|
117
|
+
catch (err) {
|
|
118
|
+
safetyLogWarning("ecosystem", `before_agent_start handler failed: ${err instanceof Error ? err.message : String(err)}`);
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
// Compose result. Return undefined if nothing changed (preserves runner contract).
|
|
122
|
+
if (currentSystemPrompt === event.systemPrompt && !lastMessage)
|
|
123
|
+
return undefined;
|
|
124
|
+
return {
|
|
125
|
+
systemPrompt: currentSystemPrompt !== event.systemPrompt ? currentSystemPrompt : undefined,
|
|
126
|
+
message: lastMessage,
|
|
127
|
+
};
|
|
89
128
|
});
|
|
90
129
|
pi.on("agent_end", async (event, ctx) => {
|
|
91
130
|
resetToolCallLoopGuard();
|
|
@@ -116,8 +155,10 @@ export function registerHooks(pi) {
|
|
|
116
155
|
const state = await deriveState(basePath);
|
|
117
156
|
if (!state.activeMilestone || !state.activeSlice || !state.activeTask)
|
|
118
157
|
return;
|
|
119
|
-
|
|
120
|
-
|
|
158
|
+
// Write checkpoint for ALL phases, not just "executing" — discuss, research,
|
|
159
|
+
// and planning also carry in-memory state (user answers, gate verification)
|
|
160
|
+
// that would be lost on compaction (#4258).
|
|
161
|
+
// if (state.phase !== "executing") return;
|
|
121
162
|
const sliceDir = resolveSlicePath(basePath, state.activeMilestone.id, state.activeSlice.id);
|
|
122
163
|
if (!sliceDir)
|
|
123
164
|
return;
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
// GSD2 — Ecosystem Extension API wrapper
|
|
2
|
+
// Wraps pi's ExtensionAPI to expose typed GSD context (phase + active unit)
|
|
3
|
+
// to extensions loaded from `./.gsd/extensions/`. The wrapper intercepts only
|
|
4
|
+
// `on("before_agent_start", ...)` so GSD can dispatch ecosystem handlers AFTER
|
|
5
|
+
// refreshing state — fixing the load-order race where third-party
|
|
6
|
+
// `.pi/extensions/` handlers see a stale module-level snapshot (#3338).
|
|
7
|
+
//
|
|
8
|
+
// SINGLE-SESSION INVARIANT: the module-level `_snapshot` is per-process.
|
|
9
|
+
// Worktree or project switches do NOT reload extensions, matching pi's
|
|
10
|
+
// `.pi/extensions/` behavior. Only re-launching the CLI rebinds the snapshot.
|
|
11
|
+
import { isGSDActive, getCurrentPhase } from "../../shared/gsd-phase-state.js";
|
|
12
|
+
import { logWarning } from "../workflow-logger.js";
|
|
13
|
+
// ─── Auto-loop phase mapping ────────────────────────────────────────────
|
|
14
|
+
const AUTO_LOOP_PHASE_MAP = {
|
|
15
|
+
"plan-milestone": "planning",
|
|
16
|
+
"plan-slice": "planning",
|
|
17
|
+
"research": "researching",
|
|
18
|
+
"discuss": "discussing",
|
|
19
|
+
"execute-task": "executing",
|
|
20
|
+
"verify": "verifying",
|
|
21
|
+
"summarize-task": "summarizing",
|
|
22
|
+
"summarize-slice": "summarizing",
|
|
23
|
+
"advance": "advancing",
|
|
24
|
+
"validate-milestone": "validating-milestone",
|
|
25
|
+
"complete-milestone": "completing-milestone",
|
|
26
|
+
"replan-slice": "replanning-slice",
|
|
27
|
+
};
|
|
28
|
+
/** Exposed for unit tests. Returns null for unknown keys (does NOT default). */
|
|
29
|
+
export function mapAutoLoopPhase(raw) {
|
|
30
|
+
return AUTO_LOOP_PHASE_MAP[raw] ?? null;
|
|
31
|
+
}
|
|
32
|
+
function resolvePhase(state) {
|
|
33
|
+
if (!state)
|
|
34
|
+
return null;
|
|
35
|
+
if (isGSDActive()) {
|
|
36
|
+
const raw = getCurrentPhase();
|
|
37
|
+
if (raw != null) {
|
|
38
|
+
const mapped = AUTO_LOOP_PHASE_MAP[raw];
|
|
39
|
+
if (mapped)
|
|
40
|
+
return mapped;
|
|
41
|
+
logWarning("ecosystem", `unknown auto-loop phase: ${raw}`);
|
|
42
|
+
// FALL THROUGH to state.phase rather than defaulting to "executing".
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
return state.phase;
|
|
46
|
+
}
|
|
47
|
+
function resolveActiveUnit(state) {
|
|
48
|
+
if (!state)
|
|
49
|
+
return null;
|
|
50
|
+
const m = state.activeMilestone;
|
|
51
|
+
const s = state.activeSlice;
|
|
52
|
+
const t = state.activeTask;
|
|
53
|
+
if (!m || !s || !t)
|
|
54
|
+
return null;
|
|
55
|
+
return {
|
|
56
|
+
milestoneId: m.id,
|
|
57
|
+
milestoneTitle: m.title,
|
|
58
|
+
sliceId: s.id,
|
|
59
|
+
sliceTitle: s.title,
|
|
60
|
+
taskId: t.id,
|
|
61
|
+
taskTitle: t.title,
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
let _snapshot = { phase: null, activeUnit: null };
|
|
65
|
+
/** Refresh the snapshot from a freshly derived GSDState (or null on failure). */
|
|
66
|
+
export function updateSnapshot(state) {
|
|
67
|
+
_snapshot = {
|
|
68
|
+
phase: resolvePhase(state),
|
|
69
|
+
activeUnit: resolveActiveUnit(state),
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
export function getSnapshotPhase() {
|
|
73
|
+
return _snapshot.phase;
|
|
74
|
+
}
|
|
75
|
+
export function getSnapshotActiveUnit() {
|
|
76
|
+
return _snapshot.activeUnit;
|
|
77
|
+
}
|
|
78
|
+
/** Test-only: reset the snapshot to its initial empty state. */
|
|
79
|
+
export function _resetSnapshot() {
|
|
80
|
+
_snapshot = { phase: null, activeUnit: null };
|
|
81
|
+
}
|
|
82
|
+
// ─── Wrapper factory ────────────────────────────────────────────────────
|
|
83
|
+
/**
|
|
84
|
+
* Build a GSDExtensionAPI by manually delegating every ExtensionAPI method
|
|
85
|
+
* to the underlying pi instance, except `on("before_agent_start", ...)`
|
|
86
|
+
* which is captured into `sharedHandlers` for GSD-owned dispatch.
|
|
87
|
+
*
|
|
88
|
+
* Uses `satisfies GSDExtensionAPI` (NOT `as`) so TypeScript catches drift
|
|
89
|
+
* when pi adds new ExtensionAPI methods.
|
|
90
|
+
*/
|
|
91
|
+
export function createGSDExtensionAPI(pi, sharedHandlers) {
|
|
92
|
+
const wrapper = {
|
|
93
|
+
// ── Event subscription (single intercept point) ────────────────────
|
|
94
|
+
on(event, handler) {
|
|
95
|
+
if (event === "before_agent_start") {
|
|
96
|
+
sharedHandlers.push(handler);
|
|
97
|
+
return;
|
|
98
|
+
}
|
|
99
|
+
pi.on(event, handler);
|
|
100
|
+
},
|
|
101
|
+
// ── Event emission ─────────────────────────────────────────────────
|
|
102
|
+
emitBeforeModelSelect: (...args) => pi.emitBeforeModelSelect(...args),
|
|
103
|
+
emitAdjustToolSet: (...args) => pi.emitAdjustToolSet(...args),
|
|
104
|
+
// ── Tool / command / shortcut / flag registration ──────────────────
|
|
105
|
+
registerTool: ((tool) => pi.registerTool(tool)),
|
|
106
|
+
registerCommand: (...args) => pi.registerCommand(...args),
|
|
107
|
+
registerBeforeInstall: (...args) => pi.registerBeforeInstall(...args),
|
|
108
|
+
registerAfterInstall: (...args) => pi.registerAfterInstall(...args),
|
|
109
|
+
registerBeforeRemove: (...args) => pi.registerBeforeRemove(...args),
|
|
110
|
+
registerAfterRemove: (...args) => pi.registerAfterRemove(...args),
|
|
111
|
+
registerShortcut: (...args) => pi.registerShortcut(...args),
|
|
112
|
+
registerFlag: (...args) => pi.registerFlag(...args),
|
|
113
|
+
getFlag: (...args) => pi.getFlag(...args),
|
|
114
|
+
// ── Message rendering ──────────────────────────────────────────────
|
|
115
|
+
registerMessageRenderer: ((customType, renderer) => pi.registerMessageRenderer(customType, renderer)),
|
|
116
|
+
// ── Actions ────────────────────────────────────────────────────────
|
|
117
|
+
sendMessage: ((message, options) => pi.sendMessage(message, options)),
|
|
118
|
+
sendUserMessage: (...args) => pi.sendUserMessage(...args),
|
|
119
|
+
retryLastTurn: () => pi.retryLastTurn(),
|
|
120
|
+
appendEntry: ((customType, data) => pi.appendEntry(customType, data)),
|
|
121
|
+
// ── Session metadata ───────────────────────────────────────────────
|
|
122
|
+
setSessionName: (...args) => pi.setSessionName(...args),
|
|
123
|
+
getSessionName: () => pi.getSessionName(),
|
|
124
|
+
setLabel: (...args) => pi.setLabel(...args),
|
|
125
|
+
exec: (...args) => pi.exec(...args),
|
|
126
|
+
getActiveTools: () => pi.getActiveTools(),
|
|
127
|
+
getAllTools: () => pi.getAllTools(),
|
|
128
|
+
setActiveTools: (...args) => pi.setActiveTools(...args),
|
|
129
|
+
getCommands: () => pi.getCommands(),
|
|
130
|
+
// ── Model & thinking ───────────────────────────────────────────────
|
|
131
|
+
setModel: (...args) => pi.setModel(...args),
|
|
132
|
+
getThinkingLevel: () => pi.getThinkingLevel(),
|
|
133
|
+
setThinkingLevel: (...args) => pi.setThinkingLevel(...args),
|
|
134
|
+
// ── Provider registration ──────────────────────────────────────────
|
|
135
|
+
registerProvider: (...args) => pi.registerProvider(...args),
|
|
136
|
+
unregisterProvider: (...args) => pi.unregisterProvider(...args),
|
|
137
|
+
// ── Shared event bus (passthrough property) ────────────────────────
|
|
138
|
+
events: pi.events,
|
|
139
|
+
// ── GSD-specific additions ─────────────────────────────────────────
|
|
140
|
+
getPhase: () => _snapshot.phase,
|
|
141
|
+
getActiveUnit: () => _snapshot.activeUnit,
|
|
142
|
+
};
|
|
143
|
+
return wrapper;
|
|
144
|
+
}
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
// GSD2 — Ecosystem extension loader for ./.gsd/extensions/
|
|
2
|
+
// Discovers and registers single-file extensions that consume GSDExtensionAPI.
|
|
3
|
+
// Trust-gated (mirrors pi's `.pi/extensions/` model) and isolated from pi's
|
|
4
|
+
// own loader chain — handlers run in GSD's own dispatch step, not pi's.
|
|
5
|
+
import * as fs from "node:fs";
|
|
6
|
+
import * as path from "node:path";
|
|
7
|
+
import { pathToFileURL } from "node:url";
|
|
8
|
+
import { getAgentDir } from "@gsd/pi-coding-agent";
|
|
9
|
+
import { logWarning } from "../workflow-logger.js";
|
|
10
|
+
import { createGSDExtensionAPI, } from "./gsd-extension-api.js";
|
|
11
|
+
// ─── Trust check (inlined; pi does not export isProjectTrusted from its
|
|
12
|
+
// package root, and constraint forbids modifying packages/pi-coding-agent/) ─
|
|
13
|
+
const TRUSTED_PROJECTS_FILE = "trusted-projects.json";
|
|
14
|
+
function isProjectTrusted(projectPath, agentDir) {
|
|
15
|
+
const canonical = path.resolve(projectPath);
|
|
16
|
+
const trustedPath = path.join(agentDir, TRUSTED_PROJECTS_FILE);
|
|
17
|
+
try {
|
|
18
|
+
const content = fs.readFileSync(trustedPath, "utf-8");
|
|
19
|
+
const parsed = JSON.parse(content);
|
|
20
|
+
if (Array.isArray(parsed)) {
|
|
21
|
+
return parsed.includes(canonical);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
catch {
|
|
25
|
+
// missing or malformed — treat as untrusted
|
|
26
|
+
}
|
|
27
|
+
return false;
|
|
28
|
+
}
|
|
29
|
+
// ─── Ready-promise singleton ────────────────────────────────────────────
|
|
30
|
+
let _readyPromise = null;
|
|
31
|
+
let _untrustedWarned = false;
|
|
32
|
+
/**
|
|
33
|
+
* Discover and register ecosystem extensions from `./.gsd/extensions/`.
|
|
34
|
+
* Idempotent: subsequent calls with the same arguments return the same
|
|
35
|
+
* pending promise (no double-load).
|
|
36
|
+
*/
|
|
37
|
+
export function loadEcosystemExtensions(pi, sharedHandlers, cwd = process.cwd()) {
|
|
38
|
+
if (_readyPromise)
|
|
39
|
+
return _readyPromise;
|
|
40
|
+
_readyPromise = _loadEcosystemExtensionsImpl(pi, sharedHandlers, cwd);
|
|
41
|
+
return _readyPromise;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Returns a promise that resolves when ecosystem loading has completed.
|
|
45
|
+
* If loading was never kicked off this returns a resolved promise so the
|
|
46
|
+
* `before_agent_start` handler can `await` unconditionally.
|
|
47
|
+
*/
|
|
48
|
+
export function getEcosystemReadyPromise() {
|
|
49
|
+
return _readyPromise ?? Promise.resolve();
|
|
50
|
+
}
|
|
51
|
+
/** Test-only: clear the singleton so tests can re-run loading. */
|
|
52
|
+
export function _resetEcosystemLoader() {
|
|
53
|
+
_readyPromise = null;
|
|
54
|
+
_untrustedWarned = false;
|
|
55
|
+
}
|
|
56
|
+
// ─── Implementation ─────────────────────────────────────────────────────
|
|
57
|
+
async function _loadEcosystemExtensionsImpl(pi, sharedHandlers, cwd) {
|
|
58
|
+
const extDir = path.join(cwd, ".gsd", "extensions");
|
|
59
|
+
if (!fs.existsSync(extDir))
|
|
60
|
+
return;
|
|
61
|
+
// Trust gate: refuse to load arbitrary code from untrusted project dirs.
|
|
62
|
+
if (!isProjectTrusted(cwd, getAgentDir())) {
|
|
63
|
+
if (!_untrustedWarned) {
|
|
64
|
+
_untrustedWarned = true;
|
|
65
|
+
logWarning("ecosystem", ".gsd/extensions present but project is not trusted — skipping ecosystem extensions. Run `pi trust` to opt in.");
|
|
66
|
+
}
|
|
67
|
+
return;
|
|
68
|
+
}
|
|
69
|
+
// Resolve realpath ONCE so symlink-escape detection has a stable anchor.
|
|
70
|
+
let realExtDir;
|
|
71
|
+
try {
|
|
72
|
+
realExtDir = fs.realpathSync(extDir);
|
|
73
|
+
}
|
|
74
|
+
catch (err) {
|
|
75
|
+
logWarning("ecosystem", `failed to resolve extensions dir: ${err instanceof Error ? err.message : String(err)}`);
|
|
76
|
+
return;
|
|
77
|
+
}
|
|
78
|
+
let entries;
|
|
79
|
+
try {
|
|
80
|
+
entries = fs
|
|
81
|
+
.readdirSync(extDir)
|
|
82
|
+
.filter((f) => f.endsWith(".js") || f.endsWith(".ts"))
|
|
83
|
+
.sort(); // deterministic load order
|
|
84
|
+
}
|
|
85
|
+
catch (err) {
|
|
86
|
+
logWarning("ecosystem", `failed to read extensions dir: ${err instanceof Error ? err.message : String(err)}`);
|
|
87
|
+
return;
|
|
88
|
+
}
|
|
89
|
+
// The wrapper api is built once per loader run and shared by all extensions
|
|
90
|
+
// so they all read from the same module-level snapshot.
|
|
91
|
+
const api = createGSDExtensionAPI(pi, sharedHandlers);
|
|
92
|
+
for (const entry of entries) {
|
|
93
|
+
await _loadOne(extDir, realExtDir, entry, api);
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
async function _loadOne(extDir, realExtDir, entry, api) {
|
|
97
|
+
const fullPath = path.join(extDir, entry);
|
|
98
|
+
// Symlink-escape guard: reject entries whose realpath is not under realExtDir.
|
|
99
|
+
let realFullPath;
|
|
100
|
+
try {
|
|
101
|
+
realFullPath = fs.realpathSync(fullPath);
|
|
102
|
+
}
|
|
103
|
+
catch (err) {
|
|
104
|
+
logWarning("ecosystem", `failed to resolve ${entry}: ${err instanceof Error ? err.message : String(err)}`);
|
|
105
|
+
return;
|
|
106
|
+
}
|
|
107
|
+
const realExtDirWithSep = realExtDir.endsWith(path.sep) ? realExtDir : realExtDir + path.sep;
|
|
108
|
+
if (realFullPath !== realExtDir &&
|
|
109
|
+
!realFullPath.startsWith(realExtDirWithSep)) {
|
|
110
|
+
logWarning("ecosystem", `rejecting ${entry}: realpath escapes extensions dir`);
|
|
111
|
+
return;
|
|
112
|
+
}
|
|
113
|
+
// For .ts files, require a sibling compiled .js — we do not run a TS loader
|
|
114
|
+
// in production. Drop mtime heuristics: if .js exists, prefer it; otherwise warn.
|
|
115
|
+
let importPath = realFullPath;
|
|
116
|
+
if (entry.endsWith(".ts")) {
|
|
117
|
+
const jsSibling = realFullPath.slice(0, -3) + ".js";
|
|
118
|
+
if (fs.existsSync(jsSibling)) {
|
|
119
|
+
importPath = jsSibling;
|
|
120
|
+
}
|
|
121
|
+
else {
|
|
122
|
+
logWarning("ecosystem", `${entry}: TypeScript source has no compiled .js sibling — compile it first`);
|
|
123
|
+
return;
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
let mod;
|
|
127
|
+
try {
|
|
128
|
+
mod = await import(pathToFileURL(importPath).href);
|
|
129
|
+
}
|
|
130
|
+
catch (err) {
|
|
131
|
+
logWarning("ecosystem", `failed to import ${entry}: ${err instanceof Error ? err.message : String(err)}`);
|
|
132
|
+
return;
|
|
133
|
+
}
|
|
134
|
+
const factory = mod?.default;
|
|
135
|
+
if (typeof factory !== "function") {
|
|
136
|
+
logWarning("ecosystem", `${entry}: default export is not a function`);
|
|
137
|
+
return;
|
|
138
|
+
}
|
|
139
|
+
try {
|
|
140
|
+
await factory(api);
|
|
141
|
+
}
|
|
142
|
+
catch (err) {
|
|
143
|
+
logWarning("ecosystem", `factory threw for ${entry}: ${err instanceof Error ? err.message : String(err)}`);
|
|
144
|
+
}
|
|
145
|
+
}
|