Skip to content

Build(deps): Bump inquirer from 8.2.6 to 12.9.1 - #108

Closed
dependabot[bot] wants to merge 1 commit into
mainfrom
dependabot/npm_and_yarn/inquirer-12.9.1
Closed

dependabot[bot] wants to merge 1 commit into
mainfrom
dependabot/npm_and_yarn/inquirer-12.9.1

Conversation

@dependabot

@dependabot dependabot Bot commented on behalf of github Aug 12, 2025

Copy link
Copy Markdown
Contributor

Bumps inquirer from 8.2.6 to 12.9.1.

Release notes

Sourced from inquirer's releases.

[email protected]

  • Search prompt: New instructions config to allow localizing the help tips.

[email protected]

  • Fix #1786 select prompt with indexMode: number theme option didn't properly calculate the items indexes if separators where present in between choices.

[email protected]

  • Fixes: a transitive dependency (run-aysnc) loaded devDependencies unexpectedly. This is now fixed upstream. Rel #1791

[email protected]

  • Select prompt: When pressing a number key, we'll ignore separators in counting the index of the item to jump to.
  • Checkbox prompt: When pressing a number key, we'll ignore separators in counting the index of the item to select.

[email protected]

-input prompt: New prefill option to control if the default value is editable inline or only after pressing tab.

[email protected]

  • Fix #1743: pagination logic of the select, checkbox and search prompts was fully rewritten to handle edge cases around rendering multi-line choices and pointer positioning.

[email protected]

  • Chore: dependencies bump

[email protected]

  • Fix #1741: Issue with SIGINT in some scenarios leaving promises unsettled on exit.
  • Fix: Remove monorepo related dependencies from all artifacts published to npm. This removes non-standard version specifiers like workspace:* from the public npm packages.

[email protected]

  • Feat(@​inquirer/select): Added an instructions option allowing to customize the messages in the help tips.
  • Feat(@​inquirer/rawlist): Arrow keys will now cycle through the option, just like the @inquirer/select prompt. Also added a loop option to control the list loop behaviour when reaching the boundaries.

[email protected]

  • README: Add new sponsor
  • Chore: dependency updates

[email protected]

  • Feat (select): Introduce theme.indexMode to control displaying an index prefix in front of each choice. (defaults to hidden)
  • Fix (select): Improve search when number keys are pressed

[email protected]

  • Fix an issue where inquirer would throw if Node is ran with the new --frozen-intrinsics flag.

[email protected]

  • Mark @types/node as an optional peer dependency across all packages.

[email protected]

  • Added new shortcut config to the checkbox prompt. Allows to customize or disable shortcut keys for select all and invert selection.

[email protected]

... (truncated)

Commits
  • 15b1e9c Publish
  • 9475bb3 Re-home external-editor & remove tmp vulnerable dependency (#1804)
  • ee16061 Add Ordered Checkbox Prompt to community list
  • 22d47dd Chore(deps-dev): Bump typescript from 5.8.3 to 5.9.2 in the build group
  • c6a265a Chore(deps-dev): Bump the linting group with 2 updates
  • a56b48f Chore(deps-dev): Bump eslint-plugin-n
  • 3ad650c Chore(deps-dev): Bump the linting group with 7 updates
  • 69944cc Publish
  • 36a7897 doc(@​inquirer/search): Document the new config. Rel #1773
  • 8ccf932 feat(@​inquirer/search): Support providing custom instructions. Fix #1773
  • Additional commits viewable in compare view

Dependabot compatibility score

Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


Dependabot commands and options

You can trigger Dependabot actions by commenting on this PR:

  • @dependabot rebase will rebase this PR
  • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
  • @dependabot merge will merge this PR after your CI passes on it
  • @dependabot squash and merge will squash and merge this PR after your CI passes on it
  • @dependabot cancel merge will cancel a previously requested merge and block automerging
  • @dependabot reopen will reopen this PR if it is closed
  • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
  • @dependabot show <dependency name> ignore conditions will show all of the ignore conditions of the specified dependency
  • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
  • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
  • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)

@dependabot dependabot Bot added dependencies Pull requests that update a dependency file javascript Pull requests that update javascript code labels Aug 12, 2025
@dependabot
dependabot Bot requested a review from joelteply August 12, 2025 07:55
@dependabot @github

dependabot Bot commented on behalf of github Aug 26, 2025

Copy link
Copy Markdown
Contributor Author

Superseded by #114.

@dependabot dependabot Bot closed this Aug 26, 2025
@dependabot
dependabot Bot deleted the dependabot/npm_and_yarn/inquirer-12.9.1 branch August 26, 2025 15:37
joelteply added a commit that referenced this pull request Jun 2, 2026
…l docs

Joel (2026-05-31): "Then we want to architect the unknowns on
paper now; what you said being load bearing in memory. Design
what we need and document what isn't."

Four new docs lock the working session's substrate doctrine into
the repo so future readers (Claude, contributors, AIs reviewing
adversarially) inherit it without needing the auto-memory:

1. **docs/architecture/AI-COMMAND-NAMESPACE.md** (~275 lines)
   The `ai/*` tree — LLMs, vision, audio, embeddings, classical
   ML, planning algorithms, game/agent AI, low-level kernels — all
   under one namespace. Three universal primitives: adapter
   polymorphism (OpenCV-style), handle pattern (establish once,
   reuse many), capture+replay (observability-is-half). The
   architectural rule: commands are dumb, daemons are smart.
   Multimodal CNN crutches are first-class peers, NOT utilities —
   how non-multimodal LLMs get sensory parity.

2. **docs/architecture/INFERENCE-SCHEDULING-AND-SCARCITY.md** (~435 lines)
   The DAEMON layer behind `ai/inference/*`. The adaptive-
   resolution analogy (video player drops 4K → 1080p under
   congestion; inference daemon drops FP16 → INT8 → INT4 under
   memory pressure — same model, no quality tier-down). Component
   designs: tiered SlotPool, RequestQueue, BatchAssembler
   (continuous batching, vLLM-style), LoRAPager, BaseModelSharing,
   PressureMonitor, AdaptiveQuantizer, SpeculativeWarmer,
   RouteSelector (local vs grid). Cross-grid M5→5090 case as a
   peer adapter. Captures the prior-attempt failure modes the
   substrate MUST NOT repeat: hot-path LoRA swap, global FIFO,
   naive shared-model concurrency, underestimated swap latency,
   policy negotiation on the command surface.

