feat: import open Discussion Framework agendas into Works
Add deterministic preview and fingerprint-bound application for independent DF sources under an AIE umbrella. Preserve complete agendas and original evidence with source-scoped identities, validated receipts and safe retries. Publish prepared Works atomically, require review for changed imports and retain existing refinement without source edits or model calls. Advertise protocol contract 2 while continuing to read contract-1 projects. Add JVM, concurrency, recovery and native coverage; document usage and complete WRK-0007 with verification evidence.
This commit is contained in:
@@ -35,16 +35,22 @@ public final class ArtifactService {
|
||||
return Filespace.locked(root, () -> {
|
||||
var work = works.editable(root, workId); String id = works.nextReference(work.artifacts(), "ART");
|
||||
Path folder = works.folder(root, workId);
|
||||
Path parent = Filespace.resolve(folder, "artifacts/evidence");
|
||||
Path stage = Filespace.resolve(parent, "." + id + "-" + UUID.randomUUID() + ".tmp"); Filespace.directory(stage);
|
||||
var artifact = new Artifact(1, id, workId, origin, purpose,
|
||||
"artifacts/evidence/" + id + "/payload", hash(bytes), bytes.length, author, Instant.now().toString());
|
||||
Filespace.writeBytes(stage.resolve("payload"), bytes, false);
|
||||
Filespace.write(stage.resolve("artifact.yaml"), Documents.yaml(artifact), false);
|
||||
Filespace.moveDirectory(stage, Filespace.resolve(parent, id));
|
||||
var artifact = writePrepared(folder, workId, id, bytes, purpose, origin, author);
|
||||
works.addReference(root, workId, "artifacts", id); return artifact;
|
||||
});
|
||||
}
|
||||
/** Normal evidence format in an unpublished Work folder; caller publishes its Work references. */
|
||||
public Artifact writePrepared(Path folder, String workId, String id, byte[] content, String purpose, String origin, String author) {
|
||||
Work.identifier(workId, "WRK"); Work.identifier(id, "ART"); byte[] bytes = content.clone();
|
||||
if (bytes.length > MAX_BYTES) throw ProtocolException.invalid("Evidence exceeds 1 MiB");
|
||||
Path parent = Filespace.resolve(folder, "artifacts/evidence");
|
||||
Path stage = Filespace.resolve(parent, "." + id + "-" + UUID.randomUUID() + ".tmp"); Filespace.directory(stage);
|
||||
var artifact = new Artifact(1, id, workId, origin, purpose,
|
||||
"artifacts/evidence/" + id + "/payload", hash(bytes), bytes.length, author, Instant.now().toString());
|
||||
Filespace.writeBytes(stage.resolve("payload"), bytes, false);
|
||||
Filespace.write(stage.resolve("artifact.yaml"), Documents.yaml(artifact), false);
|
||||
Filespace.moveDirectory(stage, Filespace.resolve(parent, id)); return artifact;
|
||||
}
|
||||
public void validate(Path root, String id) {
|
||||
for (var artifact : list(root, id)) {
|
||||
Path path = Filespace.resolve(works.folder(root, id), artifact.path());
|
||||
|
||||
Reference in New Issue
Block a user