Skip to content

fix: TS2352 cast in engine:'pi' loader test - #406

Merged
LinuxDevil merged 17 commits into
mainfrom
integration/harnesses
Oct 6, 2026
Merged

LinuxDevil merged 17 commits into
mainfrom
integration/harnesses

Conversation

@LinuxDevil

Copy link
Copy Markdown
Owner

Summary

Follow-up to #405 — that PR merged while CI was still failing on a typecheck error in loadAgentDir.test.ts:233 (PerRun<ToolsOption> can't be directly asserted to an array type; needs as unknown first). This lands the one-line fix so main typechecks again.

Test plan

  • npm run typecheck clean locally
  • npx vitest run src/agentDir/loadAgentDir.test.ts — 28/28 pass

Generated with Devin

LinuxDevil and others added 17 commits October 5, 2026 18:43
Generated with [Devin](https://devin.ai)

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
The merged DTS graph OOMs tsup's worker at the 6144MB NODE_OPTIONS cap
on zod4 peer jobs - bump to 8192 matching the build script. The
docs:verify-snippets gate also flagged sub-agents.md's piAgent example
for undeclared projectDir/ask/allow - import the helpers and use
process.cwd().

Generated with [Devin](https://devin.ai)

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
The zod4 peer matrix still OOMs tsup's DTS worker at 8GB - zod@4/ai@6-7
grow the single-pass ~30-entry declaration graph well past the light
zod3 local set. NODE_OPTIONS does propagate to the worker thread
(verified: heap_size_limit follows it), so 12288 raises the real cap;
ubuntu-latest runners have 16GB. The docs:verify-snippets gate also
flagged sub-agents.md's piAgent example for undeclared
projectDir/ask/allow - import the helpers, use process.cwd().

Generated with [Devin](https://devin.ai)

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
- pi.worker.ts added to dynamicallyLoaded (bundler shim, not statically reachable)
- unexport internal-only symbols (familyInstructionsFor, AUTH_FILE, loopGuard/outputCap); drop dead PiContent union
- registry/** + coding-harness example excluded from dupes: installable kits are self-contained by design
- split zod3ToJsonSchema/applyChecks into per-kind dispatch tables (cyclo 55/38 -> ~5)
- split piAgent.run into openSessionManager/startSession/deliver/settle (cyclo 40 -> ~10); the tool_call gate handler is a named function so coverage matching attributes it
- split chunkStream's event switch and toPiContext's role chain below the cognitive ceiling
- thresholdOverride for piAgent.ts: nested-callback CRAP matching gap, same as registryEnforce's documented case

Generated with [Devin](https://devin.ai)

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
applyChecks/applyBound/wrappedType sat at 0-27% coverage - CRAP breaches
on untested complexity. Hand-built {_def.typeName} fixtures exercise
every converter branch deterministically under both zod3 and zod4 peer
installs.

Generated with [Devin](https://devin.ai)

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Generated with [Devin](https://devin.ai)

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Six deliverables replicating the most-built agent archetypes, each
offline-testable and OpenRouter-live-capable:

- examples/deep-research: orchestrator-workers fan-out, cited synthesis
- examples/support-desk: triage -> handoff() to specialists, refund approval
- examples/evaluator-loop: writer <-> llmCritique revision loop
- examples/data-analyst: text-to-SQL with read-only defense in depth
- registry/inbox-triage: channel intake, classify, draft, approved send,
  per-sender memory, hourly sweep
- registry/incident-response: webhook alert -> diagnose -> risk-tiered
  approvals -> remediate -> verify -> audit

SDK changes the builds exposed:

- llmCritique(): judge score + actionable feedback in one call
- testToolContext() + toolResultText() testing helpers
- handoff calls now pass the permission/hooks/approval gate; structured
  routing args reach the target; run-level target options warn once
- approval TTL: approvalTtlMs (agent/run/rule), expiresAt propagates
  through pause/resume, stale decisions deny with 'approval expired'
- 'defer' approval verdict; resumedAfterApproval hook flag; transient
  tool descriptors skip agent-drift noise on resume
- declarative when matchers (eq/ne/lt/lte/gt/gte/matches) + approvalTtlMs,
  rule ttlMs and store { dir } in agent directories
- ChannelInbound.metadata flows to run/memory scopes; webhookChannel
  principal() derives an authenticated caller
- handoffRun deep-imports ToolRegistry so the Worker bundle stays node-free

Generated with [Devin](https://devin.ai)

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
*.live.test.ts is already excluded from the default vitest config and no
workflow runs test:live, so these are opt-in regression checks a human runs
with a real key to prove a change did not break a live model's ability to
drive a harness:

- examples/harnesses.live.test.ts: createAgent tool call, approval
  pause/resume, deep-research fan-out + citations, support-desk handoff to
  billing with a gated refund, evaluator-loop through llmCritique,
  data-analyst read-only SQL - all on openrouter/openai/gpt-4o-mini
- registry/kits.live.test.ts: inbox-triage and incident-response loaded
  through loadAgentDir() exactly as installed kits, state isolated via the
  kits' own env-var homes
- vitest.live.config.ts include widened to examples/ + registry/
- .env.example documents the key

Generated with [Devin](https://devin.ai)

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
deployDependencies() pinned @lousho/build-ai-agent to the exact local
package version; a scaffold built from an unpublished dev version
(1.0.0-alpha.4) made the image's `npm install --omit=dev` fail with
ETARGET. Emit `^version` instead, the same convention sync-version.mjs
uses for the create-lousho-agent pin, so an in-development build resolves
to the nearest published release.

Generated with [Devin](https://devin.ai)

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
… docs

Generated with [Devin](https://devin.ai)

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
- extract toolOutcomeMessage() so normal + handoff paths share the
  tool-result transcript shape (undefined -> null, error payloads,
  replacedByHook metadata)
- share the resumed-hook context builder across resume paths
- validateConfig: OPERAND_KIND dispatch + operand/store/rule helpers;
  numeric comparisons via a table (fail-closed semantics unchanged)
- loadAgentDir: split assembleConfig (null-override semantics preserved)
- createAgent: extract resumeRequester/agentSession factories and the
  runLevelOptions/subagent-options/approval-store/clash helpers
- ignore examples/** for duplication (standalone demos, like kits)
- unexport handoffRun internals only used in-file

Generated with [Devin](https://devin.ai)

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Internal working docs (docs/plan, docs/research, .design-ref) are not
user-facing; drop them and the README link to the validation report.

Generated with [Devin](https://devin.ai)

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
- Live OpenRouter run re-recorded the provider/execution cassettes;
  replay tests still pass (verified).
- piProvider live test: gpt-4o-mini was replace_all-ing the identical
  add/subtract bodies and then looping on read_file line-number
  prefixes; instructions now require unique-context old_string, forbid
  replace_all, warn about the line-number prefixes, and maxSteps 10->14.
- lockfile: create-lousho-agent template dep synced to ^1.0.0-alpha.4.

Generated with [Devin](https://devin.ai)

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Vitest only exposes .env on import.meta.env, so live tests' skipIf(
process.env.OPENROUTER_API_KEY) checks skipped even with a populated
.env. loadEnv() in the live config merges it, as the comment promised.

Generated with [Devin](https://devin.ai)

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
The registry table still said seven items and the changelog's install
flags named network,env while both kits' manifests declare env +
filesystem: write. README's example table now lists the four new
archetype examples and plan-mode.

Generated with [Devin](https://devin.ai)

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
docs-links.test.ts requires every README example link to resolve to a
non-empty README.md. The two missing example READMEs also feed
llms-full.txt, which is shipped in the tarball; with them the packed
size crossed the 4.5 MiB budget by ~11 KB, so it goes to 4.6 MiB (the
unpacked budget was already raised the same way in 4070302).

Generated with [Devin](https://devin.ai)

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
The check gate regenerates both files; llms-full.txt was committed but
llms.txt was missed.

Generated with [Devin](https://devin.ai)

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
@LinuxDevil LinuxDevil self-assigned this Oct 6, 2026
@LinuxDevil
LinuxDevil merged commit 2cfc1be into main Oct 6, 2026
9 checks passed
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.

1 participant