master-backup
5 Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
dd6c20df5d |
fix(compiler): thread actor-level system_prompt into graph node metadata
CI / dead_code (pull_request) Successful in 43s
CI / typecheck (pull_request) Successful in 1m13s
CI / unit_tests (pull_request) Successful in 1m11s
CI / lint (pull_request) Successful in 1m16s
CI / security (pull_request) Successful in 1m15s
CI / coverage (pull_request) Successful in 1m16s
CI / build (pull_request) Successful in 26s
CI / typecheck (push) Successful in 1m3s
CI / unit_tests (push) Successful in 1m2s
CI / lint (push) Successful in 1m6s
CI / dead_code (push) Successful in 27s
CI / security (push) Successful in 57s
CI / coverage (push) Successful in 59s
CI / build (push) Successful in 37s
actor/compiler.py:_map_node() already threaded provider and model from the
actor-level config into each AGENT node's merged_meta via setdefault, but
system_prompt was never added to the same pattern.
Three targeted additions across two files:
1. _map_node() in actor/compiler.py gains an actor_system_prompt parameter
and applies merged_meta.setdefault("system_prompt", actor_system_prompt)
inside the AGENT branch, directly after the existing provider/model calls.
setdefault semantics ensure per-node config.system_prompt overrides take
precedence, exactly matching the existing provider/model behaviour.
2. compile_actor() now passes actor_system_prompt=config.system_prompt to
_map_node() so the actor-level field reaches every AGENT node.
3. Node._execute_agent() in langgraph/nodes.py injects the node's
metadata["system_prompt"] into the context dict (before state.metadata
is merged) so host agents can read context.get("system_prompt") without
needing a direct reference to the raw ActorConfigSchema.
Seven BDD scenarios added in features/compiler_system_prompt.feature:
- Actor-level system_prompt is threaded into each AGENT node metadata.
- Per-node system_prompt takes precedence via setdefault semantics.
- process_message() receives system_prompt in the context dict.
- state.metadata["system_prompt"] overrides compiled default at runtime.
- Non-AGENT nodes (TOOL) do not receive system_prompt in metadata.
- Actor without system_prompt compiles metadata as None.
- Absent system_prompt is excluded from runtime context dict.
Bug fix: changed truthiness check from `if node_system_prompt:` to
`if node_system_prompt is not None:` in _execute_agent() to faithfully
pass empty-string system prompts into the context dict. Added explicit
`str | None` type annotation for node_system_prompt.
docs/reference/actor_compiler.md updated to document system_prompt
threading alongside provider and model in the Node Binding table.
Quality gates: lint, typecheck, unit_tests (14/14), coverage_report,
security_scan, dead_code, complexity all pass.
ISSUES CLOSED: #6
|
||
|
|
15e81e58f1 |
fix: sync doc with extraction scope, remove boundary violation, add ProviderRegistryPort
CI / dead_code (pull_request) Successful in 40s
CI / security (pull_request) Successful in 1m10s
CI / coverage (pull_request) Successful in 1m11s
CI / typecheck (pull_request) Successful in 1m19s
CI / unit_tests (pull_request) Successful in 1m18s
CI / lint (pull_request) Successful in 1m20s
CI / build (pull_request) Successful in 23s
CI / lint (push) Successful in 51s
CI / typecheck (push) Successful in 47s
CI / unit_tests (push) Successful in 49s
CI / coverage (push) Successful in 53s
CI / dead_code (push) Successful in 26s
CI / build (push) Successful in 26s
CI / security (push) Successful in 42s
Boundary fix: - Delete src/cleveractors/acms/index.py (ACMSIndex, FileTraversalEngine, IndexEntry, FileType, TierLevel) — these are CLI/storage concerns that belong in cleveragents-core per ADR-001; the file already exists there at cleveragents/acms/index.py - Clean src/cleveractors/acms/__init__.py: remove all index.py imports and re-exports; __all__ now derives purely from uko.__all__ ProviderRegistryPort (ADR-005): - Add src/cleveractors/ports/provider_registry.py: ProviderRegistryPort Protocol with get(provider, model) -> Agent | None; structural typing, no host imports, mirrors the shape of ToolRegistryPort - Update src/cleveractors/ports/__init__.py: export ProviderRegistryPort alongside ToolRegistryPort; update module docstring Wire provider resolution into the node executor: - compiler.py: _map_node now accepts actor_provider/actor_model defaults and merges them into AGENT node metadata (setdefault so per-node config values still win); compile_actor passes config.provider/config.model - nodes.py: Node.__init__ gains optional provider_registry parameter; _execute_agent resolution order is now: (1) pre-resolved agents dict, (2) ProviderRegistryPort.get(provider, model) from node metadata, (3) graceful synthetic fallback — the ValueError guard for missing config.agent is removed since the registry is a valid alternative path Documentation: - Port ADR-003 (actor abstraction definition) from cleveragents-core ADR-031 - Port ADR-004 (Jinja2 YAML template preprocessing) from cleveragents-core ADR-032 - Add ADR-005 (Provider Registry Protocol) for the new provider_registry port - Port five reference docs: actors_schema.md, actor_compiler.md, actor_config.md, actor_hierarchy.md, actors_examples.md - Port API reference: api/actor.md - Add provider field to all YAML examples in actors_examples.md, actor_hierarchy.md, and actor_config.md - Update error messages in actor_config.md to match actual validator output - Add graph-level provider/model propagation docs to actor_compiler.md - Add ADR-005 cross-references to ADR-001, ADR-002, and actors_schema.md - Fix ADR-005 status section to reflect that implementation is in this PR - Fix ADR-004 to reference actual test files (smoke.feature, not phantom ones) - Remove fabricated reserved-namespace constraint from ADR-003 Constraints - Fix broken LICENSE link in docs/index.md for MkDocs rendering - Add provider field to ActorConfigSchema table in api/actor.md - Add internal modules section to docs/specification.md (ticket item 7) - Fix markdown formatting in actors_schema.md provider field definition - Add ADR-005 cross-reference to actors_schema.md provider field section BDD coverage (7 scenarios, 30 steps): - ProviderRegistryPort happy-path resolution - Graceful fallback when provider registry returns None - Graceful fallback when no provider registry is supplied - Pre-resolved agents dict takes precedence over provider registry - Compile a minimal graph actor, reject missing provider, render template Post-review fixes applied in amend: - actors_examples.md and actor_hierarchy.md: added provider to all examples - ADR-003: removed fabricated reserved-namespace constraint - ADR-004: corrected phantom test file references - ADR-005: updated status to reflect implementation is included - Added 'no registry' and 'agents dict precedence' BDD scenarios - Added provider to api/actor.md ActorConfigSchema fields table - ADR-001 and ADR-002: added ADR-005 cross-references - actor_config.md: fixed error message to match validator - actor_compiler.md: documented graph-level provider/model propagation - index.md: fixed broken LICENSE link - actors_schema.md: added ADR-005 cross-reference ISSUES CLOSED: #4 |
||
|
|
2ce29092f5 |
docs(my-actor.yaml): add an example actor (#3)
CI / security (push) Successful in 33s
CI / unit_tests (push) Successful in 42s
CI / coverage (push) Successful in 46s
CI / typecheck (push) Successful in 1m1s
CI / lint (push) Successful in 1m1s
CI / dead_code (push) Successful in 1m5s
CI / build (push) Successful in 27s
This code adds documentation of a sample actor. ISSUES CLOSED: #1 Reviewed-on: #3 Reviewed-by: Luis Mendes <luis.mendes@cleverthis.com> |
||
|
|
6915498ff8 |
test: add Behave smoke covering compile, validate, template
Three scenarios verifying the library compiles, validates, and renders
without depending on cleveragents-core:
1. Compile a minimal two-node graph actor — parses a v3 actor dict
through ActorConfigSchema.model_validate, compiles via
compile_actor, asserts the metadata lists both node ids.
2. Reject an actor missing a required field — drops 'provider' from
a known-good actor, asserts Pydantic raises a ValidationError.
3. Render a simple template — passes '{greeting}, {name}!' through
SecureTemplateRenderer with greeting='Hello', name='actor';
asserts the rendered result is 'Hello, actor!'.
`features/environment.py` is intentionally empty — the library has
no DB, no HTTP, no fixtures to set up.
Verified green: `behave features/` → 1 feature passed, 3 scenarios
passed, 11 steps passed.
Notable subtlety: Behave's Context object reserves `config` as an
internal attribute, so the step files use `actor_config` to avoid
KeyError('config') on overwrite.
|
||
|
|
bd93ae8894 |
chore: bootstrap cleveractors-core project skeleton
Initial scaffolding for the library extracted from cleveragents-core
at commit 20ad9a46. This commit lays the empty package shell and the
quality-gate machinery; subsequent commits move actual source.
- pyproject.toml: Hatchling build; Python 3.13; pinned runtime
deps trimmed to what the library actually needs (pydantic,
structlog, langchain-core, langgraph, jinja2, pyyaml, jsonschema,
python-ulid). Dev/tests/docs extras mirror the parent.
- noxfile.py: 8 sessions matching cleveragents-core by name
(format, lint, typecheck, unit_tests, coverage_report,
security_scan, dead_code, complexity, build, docs); slimmed of
the parent's pabot / template-DB / worker plumbing because the
library is pure-domain.
- LICENSE, NOTICE, CODE_OF_CONDUCT.md, ATTRIBUTIONS.md,
.editorconfig, .gitattributes, .gitignore, .pre-commit-config.yaml,
.semgrep.yml, .bumpversion.cfg, behave.ini, pyrightconfig.json,
.python-version: copied verbatim from cleveragents-core so org-
wide policy stays in lockstep.
- README.md: tailored to the library's role; explains the
boundary with cleveragents-core and what's NOT in scope.
- src/cleveractors/__init__.py + py.typed: empty package marker
with module-level docstring listing the eventual sub-packages.
- features/steps/__init__.py: Behave test tree placeholder.
No source code is moved in this commit. The next two commits add the
CI workflow and the minimal shared types, after which the actor /
langgraph / templates / lsp / acms / agents subpackages land one
commit at a time.
|