@absolutejs/artifacts 0.2.0 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/manifest.js CHANGED
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- // ../manifest/dist/index.js
2
+ // node_modules/@absolutejs/manifest/dist/index.js
3
3
  import { Type } from "typebox";
4
4
  import { Value } from "typebox/value";
5
5
  import { Type as Type2 } from "typebox";
package/dist/rag.js CHANGED
@@ -1,6 +1,15 @@
1
1
  // @bun
2
2
  // src/rag.ts
3
3
  import { Buffer } from "buffer";
4
+
5
+ class ArtifactRAGPartialIndexError extends Error {
6
+ receipt;
7
+ constructor(receipt) {
8
+ super(`Artifact ${receipt.artifactId} indexed ${receipt.indexedUploads}/${receipt.totalUploads} uploads; ${receipt.failures.length} failed`);
9
+ this.name = "ArtifactRAGPartialIndexError";
10
+ this.receipt = receipt;
11
+ }
12
+ }
4
13
  var artifactMetadata = (artifact) => ({
5
14
  artifactId: artifact.id,
6
15
  artifactKind: artifact.kind,
@@ -49,6 +58,58 @@ var createArtifactRAGIndexCoordinator = (options) => ({
49
58
  });
50
59
  try {
51
60
  const uploads = await artifactToRAGUploads(artifact, options.reader);
61
+ if (options.failureMode === "isolate_uploads") {
62
+ const documentIds = [];
63
+ const failures = [];
64
+ let indexedUploads = 0;
65
+ for (const upload of uploads) {
66
+ try {
67
+ const indexed2 = await options.target.index([upload], { artifact });
68
+ documentIds.push(...indexed2.documentIds);
69
+ indexedUploads += 1;
70
+ } catch (error) {
71
+ failures.push({
72
+ contentType: upload.contentType ?? "application/octet-stream",
73
+ error: error instanceof Error ? error.message : String(error),
74
+ name: upload.name ?? "unnamed upload",
75
+ source: upload.source ?? `artifact:${artifact.id}`
76
+ });
77
+ }
78
+ }
79
+ const receipt = {
80
+ artifactId: artifact.id,
81
+ documentIds,
82
+ failures,
83
+ indexedUploads,
84
+ revision: artifact.revision,
85
+ status: failures.length === 0 ? "indexed" : indexedUploads > 0 ? "partial" : "failed",
86
+ totalUploads: uploads.length
87
+ };
88
+ if (failures.length > 0) {
89
+ await options.service.markIndexing(artifact.ownerId, artifact.id, {
90
+ documentIds: [
91
+ ...new Set([...previous?.documentIds ?? [], ...documentIds])
92
+ ],
93
+ error: JSON.stringify({ failures, receipt }),
94
+ revision: artifact.revision,
95
+ status: receipt.status
96
+ });
97
+ throw new ArtifactRAGPartialIndexError(receipt);
98
+ }
99
+ if (previous?.documentIds.length && options.target.remove) {
100
+ const currentIds = new Set(documentIds);
101
+ const obsoleteIds = previous.documentIds.filter((documentId) => !currentIds.has(documentId));
102
+ if (obsoleteIds.length) {
103
+ await options.target.remove(obsoleteIds, { artifact });
104
+ }
105
+ }
106
+ await options.service.markIndexing(artifact.ownerId, artifact.id, {
107
+ documentIds,
108
+ revision: artifact.revision,
109
+ status: "indexed"
110
+ });
111
+ return receipt;
112
+ }
52
113
  const indexed = await options.target.index(uploads, { artifact });
53
114
  if (previous?.documentIds.length && options.target.remove) {
54
115
  const currentIds = new Set(indexed.documentIds);
@@ -62,8 +123,18 @@ var createArtifactRAGIndexCoordinator = (options) => ({
62
123
  revision: artifact.revision,
63
124
  status: "indexed"
64
125
  });
65
- return indexed;
126
+ return {
127
+ artifactId: artifact.id,
128
+ documentIds: indexed.documentIds,
129
+ failures: [],
130
+ indexedUploads: uploads.length,
131
+ revision: artifact.revision,
132
+ status: "indexed",
133
+ totalUploads: uploads.length
134
+ };
66
135
  } catch (error) {
136
+ if (error instanceof ArtifactRAGPartialIndexError)
137
+ throw error;
67
138
  await options.service.markIndexing(artifact.ownerId, artifact.id, {
68
139
  documentIds: previous?.documentIds,
69
140
  error: error instanceof Error ? error.message : String(error),
@@ -75,6 +146,7 @@ var createArtifactRAGIndexCoordinator = (options) => ({
75
146
  }
76
147
  });
77
148
  export {
78
- createArtifactRAGIndexCoordinator,
79
- artifactToRAGUploads
149
+ ArtifactRAGPartialIndexError,
150
+ artifactToRAGUploads,
151
+ createArtifactRAGIndexCoordinator
80
152
  };
@@ -1,4 +1,4 @@
1
- import type { ArtifactAssetWriteInput, ArtifactBundleCreateInput, ArtifactProvenance, ArtifactRecord, JsonObject, JsonValue } from "./types";
1
+ import type { ArtifactAssetWriteInput, ArtifactBatchCompletionReceipt, ArtifactBatchCreateInput, ArtifactBatchValidator, ArtifactBundleCreateInput, ArtifactEvidenceReference, ArtifactProvenance, ArtifactRecord, JsonObject, JsonValue } from "./types";
2
2
  export type ArtifactGenerationInput = {
3
3
  createdBy: string;
4
4
  input?: JsonObject;
@@ -22,12 +22,35 @@ export type ArtifactGenerator = {
22
22
  generate(input: ArtifactGenerationInput, context: ArtifactGenerationContext): Promise<ArtifactGenerationResult>;
23
23
  kind: string;
24
24
  name: string;
25
+ validate?(result: ArtifactGenerationResult, input: ArtifactGenerationInput, context: ArtifactGenerationContext): ArtifactGenerationValidationIssue[] | Promise<ArtifactGenerationValidationIssue[]>;
26
+ };
27
+ export type ArtifactGenerationValidationIssue = {
28
+ code: string;
29
+ message: string;
30
+ path?: string;
25
31
  };
26
32
  export type ArtifactBundleCreator = {
27
33
  createBundle(ownerId: string, input: ArtifactBundleCreateInput): Promise<ArtifactRecord>;
28
34
  };
35
+ export type ArtifactBatchGeneratorService = ArtifactBundleCreator & {
36
+ stageBatch(ownerId: string, input: ArtifactBatchCreateInput, options?: {
37
+ validators?: ArtifactBatchValidator[];
38
+ }): Promise<{
39
+ commit(): Promise<ArtifactBatchCompletionReceipt>;
40
+ }>;
41
+ };
42
+ export type ArtifactBatchGenerationItem = Omit<ArtifactGenerationInput, "ownerId"> & {
43
+ evidence?: ArtifactEvidenceReference[];
44
+ key: string;
45
+ };
46
+ export type ArtifactBatchGenerationInput = Omit<ArtifactBatchCreateInput, "items"> & {
47
+ items: ArtifactBatchGenerationItem[];
48
+ ownerId: string;
49
+ validators?: ArtifactBatchValidator[];
50
+ };
29
51
  export declare const createArtifactGeneratorRegistry: (initial?: ArtifactGenerator[]) => {
30
52
  generate: (service: ArtifactBundleCreator, input: ArtifactGenerationInput) => Promise<ArtifactRecord>;
53
+ generateBatch: (service: ArtifactBatchGeneratorService, input: ArtifactBatchGenerationInput) => Promise<ArtifactBatchCompletionReceipt>;
31
54
  kinds: () => string[];
32
55
  register: (generator: ArtifactGenerator) => void;
33
56
  };
@@ -7,10 +7,11 @@
7
7
  * retains authorization, persistence, URLs, UI, and delivery policy.
8
8
  */
9
9
  export { defineArtifactRegistry, type ArtifactContent, type ArtifactKindDefinition, type ArtifactKindDefinitions, type ArtifactRegistry, } from "./registry";
10
- export { createArtifactGeneratorRegistry, type ArtifactBundleCreator, type ArtifactGenerationContext, type ArtifactGenerationInput, type ArtifactGenerationResult, type ArtifactGenerator, type ArtifactGeneratorRegistry, } from "./generators";
10
+ export { createArtifactGeneratorRegistry, type ArtifactBundleCreator, type ArtifactGenerationContext, type ArtifactGenerationInput, type ArtifactGenerationResult, type ArtifactGenerator, type ArtifactGeneratorRegistry, type ArtifactBatchGenerationInput, type ArtifactBatchGenerationItem, type ArtifactBatchGeneratorService, type ArtifactGenerationValidationIssue, } from "./generators";
11
+ export { validateGeneratedArtifactFormats } from "./validation";
11
12
  export { STANDARD_ARTIFACT_KIND_NAMES, standardArtifactDefinitions, } from "./standardKinds";
12
13
  export { createArtifactRendererRegistry, type ArtifactRenderer, type ArtifactRendererRegistry, type ArtifactRenderResult, } from "./renderers";
13
14
  export { createArtifactService, type ArtifactPublisher, type ArtifactService, type ArtifactServiceOptions, } from "./service";
14
15
  export { createMemoryArtifactStore, createMemoryArtifactAssetStore, type ArtifactAssetStore, type ArtifactAssetTransaction, type ArtifactStore, } from "./store";
15
16
  export { createArtifactTools, type ArtifactToolDefinition, type ArtifactToolMap, type ArtifactToolOptions, } from "./tools";
16
- export { ARTIFACT_STATUSES, ARTIFACT_EVENT_TYPES, ArtifactError, isJsonValue, type ArtifactAssetReference, type ArtifactAssetRole, type ArtifactAssetWriteInput, type ArtifactBundleCreateInput, type ArtifactCapability, type ArtifactCreateInput, type ArtifactErrorCode, type ArtifactEvent, type ArtifactEventQuery, type ArtifactEventType, type ArtifactGarbageCollectionResult, type ArtifactIndexingState, type ArtifactIndexingStatus, type ArtifactListQuery, type ArtifactLineageReference, type ArtifactLineageRelation, type ArtifactProvenance, type ArtifactPublication, type ArtifactPublishInput, type ArtifactRecord, type ArtifactRevision, type ArtifactRetentionCandidate, type ArtifactStatus, type ArtifactUpdateInput, type JsonObject, type JsonPrimitive, type JsonValue, } from "./types";
17
+ export { ARTIFACT_STATUSES, ARTIFACT_EVENT_TYPES, ArtifactError, isJsonValue, type ArtifactAssetReference, type ArtifactAssetRole, type ArtifactAssetWriteInput, type ArtifactBatchCommitMode, type ArtifactBatchCompletionReceipt, type ArtifactBatchCreateInput, type ArtifactBatchItemInput, type ArtifactBatchReceiptItem, type ArtifactBatchValidationIssue, type ArtifactBatchValidationResult, type ArtifactBatchValidator, type ArtifactBundleCreateInput, type ArtifactCapability, type ArtifactCreateInput, type ArtifactErrorCode, type ArtifactEvent, type ArtifactEventQuery, type ArtifactEventType, type ArtifactEvidenceReference, type ArtifactGarbageCollectionResult, type ArtifactIndexingState, type ArtifactIndexingStatus, type ArtifactListQuery, type ArtifactLineageReference, type ArtifactLineageRelation, type ArtifactProvenance, type ArtifactPublication, type ArtifactPublishInput, type ArtifactRecord, type ArtifactRevision, type ArtifactRetentionCandidate, type ArtifactStatus, type ArtifactUpdateInput, type JsonObject, type JsonPrimitive, type JsonValue, type StagedArtifactBatch, } from "./types";
@@ -9,6 +9,9 @@ export declare const manifest: Omit<import("@absolutejs/manifest").PackageManife
9
9
  }) => Promise<import("./types").ArtifactGarbageCollectionResult>;
10
10
  create: (ownerId: string, input: import("./types").ArtifactCreateInput) => Promise<import("./types").ArtifactRecord>;
11
11
  createBundle: (ownerId: string, input: import("./types").ArtifactBundleCreateInput) => Promise<import("./types").ArtifactRecord>;
12
+ stageBatch: (ownerId: string, input: import("./types").ArtifactBatchCreateInput, stageOptions?: {
13
+ validators?: import("./types").ArtifactBatchValidator[];
14
+ }) => Promise<import("./types").StagedArtifactBatch>;
12
15
  detach: (ownerId: string, artifactId: string, assetId: string, expectedRevision?: number) => Promise<import("./types").ArtifactRecord>;
13
16
  get: (ownerId: string, artifactId: string) => Promise<import("./types").ArtifactRecord>;
14
17
  getIndexingState: (ownerId: string, artifactId: string) => Promise<import("./types").ArtifactIndexingState | null>;
@@ -44,6 +47,9 @@ export declare const manifest: Omit<import("@absolutejs/manifest").PackageManife
44
47
  }) => Promise<import("./types").ArtifactGarbageCollectionResult>;
45
48
  create: (ownerId: string, input: import("./types").ArtifactCreateInput) => Promise<import("./types").ArtifactRecord>;
46
49
  createBundle: (ownerId: string, input: import("./types").ArtifactBundleCreateInput) => Promise<import("./types").ArtifactRecord>;
50
+ stageBatch: (ownerId: string, input: import("./types").ArtifactBatchCreateInput, stageOptions?: {
51
+ validators?: import("./types").ArtifactBatchValidator[];
52
+ }) => Promise<import("./types").StagedArtifactBatch>;
47
53
  detach: (ownerId: string, artifactId: string, assetId: string, expectedRevision?: number) => Promise<import("./types").ArtifactRecord>;
48
54
  get: (ownerId: string, artifactId: string) => Promise<import("./types").ArtifactRecord>;
49
55
  getIndexingState: (ownerId: string, artifactId: string) => Promise<import("./types").ArtifactIndexingState | null>;
@@ -80,6 +86,9 @@ export declare const manifest: Omit<import("@absolutejs/manifest").PackageManife
80
86
  }) => Promise<import("./types").ArtifactGarbageCollectionResult>;
