Skip to content

build(exports): register ./analyst-loop subpath#351

Merged
drewstone merged 2 commits into
mainfrom
fix/analyst-loop-export-subpath
Jun 21, 2026
Merged

build(exports): register ./analyst-loop subpath#351
drewstone merged 2 commits into
mainfrom
fix/analyst-loop-export-subpath

Conversation

@drewstone

Copy link
Copy Markdown
Contributor

runAnalystLoop is exported from src/analyst-loop/index.ts, and the examples/self-improving-loop README + code document importing it from @tangle-network/agent-runtime/analyst-loop as the production analyst path. But that subpath was missing from package.json exports and the tsup entry list, so it does not resolve in a published install — import { runAnalystLoop } from '@tangle-network/agent-runtime/analyst-loop' throws ERR_PACKAGE_PATH_NOT_EXPORTED.

Change

  • Add 'analyst-loop': 'src/analyst-loop/index.ts' to the tsup entry map.
  • Add the ./analyst-loop block to package.json exports.

Verified

Clean pnpm install (agent-eval 0.95.0) + pnpm build: ESM + DTS build success, emits dist/analyst-loop.js and dist/analyst-loop.d.ts (2.83 KB). import('./dist/analyst-loop.js')runAnalystLoop is a function.

Surfaced while re-auditing the substrate-adoption skills, which cite this subpath.

runAnalystLoop is exported from src/analyst-loop/index.ts and the self-improving-loop example documents importing it from @tangle-network/agent-runtime/analyst-loop, but the subpath was absent from package.json exports + the tsup entry list, so it did not resolve in a published install. Add the tsup entry + exports map entry; build emits dist/analyst-loop.{js,d.ts}.
tangletools
tangletools previously approved these changes Jun 21, 2026

@tangletools tangletools 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.

✅ Auto-approved PR — 1dd50d9c

Blanket team auto-approval is enabled for this reviewer service.
The full PR reviewer audit still runs separately and will publish findings if it detects issues.

tangletools · auto-approval · reason: blanket_auto_approve · 2026-06-21T14:33:00Z

@tangletools tangletools 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.

🟡 Value Audit — sound-with-nits

Verdict sound-with-nits
Concerns 2 (2 weak-concern)
Heuristic 0.0s
Duplication 0.0s
Interrogation 108.5s (2 bridge agents)
Total 108.5s

💰 Value — sound

