Skip to content

Add Tool Source Economy v1 - #34

Merged
likun666661 merged 1 commit into
apache:mainfrom
likun666661:deepseek-tool-source-economy-v1
Jun 17, 2026
Merged

Add Tool Source Economy v1#34
likun666661 merged 1 commit into
apache:mainfrom
likun666661:deepseek-tool-source-economy-v1

Conversation

@likun666661

Copy link
Copy Markdown
Member

Summary

  • add opt-in runtime Tool Source Economy mode with session-local source enablement
  • add permission-free connect_tool_source connector for later-request tool expansion
  • thread source-economy diagnostics through request shape, run trace, and usage telemetry while preserving top-level prefix reason compatibility
  • tag builtin tools into core/files.write/shell source groups and add focused backend tests

Verification

  • npm run build --workspace packages/core
  • npm run typecheck --workspace packages/runtime
  • npm run test --workspace packages/runtime (497/497)
  • git diff --check

Rive/Codex workflow: wfrun_4822ebad192c4409a8c5f73926a057b3, scheduler sched_a9d3856787f04c4b8b3e0be180938e53. Post-review patch fixed the final reviewer blocker around top-level prefix reason compatibility.

@likun666661
likun666661 merged commit b7c58c9 into apache:main Jun 17, 2026
Astro-Han added a commit that referenced this pull request Jun 17, 2026
…mantics

