feat(studio): deliver asset authoring and automation workflows
Add shared human/task asset batches with reviewed atomic publication, explicit reference rebinds, ownership inspection and qualified glyph/scene budgets. Expose the same authoring and capacity results through Assets and MCP. Deliver isolated guest test targets, retained visual evidence and immutable runtime lifecycle/control observations. Preserve provider qualification and installed authoring examples alongside the completed discussion lessons. Close AGD-106 coordination and the delivered discussion workflows through housekeeping, updating lesson references and preserving qualification limits. Sound remains outside the asset delivery wave. Validation: 579 module tests and 31 additional desktop, process and installed checks passed; native glyph/scene 16/17 boundaries qualified. Discussion validation passed after housekeeping.
This commit is contained in:
@@ -198,4 +198,28 @@ class LocalMcpServerTest {
|
||||
assertEquals(401, post(wire).statusCode());
|
||||
}
|
||||
|
||||
@Test void evidenceImagesUseAuthenticatedEndpointAndCannotReuseRevokedTasksOrCrossProjectIds() throws Exception {
|
||||
root=root.toRealPath();var pool=java.util.concurrent.Executors.newSingleThreadExecutor();
|
||||
var authority=new p.studio.core.session.DefaultAutomationSession(root,new p.studio.app.operation.ExecutorOperationExecutor(pool));
|
||||
var projects=new p.studio.core.project.ProjectAccessRegistry();projects.register(root,authority::enterManual,()->!authority.snapshot().closed(),authority);
|
||||
var codec=new p.studio.app.evidence.PngEvidenceCodec();var tools=new p.studio.core.session.DefaultEvidenceTools(projects,null,new p.studio.app.evidence.FileEvidenceStore(mapper),codec);
|
||||
byte[] png=codec.encode(new Evidence.Pixels(1,1,new byte[]{1,2,3,(byte)255}));
|
||||
var source=root.resolve("reference.png");java.nio.file.Files.write(source,png);
|
||||
var artifact=tools.importReference(root,null,"human-import",source,null).artifacts().getFirst();
|
||||
try {
|
||||
server.close();server=new LocalMcpServer(mapper,new McpToolRegistry(new McpToolCatalog(mapper),mapper,McpEvidenceTools.handlers(tools,mapper)));
|
||||
server.start();authorize(root);session=null;initialize();
|
||||
authority.grant(false).toCompletableFuture().get(5,java.util.concurrent.TimeUnit.SECONDS);String task=authority.acquire().task().value();
|
||||
var call=mapper.createObjectNode().put("jsonrpc","2.0").put("id",2).put("method","tools/call");
|
||||
var args=call.putObject("params").put("name","studio_evidence_image").putObject("arguments").put("projectRoot",root.toString()).put("taskId",task).put("artifactId",artifact.id());
|
||||
assertEquals(401,request("POST",server.connection().endpoint(),call.toString(),null,null,LocalMcpServer.PROTOCOL_VERSION,session).statusCode());
|
||||
var result=mapper.readTree(post(call.toString()).body()).path("result");assertFalse(result.path("isError").asBoolean());
|
||||
assertArrayEquals(png,Base64.getDecoder().decode(result.path("content").get(1).path("data").asText()));
|
||||
args.put("projectRoot",java.nio.file.Files.createDirectory(root.resolve("other")).toRealPath().toString());
|
||||
assertEquals("OUTSIDE_PROJECT_SCOPE",mapper.readTree(post(call.toString()).body()).path("result").path("structuredContent").path("error").path("code").asText());
|
||||
args.put("projectRoot",root.toString());authority.release(authority.snapshot().task()).toCompletableFuture().get(5,java.util.concurrent.TimeUnit.SECONDS);
|
||||
assertEquals("INVALID_TASK",mapper.readTree(post(call.toString()).body()).path("result").path("structuredContent").path("error").path("code").asText());
|
||||
} finally {authority.closeAsync().toCompletableFuture().join();pool.shutdownNow();}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user