[PR #7369] [MERGED] feat(capability): expose Decision model evaluation to packages (#7368) #7703

Closed
opened 2026-10-24 04:06:40 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Pasta-Devs/Marinara-Engine/pull/7369
Author: @Gunterlie
Created: 10/9/2026
Status: ✅ Merged
Merged: 10/9/2026
Merged by: @Gunterlie

Base: staging ← Head: feat/capability-decisions-7368


📝 Commits (5)

  • c433d39 feat(capability): expose Decision model evaluation to packages (#7368)
  • 66503cf docs(capability): document decisions host in the Decision section
  • d21a308 fix(capability): null on no answer, bound message names, runnable docs example
  • 851e03a fix(capability): reject unsupported Decision message roles
  • 8d92821 Merge remote-tracking branch 'origin/staging' into feat/capability-decisions-7368

📊 Changes

6 files changed (+267 additions, -2 deletions)

View changed files

📝 CHANGELOG.md (+1 -0)
📝 docs/development/optional-agent-packages.md (+26 -2)
➕ packages/server/src/services/capability-packages/capability-decision.service.ts (+112 -0)
📝 packages/server/src/services/capability-packages/capability-module-runtime.service.ts (+2 -0)
📝 packages/shared/src/types/capability-runtime.ts (+40 -0)
➕ scripts/regressions/capability-decisions.regression.ts (+86 -0)

📄 Description

Closes #7368

Why

Downloadable Agent and capability packages had no supported way to ask the user's Decision model a question about their own context. Activation questions and prompt conditionals only see Engine-managed chat context, so a package author (Discord request from DSBwizzard) would have had to import Engine internals or rebuild the Decision stack, credentials included.

What

  • CapabilityRuntimeHost.decisions?.evaluate({ messages, questions, signal?, debugMode? }) in @marinara-engine/shared.
    • Yes/no questions return a probability; Choice questions (options) return the chosen option or "none of these".
    • Returns the model's own threshold, since probabilities are not comparable across Decision models.
    • Resolves null when no Decision model is configured or it cannot be reached.
  • Server host (capability-decision.service.ts) reuses resolveDecisionBackend + buildDecisionState, so every backend works (managed sidecar, local chat slot, System One / chat-logprobs connections) and no keys reach the package.
  • Trust-boundary validation: unique ids without NUL, 1–500-char questions, ≥2 options, ≤200 messages / 200k chars, and the request's answer count is capped by the user's Decision statements per turn limit (cost control on hosted connections).
  • Optional field, feature-detected like integrations.speech — no capability API bump, no new permission (same as languageModels).
  • Honors UI debugMode and DEBUG_AGENTS for prompt logging.
  • Docs: docs/development/optional-agent-packages.md Decision section (replaces the stale "no way to ask the Decision model directly yet" line). CHANGELOG entry.

Validation

  • pnpm check passes.
  • New regression scripts/regressions/capability-decisions.regression.ts (request mapping, result shape, null with no model, rejection of invalid requests before any model call) passes.
  • Local CodeRabbit: 1 finding (stale docs line contradicting the new API) — fixed in 66503cf2d.

Manual verification

  • With a Decision model configured, call api.runtime.decisions.evaluate(...) from a sideloaded package and check yes/no and Choice answers.
  • With no Decision model configured, check that it resolves null.
  • With Debug mode on, check the Decision prompt appears in the server log.

Translated docs follow-up: #7370

Summary by CodeRabbit

  • New Features
    • Optional package server code can ask the selected Decision model yes/no and choice questions about supplied context. Results include answer probabilities, selected choices, and the model’s threshold.
    • Requests are subject to limits on context, question and option formats, and Decision statements per turn. Evaluation returns no result if a Decision model is unavailable or provides no answers; invalid requests produce an error.
  • Documentation
    • Added guidance on using Decision evaluation in optional package server code.

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/Pasta-Devs/Marinara-Engine/pull/7369 **Author:** [@Gunterlie](https://github.com/Gunterlie) **Created:** 10/9/2026 **Status:** ✅ Merged **Merged:** 10/9/2026 **Merged by:** [@Gunterlie](https://github.com/Gunterlie) **Base:** `staging` ← **Head:** `feat/capability-decisions-7368` --- ### 📝 Commits (5) - [`c433d39`](https://github.com/Pasta-Devs/Marinara-Engine/commit/c433d3929ff8368655f6c6a79ab206ecb03778e0) feat(capability): expose Decision model evaluation to packages (#7368) - [`66503cf`](https://github.com/Pasta-Devs/Marinara-Engine/commit/66503cf2d34cb94fed46b325193a401d15b1b211) docs(capability): document decisions host in the Decision section - [`d21a308`](https://github.com/Pasta-Devs/Marinara-Engine/commit/d21a308b54bddab3fd603bcdfa8905be988dfa6e) fix(capability): null on no answer, bound message names, runnable docs example - [`851e03a`](https://github.com/Pasta-Devs/Marinara-Engine/commit/851e03a6708634e076f2c3006370c4b708d9ffab) fix(capability): reject unsupported Decision message roles - [`8d92821`](https://github.com/Pasta-Devs/Marinara-Engine/commit/8d92821462dc42287a61c616a5f4cb8994466c7a) Merge remote-tracking branch 'origin/staging' into feat/capability-decisions-7368 ### 📊 Changes **6 files changed** (+267 additions, -2 deletions) <details> <summary>View changed files</summary> 📝 `CHANGELOG.md` (+1 -0) 📝 `docs/development/optional-agent-packages.md` (+26 -2) ➕ `packages/server/src/services/capability-packages/capability-decision.service.ts` (+112 -0) 📝 `packages/server/src/services/capability-packages/capability-module-runtime.service.ts` (+2 -0) 📝 `packages/shared/src/types/capability-runtime.ts` (+40 -0) ➕ `scripts/regressions/capability-decisions.regression.ts` (+86 -0) </details> ### 📄 Description Closes #7368 ## Why Downloadable Agent and capability packages had no supported way to ask the user's Decision model a question about **their own** context. Activation questions and prompt conditionals only see Engine-managed chat context, so a package author (Discord request from DSBwizzard) would have had to import Engine internals or rebuild the Decision stack, credentials included. ## What - `CapabilityRuntimeHost.decisions?.evaluate({ messages, questions, signal?, debugMode? })` in `@marinara-engine/shared`. - Yes/no questions return a probability; Choice questions (`options`) return the chosen option or `"none of these"`. - Returns the model's own `threshold`, since probabilities are not comparable across Decision models. - Resolves `null` when no Decision model is configured or it cannot be reached. - Server host (`capability-decision.service.ts`) reuses `resolveDecisionBackend` + `buildDecisionState`, so every backend works (managed sidecar, local chat slot, System One / chat-logprobs connections) and no keys reach the package. - Trust-boundary validation: unique ids without NUL, 1–500-char questions, ≥2 options, ≤200 messages / 200k chars, and the request's answer count is capped by the user's **Decision statements per turn** limit (cost control on hosted connections). - Optional field, feature-detected like `integrations.speech` — no capability API bump, no new permission (same as `languageModels`). - Honors UI `debugMode` and `DEBUG_AGENTS` for prompt logging. - Docs: `docs/development/optional-agent-packages.md` Decision section (replaces the stale "no way to ask the Decision model directly yet" line). CHANGELOG entry. ## Validation - `pnpm check` passes. - New regression `scripts/regressions/capability-decisions.regression.ts` (request mapping, result shape, `null` with no model, rejection of invalid requests before any model call) passes. - Local CodeRabbit: 1 finding (stale docs line contradicting the new API) — fixed in 66503cf2d. ## Manual verification - [ ] With a Decision model configured, call `api.runtime.decisions.evaluate(...)` from a sideloaded package and check yes/no and Choice answers. - [ ] With no Decision model configured, check that it resolves `null`. - [ ] With Debug mode on, check the Decision prompt appears in the server log. Translated docs follow-up: #7370 <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * Optional package server code can ask the selected Decision model yes/no and choice questions about supplied context. Results include answer probabilities, selected choices, and the model’s threshold. * Requests are subject to limits on context, question and option formats, and Decision statements per turn. Evaluation returns no result if a Decision model is unavailable or provides no answers; invalid requests produce an error. * **Documentation** * Added guidance on using Decision evaluation in optional package server code. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-24 04:06:40 +07:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Pasta-Devs/Marinara-Engine#7703
No description provided.