Repository navigation
feat(studio): L08a import preview and import routes - #1078
Merged
Merged
Conversation
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>
5 tasks done
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
POST /agents/import/previewparses pasted YAML, JSON or anlousho.agent-bundle(1 MB cap), upgrades v1 specs viaupgradeSpec+agentSpecV2Schema, and answers anImportPreview: format, spec, normalised bundle labels (L13normalizeLabels,LabelError→ 400LOUSHO_IMPORT_INVALID),suggestedId, nameclash, per-moderesolvedId,computeRequirementsrows, bundle prompt list and warnings (Upgraded from spec v1., per-prompt daemon notice, newer-Studio bundle refusal).POST /agents/importwrites underwithAgentLock(resolvedId):new/copymint a disabled agent (enabled: false,createdFromimport/copy) with acreate/importversion;replacekeeps the target's enable/publish/disable state, sets labels only for bundle imports, baselines external edits first and captures anupdate/importversion the store skips when content is identical. Bundle prompts are POSTed to the observe daemon best-effort (failures ignored);agent.changedreasonimportis published.server/lifecycle/agentIds.ts:slugifyAgentId(delegates to the create route'sslugAgentId),resolveFreshId,resolveNextCopyId— the copy resolver is shared with L10.agentIdTakenis exported fromstorage/agentIds.tsas the exists predicate.server/agentRecord.ts: theAgentRecordassembler extracted fromagentRoutes(which now aliases it) so import answers the same record shapeGET /agents/:idreturns.registerAgentRoutessoimportis never an agent id;runtimeClientgainspreviewImport/importAgentfor L08b's sheet.Test plan
agentIds.test.ts(14): slug cases, copy/fresh sequences, 1000-exhaustionimportParse.test.ts(10): yaml/json/bundle, newer bundle, empty, >1 MB, invalid JSON/YAML, schema error path+detailsimportRoutes.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.changedpublished, route orderingfallow dead-codeclean;fallow dupesclean (pre-existing L11b advisory only); lint clean except pre-existingsteerGate.ts:80fallow healthnot runnable locally: roottest:coveragecannot emitcoverage-final.jsonbecause 101 pre-existingEPERM: symlinktests fail on this Windows box (unrelated env issue); dead-code/dupes gates passGenerated with Devin