refactor: inline playbook session runtime, unify base-resource identity#34
Open
heimanba wants to merge 6 commits into
Open
refactor: inline playbook session runtime, unify base-resource identity#34heimanba wants to merge 6 commits into
heimanba wants to merge 6 commits into
Conversation
Change-Id: I5d340bb58f1d0d9a68607024aa49fe0b37c1eab6 Co-developed-by: Qoder <noreply@qoder.com>
readinessFromPick, PlaybookReadiness, and their tests have no production consumer: the server's agent readiness flows through the sdk's listAgentsWithReadiness instead. Remove the dead code before inlining the session runtime. Change-Id: I131ba28e7fbee9ec2aaf3a44467d27bc590dfd28 Co-developed-by: OpenCode <noreply@opencode.ai>
The playbook session-runtime adapter layer (createPlaybookSessionRuntime, pickPlaybookAgent, PlaybookAgentIdentityMismatchError, and ~15 input/output types) lived in @openagentpack/playbooks but had exactly one production consumer: the server's playbook-session-adapter. This commit: - Moves the runtime orchestration and agent-pick logic into a new apps/server/.../playbook-session-adapter/runtime.ts with all generic type parameters instantiated to their concrete server types. - Replaces the four adapter interfaces with a single concrete PlaybookSessionRuntimeDeps type (dependency injection preserved for testability, but no cross-package abstraction). - Migrates tests to apps/server with type-safe fake constructors. - Removes session-runtime.ts from @openagentpack/playbooks and cleans up all re-exports from the package index. - Eliminates the duplicate ListPlaybookSessionsInput definition in sessions.ts (now imported from runtime.ts). Behavioral changes: none. The PlaybookAgentIdentityMismatchError still surfaces as HTTP 500 (no route-level catch); a future PR can map it to 4xx if desired. Change-Id: Ia4276ea3626877163f60529342e7da1ba3a991bd Co-developed-by: OpenCode <noreply@opencode.ai>
playground's devDependency on @openagentpack/playbooks had zero imports in its source tree. Remove it. Also update the playbooks package description now that the session runtime orchestration no longer lives there. Change-Id: Ic6ac9936561f2186da6b2cdd37d8ffd0121402d3 Co-developed-by: OpenCode <noreply@opencode.ai>
…ook-session-runtime
Change-Id: I1f4b06c06ca304d98f5a1151aad48f1bf4537cec
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR consolidates four changes that simplify the session runtime architecture and strengthen base-resource identity tracking:
1. feat(byoc): runtime config, sessions and vaults updates
agents.base/agents.vault) tobuildRuntimeConfigso the webui can identify managed base resources via remote listing.examples/bailian/bailian-cli/agents.state.jsonto~/.agents/playground.state.json(one-time auto-migration preserves remote_ids).findBaseVaultto match on metadata stamp alone (not display_name), since the engine and imperative path may create vaults with different display_name values but both always set the stamp.2. refactor: inline session runtime from playbooks into server
session-runtime.tsfrom@openagentpack/playbooksintoapps/server/src/services/sessions/playbook-session-adapter/runtime.ts— the server is the only production consumer.PlaybookSessionRuntimeAdapters<TDetail, TEvent, TSession, TAgent>with concretePlaybookSessionRuntimeDepsusingProviderSessionEvent/Sessiondirectly.runtime.test.tswith full coverage of pick, start, send, list, getDetail, delete.3. refactor(playbooks): drop unused readiness mapping
SKILL_STATUS_CODE,skillStatusFromCode, and numeric↔string mapping code — no remaining consumers after Mode B removal.4. chore: remove playground dead dep on playbooks, update description
@openagentpack/playbooksdevDependency frompackages/playground.Agent declares environment + vault
toAgentBuildInputnow resolves environment and vault names from the assembled config and sets them on the agent declaration, sosyncAgentResourcesmanages base resources through the plan/apply engine (state tracking + drift detection).Test results
All 812 tests pass across all workspaces. Typecheck, architecture conformance, and lint all green.
Behavior / risk
No breaking API change is intended. Runtime base resources keep their managed identity while playground state moves to
~/.agents/playground.state.jsonwith one-time legacy migration. The PR gate now asks for risk and validation evidence in the PR description for high-risk changes, including verification-policy changes, without requiring a special commit-message marker or history rewrite. A generatedbun.lockchange alone is covered by audit and compatibility checks.Validation
bun scripts/verify.ts full --step typecheckbun scripts/verify.ts full --step lintbun scripts/verify.ts full --step architecturebun scripts/verify.ts full --step test