PR #30's P2 #3 redefines promptSegment.toolCount as the model-visible
(active) tool count, not the full providerTools registry (which includes
the invalid fallback plus any deferred-unloaded / economy-hidden schemas
that never reach the wire). After rebasing onto Tool Source Economy
(PR #34), three economy tests still asserted the old providerTools.length
values; update them to the active counts, which now equal
modelToolNames().length in each case.
Astro-Han added a commit that referenced this pull request Jun 17, 2026
…o ToolAvailabilityRuntime

Collapse the two parallel tool-visibility mechanisms — PR #30 deferred tool
loading and PR #34 tool source economy — into one mechanism and one policy
(issue #37):

- One `economy` switch + configurable `coreToolNames`; grouping comes from
  `ToolAvailabilityConfig.groups`, not the per-tool `exposure` tag (removed
  from MakaTool). The now-dead `toolSource` tag is swept separately next.
- One `load_tools` connector, built by the runtime. The historical `load_tool`
  (PR #30) and `connect_tool_source` (PR #34) calls are accepted only as
  durable ledger-seeding aliases, never advertised as provider-visible tools.
- One same-turn activation policy (prepareStep + execute-boundary gating);
  the next-request economy semantics are dropped.
- Delete tool-source-economy.ts, deferred-activation.ts, load-tool.ts and
  their tests; add tool-availability.ts + tool-availability.test.ts.
- Rename ToolSourceEconomyDiagnostic → ToolAvailabilityDiagnostic (record
  field toolSourceEconomy → toolAvailability) while keeping the historical
  *SourceIds shell vocabulary (a "source" id is a catalog group id).
- Wire main.ts through a single ToolAvailabilityConfig
  (economy = !MAKA_DISABLE_DEFERRED_TOOLS; groups = rive/office/browser); the
  runtime now produces the connector, so builtinTools no longer include it.
Astro-Han added a commit that referenced this pull request Jun 17, 2026
…o ToolAvailabilityRuntime

Collapse the two parallel tool-visibility mechanisms — PR #30 deferred tool
loading and PR #34 tool source economy — into one mechanism and one policy
(issue #37):

- One `economy` switch + configurable `coreToolNames`; grouping comes from
  `ToolAvailabilityConfig.groups`, not the per-tool `exposure` tag (removed
  from MakaTool). The now-dead `toolSource` tag is swept separately next.
- One `load_tools` connector, built by the runtime. Same-turn activation honors
  only `load_tools` (and only its `group` arg). The historical `load_tool`
  (PR #30) and `connect_tool_source` (PR #34) names are accepted solely when
  re-seeding prior-turn activations from the durable ledger — never advertised,
  never live in the current turn.
- One same-turn activation policy (prepareStep + execute-boundary gating);
  the next-request economy semantics are dropped.
- Delete tool-source-economy.ts, deferred-activation.ts, load-tool.ts and
  their tests; add tool-availability.ts + tool-availability.test.ts.
- Rename ToolSourceEconomyDiagnostic → ToolAvailabilityDiagnostic (record
  field toolSourceEconomy → toolAvailability) while keeping the historical
  *SourceIds shell vocabulary (a "source" id is a catalog group id).
- Wire main.ts through a single ToolAvailabilityConfig
  (economy = !MAKA_DISABLE_DEFERRED_TOOLS; groups = rive/office/browser); the
  runtime now produces the connector, so builtinTools no longer include it.
Astro-Han added a commit that referenced this pull request Jun 17, 2026
Recognize the unified `load_tools` connector (and the historical `load_tool`,
PR #30 — it shipped and returns the same `{ loaded: [...] }` shape) for the
localized "Load tools" card, reading the loaded group id from `group` with a
`namespace` fallback so replayed pre-unification sessions still render.

`connect_tool_source` (PR #34) is deliberately not presented: it never shipped,
so no such result exists, and its `{ tools: [...] }` shape differs from this
card's `{ loaded: [...] }`. The runtime still seeds from it for the durable
ledger (a separate concern that reads call args, not results).
Astro-Han added a commit that referenced this pull request Jun 17, 2026
…o ToolAvailabilityRuntime

Collapse the two parallel tool-visibility mechanisms — PR #30 deferred tool
loading and PR #34 tool source economy — into one mechanism and one policy
(issue #37):

- One `economy` switch + configurable `coreToolNames`; grouping comes from
  `ToolAvailabilityConfig.groups`, not the per-tool `exposure` tag (removed
  from MakaTool). The now-dead `toolSource` tag is swept separately next.
- One `load_tools` connector, built by the runtime. Same-turn activation honors
  only `load_tools` (and only its `group` arg). The historical `load_tool`
  (PR #30) and `connect_tool_source` (PR #34) names are accepted solely when
  re-seeding prior-turn activations from the durable ledger — never advertised,
  never live in the current turn.
- One same-turn activation policy (prepareStep + execute-boundary gating);
  the next-request economy semantics are dropped.
- Delete tool-source-economy.ts, deferred-activation.ts, load-tool.ts and
  their tests; add tool-availability.ts + tool-availability.test.ts.
- Rename ToolSourceEconomyDiagnostic → ToolAvailabilityDiagnostic (record
  field toolSourceEconomy → toolAvailability) while keeping the historical
  *SourceIds shell vocabulary (a "source" id is a catalog group id).
- Wire main.ts through a single ToolAvailabilityConfig
  (economy = !MAKA_DISABLE_DEFERRED_TOOLS; groups = rive/office/browser); the
  runtime now produces the connector, so builtinTools no longer include it.
Astro-Han added a commit that referenced this pull request Jun 17, 2026
Recognize the unified `load_tools` connector (and the historical `load_tool`,
PR #30 — it shipped and returns the same `{ loaded: [...] }` shape) for the
localized "Load tools" card, reading the loaded group id from `group` with a
`namespace` fallback so replayed pre-unification sessions still render.

`connect_tool_source` (PR #34) is deliberately not presented: it never shipped,
so no such result exists, and its `{ tools: [...] }` shape differs from this
card's `{ loaded: [...] }`. The runtime still seeds from it for the durable
ledger (a separate concern that reads call args, not results).
Astro-Han added a commit that referenced this pull request Jun 17, 2026
…o ToolAvailabilityRuntime

Collapse the two parallel tool-visibility mechanisms — PR #30 deferred tool
loading and PR #34 tool source economy — into one mechanism and one policy
(issue #37):

- One `economy` switch + configurable `coreToolNames`; grouping comes from
  `ToolAvailabilityConfig.groups`, not the per-tool `exposure` tag (removed
  from MakaTool). The now-dead `toolSource` tag is swept separately next.
- One `load_tools` connector, built by the runtime. Same-turn activation honors
  only `load_tools` (and only its `group` arg). The historical `load_tool`
  (PR #30) and `connect_tool_source` (PR #34) names are accepted solely when
  re-seeding prior-turn activations from the durable ledger — never advertised,
  never live in the current turn.
- One same-turn activation policy (prepareStep + execute-boundary gating);
  the next-request economy semantics are dropped.
- Delete tool-source-economy.ts, deferred-activation.ts, load-tool.ts and
  their tests; add tool-availability.ts + tool-availability.test.ts.
- Rename ToolSourceEconomyDiagnostic → ToolAvailabilityDiagnostic (record
  field toolSourceEconomy → toolAvailability) while keeping the historical
  *SourceIds shell vocabulary (a "source" id is a catalog group id).
- Wire main.ts through a single ToolAvailabilityConfig
  (economy = !MAKA_DISABLE_DEFERRED_TOOLS; groups = rive/office/browser); the
  runtime now produces the connector, so builtinTools no longer include it.
Astro-Han added a commit that referenced this pull request Jun 17, 2026
Recognize the unified `load_tools` connector (and the historical `load_tool`,
PR #30 — it shipped and returns the same `{ loaded: [...] }` shape) for the
localized "Load tools" card, reading the loaded group id from `group` with a
`namespace` fallback so replayed pre-unification sessions still render.

`connect_tool_source` (PR #34) is deliberately not presented: it never shipped,
so no such result exists, and its `{ tools: [...] }` shape differs from this
card's `{ loaded: [...] }`. The runtime still seeds from it for the durable
ledger (a separate concern that reads call args, not results).
jackwener pushed a commit that referenced this pull request Jun 21, 2026
jackwener pushed a commit that referenced this pull request Jun 21, 2026
…mantics

PR #30's P2 #3 redefines promptSegment.toolCount as the model-visible
(active) tool count, not the full providerTools registry (which includes
the invalid fallback plus any deferred-unloaded / economy-hidden schemas
that never reach the wire). After rebasing onto Tool Source Economy
(PR #34), three economy tests still asserted the old providerTools.length
values; update them to the active counts, which now equal
modelToolNames().length in each case.
jackwener pushed a commit that referenced this pull request Jun 21, 2026
…o ToolAvailabilityRuntime

Collapse the two parallel tool-visibility mechanisms — PR #30 deferred tool
loading and PR #34 tool source economy — into one mechanism and one policy
(issue #37):

- One `economy` switch + configurable `coreToolNames`; grouping comes from
  `ToolAvailabilityConfig.groups`, not the per-tool `exposure` tag (removed
  from MakaTool). The now-dead `toolSource` tag is swept separately next.
- One `load_tools` connector, built by the runtime. Same-turn activation honors
  only `load_tools` (and only its `group` arg). The historical `load_tool`
  (PR #30) and `connect_tool_source` (PR #34) names are accepted solely when
  re-seeding prior-turn activations from the durable ledger — never advertised,
  never live in the current turn.
- One same-turn activation policy (prepareStep + execute-boundary gating);
  the next-request economy semantics are dropped.
- Delete tool-source-economy.ts, deferred-activation.ts, load-tool.ts and
  their tests; add tool-availability.ts + tool-availability.test.ts.
- Rename ToolSourceEconomyDiagnostic → ToolAvailabilityDiagnostic (record
  field toolSourceEconomy → toolAvailability) while keeping the historical
  *SourceIds shell vocabulary (a "source" id is a catalog group id).
- Wire main.ts through a single ToolAvailabilityConfig
  (economy = !MAKA_DISABLE_DEFERRED_TOOLS; groups = rive/office/browser); the
  runtime now produces the connector, so builtinTools no longer include it.
jackwener pushed a commit that referenced this pull request Jun 21, 2026
Recognize the unified `load_tools` connector (and the historical `load_tool`,
PR #30 — it shipped and returns the same `{ loaded: [...] }` shape) for the
localized "Load tools" card, reading the loaded group id from `group` with a
`namespace` fallback so replayed pre-unification sessions still render.

`connect_tool_source` (PR #34) is deliberately not presented: it never shipped,
so no such result exists, and its `{ tools: [...] }` shape differs from this
card's `{ loaded: [...] }`. The runtime still seeds from it for the durable
ledger (a separate concern that reads call args, not results).
jackwener pushed a commit that referenced this pull request Jun 21, 2026
jackwener pushed a commit that referenced this pull request Jun 21, 2026
jackwener pushed a commit that referenced this pull request Jun 21, 2026
…mantics

PR #30's P2 #3 redefines promptSegment.toolCount as the model-visible
(active) tool count, not the full providerTools registry (which includes
the invalid fallback plus any deferred-unloaded / economy-hidden schemas
that never reach the wire). After rebasing onto Tool Source Economy
(PR #34), three economy tests still asserted the old providerTools.length
values; update them to the active counts, which now equal
modelToolNames().length in each case.
jackwener pushed a commit that referenced this pull request Jun 21, 2026
…o ToolAvailabilityRuntime

Collapse the two parallel tool-visibility mechanisms — PR #30 deferred tool
loading and PR #34 tool source economy — into one mechanism and one policy
(issue #37):

- One `economy` switch + configurable `coreToolNames`; grouping comes from
  `ToolAvailabilityConfig.groups`, not the per-tool `exposure` tag (removed
  from MakaTool). The now-dead `toolSource` tag is swept separately next.
- One `load_tools` connector, built by the runtime. Same-turn activation honors
  only `load_tools` (and only its `group` arg). The historical `load_tool`
  (PR #30) and `connect_tool_source` (PR #34) names are accepted solely when
  re-seeding prior-turn activations from the durable ledger — never advertised,
  never live in the current turn.
- One same-turn activation policy (prepareStep + execute-boundary gating);
  the next-request economy semantics are dropped.
- Delete tool-source-economy.ts, deferred-activation.ts, load-tool.ts and
  their tests; add tool-availability.ts + tool-availability.test.ts.
- Rename ToolSourceEconomyDiagnostic → ToolAvailabilityDiagnostic (record
  field toolSourceEconomy → toolAvailability) while keeping the historical
  *SourceIds shell vocabulary (a "source" id is a catalog group id).
- Wire main.ts through a single ToolAvailabilityConfig
  (economy = !MAKA_DISABLE_DEFERRED_TOOLS; groups = rive/office/browser); the
  runtime now produces the connector, so builtinTools no longer include it.
jackwener pushed a commit that referenced this pull request Jun 21, 2026
Recognize the unified `load_tools` connector (and the historical `load_tool`,
PR #30 — it shipped and returns the same `{ loaded: [...] }` shape) for the
localized "Load tools" card, reading the loaded group id from `group` with a
`namespace` fallback so replayed pre-unification sessions still render.

`connect_tool_source` (PR #34) is deliberately not presented: it never shipped,
so no such result exists, and its `{ tools: [...] }` shape differs from this
card's `{ loaded: [...] }`. The runtime still seeds from it for the durable
ledger (a separate concern that reads call args, not results).
jackwener pushed a commit that referenced this pull request Jun 21, 2026
jackwener pushed a commit that referenced this pull request Jun 21, 2026
…mantics

PR #30's P2 #3 redefines promptSegment.toolCount as the model-visible
(active) tool count, not the full providerTools registry (which includes
the invalid fallback plus any deferred-unloaded / economy-hidden schemas
that never reach the wire). After rebasing onto Tool Source Economy
(PR #34), three economy tests still asserted the old providerTools.length
values; update them to the active counts, which now equal
modelToolNames().length in each case.
jackwener pushed a commit that referenced this pull request Jun 21, 2026
…o ToolAvailabilityRuntime

Collapse the two parallel tool-visibility mechanisms — PR #30 deferred tool
loading and PR #34 tool source economy — into one mechanism and one policy
(issue #37):

- One `economy` switch + configurable `coreToolNames`; grouping comes from
  `ToolAvailabilityConfig.groups`, not the per-tool `exposure` tag (removed
  from MakaTool). The now-dead `toolSource` tag is swept separately next.
- One `load_tools` connector, built by the runtime. Same-turn activation honors
  only `load_tools` (and only its `group` arg). The historical `load_tool`
  (PR #30) and `connect_tool_source` (PR #34) names are accepted solely when
  re-seeding prior-turn activations from the durable ledger — never advertised,
  never live in the current turn.
- One same-turn activation policy (prepareStep + execute-boundary gating);
  the next-request economy semantics are dropped.
- Delete tool-source-economy.ts, deferred-activation.ts, load-tool.ts and
  their tests; add tool-availability.ts + tool-availability.test.ts.
- Rename ToolSourceEconomyDiagnostic → ToolAvailabilityDiagnostic (record
  field toolSourceEconomy → toolAvailability) while keeping the historical
  *SourceIds shell vocabulary (a "source" id is a catalog group id).
- Wire main.ts through a single ToolAvailabilityConfig
  (economy = !MAKA_DISABLE_DEFERRED_TOOLS; groups = rive/office/browser); the
  runtime now produces the connector, so builtinTools no longer include it.
jackwener pushed a commit that referenced this pull request Jun 21, 2026
Recognize the unified `load_tools` connector (and the historical `load_tool`,
PR #30 — it shipped and returns the same `{ loaded: [...] }` shape) for the
localized "Load tools" card, reading the loaded group id from `group` with a
`namespace` fallback so replayed pre-unification sessions still render.

`connect_tool_source` (PR #34) is deliberately not presented: it never shipped,
so no such result exists, and its `{ tools: [...] }` shape differs from this
card's `{ loaded: [...] }`. The runtime still seeds from it for the durable
ledger (a separate concern that reads call args, not results).
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