gsd-pi 2.41.0-dev.0acbce9 → 2.41.0-dev.5a170d0
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/README.md +1 -1
- package/dist/cli-web-branch.d.ts +6 -0
- package/dist/cli-web-branch.js +17 -0
- package/dist/onboarding.js +2 -1
- package/dist/resources/extensions/gsd/auto/loop.js +89 -1
- package/dist/resources/extensions/gsd/auto/phases.js +28 -10
- package/dist/resources/extensions/gsd/auto/session.js +6 -0
- package/dist/resources/extensions/gsd/auto-dashboard.js +8 -2
- package/dist/resources/extensions/gsd/auto-dispatch.js +19 -2
- package/dist/resources/extensions/gsd/auto-post-unit.js +7 -0
- package/dist/resources/extensions/gsd/auto-recovery.js +12 -4
- package/dist/resources/extensions/gsd/auto-start.js +8 -3
- package/dist/resources/extensions/gsd/auto-worktree.js +147 -13
- package/dist/resources/extensions/gsd/auto.js +64 -2
- package/dist/resources/extensions/gsd/bootstrap/db-tools.js +199 -164
- package/dist/resources/extensions/gsd/bootstrap/journal-tools.js +62 -0
- package/dist/resources/extensions/gsd/bootstrap/register-extension.js +2 -0
- package/dist/resources/extensions/gsd/bootstrap/register-hooks.js +16 -0
- package/dist/resources/extensions/gsd/bootstrap/tool-call-loop-guard.js +7 -2
- package/dist/resources/extensions/gsd/commands/catalog.js +40 -1
- package/dist/resources/extensions/gsd/commands/handlers/core.js +1 -0
- package/dist/resources/extensions/gsd/commands/handlers/ops.js +5 -0
- package/dist/resources/extensions/gsd/commands/handlers/workflow.js +146 -0
- package/dist/resources/extensions/gsd/context-injector.js +74 -0
- package/dist/resources/extensions/gsd/context-store.js +4 -3
- package/dist/resources/extensions/gsd/custom-execution-policy.js +47 -0
- package/dist/resources/extensions/gsd/custom-verification.js +145 -0
- package/dist/resources/extensions/gsd/custom-workflow-engine.js +164 -0
- package/dist/resources/extensions/gsd/dashboard-overlay.js +1 -0
- package/dist/resources/extensions/gsd/db-writer.js +5 -2
- package/dist/resources/extensions/gsd/definition-loader.js +352 -0
- package/dist/resources/extensions/gsd/detection.js +1 -1
- package/dist/resources/extensions/gsd/dev-execution-policy.js +24 -0
- package/dist/resources/extensions/gsd/dev-workflow-engine.js +82 -0
- package/dist/resources/extensions/gsd/doctor.js +11 -1
- package/dist/resources/extensions/gsd/engine-resolver.js +40 -0
- package/dist/resources/extensions/gsd/engine-types.js +8 -0
- package/dist/resources/extensions/gsd/execution-policy.js +8 -0
- package/dist/resources/extensions/gsd/exit-command.js +12 -2
- package/dist/resources/extensions/gsd/export.js +9 -13
- package/dist/resources/extensions/gsd/extension-manifest.json +2 -2
- package/dist/resources/extensions/gsd/files.js +28 -11
- package/dist/resources/extensions/gsd/forensics.js +10 -3
- package/dist/resources/extensions/gsd/git-service.js +5 -1
- package/dist/resources/extensions/gsd/graph.js +225 -0
- package/dist/resources/extensions/gsd/gsd-db.js +25 -8
- package/dist/resources/extensions/gsd/guided-flow-queue.js +1 -1
- package/dist/resources/extensions/gsd/guided-flow.js +7 -3
- package/dist/resources/extensions/gsd/journal.js +85 -0
- package/dist/resources/extensions/gsd/md-importer.js +5 -0
- package/dist/resources/extensions/gsd/milestone-ids.js +1 -1
- package/dist/resources/extensions/gsd/native-git-bridge.js +2 -2
- package/dist/resources/extensions/gsd/post-unit-hooks.js +24 -412
- package/dist/resources/extensions/gsd/preferences-types.js +1 -0
- package/dist/resources/extensions/gsd/preferences.js +1 -0
- package/dist/resources/extensions/gsd/prompt-loader.js +34 -4
- package/dist/resources/extensions/gsd/prompts/complete-milestone.md +11 -10
- package/dist/resources/extensions/gsd/prompts/discuss-headless.md +2 -2
- package/dist/resources/extensions/gsd/prompts/discuss.md +1 -1
- package/dist/resources/extensions/gsd/prompts/queue.md +1 -1
- package/dist/resources/extensions/gsd/repo-identity.js +46 -2
- package/dist/resources/extensions/gsd/rule-registry.js +489 -0
- package/dist/resources/extensions/gsd/rule-types.js +6 -0
- package/dist/resources/extensions/gsd/run-manager.js +134 -0
- package/dist/resources/extensions/gsd/service-tier.js +138 -0
- package/dist/resources/extensions/gsd/structured-data-formatter.js +2 -1
- package/dist/resources/extensions/gsd/templates/decisions.md +2 -2
- package/dist/resources/extensions/gsd/workflow-engine.js +7 -0
- package/dist/resources/extensions/gsd/workflow-templates.js +13 -1
- package/dist/resources/extensions/gsd/worktree-manager.js +20 -6
- package/dist/resources/extensions/gsd/worktree-resolver.js +19 -2
- package/dist/resources/extensions/subagent/index.js +7 -3
- package/dist/resources/extensions/voice/index.js +4 -4
- package/dist/resources/skills/create-workflow/SKILL.md +103 -0
- package/dist/resources/skills/create-workflow/references/feature-patterns.md +128 -0
- package/dist/resources/skills/create-workflow/references/verification-policies.md +76 -0
- package/dist/resources/skills/create-workflow/references/yaml-schema-v1.md +46 -0
- package/dist/resources/skills/create-workflow/templates/blog-post-pipeline.yaml +60 -0
- package/dist/resources/skills/create-workflow/templates/code-audit.yaml +60 -0
- package/dist/resources/skills/create-workflow/templates/release-checklist.yaml +66 -0
- package/dist/resources/skills/create-workflow/templates/workflow-definition.yaml +32 -0
- package/dist/resources/skills/create-workflow/workflows/create-from-scratch.md +104 -0
- package/dist/resources/skills/create-workflow/workflows/create-from-template.md +72 -0
- 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 +3 -3
- package/dist/web/standalone/.next/prerender-manifest.json +3 -3
- package/dist/web/standalone/.next/react-loadable-manifest.json +1 -1
- package/dist/web/standalone/.next/server/app/_global-error.html +2 -2
- 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/boot/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/captures/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/cleanup/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/doctor/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/export-data/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/forensics/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/history/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/hooks/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/recovery/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/settings-data/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/skill-health/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/undo/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/visualizer/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/229.js +3 -3
- package/dist/web/standalone/.next/server/middleware-build-manifest.js +1 -1
- package/dist/web/standalone/.next/server/middleware-react-loadable-manifest.js +1 -1
- package/dist/web/standalone/.next/server/pages/404.html +1 -1
- package/dist/web/standalone/.next/server/pages/500.html +2 -2
- package/dist/web/standalone/.next/server/server-reference-manifest.json +1 -1
- package/dist/web/standalone/.next/static/chunks/4024.c195dc1fdd2adbea.js +9 -0
- package/dist/web/standalone/.next/static/chunks/{webpack-9afaaebf6042a1d7.js → webpack-fa307370fcf9fb2c.js} +1 -1
- package/dist/web-mode.d.ts +2 -0
- package/dist/web-mode.js +29 -7
- package/package.json +1 -1
- package/packages/native/src/__tests__/text.test.mjs +33 -0
- package/packages/pi-coding-agent/dist/core/discovery-cache.test.js +3 -1
- package/packages/pi-coding-agent/dist/core/discovery-cache.test.js.map +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/components/login-dialog.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/components/login-dialog.js +10 -7
- package/packages/pi-coding-agent/dist/modes/interactive/components/login-dialog.js.map +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 +4 -0
- package/packages/pi-coding-agent/dist/modes/interactive/interactive-mode.js.map +1 -1
- package/packages/pi-coding-agent/src/core/discovery-cache.test.ts +4 -2
- package/packages/pi-coding-agent/src/modes/interactive/components/login-dialog.ts +11 -7
- package/packages/pi-coding-agent/src/modes/interactive/interactive-mode.ts +5 -0
- package/src/resources/extensions/gsd/auto/loop-deps.ts +5 -1
- package/src/resources/extensions/gsd/auto/loop.ts +101 -1
- package/src/resources/extensions/gsd/auto/phases.ts +30 -10
- package/src/resources/extensions/gsd/auto/session.ts +6 -0
- package/src/resources/extensions/gsd/auto/types.ts +4 -0
- package/src/resources/extensions/gsd/auto-dashboard.ts +9 -2
- package/src/resources/extensions/gsd/auto-dispatch.ts +25 -5
- package/src/resources/extensions/gsd/auto-post-unit.ts +8 -0
- package/src/resources/extensions/gsd/auto-recovery.ts +12 -4
- package/src/resources/extensions/gsd/auto-start.ts +8 -3
- package/src/resources/extensions/gsd/auto-worktree.ts +162 -18
- package/src/resources/extensions/gsd/auto.ts +71 -2
- package/src/resources/extensions/gsd/bootstrap/db-tools.ts +209 -162
- package/src/resources/extensions/gsd/bootstrap/journal-tools.ts +62 -0
- package/src/resources/extensions/gsd/bootstrap/register-extension.ts +2 -0
- package/src/resources/extensions/gsd/bootstrap/register-hooks.ts +13 -0
- package/src/resources/extensions/gsd/bootstrap/tool-call-loop-guard.ts +9 -2
- package/src/resources/extensions/gsd/commands/catalog.ts +40 -1
- package/src/resources/extensions/gsd/commands/handlers/core.ts +1 -0
- package/src/resources/extensions/gsd/commands/handlers/ops.ts +5 -0
- package/src/resources/extensions/gsd/commands/handlers/workflow.ts +164 -0
- package/src/resources/extensions/gsd/context-injector.ts +100 -0
- package/src/resources/extensions/gsd/context-store.ts +4 -3
- package/src/resources/extensions/gsd/custom-execution-policy.ts +73 -0
- package/src/resources/extensions/gsd/custom-verification.ts +180 -0
- package/src/resources/extensions/gsd/custom-workflow-engine.ts +216 -0
- package/src/resources/extensions/gsd/dashboard-overlay.ts +1 -0
- package/src/resources/extensions/gsd/db-writer.ts +6 -2
- package/src/resources/extensions/gsd/definition-loader.ts +462 -0
- package/src/resources/extensions/gsd/detection.ts +1 -1
- package/src/resources/extensions/gsd/dev-execution-policy.ts +51 -0
- package/src/resources/extensions/gsd/dev-workflow-engine.ts +110 -0
- package/src/resources/extensions/gsd/doctor.ts +12 -1
- package/src/resources/extensions/gsd/engine-resolver.ts +57 -0
- package/src/resources/extensions/gsd/engine-types.ts +71 -0
- package/src/resources/extensions/gsd/execution-policy.ts +43 -0
- package/src/resources/extensions/gsd/exit-command.ts +14 -2
- package/src/resources/extensions/gsd/export.ts +8 -15
- package/src/resources/extensions/gsd/extension-manifest.json +2 -2
- package/src/resources/extensions/gsd/files.ts +29 -12
- package/src/resources/extensions/gsd/forensics.ts +9 -3
- package/src/resources/extensions/gsd/git-service.ts +5 -4
- package/src/resources/extensions/gsd/graph.ts +312 -0
- package/src/resources/extensions/gsd/gsd-db.ts +37 -8
- package/src/resources/extensions/gsd/guided-flow-queue.ts +1 -1
- package/src/resources/extensions/gsd/guided-flow.ts +7 -3
- package/src/resources/extensions/gsd/journal.ts +134 -0
- package/src/resources/extensions/gsd/md-importer.ts +6 -0
- package/src/resources/extensions/gsd/milestone-ids.ts +1 -1
- package/src/resources/extensions/gsd/native-git-bridge.ts +2 -2
- package/src/resources/extensions/gsd/post-unit-hooks.ts +24 -462
- package/src/resources/extensions/gsd/preferences-types.ts +3 -0
- package/src/resources/extensions/gsd/preferences.ts +1 -0
- package/src/resources/extensions/gsd/prompt-loader.ts +35 -4
- package/src/resources/extensions/gsd/prompts/complete-milestone.md +11 -10
- package/src/resources/extensions/gsd/prompts/discuss-headless.md +2 -2
- package/src/resources/extensions/gsd/prompts/discuss.md +1 -1
- package/src/resources/extensions/gsd/prompts/queue.md +1 -1
- package/src/resources/extensions/gsd/repo-identity.ts +47 -2
- package/src/resources/extensions/gsd/rule-registry.ts +599 -0
- package/src/resources/extensions/gsd/rule-types.ts +68 -0
- package/src/resources/extensions/gsd/run-manager.ts +180 -0
- package/src/resources/extensions/gsd/service-tier.ts +171 -0
- package/src/resources/extensions/gsd/structured-data-formatter.ts +3 -1
- package/src/resources/extensions/gsd/templates/decisions.md +2 -2
- package/src/resources/extensions/gsd/tests/auto-loop.test.ts +103 -120
- package/src/resources/extensions/gsd/tests/auto-recovery.test.ts +85 -0
- package/src/resources/extensions/gsd/tests/auto-secrets-gate.test.ts +2 -2
- package/src/resources/extensions/gsd/tests/auto-worktree-milestone-merge.test.ts +202 -0
- package/src/resources/extensions/gsd/tests/bundled-workflow-defs.test.ts +180 -0
- package/src/resources/extensions/gsd/tests/captures.test.ts +12 -1
- package/src/resources/extensions/gsd/tests/commands-workflow-custom.test.ts +283 -0
- package/src/resources/extensions/gsd/tests/context-injector.test.ts +313 -0
- package/src/resources/extensions/gsd/tests/context-store.test.ts +10 -5
- package/src/resources/extensions/gsd/tests/continue-here.test.ts +20 -20
- package/src/resources/extensions/gsd/tests/custom-engine-loop-integration.test.ts +540 -0
- package/src/resources/extensions/gsd/tests/custom-verification.test.ts +382 -0
- package/src/resources/extensions/gsd/tests/custom-workflow-engine.test.ts +339 -0
- package/src/resources/extensions/gsd/tests/dashboard-custom-engine.test.ts +87 -0
- package/src/resources/extensions/gsd/tests/db-writer.test.ts +10 -0
- package/src/resources/extensions/gsd/tests/definition-loader.test.ts +778 -0
- package/src/resources/extensions/gsd/tests/dev-engine-wrapper.test.ts +318 -0
- package/src/resources/extensions/gsd/tests/doctor-completion-deferral.test.ts +15 -10
- package/src/resources/extensions/gsd/tests/doctor-fixlevel.test.ts +5 -4
- package/src/resources/extensions/gsd/tests/doctor-roadmap-summary-atomicity.test.ts +167 -0
- package/src/resources/extensions/gsd/tests/doctor-task-done-missing-summary-slice-loop.test.ts +174 -0
- package/src/resources/extensions/gsd/tests/e2e-workflow-pipeline-integration.test.ts +476 -0
- package/src/resources/extensions/gsd/tests/engine-interfaces-contract.test.ts +271 -0
- package/src/resources/extensions/gsd/tests/exit-command.test.ts +55 -0
- package/src/resources/extensions/gsd/tests/graph-operations.test.ts +599 -0
- package/src/resources/extensions/gsd/tests/gsd-db.test.ts +8 -1
- package/src/resources/extensions/gsd/tests/gsd-tools.test.ts +7 -7
- package/src/resources/extensions/gsd/tests/iterate-engine-integration.test.ts +429 -0
- package/src/resources/extensions/gsd/tests/journal-integration.test.ts +513 -0
- package/src/resources/extensions/gsd/tests/journal-query-tool.test.ts +147 -0
- package/src/resources/extensions/gsd/tests/journal.test.ts +386 -0
- package/src/resources/extensions/gsd/tests/md-importer.test.ts +31 -1
- package/src/resources/extensions/gsd/tests/memory-store.test.ts +2 -2
- package/src/resources/extensions/gsd/tests/milestone-id-reservation.test.ts +1 -1
- package/src/resources/extensions/gsd/tests/parsers.test.ts +110 -0
- package/src/resources/extensions/gsd/tests/preferences.test.ts +47 -25
- package/src/resources/extensions/gsd/tests/prompt-db.test.ts +3 -1
- package/src/resources/extensions/gsd/tests/repo-identity-worktree.test.ts +61 -1
- package/src/resources/extensions/gsd/tests/routing-history.test.ts +11 -22
- package/src/resources/extensions/gsd/tests/rule-registry.test.ts +413 -0
- package/src/resources/extensions/gsd/tests/run-manager.test.ts +229 -0
- package/src/resources/extensions/gsd/tests/service-tier.test.ts +98 -0
- package/src/resources/extensions/gsd/tests/skill-lifecycle.test.ts +2 -2
- package/src/resources/extensions/gsd/tests/stalled-tool-recovery.test.ts +102 -0
- package/src/resources/extensions/gsd/tests/structured-data-formatter.test.ts +4 -3
- package/src/resources/extensions/gsd/tests/tool-call-loop-guard.test.ts +45 -0
- package/src/resources/extensions/gsd/tests/tool-naming.test.ts +117 -0
- package/src/resources/extensions/gsd/tests/triage-dispatch.test.ts +6 -1
- package/src/resources/extensions/gsd/tests/windows-path-normalization.test.ts +99 -0
- package/src/resources/extensions/gsd/tests/worktree-db-integration.test.ts +1 -0
- package/src/resources/extensions/gsd/tests/worktree-db.test.ts +4 -0
- package/src/resources/extensions/gsd/tests/worktree-health-dispatch.test.ts +178 -0
- package/src/resources/extensions/gsd/tests/worktree-manager.test.ts +195 -105
- package/src/resources/extensions/gsd/tests/worktree-resolver.test.ts +78 -3
- package/src/resources/extensions/gsd/tests/worktree-symlink-removal.test.ts +140 -0
- package/src/resources/extensions/gsd/tests/worktree-sync-milestones.test.ts +74 -0
- package/src/resources/extensions/gsd/types.ts +3 -0
- package/src/resources/extensions/gsd/workflow-engine.ts +38 -0
- package/src/resources/extensions/gsd/workflow-templates.ts +12 -1
- package/src/resources/extensions/gsd/worktree-manager.ts +21 -6
- package/src/resources/extensions/gsd/worktree-resolver.ts +30 -9
- package/src/resources/extensions/subagent/index.ts +7 -3
- package/src/resources/extensions/voice/index.ts +4 -4
- package/src/resources/skills/create-workflow/SKILL.md +103 -0
- package/src/resources/skills/create-workflow/references/feature-patterns.md +128 -0
- package/src/resources/skills/create-workflow/references/verification-policies.md +76 -0
- package/src/resources/skills/create-workflow/references/yaml-schema-v1.md +46 -0
- package/src/resources/skills/create-workflow/templates/blog-post-pipeline.yaml +60 -0
- package/src/resources/skills/create-workflow/templates/code-audit.yaml +60 -0
- package/src/resources/skills/create-workflow/templates/release-checklist.yaml +66 -0
- package/src/resources/skills/create-workflow/templates/workflow-definition.yaml +32 -0
- package/src/resources/skills/create-workflow/workflows/create-from-scratch.md +104 -0
- package/src/resources/skills/create-workflow/workflows/create-from-template.md +72 -0
- package/dist/web/standalone/.next/static/chunks/4024.279c423e4661ece1.js +0 -9
- /package/dist/web/standalone/.next/static/{SwbKZ7JPNFlEmU4f8pKEv → K7GYOOPvQWX6TKYEKhODM}/_buildManifest.js +0 -0
- /package/dist/web/standalone/.next/static/{SwbKZ7JPNFlEmU4f8pKEv → K7GYOOPvQWX6TKYEKhODM}/_ssgManifest.js +0 -0
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* run-manager.ts — Create and list isolated workflow run directories.
|
|
3
|
+
*
|
|
4
|
+
* Each run lives under `.gsd/workflow-runs/<name>/<timestamp>/` and contains:
|
|
5
|
+
* - DEFINITION.yaml — frozen snapshot of the workflow definition at run-creation time
|
|
6
|
+
* - GRAPH.yaml — initialized step graph with all steps pending
|
|
7
|
+
* - PARAMS.json — (optional) parameter overrides used for this run
|
|
8
|
+
*
|
|
9
|
+
* Observability:
|
|
10
|
+
* - All run state is on disk in human-readable YAML/JSON — inspectable with cat/less.
|
|
11
|
+
* - `listRuns()` returns structured metadata including step counts and overall status.
|
|
12
|
+
* - Timestamp directory names are filesystem-safe (ISO with hyphens replacing colons).
|
|
13
|
+
* - Errors include the full path context for diagnosis.
|
|
14
|
+
*/
|
|
15
|
+
|
|
16
|
+
import { mkdirSync, writeFileSync, existsSync, readdirSync, statSync } from "node:fs";
|
|
17
|
+
import { join } from "node:path";
|
|
18
|
+
import { stringify } from "yaml";
|
|
19
|
+
import { loadDefinition, substituteParams } from "./definition-loader.js";
|
|
20
|
+
import { initializeGraph, writeGraph, readGraph } from "./graph.js";
|
|
21
|
+
import type { WorkflowDefinition } from "./definition-loader.js";
|
|
22
|
+
import type { WorkflowGraph } from "./graph.js";
|
|
23
|
+
|
|
24
|
+
// ─── Types ───────────────────────────────────────────────────────────────
|
|
25
|
+
|
|
26
|
+
export interface RunMetadata {
|
|
27
|
+
/** Workflow definition name. */
|
|
28
|
+
name: string;
|
|
29
|
+
/** Filesystem-safe timestamp string used as dir name. */
|
|
30
|
+
timestamp: string;
|
|
31
|
+
/** Full path to the run directory. */
|
|
32
|
+
runDir: string;
|
|
33
|
+
/** Step counts derived from GRAPH.yaml. */
|
|
34
|
+
steps: { total: number; completed: number; pending: number; active: number };
|
|
35
|
+
/** Overall status derived from step states. */
|
|
36
|
+
status: "pending" | "running" | "complete";
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
// ─── Constants ───────────────────────────────────────────────────────────
|
|
40
|
+
|
|
41
|
+
const RUNS_DIR = "workflow-runs";
|
|
42
|
+
const DEFS_DIR = "workflow-defs";
|
|
43
|
+
|
|
44
|
+
// ─── Helpers ─────────────────────────────────────────────────────────────
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* Generate a filesystem-safe timestamp: `YYYY-MM-DDTHH-MM-SS`.
|
|
48
|
+
* Replaces colons with hyphens so the string is safe as a directory name
|
|
49
|
+
* on all platforms (Windows forbids colons in paths).
|
|
50
|
+
*/
|
|
51
|
+
function makeTimestamp(date: Date = new Date()): string {
|
|
52
|
+
return date.toISOString().replace(/:/g, "-").replace(/\.\d{3}Z$/, "");
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* Derive overall status from a graph's step statuses.
|
|
57
|
+
*/
|
|
58
|
+
function deriveStatus(graph: WorkflowGraph): "pending" | "running" | "complete" {
|
|
59
|
+
const hasActive = graph.steps.some((s) => s.status === "active");
|
|
60
|
+
const allDone = graph.steps.every(
|
|
61
|
+
(s) => s.status === "complete" || s.status === "expanded",
|
|
62
|
+
);
|
|
63
|
+
if (allDone) return "complete";
|
|
64
|
+
if (hasActive) return "running";
|
|
65
|
+
return "pending";
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
// ─── Public API ──────────────────────────────────────────────────────────
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* Create a new isolated run directory for a workflow definition.
|
|
72
|
+
*
|
|
73
|
+
* 1. Loads the definition from `<basePath>/.gsd/workflow-defs/<defName>.yaml`
|
|
74
|
+
* 2. Applies parameter substitution if overrides are provided
|
|
75
|
+
* 3. Creates `<basePath>/.gsd/workflow-runs/<defName>/<timestamp>/`
|
|
76
|
+
* 4. Writes frozen DEFINITION.yaml, initialized GRAPH.yaml, and optional PARAMS.json
|
|
77
|
+
*
|
|
78
|
+
* @param basePath — project root directory
|
|
79
|
+
* @param defName — definition filename (without .yaml extension)
|
|
80
|
+
* @param overrides — optional parameter overrides (merged with definition defaults)
|
|
81
|
+
* @returns Full path to the created run directory
|
|
82
|
+
* @throws Error if the definition file doesn't exist or is invalid
|
|
83
|
+
*/
|
|
84
|
+
export function createRun(
|
|
85
|
+
basePath: string,
|
|
86
|
+
defName: string,
|
|
87
|
+
overrides?: Record<string, string>,
|
|
88
|
+
): string {
|
|
89
|
+
const defsDir = join(basePath, ".gsd", DEFS_DIR);
|
|
90
|
+
|
|
91
|
+
// Load and validate the definition
|
|
92
|
+
const rawDef = loadDefinition(defsDir, defName);
|
|
93
|
+
|
|
94
|
+
// Apply parameter substitution if overrides provided
|
|
95
|
+
const def: WorkflowDefinition = overrides
|
|
96
|
+
? substituteParams(rawDef, overrides)
|
|
97
|
+
: substituteParams(rawDef); // still resolve default params if any
|
|
98
|
+
|
|
99
|
+
// Create the run directory
|
|
100
|
+
const timestamp = makeTimestamp();
|
|
101
|
+
const runDir = join(basePath, ".gsd", RUNS_DIR, defName, timestamp);
|
|
102
|
+
mkdirSync(runDir, { recursive: true });
|
|
103
|
+
|
|
104
|
+
// Freeze the definition as DEFINITION.yaml
|
|
105
|
+
writeFileSync(join(runDir, "DEFINITION.yaml"), stringify(def), "utf-8");
|
|
106
|
+
|
|
107
|
+
// Initialize and write GRAPH.yaml
|
|
108
|
+
const graph = initializeGraph(def);
|
|
109
|
+
writeGraph(runDir, graph);
|
|
110
|
+
|
|
111
|
+
// Write PARAMS.json if overrides were provided
|
|
112
|
+
if (overrides && Object.keys(overrides).length > 0) {
|
|
113
|
+
writeFileSync(
|
|
114
|
+
join(runDir, "PARAMS.json"),
|
|
115
|
+
JSON.stringify(overrides, null, 2),
|
|
116
|
+
"utf-8",
|
|
117
|
+
);
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
return runDir;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
/**
|
|
124
|
+
* List existing workflow runs with metadata.
|
|
125
|
+
*
|
|
126
|
+
* Scans `<basePath>/.gsd/workflow-runs/` for run directories. Each run's
|
|
127
|
+
* GRAPH.yaml is read to derive step counts and overall status.
|
|
128
|
+
*
|
|
129
|
+
* @param basePath — project root directory
|
|
130
|
+
* @param defName — optional filter: only list runs for this definition name
|
|
131
|
+
* @returns Array of run metadata, sorted newest-first within each definition
|
|
132
|
+
*/
|
|
133
|
+
export function listRuns(basePath: string, defName?: string): RunMetadata[] {
|
|
134
|
+
const runsRoot = join(basePath, ".gsd", RUNS_DIR);
|
|
135
|
+
if (!existsSync(runsRoot)) return [];
|
|
136
|
+
|
|
137
|
+
const results: RunMetadata[] = [];
|
|
138
|
+
|
|
139
|
+
// Get workflow name directories
|
|
140
|
+
const nameDirs = defName ? [defName] : readdirSync(runsRoot).filter((entry) => {
|
|
141
|
+
const full = join(runsRoot, entry);
|
|
142
|
+
return statSync(full).isDirectory();
|
|
143
|
+
});
|
|
144
|
+
|
|
145
|
+
for (const name of nameDirs) {
|
|
146
|
+
const nameDir = join(runsRoot, name);
|
|
147
|
+
if (!existsSync(nameDir)) continue;
|
|
148
|
+
|
|
149
|
+
const timestamps = readdirSync(nameDir).filter((entry) => {
|
|
150
|
+
const full = join(nameDir, entry);
|
|
151
|
+
return statSync(full).isDirectory();
|
|
152
|
+
});
|
|
153
|
+
|
|
154
|
+
// Sort newest-first (ISO strings sort lexicographically)
|
|
155
|
+
timestamps.sort().reverse();
|
|
156
|
+
|
|
157
|
+
for (const ts of timestamps) {
|
|
158
|
+
const runDir = join(nameDir, ts);
|
|
159
|
+
try {
|
|
160
|
+
const graph = readGraph(runDir);
|
|
161
|
+
const total = graph.steps.length;
|
|
162
|
+
const completed = graph.steps.filter((s) => s.status === "complete").length;
|
|
163
|
+
const pending = graph.steps.filter((s) => s.status === "pending").length;
|
|
164
|
+
const active = graph.steps.filter((s) => s.status === "active").length;
|
|
165
|
+
|
|
166
|
+
results.push({
|
|
167
|
+
name,
|
|
168
|
+
timestamp: ts,
|
|
169
|
+
runDir,
|
|
170
|
+
steps: { total, completed, pending, active },
|
|
171
|
+
status: deriveStatus(graph),
|
|
172
|
+
});
|
|
173
|
+
} catch {
|
|
174
|
+
// Skip runs with invalid/missing GRAPH.yaml
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
return results;
|
|
180
|
+
}
|
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Service Tier — gating, status formatting, icon resolution, and
|
|
3
|
+
* the /gsd fast command handler.
|
|
4
|
+
*
|
|
5
|
+
* Service tiers (priority/flex) are an OpenAI feature that only applies
|
|
6
|
+
* to gpt-5.4 variants. This module centralizes the model-gating logic
|
|
7
|
+
* so that icons, preferences, and the before_provider_request hook all
|
|
8
|
+
* use a single source of truth.
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
import type { ExtensionCommandContext } from "@gsd/pi-coding-agent";
|
|
12
|
+
|
|
13
|
+
import { existsSync, readFileSync } from "node:fs";
|
|
14
|
+
import { saveFile } from "./files.js";
|
|
15
|
+
import {
|
|
16
|
+
getGlobalGSDPreferencesPath,
|
|
17
|
+
loadEffectiveGSDPreferences,
|
|
18
|
+
loadGlobalGSDPreferences,
|
|
19
|
+
} from "./preferences.js";
|
|
20
|
+
import { ensurePreferencesFile, serializePreferencesToFrontmatter } from "./commands-prefs-wizard.js";
|
|
21
|
+
|
|
22
|
+
// ─── Types ───────────────────────────────────────────────────────────────────
|
|
23
|
+
|
|
24
|
+
export type ServiceTierSetting = "priority" | "flex" | undefined;
|
|
25
|
+
|
|
26
|
+
// ─── Gating ──────────────────────────────────────────────────────────────────
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Returns true when the given model ID supports OpenAI service tiers.
|
|
30
|
+
* Currently only gpt-5.4 variants qualify.
|
|
31
|
+
*/
|
|
32
|
+
export function supportsServiceTier(modelId: string): boolean {
|
|
33
|
+
if (!modelId) return false;
|
|
34
|
+
// Strip provider prefix if present (e.g. "openai/gpt-5.4" → "gpt-5.4")
|
|
35
|
+
const bare = modelId.includes("/") ? modelId.split("/").pop()! : modelId;
|
|
36
|
+
return bare.startsWith("gpt-5.4");
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
// ─── Status Formatting ───────────────────────────────────────────────────────
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Human-readable description of the current service tier setting.
|
|
43
|
+
*/
|
|
44
|
+
export function formatServiceTierStatus(tier: ServiceTierSetting): string {
|
|
45
|
+
if (!tier) {
|
|
46
|
+
return [
|
|
47
|
+
"Service tier: disabled",
|
|
48
|
+
"",
|
|
49
|
+
"Usage:",
|
|
50
|
+
" /gsd fast on Set to priority (2x cost, faster)",
|
|
51
|
+
" /gsd fast flex Set to flex (0.5x cost, slower)",
|
|
52
|
+
" /gsd fast off Disable service tier",
|
|
53
|
+
"",
|
|
54
|
+
"Only affects gpt-5.4 models.",
|
|
55
|
+
].join("\n");
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
const label = tier === "priority" ? "priority (2x cost, faster)" : "flex (0.5x cost, slower)";
|
|
59
|
+
return [
|
|
60
|
+
`Service tier: ${label}`,
|
|
61
|
+
"",
|
|
62
|
+
"Usage:",
|
|
63
|
+
" /gsd fast on Set to priority (2x cost, faster)",
|
|
64
|
+
" /gsd fast flex Set to flex (0.5x cost, slower)",
|
|
65
|
+
" /gsd fast off Disable service tier",
|
|
66
|
+
"",
|
|
67
|
+
"Only affects gpt-5.4 models.",
|
|
68
|
+
].join("\n");
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
// ─── Icon Resolution ─────────────────────────────────────────────────────────
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* Returns the appropriate icon for the active service tier and model.
|
|
75
|
+
* Returns empty string when the tier is inactive or the model doesn't
|
|
76
|
+
* support service tiers.
|
|
77
|
+
*/
|
|
78
|
+
export function resolveServiceTierIcon(tier: ServiceTierSetting, modelId: string): string {
|
|
79
|
+
if (!tier || !supportsServiceTier(modelId)) return "";
|
|
80
|
+
return tier === "priority" ? "⚡" : "💰";
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
// ─── Preference Read ─────────────────────────────────────────────────────────
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* Read the effective service_tier setting from preferences.
|
|
87
|
+
*/
|
|
88
|
+
export function getEffectiveServiceTier(): ServiceTierSetting {
|
|
89
|
+
const prefs = loadEffectiveGSDPreferences()?.preferences;
|
|
90
|
+
const raw = prefs?.service_tier;
|
|
91
|
+
if (raw === "priority" || raw === "flex") return raw;
|
|
92
|
+
return undefined;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
// ─── Preference Write ────────────────────────────────────────────────────────
|
|
96
|
+
|
|
97
|
+
function extractBodyAfterFrontmatter(content: string): string | null {
|
|
98
|
+
const start = content.startsWith("---\n") ? 4 : content.startsWith("---\r\n") ? 5 : -1;
|
|
99
|
+
if (start === -1) return null;
|
|
100
|
+
const closingIdx = content.indexOf("\n---", start);
|
|
101
|
+
if (closingIdx === -1) return null;
|
|
102
|
+
const after = content.slice(closingIdx + 4);
|
|
103
|
+
return after.trim() ? after : null;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
async function writeGlobalServiceTier(
|
|
107
|
+
ctx: ExtensionCommandContext,
|
|
108
|
+
tier: ServiceTierSetting,
|
|
109
|
+
): Promise<void> {
|
|
110
|
+
const path = getGlobalGSDPreferencesPath();
|
|
111
|
+
await ensurePreferencesFile(path, ctx, "global");
|
|
112
|
+
|
|
113
|
+
const existing = loadGlobalGSDPreferences();
|
|
114
|
+
const prefs: Record<string, unknown> = existing?.preferences ? { ...existing.preferences } : {};
|
|
115
|
+
prefs.version = prefs.version || 1;
|
|
116
|
+
|
|
117
|
+
if (tier) {
|
|
118
|
+
prefs.service_tier = tier;
|
|
119
|
+
} else {
|
|
120
|
+
delete prefs.service_tier;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
const frontmatter = serializePreferencesToFrontmatter(prefs);
|
|
124
|
+
let body = "\n# GSD Skill Preferences\n\nSee `~/.gsd/agent/extensions/gsd/docs/preferences-reference.md` for full field documentation and examples.\n";
|
|
125
|
+
if (existsSync(path)) {
|
|
126
|
+
const preserved = extractBodyAfterFrontmatter(readFileSync(path, "utf-8"));
|
|
127
|
+
if (preserved) body = preserved;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
await saveFile(path, `---\n${frontmatter}---${body}`);
|
|
131
|
+
await ctx.waitForIdle();
|
|
132
|
+
await ctx.reload();
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
// ─── Command Handler ─────────────────────────────────────────────────────────
|
|
136
|
+
|
|
137
|
+
/**
|
|
138
|
+
* Handle `/gsd fast [on|off|flex|status]`.
|
|
139
|
+
*/
|
|
140
|
+
export async function handleFast(args: string, ctx: ExtensionCommandContext): Promise<void> {
|
|
141
|
+
const trimmed = args.trim().toLowerCase();
|
|
142
|
+
|
|
143
|
+
if (!trimmed || trimmed === "status") {
|
|
144
|
+
const tier = getEffectiveServiceTier();
|
|
145
|
+
ctx.ui.notify(formatServiceTierStatus(tier), "info");
|
|
146
|
+
return;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
if (trimmed === "on") {
|
|
150
|
+
await writeGlobalServiceTier(ctx, "priority");
|
|
151
|
+
ctx.ui.notify("Service tier set to priority (2x cost, faster responses). Only affects gpt-5.4 models.", "info");
|
|
152
|
+
return;
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
if (trimmed === "off") {
|
|
156
|
+
await writeGlobalServiceTier(ctx, undefined);
|
|
157
|
+
ctx.ui.notify("Service tier disabled.", "info");
|
|
158
|
+
return;
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
if (trimmed === "flex") {
|
|
162
|
+
await writeGlobalServiceTier(ctx, "flex");
|
|
163
|
+
ctx.ui.notify("Service tier set to flex (0.5x cost, slower responses). Only affects gpt-5.4 models.", "info");
|
|
164
|
+
return;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
ctx.ui.notify(
|
|
168
|
+
"Usage: /gsd fast [on|off|flex|status]\n\n on Priority tier (2x cost, faster)\n off Disable service tier\n flex Flex tier (0.5x cost, slower)\n status Show current setting",
|
|
169
|
+
"warning",
|
|
170
|
+
);
|
|
171
|
+
}
|
|
@@ -25,6 +25,7 @@ interface DecisionInput {
|
|
|
25
25
|
choice: string;
|
|
26
26
|
rationale: string;
|
|
27
27
|
revisable: string;
|
|
28
|
+
made_by?: string;
|
|
28
29
|
}
|
|
29
30
|
|
|
30
31
|
interface RequirementInput {
|
|
@@ -61,6 +62,7 @@ export function formatDecisionCompact(decision: DecisionInput): string {
|
|
|
61
62
|
decision.choice,
|
|
62
63
|
decision.rationale,
|
|
63
64
|
decision.revisable,
|
|
65
|
+
decision.made_by ?? 'agent',
|
|
64
66
|
].join(" | ");
|
|
65
67
|
}
|
|
66
68
|
|
|
@@ -70,7 +72,7 @@ export function formatDecisionsCompact(decisions: DecisionInput[]): string {
|
|
|
70
72
|
return "# Decisions (compact)\n(none)";
|
|
71
73
|
}
|
|
72
74
|
|
|
73
|
-
const header = "# Decisions (compact)\nFields: id | when | scope | decision | choice | rationale | revisable";
|
|
75
|
+
const header = "# Decisions (compact)\nFields: id | when | scope | decision | choice | rationale | revisable | made_by";
|
|
74
76
|
const lines = decisions.map(formatDecisionCompact);
|
|
75
77
|
return `${header}\n\n${lines.join("\n")}`;
|
|
76
78
|
}
|
|
@@ -4,5 +4,5 @@
|
|
|
4
4
|
To reverse a decision, add a new row that supersedes it.
|
|
5
5
|
Read this file at the start of any planning or research phase. -->
|
|
6
6
|
|
|
7
|
-
| # | When | Scope | Decision | Choice | Rationale | Revisable? |
|
|
8
|
-
|
|
7
|
+
| # | When | Scope | Decision | Choice | Rationale | Revisable? | Made By |
|
|
8
|
+
|---|------|-------|----------|--------|-----------|------------|---------|
|