Skip to content

feat(studio): L08a import preview and import routes - #1078

Merged
LinuxDevil merged 2 commits into
mainfrom
fb-l08a
Nov 12, 2026
Merged

LinuxDevil merged 2 commits into
mainfrom
fb-l08a

Conversation

@LinuxDevil

Copy link
Copy Markdown
Owner

Summary

  • POST /agents/import/preview parses pasted YAML, JSON or an lousho.agent-bundle (1 MB cap), upgrades v1 specs via upgradeSpec + agentSpecV2Schema, and answers an ImportPreview: format, spec, normalised bundle labels (L13 normalizeLabels, LabelError → 400 LOUSHO_IMPORT_INVALID), suggestedId, name clash, per-mode resolvedId, computeRequirements rows, bundle prompt list and warnings (Upgraded from spec v1., per-prompt daemon notice, newer-Studio bundle refusal).
  • POST /agents/import writes under withAgentLock(resolvedId): new/copy mint a disabled agent (enabled: false, createdFrom import/copy) with a create/import version; replace keeps the target's enable/publish/disable state, sets labels only for bundle imports, baselines external edits first and captures an update/import version the store skips when content is identical. Bundle prompts are POSTed to the observe daemon best-effort (failures ignored); agent.changed reason import is published.
  • server/lifecycle/agentIds.ts: slugifyAgentId (delegates to the create route's slugAgentId), resolveFreshId, resolveNextCopyId — the copy resolver is shared with L10. agentIdTaken is exported from storage/agentIds.ts as the exists predicate.
  • server/agentRecord.ts: the AgentRecord assembler extracted from agentRoutes (which now aliases it) so import answers the same record shape GET /agents/:id returns.
  • Routes register before registerAgentRoutes so import is never an agent id; runtimeClient gains previewImport/importAgent for L08b's sheet.

Test plan

  • agentIds.test.ts (14): slug cases, copy/fresh sequences, 1000-exhaustion
  • importParse.test.ts (10): yaml/json/bundle, newer bundle, empty, >1 MB, invalid JSON/YAML, schema error path+details
  • importRoutes.test.ts (12): preview fields, clash + per-mode resolved ids, new/copy/replace writes (spec file, meta, version lines), replace 404/missing target, prompt POST stubbed + failure ignored, agent.changed published, route ordering
  • Full server suite: 127 files / 1554 tests green; full client suite: 236 files / 3981 tests green
  • Server + client typechecks clean; fallow dead-code clean; fallow dupes clean (pre-existing L11b advisory only); lint clean except pre-existing steerGate.ts:80
  • fallow health not runnable locally: root test:coverage cannot emit coverage-final.json because 101 pre-existing EPERM: symlink tests fail on this Windows box (unrelated env issue); dead-code/dupes gates pass

Generated with Devin

LinuxDevil and others added 2 commits November 12, 2026 06:25
POST /agents/import/preview parses pasted YAML, JSON or an
lousho.agent-bundle (1 MB cap), upgrades v1 specs to v2 and answers an
ImportPreview - format, spec, normalised bundle labels, suggested id,
name clash, the id each mode resolves to, readiness rows, prompt list
and warnings. POST /agents/import writes the agent under the per-agent
lock in mode new/copy/replace: new and copy start disabled with a
create/import version and createdFrom meta, replace keeps the target's
enable/publish/disable state, sets labels only for bundles and captures
an update/import version the store skips on identical content. Bundle
prompts are POSTed to the observe daemon best-effort; agent.changed
reason import is published. Routes mount before /agents/:id so 'import'
is never an agent id. lifecycle/agentIds.ts mints slug/copy/fresh ids
(resolveNextCopyId is shared with L10); agentRecord.ts is the shared
AgentRecord assembler agentRoutes and import both read.

Generated with [Devin](https://devin.ai)

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Generated with [Devin](https://devin.ai)

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
@LinuxDevil
LinuxDevil merged commit 63673d5 into main Nov 12, 2026
6 checks passed
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.

1 participant