Fixes a package export omission: the documented public subpath @tangle-network/agent-runtime/analyst-loop now actually resolves by adding the matching tsup entry and package.json exports block.

  • What it does: Adds 'analyst-loop': 'src/analyst-loop/index.ts' to tsup.config.ts entry map (tsup.config.ts:9) and registers a ./analyst-loop exports block in package.json pointing to dist/analyst-loop.{js,d.ts} (package.json:37-41). This causes the build to emit dist/analyst-loop.js + .d.ts and makes the subpath importable from a published install.
  • Goals it achieves: Closes the gap between the public API surface already advertised in README.md:236 and examples/self-improving-loop/self-improving-loop.ts:124 and the actual published package, so consumers can import runAnalystLoop and its types from @tangle-network/agent-runtime/analyst-loop without ERR_PACKAGE_PATH_NOT_EXPORTED.
  • Assessment: Good. The change is minimal, follows the exact same types/import/default shape already used by ./loops, ./profiles, and ./mcp (package.json:22-51), and only repairs an existing documented subpath rather than inventing a new one. It matches the source layout (src/analyst-loop/index.ts) and the existing tsup entry naming convention.
  • Better / existing approach: none — this is the right approach. The codebase already uses this subpath export pattern for every public module; there is no existing ./analyst-loop export to reuse. I checked package.json, tsup.config.ts, src/analyst-loop/index.ts, README.md:236, and examples/self-improving-loop/self-improving-loop.ts:124. docs/simplification-plan.md:91 mentions a future intent to internalize `anal
  • Model: opencode/kimi-for-coding/k2p7
  • Bridge attempts: 1

🎯 Usefulness — sound-with-nits

Correct bug fix — wires a documented-but-unresolvable public subpath into tsup + exports so the analyst loop is actually consumable from a published install.

  • Integration: Reachable and used. Source exists at src/analyst-loop/index.ts:12 exporting runAnalystLoop. Internal caller at src/loop-runner.ts:29 uses a relative path (works regardless). External/docs callers depend on the public subpath: examples/self-improving-loop/README.md:107 documents @tangle-network/agent-runtime/analyst-loop runAnalystLoop as the production analyst substrate; README.md:236 referenc
  • Fit with existing patterns: Follows the established pattern exactly. Every other tsup entry (agent, intelligence, loops, profiles, mcp) has a matching block in package.json exports; analyst-loop was the lone gap. Block shape (types/import/default) matches the neighboring ./loops block at package.json:32-36 verbatim. No competing pattern.
  • Real-world viability: Pure config wiring — no runtime behavior change, no concurrency surface, no error paths introduced. Holds up because the only thing it does is make the existing built module resolvable; the dist files already build. PR body's import smoke test is the right verification.
  • Model: opencode/zai-coding-plan/glm-5.2
  • Bridge attempts: 1

🎯 Usefulness Audit

🟡 Tension with simplification-plan's INTERNALIZE direction [problem-fit] ``

docs/simplification-plan.md:91 and :106 explicitly list ./analyst-loop (and the 4-file module) as INTERNALIZE — 'analyze is internal (auto-on-settle)'. That plan is unimplemented and the current docs/README/examples treat the subpath as public, so this PR matches present intent — but a human may want to decide whether exposing it more firmly as public (vs. just fixing the gap quietly) is consistent with where the codebase is heading. Not a blocker.

🟡 Not added to verify-package-exports.mjs regression guard [robustness] ``

scripts/verify-package-exports.mjs:29-36 enumerates requiredExports (., ./agent, ./intelligence, ./loops, ./profiles, ./mcp) and asserts each resolves in a packed tarball — but not ./analyst-loop. The very gap this PR fixes would have been caught by that script had the subpath been listed. Adding './analyst-loop': ['import', 'types'] would prevent the same regression later. Small, optional improvement.


What this audit checks

It judges the change on its merits — not whether it was tasked out in an issue. Unticketed, fast-moving work is fine; the question is whether the change is good and whether a better or existing approach should be used instead.

Pass What it asks
Heuristic Vague title? Whitespace-only or cruft-bearing diff? (content signals only)
Duplication Do added function/class names already exist elsewhere in the repo?
Value Audit What does it do? What goal does it achieve? Is it good? Better architecture or already-exists?
Usefulness Audit Does it integrate and fit? Will it hold up in real use and actually get used?

Findings are concerns, not blocks — the human reviewer decides what to do with them.

value-audit · 20260621T143941Z

@tangletools

Copy link
Copy Markdown
Contributor

✅ No Blockers — 1dd50d9c

Readiness 85/100 · Confidence 70/100 · 1 finding (1 low)

deepseek glm aggregate
Readiness 85 92 85
Confidence 70 70 70
Correctness 85 92 85
Security 85 92 85
Testing 85 92 85
Architecture 85 92 85

Full multi-shot audit completed 2/2 planned shots over 2 changed files. Global verifier still owns final merge decision. | Full multi-shot audit completed 2/2 planned shots over 2 changed files. Global verifier still owns final merge decision.

🟡 LOW verify-package-exports gate does not cover the new ./analyst-loop export — package.json

scripts/verify-package-exports.mjs:29-36 enumerates requiredExports for ., ./agent, ./intelligence, ./loops, ./profiles, ./mcp but not the newly added ./analyst-loop (package.json:37-41). Impact: if a future change drops the tsup entry or the export target, the pack/import smoke test will not catch it for this subpath. Fix: add './analyst-loop': ['import', 'types'] to the requiredExports map in scripts/verify-package-exports.mjs. Note: that file is outside this shot's scope, so this is a recommendation for the PR author, not a blocking issue for package.json itself.


tangletools · 2026-06-21T14:40:00Z · trace

…oser-rename drift

Adds src/analyst-loop/index.ts to typedoc entryPoints so the new ./analyst-loop subpath generates an API page and its symbols are gated. Regenerates docs/api and refreshes docs/canonical-api.md (version 0.69.0->0.70.0, agent-eval pin >=0.93->>=0.95, gepaDriver->gepaProposer) — pre-existing drift from the 0.70.0 Proposer-rename release that left the docs gate red on main.

@tangletools tangletools 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.

✅ Auto-approved PR — 9c5d68c6

Blanket team auto-approval is enabled for this reviewer service.
The full PR reviewer audit still runs separately and will publish findings if it detects issues.

tangletools · auto-approval · reason: blanket_auto_approve · 2026-06-21T14:41:21Z

@drewstone drewstone merged commit 4511530 into main Jun 21, 2026
1 check 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.

2 participants