3. **docs/architecture/OBSERVABILITY-AS-SUBSTRATE.md** (~253 lines)
   The "half the architecture is debug" doctrine. The CaptureSink
   pattern as universal shape (trait + Noop/JSONL/InMemory + Recording
   decorator). The three canonical introspection questions:
   counterfactual ("would I respond the same way?"), fault
   isolation ("which layer is broken?"), relevance ("contextually
   relevant?"). The non-negotiable Noop-default-zero-overhead rule.
   Introspection reachable as a command, not just files on disk.

4. **docs/planning/AI-LANE-OPEN-QUESTIONS.md** (~417 lines)
   Explicit punch list of 20 design decisions we KNOW we need but
   haven't made yet, organized by lane: inference daemon (#109),
   cross-grid inference (#108), namespace consolidation (#106),
   observability, hardware/memory hierarchy, multi-modal
   pipelines, prior-attempt forensics. Each entry: question, why
   it matters, what's blocked, candidate approaches, decision
   gate. Highest-priority: Q20 (recover prior-attempt failure
   logs — don't repeat what was "rather shitty"), Q1 (persona
   priority class signaling), Q11 (namespace migration path).

Plus CLAUDE.md's canonical-substrate-docs intro now lists the
three new architecture docs + the open-questions doc, so the
next reader picking up this work finds them in the right order.

Implementation status note: the inference COMMAND layer (open /
generate / close / inspect) ships today via #107A + #107B. The
SMART daemon layer (slot pools, continuous batching, multi-LoRA
serving, adaptive quantization, cross-grid offload) is designed
here but unbuilt — task #109 and #108. The docs are deliberately
honest about what's known and what's open; nothing in
INFERENCE-SCHEDULING-AND-SCARCITY.md or AI-LANE-OPEN-QUESTIONS.md
overstates current implementation.
joelteply added a commit that referenced this pull request Jun 2, 2026
…n after prior-art survey

Joel (2026-05-31): "Let's look at prior art on genomic paging,
model loading. I think we weren't clever enough with our lanes.
The goal should be to ideally cover the needs of the persona,
while being realistic. On this machine it might be 3 low end,
maybe cpu, without a grid inference provider which we plan to
use. But this isn't an option for some. We should at least
attempt something reasonable, a model with creative capacity."

After surveying the existing tree:

**Prior art already shipped (and previously underweighted in INFERENCE-SCHEDULING-AND-SCARCITY.md):**

- `cognition/throughput_lease.rs::ThroughputLease` — the
  slot/lane primitive with Graceful / Hard / Pinned revocation
- `cognition/throughput_lease.rs::ThroughputLeaseRegistry`
- `cognition/adaptive_throughput.rs::AdaptiveThroughputRequest` +
  `AdaptiveThroughputPlan` — the admission planner keyed by
  `target_silicon`
- `inference/footprint_registry/mod.rs::FootprintRegistry` —
  per-resource memory accounting + cheapest-eviction search +
  lease-aware composition (`acquire_lease`)
- `genome/working_set.rs` + `genome/tier.rs` — 5-tier hierarchy
  (Fast / Warm / Bench / Cold / Frozen) with canonical per-tier
  eviction policies (LruWithinTurn / LruAcrossTurns /
  LfuPlusRecency / DemandAlignedWithRefinedPreference /
  AppendOnlyGcOnSleep). UMA-aware.
- `paging/broker.rs::PressureBroker` + `PressureTier`
  (Normal/Warning/High/Critical)
- `inference/recipe_budget.rs::TaskKind` — 10 task classes already
  enumerated (Chat, VoiceChat, VideoChat, CodingSmall, CodingLarge,
  GameNpcIdle, GameNpcEngaged, SentinelEasy, SentinelHard,
  AcademyStudent) with seed KV budgets and per-silicon cost models.

**The "we weren't clever enough" insight:** prior attempts treated
lanes as separate model loads. The actually-clever framing is the
opposite — a lane is `(persona, TaskKind, ThroughputLease)` over
the SHARED base model. Continuous batching multiplexes lanes
through the same model forward pass. KV cache budgets per lane
come from the existing TaskKind table.

Three premises:
1. ONE base model on the host (substrate picks best-fit, creative
   capacity, not stupid)
2. N lanes, each (persona, TaskKind) — multiplexed via continuous
   batching
3. Existing primitives compose into the InferenceCoordinator — no
   reinvention

Realistic baseline target (Joel's "3 low-end CPU" case):
- 1 base model: Gemma-2-2B Q4_K_M or Qwen-2.5-3B Q4_K_M (~2 GB)
- 3 lanes: typical 1× VoiceChat (8K) + 1× Chat (8K) + 1× GameNpcIdle (4K)
- Total KV: ~1 GB FP16 (~650 MB INT8)
- Throughput: ~10-18 tok/s aggregate through continuous batch on CPU
- No grid required; works standalone

Higher-end (M5 UMA) keeps the same shape, scales up the model.
Grid (#108) adds remote-lane fallback — same architecture, peer
hosting some of the lanes.

**The new doc covers:**
- Full prior-art inventory (component → existing file mapping)
- Lane type definition (persona / task / lease)
- Coordinator scaffold (composing existing primitives)
- 5-step MVP build plan (Lane type → Coordinator → wire-through →
  LlamaCpp batched decode → pressure-driven eviction)
- Realistic baseline target table (CPU-only / 8 GB / 16 GB / M5)
- Acceptance criteria
- 5 new open questions specific to the realistic lane build (Q21
  llama.cpp batched-decode finish reasons, Q22 model-pick policy,
  Q23 KV precision switch, Q24 TaskKind mid-session change, Q25
  idle-lane demotion policy)
- Explicit non-goals (no per-persona model loads, no quality-tiered
  selection, no hot-path LoRA swap, no global FIFO, no client-side
  scheduling awareness)

**Side updates:**
- CLAUDE.md canonical-docs section: the realistic-lane doc lands
  as the "read this FIRST for scheduler work" pointer; SCHEDULING-AND-
  SCARCITY remains the aspirational ceiling.
- AI-LANE-OPEN-QUESTIONS.md: 5 new questions Q21–Q25 land under a
  "Realistic lane build" section adjacent to the existing scheduling
  questions.
- Task #109 rescoped: from "build scheduler from scratch" to "compose
  existing primitives into InferenceCoordinator" with the realistic-
  lane doc as the build plan.

This unblocks #109 with a far more tractable scope. The aspirational
ceiling stays — it's where the substrate is going — but the floor is
buildable in a focused MVP cut.
joelteply added a commit that referenced this pull request Jun 2, 2026
…ookPro15,1

Joel (2026-05-31): %22We want to know if we can get something
workable for this Intel Mac.%22 This doc answers it with honest
measured constraints + the three concrete things we ship.

Measured baseline (from 2026-05-30 evidence in the tree):
- Metal-AMD: 0.8 tok/s + garbled output (broken)
- CPU-only: 1.1 tok/s + coherent (works)

What that means for personas:
- Single-persona slow-chat: workable (30s-2min response times for
  thoughtful reflective conversation)
- Background reflection: workable (any model, no latency budget)
- Heuristic adapter through full substrate stack: works at zero
  cost, gives substrate observability + lane lifecycle + capture
  sinks for FREE on any host (this Mac included)
- Real-time voice/video: NOT workable locally (1.1 tok/s × ~3 sec
  budget = 3 tokens per turn, useless)
- 16 concurrent personas with real model: NOT workable (CPU
  bandwidth bottleneck)

The three things we ship to make this Mac workable as a substrate citizen:

1. CI proves heuristic adapter end-to-end (the %22working persona%22
   demonstration Joel asked for) — PersonaResolver impl + headless
   chat-flow harness. Validates: every substrate layer wired
   correctly, no GGUF needed.

2. Smallest viable GGUF for thoughtful slow personas — Gemma-2-2B
   Q4_K_M default; Qwen-2.5-1.5B Q4_K_M fallback for <8GB hosts.
   LlamaCppAdapter already CPU-forces on this tier (per #51).

3. AircRemoteInferenceAdapter (#108) — THE unlock. Intel Mac runs
   reflective lanes locally; 5090 in another room runs latency-
   sensitive work; airc transports between. The Intel Mac becomes
   a first-class substrate citizen via grid offload, not by
   tiering down model quality (per [[host-the-seemingly-impossible]]).

Honest non-promises:
- Not pretending Metal-AMD works.
- Not running 16 concurrent personas on this Mac.
- Not tiering down model quality to %22make voice work%22 locally —
  voice gets handled by offload, not by degraded model.

The substrate has shown its defining boast IS achievable on Joel%27s
actual 2018-vintage hardware. The realistic floor is %22substrate
works everywhere + cleverness offloads compute%22 — this Mac is
included.
joelteply added a commit that referenced this pull request Jun 2, 2026
…GPU, Windows are co-primary targets

Joel (2026-05-31), refining the hardware matrix in two messages:

1. %22We%27d really be building for 3090 desktops or m5%27s at the same
   time. The 5090 is luxury but we will take advantage. I have
   1080ti%27s on another windows box.%22
2. %22I have 1080ti and 5090 windows only. Don%27t have the 3090. Just
   target sizes. M1 or higher ok ram ought to be good too.%22

Reframes the strategy doc from %22Intel Mac + M5%22 to the full
hardware matrix:

- **Apple Silicon class (M1 Pro/Max → M5 Pro/Max, ≥16 GB UMA)** —
  primary local. M1 is the floor; M2+ Pro/Max comfortably runs the
  realistic floor. Throughput table per generation included.
- **Ampere+ desktop GPU class (24 GB VRAM)** — co-primary local.
  RTX 3090 is the SIZING target; substrate runs on any GPU at
  that class. Joel doesn%27t own a 3090 — it%27s a target size.
- **Pascal class (1080 Ti, 11 GB VRAM, Windows)** — supported
  older target. Joel%27s actual hardware.
- **Blackwell (5090, 32 GB VRAM, Windows)** — luxury overflow.
  Joel has one but designing around it would lock out others.
- **MacBookPro15,1 Intel Mac** — edge proof; heuristic + reflective
  + grid offload.
- **Windows is first-class** — both Joel%27s NVIDIA boxes are
  Windows. Build matrix MUST include Windows; CI MUST exercise
  the Windows path on at least the heuristic substrate flow.

Grid principle reinforced: %22this isn%27t a single-machine substrate.
Joel%27s actual setup is a grid of heterogeneous boxes, and the
substrate routes lanes wherever capacity is available.%22 The same
`adapter.generate_text(request)` command runs everywhere; the
AircRemoteInferenceAdapter (#108) is just an adapter impl with
airc transport instead of llama.cpp.

Flags two missing tier enums (task #115):
- Sm60 (Pascal, 1080 Ti)
- M5UmaProMax (currently M5 would fall back to M3UmaProMax)

Updated #108 task description to capture %22same command across the
wire%22 architecture explicitly.
joelteply added a commit that referenced this pull request Jun 2, 2026
…aProMax, M5UmaProMax (task #115)

Joel%27s strategy doc (committed earlier this session) declared
M5 Pro/Max + GTX 1080 Ti as supported daily-driver targets. Both
were silently misclassified by the substrate:

- M5 Pro/Max → fell through the `M3 || M4 || M5` branch into
  M3UmaProMax. The substrate couldn%27t distinguish M5 throughput
  from M3.
- GTX 1080 Ti → unknown to nvidia_sm_tier (no GTX 10xx / P-series
  branch). Returned UnknownGpuDevice; Joel%27s Windows box would
  reject coherent inference setup.

Fixes:

1. Added three enum variants to HwCapabilityTier in
   `cognition/model_resolver/types.rs`:
   - `M4UmaProMax` — Apple M4 Pro/Max/Ultra. Adds Metal 3 tensor
     API + AMX matmul; ~30% better than M3 on Qwen-7B Q4_K_M.
   - `M5UmaProMax` — Apple M5 Pro/Max/Ultra. Joel%27s daily-driver
     target per the strategy doc. 24-48 GB UMA comfortably fits
     Qwen-2.5-14B at 24 GB, 27B at 48 GB.
   - `Sm60` — NVIDIA Pascal compute capability 6.x. GTX 10xx
     series (1080 Ti, 1080, 1070 Ti, etc.), Tesla P100 / P40 / P4,
     Titan X/Xp. Joel%27s 1080 Ti on Windows lives here.

2. Updated `apple_silicon_tier()` to check more-specific patterns
   first (M5 → M4 → M3 → M2 → M1) so each tier maps distinctly
   instead of collapsing into M3UmaProMax.

3. Updated `nvidia_sm_tier()` with a Pascal branch — matches
   %22GTX 10%22 / %22P100%22 / %22P40%22 / %22P4%22 / %22TITAN X%22 / %22TITAN XP%22
   substrings. Standard transformer inference works via llama.cpp%27s
   CUDA backend on Pascal; smaller VRAM (11 GB on 1080 Ti)
   constrains model size to Qwen-7B class at Q4_K_M.

### Tests (5 new, 14 total in host_capability_probe, all green)

- nvidia_pattern_match_resolves_known_skus — extended with 7
  Pascal cards (1080 Ti, 1080, 1070 Ti, 1060, P100, P40, Titan Xp)
- apple_silicon_m5_classifies_above_m3_not_falling_through
- apple_silicon_m4_classifies_distinctly_from_m3
- apple_silicon_m3_still_classifies_correctly_after_m4_m5_added
  (regression guard against ordering bugs)
- apple_silicon_m2_pro_max_stays_in_m2_tier (regression guard)
- apple_silicon_tier_mapping — updated to assert M4/M5 land in
  their own tiers (was asserting %22M4 aliases to M3%22 before)

### What is NOT touched

- Per-tier default-model picks (the model registry%27s tier table).
  The new variants exist as enum values but the registry doesn%27t
  yet have explicit default-model rows for them. Adding model
  picks happens when #49 (resolve missing GGUF in 0.8b/2b forge
  repos) lands a concrete catalog, or in a focused follow-up.
- AircRemoteInferenceAdapter routing decisions per tier (#108) —
  the tier classification is now accurate enough to inform those
  decisions when #108 implements them.

With the enum fixed, anyone running continuum-core-server on:
- A 1080 Ti Windows box → probe correctly classifies Sm60 instead
  of erroring; subsequent code paths can branch appropriately.
- An M5 Mac → probe classifies M5UmaProMax distinctly from M3.
- An M4 Mac → probe classifies M4UmaProMax distinctly from M3.

ts-rs regenerated bindings for HwCapabilityTier.ts.
joelteply added a commit that referenced this pull request Jun 2, 2026
… wire (task #108, slices A+B+C)

Joel (2026-05-31): %22grid inference and they%27re just the same command
just executed across the wire and airc substrate delivered
payloads.%22 This commit ships the substrate-side architecture for
the AircRemoteInferenceAdapter — three of the five slices that
make up #108 (production airc transport + peer-side handler are
the two follow-up slices).

### Architecture proven

The AircRemoteInferenceAdapter implements AIProviderAdapter. The
caller sees:

    // LOCAL: heuristic adapter on this host
    let response = local_adapter.generate_text(request).await?;

    // REMOTE: same call, transport is airc
    let response = remote_adapter.generate_text(request).await?;

No difference at the call site. Composes with everything we
shipped earlier this session: the coordinator (#109) can hold a
mix of local + remote handles; the rag-inspect chain (#104) works
through remote adapters; the lane scheduler eviction (#111) treats
remote handles the same as local; the substrate%27s defining boast
— %22the Intel Mac participates as a citizen via grid offload%22 —
is now structurally realizable.

### Slice A — protocol.rs (wire types)

- RemoteInferenceRequest { correlation_id, text_request,
  target_peer? }
- RemoteInferenceResponse { correlation_id, served_by,
  text_response }
- RemoteInferenceError variants: Transport, NoPeerReachable,
  Timeout, CorrelationMismatch, PeerAdapterFailed, PolicyDenied
- ts-rs exports to shared/generated/airc_remote/
- Pure data; no transport, no I/O

### Slice B — transport.rs (the trait + test impls)

- AircInferenceTransport trait — one method, send_request
  (async, &self so adapter can hold Arc<dyn Transport> and
  concurrent-call across in-flight requests)
- StubInferenceTransport — closure-driven for unit tests, with
  `always_failing(err)` convenience
- **LocalAdapterTransport — the architecture proof.** Wraps an
  Arc<dyn AIProviderAdapter>; send_request unpacks the text
  request, calls adapter.generate_text, packages the response
  back into an envelope. With this transport, the remote adapter
  is functionally identical to calling the wrapped adapter
  directly — the substrate can%27t tell.

### Slice C — adapter.rs (the AIProviderAdapter impl)

- AircRemoteInferenceAdapter::new(Arc<dyn AircInferenceTransport>)
- .with_target_peer(peer) — pin every outgoing request to a
  specific peer (when substrate has reason)
- AIRC_REMOTE_PROVIDER_ID = %22airc-remote%22; the adapter rewrites
  response.provider to this so observability sees %22this came
  through the grid%22 even when the actual transport was local
- All trait methods implemented; future capability-discovery +
  health-handshake slices documented as pending

### Tests (27 new, all green)

Protocol (7):
- new_request_assigns_fresh_correlation_id_each_time
- new_request_defaults_target_peer_to_none
- with_target_peer_sets_the_field
- request_serializes_and_round_trips (full serde round-trip)
- error_display_is_human_readable (all 6 variants)
- error_correlation_mismatch_displays_both_ids
- errors_round_trip_via_serde
+ 3 ts-rs export bindings tests

Transport (6):
- stub_transport_returns_canned_response
- stub_transport_can_return_typed_error
- **local_adapter_transport_round_trips_via_heuristic** —
  THE architecture proof at the transport level
- local_adapter_transport_propagates_peer_adapter_errors
- local_adapter_transport_preserves_correlation_id
- local_adapter_transport_with_custom_peer_id

Adapter (11):
- adapter_reports_canonical_provider_id
- adapter_capabilities_admit_text_and_chat_not_local (is_local=false)
- adapter_supports_any_model_name_by_default (peer decides)
- **remote_adapter_over_local_heuristic_transport_round_trips** —
  THE architecture proof at the adapter level. AircRemote wrapped
  around LocalAdapterTransport(heuristic) produces exactly what
  calling heuristic directly produces.
- **remote_adapter_deterministic_when_peer_is_deterministic** —
  replay-safety holds across the wire. Same prompt, different
  remote-adapter instances over different heuristic instances →
  byte-identical responses.
- transport_error_surfaces_as_adapter_error_string
- timeout_error_surfaces_with_elapsed_ms
- policy_denied_surfaces_through_adapter
- with_target_peer_threads_through_to_transport_envelope
- without_target_peer_sends_envelope_with_none
- health_check_reports_healthy_with_pending_message

### What slices A+B+C deliberately do NOT ship

- **Production airc transport** (slice D) — the actual
  airc_lib::Airc-backed AircInferenceTransport that frames
  requests into airc events with correlation headers, awaits the
  paired response event, handles timeouts + retries. The trait
  shape is stable; the impl plugs in without touching the
  adapter or wire types.
- **Peer-side handler** (slice E) — the receiving end: when a
  peer%27s airc daemon delivers a %22remote inference request%22
  envelope, route it through the peer%27s local
  InferenceLlmModule (or ai/inference/generate ServiceModule)
  and send the response back.
- **Peer discovery + capacity advertising** — open questions Q8
  + Q12 in `docs/planning/AI-LANE-OPEN-QUESTIONS.md`. The
  substrate needs to know which peers run which models warm.
- **Persona identity projection on remote peer** — open question
  Q9. How does Paige%27s identity flow over airc to a peer that
  serves her inference?

Each of these is its own focused commit. The substrate-side
architecture proven by this commit doesn%27t change shape when
they land.

### What this unblocks NOW

A contributor writing the production airc transport (slice D)
has a stable trait to implement against. A contributor writing
the peer-side handler (slice E) has typed wire envelopes to
route. The substrate-as-grid architecture per
[[the-substrate-is-the-grid-tron-frame]] is now real in code.
Intel Mac + 1080 Ti + 5090 + Apple Silicon — same command,
different transport, transparent to everything above the
adapter trait.
joelteply added a commit that referenced this pull request Jun 2, 2026
…t (task #119)

Inbound substrate gap captured running the demo against the live
airc daemon on Joel's MacBookPro15,1:

  ~/.airc/events.sqlite::bus_events             = 9435 entries
  ~/.continuum/personas/Paige/.../events.sqlite = 6 (subscription
                                                    json only, 0 chat)
  airc_lib::Airc::page_recent (airc-store/src/sqlite.rs:794)
    -> SELECT FROM events table only

Net effect: a persona that calls attach_as + .join(room) +
.page_recent(N) sees none of the bus chat. The outbound path
(attach + room join + heuristic adapter + airc.say) works; the
inbound round-trip does not -- that is the substrate-side fanout
gap tracked as task #102 (airc subscription backfill), cross-cut
with task #82 (CBOR Response::Event schema mismatch).

This commit:

1. Adds a "Known substrate gap" section to the demo's module
   doc so the limitation is documented at the binary that
   demonstrates it, not just in a task tracker.

2. Adds per-tick diagnostic eprintln so each poll loop prints:

     tick=N page_recent=X text=Y from_others=Z
       max_lamport=L last_seen=L

   Keeps the gap loud rather than silent until #102 lands. The
   moment fanout starts working, those numbers go nonzero and
   the demo starts responding without any code changes.

Per the doctrine: every error is an opportunity to battle-harden.
The immediate observable (silent demo) is fixed (loud diagnostics
on every tick); the underlying class of bug (bus_events not
propagating to per-scope stores) is named precisely on the task
that will fix it.

Refs: #102, #82, #108, #119

Co-Authored-By: Claude Opus 4.7 <[email protected]>
joelteply added a commit that referenced this pull request Jun 2, 2026
… (RTOS doctrine)

v1 polled airc.page_recent every 3s. This hid the substrate's
actual contract and led to a false-positive hypothesis (task
#102: "airc bus_events not fanning to per-persona scopes").

Tracing the substrate end-to-end revealed the public API for
the canonical replay-then-stream pattern already exists:

- Airc::subscribe() at airc-lib/src/messaging.rs:204 routes
  through the daemon attach stream when daemon-attached
  (daemon_subscribe at airc-lib/src/daemon.rs:358), decoding
  Response::Event { envelope } via decode_wire_event and
  yielding Arc<TranscriptEvent> through an EventStream with
  reconnect-from-cursor on daemon restarts.
- Airc::page_recent() (when daemon-attached) issues an
  InboxRequest which the daemon's handle_inbox replays via
  state.router.resume_from_cursor against the durable tier.

Both halves of the contract are already exposed. There's no
missing airc-side code for the inbound path.

This commit:

1. Replaces the poll loop with `airc.subscribe().await` then a
   `while let Some(item) = stream.next().await` driver.
2. Keeps page_recent for one-shot warm-up cursor (so Paige
   doesn't re-process events from before this binary started).
3. Drops the per-tick diagnostic eprintln — no ticks now.
4. Updates the module doc to document what the substrate
   actually does, and captures the empirical finding (below).

Empirical status testing against the live daemon on Joel's
MacBookPro15,1 (build=71a07525f57c, branch=
feat/airc-ipc-endpoint-command):

1. Demo prints `✓ subscribed to live daemon stream` — attach
   handshake succeeds, no error.
2. Three test messages posted via `airc msg` reach the
   daemon's ~/.airc/events.sqlite::bus_events (verified by
   direct sqlite3: epoch=124, counters 646-648, matching
   channel uuid).
3. Demo's stream yields ZERO events — no inbound log line, no
   "subscribe stream ended" log line. The mpsc is open but
   silent.

This is task #82 ("Headless break #3: CBOR Response::Event
schema mismatch") manifesting on the live daemon. Either:
- decode_wire_event silently bails inside the daemon_subscribe
  loop (airc-lib/src/daemon.rs:416, the `Err(_) => return`),
  killing the subscription without surfacing the error, OR
- The subscriber filter on the daemon side doesn't match
  envelopes posted via `airc msg`.

The OUTBOUND path (attach + room join + heuristic adapter +
say) remains provably wired. The INBOUND path is structurally
correct here and will start producing replies the moment
task #82 lands in the daemon.

Refs: #82, #102, #108, #119

Co-Authored-By: Claude Opus 4.7 <[email protected]>
joelteply added a commit that referenced this pull request Jun 2, 2026
…ce 9)

Slice 9 turns the slice-8 MaterializedPersonaPlan into a HostedPersona:
a row owning a constructed inference adapter, ready for the slice-10
per-persona service-loop to drive.

- PersonaAdapterFactory trait: one async method (build_adapter), the
  polymorphism rail where future shapes land (#122 shared-base +
  LoRA paging, #108 cross-grid inference). Smart routing lives in
  the boot composition above; the trait stays trivial per
  [[commands-are-dumb-daemons-are-smart]].
- LlamaCppPersonaAdapterFactory: production impl that hands the
  profile to LlamaCppAdapter::for_persona. Stateless + Arc-shareable.
- HostedPersona { role, instance, adapter: Box<dyn AIProviderAdapter> }.
  Slice 10 takes a Vec<HostedPersona> and binds each persona to its
  airc room with a subscribe-and-respond loop.
- SupervisorError: Profile (slice-8 profile already failed — passes
  through) vs AdapterFactory (factory rejected this profile). Both
  tagged with slot_index + role for operator visibility.
- materialize_adapters(plans, factory): sequential per-row build
  (intentional — four ~500 MiB GGUF loads in parallel on an 8 GiB
  Intel Mac is hostile). Slice 10+ parallelizes once #122 makes the
  per-persona cost much smaller. Per [[no-fallbacks-ever]] no
  substitution, no implicit retry — failed rows stay errored.

Tests use a stub PersonaAdapterFactory so adapter materialization
runs without loading a real GGUF:
- materializes_one_adapter_per_persona_via_factory — happy path
  proves factory called once per persona, adapter.provider_id()
  matches each profile's model_id (no leaked shared state).
- forwards_profile_errors_without_calling_factory — Err(profile)
  from slice 8 becomes SupervisorError::Profile WITHOUT firing the
  factory; sibling Ok rows still materialize.
- factory_rejection_surfaces_as_adapter_factory_error — factory's
  error message threads cleanly into SupervisorError::AdapterFactory.
- empty_plans_yields_empty_hosted.

Co-Authored-By: Claude Opus 4.7 <[email protected]>
joelteply added a commit that referenced this pull request Jun 9, 2026
…, harden integration test

Three round-2 reviewers cleared the round-1 BLOCKs:
  R1 APPROVE (90 conf) — health-check lie genuinely fixed
  R2 LGTM-WITH-NOTES (84 conf) — duplicate gone; two doctrinal nits
  R3 LGTM-WITH-NOTES (82 conf) — drift coverage closed; flake + diagnostics nits

Per [[agent-review-as-acceptable-approval]] that's approval. This commit
applies the cheap doctrinal cleanups in-place so merge ships at the
quality bar Joel set with "purist in every way."

R2-N1: deduplicate `build_headers`. The new `AircLiveTransport::build_headers`
in round 2 was 4 lines of `headers.insert()` calls that exactly mirror
`routing::airc_transport::AircTransport::build_headers` (env=None on
our envelopes, so the env-header branch of the canonical function is
a no-op). R2's verdict: "the exact compression violation R1 BLOCK
was about, re-introduced at a smaller scale within the fix commit."
Fix: delete the duplicate, call the canonical
`AircTransport::build_headers(&envelope)` at the one dispatch site.
One logical decision in one place; if `AircCommandRequest` evolves,
both call sites drift together by construction.

R2-N2: stale mod-doc. `inference/airc_remote/mod.rs` still claimed
the production transport was a "follow-up slice (task #108)" — but
round 2 IS the production transport. Also `LocalAdapterTransport`
re-exported but never mentioned in the module layout block. Replaced
the stale bullet with explicit one-line summaries of all three
transport impls: AircLiveTransport (production), LocalAdapterTransport
(in-process passthrough for tests + replay), StubInferenceTransport
(closure stub for error/correlation branches).

R3-N1: convert filter to assert on HEADER_CONTINUUM_BODY_HINT.
Round-2 test had:
   let hint = event.headers.get(HEADER_CONTINUUM_BODY_HINT)?;
   if hint != COMMAND_REQUEST_BODY_HINT { continue; }
Drift in AircLiveTransport's hint stamping would silently skip the
event, await_reply times out at 30s (DEFAULT_COMMAND_DEADLINE), test
fails with a generic Timeout panic — not a named-surface assertion.
Same diagnostic-only-vs-coverage shape R3 BLOCKed on in round 1, at
smaller scale. Fix: keep the `continue` on absent hint (control frames
+ keepalives legitimately have no body_hint), but ASSERT the value
matches COMMAND_REQUEST_BODY_HINT once a body_hint is present. Drift
now fails with: "wire header HEADER_CONTINUUM_BODY_HINT must stamp
COMMAND_REQUEST_BODY_HINT for ai/generate dispatch; got {hint}".

R3-N4: replace 50ms sleep barrier with `tokio::sync::Notify`. The
test had a `sleep(50ms)` to give the responder + sniffer time to
install their `subscribe()` calls before the adapter dispatched.
Flaky on loaded CI. Fix: each spawn function takes an
`Arc<tokio::sync::Notify>` and signals it AFTER `peer.subscribe().await`
returns. The test waits on both notifies before dispatch. Wall-clock
faster too (no fixed 50ms floor) — test runs in 0.89s instead of
0.95s in the integration suite, deterministically.

Deferred follow-up notes (filed in PR body as known follow-ups, not
landed in this PR):

  R3-N2: correlation_id round-trip not explicitly asserted. Drift
  would cause 30s timeout, not a typed assertion. Follow-up: capture
  `pending.correlation_id` from a transport-side hook (or expose it
  to tests) and assert against the sniffed reply's
  HEADER_AIRC_CORRELATION_ID.

  R3-N3: AircCommandResponse::Error variant uncovered. The OK path
  is the only one wired in this test; if send_reply ever stamped
  "ok" unconditionally, this test passes. Follow-up: a second test
  method swapping `canned` for `AircCommandResponse::error(...)`
  closing the error-status-stamping integration gap. Unit test for
  the error variant exists in transport.rs::local_adapter_transport_
  propagates_peer_adapter_errors; substrate's send_reply
  error-stamping path has no integration coverage.

Verified after polish:
  cargo check -p continuum-core --features metal,accelerate -> clean
  cargo test  -p continuum-core --features metal,accelerate
    --lib inference::airc_remote               -> 28/28 unit (0.45s)
    --test airc_remote_inference_roundtrip     -> 1/1 integration (0.89s, deterministic — no sleep)

Net diff over 113b5f7:
  transport.rs: -15 (delete build_headers), +6 (import AircTransport + 1-line comment at call site)
  mod.rs:       -4 (stale bullet), +11 (3 transport impls explicit)
  test:         -3 (drop Duration import + 50ms sleep), +28 (Notify barriers + assert-on-hint)

Co-Authored-By: Claude Opus 4.7 <[email protected]>
joelteply added a commit that referenced this pull request Jun 9, 2026
…t-class AIProviderAdapter (task #108 slice C)

A persona on an Intel Mac can now register an adapter that dispatches
inference at airc://<rtx5090>/ai/generate transparently. From the
cognition path's perspective it's just another AIProviderAdapter; the
inference happens on another machine but the substrate doesn't have to
care. The Tron-grid frame ([[the-substrate-is-the-grid-tron-frame]])
becomes literal at the inference seam.

What lands:

core/continuum-core/src/ai/airc_remote_adapter.rs (NEW)
  pub struct AircRemoteInferenceAdapter { airc, target_peer, ... }
  pub const AIRC_REMOTE_PROVIDER_PREFIX = "airc-remote"
  impl AIProviderAdapter:
    provider_id() = "airc-remote/<peer-uuid>"
    name() = "airc-remote (cross-grid inference)"
    capabilities() = conservative text-only chat-only default; operator
                     overrides via with_capabilities() once they know
                     what the remote runs
    api_style() = ApiStyle::Local
    default_model() = constructor-supplied
    initialize/shutdown = no-op (remote owns model state)
    generate_text(request):
      serialize request → AircCommandRequest{path="ai/generate",
        kind=KIND_PEER, params=request_json} → stamp wire headers per
        continuum-airc-protocol → airc.request to MentionTarget::Peer →
        await_reply → decode AircCommandResponse → decode
        TextGenerationResponse
    create_embedding = NotImplemented (slice C follow-up at ai/embed)
    health_check = Healthy by construction (live probe deferred)
    get_available_models = conservative single-entry list (remote
        registry probe deferred)
  Builder: with_deadline(), with_capabilities()

core/continuum-core/src/ai/mod.rs
  pub mod airc_remote_adapter

core/continuum-core/tests/airc_remote_inference_roundtrip.rs (NEW)
  Live wire test using TwoAircLoopback:
    peer_a = "the 5090" — hosts substrate-equivalent ai/generate
      responder using REAL CommandRequestHandler::parse_envelope +
      send_reply (catches drift between adapter wire and substrate
      parser — same pattern as airc_ipc_roundtrip.rs).
    peer_b = "the Intel Mac" — has AircRemoteInferenceAdapter pointed
      at peer_a, calls .generate_text(request).
  Asserts:
    - wire envelope kind == KIND_PEER, path == "ai/generate", env == None
    - params decode as TextGenerationRequest on substrate side
    - typed TextGenerationResponse decodes correctly on adapter side
    - all fields round-trip (text, model, provider, usage, request_id)

Verified:
  cargo test -p continuum-core --features metal,accelerate
    --lib ai::airc_remote_adapter            → 2/2 unit (0.0s)
    --test airc_remote_inference_roundtrip   → 1/1 integration (1.16s)

Closes task #108 slice C (the adapter itself + first live test).

Follow-up slices already named in task #108 sub-tasks:
  - #117 slice D: Production AircInferenceTransport (live airc daemon —
    same wire, but the remote responder is a REAL ai/generate handler
    dispatching through its CommandExecutor instead of a canned response)
  - #118 slice E: Peer-side handler — receive remote inference
    envelopes, route to local adapter (already exists today as
    CommandRequestHandler; slice E adds the inference-specific routing
    + per-persona auth gate)
  - Probe pings to refresh AdapterCapabilities + ModelInfo from the
    remote on a cadence (no more "conservative defaults")
  - Embedding support (ai/embed roundtrip via the same adapter)

Co-Authored-By: Claude Opus 4.7 <[email protected]>
joelteply added a commit that referenced this pull request Jun 9, 2026
…, harden integration test

Three round-2 reviewers cleared the round-1 BLOCKs:
  R1 APPROVE (90 conf) — health-check lie genuinely fixed
  R2 LGTM-WITH-NOTES (84 conf) — duplicate gone; two doctrinal nits
  R3 LGTM-WITH-NOTES (82 conf) — drift coverage closed; flake + diagnostics nits

Per [[agent-review-as-acceptable-approval]] that's approval. This commit
applies the cheap doctrinal cleanups in-place so merge ships at the
quality bar Joel set with "purist in every way."

R2-N1: deduplicate `build_headers`. The new `AircLiveTransport::build_headers`
in round 2 was 4 lines of `headers.insert()` calls that exactly mirror
`routing::airc_transport::AircTransport::build_headers` (env=None on
our envelopes, so the env-header branch of the canonical function is
a no-op). R2's verdict: "the exact compression violation R1 BLOCK
was about, re-introduced at a smaller scale within the fix commit."
Fix: delete the duplicate, call the canonical
`AircTransport::build_headers(&envelope)` at the one dispatch site.
One logical decision in one place; if `AircCommandRequest` evolves,
both call sites drift together by construction.

R2-N2: stale mod-doc. `inference/airc_remote/mod.rs` still claimed
the production transport was a "follow-up slice (task #108)" — but
round 2 IS the production transport. Also `LocalAdapterTransport`
re-exported but never mentioned in the module layout block. Replaced
the stale bullet with explicit one-line summaries of all three
transport impls: AircLiveTransport (production), LocalAdapterTransport
(in-process passthrough for tests + replay), StubInferenceTransport
(closure stub for error/correlation branches).

R3-N1: convert filter to assert on HEADER_CONTINUUM_BODY_HINT.
Round-2 test had:
   let hint = event.headers.get(HEADER_CONTINUUM_BODY_HINT)?;
   if hint != COMMAND_REQUEST_BODY_HINT { continue; }
Drift in AircLiveTransport's hint stamping would silently skip the
event, await_reply times out at 30s (DEFAULT_COMMAND_DEADLINE), test
fails with a generic Timeout panic — not a named-surface assertion.
Same diagnostic-only-vs-coverage shape R3 BLOCKed on in round 1, at
smaller scale. Fix: keep the `continue` on absent hint (control frames
+ keepalives legitimately have no body_hint), but ASSERT the value
matches COMMAND_REQUEST_BODY_HINT once a body_hint is present. Drift
now fails with: "wire header HEADER_CONTINUUM_BODY_HINT must stamp
COMMAND_REQUEST_BODY_HINT for ai/generate dispatch; got {hint}".

R3-N4: replace 50ms sleep barrier with `tokio::sync::Notify`. The
test had a `sleep(50ms)` to give the responder + sniffer time to
install their `subscribe()` calls before the adapter dispatched.
Flaky on loaded CI. Fix: each spawn function takes an
`Arc<tokio::sync::Notify>` and signals it AFTER `peer.subscribe().await`
returns. The test waits on both notifies before dispatch. Wall-clock
faster too (no fixed 50ms floor) — test runs in 0.89s instead of
0.95s in the integration suite, deterministically.

Deferred follow-up notes (filed in PR body as known follow-ups, not
landed in this PR):

  R3-N2: correlation_id round-trip not explicitly asserted. Drift
  would cause 30s timeout, not a typed assertion. Follow-up: capture
  `pending.correlation_id` from a transport-side hook (or expose it
  to tests) and assert against the sniffed reply's
  HEADER_AIRC_CORRELATION_ID.

  R3-N3: AircCommandResponse::Error variant uncovered. The OK path
  is the only one wired in this test; if send_reply ever stamped
  "ok" unconditionally, this test passes. Follow-up: a second test
  method swapping `canned` for `AircCommandResponse::error(...)`
  closing the error-status-stamping integration gap. Unit test for
  the error variant exists in transport.rs::local_adapter_transport_
  propagates_peer_adapter_errors; substrate's send_reply
  error-stamping path has no integration coverage.

Verified after polish:
  cargo check -p continuum-core --features metal,accelerate -> clean
  cargo test  -p continuum-core --features metal,accelerate
    --lib inference::airc_remote               -> 28/28 unit (0.45s)
    --test airc_remote_inference_roundtrip     -> 1/1 integration (0.89s, deterministic — no sleep)

Net diff over 113b5f7:
  transport.rs: -15 (delete build_headers), +6 (import AircTransport + 1-line comment at call site)
  mod.rs:       -4 (stale bullet), +11 (3 transport impls explicit)
  test:         -3 (drop Duration import + 50ms sleep), +28 (Notify barriers + assert-on-hint)

Co-Authored-By: Claude Opus 4.7 <[email protected]>
joelteply added a commit that referenced this pull request Jun 9, 2026
…uner skeleton — the unification

Stacks on top of `feat/fine-tuning-subsystem` (which lands the trait
+ types + registry + OpenAI adapter). This commit wires the dispatch
seam: a `genome/*` ServiceModule on top of a typed coordinator that
abstracts provider selection across local / grid / cloud.

Joel's framing: "Finally bringing it all together into a performant
concurrent rtos abstracting provider whether local, grid or cloud."
The convergence:

- Inference: `AIProviderAdapter` trait, 9 cloud providers + local
  llamacpp + cross-grid airc-remote (#108) all behind one Arc<dyn>
- Fine-tuning: `FineTuningAdapter` trait, 1 cloud impl (OpenAI) +
  local-candle skeleton + future cross-grid airc-remote, all
  behind one Arc<dyn>
- Both seam into the same RTOS substrate: `ServiceModule` + `tick` +
  `install_executor` + `PressureBroker` + `TokioConcurrencyPolicy`
- Persona never names a provider; substrate picks per request

## What lands

### `core/continuum-core/src/genome/fine_tuning/coordinator.rs`

`FineTuningCoordinator` — stateless selector consulting an
`Arc<FineTuningRegistry>`. Algorithm:

1. **Filter** by hard capability match: base_model prefix (empty Vec
   = wildcard for local Candle), `supports_lora` if request has
   LoRA hyperparams, `supports_validation` if dataset's
   validation_split > 0.
2. **Honor preferred_provider** when supplied AND capable. When the
   preference is registered but NOT capable for this request,
   return typed `PreferredUnavailable` with the diagnostic — no
   silent fallback to a different provider ([[no-fallbacks-ever]]).
3. **Otherwise rank by locality**: adapters with
   `produces_local_artifact=true` beat cloud. Tier 0 = local; tier
   1 = cloud.
4. **Alphabetical tie-break** within tier. Stable, no hidden
   ordering.

9 unit tests cover each rule independently. The locality rule is
load-bearing for the matrix-dojo doctrine — pinning it now keeps
training data on-substrate when local capacity exists.

### `core/continuum-core/src/genome/fine_tuning/local_candle_adapter.rs`

`LocalCandleFineTuner` — substrate-native LoRA trainer skeleton.
Honest "not yet" semantics per [[no-fallbacks-ever]] + the
cautionary tale of the dead `channel.rs` trigger we deleted in PR
#1572:

- Exists as a real registered adapter (the architectural slot is
  visible to the coordinator + telemetry + operator)
- `create_job` returns `FineTuningError::LocalTrainerFailed` with
  pointers to follow-up tasks #231/#232/#233 — explicit "math not
  implemented" instead of fabricated success
- `poll` / `cancel` correctly reject unknown handles with
  `UnknownHandle` instead of fabricating a `TrainingStatus`
- Capabilities advertise the eventual real shape
  (`produces_local_artifact=true` so locality preference fires;
  wildcard base prefixes; LoRA + validation supported), so swapping
  the math in later requires no call-site changes

When tasks #231-#233 land the optimizer loop, this struct fills in
place. The trait + the dispatch + the boot wiring all stay.

### `core/continuum-core/src/modules/genome.rs`

`GenomeModule` ServiceModule. Three commands:

- `genome/job-create` — coordinator picks provider, adapter creates
  job. Returns `{success, result: {handle, selectedProvider}}` so
  callers see which provider got picked (important for telemetry +
  operator validation of the locality preference).
- `genome/job-status` — adapter looked up by `handle.provider_id`,
  polls, returns typed `TrainingStatus`.
- `genome/job-cancel` — same lookup, cancels.

Per [[commands-are-dumb-daemons-are-smart]] the module is narrow.
All errors return as `{success: false, error, errorKind}` so TS-side
callers can branch on the typed `errorKind` slug
(`InvalidRequest` / `MissingCredentials` / `ProviderRejected` /
`Transient` / `MalformedResponse` / `LocalTrainerFailed` /
`UnknownHandle`) without parsing free-form text.

### `start_server` boot wiring (`ipc/mod.rs`)

Builds a `FineTuningRegistry`, conditionally registers
`OpenAIFineTuningAdapter` when `OPENAI_API_KEY` is set, always
registers `LocalCandleFineTuner`, then registers the `GenomeModule`
backed by the populated registry. Mistral / Anthropic / Fireworks /
DeepSeek / Together adapters plug in here as their impls land — same
pattern, gated on the matching `*_API_KEY` secret.

### `core/continuum-core/Cargo.toml`

Adds `multipart` to `reqwest` features (carried over from the
stacked-below PR; OpenAI's `/v1/files` upload needs it).

## Verified

  cargo check -p continuum-core --lib --features metal,accelerate    -> clean
  cargo test  -p continuum-core --lib --features metal,accelerate
    genome::fine_tuning::                                             -> 34/34
    modules::genome::                                                 -> 5/5

39 new tests across the stack. Covers: trait object-safety + dyn
dispatch; registry lookup + re-registration; coordinator selection
rules (8 distinct invariants); OpenAI HTTP status mapping + provider
slug taxonomy; ServiceModule wire shape + envelope contract +
preferred-provider honoring.

## Doctrinal alignment

- `[[commands-are-dumb-daemons-are-smart]]` — `GenomeModule` is
  narrow (validate → look up adapter → dispatch). All smart logic
  (capability filter, locality preference, future cost/pressure
  signals) lives in `FineTuningCoordinator` + the adapter impls.
- `[[no-fallbacks-ever]]` — `LocalCandleFineTuner` skeleton returns
  typed `LocalTrainerFailed` instead of silently picking cloud or
  fabricating success. `PreferredUnavailable` is the typed answer
  to "honor my preference or tell me why you can't."
- `[[matrix-dojo-layer-loading-as-substrate-primitive]]` — the
  coordinator's locality rank ensures training data stays
  on-substrate when local capacity exists.
- `[[inference-is-an-adapter-always-in-the-loop]]` extended: fine-
  tuning is also an adapter, always in the loop. The coordinator
  is the substrate's typed answer to "which adapter?"
- `[[rust-is-the-core-node-is-the-shell]]` — `genome/job-create`
  now exists as a Rust ServiceModule. The TS-side equivalent in
  `src/commands/genome/job-create/` is no longer authoritative;
  follow-up PR can delete it once Node clients route through the
  Rust path.

## Follow-ups (already filed)

- #231: `LocalCandleFineTuner` LoRA module + autograd (math 1/3)
- #232: data loader + AdamW + training loop (math 2/3)
- #233: job lifecycle actor + safetensors output (math 3/3)
- 5 more cloud adapters (Mistral / Anthropic / Fireworks / DeepSeek
  / Together) — each ~250 LOC mirroring the OpenAI pattern, slots
  into the existing boot wiring with a one-line registration

Co-Authored-By: Claude Opus 4.7 <[email protected]>
joelteply added a commit that referenced this pull request Jun 9, 2026
…dule + OpenAI + local skeleton (task #230) (#1574)

* feat(genome): fine-tuning subsystem — trait + types + registry + OpenAI adapter (task #230, Stage 1)

Lays the substrate-side architectural seam for the continuous-learning
loop: noteworthy engrams → teacher-synthesized curriculum →
fine-tuning subsystem → LoRA artifact → forge/alloy provenance →
genome paging → mesh sharing.

Joel's framing on this stage: "make a glorious fine tuning subsystem
per our awesome continuous learning. Modular code." This commit
lands the modular pieces; the local Candle trainer + remaining cloud
adapters + the academy/teacher pipeline are follow-up PRs that plug
into the seams this commit defines.

## What lands

### `core/continuum-core/src/genome/fine_tuning/`

A new submodule under the existing `genome/` cache + paging
infrastructure. Four files:

- **`mod.rs`** — doctrine doc explaining where this module sits in
  the continuous-learning loop. Stage 3 of 6: takes a curated
  dataset + hyperparams + provider preference, runs a job, returns
  a `TrainingArtifact` that forge / alloy / paging consume.

- **`types.rs`** — typed wire surfaces. Every field that crosses an
  adapter boundary is typed at compile time; no `serde_json::Value`
  pass-through except for opt-in dataset-example metadata:
  - `TrainingJobRequest` (persona_id, base_model, trait_kind,
    dataset, optional hyperparams)
  - `TrainingDataset` + `TrainingExample` + `TrainingSource` enum
    (`teacher_synthesized` / `operator_curated` / `raw` /
    `mesh_inherited`) — source provenance is load-bearing for the
    substrate's reputation signal
  - `LoRAHyperparams` + `ScheduleParams`
  - `JobHandle` (provider_id + provider_job_id + local UUID)
  - `TrainingStatus` tagged enum (Queued / Running / Completed /
    Failed / Cancelled) — terminal `Completed` carries the
    `TrainingArtifact`
  - `TrainingArtifact` + `JobMetrics`
  All structs ts-rs export to `protocol/typescript/genome/fine_tuning/`
  so TS-side consumers get matching types automatically.

- **`adapter.rs`** — the `FineTuningAdapter` trait + typed
  `FineTuningError` taxonomy (`InvalidRequest` /
  `MissingCredentials` / `ProviderRejected` / `Transient` /
  `MalformedResponse` / `LocalTrainerFailed` / `UnknownHandle`).
  Same async-trait + `Arc<dyn ...>` shape that `AIProviderAdapter`
  in `ai/adapter.rs` uses for inference — the substrate's two
  model-touchpoint seams now mirror each other. Trait is
  object-safe; covered by a stub-adapter dyn-dispatch test.

- **`registry.rs`** — `FineTuningRegistry` keyed by `provider_id`.
  Same pattern as the inference `AdapterRegistry`. Re-registering
  the same provider returns the prior entry so callers can shut it
  down cleanly (proven by `re_register_returns_prior` test, written
  to catch the "silently lying about lookup success" pattern Stage
  B was about removing).

### `core/continuum-core/src/genome/fine_tuning/openai_adapter.rs`

First concrete adapter — proves the trait fits a real provider's
shape. Implements:

- `create_job` — uploads dataset as JSONL via `/v1/files`
  (purpose=fine-tune), then POSTs `/v1/fine_tuning/jobs`. Schedule
  hyperparams pass through to OpenAI's `hyperparameters` field when
  the caller supplied them; otherwise OpenAI picks defaults.
- `poll` — GETs `/v1/fine_tuning/jobs/{id}`, maps OpenAI's status
  string set (`validating_files` / `queued` / `running` /
  `succeeded` / `failed` / `cancelled`) to typed `TrainingStatus`
  variants. Terminal `succeeded` builds the `TrainingArtifact` from
  `fine_tuned_model` + `trained_tokens`. OpenAI doesn't ship weights
  back; `local_path` stays `None`.
- `cancel` — POSTs the cancel endpoint.

Provider/error mapping is conservative: 4xx → `ProviderRejected`
(don't retry without fixing the request), 5xx → `Transient`
(backoff + retry is appropriate), JSON shape mismatch →
`MalformedResponse`. 429 is currently mapped to `ProviderRejected`
because the OpenAI docs class it as a quota / config issue, not a
transient outage — pinned by test so a future flip to `Transient`
is a conscious choice.

### Cargo dependency

Adds `multipart` to the existing `reqwest` feature list for the
`/v1/files` upload step. No new top-level dep.

## Verified

  cargo check -p continuum-core --lib --features metal,accelerate   -> clean
  cargo test  -p continuum-core --lib --features metal,accelerate
    genome::fine_tuning::                                            -> 22/22

The 22 tests cover:
- `types`: 11 (ts-rs binding generation pinned per struct + the
  three hand-written invariant tests — TrainingSource snake_case,
  TrainingStatus tagged shape + camelCase fields, LoRA hyperparam
  camelCase serialization)
- `adapter`: 2 (trait object-safety + end-to-end stub roundtrip
  through create/poll/cancel)
- `registry`: 2 (lookup by provider_id + re-register returns prior)
- `openai_adapter`: 4 (status mapping covers all documented states +
  HTTP error taxonomy + provider_id mismatch returns UnknownHandle +
  capabilities pin)

## What's next (Stage 2+ of #230)

Each is a small, focused PR that drops into the seam this commit
defines:

- Mistral adapter (OpenAI-API-compatible mostly; quirk handling for
  Mistral's job lifecycle differences)
- Anthropic adapter
- Fireworks / DeepSeek / Together adapters
- `LocalCandleFineTuner` — the substrate-native sibling. Uses the
  existing `inference/lora.rs` weight-merge math, adds the
  optimizer loop. This is where the matrix-dojo + teacher-synthesis
  doctrines actually compound — in-process training closes the loop
  between persona experience and persona capability without any
  cloud-provider hop.
- Rust `genome/job-create` ServiceModule — narrow command on top of
  this trait; replaces the dead trigger we deleted in PR #1572.

## Doctrinal alignment

- `[[teacher-synthesizes-in-academy-like-dreaming]]` — the
  `TrainingSource::TeacherSynthesized` variant exists specifically
  to mark academy-synthesized datasets distinct from raw operator
  corpora; substrate-side reputation can branch on this.
- `[[noteworthy-flag-feeds-memory-AND-curriculum]]` — the doctrine
  doc in `mod.rs` names this as the upstream of the curriculum
  drain; this PR doesn't wire that drain yet but the
  `TrainingJobRequest` is shaped to accept it.
- `[[matrix-dojo-layer-loading-as-substrate-primitive]]` — the
  `TrainingArtifact` flows directly into the existing
  `persona/genome_paging.rs` LRU-managed working set; no new layer
  in between.
- `[[mesh-of-lessons-cross-persona-curricula]]` — `TrainingSource::MeshInherited`
  is the typed marker that the substrate can use to attribute
  cross-persona curriculum sharing.
- `[[rust-is-the-core-node-is-the-shell]]` — the 6 TS LoRA-trainer
  adapters in `src/daemons/ai-provider-daemon/adapters/*/server/*FineTuningAdapter.ts`
  become individually deletable as each Rust adapter lands.
- `[[no-fallbacks-ever]]` — every adapter method returns a typed
  `FineTuningError` variant. No silent skip; no `Ok(())` on a job
  that didn't actually start (the cautionary tale being the dead
  channel.rs trigger from PR #1572).
- `[[every-error-is-an-opportunity-to-battle-harden]]` — the error
  taxonomy distinguishes retriable (`Transient`) from terminal
  (`ProviderRejected` / `MalformedResponse` / `LocalTrainerFailed`)
  so the substrate-side dispatcher branches correctly on first
  failure, not after a thousand burned retries.

Co-Authored-By: Claude Opus 4.7 <[email protected]>

* feat(genome): FineTuningCoordinator + GenomeModule + LocalCandleFineTuner skeleton — the unification

Stacks on top of `feat/fine-tuning-subsystem` (which lands the trait
+ types + registry + OpenAI adapter). This commit wires the dispatch
seam: a `genome/*` ServiceModule on top of a typed coordinator that
abstracts provider selection across local / grid / cloud.

Joel's framing: "Finally bringing it all together into a performant
concurrent rtos abstracting provider whether local, grid or cloud."
The convergence:

- Inference: `AIProviderAdapter` trait, 9 cloud providers + local
  llamacpp + cross-grid airc-remote (#108) all behind one Arc<dyn>
- Fine-tuning: `FineTuningAdapter` trait, 1 cloud impl (OpenAI) +
  local-candle skeleton + future cross-grid airc-remote, all
  behind one Arc<dyn>
- Both seam into the same RTOS substrate: `ServiceModule` + `tick` +
  `install_executor` + `PressureBroker` + `TokioConcurrencyPolicy`
- Persona never names a provider; substrate picks per request

## What lands

### `core/continuum-core/src/genome/fine_tuning/coordinator.rs`

`FineTuningCoordinator` — stateless selector consulting an
`Arc<FineTuningRegistry>`. Algorithm:

1. **Filter** by hard capability match: base_model prefix (empty Vec
   = wildcard for local Candle), `supports_lora` if request has
   LoRA hyperparams, `supports_validation` if dataset's
   validation_split > 0.
2. **Honor preferred_provider** when supplied AND capable. When the
   preference is registered but NOT capable for this request,
   return typed `PreferredUnavailable` with the diagnostic — no
   silent fallback to a different provider ([[no-fallbacks-ever]]).
3. **Otherwise rank by locality**: adapters with
   `produces_local_artifact=true` beat cloud. Tier 0 = local; tier
   1 = cloud.
4. **Alphabetical tie-break** within tier. Stable, no hidden
   ordering.

9 unit tests cover each rule independently. The locality rule is
load-bearing for the matrix-dojo doctrine — pinning it now keeps
training data on-substrate when local capacity exists.

### `core/continuum-core/src/genome/fine_tuning/local_candle_adapter.rs`

`LocalCandleFineTuner` — substrate-native LoRA trainer skeleton.
Honest "not yet" semantics per [[no-fallbacks-ever]] + the
cautionary tale of the dead `channel.rs` trigger we deleted in PR
#1572:

- Exists as a real registered adapter (the architectural slot is
  visible to the coordinator + telemetry + operator)
- `create_job` returns `FineTuningError::LocalTrainerFailed` with
  pointers to follow-up tasks #231/#232/#233 — explicit "math not
  implemented" instead of fabricated success
- `poll` / `cancel` correctly reject unknown handles with
  `UnknownHandle` instead of fabricating a `TrainingStatus`
- Capabilities advertise the eventual real shape
  (`produces_local_artifact=true` so locality preference fires;
  wildcard base prefixes; LoRA + validation supported), so swapping
  the math in later requires no call-site changes

When tasks #231-#233 land the optimizer loop, this struct fills in
place. The trait + the dispatch + the boot wiring all stay.

### `core/continuum-core/src/modules/genome.rs`

`GenomeModule` ServiceModule. Three commands:

- `genome/job-create` — coordinator picks provider, adapter creates
  job. Returns `{success, result: {handle, selectedProvider}}` so
  callers see which provider got picked (important for telemetry +
  operator validation of the locality preference).
- `genome/job-status` — adapter looked up by `handle.provider_id`,
  polls, returns typed `TrainingStatus`.
- `genome/job-cancel` — same lookup, cancels.

Per [[commands-are-dumb-daemons-are-smart]] the module is narrow.
All errors return as `{success: false, error, errorKind}` so TS-side
callers can branch on the typed `errorKind` slug
(`InvalidRequest` / `MissingCredentials` / `ProviderRejected` /
`Transient` / `MalformedResponse` / `LocalTrainerFailed` /
`UnknownHandle`) without parsing free-form text.

### `start_server` boot wiring (`ipc/mod.rs`)

Builds a `FineTuningRegistry`, conditionally registers
`OpenAIFineTuningAdapter` when `OPENAI_API_KEY` is set, always
registers `LocalCandleFineTuner`, then registers the `GenomeModule`
backed by the populated registry. Mistral / Anthropic / Fireworks /
DeepSeek / Together adapters plug in here as their impls land — same
pattern, gated on the matching `*_API_KEY` secret.

### `core/continuum-core/Cargo.toml`

Adds `multipart` to `reqwest` features (carried over from the
stacked-below PR; OpenAI's `/v1/files` upload needs it).

## Verified

  cargo check -p continuum-core --lib --features metal,accelerate    -> clean
  cargo test  -p continuum-core --lib --features metal,accelerate
    genome::fine_tuning::                                             -> 34/34
    modules::genome::                                                 -> 5/5

39 new tests across the stack. Covers: trait object-safety + dyn
dispatch; registry lookup + re-registration; coordinator selection
rules (8 distinct invariants); OpenAI HTTP status mapping + provider
slug taxonomy; ServiceModule wire shape + envelope contract +
preferred-provider honoring.

## Doctrinal alignment

- `[[commands-are-dumb-daemons-are-smart]]` — `GenomeModule` is
  narrow (validate → look up adapter → dispatch). All smart logic
  (capability filter, locality preference, future cost/pressure
  signals) lives in `FineTuningCoordinator` + the adapter impls.
- `[[no-fallbacks-ever]]` — `LocalCandleFineTuner` skeleton returns
  typed `LocalTrainerFailed` instead of silently picking cloud or
  fabricating success. `PreferredUnavailable` is the typed answer
  to "honor my preference or tell me why you can't."
- `[[matrix-dojo-layer-loading-as-substrate-primitive]]` — the
  coordinator's locality rank ensures training data stays
  on-substrate when local capacity exists.
- `[[inference-is-an-adapter-always-in-the-loop]]` extended: fine-
  tuning is also an adapter, always in the loop. The coordinator
  is the substrate's typed answer to "which adapter?"
- `[[rust-is-the-core-node-is-the-shell]]` — `genome/job-create`
  now exists as a Rust ServiceModule. The TS-side equivalent in
  `src/commands/genome/job-create/` is no longer authoritative;
  follow-up PR can delete it once Node clients route through the
  Rust path.

## Follow-ups (already filed)

- #231: `LocalCandleFineTuner` LoRA module + autograd (math 1/3)
- #232: data loader + AdamW + training loop (math 2/3)
- #233: job lifecycle actor + safetensors output (math 3/3)
- 5 more cloud adapters (Mistral / Anthropic / Fireworks / DeepSeek
  / Together) — each ~250 LOC mirroring the OpenAI pattern, slots
  into the existing boot wiring with a one-line registration

Co-Authored-By: Claude Opus 4.7 <[email protected]>

---------

Co-authored-by: Claude Opus 4.7 <[email protected]>
joelteply added a commit that referenced this pull request Jun 10, 2026
…ratchet (task #240 — fourth proof shape) (#1592)

Fourth proof in the architecture-test matrix. Pins the "module
compose-by-event" doctrine clause — substrate-internal modules
compose via the event substrate (MessageBus subscribe/emit) or via
pre-bound handles, not by imperative `CommandExecutor::execute_*`
round-trips through the outer command interface inside the
cognition hot path.

## What ships

`core/continuum-core/tests/architecture_compose_by_event.rs` — two
integration tests:

1. `cognition_command_executor_calls_ratchet` — scans every `.rs`
   file under `core/continuum-core/src/cognition/`, finds lines
   matching `.execute_json(`, `.execute_with_caller(`,
   `.execute_ts(`, `.execute_ts_json(`, asserts the count doesn't
   grow beyond the current grandfathered budget of **1**. NEW
   calls BLOCK; the existing one is tracked under #112-#114
   (route persona response / should_respond / validate through
   inference handle).

   Bare `.execute(` is intentionally NOT in the forbidden list —
   it would generate false positives across futures, queues, and
   other APIs. If a typed `executor.execute(typed_args)` pattern
   appears inside cognition in a future refactor, extend the list.

   Test mods (`#[cfg(test)] mod ... { ... }`) are exempted via
   the same brace-depth parser as the singleton-ban test, with
   inline `#[cfg(test)] mod tests {` handling.

   Line comments (`//` lines) are skipped so doc comments quoting
   the very pattern being banned don't trip the scanner — this
   matters for cognition module top-of-file docs that reference
   `Commands.execute('cognition/...')` as the TS-side caller
   contract.

2. `command_executor_remains_the_outer_boundary` — positive pin:
   `runtime/command_executor.rs` exists, declares
   `pub struct CommandExecutor`, exposes `pub async fn execute_json`.
   If the type is renamed or `execute_json` moves, the test is
   loud, not silent — and the FORBIDDEN list in this test file
   needs updating to match.

## The 1 grandfathered violation

`cognition/vision_describe.rs::describe_image_via_ai_generate` calls
`executor.execute_json("ai/generate", ...)`. The clean fix is a
pre-bound `InferenceHandle` (cf. tasks #107-#108), called directly
the same way `airc_chat_demo` already does. Migration tracked under
#112-#114 (the inference-command-routing campaign) and #106
(ai/* namespace consolidation).

## Why ratchet (not strict)

Same reason as engine-OS layering and singleton-ban: the single
existing violation needs a considered migration (which `InferenceHandle`
to pre-bind, where to wire the lifecycle), not a sed sweep. NEW
violations BLOCK at PR time; the ratchet count graduates to ✅ when
#112-#114 land.

## Matrix update

`PROVING-THE-DOCTRINE.md` row for "Module compose-by-event" flips
from 🔴 (no proof) to 🟡 (ratchet active, target ✅ when count = 0).

## Test plan

- [x] `cargo test -p continuum-core --test
      architecture_compose_by_event --features metal,accelerate`
      — 2/2 pass; grandfathered count = 1 (exact match)
- [x] `// proves: module compose-by-event` tag applied
- [x] Ratchet logic verified (both grow-detection and
      shrink-detection paths via inspection)
- [x] Line-comment skip verified — the two pre-existing
      `Commands.execute(...)` doc references in
      `vision_describe.rs` and `rate_proposals/mod.rs` do NOT
      trip the scanner

## Doctrine alignment

- Substrate doctrine § "Module compose-by-event" — cognition
  composes via event substrate or pre-bound handles, not
  imperative request-response round-trips
- [[no-fallbacks-ever]] — the ratchet IS the no-fallback
  equivalent for the cognition→command-executor coupling at
  build-graph layer

## Related

- Task #240 — architecture-test matrix, fourth proof
- Builds on PR #1589 (ratchet pattern) and PR #1591 (singleton ban —
  same scanner shape)
- Migration follow-up: tasks #112-#114 (#113 is currently
  in_progress) → ratchet count goes 1 → 0 → strict

Co-authored-by: Claude Opus 4.7 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dependencies Pull requests that update a dependency file javascript Pull requests that update javascript code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants