@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
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
export interface AutoresearchSetupPromptInput {
|
|
2
|
+
baseSystemPrompt: string;
|
|
3
|
+
goal: string;
|
|
4
|
+
workingDir: string;
|
|
5
|
+
branch: string | null;
|
|
6
|
+
/** Dirty-worktree / no-repo degradation warning shown during Phase 1. */
|
|
7
|
+
baselineWarning?: string | null;
|
|
8
|
+
}
|
|
9
|
+
/** Phase 1: harness-setup prompt. */
|
|
10
|
+
export declare function renderAutoresearchSetupPrompt(input: AutoresearchSetupPromptInput): string;
|
|
11
|
+
export interface AutoresearchRecentRunPrompt {
|
|
12
|
+
run_number: number;
|
|
13
|
+
status: string;
|
|
14
|
+
metric_display: string;
|
|
15
|
+
description: string;
|
|
16
|
+
has_asi_summary: boolean;
|
|
17
|
+
asi_summary: string;
|
|
18
|
+
has_deviations: boolean;
|
|
19
|
+
deviations: string;
|
|
20
|
+
justified: boolean;
|
|
21
|
+
flagged: boolean;
|
|
22
|
+
flagged_reason: string;
|
|
23
|
+
}
|
|
24
|
+
export interface AutoresearchIteratePromptInput {
|
|
25
|
+
baseSystemPrompt: string;
|
|
26
|
+
goal: string;
|
|
27
|
+
workingDir: string;
|
|
28
|
+
branch: string | null;
|
|
29
|
+
baselineCommit: string | null;
|
|
30
|
+
metricName: string;
|
|
31
|
+
metricUnit: string;
|
|
32
|
+
notes: string;
|
|
33
|
+
currentSegment: number;
|
|
34
|
+
currentSegmentRunCount: number;
|
|
35
|
+
baselineMetric: number | null;
|
|
36
|
+
bestMetric: number | null;
|
|
37
|
+
bestRunNumber: number | null;
|
|
38
|
+
recentRuns: AutoresearchRecentRunPrompt[];
|
|
39
|
+
unjustifiedRuns: Array<{
|
|
40
|
+
run_number: number;
|
|
41
|
+
paths: string;
|
|
42
|
+
}>;
|
|
43
|
+
pendingRun: {
|
|
44
|
+
runNumber: number;
|
|
45
|
+
command: string;
|
|
46
|
+
parsedPrimary: number | null;
|
|
47
|
+
passed: boolean;
|
|
48
|
+
} | null;
|
|
49
|
+
}
|
|
50
|
+
/** Phase 2: iterate-loop prompt. */
|
|
51
|
+
export declare function renderAutoresearchIteratePrompt(input: AutoresearchIteratePromptInput): string;
|
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
import type { ASIData, ExperimentStatus, MetricDef, MetricDirection, NumericMetricMap } from "./types";
|
|
2
|
+
export type { ASIData, ExperimentStatus, MetricDirection, NumericMetricMap };
|
|
3
|
+
export interface AutoresearchExperimentConfig {
|
|
4
|
+
name: string;
|
|
5
|
+
goal: string | null;
|
|
6
|
+
primaryMetric: string;
|
|
7
|
+
metricUnit: string;
|
|
8
|
+
direction: MetricDirection;
|
|
9
|
+
preferredCommand: string | null;
|
|
10
|
+
branch: string | null;
|
|
11
|
+
baselineCommit: string | null;
|
|
12
|
+
currentSegment: number;
|
|
13
|
+
maxIterations: number | null;
|
|
14
|
+
scopePaths: string[];
|
|
15
|
+
offLimits: string[];
|
|
16
|
+
constraints: string[];
|
|
17
|
+
secondaryMetrics: string[];
|
|
18
|
+
notes: string;
|
|
19
|
+
createdAt: number;
|
|
20
|
+
closedAt: number | null;
|
|
21
|
+
}
|
|
22
|
+
export interface AutoresearchRunRecord {
|
|
23
|
+
runId: string;
|
|
24
|
+
runNumber: number;
|
|
25
|
+
segment: number;
|
|
26
|
+
command: string;
|
|
27
|
+
startedAt: number;
|
|
28
|
+
completedAt: number | null;
|
|
29
|
+
durationMs: number | null;
|
|
30
|
+
exitCode: number | null;
|
|
31
|
+
timedOut: boolean;
|
|
32
|
+
status: ExperimentStatus | null;
|
|
33
|
+
description: string | null;
|
|
34
|
+
metric: number | null;
|
|
35
|
+
metrics: NumericMetricMap;
|
|
36
|
+
asi: ASIData | null;
|
|
37
|
+
commitHash: string | null;
|
|
38
|
+
confidence: number | null;
|
|
39
|
+
preRunDirtyPaths: string[];
|
|
40
|
+
modifiedPaths: string[];
|
|
41
|
+
scopeDeviations: string[];
|
|
42
|
+
justification: string | null;
|
|
43
|
+
flagged: boolean;
|
|
44
|
+
flaggedReason: string | null;
|
|
45
|
+
loggedAt: number | null;
|
|
46
|
+
abandonedAt: number | null;
|
|
47
|
+
}
|
|
48
|
+
export interface AutoresearchRunsPaths {
|
|
49
|
+
dir: string;
|
|
50
|
+
runsPath: string;
|
|
51
|
+
configPath: string;
|
|
52
|
+
}
|
|
53
|
+
export declare function autoresearchRunsPaths(cwd: string, sessionId?: string | null): AutoresearchRunsPaths;
|
|
54
|
+
export declare function createAutoresearchExperimentConfig(input: {
|
|
55
|
+
name: string;
|
|
56
|
+
goal?: string | null;
|
|
57
|
+
primaryMetric: string;
|
|
58
|
+
metricUnit?: string;
|
|
59
|
+
direction?: MetricDirection;
|
|
60
|
+
preferredCommand?: string | null;
|
|
61
|
+
branch?: string | null;
|
|
62
|
+
baselineCommit?: string | null;
|
|
63
|
+
maxIterations?: number | null;
|
|
64
|
+
scopePaths?: string[];
|
|
65
|
+
offLimits?: string[];
|
|
66
|
+
constraints?: string[];
|
|
67
|
+
secondaryMetrics?: string[];
|
|
68
|
+
notes?: string;
|
|
69
|
+
createdAt?: number;
|
|
70
|
+
}): AutoresearchExperimentConfig;
|
|
71
|
+
/**
|
|
72
|
+
* Session-scoped JSONL run store. Reads are served from a cached in-memory
|
|
73
|
+
* snapshot; every mutation routes through the sanctioned `.gjc/**` state-writer
|
|
74
|
+
* primitives (append for new runs, locked rewrite for updates).
|
|
75
|
+
*/
|
|
76
|
+
export declare class AutoresearchRunsStore {
|
|
77
|
+
#private;
|
|
78
|
+
private constructor();
|
|
79
|
+
static open(cwd: string, sessionId?: string | null): Promise<AutoresearchRunsStore>;
|
|
80
|
+
get paths(): AutoresearchRunsPaths;
|
|
81
|
+
get config(): AutoresearchExperimentConfig | null;
|
|
82
|
+
get runs(): AutoresearchRunRecord[];
|
|
83
|
+
/** Persist the experiment configuration (first write creates the file). */
|
|
84
|
+
saveConfig(config: AutoresearchExperimentConfig): Promise<void>;
|
|
85
|
+
/** Seed the in-memory config without persisting (mission-derived defaults). */
|
|
86
|
+
setInMemoryConfig(config: AutoresearchExperimentConfig): void;
|
|
87
|
+
/** Start a run: append its record line and return the created record. */
|
|
88
|
+
startRun(input: {
|
|
89
|
+
segment?: number;
|
|
90
|
+
command: string;
|
|
91
|
+
preRunDirtyPaths?: string[];
|
|
92
|
+
startedAt?: number;
|
|
93
|
+
}): Promise<AutoresearchRunRecord>;
|
|
94
|
+
/** Mark a completed run (exit code, duration, parsed metrics/ASI). */
|
|
95
|
+
completeRun(runId: string, patch: Partial<AutoresearchRunRecord>): Promise<AutoresearchRunRecord>;
|
|
96
|
+
/** Log a run: final status, description, metric, ASI, paths, confidence. */
|
|
97
|
+
logRun(runId: string, patch: Partial<AutoresearchRunRecord>): Promise<AutoresearchRunRecord>;
|
|
98
|
+
/** Flag a run as suspect; flagged runs are excluded from baseline/best math. */
|
|
99
|
+
flagRun(runId: string, reason: string): Promise<AutoresearchRunRecord>;
|
|
100
|
+
updateRunConfidence(runId: string, confidence: number | null): Promise<AutoresearchRunRecord>;
|
|
101
|
+
/** Abandon every pending run; returns how many were abandoned. */
|
|
102
|
+
abandonPendingRuns(): Promise<number>;
|
|
103
|
+
/** Most recent pending (started, unlogged, unabandoned) run, or null. */
|
|
104
|
+
getPendingRun(): AutoresearchRunRecord | null;
|
|
105
|
+
listRuns(): AutoresearchRunRecord[];
|
|
106
|
+
listLoggedRuns(): AutoresearchRunRecord[];
|
|
107
|
+
}
|
|
108
|
+
/**
|
|
109
|
+
* Minimal structural shape the math operates on; both persisted run records
|
|
110
|
+
* and rebuilt experiment results satisfy it.
|
|
111
|
+
*/
|
|
112
|
+
export interface BaselineCandidate {
|
|
113
|
+
segment: number;
|
|
114
|
+
status: ExperimentStatus | null;
|
|
115
|
+
metric: number | null;
|
|
116
|
+
metrics: NumericMetricMap;
|
|
117
|
+
flagged: boolean;
|
|
118
|
+
runNumber: number;
|
|
119
|
+
}
|
|
120
|
+
export declare function currentResults(results: readonly BaselineCandidate[], segment: number): BaselineCandidate[];
|
|
121
|
+
/** First kept, unflagged run in the segment — the baseline. */
|
|
122
|
+
export declare function findBaselineResult(results: readonly BaselineCandidate[], segment: number): BaselineCandidate | null;
|
|
123
|
+
export declare function findBaselineMetric(results: readonly BaselineCandidate[], segment: number): number | null;
|
|
124
|
+
/** Best kept, unflagged metric in the segment, honoring direction. */
|
|
125
|
+
export declare function findBestKeptMetric(results: readonly BaselineCandidate[], segment: number, direction: MetricDirection): number | null;
|
|
126
|
+
export declare function findBaselineRunNumber(results: readonly BaselineCandidate[], segment: number): number | null;
|
|
127
|
+
/** Baseline secondary-metric values, filling gaps from other unflagged runs. */
|
|
128
|
+
export declare function findBaselineSecondary(results: readonly BaselineCandidate[], segment: number, knownMetrics: MetricDef[]): NumericMetricMap;
|
|
129
|
+
export declare function sortedMedian(values: number[]): number;
|
|
130
|
+
/**
|
|
131
|
+
* Confidence score: how many multiples of the observed noise floor (median
|
|
132
|
+
* absolute deviation) separate the best kept metric from the baseline. Null
|
|
133
|
+
* when there are too few runs, no baseline, or no measurable spread.
|
|
134
|
+
*/
|
|
135
|
+
export declare function computeConfidence(results: readonly BaselineCandidate[], segment: number, direction: MetricDirection): number | null;
|
|
136
|
+
export interface AutoresearchExperimentResult {
|
|
137
|
+
runNumber: number;
|
|
138
|
+
commit: string;
|
|
139
|
+
metric: number | null;
|
|
140
|
+
metrics: NumericMetricMap;
|
|
141
|
+
status: ExperimentStatus;
|
|
142
|
+
description: string;
|
|
143
|
+
timestamp: number;
|
|
144
|
+
segment: number;
|
|
145
|
+
confidence: number | null;
|
|
146
|
+
asi?: ASIData;
|
|
147
|
+
modifiedPaths: string[];
|
|
148
|
+
scopeDeviations: string[];
|
|
149
|
+
justification: string | null;
|
|
150
|
+
flagged: boolean;
|
|
151
|
+
flaggedReason: string | null;
|
|
152
|
+
}
|
|
153
|
+
export interface AutoresearchExperimentState {
|
|
154
|
+
results: AutoresearchExperimentResult[];
|
|
155
|
+
bestMetric: number | null;
|
|
156
|
+
bestDirection: MetricDirection;
|
|
157
|
+
metricName: string;
|
|
158
|
+
metricUnit: string;
|
|
159
|
+
secondaryMetrics: MetricDef[];
|
|
160
|
+
name: string | null;
|
|
161
|
+
goal: string | null;
|
|
162
|
+
currentSegment: number;
|
|
163
|
+
maxExperiments: number | null;
|
|
164
|
+
confidence: number | null;
|
|
165
|
+
scopePaths: string[];
|
|
166
|
+
offLimits: string[];
|
|
167
|
+
constraints: string[];
|
|
168
|
+
notes: string;
|
|
169
|
+
branch: string | null;
|
|
170
|
+
baselineCommit: string | null;
|
|
171
|
+
}
|
|
172
|
+
/** Rebuild the experiment state view from the persisted config + logged runs. */
|
|
173
|
+
export declare function buildAutoresearchExperimentState(config: AutoresearchExperimentConfig, loggedRuns: AutoresearchRunRecord[]): AutoresearchExperimentState;
|
|
@@ -1,7 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Shared types for the rebuilt autoresearch capability modules.
|
|
3
|
+
*
|
|
4
|
+
* These mirror the deleted extension's `types.ts` surface (metrics, ASI,
|
|
5
|
+
* experiment statuses) without the extension-only runtime types (dashboards,
|
|
6
|
+
* tool factories, session entries). The mission/verdict/ledger types live in
|
|
7
|
+
* `gjc-runtime/autoresearch-runtime.ts`; run storage and dashboard models live
|
|
8
|
+
* in `runs.ts` / `dashboard.ts`.
|
|
9
|
+
*/
|
|
5
10
|
export type MetricDirection = "lower" | "higher";
|
|
6
11
|
export type ExperimentStatus = "keep" | "discard" | "crash" | "checks_failed";
|
|
7
12
|
export type ASIValue = string | number | boolean | null | ASIValue[] | {
|
|
@@ -17,138 +22,3 @@ export interface MetricDef {
|
|
|
17
22
|
name: string;
|
|
18
23
|
unit: string;
|
|
19
24
|
}
|
|
20
|
-
export interface ExperimentResult {
|
|
21
|
-
runNumber: number | null;
|
|
22
|
-
commit: string;
|
|
23
|
-
metric: number;
|
|
24
|
-
metrics: NumericMetricMap;
|
|
25
|
-
status: ExperimentStatus;
|
|
26
|
-
description: string;
|
|
27
|
-
timestamp: number;
|
|
28
|
-
segment: number;
|
|
29
|
-
confidence: number | null;
|
|
30
|
-
asi?: ASIData;
|
|
31
|
-
modifiedPaths: string[];
|
|
32
|
-
scopeDeviations: string[];
|
|
33
|
-
justification: string | null;
|
|
34
|
-
flagged: boolean;
|
|
35
|
-
flaggedReason: string | null;
|
|
36
|
-
}
|
|
37
|
-
export interface ExperimentState {
|
|
38
|
-
results: ExperimentResult[];
|
|
39
|
-
bestMetric: number | null;
|
|
40
|
-
bestDirection: MetricDirection;
|
|
41
|
-
metricName: string;
|
|
42
|
-
metricUnit: string;
|
|
43
|
-
secondaryMetrics: MetricDef[];
|
|
44
|
-
name: string | null;
|
|
45
|
-
goal: string | null;
|
|
46
|
-
currentSegment: number;
|
|
47
|
-
maxExperiments: number | null;
|
|
48
|
-
confidence: number | null;
|
|
49
|
-
scopePaths: string[];
|
|
50
|
-
offLimits: string[];
|
|
51
|
-
constraints: string[];
|
|
52
|
-
notes: string;
|
|
53
|
-
branch: string | null;
|
|
54
|
-
baselineCommit: string | null;
|
|
55
|
-
sessionId: number | null;
|
|
56
|
-
}
|
|
57
|
-
export interface RunExperimentProgressDetails {
|
|
58
|
-
phase: "running";
|
|
59
|
-
elapsed: string;
|
|
60
|
-
truncation?: TruncationResult;
|
|
61
|
-
fullOutputPath?: string;
|
|
62
|
-
runDirectory?: string;
|
|
63
|
-
}
|
|
64
|
-
export interface RunDetails {
|
|
65
|
-
runNumber: number;
|
|
66
|
-
runDirectory: string;
|
|
67
|
-
benchmarkLogPath: string;
|
|
68
|
-
command: string;
|
|
69
|
-
exitCode: number | null;
|
|
70
|
-
durationSeconds: number;
|
|
71
|
-
passed: boolean;
|
|
72
|
-
crashed: boolean;
|
|
73
|
-
timedOut: boolean;
|
|
74
|
-
tailOutput: string;
|
|
75
|
-
parsedMetrics: NumericMetricMap | null;
|
|
76
|
-
parsedPrimary: number | null;
|
|
77
|
-
parsedAsi: ASIData | null;
|
|
78
|
-
metricName: string;
|
|
79
|
-
metricUnit: string;
|
|
80
|
-
preRunDirtyPaths: string[];
|
|
81
|
-
abandonedPriorRun: number | null;
|
|
82
|
-
truncation?: TruncationResult;
|
|
83
|
-
fullOutputPath?: string;
|
|
84
|
-
}
|
|
85
|
-
export interface LogDetails {
|
|
86
|
-
experiment: ExperimentResult;
|
|
87
|
-
state: ExperimentState;
|
|
88
|
-
wallClockSeconds: number | null;
|
|
89
|
-
scopeDeviations: string[];
|
|
90
|
-
justification: string | null;
|
|
91
|
-
flaggedRuns: Array<{
|
|
92
|
-
runId: number;
|
|
93
|
-
reason: string;
|
|
94
|
-
}>;
|
|
95
|
-
}
|
|
96
|
-
export interface PendingRunSummary {
|
|
97
|
-
command: string;
|
|
98
|
-
durationSeconds: number | null;
|
|
99
|
-
parsedAsi: ASIData | null;
|
|
100
|
-
parsedMetrics: NumericMetricMap | null;
|
|
101
|
-
parsedPrimary: number | null;
|
|
102
|
-
passed: boolean;
|
|
103
|
-
preRunDirtyPaths: string[];
|
|
104
|
-
runDirectory: string;
|
|
105
|
-
runNumber: number;
|
|
106
|
-
exitCode: number | null;
|
|
107
|
-
timedOut: boolean;
|
|
108
|
-
}
|
|
109
|
-
export interface RunningExperiment {
|
|
110
|
-
startedAt: number;
|
|
111
|
-
command: string;
|
|
112
|
-
runDirectory: string;
|
|
113
|
-
runNumber: number;
|
|
114
|
-
}
|
|
115
|
-
export interface AutoresearchRuntime {
|
|
116
|
-
autoresearchMode: boolean;
|
|
117
|
-
autoResumeArmed: boolean;
|
|
118
|
-
dashboardExpanded: boolean;
|
|
119
|
-
lastAutoResumePendingRunNumber: number | null;
|
|
120
|
-
lastRunDuration: number | null;
|
|
121
|
-
lastRunAsi: ASIData | null;
|
|
122
|
-
lastRunArtifactDir: string | null;
|
|
123
|
-
lastRunNumber: number | null;
|
|
124
|
-
lastRunSummary: PendingRunSummary | null;
|
|
125
|
-
runningExperiment: RunningExperiment | null;
|
|
126
|
-
state: ExperimentState;
|
|
127
|
-
goal: string | null;
|
|
128
|
-
}
|
|
129
|
-
export interface AutoresearchControlEntryData {
|
|
130
|
-
mode: "on" | "off" | "clear";
|
|
131
|
-
goal?: string;
|
|
132
|
-
}
|
|
133
|
-
export interface ReconstructedControlState {
|
|
134
|
-
autoresearchMode: boolean;
|
|
135
|
-
goal: string | null;
|
|
136
|
-
lastMode: AutoresearchControlEntryData["mode"] | null;
|
|
137
|
-
}
|
|
138
|
-
export interface RuntimeStore {
|
|
139
|
-
clear(sessionKey: string): void;
|
|
140
|
-
ensure(sessionKey: string): AutoresearchRuntime;
|
|
141
|
-
}
|
|
142
|
-
export interface DashboardController {
|
|
143
|
-
clear(ctx: ExtensionContext): void;
|
|
144
|
-
requestRender(): void;
|
|
145
|
-
showOverlay(ctx: ExtensionContext, runtime: AutoresearchRuntime): Promise<void>;
|
|
146
|
-
updateWidget(ctx: ExtensionContext, runtime: AutoresearchRuntime): void;
|
|
147
|
-
}
|
|
148
|
-
export interface AutoresearchToolFactoryOptions {
|
|
149
|
-
dashboard: DashboardController;
|
|
150
|
-
getRuntime(ctx: ExtensionContext): AutoresearchRuntime;
|
|
151
|
-
pi: ExtensionAPI;
|
|
152
|
-
}
|
|
153
|
-
export type AutoresearchToolResult<TDetails> = AgentToolResult<TDetails>;
|
|
154
|
-
export type SessionEntries = SessionEntry[];
|
|
@@ -14,6 +14,20 @@ export interface LoadContext {
|
|
|
14
14
|
cwd: string;
|
|
15
15
|
/** User home directory */
|
|
16
16
|
home: string;
|
|
17
|
+
/**
|
|
18
|
+
* GJC's user-scope config directory: the resolved agent directory
|
|
19
|
+
* (`getAgentDir()`), which `--agent-dir`, `GJC_CODING_AGENT_DIR` and
|
|
20
|
+
* `setAgentDir()` redirect away from `<home>/.gjc/agent`. `loadCapability`
|
|
21
|
+
* always sets it; ad-hoc contexts built for path scanning may omit it, and
|
|
22
|
+
* consumers then fall back to the same process-wide `getAgentDir()`.
|
|
23
|
+
*
|
|
24
|
+
* A native surface whose write path targets the agent directory resolves its
|
|
25
|
+
* user scope from here, or discovery reads a different file than the one the
|
|
26
|
+
* writer produced: `gjc mcp add` (user scope) writes `getMCPConfigPath("user")`
|
|
27
|
+
* under this directory. Surfaces whose writers are home-relative (skills) keep
|
|
28
|
+
* resolving from `home`.
|
|
29
|
+
*/
|
|
30
|
+
userAgentDir?: string;
|
|
17
31
|
/** Git repository root (directory containing .git), or null if not in a repo */
|
|
18
32
|
repoRoot: string | null;
|
|
19
33
|
}
|
|
@@ -59,6 +73,12 @@ export interface LoadOptions {
|
|
|
59
73
|
excludeProviders?: string[];
|
|
60
74
|
/** Custom cwd. Default: getProjectDir() */
|
|
61
75
|
cwd?: string;
|
|
76
|
+
/**
|
|
77
|
+
* Agent directory backing `LoadContext.userAgentDir`. Default: getAgentDir().
|
|
78
|
+
* Set it when loading for a session whose agent directory differs from the
|
|
79
|
+
* process-wide one (`createAgentSession({ agentDir })`).
|
|
80
|
+
*/
|
|
81
|
+
agentDir?: string;
|
|
62
82
|
/** Include items even if they fail validation. Default: false */
|
|
63
83
|
includeInvalid?: boolean;
|
|
64
84
|
/** Include items disabled via settings. Default: false */
|
|
@@ -15,5 +15,6 @@ export interface AccountsCommandArgs {
|
|
|
15
15
|
declare class AccountsCommandError extends Error {
|
|
16
16
|
constructor(message: string);
|
|
17
17
|
}
|
|
18
|
+
export declare function toAccountsCommandError(error: unknown): AccountsCommandError | undefined;
|
|
18
19
|
export declare function runAccountsCommand(cmd: AccountsCommandArgs): Promise<void>;
|
|
19
20
|
export { AccountsCommandError };
|
|
@@ -1,10 +1,8 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* `gjc rlm` — opt-in Jupyter-style research session with a persistent Python kernel.
|
|
3
|
-
*/
|
|
4
1
|
import { Command } from "@gajae-code/utils/cli";
|
|
5
|
-
export default class
|
|
2
|
+
export default class Autoresearch extends Command {
|
|
6
3
|
static description: string;
|
|
7
4
|
static strict: boolean;
|
|
8
5
|
static examples: string[];
|
|
6
|
+
static delegateHelp: boolean;
|
|
9
7
|
run(): Promise<void>;
|
|
10
8
|
}
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Dependency-free autorouting vocabulary and settings validators.
|
|
3
|
+
*
|
|
4
|
+
* This module deliberately does not import Settings, task code, or model
|
|
5
|
+
* profiles. It is the shared contract used by settings and (later) routing
|
|
6
|
+
* policy code.
|
|
7
|
+
*/
|
|
8
|
+
export declare const AUTOROUTING_TIERS: readonly ["fast", "balanced", "strong"];
|
|
9
|
+
export type AutoroutingTier = (typeof AUTOROUTING_TIERS)[number];
|
|
10
|
+
export declare const DEFAULT_AUTOROUTING_TIER: AutoroutingTier;
|
|
11
|
+
/**
|
|
12
|
+
* The single wording for "autorouting is switched on but cannot route".
|
|
13
|
+
*
|
|
14
|
+
* One constant so every delivery surface (interactive, print, and the SDK/ACP
|
|
15
|
+
* host) reports the identical sentence and cannot drift apart. Bounded and free
|
|
16
|
+
* of interpolation so it is always safe to render.
|
|
17
|
+
*/
|
|
18
|
+
export declare const AUTOROUTING_INACTIVE_WARNING = "Autorouting is enabled but has no usable tier chains; Task items fall back to manual model resolution. Run /routing to inspect, or /model \u2192 smart routing to generate tiers.";
|
|
19
|
+
/** The normalized tier map consumed by routing policy. */
|
|
20
|
+
export type TierMap = Partial<Record<AutoroutingTier, string[]>>;
|
|
21
|
+
/** The permissive input shape accepted by the settings surface. */
|
|
22
|
+
export type AutoroutingTierMapInput = Partial<Record<AutoroutingTier, string | string[]>>;
|
|
23
|
+
export type AutoroutingSetup = {
|
|
24
|
+
schema: 1;
|
|
25
|
+
providers: string[];
|
|
26
|
+
models?: string[];
|
|
27
|
+
};
|
|
28
|
+
/** Fingerprints describing the generated autorouting declaration and materialized tiers. */
|
|
29
|
+
export type AutoroutingProvenance = {
|
|
30
|
+
schema: 1;
|
|
31
|
+
source: {
|
|
32
|
+
catalogFingerprint: string;
|
|
33
|
+
mapFingerprint: string;
|
|
34
|
+
generatorVersion: number;
|
|
35
|
+
};
|
|
36
|
+
declarationFingerprint: string;
|
|
37
|
+
tiersFingerprint: string;
|
|
38
|
+
};
|
|
39
|
+
/** Hard upper bound shared with the routing-evidence invariant in task/types.ts. */
|
|
40
|
+
export declare const AUTOROUTING_SELECTOR_MAX_LENGTH = 256;
|
|
41
|
+
/** The exact selector grammar published by the generated config schema. */
|
|
42
|
+
export declare const AUTOROUTING_SELECTOR_PATTERN = "^[^/\\s*?\\[\\x00-\\x1F\\x7F-\\x9F\\u2028\\u2029]+\\/[^\\s*?\\[\\x00-\\x1F\\x7F-\\x9F\\u2028\\u2029]+(?::(?:minimal|low|medium|high|xhigh))?$";
|
|
43
|
+
export declare const AUTOROUTING_SELECTOR_DESCRIPTION = "provider/modelId with an optional valid thinking suffix (:minimal|low|medium|high|xhigh), no globs, no bare model ids, no pi/<role> role aliases.";
|
|
44
|
+
export type AutoroutingReasonCode = "tier_unmatched" | "tier_missing_in_map" | "config_invalid" | "map_absent" | "selector_not_provider_qualified" | "auth_substituted" | "assistant_model_mismatch" | "provider_disabled" | "snapshot_missing" | "credential_unavailable" | "preflight_spawn_failed" | "preflight_exhausted";
|
|
45
|
+
export type AutoroutingLocalIssue = {
|
|
46
|
+
path: string;
|
|
47
|
+
code: AutoroutingReasonCode;
|
|
48
|
+
/** Alias retained for callers that describe diagnostics as reasons. */
|
|
49
|
+
reason: AutoroutingReasonCode;
|
|
50
|
+
detail: string;
|
|
51
|
+
};
|
|
52
|
+
export type AutoroutingEffectiveIssue = {
|
|
53
|
+
code: Extract<AutoroutingReasonCode, "config_invalid" | "map_absent">;
|
|
54
|
+
/** Alias retained for callers that describe diagnostics as reasons. */
|
|
55
|
+
reason: Extract<AutoroutingReasonCode, "config_invalid" | "map_absent">;
|
|
56
|
+
detail: string;
|
|
57
|
+
};
|
|
58
|
+
export type AutoroutingEffective = {
|
|
59
|
+
active: true;
|
|
60
|
+
map: TierMap;
|
|
61
|
+
} | {
|
|
62
|
+
active: false;
|
|
63
|
+
issue?: AutoroutingEffectiveIssue;
|
|
64
|
+
};
|
|
65
|
+
/**
|
|
66
|
+
* Validate one provider-qualified selector. A selector has one provider
|
|
67
|
+
* segment, a non-empty model remainder, and may carry one supported thinking
|
|
68
|
+
* suffix. Model ids may themselves contain slashes; the provider is always
|
|
69
|
+
* the segment before the first slash.
|
|
70
|
+
*/
|
|
71
|
+
export declare function isValidAutoroutingSelector(value: unknown): value is string;
|
|
72
|
+
export declare function normalizeTierMap(value: unknown): TierMap;
|
|
73
|
+
/** True when at least one known tier contains one grammatically valid selector. */
|
|
74
|
+
export declare function isMeaningfulTierMap(value: unknown): value is TierMap;
|
|
75
|
+
/** Validate the typed auto-setup declaration without consulting the model catalog. */
|
|
76
|
+
export declare function validateAutoroutingSetup(value: unknown): AutoroutingLocalIssue[];
|
|
77
|
+
/** Validate generated-tier provenance and its source identity. */
|
|
78
|
+
export declare function validateAutoroutingProvenance(value: unknown): AutoroutingLocalIssue[];
|
|
79
|
+
/** Validate only local types, keys, and selector grammar for one source layer. */
|
|
80
|
+
export declare function validateAutoroutingLocal(fragment: unknown): AutoroutingLocalIssue[];
|
|
81
|
+
export type AutoroutingProvenanceState = {
|
|
82
|
+
staleMap: boolean;
|
|
83
|
+
staleCatalog: boolean;
|
|
84
|
+
handEdited: boolean;
|
|
85
|
+
};
|
|
86
|
+
/** Compare recorded provenance with the current catalog/map/tier materialization. */
|
|
87
|
+
export declare function evaluateAutoroutingProvenanceState(provenance: AutoroutingProvenance | undefined, current: {
|
|
88
|
+
catalogFingerprint: string;
|
|
89
|
+
mapFingerprint: string;
|
|
90
|
+
tiers: unknown;
|
|
91
|
+
}): AutoroutingProvenanceState;
|
|
92
|
+
/** Compare a recorded tier fingerprint with the current raw tier map. */
|
|
93
|
+
export declare function matchesRecordedTiersFingerprint(provenance: AutoroutingProvenance | undefined, tiers: unknown): boolean;
|
|
94
|
+
/** Advisory comparison between a recorded declaration and the current provider priority. */
|
|
95
|
+
export type AutoroutingProviderOrderHint = {
|
|
96
|
+
/** The declaration lists the same providers in a different relative order. */
|
|
97
|
+
reordered: boolean;
|
|
98
|
+
/** Declared providers that the current catalog no longer offers, in declaration order. */
|
|
99
|
+
missing: string[];
|
|
100
|
+
};
|
|
101
|
+
/**
|
|
102
|
+
* Compare a recorded `setup.providers` declaration against the current provider
|
|
103
|
+
* priority, for an advisory panel hint only.
|
|
104
|
+
*
|
|
105
|
+
* Pure string comparison over two arrays, normalized exactly the way provider
|
|
106
|
+
* selection normalizes ids (trim + lowercase). It deliberately never reaches
|
|
107
|
+
* provenance, effective state, routing, preflight, or evidence: a changed priority
|
|
108
|
+
* is a new suggestion, not proof that persisted tiers went stale.
|
|
109
|
+
*/
|
|
110
|
+
export declare function autoroutingProviderOrderHint(setupProviders: readonly string[], currentOrder: readonly string[]): AutoroutingProviderOrderHint;
|
|
111
|
+
export type AutoroutingSettingsBatchPatch = {
|
|
112
|
+
path: "task.autorouting.tiers";
|
|
113
|
+
op: "set";
|
|
114
|
+
value: TierMap;
|
|
115
|
+
} | {
|
|
116
|
+
path: "task.autorouting.setup";
|
|
117
|
+
op: "set";
|
|
118
|
+
value: AutoroutingSetup;
|
|
119
|
+
} | {
|
|
120
|
+
path: "task.autorouting.provenance";
|
|
121
|
+
op: "set";
|
|
122
|
+
value: AutoroutingProvenance;
|
|
123
|
+
} | {
|
|
124
|
+
path: "task.autorouting.tiers" | "task.autorouting.setup" | "task.autorouting.provenance";
|
|
125
|
+
op: "unset";
|
|
126
|
+
};
|
|
127
|
+
/** Build the one atomic settings batch used by autorouting Apply/Refresh or Clear. */
|
|
128
|
+
export declare function buildAutoroutingSettingsBatch(input: {
|
|
129
|
+
tiers: TierMap;
|
|
130
|
+
setup: AutoroutingSetup;
|
|
131
|
+
provenance: AutoroutingProvenance;
|
|
132
|
+
} | {
|
|
133
|
+
clear: true;
|
|
134
|
+
}): readonly AutoroutingSettingsBatchPatch[];
|
|
135
|
+
/** Convenience aliases for controller intents that all use one atomic batch. */
|
|
136
|
+
export declare const buildAutoroutingApplyPatches: typeof buildAutoroutingSettingsBatch;
|
|
137
|
+
export declare const buildAutoroutingRefreshPatches: typeof buildAutoroutingSettingsBatch;
|
|
138
|
+
export declare const buildAutoroutingClearPatches: () => readonly AutoroutingSettingsBatchPatch[];
|
|
139
|
+
/** Build the separate single-key enabled toggle mutation. */
|
|
140
|
+
export declare function buildAutoroutingEnabledPatch(enabled: boolean): {
|
|
141
|
+
path: "task.autorouting.enabled";
|
|
142
|
+
op: "set";
|
|
143
|
+
value: boolean;
|
|
144
|
+
};
|
|
145
|
+
/** Validate effective enablement and map cross-field semantics. */
|
|
146
|
+
export declare function validateAutoroutingEffective(fragment: unknown): AutoroutingEffective;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pure autorouting chain materialization.
|
|
3
|
+
*
|
|
4
|
+
* The generator consumes an explicit setup, a curation map, and a complete
|
|
5
|
+
* model-registry snapshot. It never reads credentials, the clock, network
|
|
6
|
+
* state, or discovery availability.
|
|
7
|
+
*/
|
|
8
|
+
import type { Api, Model } from "@gajae-code/ai/core";
|
|
9
|
+
import { type AutoroutingSetup, type TierMap } from "./autorouting-contract";
|
|
10
|
+
import { type AutoroutingCuratedTierMap, type CuratedTierLabels } from "./autorouting-tier-map";
|
|
11
|
+
export type { AutoroutingSetup } from "./autorouting-contract";
|
|
12
|
+
export { canonicalJsonBytes } from "./autorouting-tier-map";
|
|
13
|
+
export declare const AUTOROUTING_GENERATOR_VERSION = 1;
|
|
14
|
+
export declare const GENERATOR_VERSION = 1;
|
|
15
|
+
export type AutoroutingGeneratorMap = AutoroutingCuratedTierMap | CuratedTierLabels | {
|
|
16
|
+
labels: CuratedTierLabels;
|
|
17
|
+
skips?: Record<`${string}/${string}`, {
|
|
18
|
+
rationale: string;
|
|
19
|
+
baseline?: true;
|
|
20
|
+
}>;
|
|
21
|
+
skipList?: Record<`${string}/${string}`, {
|
|
22
|
+
rationale: string;
|
|
23
|
+
baseline?: true;
|
|
24
|
+
}>;
|
|
25
|
+
version: number;
|
|
26
|
+
};
|
|
27
|
+
export type AutoroutingCuratedMap = AutoroutingGeneratorMap;
|
|
28
|
+
export type AutoroutingSourceIdentity = {
|
|
29
|
+
catalogFingerprint: string;
|
|
30
|
+
mapFingerprint: string;
|
|
31
|
+
generatorVersion: number;
|
|
32
|
+
};
|
|
33
|
+
export type GeneratedTierChains = {
|
|
34
|
+
tiers: TierMap;
|
|
35
|
+
declarationFingerprint: string;
|
|
36
|
+
tiersFingerprint: string;
|
|
37
|
+
sourceIdentity: AutoroutingSourceIdentity;
|
|
38
|
+
};
|
|
39
|
+
/** Generate deterministic fast/balanced/strong fallback chains. */
|
|
40
|
+
export declare function generateTierChains(setup: AutoroutingSetup, curatedMap: AutoroutingGeneratorMap | undefined, catalog: readonly Model<Api>[]): GeneratedTierChains;
|