@absolutejs/artifacts 0.1.5 → 0.2.1

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.
@@ -27,12 +27,12 @@
27
27
  ],
28
28
  "properties": {
29
29
  "artifactId": {
30
- "minLength": 1,
31
- "type": "string"
30
+ "type": "string",
31
+ "minLength": 1
32
32
  },
33
33
  "ownerId": {
34
- "minLength": 1,
35
- "type": "string"
34
+ "type": "string",
35
+ "minLength": 1
36
36
  }
37
37
  }
38
38
  },
@@ -168,7 +168,7 @@
168
168
  ]
169
169
  },
170
170
  {
171
- "from": "@sinclair/typebox",
171
+ "from": "typebox",
172
172
  "names": [
173
173
  "Type"
174
174
  ]
@@ -208,12 +208,12 @@
208
208
  ],
209
209
  "properties": {
210
210
  "artifactId": {
211
- "minLength": 1,
212
- "type": "string"
211
+ "type": "string",
212
+ "minLength": 1
213
213
  },
214
214
  "ownerId": {
215
- "minLength": 1,
216
- "type": "string"
215
+ "type": "string",
216
+ "minLength": 1
217
217
  }
218
218
  }
219
219
  },
@@ -245,12 +245,12 @@
245
245
  ],
246
246
  "properties": {
247
247
  "kind": {
248
- "minLength": 1,
249
- "type": "string"
248
+ "type": "string",
249
+ "minLength": 1
250
250
  },
251
251
  "ownerId": {
252
- "minLength": 1,
253
- "type": "string"
252
+ "type": "string",
253
+ "minLength": 1
254
254
  }
255
255
  }
256
256
  },
@@ -284,12 +284,12 @@
284
284
  ],
285
285
  "properties": {
286
286
  "artifactId": {
287
- "minLength": 1,
288
- "type": "string"
287
+ "type": "string",
288
+ "minLength": 1
289
289
  },
290
290
  "ownerId": {
291
- "minLength": 1,
292
- "type": "string"
291
+ "type": "string",
292
+ "minLength": 1
293
293
  }
294
294
  }
295
295
  },
@@ -325,16 +325,16 @@
325
325
  ],
326
326
  "properties": {
327
327
  "artifactId": {
328
- "minLength": 1,
329
- "type": "string"
328
+ "type": "string",
329
+ "minLength": 1
330
330
  },
331
331
  "ownerId": {
332
- "minLength": 1,
333
- "type": "string"
332
+ "type": "string",
333
+ "minLength": 1
334
334
  },
335
335
  "revision": {
336
- "minimum": 1,
337
- "type": "integer"
336
+ "type": "integer",
337
+ "minimum": 1
338
338
  }
339
339
  }
340
340
  },
package/dist/rag.js CHANGED
@@ -75,6 +75,6 @@ var createArtifactRAGIndexCoordinator = (options) => ({
75
75
  }
76
76
  });
77
77
  export {
78
- createArtifactRAGIndexCoordinator,
79
- artifactToRAGUploads
78
+ artifactToRAGUploads,
79
+ createArtifactRAGIndexCoordinator
80
80
  };
@@ -13,4 +13,4 @@ export { createArtifactRendererRegistry, type ArtifactRenderer, type ArtifactRen
13
13
  export { createArtifactService, type ArtifactPublisher, type ArtifactService, type ArtifactServiceOptions, } from "./service";
14
14
  export { createMemoryArtifactStore, createMemoryArtifactAssetStore, type ArtifactAssetStore, type ArtifactAssetTransaction, type ArtifactStore, } from "./store";
15
15
  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";
16
+ 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";
@@ -1,3 +1,4 @@
1
+ import { Type } from "typebox";
1
2
  export declare const manifest: Omit<import("@absolutejs/manifest").PackageManifest<Record<string, never>, {
2
3
  archive: (ownerId: string, artifactId: string) => Promise<import("./types").ArtifactRecord>;
3
4
  attach: (ownerId: string, artifactId: string, input: import("./types").ArtifactAssetWriteInput, expectedRevision?: number) => Promise<import("./types").ArtifactRecord>;
@@ -8,6 +9,9 @@ export declare const manifest: Omit<import("@absolutejs/manifest").PackageManife
8
9
  }) => Promise<import("./types").ArtifactGarbageCollectionResult>;
