@staix/agent-hub 0.51.0 → 0.52.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 +35 -0
- package/README.md +1 -1
- package/docs/adding-an-ai-tool.md +24 -2
- package/docs/agent-notes/adapters.md +1 -0
- package/docs/agent-notes/budget.md +8 -2
- package/docs/agent-notes/daemon.md +13 -8
- package/docs/agent-notes/security-review.md +6 -5
- package/docs/agent-notes/tasks.md +5 -2
- package/docs/agent-notes/tests.md +4 -3
- package/docs/cooperbench.md +1 -1
- package/docs/design/adapters.md +4 -0
- package/docs/design/cli-output-inventory.md +162 -152
- package/docs/design/cli-output.md +4 -3
- package/docs/design/guidance-probes.md +1 -0
- package/docs/design/roadmap.md +2 -0
- package/docs/design/task-board.md +1 -0
- package/docs/dogfood.md +14 -0
- package/docs/events.md +4 -2
- package/docs/memory.md +5 -3
- package/docs/operations.md +210 -16
- package/docs/quickstart.md +12 -2
- package/docs/roles.md +1 -1
- package/docs/sdlc.md +26 -3
- package/docs/security.md +11 -5
- package/docs/specs/2026-09-19-agent-hub-design.md +43 -0
- package/docs/specs/2026-09-19-multi-project-design.md +4 -0
- package/docs/specs/2026-09-20-upgrade-recovery-design.md +17 -0
- package/docs/specs/mcp-endpoint.md +63 -0
- package/docs/verification/2026-11-30-capability-listing-shape-1808.md +45 -0
- package/docs/verification/2026-11-30-upgrade-keep-1807.md +174 -0
- package/docs/verification/2026-12-01-1811-confirmation-receipt.md +19 -0
- package/docs/verification/2026-12-01-1811-orca-agent-list.md +20 -0
- package/docs/verification/2026-12-01-1811-orca-pane-key.md +21 -0
- package/docs/verification/2026-12-02-1819-claude-process-after-renewal.md +54 -0
- package/docs/verification/2026-12-02-agy-1.5.21.md +74 -0
- package/docs/verification/2026-12-02-claude-implementer-2.1.334.md +44 -0
- package/docs/verification/2026-12-02-cli-import-graph.md +33 -0
- package/docs/verification/2026-12-03-0.52.0.md +150 -0
- package/docs/verification/2026-12-03-codex-0173-reviewer-isolation.md +53 -0
- package/docs/verification/2026-12-03-codex-0173-reviewer-tool-call.md +34 -0
- package/docs/verification/2026-12-03-jcode-1.3.0.md +25 -0
- package/docs/verification/agy/README.md +17 -0
- package/docs/verification/agy/cli-surface.ts +68 -0
- package/docs/verification/agy/interactive-bridge.ts +92 -0
- package/docs/verification/agy/interactive-session.ts +131 -0
- package/docs/verification/agy/launcher-nonce.ts +215 -0
- package/docs/verification/agy/native-hooks.ts +210 -0
- package/docs/verification/agy/originals/agent-hub-681/cli-surface.ts +87 -0
- package/docs/verification/agy/originals/agent-hub-681/native-hooks-adapted.ts +91 -0
- package/docs/verification/agy/originals/agent-hub-681/tui-actual.ts +200 -0
- package/docs/verification/agy/originals/agent-hub-684/probe.ts +107 -0
- package/docs/verification/agy/originals.json +25 -0
- package/docs/verification/agy/permission-new-functions.ts +128 -0
- package/docs/verification/agy/run-probe.py +108 -0
- package/docs/verification/agy/runtime.ts +171 -0
- package/docs/verification/agy/tmux-helper-control.ts +6 -0
- package/docs/verification/agy/tmux-session.ts +235 -0
- package/docs/verified.json +82 -41
- package/package.json +3 -3
- package/plugins/agent-hub/.claude-plugin/plugin.json +1 -1
- package/plugins/agent-hub/compat.json +157 -0
- package/plugins/agent-hub/kimi-hook.js +621 -865
- package/plugins/agent-hub/server.js +17423 -32962
- package/src/adapters/agy/definition.ts +7 -24
- package/src/adapters/channel-peer.ts +3 -1
- package/src/adapters/claude-channel.ts +38 -257
- package/src/adapters/claude-implementer.ts +3 -1
- package/src/adapters/codex-appserver.ts +77 -15
- package/src/adapters/compat.ts +74 -11
- package/src/adapters/configured-acp.ts +23 -163
- package/src/adapters/configured-adapter-policy.ts +160 -0
- package/src/adapters/configured-pull-entry.ts +53 -0
- package/src/adapters/configured-pull.ts +38 -0
- package/src/adapters/conformance/fakes/app-server.ts +9 -2
- package/src/adapters/declaration-catalog.ts +25 -0
- package/src/adapters/declaration-data.ts +342 -0
- package/src/adapters/declaration-resolution.ts +53 -0
- package/src/adapters/definitions/builtin-metadata.ts +61 -83
- package/src/adapters/definitions/jcode-launch.ts +13 -0
- package/src/adapters/definitions/native-adapter-policy.ts +390 -0
- package/src/adapters/definitions/native-cli-claude-launch.ts +3 -2
- package/src/adapters/definitions/native-cli-codex-launch.ts +2 -1
- package/src/adapters/definitions/native-cli-entry-jcode.ts +4 -2
- package/src/adapters/definitions/native-cli-entry-types.ts +9 -2
- package/src/adapters/definitions/native-cli-launch-common.ts +2 -2
- package/src/adapters/definitions/native-cli-retained.ts +1 -1
- package/src/adapters/definitions/native-configuration.ts +18 -0
- package/src/adapters/definitions/native-help.ts +24 -0
- package/src/adapters/definitions/native-launch-declarations.ts +34 -0
- package/src/adapters/definitions/native-launch-policy.ts +4 -0
- package/src/adapters/definitions/native-launch-settings.ts +72 -0
- package/src/adapters/definitions/native-light-cli.ts +18 -0
- package/src/adapters/definitions/native-light-preview.ts +10 -0
- package/src/adapters/definitions/native-wrapper-launch.ts +10 -0
- package/src/adapters/definitions/qwen.ts +6 -29
- package/src/adapters/definitions/reviewer-variants.ts +7 -8
- package/src/adapters/external-declarations.ts +31 -0
- package/src/adapters/external-modules.ts +4 -29
- package/src/adapters/jcode.ts +3 -12
- package/src/adapters/native-capabilities.ts +18 -8
- package/src/adapters/native-proof-ports.ts +1 -1
- package/src/adapters/presets.ts +136 -0
- package/src/adapters/qwen-dual.ts +2 -2
- package/src/adapters/registry-types.ts +3 -0
- package/src/adapters/registry.ts +20 -81
- package/src/adapters/reviewer-print.ts +26 -9
- package/src/adapters/role-eligibility.ts +2 -1
- package/src/cli/accounts-import.ts +72 -0
- package/src/cli/agents-latest-table.ts +88 -0
- package/src/cli/agents-latest.ts +22 -0
- package/src/cli/agents-output.ts +10 -0
- package/src/cli/agents-presets.ts +100 -0
- package/src/cli/agents.ts +1 -1
- package/src/cli/attention.ts +3 -2
- package/src/cli/autonomy-homes.ts +7 -2
- package/src/cli/budget-renew-guidance.ts +129 -0
- package/src/cli/claude-homes.ts +9 -5
- package/src/cli/command-context.ts +3 -0
- package/src/cli/command-table.ts +123 -0
- package/src/cli/commands/accounts.ts +8 -0
- package/src/cli/commands/agents.ts +18 -0
- package/src/cli/commands/answer.ts +28 -0
- package/src/cli/commands/ask.ts +17 -0
- package/src/cli/commands/autonomy.ts +83 -0
- package/src/cli/commands/backlog.ts +46 -0
- package/src/cli/commands/bench.ts +60 -0
- package/src/cli/commands/board.ts +48 -0
- package/src/cli/commands/broker.ts +9 -0
- package/src/cli/commands/budget.ts +96 -0
- package/src/cli/commands/capabilities.ts +12 -0
- package/src/cli/commands/check-path.ts +55 -0
- package/src/cli/commands/completion.ts +8 -0
- package/src/cli/commands/console.ts +12 -0
- package/src/cli/commands/daemon.ts +8 -0
- package/src/cli/commands/deliverables.ts +25 -0
- package/src/cli/commands/doctor.ts +249 -0
- package/src/cli/commands/down.ts +3 -0
- package/src/cli/commands/export.ts +15 -0
- package/src/cli/commands/facts.ts +15 -0
- package/src/cli/commands/goal.ts +22 -0
- package/src/cli/commands/guidance.ts +102 -0
- package/src/cli/commands/help.ts +17 -0
- package/src/cli/commands/host.ts +45 -0
- package/src/cli/commands/init.ts +121 -0
- package/src/cli/commands/instructed.ts +19 -0
- package/src/cli/commands/instruction-hook.ts +15 -0
- package/src/cli/commands/intake.ts +24 -0
- package/src/cli/commands/kill.ts +15 -0
- package/src/cli/commands/learn.ts +23 -0
- package/src/cli/commands/lineage.ts +30 -0
- package/src/cli/commands/logs.ts +21 -0
- package/src/cli/commands/manager.ts +15 -0
- package/src/cli/commands/memory.ts +21 -0
- package/src/cli/commands/model.ts +25 -0
- package/src/cli/commands/models.ts +40 -0
- package/src/cli/commands/native.ts +39 -0
- package/src/cli/commands/pause.ts +5 -0
- package/src/cli/commands/peer.ts +32 -0
- package/src/cli/commands/permission.ts +26 -0
- package/src/cli/commands/permit.ts +12 -0
- package/src/cli/commands/pet.ts +24 -0
- package/src/cli/commands/projects.ts +49 -0
- package/src/cli/commands/queue.ts +70 -0
- package/src/cli/commands/recovery-run.ts +13 -0
- package/src/cli/commands/recovery.ts +130 -0
- package/src/cli/commands/release.ts +23 -0
- package/src/cli/commands/releases.ts +9 -0
- package/src/cli/commands/remember.ts +6 -0
- package/src/cli/commands/report.ts +27 -0
- package/src/cli/commands/research.ts +53 -0
- package/src/cli/commands/reset.ts +89 -0
- package/src/cli/commands/restart.ts +5 -0
- package/src/cli/commands/results.ts +31 -0
- package/src/cli/commands/resume.ts +5 -0
- package/src/cli/commands/review.ts +24 -0
- package/src/cli/commands/roadmap.ts +21 -0
- package/src/cli/commands/role.ts +34 -0
- package/src/cli/commands/roles.ts +30 -0
- package/src/cli/commands/room.ts +14 -0
- package/src/cli/commands/roster.ts +48 -0
- package/src/cli/commands/route.ts +9 -0
- package/src/cli/commands/say.ts +21 -0
- package/src/cli/commands/schedule.ts +17 -0
- package/src/cli/commands/sdlc.ts +321 -0
- package/src/cli/commands/settings.ts +148 -0
- package/src/cli/commands/setup.ts +89 -0
- package/src/cli/commands/shared-refusals.ts +25 -0
- package/src/cli/commands/smoke.ts +44 -0
- package/src/cli/commands/source.ts +64 -0
- package/src/cli/commands/specs.ts +13 -0
- package/src/cli/commands/status.ts +28 -0
- package/src/cli/commands/stop.ts +17 -0
- package/src/cli/commands/structure.ts +60 -0
- package/src/cli/commands/study.ts +39 -0
- package/src/cli/commands/tail.ts +19 -0
- package/src/cli/commands/task.ts +114 -0
- package/src/cli/commands/title.ts +17 -0
- package/src/cli/commands/turns.ts +10 -0
- package/src/cli/commands/ui.ts +47 -0
- package/src/cli/commands/undo.ts +77 -0
- package/src/cli/commands/up.ts +39 -0
- package/src/cli/commands/upgrade.ts +5 -0
- package/src/cli/commands/usage.ts +33 -0
- package/src/cli/commands/version.ts +5 -0
- package/src/cli/commands/watch.ts +30 -0
- package/src/cli/commands/worktrees.ts +31 -0
- package/src/cli/console-state.ts +5 -138
- package/src/cli/console-versions.ts +1 -1
- package/src/cli/help.ts +37 -15
- package/src/cli/identity.ts +23 -4
- package/src/cli/launch-check.ts +1 -2
- package/src/cli/launch.ts +13 -82
- package/src/cli/light-dispatch.ts +29 -0
- package/src/cli/main.js +8 -1
- package/src/cli/main.ts +233 -2816
- package/src/cli/orca-probe.ts +119 -0
- package/src/cli/output.ts +31 -2
- package/src/cli/preview.ts +10 -5
- package/src/cli/recovery-version-preflight.ts +28 -9
- package/src/cli/replace-process.ts +22 -0
- package/src/cli/report-layout.ts +142 -0
- package/src/cli/roadmap-usage.ts +16 -0
- package/src/cli/roadmap.ts +3 -16
- package/src/cli/sdlc-doctor.ts +27 -0
- package/src/cli/sdlc-output.ts +55 -1
- package/src/cli/setup-homes.ts +1 -1
- package/src/cli/start-agents-run.ts +1 -1
- package/src/cli/statusline-tee.ts +25 -4
- package/src/cli/terminal-recovery.ts +53 -10
- package/src/cli/upgrade-interactive.ts +1 -0
- package/src/cli/upgrade-runtime.ts +11 -0
- package/src/cli/upgrade.ts +4 -15
- package/src/hub/accounts.ts +148 -0
- package/src/hub/addons.ts +20 -0
- package/src/hub/agent-drift.ts +2 -1
- package/src/hub/budget-projection.ts +39 -7
- package/src/hub/budget.ts +231 -16
- package/src/hub/channel-project.ts +3 -3
- package/src/hub/conductor-peer.ts +24 -0
- package/src/hub/conductor.ts +2 -21
- package/src/hub/config-apply.ts +24 -13
- package/src/hub/config-edit.ts +1 -1
- package/src/hub/config-tier.ts +2 -0
- package/src/hub/config.ts +31 -14
- package/src/hub/control-client.ts +48 -0
- package/src/hub/daemon.ts +421 -61
- package/src/hub/events.ts +3 -0
- package/src/hub/home-tag.ts +12 -0
- package/src/hub/host.ts +217 -0
- package/src/hub/hub-tools.ts +2 -1
- package/src/hub/instance-budget.ts +2 -2
- package/src/hub/instance-config.ts +15 -126
- package/src/hub/instances.ts +22 -6
- package/src/hub/instruction-receipt.ts +2 -2
- package/src/hub/kimi-usage.ts +38 -11
- package/src/hub/lifecycle.ts +86 -4
- package/src/hub/mcp-bridge-core.ts +98 -0
- package/src/hub/mcp-channel-push.ts +20 -0
- package/src/hub/mcp-endpoint-serve.ts +178 -0
- package/src/hub/mcp-endpoint.ts +226 -0
- package/src/hub/mcp-tool-call.ts +181 -0
- package/src/hub/operational-settings.ts +2 -0
- package/src/hub/orca-env.ts +6 -0
- package/src/hub/orca-state.ts +84 -0
- package/src/hub/peers.ts +5 -1
- package/src/hub/permission-mode.ts +2 -1
- package/src/hub/project.ts +20 -0
- package/src/hub/protocol-window.ts +58 -0
- package/src/hub/quota-origin.ts +20 -0
- package/src/hub/registry.ts +36 -2
- package/src/hub/report.ts +1 -1
- package/src/hub/research.ts +1 -1
- package/src/hub/review-brief.ts +47 -2
- package/src/hub/roster.ts +6 -3
- package/src/hub/routing.ts +9 -2
- package/src/hub/sdlc-check.ts +205 -0
- package/src/hub/sdlc-sync.ts +146 -0
- package/src/hub/sdlc.ts +33 -4
- package/src/hub/settings.ts +7 -4
- package/src/hub/start-agents.ts +1 -1
- package/src/hub/start-mode.ts +11 -4
- package/src/hub/structure-budget.ts +131 -0
- package/src/hub/structure-scan.ts +149 -0
- package/src/hub/tasks-experiment.ts +455 -0
- package/src/hub/tasks-guidance.ts +606 -0
- package/src/hub/tasks-roadmap-plan.ts +419 -0
- package/src/hub/tasks-roadmap.ts +491 -0
- package/src/hub/tasks-study.ts +661 -0
- package/src/hub/tasks-survey.ts +192 -0
- package/src/hub/tasks.ts +319 -2548
- package/src/hub/terminal-open.ts +5 -3
- package/src/hub/tooling.ts +3 -19
- package/src/hub/usage-rollup.ts +9 -3
- package/src/local/tools.ts +5 -0
- package/src/ui/index.html +1 -1
- package/src/ui/needs.ts +17 -5
- package/src/ui/peer-palette.ts +2 -4
- package/templates/presets/agents.json +60 -0
- package/templates/presets/confirmation-matrix.json +8 -8
package/src/hub/config-apply.ts
CHANGED
|
@@ -1,17 +1,21 @@
|
|
|
1
|
+
import { DECLARATION_START_MODE_PEERS } from "../adapters/declaration-catalog.ts";
|
|
1
2
|
import { operationalNumber, OPERATIONAL_NUMBERS } from "./operational-settings.ts";
|
|
2
3
|
import { parseResearchRunners } from "./research-runner.ts";
|
|
3
4
|
import { QUEUE_BACKPRESSURE_LIMITS } from "./queue-backpressure.ts";
|
|
4
5
|
import { operationalSettingKey } from "./operational-authority.ts";
|
|
6
|
+
import { DEFAULT_BRIDGE_WINDOW, bridgeWindowSettings } from "./protocol-window.ts";
|
|
5
7
|
import { remoteRunnerConfig } from "./check-runner.ts";
|
|
6
8
|
import { ACTION_CLASSES } from "./action-class.ts";
|
|
7
9
|
import { actionPolicyConfig } from "./action-policy.ts";
|
|
8
|
-
import { adapterModuleDeclarations } from "../adapters/external-
|
|
10
|
+
import { adapterModuleDeclarations } from "../adapters/external-declarations.ts";
|
|
9
11
|
import { externalMetadataDefinitions, type ExternalAdapterMetadata } from "../adapters/external-metadata.ts";
|
|
10
12
|
import { reviewerPoolConfig } from "./reviewer-pool-config.ts";
|
|
11
13
|
import type { HubConfig } from "./config.ts";
|
|
12
14
|
import { ALL_MACHINE_LOCAL, configRepositoryPresent, configTracked } from "./config-trust.ts";
|
|
13
15
|
import { structuralLeaf } from "./config-tier.ts";
|
|
14
|
-
import {
|
|
16
|
+
import { NATIVE_CONFIGURATION } from "../adapters/definitions/native-configuration.ts";
|
|
17
|
+
import { createProjectDeclarationCatalog, DECLARATION_DEFAULT_REVIEW_POOL as DEFAULT_REVIEW_POOL, DECLARATION_REVIEW_POOL_KINDS as REVIEW_POOL_KINDS, DECLARATION_SUPPORTED_PEERS as SUPPORTED_PEERS, DECLARATION_PLANNER_PEERS as PLANNER_PEERS } from "../adapters/declaration-catalog.ts";
|
|
18
|
+
import type { ProjectAdapterCatalog } from "../adapters/registry-types.ts";
|
|
15
19
|
import { CLASSES } from "./board.ts";
|
|
16
20
|
import { permissionDefaults } from "./permission-mode.ts";
|
|
17
21
|
import { peerStartConfig, terminalTemplate } from "./start-mode.ts";
|
|
@@ -36,7 +40,7 @@ export interface ConfigIdentityScope { catalog: ProjectAdapterCatalog; instances
|
|
|
36
40
|
/** Plain captured metadata stays cloneable with ConfigSources; native callbacks are compiled outside it. */
|
|
37
41
|
export interface ConfigIdentitySnapshot { adapters?: HubConfig["adapters"]; externalAdapters?: readonly ExternalAdapterMetadata[]; instances: InstancesConfig }
|
|
38
42
|
export function configIdentityScope(snapshot: ConfigIdentitySnapshot): ConfigIdentityScope {
|
|
39
|
-
return { catalog:
|
|
43
|
+
return { catalog: createProjectDeclarationCatalog(snapshot.adapters, externalMetadataDefinitions(snapshot.externalAdapters)), instances: snapshot.instances };
|
|
40
44
|
}
|
|
41
45
|
export interface ConfigChange extends ApplyRule { key: string; before: unknown; after: unknown }
|
|
42
46
|
export interface ConfigLayer { name: "config.json" | "config.local.json"; raw: Record<string, unknown> }
|
|
@@ -197,13 +201,13 @@ const researchRunners: Check = value => { parseResearchRunners(value); };
|
|
|
197
201
|
shapes.set(researchRunners, { item: block({ publicKey: text, projects: strings, revoked: bool }) });
|
|
198
202
|
const schema: Record<string, Check> = {
|
|
199
203
|
_autonomy: v => { autonomyOwnership(v); },
|
|
200
|
-
...Object.assign({}, ...
|
|
204
|
+
...Object.assign({}, ...NATIVE_CONFIGURATION.map(policy => policy.schema?.(nativeValidators) ?? {})),
|
|
201
205
|
watchdog_ms: number(1, 2_147_483_647), kimi_cmd: argv, qwen_cmd: argv, jcode_cmd: argv, codex_bin: text, jcode_home: text, jcode_mcp_allow: strings, jcode_provider_profile: text,
|
|
202
206
|
action_policy: block({ enabled: bool, floor: bool, always_ask: (v, k) => { actionPolicyConfig({ always_ask: v }); }, budgets: map(number(0, 1000, true), ACTION_CLASSES) }),
|
|
203
207
|
permission_modes: v => { permissionDefaults(v); }, protect_instruction_files: bool,
|
|
204
208
|
instructed: block({ mode: words(["off", "exact", "intent"]) }),
|
|
205
209
|
adapter_modules: v => { adapterModuleDeclarations(v); },
|
|
206
|
-
adapters: v => {
|
|
210
|
+
adapters: v => { createProjectDeclarationCatalog(v); }, instances: v => { validateInstances(v, createProjectDeclarationCatalog()); }, pet: validatePetConfig,
|
|
207
211
|
batch_max: number(1, 100_000, true), batch_ms: number(0, 2_147_483_647), queue_cap: number(1, 1_000_000, true),
|
|
208
212
|
memory: block({ enabled: bool, worker_url: text, inject_tokens: number(0, 1_000_000, true), brief_items: number(0, 10_000, true), native: bool,
|
|
209
213
|
short_ttl_days: number(1, 3650, true), sync_interval_min: number(0, 1440, true), suggest_edges: bool, preface_unused_after: number(0, 100_000, true),
|
|
@@ -218,7 +222,7 @@ const schema: Record<string, Check> = {
|
|
|
218
222
|
// S6 owns this closed schema at the committed candidate boundary; config.local is ignored before runtime publication.
|
|
219
223
|
release: () => {},
|
|
220
224
|
conductor: block({ feed: words(["own", "all", "off"]), approval_wait_s: number(0, 2_147_483_647 / 1000) }),
|
|
221
|
-
budget: block({ gate: number(0, 1), stale_min: timerMinutes, poll_min: timerMinutes, checkpoint_timeout_s: timerSeconds, kimi_tokens_5h: number(0), wait_max_min: number(0) }),
|
|
225
|
+
budget: block({ gate: number(0, 1), stale_min: timerMinutes, poll_min: timerMinutes, checkpoint_timeout_s: timerSeconds, kimi_tokens_5h: number(0), wait_max_min: number(0), cross_account_handoff: bool }),
|
|
222
226
|
context: block({ gate: number(0, 1), stale_min: timerMinutes, max_assignment_used: number(0, 1) }),
|
|
223
227
|
supervision: block({ mode: words(["off", "shadow", "advisory"]) }),
|
|
224
228
|
edit_governance: block({ arm: words(["baseline", "route_guard", "occ_guard", "combined_guard"]) }),
|
|
@@ -243,22 +247,27 @@ const schema: Record<string, Check> = {
|
|
|
243
247
|
else if (/^[a-z][a-z0-9_]{0,47}$/.test(key)) text(value, `${k}.${key}`); else fail(`${k}.${key}`, "unknown key");
|
|
244
248
|
} },
|
|
245
249
|
visuals: block({ retention_days: number(1, 3650, true) }),
|
|
246
|
-
snapshots: block({ enabled: bool, keep: number(1, 1_000_000, true) }), research: block({ enabled: bool, runners: researchRunners }), bench: block({ enabled: bool }),
|
|
250
|
+
snapshots: block({ enabled: bool, keep: number(1, 1_000_000, true) }), research: block({ enabled: bool, runners: researchRunners }), bench: block({ enabled: bool }), host: block({ shared: bool }),
|
|
247
251
|
worktrees: block({ quiet_days: number(0, 3650, true), alert_over: number(0, 100_000, true) }),
|
|
248
252
|
// #1053: how long an unanswered question waits (`ttl_s`, 1 minute to 30 days) and, per adapter kind, how long a `hub_ask` call waits for the person before it answers `pending`.
|
|
249
253
|
questions: block({ ttl_s: number(60, 2_592_000, true), wait_ms: map(number(1000, 600_000, true)) }),
|
|
250
|
-
peers: (v, k) => { map(block({ start_mode: words(["tui", "headless"]) }),
|
|
254
|
+
peers: (v, k) => { map(block({ start_mode: words(["tui", "headless"]) }), DECLARATION_START_MODE_PEERS)(v, k); peerStartConfig(v); },
|
|
251
255
|
terminal: (v, k) => { block({ open: strings })(v, k); terminalTemplate(object(v, k).open); },
|
|
252
256
|
start: (v, k) => { block({ agents: strings })(v, k); if (object(v, k).agents !== undefined) checkStartAgents(object(v, k).agents, `${k}.agents`); },
|
|
253
257
|
limits: block({ sender_per_min: number(0), pair_per_min: number(0), important_per_hour: number(0), repeat_window_s: number(0) }),
|
|
254
258
|
review: block({ adaptive: bool, min_reviews: number(1, Number.MAX_SAFE_INTEGER, true), pool: v => { reviewerPoolConfig({ pool: v }, DEFAULT_REVIEW_POOL, REVIEW_POOL_KINDS); }, rerotate: bool, same_family: words(["fallback", "never"]),
|
|
255
259
|
gate: value => { reviewerPoolConfig({ gate: value }, DEFAULT_REVIEW_POOL, REVIEW_POOL_KINDS); }, unknown_quota: value => { reviewerPoolConfig({ unknown_quota: value }, DEFAULT_REVIEW_POOL, REVIEW_POOL_KINDS); }, max_minutes: value => { reviewerPoolConfig({ max_minutes: value }, DEFAULT_REVIEW_POOL, REVIEW_POOL_KINDS); } }), recovery: block({ auto_resume_after_crash: bool, reconnect_wait_s: operationalNumberCheck("recovery.reconnect_wait_s"), unmanaged_reconnect_wait_s: operationalNumberCheck("recovery.unmanaged_reconnect_wait_s"), control_timeout_s: operationalNumberCheck("recovery.control_timeout_s"), shutdown_wait_s: operationalNumberCheck("recovery.shutdown_wait_s"), terminal_idle_wait_s: operationalNumberCheck("recovery.terminal_idle_wait_s") }),
|
|
260
|
+
upgrade: value => { bridgeWindowSettings(value); },
|
|
256
261
|
capabilities: map(strings), invocation: block({ share: map(map(() => {})), timeout_s: number(10, 86_400, true) }), coordination: words(["advisory", "turn-free"]), experiments: block({ stale_notices: words(["drop", "deliver"]) }),
|
|
257
262
|
};
|
|
258
263
|
export const SCHEMA_KEYS: readonly string[] = Object.freeze(Object.keys(schema));
|
|
259
264
|
export function validateRawConfig(raw: unknown, declarations?: InstancesConfig, context?: ProjectAdapterCatalog, inertModuleRoster = false): asserts raw is Record<string, unknown> {
|
|
260
265
|
const value = object(raw, "config");
|
|
261
|
-
const catalog = value.adapters !== undefined
|
|
266
|
+
const catalog = value.adapters !== undefined
|
|
267
|
+
? context?.externalDefinitions.some(row => row.start.create !== undefined)
|
|
268
|
+
? (require("../adapters/registry.ts") as typeof import("../adapters/registry.ts")).createProjectAdapterCatalog(value.adapters, context.externalDefinitions)
|
|
269
|
+
: createProjectDeclarationCatalog(value.adapters, context?.externalDefinitions)
|
|
270
|
+
: context ?? createProjectDeclarationCatalog();
|
|
262
271
|
const instances = validateInstances(value.instances ?? declarations, catalog);
|
|
263
272
|
block({ ...schema,
|
|
264
273
|
instances: v => { validateInstances(v, catalog); },
|
|
@@ -279,20 +288,21 @@ export function validateEffectiveConfig(value: unknown, catalog?: ProjectAdapter
|
|
|
279
288
|
validateRawConfig(raw, undefined, catalog);
|
|
280
289
|
const profile = resolveProfile(raw.profile, raw.profile_overrides);
|
|
281
290
|
for (const key of Object.keys(object(raw.checks, "checks"))) if (!["timeout_s", "runner", "remote", ...CLASSES, ...Object.keys(profile.classes)].includes(key)) fail(`checks.${key}`, "unknown task class");
|
|
282
|
-
for (const
|
|
291
|
+
for (const policy of NATIVE_CONFIGURATION) policy.validateEffective?.(raw, fail);
|
|
283
292
|
}
|
|
284
293
|
|
|
285
294
|
const restart: Record<string, string> = {
|
|
286
295
|
adapter_modules: "External adapter modules are verified and imported only at daemon startup",
|
|
287
296
|
adapters: "Configured adapter identity, commands and capability policy are fixed at daemon startup",
|
|
288
297
|
instances: "Native instance identity, worktree, ports and account bindings are fixed at daemon startup",
|
|
289
|
-
...Object.assign({}, ...
|
|
298
|
+
...Object.assign({}, ...NATIVE_CONFIGURATION.map(policy => policy.restartReasons ?? {})),
|
|
290
299
|
memory: "Open memory consumers, selected profile, client and sync timer must be quiesced together",
|
|
291
300
|
omniroute: "Credentials and gateway clients are bound to relay ownership", mlx: "Model runtime ownership and device resources belong to this daemon",
|
|
292
301
|
checks: "Bounded runner and completion-check contracts are constructed together",
|
|
302
|
+
upgrade: "Restart to apply the accepted bridge protocol range, bounded by the implementation floor",
|
|
293
303
|
pii: "Existing native sessions retain their startup privacy boundary", data: "Existing native sessions retain their startup read-only policy",
|
|
294
304
|
profile: "Session tool schemas and profile contracts are bound at startup", profile_overrides: "Session tool schemas and profile contracts are bound at startup",
|
|
295
|
-
text_projection: "Converter and cache ownership are bound at startup", corpus: "The corpus index is bound to its roots at startup", roadmap: "GitHub mirror authority is bound at startup", terminal: "Terminal provider is supplied by the daemon lifecycle", bench: "Benchmark execution environment is selected before work starts",
|
|
305
|
+
text_projection: "Converter and cache ownership are bound at startup", corpus: "The corpus index is bound to its roots at startup", roadmap: "GitHub mirror authority is bound at startup", terminal: "Terminal provider is supplied by the daemon lifecycle", bench: "Benchmark execution environment is selected before work starts", host: "The process a project runs in is chosen when it starts",
|
|
296
306
|
};
|
|
297
307
|
const live = new Set(["instructed", "visuals", "action_policy", "permission", "roster", "roles", "planner", "conductor", "protect_instruction_files", "task_sweep", "capabilities", "invocation", "research", "snapshots", "worktrees", "tasks.wip_limits", "tasks.escalate_after", "tasks.auto_pull", "tasks.queue_backpressure", "schedules", "approvals.notify", "questions", "pet", "specs", "supervision", "edit_governance"]);
|
|
298
308
|
const nextMemory = new Set(["memory.inject_tokens", "memory.brief_items", "memory.suggest_edges", "memory.preface_unused_after"]);
|
|
@@ -303,6 +313,7 @@ export function configApply(key: string, scopes: readonly ConfigIdentityScope[]
|
|
|
303
313
|
if (top !== "routing" && top !== "permission" && key.includes(".")) {
|
|
304
314
|
const special: Record<string, readonly string[]> = {
|
|
305
315
|
specs: ["enabled", "review", "roots", "stamps_file"],
|
|
316
|
+
upgrade: Object.keys(DEFAULT_BRIDGE_WINDOW),
|
|
306
317
|
task_sweep: ["enabled", "auto_reassign", "no_writes_turns", "interval_s", "unaccepted_min", "idle_min", "review_min", "ready_min", "ladder_min"],
|
|
307
318
|
checks: ["timeout_s", "runner", "remote", ...CLASSES], terminal: ["open"], start: ["agents"],
|
|
308
319
|
};
|
|
@@ -316,7 +327,7 @@ export function configApply(key: string, scopes: readonly ConfigIdentityScope[]
|
|
|
316
327
|
else return fail(key, "unknown configuration key");
|
|
317
328
|
}
|
|
318
329
|
}
|
|
319
|
-
if (top === "routing" && !
|
|
330
|
+
if (top === "routing" && !NATIVE_CONFIGURATION.some(policy => Object.keys(policy.restartReasons ?? {}).some(prefix => prefix.startsWith("routing.") && key.startsWith(prefix))) && key !== "routing") {
|
|
320
331
|
return { applies: ["classes", "stay_switch", "signals", "constraints", "hub_routes", "max_switch_prefill_tokens"].includes(key.split(".")[1]!) ? "live" : "next use" };
|
|
321
332
|
}
|
|
322
333
|
const operational = operationalNumber(key);
|
package/src/hub/config-edit.ts
CHANGED
|
@@ -206,7 +206,7 @@ export function planConfigEdit(cwd: string, rawRequest: unknown, check: Candidat
|
|
|
206
206
|
if (lost) return { ok: false, error: `instances.${path[1]}.${lost}: this replacement would drop a native home or account setting; set only the fields you change (instances.${path[1]}.<field>); nothing was written`, field: `instances.${path[1]}.${lost}` };
|
|
207
207
|
}
|
|
208
208
|
putPath(doc, path, value);
|
|
209
|
-
diff.push({ path: path.join("."), tier: tier.tier, before: held, after: value === null ? undefined : value, applies: path[0] === "instances" ? "restart" : "next use" });
|
|
209
|
+
diff.push({ path: path.join("."), tier: tier.tier, before: held, after: value === null ? undefined : value, applies: path[0] === "instances" || path[0] === "upgrade" ? "restart" : "next use" });
|
|
210
210
|
}
|
|
211
211
|
next = Object.keys(doc).length || before !== null ? `${JSON.stringify(doc, null, 2)}\n` : null;
|
|
212
212
|
if (Buffer.byteLength(next ?? "") > MAX_FILE_BYTES["config.local.json"]) return { ok: false, error: ".agenthub/config.local.json would exceed its size limit; nothing was written" };
|
package/src/hub/config-tier.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { NEVER_EDITABLE, SETTINGS } from "./settings.ts";
|
|
2
|
+
import { DEFAULT_BRIDGE_WINDOW } from "./protocol-window.ts";
|
|
2
3
|
|
|
3
4
|
/**
|
|
4
5
|
* #689: which structural keys a person may edit, and from where.
|
|
@@ -23,6 +24,7 @@ const TIER2_BLOCKS: Readonly<Record<string, readonly string[]>> = {
|
|
|
23
24
|
snapshots: ["keep"],
|
|
24
25
|
approvals: ["timeout_s"],
|
|
25
26
|
context: ["gate"],
|
|
27
|
+
upgrade: Object.keys(DEFAULT_BRIDGE_WINDOW),
|
|
26
28
|
};
|
|
27
29
|
const SDLC_KEYS = ["mode", "required_checks"] as const;
|
|
28
30
|
/** Registry-owned keys keep their own write path: a roster change moves tasks and stops peers, and a WIP limit applies live. */
|
package/src/hub/config.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { queueBackpressurePolicy, type QueueBackpressurePolicy } from "./queue-backpressure.ts";
|
|
2
2
|
import { actionPolicyConfig, type ActionPolicyConfig } from "./action-policy.ts";
|
|
3
|
-
import { type AdapterModuleDeclaration } from "../adapters/external-
|
|
3
|
+
import { type AdapterModuleDeclaration } from "../adapters/external-declarations.ts";
|
|
4
4
|
import { remoteRunnerConfig, type RemoteRunnerConfig } from "./check-runner.ts";
|
|
5
5
|
import { planningWipLimits } from "./planning.ts";
|
|
6
6
|
import { PET_WINDOW_RETIRED_NOTICE, stripLegacyPetWindow } from "../pet/config.ts";
|
|
@@ -9,9 +9,11 @@ import { policyPaths } from "./path-policy.ts";
|
|
|
9
9
|
import { profileName, resolveProfile, mergeProfileOverrides, type ProfileName } from "./profiles.ts";
|
|
10
10
|
import { catalogAssignments } from "./roles.ts";
|
|
11
11
|
import { peerRosterConfig, type PeerRoster } from "./roster.ts";
|
|
12
|
-
import {
|
|
12
|
+
import { isBuiltinAdapterKind } from "../adapters/definitions/native-help.ts";
|
|
13
|
+
import { NATIVE_CONFIG_BLOCKS, nativeConfigurationDefaults, mergeNativeConfiguration } from "../adapters/definitions/native-config-defaults.ts";
|
|
13
14
|
import { effectiveInstanceRoles, type InstancesConfig } from "./instances.ts";
|
|
14
|
-
import {
|
|
15
|
+
import { DEFAULT_BRIDGE_WINDOW, bridgeWindowSettings, type BridgeWindowSettings } from "./protocol-window.ts";
|
|
16
|
+
import { INSTANCE_CONFIG_FILES, readInstanceConfig, readStartupInstanceConfig, withoutInertInstancePolicy, readInstanceConfigLayers } from "./instance-config.ts";
|
|
15
17
|
import { readFileSync } from "node:fs";
|
|
16
18
|
import { join, resolve } from "node:path";
|
|
17
19
|
import { homedir } from "node:os";
|
|
@@ -35,9 +37,9 @@ import { DEFAULT_REVIEW_GATE, DEFAULT_REVIEW_MAX_MINUTES, DEFAULT_REVIEW_UNKNOWN
|
|
|
35
37
|
import { DEFAULT_OMNIROUTE, type OmniRouteConfig } from "../omniroute/client.ts";
|
|
36
38
|
import { DEFAULT_BUDGET, type BudgetConfig } from "./budget.ts";
|
|
37
39
|
import { isAbsolute } from "node:path";
|
|
38
|
-
import { DEFAULT_ROLES } from "
|
|
39
|
-
import { conductorPeer } from "./conductor.ts";
|
|
40
|
-
import { ESCALATE_AFTER } from "./
|
|
40
|
+
import { DEFAULT_ROLES } from "../adapters/definitions/native-adapter-policy.ts";
|
|
41
|
+
import { conductorPeer } from "./conductor-peer.ts";
|
|
42
|
+
import { ESCALATE_AFTER } from "./operational-settings.ts";
|
|
41
43
|
import { DEFAULT_INFERENCE, type InferenceConfig } from "./inference.ts";
|
|
42
44
|
import { loadRouting } from "./routing.ts";
|
|
43
45
|
import { checkSettingValue, settingDef as instanceSettingDef } from "./settings.ts";
|
|
@@ -55,6 +57,8 @@ import { DEFAULT_SPECS_CONFIG, parseSpecsConfig, type SpecsConfig } from "./spec
|
|
|
55
57
|
export interface HubConfig {
|
|
56
58
|
adapter_modules?: readonly AdapterModuleDeclaration[];
|
|
57
59
|
adapters?: Readonly<Record<string, import("../adapters/configured-acp.ts").ConfiguredAdapterConfig>>;
|
|
60
|
+
/** #1810: declared accounts. The home paths stay in this object and in `config.local.json`; settings, status and logs show labels only. */
|
|
61
|
+
accounts?: import("./accounts.ts").Accounts;
|
|
58
62
|
/** Person-owned declarations, read only from an untracked machine-local file. Bound for this daemon lifetime. */
|
|
59
63
|
instances?: InstancesConfig;
|
|
60
64
|
watchdog_ms: number;
|
|
@@ -135,6 +139,8 @@ export interface HubConfig {
|
|
|
135
139
|
research: { enabled: boolean; runners?: Record<string, RegisteredRunnerV1> };
|
|
136
140
|
/** #251: a project kept for benchmarks: `ahub bench run` resets its work tree between attempts. */
|
|
137
141
|
bench: { enabled: boolean };
|
|
142
|
+
/** #1779: `shared` lets a project run inside the host of its runtime instead of its own process. Off by default. */
|
|
143
|
+
host: { shared: boolean };
|
|
138
144
|
/** #269: per peer, how a start comes up when nothing more specific was asked: `tui` (the default) or `headless`. Pi and Codex only. */
|
|
139
145
|
peers: PeerStartConfig;
|
|
140
146
|
/** #269: a machine-local argv that opens a terminal for a hub-made TUI start; `{command}` in one element is the command to run. */
|
|
@@ -145,6 +151,8 @@ export interface HubConfig {
|
|
|
145
151
|
limits: LimitsConfig;
|
|
146
152
|
/** Reviewer choice from recorded review outcomes, once a reviewer has `min_reviews` of an implementer (issue #35). */
|
|
147
153
|
review: { adaptive: boolean; min_reviews: number; pool?: string[]; rerotate?: boolean; same_family?: "fallback" | "never"; gate?: ReviewGate; unknown_quota?: ReviewUnknownQuota; max_minutes?: number };
|
|
154
|
+
/** Candidate bridge window for the next daemon once bridge admission supports it. */
|
|
155
|
+
upgrade: BridgeWindowSettings;
|
|
148
156
|
/** After an unplanned stop, start Kimi, Pi and the local worker again with their recorded sessions (issue #37). */
|
|
149
157
|
/** #489 H4: the five waits the upgrade coordinator reads from this project's config at the start of each wait; the daemon itself only validates and carries them. */
|
|
150
158
|
recovery: { auto_resume_after_crash: boolean; reconnect_wait_s?: number; unmanaged_reconnect_wait_s?: number; control_timeout_s?: number; shutdown_wait_s?: number; terminal_idle_wait_s?: number };
|
|
@@ -214,11 +222,13 @@ export const DEFAULT_CONFIG: HubConfig = {
|
|
|
214
222
|
visuals: { retention_days: 30 },
|
|
215
223
|
research: { enabled: false },
|
|
216
224
|
bench: { enabled: false },
|
|
225
|
+
host: { shared: false },
|
|
217
226
|
peers: {},
|
|
218
227
|
terminal: { open: [] },
|
|
219
228
|
start: { agents: [...START_AGENTS_DEFAULT] },
|
|
220
229
|
limits: DEFAULT_LIMITS,
|
|
221
230
|
review: { adaptive: false, min_reviews: 5, gate: DEFAULT_REVIEW_GATE, unknown_quota: DEFAULT_REVIEW_UNKNOWN_QUOTA, max_minutes: DEFAULT_REVIEW_MAX_MINUTES },
|
|
231
|
+
upgrade: { ...DEFAULT_BRIDGE_WINDOW },
|
|
222
232
|
recovery: { auto_resume_after_crash: false, reconnect_wait_s: RECOVERY_RECONNECT_WAIT_SETTING.defaultValue, unmanaged_reconnect_wait_s: RECOVERY_UNMANAGED_RECONNECT_WAIT_SETTING.defaultValue, control_timeout_s: RECOVERY_CONTROL_TIMEOUT_SETTING.defaultValue, shutdown_wait_s: RECOVERY_SHUTDOWN_WAIT_SETTING.defaultValue, terminal_idle_wait_s: RECOVERY_TERMINAL_IDLE_WAIT_SETTING.defaultValue },
|
|
223
233
|
capabilities: {},
|
|
224
234
|
coordination: "advisory",
|
|
@@ -227,15 +237,15 @@ export const DEFAULT_CONFIG: HubConfig = {
|
|
|
227
237
|
/** The shared project config, then the machine's own file, which overrides it block by block (issue #17). */
|
|
228
238
|
export const CONFIG_FILES = INSTANCE_CONFIG_FILES;
|
|
229
239
|
export interface ConfigLayer { name: typeof CONFIG_FILES[number]; raw: Record<string, any> }
|
|
230
|
-
const CONFIG_BLOCKS = ["instructed", "action_policy", "memory", "roster", "roles", "catalog_roles", "pii", "data", "conductor", "budget", "context", "inference", "omniroute", ...NATIVE_CONFIG_BLOCKS, "approvals", "tasks", "task_sweep", "bus", "adapter_timing", "model_relay", "console", "corpus", "specs", "checks", "snapshots", "worktrees", "visuals", "research", "bench", "limits", "review", "recovery", "capabilities", "mlx", "permission_modes", "peers", "terminal", "start", "pet", "questions"];
|
|
240
|
+
const CONFIG_BLOCKS = ["instructed", "action_policy", "memory", "roster", "roles", "catalog_roles", "pii", "data", "conductor", "budget", "context", "inference", "omniroute", ...NATIVE_CONFIG_BLOCKS, "approvals", "tasks", "task_sweep", "bus", "adapter_timing", "model_relay", "console", "corpus", "specs", "checks", "snapshots", "worktrees", "visuals", "research", "bench", "host", "limits", "review", "recovery", "upgrade", "capabilities", "mlx", "permission_modes", "peers", "terminal", "start", "pet", "questions"];
|
|
231
241
|
|
|
232
242
|
/** Connection-time policy refresh reads role/feed fields only, never launches or machine-local configuration. */
|
|
233
|
-
export function loadConductorPolicy(cwd: string, layers?: readonly ConfigLayer[], scope: Pick<ReturnType<typeof readInstanceConfig>, "instances" | "catalog"> = readInstanceConfig(cwd, layers)): { roles: Record<string, string[]>; conductor: HubConfig["conductor"]; planner?: string | string[]; notices?: string[] } {
|
|
234
|
-
const roles: Record<string, string[]> = { ...
|
|
243
|
+
export function loadConductorPolicy(cwd: string, layers?: readonly ConfigLayer[], scope: Pick<ReturnType<typeof readInstanceConfig>, "instances" | "catalog"> = readInstanceConfig(cwd, layers), defaultRoles = DEFAULT_ROLES): { roles: Record<string, string[]>; conductor: HubConfig["conductor"]; planner?: string | string[]; notices?: string[] } {
|
|
244
|
+
const roles: Record<string, string[]> = { ...defaultRoles };
|
|
235
245
|
const conductor = { ...DEFAULT_CONFIG.conductor };
|
|
236
246
|
const notices: string[] = [];
|
|
237
247
|
// #1063: what the layers declare after the adapter ceiling and before the #1408 eligibility drop. At most one conductor is checked on this map (as on main), so an eligible-ceiling kind that cannot conduct is refused, never ignored, and a conductor the ceiling never allowed does not count.
|
|
238
|
-
const declaredRoles: Record<string, string[]> = { ...
|
|
248
|
+
const declaredRoles: Record<string, string[]> = { ...defaultRoles };
|
|
239
249
|
let planner: string | string[] | undefined;
|
|
240
250
|
// #1408 R2: the conductor role needs an interactive session, so the loader reads each peer's effective start mode (config.local.json wins per peer) before it reads roles.
|
|
241
251
|
const startModes: Record<string, StartMode> = {};
|
|
@@ -317,9 +327,11 @@ const questionsConfig = (value: unknown): HubConfig["questions"] => {
|
|
|
317
327
|
if (raw.wait_ms && typeof raw.wait_ms === "object" && !Array.isArray(raw.wait_ms)) for (const [kind, ms] of Object.entries(raw.wait_ms as Record<string, unknown>)) if (/^[a-z][a-z0-9-]{0,31}$/.test(kind) && typeof ms === "number" && Number.isSafeInteger(ms) && ms >= 1000 && ms <= 600_000) wait[kind] = ms;
|
|
318
328
|
return { ttl_s: ttl, wait_ms: wait };
|
|
319
329
|
};
|
|
320
|
-
export function loadConfig(cwd: string, layers?: readonly ConfigLayer[], routingRetired: readonly string[] = retiredRoutingSettings(cwd), externalDefinitions?: readonly import("../adapters/registry-types.ts").AdapterDefinition[]): HubConfig {
|
|
330
|
+
export function loadConfig(cwd: string, layers?: readonly ConfigLayer[], routingRetired: readonly string[] = retiredRoutingSettings(cwd), externalDefinitions?: readonly import("../adapters/registry-types.ts").AdapterDefinition[], defaultRoles = DEFAULT_ROLES): HubConfig {
|
|
321
331
|
const captured = layers ?? readInstanceConfigLayers(cwd);
|
|
322
|
-
const instanceConfig =
|
|
332
|
+
const instanceConfig = externalDefinitions === undefined
|
|
333
|
+
? readStartupInstanceConfig(cwd, captured)
|
|
334
|
+
: readInstanceConfig(cwd, captured, externalDefinitions);
|
|
323
335
|
const instances = instanceConfig.instances;
|
|
324
336
|
const adapterCatalog = instanceConfig.catalog;
|
|
325
337
|
const ignored: string[] = [...instanceConfig.ignored];
|
|
@@ -338,6 +350,7 @@ export function loadConfig(cwd: string, layers?: readonly ConfigLayer[], routing
|
|
|
338
350
|
}
|
|
339
351
|
delete file.adapter_modules; // Code provenance is captured separately and never evaluated by configuration reads.
|
|
340
352
|
delete file.adapters; // Adapter provenance is compiled by the same project-local loader.
|
|
353
|
+
delete file.accounts; // #1810: declared accounts come only from the trusted loader, never from a file spread.
|
|
341
354
|
delete file.instances; // Declaration authority was checked against its exact captured origin above.
|
|
342
355
|
peerRosterConfig(file.roster, instances, adapterCatalog, inertModuleRoster);
|
|
343
356
|
catalogAssignments(file.catalog_roles);
|
|
@@ -349,6 +362,7 @@ export function loadConfig(cwd: string, layers?: readonly ConfigLayer[], routing
|
|
|
349
362
|
if (file.specs !== undefined) parseSpecsConfig(file.specs);
|
|
350
363
|
queueBackpressurePolicy(file.tasks?.queue_backpressure);
|
|
351
364
|
validateOperationalConfig(file);
|
|
365
|
+
if (file.upgrade !== undefined) bridgeWindowSettings(file.upgrade);
|
|
352
366
|
for (const [block, key] of [["pii", "paths"], ["data", "readonly"]] as const) {
|
|
353
367
|
const raw = file[block];
|
|
354
368
|
if (raw !== undefined && (!raw || typeof raw !== "object" || Array.isArray(raw) || Object.keys(raw).some(k => k !== key))) throw new Error(block + " must be a bounded path policy block");
|
|
@@ -427,9 +441,9 @@ export function loadConfig(cwd: string, layers?: readonly ConfigLayer[], routing
|
|
|
427
441
|
throw new Error("legacy MLX configuration requires explicit mlx.provider=legacy; migrate to provider=ollama to avoid Python serving");
|
|
428
442
|
}
|
|
429
443
|
const mlx = { ...(file.mlx?.provider === "legacy" ? { enabled: true, provider: "legacy" as const, maxInputTokens: 16_000, maxTokens: 2048 } : DEFAULT_CONFIG.mlx), ...file.mlx };
|
|
430
|
-
const conductorPolicy = loadConductorPolicy(cwd, captured, instanceConfig);
|
|
444
|
+
const conductorPolicy = loadConductorPolicy(cwd, captured, instanceConfig, defaultRoles);
|
|
431
445
|
retired.push(...conductorPolicy.notices ?? []);
|
|
432
|
-
const configuredRoles = Object.fromEntries(adapterCatalog.definitions.filter(d => !
|
|
446
|
+
const configuredRoles = Object.fromEntries(adapterCatalog.definitions.filter(d => !isBuiltinAdapterKind(d.kind)).map(d => [d.kind, [...d.roles]]));
|
|
433
447
|
const extraRoles = Object.fromEntries(Object.keys(instances ?? {}).map(id => [id, effectiveInstanceRoles(id, instances, conductorPolicy.roles, adapterCatalog)]));
|
|
434
448
|
const instancePermissions: Record<string, PermissionMode> = {};
|
|
435
449
|
const instanceModes: PeerStartConfig = {};
|
|
@@ -451,6 +465,7 @@ export function loadConfig(cwd: string, layers?: readonly ConfigLayer[], routing
|
|
|
451
465
|
...DEFAULT_CONFIG,
|
|
452
466
|
...file,
|
|
453
467
|
...(instanceConfig.adapters ? { adapters: instanceConfig.adapters } : {}),
|
|
468
|
+
...(instanceConfig.accounts ? { accounts: instanceConfig.accounts } : {}),
|
|
454
469
|
...(instanceConfig.adapter_modules ? { adapter_modules: instanceConfig.adapter_modules } : {}),
|
|
455
470
|
...(instances ? { instances } : {}),
|
|
456
471
|
...(file.text_projection !== undefined ? { text_projection: projectionConfig(file.text_projection) } : {}),
|
|
@@ -495,6 +510,7 @@ export function loadConfig(cwd: string, layers?: readonly ConfigLayer[], routing
|
|
|
495
510
|
questions: questionsConfig(file.questions),
|
|
496
511
|
visuals: { retention_days: typeof file.visuals?.retention_days === "number" && Number.isSafeInteger(file.visuals.retention_days) && file.visuals.retention_days >= 1 && file.visuals.retention_days <= 3650 ? file.visuals.retention_days : DEFAULT_CONFIG.visuals.retention_days },
|
|
497
512
|
research: { enabled: file.research?.enabled === true, ...(file.research?.runners !== undefined ? { runners: parseResearchRunners(file.research.runners) } : {}) }, // opt-in: anything but true is off
|
|
513
|
+
host: { shared: file.host?.shared === true },
|
|
498
514
|
bench: { enabled: file.bench?.enabled === true }, // opt-in: a run resets this project's work tree
|
|
499
515
|
peers: { ...instanceModes, ...peerStartConfig(file.peers, instances, adapterCatalog) },
|
|
500
516
|
terminal: { open: terminalTemplate(file.terminal?.open) },
|
|
@@ -502,6 +518,7 @@ export function loadConfig(cwd: string, layers?: readonly ConfigLayer[], routing
|
|
|
502
518
|
limits: { ...PROJECT_LIMITS, ...file.limits }, // on with any project config (issue #38)
|
|
503
519
|
review: { ...DEFAULT_CONFIG.review, ...file.review },
|
|
504
520
|
recovery: { ...DEFAULT_CONFIG.recovery, ...file.recovery },
|
|
521
|
+
upgrade: bridgeWindowSettings(file.upgrade),
|
|
505
522
|
capabilities: { ...file.capabilities },
|
|
506
523
|
mlx,
|
|
507
524
|
...(ignored.length ? { ignored } : {}),
|
|
@@ -80,6 +80,8 @@ export interface Hello {
|
|
|
80
80
|
retainStandby?: true;
|
|
81
81
|
/** Display-only process id, never native-session or authorization evidence. */
|
|
82
82
|
clientPid?: number;
|
|
83
|
+
/** #1810: the configuration home the session runs under (`CLAUDE_CONFIG_DIR` or the default home). The daemon maps it to a declared label and keeps no path. */
|
|
84
|
+
home?: string;
|
|
83
85
|
/** #1385: the agent-hub version this client was built from. `connect` always sets it from `VERSION`; display only, never admission, compatibility or authorization evidence. */
|
|
84
86
|
clientVersion?: string;
|
|
85
87
|
projectId?: string;
|
|
@@ -155,6 +157,9 @@ export const QUESTION_WAIT_MAX_MS = 600_000;
|
|
|
155
157
|
export const QUESTION_CONTROL_TIMEOUT_MS = QUESTION_WAIT_MAX_MS + 15_000;
|
|
156
158
|
|
|
157
159
|
|
|
160
|
+
/** What a client needs of its transport: a WebSocket, or the daemon's in-process stand-in for one (#1780 T2a-2c). */
|
|
161
|
+
type ControlLink = Pick<WebSocket, "readyState" | "send" | "close">;
|
|
162
|
+
|
|
158
163
|
/** One authenticated control connection. `request` correlates replies by `rid`; everything else goes to `onPush`. */
|
|
159
164
|
export class ControlClient {
|
|
160
165
|
features: readonly string[] = [];
|
|
@@ -262,6 +267,49 @@ export class ControlClient {
|
|
|
262
267
|
});
|
|
263
268
|
}
|
|
264
269
|
|
|
270
|
+
/**
|
|
271
|
+
* #1780 T2a-2c: a client over a link inside the daemon process, for an MCP endpoint session. `open` builds the link and gets the two functions the link calls: `receive` with each message the hub
|
|
272
|
+
* sends it, `closed` when the hub closes it. The hello and welcome are the control path's own; a refusal rejects with the close code and reason, as `connect` does.
|
|
273
|
+
*/
|
|
274
|
+
static inProcess(open: (receive: (msg: any) => void, closed: (code: number, reason: string) => void) => ControlLink, hello: Record<string, unknown>, timeoutMs = 3000): Promise<ControlClient> {
|
|
275
|
+
let client!: ControlClient;
|
|
276
|
+
const refusedOnClose: { fail?: (error: Error) => void } = {};
|
|
277
|
+
const receive = (msg: any) => {
|
|
278
|
+
if (!msg || typeof msg !== "object" || Array.isArray(msg)) return;
|
|
279
|
+
const done = msg.rid !== undefined ? client.pending.get(msg.rid) : undefined;
|
|
280
|
+
if (!done) {
|
|
281
|
+
if (msg.t === "peer_attached" && msg.standbyId === client.standbyId) { client.standby = false; client.standbyId = undefined; }
|
|
282
|
+
return client.onPush(msg);
|
|
283
|
+
}
|
|
284
|
+
client.pending.delete(msg.rid);
|
|
285
|
+
done(msg);
|
|
286
|
+
};
|
|
287
|
+
const closed = (code: number, reason: string) => {
|
|
288
|
+
refusedOnClose.fail?.(Object.assign(new Error(`hub closed the connection: ${reason || "refused"}`), { code }));
|
|
289
|
+
for (const done of client.pending.values()) done({ ok: false, error: "hub connection closed" });
|
|
290
|
+
client.pending.clear();
|
|
291
|
+
client.onClose(code, reason);
|
|
292
|
+
};
|
|
293
|
+
const link = open(receive, closed);
|
|
294
|
+
client = new ControlClient(link as unknown as WebSocket);
|
|
295
|
+
return new Promise((resolve, reject) => {
|
|
296
|
+
// Every refusal closes the link, as `connect` does: a hello that timed out must not leave a Sock the daemon may still admit and attach a peer to.
|
|
297
|
+
const refuse = (error: Error) => { try { link.close(); } catch { /* the link is already gone */ } reject(error); };
|
|
298
|
+
refusedOnClose.fail = refuse;
|
|
299
|
+
void client.request({ t: "hello", ...hello }, timeoutMs).then(reply => {
|
|
300
|
+
if (reply.t !== "welcome" || reply.ok === false) return refuse(new Error(reply.error ?? "hub refused handshake"));
|
|
301
|
+
client.protocol = typeof reply.protocol === "number" ? reply.protocol : undefined;
|
|
302
|
+
client.features = Object.freeze(Array.isArray(reply.features) ? reply.features.filter((feature: unknown): feature is string => typeof feature === "string") : []);
|
|
303
|
+
client.welcomeInstanceId = typeof reply.instanceId === "string" && reply.instanceId ? reply.instanceId : undefined;
|
|
304
|
+
client.sessionId = typeof reply.session === "string" && reply.session.length <= 64 ? reply.session : undefined;
|
|
305
|
+
client.standby = reply.standby === true;
|
|
306
|
+
client.standbyId = client.standby && typeof reply.standbyId === "string" ? reply.standbyId : undefined;
|
|
307
|
+
refusedOnClose.fail = undefined;
|
|
308
|
+
resolve(client);
|
|
309
|
+
});
|
|
310
|
+
});
|
|
311
|
+
}
|
|
312
|
+
|
|
265
313
|
/** Read inert instance policy only from this authenticated, still-current daemon connection. */
|
|
266
314
|
async readExternalInstanceCatalog(projectRoot: string, timeoutMs = 3000): Promise<ExternalInstanceCatalog> {
|
|
267
315
|
const epoch = this.instanceId;
|