81
87
  create: (ownerId: string, input: import("./types").ArtifactCreateInput) => Promise<import("./types").ArtifactRecord>;
82
88
  createBundle: (ownerId: string, input: import("./types").ArtifactBundleCreateInput) => Promise<import("./types").ArtifactRecord>;
89
+ stageBatch: (ownerId: string, input: import("./types").ArtifactBatchCreateInput, stageOptions?: {
90
+ validators?: import("./types").ArtifactBatchValidator[];
91
+ }) => Promise<import("./types").StagedArtifactBatch>;
83
92
  detach: (ownerId: string, artifactId: string, assetId: string, expectedRevision?: number) => Promise<import("./types").ArtifactRecord>;
84
93
  get: (ownerId: string, artifactId: string) => Promise<import("./types").ArtifactRecord>;
85
94
  getIndexingState: (ownerId: string, artifactId: string) => Promise<import("./types").ArtifactIndexingState | null>;
package/dist/src/rag.d.ts CHANGED
@@ -26,21 +26,39 @@ export type ArtifactRAGIndexStateWriter = {
26
26
  documentIds?: string[];
27
27
  error?: string;
28
28
  revision: number;
29
- status: "failed" | "indexed" | "pending" | "stale";
29
+ status: "failed" | "indexed" | "partial" | "pending" | "stale";
30
30
  }): Promise<unknown>;