9
10
  create: (ownerId: string, input: import("./types").ArtifactCreateInput) => Promise<import("./types").ArtifactRecord>;
10
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>;
11
15
  detach: (ownerId: string, artifactId: string, assetId: string, expectedRevision?: number) => Promise<import("./types").ArtifactRecord>;
12
16
  get: (ownerId: string, artifactId: string) => Promise<import("./types").ArtifactRecord>;
13
17
  getIndexingState: (ownerId: string, artifactId: string) => Promise<import("./types").ArtifactIndexingState | null>;
@@ -43,6 +47,9 @@ export declare const manifest: Omit<import("@absolutejs/manifest").PackageManife
43
47
  }) => Promise<import("./types").ArtifactGarbageCollectionResult>;
44
48
  create: (ownerId: string, input: import("./types").ArtifactCreateInput) => Promise<import("./types").ArtifactRecord>;
45
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>;
46
53
  detach: (ownerId: string, artifactId: string, assetId: string, expectedRevision?: number) => Promise<import("./types").ArtifactRecord>;
47
54
  get: (ownerId: string, artifactId: string) => Promise<import("./types").ArtifactRecord>;
48
55
  getIndexingState: (ownerId: string, artifactId: string) => Promise<import("./types").ArtifactIndexingState | null>;
@@ -79,6 +86,9 @@ export declare const manifest: Omit<import("@absolutejs/manifest").PackageManife
79
86
  }) => Promise<import("./types").ArtifactGarbageCollectionResult>;
80
87
  create: (ownerId: string, input: import("./types").ArtifactCreateInput) => Promise<import("./types").ArtifactRecord>;
81
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>;
82
92
  detach: (ownerId: string, artifactId: string, assetId: string, expectedRevision?: number) => Promise<import("./types").ArtifactRecord>;
83
93
  get: (ownerId: string, artifactId: string) => Promise<import("./types").ArtifactRecord>;
84
94
  getIndexingState: (ownerId: string, artifactId: string) => Promise<import("./types").ArtifactIndexingState | null>;
@@ -104,5 +114,5 @@ export declare const manifest: Omit<import("@absolutejs/manifest").PackageManife
104
114
  update: (ownerId: string, artifactId: string, input: import("./types").ArtifactUpdateInput) => Promise<import("./types").ArtifactRecord>;
105
115
  }>> | undefined;
106
116
  }) & {
107
- settings: import("@sinclair/typebox").TObject<{}>;
117
+ settings: Type.TObject<{}>;
108
118
  });
@@ -1,4 +1,4 @@
1
- import type { Static, TSchema } from "@sinclair/typebox";
1
+ import type { Static, TSchema } from "typebox";
2
2
  import { type ArtifactCapability, type JsonValue } from "./types";
