openworkgraph 0.2.12
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/README.md +64 -0
- package/dist/api-image-agent.d.ts +32 -0
- package/dist/api-image-agent.js +132 -0
- package/dist/api-image-output.d.ts +8 -0
- package/dist/api-image-output.js +41 -0
- package/dist/api.d.ts +35 -0
- package/dist/api.js +153 -0
- package/dist/auth.d.ts +58 -0
- package/dist/auth.js +273 -0
- package/dist/backend/adapter.d.ts +35 -0
- package/dist/backend/adapter.js +439 -0
- package/dist/backend/capabilities.d.ts +23 -0
- package/dist/backend/capabilities.js +75 -0
- package/dist/backend/diagnostics.d.ts +9 -0
- package/dist/backend/diagnostics.js +80 -0
- package/dist/backend/index.d.ts +6 -0
- package/dist/backend/index.js +7 -0
- package/dist/backend/models.d.ts +15 -0
- package/dist/backend/models.js +43 -0
- package/dist/backend/paths.d.ts +6 -0
- package/dist/backend/paths.js +69 -0
- package/dist/backend/stdio.d.ts +66 -0
- package/dist/backend/stdio.js +172 -0
- package/dist/backend/types.d.ts +90 -0
- package/dist/backend/types.js +11 -0
- package/dist/backup-api.d.ts +10 -0
- package/dist/backup-api.js +40 -0
- package/dist/blob-store.d.ts +40 -0
- package/dist/blob-store.js +218 -0
- package/dist/cli-help.d.ts +1 -0
- package/dist/cli-help.js +63 -0
- package/dist/cli-output.d.ts +4 -0
- package/dist/cli-output.js +130 -0
- package/dist/cli.d.ts +2 -0
- package/dist/cli.js +284 -0
- package/dist/client-pairing.d.ts +8 -0
- package/dist/client-pairing.js +30 -0
- package/dist/directories.d.ts +14 -0
- package/dist/directories.js +34 -0
- package/dist/errors.d.ts +12 -0
- package/dist/errors.js +7 -0
- package/dist/events.d.ts +22 -0
- package/dist/events.js +155 -0
- package/dist/execution-chains.d.ts +24 -0
- package/dist/execution-chains.js +231 -0
- package/dist/execution-settings.d.ts +10 -0
- package/dist/execution-settings.js +38 -0
- package/dist/graph-document-history.d.ts +43 -0
- package/dist/graph-document-history.js +275 -0
- package/dist/graph-files.d.ts +14 -0
- package/dist/graph-files.js +59 -0
- package/dist/graph-transfer.d.ts +53 -0
- package/dist/graph-transfer.js +501 -0
- package/dist/graphs.d.ts +68 -0
- package/dist/graphs.js +771 -0
- package/dist/history.d.ts +20 -0
- package/dist/history.js +61 -0
- package/dist/http.d.ts +2 -0
- package/dist/http.js +42 -0
- package/dist/image-credentials.d.ts +11 -0
- package/dist/image-credentials.js +130 -0
- package/dist/image-providers.d.ts +51 -0
- package/dist/image-providers.js +271 -0
- package/dist/input-materialization.d.ts +17 -0
- package/dist/input-materialization.js +95 -0
- package/dist/inputs.d.ts +74 -0
- package/dist/inputs.js +301 -0
- package/dist/local-control.d.ts +13 -0
- package/dist/local-control.js +37 -0
- package/dist/network.d.ts +11 -0
- package/dist/network.js +48 -0
- package/dist/openai-image-driver.d.ts +42 -0
- package/dist/openai-image-driver.js +368 -0
- package/dist/operations/backups.d.ts +40 -0
- package/dist/operations/backups.js +391 -0
- package/dist/operations/capacity.d.ts +7 -0
- package/dist/operations/capacity.js +35 -0
- package/dist/operations/cli-context.d.ts +7 -0
- package/dist/operations/cli-context.js +58 -0
- package/dist/operations/daemon.d.ts +36 -0
- package/dist/operations/daemon.js +159 -0
- package/dist/operations/files.d.ts +12 -0
- package/dist/operations/files.js +84 -0
- package/dist/operations/lifecycle.d.ts +28 -0
- package/dist/operations/lifecycle.js +155 -0
- package/dist/operations/local-admin.d.ts +6 -0
- package/dist/operations/local-admin.js +38 -0
- package/dist/operations/logs.d.ts +16 -0
- package/dist/operations/logs.js +37 -0
- package/dist/operations/plugins.d.ts +10 -0
- package/dist/operations/plugins.js +11 -0
- package/dist/operations/snapshot-worker.d.ts +1 -0
- package/dist/operations/snapshot-worker.js +18 -0
- package/dist/operations/snapshot.d.ts +1 -0
- package/dist/operations/snapshot.js +14 -0
- package/dist/operations/update.d.ts +26 -0
- package/dist/operations/update.js +216 -0
- package/dist/persistence/asset-business-schema.d.ts +2 -0
- package/dist/persistence/asset-business-schema.js +36 -0
- package/dist/persistence/database.d.ts +7 -0
- package/dist/persistence/database.js +91 -0
- package/dist/persistence/plugin-schema.d.ts +9 -0
- package/dist/persistence/plugin-schema.js +38 -0
- package/dist/persistence/repositories.d.ts +20 -0
- package/dist/persistence/repositories.js +106 -0
- package/dist/persistence/resource-schema.d.ts +2 -0
- package/dist/persistence/resource-schema.js +44 -0
- package/dist/persistence/schema.d.ts +6 -0
- package/dist/persistence/schema.js +236 -0
- package/dist/persistence/workflow-schema.d.ts +2 -0
- package/dist/persistence/workflow-schema.js +19 -0
- package/dist/plugin-api.d.ts +10 -0
- package/dist/plugin-api.js +40 -0
- package/dist/plugin-management.d.ts +36 -0
- package/dist/plugin-management.js +112 -0
- package/dist/plugins.d.ts +55 -0
- package/dist/plugins.js +239 -0
- package/dist/project-discovery.d.ts +3 -0
- package/dist/project-discovery.js +57 -0
- package/dist/project-files-api.d.ts +16 -0
- package/dist/project-files-api.js +243 -0
- package/dist/project-files.d.ts +97 -0
- package/dist/project-files.js +557 -0
- package/dist/project-lock.d.ts +4 -0
- package/dist/project-lock.js +35 -0
- package/dist/project-probe-worker.d.ts +1 -0
- package/dist/project-probe-worker.js +17 -0
- package/dist/project-probe.d.ts +22 -0
- package/dist/project-probe.js +67 -0
- package/dist/projects.d.ts +29 -0
- package/dist/projects.js +219 -0
- package/dist/publication.d.ts +31 -0
- package/dist/publication.js +642 -0
- package/dist/resource-api.d.ts +15 -0
- package/dist/resource-api.js +256 -0
- package/dist/resources-orphans.d.ts +41 -0
- package/dist/resources-orphans.js +235 -0
- package/dist/resources.d.ts +246 -0
- package/dist/resources.js +714 -0
- package/dist/run-api.d.ts +10 -0
- package/dist/run-api.js +308 -0
- package/dist/run-context.d.ts +54 -0
- package/dist/run-context.js +137 -0
- package/dist/runs.d.ts +82 -0
- package/dist/runs.js +506 -0
- package/dist/runtime-backend.d.ts +24 -0
- package/dist/runtime-backend.js +214 -0
- package/dist/runtime.d.ts +97 -0
- package/dist/runtime.js +553 -0
- package/dist/scheduler.d.ts +85 -0
- package/dist/scheduler.js +344 -0
- package/dist/service.d.ts +29 -0
- package/dist/service.js +515 -0
- package/dist/skills-api.d.ts +18 -0
- package/dist/skills-api.js +120 -0
- package/dist/storage-api.d.ts +21 -0
- package/dist/storage-api.js +92 -0
- package/dist/transfer-api.d.ts +10 -0
- package/dist/transfer-api.js +60 -0
- package/dist/vendor/protocol/contracts.typecheck.d.ts +1 -0
- package/dist/vendor/protocol/contracts.typecheck.js +35 -0
- package/dist/vendor/protocol/execution-chain.d.ts +6 -0
- package/dist/vendor/protocol/execution-chain.js +26 -0
- package/dist/vendor/protocol/graph-binary.d.ts +15 -0
- package/dist/vendor/protocol/graph-binary.js +121 -0
- package/dist/vendor/protocol/graph-title.d.ts +2 -0
- package/dist/vendor/protocol/graph-title.js +23 -0
- package/dist/vendor/protocol/index.d.ts +617 -0
- package/dist/vendor/protocol/index.js +20 -0
- package/dist/vendor/protocol/pairing.d.ts +29 -0
- package/dist/vendor/protocol/pairing.js +71 -0
- package/dist/vendor/protocol/preview.d.ts +2 -0
- package/dist/vendor/protocol/preview.js +9 -0
- package/dist/vendor/protocol/resource-mime.d.ts +2 -0
- package/dist/vendor/protocol/resource-mime.js +35 -0
- package/dist/video-thumbnail.d.ts +2 -0
- package/dist/video-thumbnail.js +34 -0
- package/package.json +9 -0
|
@@ -0,0 +1,246 @@
|
|
|
1
|
+
import type { DatabaseSync } from 'node:sqlite';
|
|
2
|
+
import { BlobStore } from './blob-store.js';
|
|
3
|
+
import type { PreparedBlob } from './blob-store.js';
|
|
4
|
+
export interface ResourceScope {
|
|
5
|
+
projectId: string;
|
|
6
|
+
serviceId?: string;
|
|
7
|
+
}
|
|
8
|
+
export interface CanvasScope extends ResourceScope {
|
|
9
|
+
graphId: string;
|
|
10
|
+
}
|
|
11
|
+
export type LibraryTarget = ResourceScope & {
|
|
12
|
+
name: string;
|
|
13
|
+
} & ({
|
|
14
|
+
mode: 'new';
|
|
15
|
+
} | {
|
|
16
|
+
mode: 'update';
|
|
17
|
+
assetId: string;
|
|
18
|
+
expectedVersion: number;
|
|
19
|
+
});
|
|
20
|
+
export type UploadTarget = LibraryTarget | (CanvasScope & {
|
|
21
|
+
name: string;
|
|
22
|
+
mode: 'canvas';
|
|
23
|
+
});
|
|
24
|
+
export interface UploadStart extends ResourceScope {
|
|
25
|
+
name: string;
|
|
26
|
+
bytes: number;
|
|
27
|
+
mime: string;
|
|
28
|
+
sha256?: string;
|
|
29
|
+
}
|
|
30
|
+
export interface UploadStatus {
|
|
31
|
+
uploadId: string;
|
|
32
|
+
projectId: string;
|
|
33
|
+
name: string;
|
|
34
|
+
bytes: number;
|
|
35
|
+
received: number;
|
|
36
|
+
mime: string;
|
|
37
|
+
state: string;
|
|
38
|
+
sha256: string | null;
|
|
39
|
+
}
|
|
40
|
+
export interface PreparedAppend {
|
|
41
|
+
readonly uploadId: string;
|
|
42
|
+
readonly projectId: string;
|
|
43
|
+
readonly offset: number;
|
|
44
|
+
readonly bytes: number;
|
|
45
|
+
readonly sha256: string;
|
|
46
|
+
readonly path: string;
|
|
47
|
+
}
|
|
48
|
+
export interface PreparedFinish {
|
|
49
|
+
readonly uploadId: string;
|
|
50
|
+
readonly projectId: string;
|
|
51
|
+
readonly blob: PreparedBlob;
|
|
52
|
+
}
|
|
53
|
+
export interface ResourceVersion {
|
|
54
|
+
version: number;
|
|
55
|
+
sha256: string;
|
|
56
|
+
bytes: number;
|
|
57
|
+
mime: string;
|
|
58
|
+
state: 'ready';
|
|
59
|
+
representationVersion: number | null;
|
|
60
|
+
}
|
|
61
|
+
export interface LibraryAsset {
|
|
62
|
+
id: string;
|
|
63
|
+
projectId: string;
|
|
64
|
+
name: string;
|
|
65
|
+
shared: boolean;
|
|
66
|
+
deleted: boolean;
|
|
67
|
+
current: ResourceVersion & {
|
|
68
|
+
assetId: string;
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
export interface CanvasResource {
|
|
72
|
+
id: string;
|
|
73
|
+
projectId: string;
|
|
74
|
+
graphId: string;
|
|
75
|
+
name: string;
|
|
76
|
+
current: ResourceVersion & {
|
|
77
|
+
resourceId: string;
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
export interface CanvasCreated {
|
|
81
|
+
resource: CanvasResource;
|
|
82
|
+
referenceId: string;
|
|
83
|
+
}
|
|
84
|
+
export declare const IMAGE_THUMBNAIL_LEVELS: readonly [320, 640, 1280, 2560, 4096];
|
|
85
|
+
/** All commit methods require the caller's synchronous authenticated transaction. */
|
|
86
|
+
export declare class Resources {
|
|
87
|
+
readonly db: DatabaseSync;
|
|
88
|
+
readonly blobs: BlobStore;
|
|
89
|
+
readonly now: () => number;
|
|
90
|
+
private readonly appends;
|
|
91
|
+
private readonly finishes;
|
|
92
|
+
private readonly videoFrames;
|
|
93
|
+
constructor(db: DatabaseSync, blobs: BlobStore, options?: {
|
|
94
|
+
now?: () => number;
|
|
95
|
+
});
|
|
96
|
+
private tx;
|
|
97
|
+
private outside;
|
|
98
|
+
private project;
|
|
99
|
+
private graph;
|
|
100
|
+
private writable;
|
|
101
|
+
private writableGraph;
|
|
102
|
+
private event;
|
|
103
|
+
startUpload(request: UploadStart): UploadStatus;
|
|
104
|
+
uploadStatus(scope: ResourceScope, uploadId: string): UploadStatus;
|
|
105
|
+
prepareAppend(scope: ResourceScope, uploadId: string, offset: number, bytes: Uint8Array): Promise<PreparedAppend>;
|
|
106
|
+
commitAppend(scope: ResourceScope, prepared: PreparedAppend): UploadStatus;
|
|
107
|
+
prepareFinish(scope: ResourceScope, uploadId: string): Promise<PreparedFinish>;
|
|
108
|
+
prepareBytes(bytes: Uint8Array, mime?: string, sha256?: string): Promise<PreparedBlob>;
|
|
109
|
+
prepareProjectFile(scope: ResourceScope, path: string, mime?: string): Promise<PreparedBlob>;
|
|
110
|
+
private register;
|
|
111
|
+
private queueFile;
|
|
112
|
+
/** Explicit cleanup of a known failed preparation; never scan unknown files.
|
|
113
|
+
* The permanent tombstone prevents any later commit from reusing this path. */
|
|
114
|
+
discardPrepared(blob: PreparedBlob): boolean;
|
|
115
|
+
discardAppend(scope: ResourceScope, prepared: PreparedAppend): boolean;
|
|
116
|
+
cancelUpload(scope: ResourceScope, uploadId: string): void;
|
|
117
|
+
commitFinish(scope: ResourceScope, prepared: PreparedFinish, target: UploadTarget): LibraryAsset | CanvasCreated;
|
|
118
|
+
createLibraryFromPrepared(target: LibraryTarget, blob: PreparedBlob): LibraryAsset;
|
|
119
|
+
private libraryFromBlob;
|
|
120
|
+
createCanvasFromPrepared(scope: CanvasScope, blob: PreparedBlob, title: string): CanvasCreated;
|
|
121
|
+
private representationVersion;
|
|
122
|
+
/** Editing is separate from canvas upload (which always creates an identity).
|
|
123
|
+
* Existing node/history refs stay pinned; caller explicitly attaches the new hold. */
|
|
124
|
+
updateCanvasFromPrepared(scope: CanvasScope, resourceId: string, expectedVersion: number, blob: PreparedBlob, title?: string): CanvasCreated;
|
|
125
|
+
/** Trusted helper: caller authorizes source; never expose as a public hash API. */
|
|
126
|
+
createCanvasFromReadyBlob(scope: CanvasScope, sha256: string, mime: string, title: string): CanvasCreated;
|
|
127
|
+
holdCanvasResource(scope: CanvasScope, resourceId: string, version: number): string;
|
|
128
|
+
attachNodeReference(scope: CanvasScope, resourceId: string, version: number, nodeId: string, releaseGraphHold?: string): string;
|
|
129
|
+
releaseCanvasReference(scope: CanvasScope, referenceId: string): void;
|
|
130
|
+
/** Public temp-upload release cannot remove node/snapshot/history ownership. */
|
|
131
|
+
releaseGraphReference(scope: CanvasScope, referenceId: string): void;
|
|
132
|
+
/** Called after Graphs inserts node/history ownership, in the same transaction.
|
|
133
|
+
* Consume only the attached immutable version's temporary graph holds. */
|
|
134
|
+
consumeGraphHolds(scope: CanvasScope, resourceId: string, version: number): number;
|
|
135
|
+
copyAssetToCanvas(scope: CanvasScope, assetId: string, expectedAssetVersion: number): CanvasCreated;
|
|
136
|
+
/** Clipboard copies a pinned, authorized canvas version into a new identity.
|
|
137
|
+
* Never expose an arbitrary blob-hash copy API or resurrect a collected source. */
|
|
138
|
+
copyCanvasToCanvas(scope: CanvasScope, sourceGraphId: string, resourceId: string, version: number): CanvasCreated;
|
|
139
|
+
saveCanvasToLibrary(scope: CanvasScope, resourceId: string, expectedResourceVersion: number, title: string): LibraryAsset;
|
|
140
|
+
copyAssetToProject(scope: ResourceScope, assetId: string, expectedVersion: number, title?: string): LibraryAsset;
|
|
141
|
+
private version;
|
|
142
|
+
getAsset(scope: ResourceScope, id: string): LibraryAsset;
|
|
143
|
+
listAssets(scope: ResourceScope, options?: {
|
|
144
|
+
name?: string;
|
|
145
|
+
search?: string;
|
|
146
|
+
deleted?: boolean;
|
|
147
|
+
scope?: 'project' | 'shared' | 'available';
|
|
148
|
+
limit?: number;
|
|
149
|
+
offset?: number;
|
|
150
|
+
}): LibraryAsset[];
|
|
151
|
+
listSameNameAssets(scope: ResourceScope, title: string): LibraryAsset[];
|
|
152
|
+
setShared(scope: ResourceScope, id: string, shared: boolean): LibraryAsset;
|
|
153
|
+
emptyTrash(scope: ResourceScope): {
|
|
154
|
+
removed: number;
|
|
155
|
+
retained: number;
|
|
156
|
+
};
|
|
157
|
+
softDelete(scope: ResourceScope, id: string): LibraryAsset;
|
|
158
|
+
restore(scope: ResourceScope, id: string): LibraryAsset;
|
|
159
|
+
getCanvas(scope: CanvasScope, id: string): CanvasResource;
|
|
160
|
+
listCanvas(scope: CanvasScope): CanvasResource[];
|
|
161
|
+
readCanvasVersion(scope: CanvasScope, id: string, version: number): ResourceVersion;
|
|
162
|
+
readAssetVersion(scope: ResourceScope, id: string, version: number): ResourceVersion;
|
|
163
|
+
readContent(scope: ResourceScope | CanvasScope, kind: 'asset' | 'canvas', id: string, version: number, range?: {
|
|
164
|
+
start: number;
|
|
165
|
+
end?: number;
|
|
166
|
+
}): Promise<{
|
|
167
|
+
bytes: Buffer;
|
|
168
|
+
mime: string;
|
|
169
|
+
total: number;
|
|
170
|
+
start: number;
|
|
171
|
+
end: number;
|
|
172
|
+
}>;
|
|
173
|
+
thumbnail(scope: ResourceScope | CanvasScope, kind: 'asset' | 'canvas', id: string, version: number, size?: number): Promise<{
|
|
174
|
+
bytes: Buffer;
|
|
175
|
+
mime: string;
|
|
176
|
+
total: number;
|
|
177
|
+
start: number;
|
|
178
|
+
end: number;
|
|
179
|
+
cacheable?: boolean;
|
|
180
|
+
}>;
|
|
181
|
+
representation(scope: ResourceScope | CanvasScope, kind: 'asset' | 'canvas', id: string, version: number): Promise<{
|
|
182
|
+
state: 'ready' | 'unsupported';
|
|
183
|
+
processor: string;
|
|
184
|
+
version: number;
|
|
185
|
+
mime: string;
|
|
186
|
+
text: string | null;
|
|
187
|
+
reason: string | null;
|
|
188
|
+
}>;
|
|
189
|
+
/** DB-only resolver for InputPreparation; caller already selected a scoped version.
|
|
190
|
+
* No extraction or file I/O is performed in the snapshot transaction. */
|
|
191
|
+
readPreparedRepresentation(resource: {
|
|
192
|
+
resourceId: string;
|
|
193
|
+
version: number;
|
|
194
|
+
sha256: string;
|
|
195
|
+
mime: string;
|
|
196
|
+
bytes: number;
|
|
197
|
+
representationVersion: number | null;
|
|
198
|
+
}): {
|
|
199
|
+
state: 'ready' | 'failed';
|
|
200
|
+
resourceSha256: string;
|
|
201
|
+
representationVersion: number | null;
|
|
202
|
+
text: string | null;
|
|
203
|
+
contentHash: string | null;
|
|
204
|
+
} | null;
|
|
205
|
+
preview(scope: ResourceScope | CanvasScope, kind: 'asset' | 'canvas', id: string, version: number): Promise<{
|
|
206
|
+
state: 'ready' | 'unsupported';
|
|
207
|
+
processor: string;
|
|
208
|
+
version: number;
|
|
209
|
+
mime: string;
|
|
210
|
+
text: string | null;
|
|
211
|
+
reason: string | null;
|
|
212
|
+
} | {
|
|
213
|
+
state: 'ready';
|
|
214
|
+
processor: string;
|
|
215
|
+
version: number;
|
|
216
|
+
content: {
|
|
217
|
+
bytes: Buffer;
|
|
218
|
+
mime: string;
|
|
219
|
+
total: number;
|
|
220
|
+
start: number;
|
|
221
|
+
end: number;
|
|
222
|
+
};
|
|
223
|
+
}>;
|
|
224
|
+
/** Preserve exact ID/hash leaves in legacy snapshot JSON without rewriting it. */
|
|
225
|
+
private snapshotMentions;
|
|
226
|
+
/** Typed snapshots protect only their named identity; shared hashes protect bytes. */
|
|
227
|
+
private snapshotUnboundHash;
|
|
228
|
+
private assetReferenced;
|
|
229
|
+
private canvasReferenced;
|
|
230
|
+
collectGarbage(only?: {
|
|
231
|
+
graphId: string;
|
|
232
|
+
blobHashes: string[];
|
|
233
|
+
}, canvasOnly?: boolean): {
|
|
234
|
+
canvas: number;
|
|
235
|
+
assets: number;
|
|
236
|
+
blobs: number;
|
|
237
|
+
};
|
|
238
|
+
drainFileDeletions(): Promise<{
|
|
239
|
+
removed: number;
|
|
240
|
+
failed: number;
|
|
241
|
+
}>;
|
|
242
|
+
/** Global cross-connection GC barrier for online SQLite + immutable-file copies.
|
|
243
|
+
* Existing drains finish first; new drains and logical GC stop at the barrier.
|
|
244
|
+
* Crashed leases fail closed; only an exclusive offline owner may clear them. */
|
|
245
|
+
withBlobLease<T>(work: () => Promise<T>): Promise<T>;
|
|
246
|
+
}
|