@gajae-code/coding-agent 0.14.2 → 0.15.0
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/CHANGELOG.md +120 -1
- package/dist/types/async/job-manager.d.ts +4 -1
- package/dist/types/autoresearch/dashboard.d.ts +29 -4
- package/dist/types/autoresearch/data-context.d.ts +25 -0
- package/dist/types/autoresearch/git.d.ts +65 -7
- package/dist/types/autoresearch/harness.d.ts +58 -0
- package/dist/types/autoresearch/prompts.d.ts +51 -0
- package/dist/types/autoresearch/runs.d.ts +173 -0
- package/dist/types/autoresearch/types.d.ts +9 -139
- package/dist/types/capability/types.d.ts +20 -0
- package/dist/types/cli/accounts-cli.d.ts +1 -0
- package/dist/types/commands/{rlm.d.ts → autoresearch.d.ts} +2 -4
- package/dist/types/config/autorouting-contract.d.ts +146 -0
- package/dist/types/config/autorouting-generator.d.ts +40 -0
- package/dist/types/config/autorouting-tier-map.d.ts +16844 -0
- package/dist/types/config/autorouting.d.ts +35 -0
- package/dist/types/config/model-discovery-manager.d.ts +8 -1
- package/dist/types/config/model-registry.d.ts +30 -1
- package/dist/types/config/provider-selection-policy.d.ts +23 -0
- package/dist/types/config/settings-schema.d.ts +61 -3
- package/dist/types/config/settings.d.ts +3 -0
- package/dist/types/coordinator/contract.d.ts +1 -1
- package/dist/types/coordinator-mcp/durability.d.ts +29 -0
- package/dist/types/coordinator-mcp/event-webhook.d.ts +50 -0
- package/dist/types/coordinator-mcp/question-state.d.ts +1 -1
- package/dist/types/coordinator-mcp/server.d.ts +14 -0
- package/dist/types/crash/index-store.d.ts +3 -0
- package/dist/types/crash/record-loader.d.ts +2 -0
- package/dist/types/crash/upstream/relay.d.ts +5 -3
- package/dist/types/cursor.d.ts +12 -0
- package/dist/types/defaults/gjc-defaults.d.ts +35 -1
- package/dist/types/defaults/gjc-skills.generated.d.ts +1 -1
- package/dist/types/discovery/helpers.d.ts +1 -1
- package/dist/types/edit/index.d.ts +2 -1
- package/dist/types/eval/py/executor.d.ts +2 -0
- package/dist/types/extensibility/extensions/loader.d.ts +32 -0
- package/dist/types/extensibility/gjc-plugins/types.d.ts +1 -1
- package/dist/types/extensibility/skills.d.ts +2 -0
- package/dist/types/gjc-runtime/autoresearch-runtime.d.ts +194 -0
- package/dist/types/gjc-runtime/gc-runtime.d.ts +1 -1
- package/dist/types/gjc-runtime/psmux-detect.d.ts +1 -1
- package/dist/types/gjc-runtime/python-transcript.d.ts +19 -0
- package/dist/types/gjc-runtime/ralplan-runtime.d.ts +2 -8
- package/dist/types/gjc-runtime/session-layout.d.ts +6 -3
- package/dist/types/gjc-runtime/state-renderer.d.ts +0 -22
- package/dist/types/gjc-runtime/state-schema.d.ts +7 -7
- package/dist/types/gjc-runtime/tmux-common.d.ts +2 -2
- package/dist/types/gjc-runtime/ultragoal-change-set.d.ts +38 -1
- package/dist/types/gjc-runtime/ultragoal-runtime.d.ts +2 -24
- package/dist/types/gjc-runtime/ultragoal-validation-policy.d.ts +73 -0
- package/dist/types/gjc-runtime/workflow-recovery-projection.d.ts +100 -0
- package/dist/types/hooks/skill-keywords.d.ts +1 -1
- package/dist/types/main.d.ts +0 -10
- package/dist/types/modes/acp/acp-agent.d.ts +13 -6
- package/dist/types/modes/components/model-selector.d.ts +14 -0
- package/dist/types/modes/components/skill-hud/render.d.ts +6 -1
- package/dist/types/modes/components/smart-routing-panel.d.ts +82 -0
- package/dist/types/modes/controllers/selector-controller.d.ts +14 -0
- package/dist/types/modes/interactive-mode.d.ts +3 -0
- package/dist/types/modes/types.d.ts +9 -0
- package/dist/types/rlm/artifacts.d.ts +4 -4
- package/dist/types/runtime/optional-runtime-services.d.ts +2 -1
- package/dist/types/runtime/workspace-tree-service.d.ts +5 -1
- package/dist/types/runtime-mcp/config.d.ts +6 -0
- package/dist/types/runtime-mcp/manager.d.ts +10 -0
- package/dist/types/sdk/acp/adapter.d.ts +0 -4
- package/dist/types/sdk/broker/broker.d.ts +1 -1
- package/dist/types/sdk/broker/lifecycle.d.ts +57 -2
- package/dist/types/sdk/broker/session-index.d.ts +15 -0
- package/dist/types/sdk/bus/chat-daemon-control.d.ts +6 -0
- package/dist/types/sdk/bus/chat-daemon-runtime.d.ts +4 -0
- package/dist/types/sdk/bus/index.d.ts +8 -0
- package/dist/types/sdk/bus/kind-aware-reconciliation.d.ts +2 -0
- package/dist/types/sdk/bus/telegram-daemon-contract.d.ts +12 -2
- package/dist/types/sdk/client/client.d.ts +39 -4
- package/dist/types/sdk/host/host.d.ts +1 -0
- package/dist/types/sdk/host/internal-autorouting-state.d.ts +3 -0
- package/dist/types/sdk/host/model-pin.d.ts +29 -0
- package/dist/types/sdk/host/session-runtime.d.ts +2 -1
- package/dist/types/sdk/lifecycle-session.d.ts +13 -0
- package/dist/types/sdk/router/session-router.d.ts +27 -1
- package/dist/types/sdk/session.d.ts +11 -1
- package/dist/types/session/agent-session.d.ts +36 -6
- package/dist/types/session/artifacts.d.ts +16 -1
- package/dist/types/session/internal/managed-session-storage.d.ts +7 -0
- package/dist/types/session/session-manager.d.ts +84 -2
- package/dist/types/session/session-staging-paths.d.ts +3 -0
- package/dist/types/skill-state/canonical-skills.d.ts +1 -1
- package/dist/types/skill-state/workflow-hud.d.ts +12 -21
- package/dist/types/skill-state/workflow-mutation-guard.d.ts +1 -0
- package/dist/types/slash-commands/helpers/autorouting-status.d.ts +8 -0
- package/dist/types/system-prompt.d.ts +23 -0
- package/dist/types/task/executor.d.ts +35 -4
- package/dist/types/task/index.d.ts +17 -3
- package/dist/types/task/receipt.d.ts +3 -1
- package/dist/types/task/types.d.ts +144 -0
- package/dist/types/tools/atomic-file-write.d.ts +72 -0
- package/dist/types/tools/descriptors.d.ts +1 -0
- package/dist/types/tools/index.d.ts +36 -1
- package/dist/types/tools/move-session.d.ts +40 -0
- package/dist/types/tools/python.d.ts +12 -0
- package/dist/types/tools/resource-gc.d.ts +0 -3
- package/dist/types/tools/search.d.ts +8 -1
- package/dist/types/tools/skill.d.ts +9 -4
- package/dist/types/tools/subagent.d.ts +33 -3
- package/dist/types/utils/xml-escape.d.ts +2 -0
- package/dist/types/workflow/workflow-intent-diff.d.ts +2 -2
- package/dist/types/workflow/workflow-intent-report-consumer.d.ts +1 -1
- package/package.json +11 -12
- package/scripts/build-sdk-package-smoke.ts +7 -5
- package/scripts/check-autorouting-tier-map.ts +183 -0
- package/scripts/generate-sdk-operation-inventory.ts +12 -0
- package/scripts/generate-tool-catalog.ts +40 -5
- package/src/async/job-manager.ts +5 -2
- package/src/autoresearch/dashboard.ts +134 -314
- package/src/autoresearch/data-context.ts +35 -0
- package/src/autoresearch/git.ts +186 -26
- package/src/autoresearch/{helpers.ts → harness.ts} +65 -40
- package/src/autoresearch/{prompt-setup.md → prompts/prompt-setup.md} +7 -7
- package/src/autoresearch/prompts/prompt.md +103 -0
- package/src/autoresearch/prompts.ts +126 -0
- package/src/autoresearch/runs.ts +708 -0
- package/src/autoresearch/types.ts +9 -150
- package/src/capability/index.ts +4 -4
- package/src/capability/types.ts +20 -0
- package/src/cli/accounts-cli.ts +21 -5
- package/src/cli/config-cli.ts +25 -1
- package/src/cli/fast-help.ts +1 -2
- package/src/cli/list-models.ts +5 -8
- package/src/cli/setup-cli.ts +8 -0
- package/src/cli.ts +2 -21
- package/src/commands/autoresearch.ts +33 -0
- package/src/commands/coordinator.ts +15 -0
- package/src/commands/launch.ts +2 -4
- package/src/commands/quick-lane.ts +1 -1
- package/src/commands/sdk.ts +24 -0
- package/src/commands/state.ts +1 -1
- package/src/config/autorouting-contract.ts +474 -0
- package/src/config/autorouting-generator.ts +238 -0
- package/src/config/autorouting-tier-map.ts +6108 -0
- package/src/config/autorouting.ts +120 -0
- package/src/config/model-discovery-manager.ts +42 -11
- package/src/config/model-registry.ts +348 -68
- package/src/config/provider-selection-policy.ts +60 -9
- package/src/config/settings-schema.ts +195 -6
- package/src/config/settings.ts +62 -1
- package/src/config.ts +2 -3
- package/src/coordinator/contract.ts +0 -1
- package/src/coordinator-mcp/codex-handoff.ts +68 -42
- package/src/coordinator-mcp/durability.ts +200 -0
- package/src/coordinator-mcp/event-webhook.ts +278 -0
- package/src/coordinator-mcp/question-state.ts +109 -46
- package/src/coordinator-mcp/server.ts +932 -504
- package/src/crash/index-store.ts +126 -22
- package/src/crash/record-loader.ts +7 -0
- package/src/crash/upstream/relay.ts +82 -34
- package/src/cursor.ts +84 -1
- package/src/debug/index.ts +26 -0
- package/src/defaults/gjc/skills/autoresearch/SKILL.md +116 -0
- package/src/defaults/gjc/skills/autoresearch/auto-critic.md +46 -0
- package/src/defaults/gjc/skills/autoresearch/auto-iterate.md +42 -0
- package/src/defaults/gjc/skills/deep-interview/SKILL.md +17 -37
- package/src/defaults/gjc/skills/ralplan/SKILL.md +21 -18
- package/src/defaults/gjc/skills/ultragoal/SKILL.md +6 -17
- package/src/defaults/gjc/skills/ultragoal/ai-slop-cleaner.md +2 -2
- package/src/defaults/gjc-defaults.ts +89 -2
- package/src/defaults/gjc-skills.generated.ts +24 -17
- package/src/discovery/builtin.ts +18 -5
- package/src/discovery/helpers.ts +6 -6
- package/src/edit/index.ts +5 -2
- package/src/eval/py/executor.ts +8 -0
- package/src/extensibility/extensions/loader.ts +135 -13
- package/src/extensibility/extensions/wrapper.ts +1 -2
- package/src/extensibility/gjc-plugins/schema.ts +1 -1
- package/src/extensibility/runtime-skill-discovery.ts +2 -2
- package/src/extensibility/skill-management.ts +2 -3
- package/src/extensibility/skills.ts +16 -8
- package/src/gjc-runtime/autoresearch-runtime.ts +1509 -0
- package/src/gjc-runtime/gc-render.ts +0 -1
- package/src/gjc-runtime/gc-runtime.ts +1 -11
- package/src/gjc-runtime/launch-tmux.ts +3 -3
- package/src/gjc-runtime/psmux-detect.ts +2 -2
- package/src/gjc-runtime/python-transcript.ts +58 -0
- package/src/gjc-runtime/ralplan-runtime.ts +6 -18
- package/src/gjc-runtime/session-layout.ts +18 -7
- package/src/gjc-runtime/session-state-sidecar.ts +58 -9
- package/src/gjc-runtime/state-renderer.ts +0 -38
- package/src/gjc-runtime/state-runtime.ts +43 -22
- package/src/gjc-runtime/state-schema.ts +1 -1
- package/src/gjc-runtime/tmux-common.ts +7 -7
- package/src/gjc-runtime/ultragoal-change-set.ts +232 -11
- package/src/gjc-runtime/ultragoal-runtime.ts +309 -114
- package/src/gjc-runtime/ultragoal-validation-policy.ts +247 -0
- package/src/gjc-runtime/workflow-command-ref.ts +15 -11
- package/src/gjc-runtime/workflow-manifest.generated.json +413 -532
- package/src/gjc-runtime/workflow-manifest.ts +43 -83
- package/src/gjc-runtime/workflow-recovery-projection.ts +616 -0
- package/src/hooks/skill-keywords.ts +3 -3
- package/src/hooks/skill-state.ts +2 -2
- package/src/internal-urls/docs-index.generated.ts +26 -24
- package/src/lsp/index.ts +25 -5
- package/src/main.ts +2 -27
- package/src/modes/acp/acp-agent.ts +200 -75
- package/src/modes/components/model-selector.ts +216 -13
- package/src/modes/components/oauth-selector.ts +5 -5
- package/src/modes/components/skill-hud/render.ts +173 -35
- package/src/modes/components/smart-routing-panel.ts +531 -0
- package/src/modes/components/tool-status-header.ts +6 -3
- package/src/modes/controllers/command-controller.ts +17 -7
- package/src/modes/controllers/input-controller.ts +44 -9
- package/src/modes/controllers/runtime-mcp-command-controller.ts +4 -0
- package/src/modes/controllers/selector-controller.ts +298 -65
- package/src/modes/interactive-mode.ts +8 -1
- package/src/modes/shared/agent-wire/workflow-gate-types.ts +1 -1
- package/src/modes/types.ts +9 -1
- package/src/prompts/agents/planner.md +1 -1
- package/src/prompts/system/system-prompt.md +1 -1
- package/src/prompts/system/volatile-project-context.md +2 -1
- package/src/prompts/tools/move-session.md +15 -0
- package/src/prompts/tools/python.md +12 -0
- package/src/prompts/tools/skill-discovery.md +1 -1
- package/src/prompts/tools/skill.md +2 -2
- package/src/prompts/tools/task-summary.md +1 -0
- package/src/prompts/tools/task.md +6 -0
- package/src/rlm/artifacts.ts +12 -10
- package/src/runtime/optional-runtime-services.ts +3 -2
- package/src/runtime/workspace-tree-service.ts +11 -3
- package/src/runtime-mcp/config.ts +8 -1
- package/src/runtime-mcp/manager.ts +33 -0
- package/src/sdk/acp/adapter.ts +48 -1
- package/src/sdk/broker/broker.ts +30 -2
- package/src/sdk/broker/discovery.ts +217 -2
- package/src/sdk/broker/lifecycle.ts +385 -59
- package/src/sdk/broker/session-index.ts +243 -48
- package/src/sdk/broker/transport.ts +1 -0
- package/src/sdk/bus/chat-daemon-control.ts +8 -2
- package/src/sdk/bus/chat-daemon-runtime.ts +5 -0
- package/src/sdk/bus/index.ts +208 -11
- package/src/sdk/bus/kind-aware-reconciliation.ts +16 -0
- package/src/sdk/bus/reconciliation-store.ts +27 -5
- package/src/sdk/bus/telegram-daemon-contract.ts +12 -2
- package/src/sdk/client/client.ts +204 -22
- package/src/sdk/host/host.ts +16 -0
- package/src/sdk/host/internal-autorouting-state.ts +13 -0
- package/src/sdk/host/model-pin.ts +101 -0
- package/src/sdk/host/reverse-leases.ts +2 -1
- package/src/sdk/host/session-runtime.test.ts +224 -1
- package/src/sdk/host/session-runtime.ts +125 -37
- package/src/sdk/lifecycle/service.ts +3 -1
- package/src/sdk/lifecycle-session.ts +42 -1
- package/src/sdk/protocol/operation-inventory.generated.json +66 -0
- package/src/sdk/router/session-router.ts +375 -36
- package/src/sdk/session.ts +547 -47
- package/src/session/account-inventory.ts +1 -1
- package/src/session/agent-session.ts +765 -189
- package/src/session/artifacts.ts +234 -4
- package/src/session/internal/managed-session-storage.ts +91 -4
- package/src/session/provider-safety-stop-hint.ts +3 -2
- package/src/session/session-manager.ts +775 -16
- package/src/session/session-staging-paths.ts +8 -0
- package/src/setup/hermes/templates/operator-instructions.v1.md +0 -1
- package/src/setup/host-plugin-setup.ts +2 -2
- package/src/skill-state/active-state.ts +2 -2
- package/src/skill-state/canonical-skills.ts +1 -1
- package/src/skill-state/initial-phase.ts +1 -1
- package/src/skill-state/workflow-hud.ts +41 -41
- package/src/skill-state/workflow-mutation-guard.ts +26 -7
- package/src/slash-commands/builtin-registry.ts +77 -0
- package/src/slash-commands/helpers/autorouting-status.ts +55 -0
- package/src/system-prompt.ts +102 -5
- package/src/task/discovery.ts +2 -3
- package/src/task/executor.ts +617 -43
- package/src/task/index.ts +262 -15
- package/src/task/receipt.ts +30 -0
- package/src/task/render.ts +11 -1
- package/src/task/types.ts +316 -0
- package/src/tools/atomic-file-write.ts +594 -0
- package/src/tools/bisect.ts +3 -2
- package/src/tools/descriptors.test.ts +3 -0
- package/src/tools/descriptors.ts +24 -0
- package/src/tools/image-gen.ts +5 -1
- package/src/tools/index.ts +62 -5
- package/src/tools/move-session.ts +107 -0
- package/src/tools/python.ts +205 -0
- package/src/tools/read.ts +88 -15
- package/src/tools/renderers.ts +2 -0
- package/src/tools/resource-gc.ts +8 -177
- package/src/tools/search.ts +30 -6
- package/src/tools/skill-discovery.ts +1 -0
- package/src/tools/skill.ts +37 -7
- package/src/tools/subagent-render.ts +119 -13
- package/src/tools/subagent.ts +91 -74
- package/src/tools/tool-catalog.generated.ts +64 -2
- package/src/tools/write.ts +16 -12
- package/src/utils/xml-escape.ts +14 -0
- package/src/web/search/providers/codex.ts +2 -2
- package/src/workflow/workflow-intent-diff.ts +13 -12
- package/src/workflow/workflow-intent-report-consumer.ts +6 -6
- package/dist/types/autoresearch/helpers.d.ts +0 -24
- package/dist/types/autoresearch/index.d.ts +0 -2
- package/dist/types/autoresearch/state.d.ts +0 -17
- package/dist/types/autoresearch/storage.d.ts +0 -142
- package/dist/types/autoresearch/tools/init-experiment.d.ts +0 -31
- package/dist/types/autoresearch/tools/log-experiment.d.ts +0 -23
- package/dist/types/autoresearch/tools/run-experiment.d.ts +0 -8
- package/dist/types/autoresearch/tools/update-notes.d.ts +0 -12
- package/dist/types/commands/team.d.ts +0 -24
- package/dist/types/gjc-runtime/team-gc.d.ts +0 -7
- package/dist/types/gjc-runtime/team-launch.d.ts +0 -61
- package/dist/types/gjc-runtime/team-notify.d.ts +0 -45
- package/dist/types/gjc-runtime/team-runtime.d.ts +0 -336
- package/dist/types/gjc-runtime/team-store.d.ts +0 -168
- package/dist/types/gjc-runtime/team-worker-heartbeat.d.ts +0 -43
- package/dist/types/gjc-runtime/team-worker-memory-guard.d.ts +0 -92
- package/dist/types/gjc-runtime/team-workers.d.ts +0 -83
- package/dist/types/rlm/index.d.ts +0 -47
- package/dist/types/rlm/preset.d.ts +0 -23
- package/dist/types/rlm/python-tool.d.ts +0 -16
- package/src/autoresearch/command-resume.md +0 -14
- package/src/autoresearch/index.ts +0 -536
- package/src/autoresearch/prompt.md +0 -103
- package/src/autoresearch/resume-message.md +0 -10
- package/src/autoresearch/state.ts +0 -273
- package/src/autoresearch/storage.ts +0 -699
- package/src/autoresearch/tools/init-experiment.ts +0 -272
- package/src/autoresearch/tools/log-experiment.ts +0 -524
- package/src/autoresearch/tools/run-experiment.ts +0 -475
- package/src/autoresearch/tools/update-notes.ts +0 -109
- package/src/commands/rlm.ts +0 -19
- package/src/commands/team.ts +0 -238
- package/src/defaults/gjc/skills/deep-interview/auto-research-greenfield.md +0 -42
- package/src/defaults/gjc/skills/team/SKILL.md +0 -467
- package/src/gjc-runtime/team-gc.ts +0 -49
- package/src/gjc-runtime/team-launch.ts +0 -404
- package/src/gjc-runtime/team-notify.ts +0 -326
- package/src/gjc-runtime/team-runtime.ts +0 -5923
- package/src/gjc-runtime/team-store.ts +0 -878
- package/src/gjc-runtime/team-worker-heartbeat.ts +0 -149
- package/src/gjc-runtime/team-worker-memory-guard.ts +0 -363
- package/src/gjc-runtime/team-workers.ts +0 -1123
- package/src/prompts/system/rlm-report-command.md +0 -1
- package/src/prompts/system/rlm-research.md +0 -23
- package/src/rlm/index.ts +0 -365
- package/src/rlm/preset.ts +0 -76
- package/src/rlm/python-tool.ts +0 -68
|
@@ -147,26 +147,116 @@ export class ExtensionRuntime implements IExtensionRuntime {
|
|
|
147
147
|
}
|
|
148
148
|
}
|
|
149
149
|
|
|
150
|
+
/**
|
|
151
|
+
* Per-extension activation transaction over the shared runtime state.
|
|
152
|
+
*
|
|
153
|
+
* Registration writes from a factory are staged here (stage); the factory
|
|
154
|
+
* completing without throwing is the validation step; commit copies the
|
|
155
|
+
* staged mutations into the shared runtime; rollback discards them, so a
|
|
156
|
+
* factory that fails midway leaves no registration behind (issue #4718).
|
|
157
|
+
*/
|
|
158
|
+
export class ExtensionActivationScope {
|
|
159
|
+
readonly #runtime: IExtensionRuntime;
|
|
160
|
+
readonly #stagedFlagDefaults = new Map<string, boolean | string>();
|
|
161
|
+
readonly #stagedProviderRegistrations: Array<{
|
|
162
|
+
name: string;
|
|
163
|
+
config: import("./types").ProviderConfig;
|
|
164
|
+
sourceId: string;
|
|
165
|
+
}> = [];
|
|
166
|
+
#closed = false;
|
|
167
|
+
|
|
168
|
+
/** True while staged writes may still be added or committed. */
|
|
169
|
+
get open(): boolean {
|
|
170
|
+
return !this.#closed;
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
constructor(runtime: IExtensionRuntime) {
|
|
174
|
+
this.#runtime = runtime;
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
get flagValues(): Map<string, boolean | string> {
|
|
178
|
+
return this.#stagedFlagDefaults;
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
get pendingProviderRegistrations(): Array<{
|
|
182
|
+
name: string;
|
|
183
|
+
config: import("./types").ProviderConfig;
|
|
184
|
+
sourceId: string;
|
|
185
|
+
}> {
|
|
186
|
+
return this.#stagedProviderRegistrations;
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
/**
|
|
190
|
+
* Publish the staged mutations into the shared runtime as one transaction.
|
|
191
|
+
*
|
|
192
|
+
* Prior state is journaled before any live mutation so a throw partway
|
|
193
|
+
* through publication is undone before it escapes: flag entries that did
|
|
194
|
+
* not exist are removed, overwritten entries are restored, and the
|
|
195
|
+
* provider queue is truncated to its prior length. The scope only becomes
|
|
196
|
+
* terminal once publication has fully succeeded, so a failed commit
|
|
197
|
+
* leaves the shared runtime exactly as it was (issue #4718).
|
|
198
|
+
*/
|
|
199
|
+
commit(): void {
|
|
200
|
+
if (this.#closed) return;
|
|
201
|
+
const priorFlagEntries = new Map<string, { existed: true; value: boolean | string } | { existed: false }>();
|
|
202
|
+
for (const name of this.#stagedFlagDefaults.keys()) {
|
|
203
|
+
// Flag values are `boolean | string`, so `undefined` means absent.
|
|
204
|
+
const current = this.#runtime.flagValues.get(name);
|
|
205
|
+
priorFlagEntries.set(name, current === undefined ? { existed: false } : { existed: true, value: current });
|
|
206
|
+
}
|
|
207
|
+
const priorProviderCount = this.#runtime.pendingProviderRegistrations.length;
|
|
208
|
+
|
|
209
|
+
try {
|
|
210
|
+
for (const [name, value] of this.#stagedFlagDefaults) {
|
|
211
|
+
this.#runtime.flagValues.set(name, value);
|
|
212
|
+
}
|
|
213
|
+
for (const registration of this.#stagedProviderRegistrations) {
|
|
214
|
+
this.#runtime.pendingProviderRegistrations.push(registration);
|
|
215
|
+
}
|
|
216
|
+
} catch (err) {
|
|
217
|
+
for (const [name, prior] of priorFlagEntries) {
|
|
218
|
+
if (prior.existed) {
|
|
219
|
+
this.#runtime.flagValues.set(name, prior.value);
|
|
220
|
+
} else {
|
|
221
|
+
this.#runtime.flagValues.delete(name);
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
this.#runtime.pendingProviderRegistrations.length = priorProviderCount;
|
|
225
|
+
this.#close();
|
|
226
|
+
throw err;
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
this.#closed = true;
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
rollback(): void {
|
|
233
|
+
if (this.#closed) return;
|
|
234
|
+
this.#close();
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
/** Mark the scope terminal and drop the staged copies. */
|
|
238
|
+
#close(): void {
|
|
239
|
+
this.#closed = true;
|
|
240
|
+
this.#stagedFlagDefaults.clear();
|
|
241
|
+
this.#stagedProviderRegistrations.length = 0;
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
|
|
150
245
|
/**
|
|
151
246
|
* ExtensionAPI implementation for an extension.
|
|
152
247
|
* Registration methods write to the extension object.
|
|
153
248
|
* Action methods delegate to the shared runtime.
|
|
154
249
|
*/
|
|
155
|
-
class ConcreteExtensionAPI implements ExtensionAPI
|
|
250
|
+
class ConcreteExtensionAPI implements ExtensionAPI {
|
|
156
251
|
readonly logger = logger;
|
|
157
252
|
readonly typebox = TypeBox;
|
|
158
253
|
readonly zod = Zod;
|
|
159
|
-
readonly flagValues = new Map<string, boolean | string>();
|
|
160
|
-
readonly pendingProviderRegistrations: Array<{
|
|
161
|
-
name: string;
|
|
162
|
-
config: import("./types").ProviderConfig;
|
|
163
|
-
sourceId: string;
|
|
164
|
-
}> = [];
|
|
165
254
|
|
|
166
255
|
constructor(
|
|
167
256
|
public readonly pi: typeof import("@gajae-code/coding-agent"),
|
|
168
257
|
private readonly extension: Extension,
|
|
169
258
|
private readonly runtime: IExtensionRuntime,
|
|
259
|
+
private readonly activation: ExtensionActivationScope,
|
|
170
260
|
private readonly cwd: string,
|
|
171
261
|
public readonly events: EventBus,
|
|
172
262
|
) {}
|
|
@@ -218,7 +308,7 @@ class ConcreteExtensionAPI implements ExtensionAPI, IExtensionRuntime {
|
|
|
218
308
|
): void {
|
|
219
309
|
this.extension.flags.set(name, { name, extensionPath: this.extension.path, ...options });
|
|
220
310
|
if (options.default !== undefined) {
|
|
221
|
-
this.
|
|
311
|
+
this.activation.flagValues.set(name, options.default);
|
|
222
312
|
}
|
|
223
313
|
}
|
|
224
314
|
|
|
@@ -228,7 +318,14 @@ class ConcreteExtensionAPI implements ExtensionAPI, IExtensionRuntime {
|
|
|
228
318
|
|
|
229
319
|
getFlag(name: string): boolean | string | undefined {
|
|
230
320
|
if (!this.extension.flags.has(name)) return undefined;
|
|
231
|
-
|
|
321
|
+
if (!this.activation.open) {
|
|
322
|
+
// Post-commit: the shared runtime is authoritative, so runtime-side
|
|
323
|
+
// writes (CLI flag overrides, later extensions) stay observable.
|
|
324
|
+
return this.runtime.flagValues.get(name);
|
|
325
|
+
}
|
|
326
|
+
// Activation in flight: prefer this factory's staged default so the
|
|
327
|
+
// extension reads back what it just registered.
|
|
328
|
+
return this.activation.flagValues.get(name) ?? this.runtime.flagValues.get(name);
|
|
232
329
|
}
|
|
233
330
|
|
|
234
331
|
sendMessage<T = unknown>(
|
|
@@ -338,7 +435,7 @@ class ConcreteExtensionAPI implements ExtensionAPI, IExtensionRuntime {
|
|
|
338
435
|
}
|
|
339
436
|
|
|
340
437
|
registerProvider(name: string, config: import("./types").ProviderConfig): void {
|
|
341
|
-
this.
|
|
438
|
+
this.activation.pendingProviderRegistrations.push({ name, config, sourceId: this.extension.path });
|
|
342
439
|
}
|
|
343
440
|
}
|
|
344
441
|
|
|
@@ -365,6 +462,7 @@ async function loadExtension(
|
|
|
365
462
|
runtime: IExtensionRuntime,
|
|
366
463
|
): Promise<{ extension: Extension | null; error: string | null }> {
|
|
367
464
|
const resolvedPath = resolvePath(extensionPath, cwd);
|
|
465
|
+
let activation: ExtensionActivationScope | undefined;
|
|
368
466
|
try {
|
|
369
467
|
const module = (await loadLegacyPiModule(resolvedPath)) as LoadedExtensionModule;
|
|
370
468
|
const factory = getExtensionFactory(module);
|
|
@@ -377,11 +475,21 @@ async function loadExtension(
|
|
|
377
475
|
}
|
|
378
476
|
|
|
379
477
|
const extension = createExtension(extensionPath, resolvedPath);
|
|
380
|
-
|
|
478
|
+
activation = new ExtensionActivationScope(runtime);
|
|
479
|
+
const api = new ConcreteExtensionAPI(
|
|
480
|
+
await import("@gajae-code/coding-agent"),
|
|
481
|
+
extension,
|
|
482
|
+
runtime,
|
|
483
|
+
activation,
|
|
484
|
+
cwd,
|
|
485
|
+
eventBus,
|
|
486
|
+
);
|
|
381
487
|
await factory(api);
|
|
488
|
+
activation.commit();
|
|
382
489
|
|
|
383
490
|
return { extension, error: null };
|
|
384
491
|
} catch (err) {
|
|
492
|
+
activation?.rollback();
|
|
385
493
|
const message = err instanceof Error ? err.message : String(err);
|
|
386
494
|
return { extension: null, error: `Failed to load extension: ${message}` };
|
|
387
495
|
}
|
|
@@ -398,8 +506,22 @@ export async function loadExtensionFromFactory(
|
|
|
398
506
|
name = "<inline>",
|
|
399
507
|
): Promise<Extension> {
|
|
400
508
|
const extension = createExtension(name, name);
|
|
401
|
-
const
|
|
402
|
-
|
|
509
|
+
const activation = new ExtensionActivationScope(runtime);
|
|
510
|
+
const api = new ConcreteExtensionAPI(
|
|
511
|
+
await import("@gajae-code/coding-agent"),
|
|
512
|
+
extension,
|
|
513
|
+
runtime,
|
|
514
|
+
activation,
|
|
515
|
+
cwd,
|
|
516
|
+
eventBus,
|
|
517
|
+
);
|
|
518
|
+
try {
|
|
519
|
+
await factory(api);
|
|
520
|
+
} catch (err) {
|
|
521
|
+
activation.rollback();
|
|
522
|
+
throw err;
|
|
523
|
+
}
|
|
524
|
+
activation.commit();
|
|
403
525
|
return extension;
|
|
404
526
|
}
|
|
405
527
|
|
|
@@ -26,8 +26,6 @@ export class RegisteredToolAdapter implements AgentTool<any, any, any> {
|
|
|
26
26
|
private registeredTool: RegisteredTool,
|
|
27
27
|
private runner: ExtensionRunner,
|
|
28
28
|
) {
|
|
29
|
-
applyToolProxy(registeredTool.definition, this);
|
|
30
|
-
|
|
31
29
|
// Only define render methods when the underlying definition provides them.
|
|
32
30
|
// If these exist unconditionally on the prototype, ToolExecutionComponent
|
|
33
31
|
// enters the custom-renderer path, gets undefined back, and silently
|
|
@@ -45,6 +43,7 @@ export class RegisteredToolAdapter implements AgentTool<any, any, any> {
|
|
|
45
43
|
args,
|
|
46
44
|
);
|
|
47
45
|
}
|
|
46
|
+
applyToolProxy(registeredTool.definition, this);
|
|
48
47
|
}
|
|
49
48
|
|
|
50
49
|
async execute(
|
|
@@ -26,7 +26,7 @@ const FORBIDDEN_MANIFEST_KEYS = ["skills", "slash-commands", "commands", "agents
|
|
|
26
26
|
type ForbiddenManifestKey = (typeof FORBIDDEN_MANIFEST_KEYS)[number];
|
|
27
27
|
|
|
28
28
|
const FORBIDDEN_SURFACE_DIAGNOSTICS: Record<ForbiddenManifestKey, string> = {
|
|
29
|
-
skills: `Forbidden GJC plugin surface "skills": bundles may only EXTEND the four bundled workflow skills (deep-interview, ralplan, ultragoal,
|
|
29
|
+
skills: `Forbidden GJC plugin surface "skills": bundles may only EXTEND the four bundled workflow skills (deep-interview, ralplan, ultragoal, autoresearch) and the four role agents (executor, architect, planner, critic), never register a new top-level skill. Bind an inline sub-skill with the canonical "subskills" surface (frontmatter binds_to/phase/activation_arg), or drop the manifest and use the loose surface .gjc/skills/<name>/SKILL.md (project) / ~/.gjc/agent/skills/<name>/SKILL.md (user).`,
|
|
30
30
|
"slash-commands": `Forbidden GJC plugin surface "slash-commands": bundles cannot register slash commands. Use the loose surface .gjc/commands/<name> (TypeScript module) or a markdown slash-command file instead.`,
|
|
31
31
|
commands: `Forbidden GJC plugin surface "commands" (Claude Code plugin.json vocabulary): bundles cannot register slash commands. Use the loose surface .gjc/commands/<name> (TypeScript module) or a markdown slash-command file instead.`,
|
|
32
32
|
agents: `Forbidden GJC plugin surface "agents" (Claude Code plugin.json vocabulary): bundles cannot register top-level agents; executor/architect/planner/critic are protected. Bind a sub-skill to an existing agent with the canonical "subskills" surface (frontmatter binds_to: one of executor|architect|planner|critic, phase, activation_arg) instead.`,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as fs from "node:fs/promises";
|
|
2
|
-
import * as os from "node:os";
|
|
3
2
|
import * as path from "node:path";
|
|
3
|
+
import { getTrustedHomeDir } from "@gajae-code/utils";
|
|
4
4
|
import { findRepoRoot } from "../capability/fs";
|
|
5
5
|
import type { Skill as CapabilitySkill } from "../capability/skill";
|
|
6
6
|
import type { SkillsSettings } from "../config/settings-schema";
|
|
@@ -47,7 +47,7 @@ export interface DiscoverRuntimeSkillsOptions {
|
|
|
47
47
|
}
|
|
48
48
|
|
|
49
49
|
function getRuntimeHome(): string {
|
|
50
|
-
return
|
|
50
|
+
return getTrustedHomeDir();
|
|
51
51
|
}
|
|
52
52
|
|
|
53
53
|
const DEFAULT_LIMIT = 20;
|
|
@@ -13,9 +13,8 @@
|
|
|
13
13
|
* preview/apply transaction and the UI itself are owned by #4291.
|
|
14
14
|
*/
|
|
15
15
|
import * as fs from "node:fs/promises";
|
|
16
|
-
import * as os from "node:os";
|
|
17
16
|
import * as path from "node:path";
|
|
18
|
-
import { parseFrontmatter } from "@gajae-code/utils";
|
|
17
|
+
import { getTrustedHomeDir, parseFrontmatter } from "@gajae-code/utils";
|
|
19
18
|
import { findRepoRoot } from "../capability/fs";
|
|
20
19
|
import type { Skill as CapabilitySkill } from "../capability/skill";
|
|
21
20
|
import { resolveSkillScopeTrust } from "../config/skill-settings-defaults";
|
|
@@ -97,7 +96,7 @@ export class SkillFrontmatterError extends Error {
|
|
|
97
96
|
const BUILT_IN_SKILL_NAMES = new Set<string>(CANONICAL_GJC_WORKFLOW_SKILLS);
|
|
98
97
|
|
|
99
98
|
function getRuntimeHome(): string {
|
|
100
|
-
return
|
|
99
|
+
return getTrustedHomeDir();
|
|
101
100
|
}
|
|
102
101
|
|
|
103
102
|
/** Ancestor directories from `cwd` (inclusive) up to `stop` (inclusive), excluding `home`. */
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import * as fs from "node:fs/promises";
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
2
|
+
import { getProjectDir, getTrustedHomeDir } from "@gajae-code/utils";
|
|
3
|
+
import { findRepoRoot } from "../capability/fs";
|
|
4
4
|
import { skillCapability } from "../capability/skill";
|
|
5
5
|
import type { SourceMeta } from "../capability/types";
|
|
6
6
|
import type { SkillsSettings } from "../config/settings";
|
|
7
7
|
import { resolveSkillScopeTrust } from "../config/skill-settings-defaults";
|
|
8
|
-
import { type Skill as CapabilitySkill,
|
|
8
|
+
import { type Skill as CapabilitySkill, getCapability } from "../discovery";
|
|
9
9
|
import { compareSkillOrder, scanSkillsFromDir } from "../discovery/helpers";
|
|
10
10
|
import type { SkillPromptDetails } from "../session/messages";
|
|
11
11
|
import { CANONICAL_GJC_WORKFLOW_SKILLS } from "../skill-state/canonical-skills";
|
|
@@ -77,11 +77,12 @@ export interface LoadSkillsFromDirOptions {
|
|
|
77
77
|
}
|
|
78
78
|
|
|
79
79
|
export async function loadSkillsFromDir(options: LoadSkillsFromDirOptions): Promise<LoadSkillsResult> {
|
|
80
|
+
const home = getTrustedHomeDir();
|
|
80
81
|
const [rawProviderId, rawLevel] = options.source.split(":", 2);
|
|
81
82
|
const providerId = rawProviderId || "custom";
|
|
82
83
|
const level: "user" | "project" = rawLevel === "project" ? "project" : "user";
|
|
83
84
|
const result = await scanSkillsFromDir(
|
|
84
|
-
{ cwd: getProjectDir(), home
|
|
85
|
+
{ cwd: getProjectDir(), home, repoRoot: null },
|
|
85
86
|
{
|
|
86
87
|
dir: options.dir,
|
|
87
88
|
providerId,
|
|
@@ -108,6 +109,8 @@ export async function loadSkillsFromDir(options: LoadSkillsFromDirOptions): Prom
|
|
|
108
109
|
export interface LoadSkillsOptions extends SkillsSettings {
|
|
109
110
|
/** Working directory for project-local skills. Default: getProjectDir() */
|
|
110
111
|
cwd?: string;
|
|
112
|
+
/** Explicit user home for skill discovery. Default: getTrustedHomeDir(). */
|
|
113
|
+
home?: string;
|
|
111
114
|
}
|
|
112
115
|
|
|
113
116
|
/**
|
|
@@ -137,6 +140,7 @@ export async function loadSkills(options: LoadSkillsOptions = {}): Promise<LoadS
|
|
|
137
140
|
if (!enabled) {
|
|
138
141
|
return { skills: [], warnings: [] };
|
|
139
142
|
}
|
|
143
|
+
const home = options.home ?? getTrustedHomeDir();
|
|
140
144
|
|
|
141
145
|
const projectTrusted = resolveSkillScopeTrust(options, "project");
|
|
142
146
|
const userTrusted = resolveSkillScopeTrust(options, "user");
|
|
@@ -156,7 +160,11 @@ export async function loadSkills(options: LoadSkillsOptions = {}): Promise<LoadS
|
|
|
156
160
|
// Use capability API to load all skills. `all` (rather than `items`) keeps
|
|
157
161
|
// shadowed duplicates so this function can apply the documented precedence
|
|
158
162
|
// itself: project scope beats user scope.
|
|
159
|
-
const
|
|
163
|
+
const nativeProvider = getCapability<CapabilitySkill>(skillCapability.id)?.providers.find(
|
|
164
|
+
provider => provider.id === "native",
|
|
165
|
+
);
|
|
166
|
+
if (!nativeProvider) throw new Error("Native skill provider is unavailable");
|
|
167
|
+
const result = await nativeProvider.load({ cwd, home, repoRoot: await findRepoRoot(cwd) });
|
|
160
168
|
|
|
161
169
|
const skillMap = new Map<string, Skill>();
|
|
162
170
|
const realPathSet = new Set<string>();
|
|
@@ -182,7 +190,7 @@ export async function loadSkills(options: LoadSkillsOptions = {}): Promise<LoadS
|
|
|
182
190
|
// precedence. `all` is already in native provider order with project dirs
|
|
183
191
|
// before user dirs; a stable sort by level lifts every project item above
|
|
184
192
|
// every user item, giving: project `.gjc/skills` > user roots.
|
|
185
|
-
const filteredSkills = result.
|
|
193
|
+
const filteredSkills = result.items
|
|
186
194
|
.filter(capSkill => {
|
|
187
195
|
if (!isSourceEnabled(capSkill._source)) return false;
|
|
188
196
|
if (disabledSkillNames.has(capSkill.name)) return false;
|
|
@@ -250,9 +258,9 @@ export async function loadSkills(options: LoadSkillsOptions = {}): Promise<LoadS
|
|
|
250
258
|
|
|
251
259
|
const customDirectoryResults = await Promise.all(
|
|
252
260
|
customDirectories.map(async dir => {
|
|
253
|
-
const expandedDir = expandTilde(dir);
|
|
261
|
+
const expandedDir = expandTilde(dir, home);
|
|
254
262
|
const scanResult = await scanSkillsFromDir(
|
|
255
|
-
{ cwd, home
|
|
263
|
+
{ cwd, home, repoRoot: null },
|
|
256
264
|
{
|
|
257
265
|
dir: expandedDir,
|
|
258
266
|
providerId: "custom",
|