3
3
  export type ArtifactAssetPolicy = {
4
4
  /** Exact media types or wildcards such as image/* and application/*. */
@@ -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>;
@@ -1,3 +1,4 @@
1
+ import { Type } from "typebox";
1
2
  export declare const standardArtifactDefinitions: {
2
3
  archive: {
3
4
  assets: {
@@ -5,10 +6,10 @@ export declare const standardArtifactDefinitions: {
5
6
  maxCount: number;
6
7
  };
7
8
  capabilities: ("attach" | "archive" | "edit" | "export" | "preview" | "refine")[];
8
- content: import("@sinclair/typebox").TObject<{
9
- description: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
10
- instructions: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
11
- summary: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
9
+ content: Type.TObject<{
10
+ description: Type.TOptional<Type.TString>;
11
+ instructions: Type.TOptional<Type.TString>;
12
+ summary: Type.TOptional<Type.TString>;
12
13
  }>;
13
14
  label: string;
14
15
  schemaVersion: number;
@@ -19,10 +20,10 @@ export declare const standardArtifactDefinitions: {
19
20
  maxCount: number;
20
21
  };
21
22
  capabilities: ("attach" | "archive" | "edit" | "export" | "preview" | "refine")[];
22
- content: import("@sinclair/typebox").TObject<{
23
- description: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
24
- instructions: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
25
- summary: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
23
+ content: Type.TObject<{
24
+ description: Type.TOptional<Type.TString>;
25
+ instructions: Type.TOptional<Type.TString>;
26
+ summary: Type.TOptional<Type.TString>;
26
27
  }>;
27
28
  label: string;
28
29
  schemaVersion: number;
@@ -33,10 +34,10 @@ export declare const standardArtifactDefinitions: {
33
34
  maxCount: number;
34
35
  };
35
36
  capabilities: ("attach" | "archive" | "edit" | "export" | "preview" | "refine")[];
36
- content: import("@sinclair/typebox").TObject<{
37
- description: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
38
- instructions: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
39
- summary: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
37
+ content: Type.TObject<{
38
+ description: Type.TOptional<Type.TString>;
39
+ instructions: Type.TOptional<Type.TString>;
40
+ summary: Type.TOptional<Type.TString>;
40
41
  }>;
41
42
  label: string;
42
43
  schemaVersion: number;
@@ -47,10 +48,10 @@ export declare const standardArtifactDefinitions: {
47
48
  maxCount: number;
48
49
  };
49
50
  capabilities: ("attach" | "archive" | "edit" | "export" | "preview" | "refine")[];
50
- content: import("@sinclair/typebox").TObject<{
51
- description: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
52
- instructions: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
53
- summary: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
51
+ content: Type.TObject<{
52
+ description: Type.TOptional<Type.TString>;
53
+ instructions: Type.TOptional<Type.TString>;
54
+ summary: Type.TOptional<Type.TString>;
54
55
  }>;
55
56
  label: string;
56
57
  schemaVersion: number;
@@ -61,10 +62,10 @@ export declare const standardArtifactDefinitions: {
61
62
  maxCount: number;
62
63
  };
63
64
  capabilities: ("attach" | "archive" | "edit" | "export" | "preview" | "refine")[];
64
- content: import("@sinclair/typebox").TObject<{
65
- description: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
66
- instructions: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
67
- summary: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
65
+ content: Type.TObject<{
66
+ description: Type.TOptional<Type.TString>;
67
+ instructions: Type.TOptional<Type.TString>;
68
+ summary: Type.TOptional<Type.TString>;
68
69
  }>;
69
70
  label: string;
70
71
  schemaVersion: number;
@@ -75,10 +76,10 @@ export declare const standardArtifactDefinitions: {
75
76
  maxCount: number;
76
77
  };
77
78
  capabilities: ("attach" | "archive" | "edit" | "export" | "preview" | "refine")[];
78
- content: import("@sinclair/typebox").TObject<{
79
- description: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
80
- instructions: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
81
- summary: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
79
+ content: Type.TObject<{
80
+ description: Type.TOptional<Type.TString>;
81
+ instructions: Type.TOptional<Type.TString>;
82
+ summary: Type.TOptional<Type.TString>;
82
83
  }>;
83
84
  label: string;
84
85
  schemaVersion: number;
@@ -89,10 +90,10 @@ export declare const standardArtifactDefinitions: {
89
90
  maxCount: number;
90
91
  };
91
92
  capabilities: ("attach" | "archive" | "edit" | "export" | "preview" | "refine")[];
92
- content: import("@sinclair/typebox").TObject<{
93
- description: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
94
- instructions: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
95
- summary: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
93
+ content: Type.TObject<{
94
+ description: Type.TOptional<Type.TString>;
95
+ instructions: Type.TOptional<Type.TString>;
96
+ summary: Type.TOptional<Type.TString>;
96
97
  }>;
97
98
  label: string;
98
99
  schemaVersion: number;
@@ -103,10 +104,10 @@ export declare const standardArtifactDefinitions: {
103
104
  maxCount: number;
104
105
  };
105
106
  capabilities: ("attach" | "archive" | "edit" | "export" | "preview" | "refine")[];
106
- content: import("@sinclair/typebox").TObject<{
107
- description: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
108
- instructions: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
109
- summary: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
107
+ content: Type.TObject<{
108
+ description: Type.TOptional<Type.TString>;
109
+ instructions: Type.TOptional<Type.TString>;
110
+ summary: Type.TOptional<Type.TString>;
110
111
  }>;
111
112
  label: string;
112
113
  schemaVersion: number;
@@ -117,10 +118,10 @@ export declare const standardArtifactDefinitions: {
117
118
  maxCount: number;
118
119
  };
119
120
  capabilities: ("attach" | "archive" | "edit" | "export" | "preview" | "refine")[];
120
- content: import("@sinclair/typebox").TObject<{
121
- description: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
122
- instructions: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
123
- summary: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
121
+ content: Type.TObject<{
122
+ description: Type.TOptional<Type.TString>;
123
+ instructions: Type.TOptional<Type.TString>;
124
+ summary: Type.TOptional<Type.TString>;
124
125
  }>;
125
126
  label: string;
126
127
  schemaVersion: number;
@@ -131,10 +132,10 @@ export declare const standardArtifactDefinitions: {
131
132
  maxCount: number;
132
133
  };
133
134
  capabilities: ("attach" | "archive" | "edit" | "export" | "preview" | "refine")[];
134
- content: import("@sinclair/typebox").TObject<{
135
- description: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
136
- instructions: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
137
- summary: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
135
+ content: Type.TObject<{
136
+ description: Type.TOptional<Type.TString>;
137
+ instructions: Type.TOptional<Type.TString>;
138
+ summary: Type.TOptional<Type.TString>;
138
139
  }>;
139
140
  label: string;
140
141
  schemaVersion: number;
@@ -145,10 +146,10 @@ export declare const standardArtifactDefinitions: {
145
146
  maxCount: number;
146
147
  };
147
148
  capabilities: ("attach" | "archive" | "edit" | "export" | "preview" | "refine")[];
148
- content: import("@sinclair/typebox").TObject<{
149
- description: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
150
- instructions: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
151
- summary: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
149
+ content: Type.TObject<{
150
+ description: Type.TOptional<Type.TString>;
151
+ instructions: Type.TOptional<Type.TString>;
152
+ summary: Type.TOptional<Type.TString>;
152
153
  }>;
153
154
  label: string;
154
155
  schemaVersion: number;
@@ -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>;
@@ -1,4 +1,4 @@
1
- import { type TSchema } from "@sinclair/typebox";
1
+ import { type TSchema } from "typebox";
2
2
  import type { ArtifactService } from "./service";
3
3
  export type ArtifactToolDefinition = {
4
4
  annotations?: {
@@ -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;
@@ -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);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@absolutejs/artifacts",
3
- "version": "0.1.5",
3
+ "version": "0.2.1",
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",
@@ -21,7 +21,7 @@
21
21
  "url": "https://github.com/absolutejs/artifacts/issues"
22
22
  },
23
23
  "scripts": {
24
- "build": "rm -rf dist && bun build src/index.ts src/drizzle.ts src/manifest.ts src/rag.ts --outdir dist --root ./src --target=bun --external @absolutejs/rag --external @sinclair/typebox --external @sinclair/typebox/value --external drizzle-orm --external 'drizzle-orm/*' --external drizzle-typebox && tsc --emitDeclarationOnly --project tsconfig.json && absolute-manifest emit",
24
+ "build": "rm -rf dist && bun build src/index.ts src/drizzle.ts src/manifest.ts src/rag.ts --outdir dist --root ./src --target=bun --external @absolutejs/rag --external @sinclair/typebox --external @sinclair/typebox/value --external typebox --external 'typebox/*' --external drizzle-orm --external 'drizzle-orm/*' --external drizzle-typebox && tsc --emitDeclarationOnly --project tsconfig.json && absolute-manifest emit",
25
25
  "format": "prettier --write \"./**/*.{ts,json,md}\"",
26
26
  "release": "bun run format && bun run test && bun run build && bun publish",
27
27
  "test": "bun test",
@@ -57,9 +57,10 @@
57
57
  }
58
58
  },
59
59
  "dependencies": {
60
- "@absolutejs/manifest": "^0.9.0",
60
+ "@absolutejs/manifest": "^0.10.0",
61
61
  "@sinclair/typebox": "^0.34.0",
62
- "drizzle-typebox": "1.0.0-beta.14-a36c63d"
62
+ "drizzle-typebox": "1.0.0-beta.14-a36c63d",
63
+ "typebox": "^1.3.16"
63
64
  },
64
65
  "peerDependencies": {
65
66
  "@absolutejs/rag": ">=0.1.1 <0.9.0",