Skip to content

Add code_mode schema to agent configs#480

Open
yardend-wix wants to merge 4 commits intomainfrom
task/codemode
Open

Add code_mode schema to agent configs#480
yardend-wix wants to merge 4 commits intomainfrom
task/codemode

Conversation

@yardend-wix
Copy link
Copy Markdown
Contributor

@yardend-wix yardend-wix commented Apr 15, 2026

Note

Description

Adds a code_mode optional field to the agent configuration schema, enabling fine-grained access control policies for agents operating in code mode. The field supports entity-level row-level security (RLS) rules — using boolean flags or MongoDB-style filter objects — alongside a function allowlist. The config is validated at parse time (shape only, no semantic backend checks) and forwarded to the backend as-is during pushAgents.

Related Issue

None

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update
  • Refactoring (no functional changes)
  • Other (please describe):

Changes Made

  • Added EntityAccessRuleSchema (boolean | Record<string, unknown>) for per-operation entity access rules
  • Added AgentAccessConfigSchema with entities (nested record of per-operation rules) and functions (array of { name } objects) fields
  • Added CodeModeConfigSchema wrapping AgentAccessConfigSchema with defaults applied
  • Added optional code_mode field to AgentConfigSchema; exported all new TypeScript types
  • Added integration test in agents.spec.ts verifying the code_mode block is sent to the backend correctly
  • Added comprehensive schema validation test suite in agents_code_mode.spec.ts (valid/invalid shapes, MongoDB filter patterns, edge cases)
  • Added test in agents_write.spec.ts confirming code_mode is preserved when writing agents to disk
  • Updated customer_support.json fixture to include a representative code_mode example

Testing

  • I have tested these changes locally
  • I have added/updated tests as needed
  • All tests pass (npm test)

Checklist

  • My code follows the project's style guidelines
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation (if applicable)
  • My changes generate no new warnings
  • I have updated docs/ (AGENTS.md) if I made architectural changes

Additional Notes

The schema intentionally validates shape only — entity and function names are not checked against the backend at parse time, matching the RLS philosophy used elsewhere in the codebase. The functions allowlist changed from string[] to Array<{ name: string }> (see commit 2870bac) to align with the backend's expected format, and the fixture and tests were updated accordingly.


🤖 Generated by Claude | 2026-04-16 00:00 UTC | 23e497d

Formalizes the code_mode field in AgentConfigSchema with typed
EntityAccessRule / AgentAccessConfig / CodeModeConfig schemas. Matches
the backend shape-only validation philosophy — no semantic checks on
filter syntax, field paths, or template variables.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Apr 15, 2026

🚀 Package Preview Available!


Install this PR's preview build with npm:

npm i @base44-preview/cli@0.0.50-pr.480.23e497d

Prefer not to change any import paths? Install using npm alias so your code still imports base44:

npm i "base44@npm:@base44-preview/cli@0.0.50-pr.480.23e497d"

Or add it to your package.json dependencies:

{
  "dependencies": {
    "base44": "npm:@base44-preview/cli@0.0.50-pr.480.23e497d"
  }
}

Preview published to npm registry — try new features instantly!

Comment thread packages/cli/src/core/resources/agent/schema.ts Outdated
yardend-wix and others added 3 commits April 16, 2026 10:49
Functions format is now [{"name": "func-name"}, ...] instead of
["func-name", ...] — extensible for future per-function properties
(env, version, etc.) without requiring a data migration.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Update customer_support.json fixture to use the new object format
for functions (missed in previous commit) and fix Biome formatting.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
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