31
31
  };
32
+ export type ArtifactRAGIndexFailure = {
33
+ contentType: string;
34
+ error: string;
35
+ name: string;
36
+ source: string;
37
+ };
38
+ export type ArtifactRAGIndexReceipt = {
39
+ artifactId: string;
40
+ documentIds: string[];
41
+ failures: ArtifactRAGIndexFailure[];
42
+ indexedUploads: number;
43
+ revision: number;
44
+ status: "failed" | "indexed" | "partial";
45
+ totalUploads: number;
46
+ };
47
+ export declare class ArtifactRAGPartialIndexError extends Error {
48
+ readonly receipt: ArtifactRAGIndexReceipt;
49
+ constructor(receipt: ArtifactRAGIndexReceipt);
50
+ }
32
51
  /**
33
52
  * Resolve an artifact revision into upload inputs accepted by @absolutejs/rag.
34
53
  * Storage URIs remain opaque; only the supplied reader is allowed to access bytes.
35
54
  */
36
55
  export declare const artifactToRAGUploads: (artifact: ArtifactRecord, reader: ArtifactRAGAssetReader, options?: ArtifactRAGUploadOptions) => Promise<RAGDocumentUploadInput[]>;
37
56
  export declare const createArtifactRAGIndexCoordinator: (options: {
57
+ failureMode?: "fail_fast" | "isolate_uploads";
38
58
  reader: ArtifactRAGAssetReader;
39
59
  service: ArtifactRAGIndexStateWriter;
40
60
  target: ArtifactRAGIndexTarget;
41
61
  }) => {
42
- index: (artifact: ArtifactRecord) => Promise<{
43
- documentIds: string[];
44
- }>;
62
+ index: (artifact: ArtifactRecord) => Promise<ArtifactRAGIndexReceipt>;
45
63
  };
