Skip to content

Resolve Lerna 8 update conflicts - #15

Closed
joelteply wants to merge 3 commits into
mainfrom
fix/resolve-lerna-conflicts
Closed

joelteply wants to merge 3 commits into
mainfrom
fix/resolve-lerna-conflicts

Conversation

@joelteply

@joelteply joelteply commented Apr 9, 2025 •

Copy link
Copy Markdown
Contributor
  • Update Lerna from 6.6.2 to 8.2.1
  • Update postinstall script from 'lerna bootstrap' to 'lerna run prepare'
  • Update Node.js engine requirement to 18+ (was 14+)
  • Update CI workflow to use Node.js 18+ and 20+ (remove 16.x)
  • Add update script and documentation for Lerna 8 transition

This resolves the conflicts in PR #7 and provides a smoother upgrade path.

🤖 Generated with Claude Code

Description

Please include a summary of the changes and which issue is fixed. Please also include relevant motivation and context.

Fixes # (issue)

Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change that fixes an issue)
  • New feature (non-breaking change that adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

How Has This Been Tested?

Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce.

  • Test A
  • Test B

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes

- Update Lerna from 6.6.2 to 8.2.1
- Update postinstall script from 'lerna bootstrap' to 'lerna run prepare'
- Update Node.js engine requirement to 18+ (was 14+)
- Update CI workflow to use Node.js 18+ and 20+ (remove 16.x)
- Add update script and documentation for Lerna 8 transition

This resolves the conflicts in PR #7 and provides a smoother upgrade path.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <[email protected]>
Copilot AI review requested due to automatic review settings April 9, 2025 02:50

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot reviewed 2 out of 4 changed files in this pull request and generated no comments.

Files not reviewed (2)
  • package.json: Language not supported
  • scripts/update-lerna.sh: Language not supported
Comments suppressed due to low confidence (1)

LERNA_UPDATE.md:17

  • Ensure that the update script (update-lerna.sh) has executable permissions and is present in the scripts directory to avoid runtime issues.
./scripts/update-lerna.sh

@joelteply
joelteply enabled auto-merge April 9, 2025 02:51
joelteply and others added 2 commits April 8, 2025 21:57
- Add robust error handling to visualize-config.js
- Create simplified version that doesn't depend on yaml module
- Add package.json for examples directory
- Update CI workflow to better handle example validation

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <[email protected]>
@joelteply joelteply closed this Apr 9, 2025
auto-merge was automatically disabled April 9, 2025 03:28

Pull request was closed

@joelteply
joelteply deleted the fix/resolve-lerna-conflicts branch April 9, 2025 04:29
joelteply added a commit that referenced this pull request Jun 17, 2026
… 4 methods (#1667)

AIProviderAdapter required ~10 methods, so every new provider and every
test fixture boilerplated the long tail with identical canned values —
the cv::Algorithm anti-pattern (the interface should make the COMMON case
trivial). This was the concrete friction that made the deliberation
acts-loop test (task #15) heavy enough to defer.

Give the rarely-overridden methods sensible defaults so a minimal adapter
is just provider_id + name + default_model + generate_text:
  - capabilities() -> AdapterCapabilities::text_only() (new constructor)
  - api_style()    -> Local
  - initialize()   -> Ok(())
  - shutdown()     -> Ok(())
  - health_check() -> HealthStatus::healthy() (new constructor)
  - get_available_models() -> [] (ModelInfo has no defaults by design,
    so the honest default is "no catalog," not a synthesized entry)

Mirrors how the trait ALREADY defaults warmup / create_embedding /
device_type / supports / lora_* — the CBAR "for free" shape: minimal
required surface, sensible defaults, override only what differs. Cloud
adapters override api_style/health_check/get_available_models; local
model adapters override initialize/shutdown/warmup. No production adapter
changes behavior (they all override these explicitly already).

Boy-scout: collapse the test StubAdapter to the 4 required methods +
supports_model, proving the defaults via the existing registry tests, and
add minimal_adapter_inherits_sensible_defaults asserting each default.

Coordinated on airc: BigMama confirmed no collision (she's in client/ +
continuum-airc-protocol, nowhere near core/ai/adapter.rs) and endorsed
the cut as the right elegance.

Co-authored-by: Claude Opus 4.8 <[email protected]>
joelteply added a commit that referenced this pull request Jun 17, 2026
…gance pass

Activates task #15: the speaks→ACTS path now has end-to-end behavioral
coverage with deterministic doubles, and the loop itself is refined.

Tests (llm_deliberation_faculty):
  - persona_acts_then_speaks_threading_tool_results — model requests a tool
    → executor runs it → result threaded back → model re-generates → its
    post-tool text is the Speak verdict. Asserts the right tool ran, the
    loop re-generated (2 model calls), and the re-prompt carried the tool
    RESULT back (the agent transcript). The case that proves a persona can
    act on what its tools returned, not just speak.
  - tools_without_executor_stay_speak_only — the can_act gate: tools
    authorized but no executor → tools inert, single generate, no tool
    round. Backward-compat guard.

Test doubles are LEAN thanks to the AIProviderAdapter default impls (#1667):
ScriptedAdapter is 4 methods (canned response sequence + records requests);
RecordingExecutor records the calls it ran. That boilerplate was the exact
friction that made this test heavy enough to defer.

Elegance pass on the loop (Joel: "elegant structs, good generics,
adaptability"):
  - Extracted try_tool_round() — owns the whole can_act gate (authorized
    tools AND executor AND a non-empty tool-use response), runs the batch,
    threads the agent transcript, returns whether to re-generate. The loop
    body is now generate → maybe act → re-generate, bounded.
  - Extracted verdict() — text → Contribution in one place.
  - Added ChatMessage::assistant_tool_use(&[ToolCall]) and
    ChatMessage::tool_results(&[ToolResult]) — the two agent-transcript
    turn shapes the loop built inline now live as reusable constructors on
    ChatMessage (one place per concern; any future agent loop reuses them).

Co-Authored-By: Claude Opus 4.8 <[email protected]>
joelteply added a commit that referenced this pull request Jun 20, 2026
…ned (#1665)

* feat(cognition): deliberation agent loop — the speaks→acts capability (dormant)

The LlmDeliberationFaculty can now ACT, not just speak: with an authorized tool set
(NativeToolSpec) + an injected ToolExecutor, contribute() runs the agent loop —
generate → if finish_reason=ToolUse, execute_native_batch the structured tool_calls
→ thread the ToolResults back as ContentPart::ToolResult → re-generate → until a
final text Decision (bounded by max_tool_iterations; a turn is bounded work, not an
open agent). Structured ContentPart contract, NOT text-parsing (per
PERSONA-COGNITION-PIPELINE.md). ToolExecutor is injected (trait) — TS-IPC impl in
prod, mock in tests; the loop is impl-agnostic.

DORMANT + SAFE: backward-compatible — with no tools/executor (the current
build_workspace_cycle default) the loop runs exactly once with tools:None and
returns the same verdict as before. The existing deliberates_through_a_real_adapter
test passes unchanged through the new loop (speak-only path regression-validated).
The acting branch cannot fire in production until a persona is wired with tools +
an executor.

FOLLOW-UP (the activation slice, gated): (1) supervisor wires the persona's
authorized NativeToolSpec set + a concrete ToolExecutor (TsIpcToolExecutor) into
build_workspace_cycle; (2) the acting-path behavioral test (scripted adapter
returning tool_use→text + a mock executor, asserting the loop executes + threads +
decides); (3) thread the real session/context ids into tool_context() (nil today).

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

* test(cognition): behavioral test for the deliberation acts-loop + elegance pass

Activates task #15: the speaks→ACTS path now has end-to-end behavioral
coverage with deterministic doubles, and the loop itself is refined.

Tests (llm_deliberation_faculty):
  - persona_acts_then_speaks_threading_tool_results — model requests a tool
    → executor runs it → result threaded back → model re-generates → its
    post-tool text is the Speak verdict. Asserts the right tool ran, the
    loop re-generated (2 model calls), and the re-prompt carried the tool
    RESULT back (the agent transcript). The case that proves a persona can
    act on what its tools returned, not just speak.
  - tools_without_executor_stay_speak_only — the can_act gate: tools
    authorized but no executor → tools inert, single generate, no tool
    round. Backward-compat guard.

Test doubles are LEAN thanks to the AIProviderAdapter default impls (#1667):
ScriptedAdapter is 4 methods (canned response sequence + records requests);
RecordingExecutor records the calls it ran. That boilerplate was the exact
friction that made this test heavy enough to defer.

Elegance pass on the loop (Joel: "elegant structs, good generics,
adaptability"):
  - Extracted try_tool_round() — owns the whole can_act gate (authorized
    tools AND executor AND a non-empty tool-use response), runs the batch,
    threads the agent transcript, returns whether to re-generate. The loop
    body is now generate → maybe act → re-generate, bounded.
  - Extracted verdict() — text → Contribution in one place.
  - Added ChatMessage::assistant_tool_use(&[ToolCall]) and
    ChatMessage::tool_results(&[ToolResult]) — the two agent-transcript
    turn shapes the loop built inline now live as reusable constructors on
    ChatMessage (one place per concern; any future agent loop reuses them).

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

* fix(cognition): abstain instead of fabricating PASS when the model is cut off

Adversarial review (PR #1665) caught a no-fallbacks-doctrine violation: when
the model hit the tool-iteration cap (or had no executor) and returned
finish_reason=ToolUse with EMPTY text, the loop fell through to
verdict("") → decision_from_response("") → Decision::Pass — silently turning
a model cut off mid-reasoning into "chose silence (PASS)". Silence must be the
model's choice, never a substrate artifact (same rule the inference-failure
branch already honors by returning None).

Fix: when the model still wanted to act but we're not acting AND it left no
verdict text, abstain (return None) + warn at the cap boundary
(OBSERVABILITY-AS-SUBSTRATE: hitting the ceiling is a load-bearing decision).
Non-empty text is still honored — a model that says "PASS" alongside a tool
call expressed a real verdict (tools_without_executor_stay_speak_only stays
green).

Regression test added: tool_want_with_empty_text_and_no_executor_abstains.
All 5 deliberation tests pass.

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

---------

Co-authored-by: Claude Opus 4.8 <[email protected]>
joelteply added a commit that referenced this pull request Jun 20, 2026
…l calls → core commands) (#1700)

The diagnosis behind "personas only do stupid demos": the live cognition brain
can deliberate and SPEAK, but it had no hands. The deliberation faculty's
agent loop can emit native tool_use calls, but the ONLY ToolExecutor was a test
double — so the live persona could never act. (Tool execution historically
lived TS-side; when the brain moved to Rust the tool seam was left as a trait
with no production impl.)

CommandToolExecutor is that production impl. It routes each native tool call
straight to the core command surface (code/read, code/edit, cargo, data/* — the
same catalog the MCP server exposes) via CommandExecutor. No Node in the loop:
brain is Rust, tools are Rust commands. Tool name == command name (underscore
form maps to slash). Each call dispatches under the persona's own
CallerIdentity::local(persona_id), so the SAME AuthPolicy gate (incl.
GridTrustAuthPolicy) that protects every command gates the persona too. A failed
call feeds back as an error RESULT (model can recover), not a batch failure;
results truncate on a char boundary so context doesn't blow up.

Tests: routes a native call to the real command (the keystone — "talks"→"acts"),
underscore→slash mapping, failed-call→error-result-not-batch-failure. 3/3 pass.

Slice 1 of #15 (persona-as-client tools). Slice 2 wires this + a default toolset
into build_workspace_cycle so the LIVE persona gets hands.

Co-authored-by: Claude Opus 4.8 <[email protected]>
joelteply added a commit that referenced this pull request Jun 20, 2026
…s, preserve behavior

Adversarial reviewer (default-BLOCK) findings on #1702, all fixed:

- BLOCKER: the per-call `time_async!` wrap allocated 3 Strings every tool call
  (TimingGuard is NOT a no-op when logging is off — `.into()` x2 on construct +
  `format!` in Drop before the LOGGER check). It ADDED hot-path allocations in
  the PR meant to remove them, with a false "no-op" comment. Removed the per-call
  wrap; dispatch latency is already captured by the executor's command_completed
  event + measured by the load harness. Hot path is now alloc-lean.
- MAJOR: error content fed to the model was the ClientError wrapper Display
  ("substrate refused command `x`: …"). Now unwraps ClientError::Refused.reason
  so the model sees the substrate's real message ("Unknown command: …"), matching
  the prior behavior. Pinned by an assertion in failed_call_*.
- MAJOR: Binary command results flipped from success(metadata) to error when
  routed through InProcessTransport. command_result_to_value now mirrors
  CommandResult::to_json_value (Binary → Ok(metadata)). Pinned by a new test.
- MINOR: reworded the exec_over doc — this executor is not yet wired into
  build_workspace_cycle (that's the next slice of #15).
- NIT: restored alphabetical order of the InProcessTransport re-export.

All green: client execute_value, 6 executor tests (incl. 3 stress proofs),
4 in_process_transport tests (incl. the new Binary pin).

Refs #15.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
joelteply added a commit that referenced this pull request Jun 20, 2026
…round-trip (#1702)

* perf(persona): route tool dispatch through the uniform client + kill Value round-trip

Persona ToolExecutor now rides the SAME continuum_client::Connection every
citizen uses, over InProcessTransport (the local-connection variant) — no
bespoke Arc<CommandExecutor> path. cli/mobile/persona differ only by transport.

- execute_native_batch dispatches the whole batch CONCURRENTLY (join_all):
  native parallel tool calls in a turn are independent, correlate by
  tool_use_id. Consolidated burst at O(batch), never per-event FIFO.
- CommandClient::execute_value: Value-native dispatch that skips the
  to_value/from_value round-trip the typed execute() did for P=R=Value (two
  full tree-walks of pure waste on every persona tool call). execute() now
  delegates through it — one dispatch path; round-trip only at the genuine
  typed boundary. +10-15% at scale even in debug.
- Cow command names: only allocate the _->/ rewrite when an underscore exists.
- time_async! probe on the dispatch seam (not eprintln).

Proven, not claimed (gated #[cfg(feature="stress-tests")]):
- Barrier(50) deadlock-proofs: intra-batch + cross-persona dispatch is
  concurrent; serialization would deadlock -> timeout fails.
- load_harness.rs: realistic 50-persona team on a shared project via the REAL
  CodeModule (read/search/tree/write, real payloads). read 27k/s search 17k/s
  write 31k/s tree 6k/s, 0 errors. Dispatch overhead ~13us = ~2% of a real
  read. read scaling sweep 10->400 personas: 23k->35k reads/sec, flat latency,
  NO contention cliff.

Verdict: the in-process client path scales clean; dispatch is not the
bottleneck. Next: airc remote-path (AircIpcTransport) body-opaque streamlining.

Refs #15.

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

* perf(persona): address adversarial review — drop hot-path probe allocs, preserve behavior

Adversarial reviewer (default-BLOCK) findings on #1702, all fixed:

- BLOCKER: the per-call `time_async!` wrap allocated 3 Strings every tool call
  (TimingGuard is NOT a no-op when logging is off — `.into()` x2 on construct +
  `format!` in Drop before the LOGGER check). It ADDED hot-path allocations in
  the PR meant to remove them, with a false "no-op" comment. Removed the per-call
  wrap; dispatch latency is already captured by the executor's command_completed
  event + measured by the load harness. Hot path is now alloc-lean.
- MAJOR: error content fed to the model was the ClientError wrapper Display
  ("substrate refused command `x`: …"). Now unwraps ClientError::Refused.reason
  so the model sees the substrate's real message ("Unknown command: …"), matching
  the prior behavior. Pinned by an assertion in failed_call_*.
- MAJOR: Binary command results flipped from success(metadata) to error when
  routed through InProcessTransport. command_result_to_value now mirrors
  CommandResult::to_json_value (Binary → Ok(metadata)). Pinned by a new test.
- MINOR: reworded the exec_over doc — this executor is not yet wired into
  build_workspace_cycle (that's the next slice of #15).
- NIT: restored alphabetical order of the InProcessTransport re-export.

All green: client execute_value, 6 executor tests (incl. 3 stress proofs),
4 in_process_transport tests (incl. the new Binary pin).

Refs #15.

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

* docs(persona): fix stale load-harness comment left by the probe removal

Re-review caught it: load_scaling_curve's comment still claimed per-call
dispatch is timed by a time_async! probe — that probe was removed in the prior
fix commit. Corrected to state batch latency is the measurement and per-call
dispatch is intentionally not separately probed on the hot path. Comment-only.

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

---------

Co-authored-by: Claude Opus 4.8 <[email protected]>
joelteply added a commit that referenced this pull request Jun 21, 2026
#1708)

A persona's tools are now DISCOVERED, never hardcoded. The surface is a pure
function of `command_registry() × access_level`: every command that declares
`AccessLevel::AiSafe` becomes a callable tool, a new ai-safe command appears
→ the persona can use it with zero code change. No hardcoded tool list, no
parallel allow-table — the command's own access_level (its destiny),
surfaced through the one central listing, is the single source of truth.

This replaces the anti-pattern (a fixed with_tools(vec![read_tool()]) and a
would-be hardcoded ACL prefix table) with the dynamic mechanism that was
always intended ("all open, dynamic").

- `ai_safe_tool_specs()` — the persona's tools, derived live from the registry.
- `descriptor_to_tool_spec()` — the projection; description + schema are
  best-effort until commands declare richer tool-facing metadata (the next
  mechanism, in the command's own destiny), which lands here with no caller
  change. Open-by-default now.
- `tool_surface_report()` — the anti-"tool vanished" diagnostic: included /
  excluded + the one reason (access_level), so "why isn't tool X here?" is a
  one-look answer, never a hunt for a scattered filter.

Tests: surface == registry AiSafe slice (no silent inclusion/exclusion;
included ∪ excluded == whole registry); projection preserves the command
name. Next: wire ai_safe_tool_specs() into build_workspace_cycle (#15) and
enrich descriptor metadata (description + param schema).

Co-authored-by: Claude Opus 4.8 <[email protected]>
joelteply added a commit that referenced this pull request Jun 21, 2026
…he live brain (#15) (#1717)

The deliberation faculty could already DECIDE to act (it emits native tool_use
calls), but build_workspace_cycle constructed it speak-only — no executor, so
the live persona could talk but never touch the world. This wires the persona's
nervous system: the model's tool calls now route to the core's command surface.

The chain:
- CommandToolExecutor::for_persona(executor, persona) — production factory.
  Takes the substrate's WIRED Arc<CommandExecutor> (the one start_server builds
  with GridTrustAuthPolicy + interceptors), NOT a fresh CommandExecutor::new
  (AllowAll default, no interceptors). That is the load-bearing SECURITY choice:
  the transport carries CallerIdentity::airc(persona), so the persona is gated
  AS ITSELF — an Owner-gated command (data/delete, grid/trust) is REFUSED at
  execution even if it appears in the tool surface.
- PersonaBrainConfig.tool_executor: Option<Arc<dyn ToolExecutor>>. Some →
  build_workspace_cycle offers the dynamic AiSafe tool surface
  (ai_safe_tool_specs(), command_registry × AiSafe — nothing hardcoded) and
  wires the executor. None → speak-only (the safe default for harnesses).
- materialize_adapters gains a tool_executor_for closure (same closure-DI shape
  as runtime_lookup) — keeps the supervisor decoupled from the command runtime.
- The wired executor reaches the spawn task through the existing executor-ready
  oneshot: it now carries Arc<CommandExecutor> instead of () — one channel,
  both the ordering gate AND the payload the hands ride. spawn_all takes it and
  builds a per-persona CommandToolExecutor.

Security model, stated: OFFER = the AiSafe surface; EXECUTE = authorized-by-
identity through GridTrustAuthPolicy. The two layers are independent, so a
broad tool surface never widens what a persona may actually do.

Covered by existing tests (composition): for_persona via the 20 command_executor
tests; the identity→ACL path by in_process_transport's
scoped_persona_client_dispatches_with_identity_and_context; acts-then-speaks by
llm_deliberation_faculty's persona_acts_then_speaks_threading_tool_results.
Binary + persona_workspace + supervisor all green.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants