[GH-ISSUE #1889] Restore custom agent activation settings schema contract #916

Closed
opened 2026-10-21 05:23:25 +07:00 by bsakaguchi · 1 comment
Owner

Originally created by @Xelvanis on GitHub (Jun 2, 2026).
Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/1889

Originally assigned to: @SpicyMarinara on GitHub.

What problem does this solve?

Legacy custom agent activation exposed a named schema contract for settings.activationKeywords and settings.activationScanDepth. Refactor keeps runtime behavior, but the agent config schema now accepts settings as a generic record, so activation settings are normalized at runtime without a matching contract-level schema.

Evidence:

  • Refactor constants and normalizers live in src/engine/contracts/constants/agent-activation.ts.
  • Refactor runtime matching uses those normalizers in src/engine/agents-runtime/activation.ts.
  • Refactor schema currently keeps settings: z.record(z.unknown()).default({}) in src/engine/contracts/schemas/agent.schema.ts and has no named custom agent activation settings schema.
  • Legacy had customAgentActivationSettingsSchema in packages/shared/src/schemas/agent.schema.ts for activationKeywords and activationScanDepth.

Proposed behavior

Add or restore a named custom agent activation settings schema in the refactor contract layer that validates:

  • activationKeywords: trimmed non-empty string array, max 100
  • activationScanDepth: integer from 1 through MAX_CUSTOM_AGENT_ACTIVATION_SCAN_DEPTH

Use it where custom agent settings are validated or normalized, while keeping product behavior in src/engine and not moving React or runtime adapter concerns into contracts.

Expected owner or impact area

  • App shell, navigation, startup, or providers
  • Catalog resources: chats, characters, personas, lorebooks, presets, connections, agents, gallery, or knowledge
  • Chat mode
  • Roleplay mode
  • Game mode
  • Shared mode UI
  • Runtime systems: generation, world-state, visuals, tracker, or haptics
  • Professor Mari or shell tools
  • React-free engine behavior, contracts, agents, or capability ports
  • Shared API wrapper or remote runtime routing
  • Tauri/Rust storage, assets, LLM, integrations, security, imports, or HTTP runtime
  • Docs, contributor workflow, or templates

Refactor branch considerations

Keep the activation contract in the React-free engine layer. UI should consume the contract helpers instead of duplicating parsing rules. Storage/import paths should preserve unknown settings, but activation-specific fields should still have a contract shape when they are intentionally supported.

Alternatives considered

Leaving only runtime normalizers avoids immediate behavior changes, but it leaves persisted/imported custom agent activation settings without a named schema surface and makes future compatibility checks easier to miss.

Additional context

A legacy parity audit on origin/refactor found no confirmed custom agent activation runtime regression. Refactor is better than legacy in one respect: UI and runtime now share the same normalization helpers. This issue tracks the remaining contract/schema parity gap only.

Template check

Please uncheck the box below before submitting so we know you read the template. It is intentionally pre-checked:

  • I DID NOT read this template and provide the requested details.
Originally created by @Xelvanis on GitHub (Jun 2, 2026). Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/1889 Originally assigned to: @SpicyMarinara on GitHub. ## What problem does this solve? Legacy custom agent activation exposed a named schema contract for `settings.activationKeywords` and `settings.activationScanDepth`. Refactor keeps runtime behavior, but the agent config schema now accepts `settings` as a generic record, so activation settings are normalized at runtime without a matching contract-level schema. Evidence: - Refactor constants and normalizers live in `src/engine/contracts/constants/agent-activation.ts`. - Refactor runtime matching uses those normalizers in `src/engine/agents-runtime/activation.ts`. - Refactor schema currently keeps `settings: z.record(z.unknown()).default({})` in `src/engine/contracts/schemas/agent.schema.ts` and has no named custom agent activation settings schema. - Legacy had `customAgentActivationSettingsSchema` in `packages/shared/src/schemas/agent.schema.ts` for `activationKeywords` and `activationScanDepth`. ## Proposed behavior Add or restore a named custom agent activation settings schema in the refactor contract layer that validates: - `activationKeywords`: trimmed non-empty string array, max 100 - `activationScanDepth`: integer from 1 through `MAX_CUSTOM_AGENT_ACTIVATION_SCAN_DEPTH` Use it where custom agent settings are validated or normalized, while keeping product behavior in `src/engine` and not moving React or runtime adapter concerns into contracts. ## Expected owner or impact area - [ ] App shell, navigation, startup, or providers - [x] Catalog resources: chats, characters, personas, lorebooks, presets, connections, agents, gallery, or knowledge - [ ] Chat mode - [ ] Roleplay mode - [ ] Game mode - [ ] Shared mode UI - [ ] Runtime systems: generation, world-state, visuals, tracker, or haptics - [ ] Professor Mari or shell tools - [x] React-free engine behavior, contracts, agents, or capability ports - [ ] Shared API wrapper or remote runtime routing - [ ] Tauri/Rust storage, assets, LLM, integrations, security, imports, or HTTP runtime - [ ] Docs, contributor workflow, or templates ## Refactor branch considerations Keep the activation contract in the React-free engine layer. UI should consume the contract helpers instead of duplicating parsing rules. Storage/import paths should preserve unknown settings, but activation-specific fields should still have a contract shape when they are intentionally supported. ## Alternatives considered Leaving only runtime normalizers avoids immediate behavior changes, but it leaves persisted/imported custom agent activation settings without a named schema surface and makes future compatibility checks easier to miss. ## Additional context A legacy parity audit on `origin/refactor` found no confirmed custom agent activation runtime regression. Refactor is better than legacy in one respect: UI and runtime now share the same normalization helpers. This issue tracks the remaining contract/schema parity gap only. ## Template check Please uncheck the box below before submitting so we know you read the template. It is intentionally pre-checked: - [ ] I DID NOT read this template and provide the requested details.
Author
Owner

@SpicyMarinara commented on GitHub (Jun 2, 2026):

Fixed on refactor in a4ba3c90: restored the named custom agent activation settings schema, validating normalized activationKeywords and activationScanDepth while preserving unknown settings. Verification passed: typecheck, architecture, docs, build, cargo check, diff check.

<!-- gh-comment-id:4601637230 --> @SpicyMarinara commented on GitHub (Jun 2, 2026): Fixed on refactor in a4ba3c90: restored the named custom agent activation settings schema, validating normalized activationKeywords and activationScanDepth while preserving unknown settings. Verification passed: typecheck, architecture, docs, build, cargo check, diff check.
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#916
No description provided.