Skip to content

feat(ai): add agent/structured-call forced-tool LLM call primitive - #28

Merged
Peefy merged 2 commits into
mainfrom
feat/ai-structured-call
Sep 1, 2026
Merged

feat(ai): add agent/structured-call forced-tool LLM call primitive#28
Peefy merged 2 commits into
mainfrom
feat/ai-structured-call

Conversation

@Peefy

@Peefy Peefy commented Sep 1, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Add agent/structured-call subpath to @melandlabs/ai: executeStructuredCall, a single forced-tool LLM call primitive speaking the Anthropic Messages wire format over native fetch (no SDK, no retry), generalized from alloomi's digital-employee planner
  • Ship the wire-tolerance helpers as standalone exports: extractToolUseInput (text-embedded JSON fallback, multi-tool_use tolerance), findShapedObject (parameterized findPlanShape), extractBalancedJsonObject (brace-balanced scan that ignores braces inside string literals)
  • Register in tsup entry, package.json exports (./agent/structured-call + /index), and the root barrel (NOT in the agent barrel, per the NOTE in src/agent/index.ts)
  • Include a patch changeset; also ignore macOS .DS_Store

Test plan

  • pnpm test — 99 tests pass, incl. 18 client cases (success tool_use with URL/headers/body assertions, text JSON fallback, multi-tool_use first+warn, name mismatch, no_tool_use, 402/500 http_error, network/timeout/aborted classification, decode_error, provider/thinking toggles, headers override, fetchImpl injection)
  • pnpm tsc / pnpm -r build — all packages green
  • pnpm format / pnpm lint:fix — clean
  • Dist smoke test via node --input-type=module against dist/agent/structured-call/index.js (fake fetchImpl, asserted ok:true, source:"tool_use" and body fields)

🤖 Generated with Claude Code

Peefy and others added 2 commits September 1, 2026 11:00
Single Messages round-trip with tool_choice pinned to one tool, over
native fetch (no SDK, no retry), generalized from alloomi's
digital-employee planner. Ships the wire-tolerance helpers
extractToolUseInput / findShapedObject / extractBalancedJsonObject as
standalone exports, registered under the
`@melandlabs/ai/agent/structured-call` subpath plus the root barrel.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@Peefy
Peefy merged commit c1b74ce into main Sep 1, 2026
13 checks passed
@Peefy
Peefy deleted the feat/ai-structured-call branch September 2, 2026 03:24
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