46
64
  export type ArtifactRAGIndexCoordinator = ReturnType<typeof createArtifactRAGIndexCoordinator>;
@@ -1,6 +1,6 @@
1
1
  import type { ArtifactKindDefinitions, ArtifactRegistry } from "./registry";
2
2
  import type { ArtifactAssetStore, ArtifactStore } from "./store";
3
- import { type ArtifactAssetReference, type ArtifactAssetWriteInput, type ArtifactBundleCreateInput, type ArtifactCreateInput, type ArtifactEvent, type ArtifactEventQuery, type ArtifactGarbageCollectionResult, type ArtifactIndexingState, type ArtifactIndexingStatus, type ArtifactListQuery, type ArtifactPublishInput, type ArtifactRecord, type ArtifactUpdateInput } from "./types";
3
+ import { type ArtifactAssetReference, type ArtifactAssetWriteInput, type ArtifactBatchCreateInput, type ArtifactBatchValidator, type ArtifactBundleCreateInput, type ArtifactCreateInput, type ArtifactEvent, type ArtifactEventQuery, type ArtifactGarbageCollectionResult, type ArtifactIndexingState, type ArtifactIndexingStatus, type ArtifactListQuery, type ArtifactPublishInput, type ArtifactRecord, type ArtifactUpdateInput, type StagedArtifactBatch } from "./types";
4
4
  export type ArtifactPublisher = {
5
5
  publish(artifact: ArtifactRecord, options: {
6
6
  idempotencyKey: string;
@@ -16,6 +16,7 @@ export type ArtifactPublisher = {
16
16
  };
17
17
  export type ArtifactServiceOptions<TDefinitions extends ArtifactKindDefinitions = ArtifactKindDefinitions> = {
18
18
  assetStore?: ArtifactAssetStore;
19
+ batchIdFactory?: () => string;
19
20
  clock?: () => Date;
20
21
  eventIdFactory?: () => string;
21
22
  idFactory?: () => string;
@@ -34,6 +35,9 @@ export declare const createArtifactService: <TDefinitions extends ArtifactKindDe
34
35
  }) => Promise<ArtifactGarbageCollectionResult>;
35
36
  create: (ownerId: string, input: ArtifactCreateInput) => Promise<ArtifactRecord>;
36
37
  createBundle: (ownerId: string, input: ArtifactBundleCreateInput) => Promise<ArtifactRecord>;
38
+ stageBatch: (ownerId: string, input: ArtifactBatchCreateInput, stageOptions?: {
39
+ validators?: ArtifactBatchValidator[];
40
+ }) => Promise<StagedArtifactBatch>;
37
41
  detach: (ownerId: string, artifactId: string, assetId: string, expectedRevision?: number) => Promise<ArtifactRecord>;
38
42
  get: (ownerId: string, artifactId: string) => Promise<ArtifactRecord>;
39
43
  getIndexingState: (ownerId: string, artifactId: string) => Promise<ArtifactIndexingState | null>;
@@ -22,6 +22,11 @@ export type ArtifactAssetStore = {
22
22
  export type ArtifactStore = {
23
23
  /** Persist the current record and its first immutable revision atomically. */
24
24
  create(record: ArtifactRecord, events?: ArtifactEvent[]): Promise<void>;
25
+ /** Persist multiple records, first revisions, and events in one transaction. */
26
+ createBatch?(entries: Array<{
27
+ events?: ArtifactEvent[];
28
+ record: ArtifactRecord;
29
+ }>): Promise<void>;
25
30
  getIndexingState(ownerId: string, artifactId: string): Promise<ArtifactIndexingState | null>;
26
31
  get(ownerId: string, artifactId: string): Promise<ArtifactRecord | null>;
27
32
  getRevision(ownerId: string, artifactId: string, revision: number): Promise<ArtifactRevision | null>;
@@ -8,12 +8,20 @@ export declare function isJsonValue(value: unknown): value is JsonValue;
8
8
  export type ArtifactStatus = (typeof ARTIFACT_STATUSES)[number];
9
9
  export type ArtifactCapability = "attach" | "archive" | "edit" | "export" | "preview" | "publish" | "refine";
10
10
  export type ArtifactProvenance = {
11
+ evidence?: ArtifactEvidenceReference[];
11
12
  lineage?: ArtifactLineageReference[];
12
13
  model?: string;
13
14
  sourceIds?: string[];
14
15
  tool?: string;
15
16
  traceId?: string;
16
17
  };
18
+ export type ArtifactEvidenceReference = {
19
+ capturedAt?: string;
20
+ excerpt?: string;
21
+ metadata?: JsonObject;
22
+ sourceId?: string;
23
+ sourceUrl?: string;
24
+ };
17
25
  export type ArtifactLineageRelation = "derived_from" | "generated_from" | "references" | "replaces";
18
26
  export type ArtifactLineageReference = {
19
27
  artifactId?: string;
@@ -86,7 +94,7 @@ export type ArtifactEventQuery = {
86
94
  processed?: boolean;
87
95
  type?: ArtifactEventType;
88
96
  };
89
- export type ArtifactIndexingStatus = "failed" | "indexed" | "pending" | "stale";
97
+ export type ArtifactIndexingStatus = "failed" | "indexed" | "partial" | "pending" | "stale";
90
98
  export type ArtifactIndexingState = {
91
99
  artifactId: string;
92
100
  documentIds: string[];
@@ -122,6 +130,78 @@ export type ArtifactUpdateInput = {
122
130
  export type ArtifactBundleCreateInput = Omit<ArtifactCreateInput, "assets"> & {
123
131
  assets?: ArtifactAssetWriteInput[];
124
132
  };
133
+ export type ArtifactBatchItemInput = {
134
+ artifact: ArtifactBundleCreateInput;
135
+ evidence?: ArtifactEvidenceReference[];
136
+ /** Stable caller-defined key used to reconcile a receipt with requested output. */
137
+ key: string;
138
+ };
139
+ export type ArtifactBatchCommitMode = "archive_on_failure" | "require_atomic";
140
+ export type ArtifactBatchCreateInput = {
141
+ bundleId?: string;
142
+ commitMode?: ArtifactBatchCommitMode;
143
+ evidence?: ArtifactEvidenceReference[];
144
+ items: ArtifactBatchItemInput[];
145
+ metadata?: JsonObject;
146
+ provenance?: ArtifactProvenance;
147
+ };
148
+ export type ArtifactBatchValidationIssue = {
149
+ code: string;
150
+ itemKey?: string;
151
+ message: string;
152
+ path?: string;
153
+ };
154
+ export type ArtifactBatchValidationResult = {
155
+ issues?: never;
156
+ valid: true;
157
+ } | {
158
+ issues: ArtifactBatchValidationIssue[];
159
+ valid: false;
160
+ };
161
+ export type ArtifactBatchReceiptItem = {
162
+ artifactId: string;
163
+ archived?: boolean;
164
+ key: string;
165
+ kind: string;
166
+ revision: number;
167
+ title: string;
168
+ };
169
+ export type ArtifactBatchCompletionReceipt = {
170
+ archivedArtifactIds: string[];
171
+ atomic: boolean;
172
+ bundleId: string;
173
+ completedAt: string;
174
+ error?: string;
175
+ items: ArtifactBatchReceiptItem[];
176
+ ownerId: string;
177
+ stagedAt: string;
178
+ status: "committed" | "partial_failure" | "rolled_back";
179
+ validation: ArtifactBatchValidationResult;
180
+ };
181
+ export type ArtifactBatchValidator = (context: {
182
+ bundleId: string;
183
+ evidence: ArtifactEvidenceReference[];
184
+ items: ReadonlyArray<{
185
+ evidence: ArtifactEvidenceReference[];
186
+ key: string;
187
+ record: Readonly<ArtifactRecord>;
188
+ }>;
189
+ ownerId: string;
190
+ }) => ArtifactBatchValidationIssue[] | Promise<ArtifactBatchValidationIssue[]>;
191
+ export type StagedArtifactBatch = {
192
+ bundleId: string;
193
+ commit(): Promise<ArtifactBatchCompletionReceipt>;
194
+ evidence: ArtifactEvidenceReference[];
195
+ items: ReadonlyArray<{
196
+ evidence: ArtifactEvidenceReference[];
197
+ key: string;
198
+ record: Readonly<ArtifactRecord>;
199
+ }>;
200
+ ownerId: string;
201
+ rollback(reason?: string): Promise<ArtifactBatchCompletionReceipt>;
202
+ stagedAt: string;
203
+ validation: ArtifactBatchValidationResult;
204
+ };
125
205
  export type ArtifactPublishInput = {
126
206
  mode?: "live" | "pinned";
127
207
  };
@@ -133,7 +213,7 @@ export type ArtifactGarbageCollectionResult = {
133
213
  deleted: ArtifactAssetReference[];
134
214
  retained: ArtifactAssetReference[];
135
215
  };
136
- export type ArtifactErrorCode = "asset_store_unavailable" | "asset_transaction_unavailable" | "conflict" | "generator_unavailable" | "invalid_content" | "not_found" | "publisher_unavailable" | "renderer_unavailable" | "unsupported_capability" | "unknown_kind";
216
+ export type ArtifactErrorCode = "asset_store_unavailable" | "asset_transaction_unavailable" | "atomic_batch_unavailable" | "batch_validation_failed" | "conflict" | "generator_unavailable" | "invalid_content" | "not_found" | "publisher_unavailable" | "renderer_unavailable" | "unsupported_capability" | "unknown_kind";
137
217
  export declare class ArtifactError extends Error {
138
218
  readonly code: ArtifactErrorCode;
139
219
  constructor(code: ArtifactErrorCode, message: string);
@@ -0,0 +1,3 @@
1
+ import type { ArtifactGenerationResult, ArtifactGenerationValidationIssue } from "./generators";
2
+ /** Validate common generated download formats before an artifact is committed. */
3
+ export declare const validateGeneratedArtifactFormats: (result: ArtifactGenerationResult) => ArtifactGenerationValidationIssue[];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@absolutejs/artifacts",
3
- "version": "0.2.0",
3
+ "version": "0.3.0",
4
4
  "description": "Typed, versioned artifacts for AI products — schemas, lifecycle, storage, rendering, publishing, revisions, and agent tools without prescribing a database or host.",
5
5
  "author": "Alex Kahn",
6
6
  "license": "BUSL-1.1",
@@ -60,6 +60,7 @@
60
60
  "@absolutejs/manifest": "^0.10.0",
61
61
  "@sinclair/typebox": "^0.34.0",
62
62
  "drizzle-typebox": "1.0.0-beta.14-a36c63d",
63
+ "fflate": "^0.8.2",
63
64
  "typebox": "^1.3.16"
64
65
  },
65
66
  "peerDependencies": {