@tangle-network/agent-app 0.60.54 → 0.60.55
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/assistant/index.js +5 -5
- package/dist/chat-react/index.js +1 -1
- package/dist/chat-routes/index.js +9 -9
- package/dist/chat-store/index.js +2 -2
- package/dist/{chunk-WKD4E52F.js → chunk-2YLSWZ5W.js} +4 -4
- package/dist/chunk-6DOQ6T2O.js +227 -0
- package/dist/chunk-6DOQ6T2O.js.map +1 -0
- package/dist/{chunk-EE7SZFS2.js → chunk-6LPQRKH7.js} +2 -2
- package/dist/{chunk-JSDTYUKF.js → chunk-CZ7KLS7N.js} +12 -12
- package/dist/object-store/index.js +11 -213
- package/dist/object-store/index.js.map +1 -1
- package/dist/public-consultation/index.js +6 -6
- package/dist/stream/index.js +17 -17
- package/dist/teams/invitations-api.js +3 -3
- package/dist/web-react/index.js +8 -8
- package/dist/workspace-export/checksum.d.ts +15 -0
- package/dist/workspace-export/d1.d.ts +56 -0
- package/dist/workspace-export/engine.d.ts +51 -0
- package/dist/workspace-export/index.d.ts +16 -0
- package/dist/workspace-export/index.js +1438 -0
- package/dist/workspace-export/index.js.map +1 -0
- package/dist/workspace-export/react.d.ts +16 -0
- package/dist/workspace-export/react.js +158 -0
- package/dist/workspace-export/react.js.map +1 -0
- package/dist/workspace-export/routes.d.ts +53 -0
- package/dist/workspace-export/secrets.d.ts +41 -0
- package/dist/workspace-export/sources.d.ts +59 -0
- package/dist/workspace-export/storage.d.ts +59 -0
- package/dist/workspace-export/tar.d.ts +14 -0
- package/dist/workspace-export/types.d.ts +136 -0
- package/dist/workspace-export/zip.d.ts +26 -0
- package/package.json +11 -1
- /package/dist/{chunk-WKD4E52F.js.map → chunk-2YLSWZ5W.js.map} +0 -0
- /package/dist/{chunk-EE7SZFS2.js.map → chunk-6LPQRKH7.js.map} +0 -0
- /package/dist/{chunk-JSDTYUKF.js.map → chunk-CZ7KLS7N.js.map} +0 -0
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Where an export keeps its pieces until download. Each entry is written as
|
|
3
|
+
* bounded segments so nothing larger than one segment is ever held in memory,
|
|
4
|
+
* and the job record is updated with a compare-and-swap so two tabs advancing
|
|
5
|
+
* the same export cannot both run it.
|
|
6
|
+
*/
|
|
7
|
+
export interface ExportStorage {
|
|
8
|
+
/** `ifMatch` makes the write conditional; a lost race returns `null`. */
|
|
9
|
+
put(key: string, body: Uint8Array, options?: {
|
|
10
|
+
ifMatch?: string;
|
|
11
|
+
}): Promise<{
|
|
12
|
+
etag: string;
|
|
13
|
+
} | null>;
|
|
14
|
+
get(key: string): Promise<{
|
|
15
|
+
body: ReadableStream<Uint8Array>;
|
|
16
|
+
size: number;
|
|
17
|
+
etag: string;
|
|
18
|
+
} | null>;
|
|
19
|
+
list(prefix: string, cursor?: string): Promise<{
|
|
20
|
+
keys: string[];
|
|
21
|
+
cursor?: string;
|
|
22
|
+
}>;
|
|
23
|
+
delete(keys: string[]): Promise<void>;
|
|
24
|
+
}
|
|
25
|
+
/** The slice of Cloudflare's `R2Bucket` used here; a real binding satisfies it. */
|
|
26
|
+
export interface R2ExportBucket {
|
|
27
|
+
put(key: string, value: Uint8Array, options?: {
|
|
28
|
+
onlyIf?: {
|
|
29
|
+
etagMatches?: string;
|
|
30
|
+
};
|
|
31
|
+
httpMetadata?: {
|
|
32
|
+
contentType?: string;
|
|
33
|
+
};
|
|
34
|
+
}): Promise<{
|
|
35
|
+
etag: string;
|
|
36
|
+
} | null>;
|
|
37
|
+
get(key: string): Promise<{
|
|
38
|
+
body: ReadableStream<Uint8Array>;
|
|
39
|
+
size: number;
|
|
40
|
+
etag: string;
|
|
41
|
+
} | null>;
|
|
42
|
+
list(options: {
|
|
43
|
+
prefix: string;
|
|
44
|
+
cursor?: string;
|
|
45
|
+
limit?: number;
|
|
46
|
+
}): Promise<{
|
|
47
|
+
objects: {
|
|
48
|
+
key: string;
|
|
49
|
+
}[];
|
|
50
|
+
truncated: boolean;
|
|
51
|
+
cursor?: string;
|
|
52
|
+
}>;
|
|
53
|
+
delete(keys: string | string[]): Promise<void>;
|
|
54
|
+
}
|
|
55
|
+
export declare function createR2ExportStorage(bucket: R2ExportBucket): ExportStorage;
|
|
56
|
+
/** An in-memory store for tests and local runs. */
|
|
57
|
+
export declare function createMemoryExportStorage(): ExportStorage & {
|
|
58
|
+
objects: Map<string, Uint8Array>;
|
|
59
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Reads an uncompressed tar stream in flight without changing its length.
|
|
3
|
+
*
|
|
4
|
+
* It counts members for the manifest and overwrites the contents of known
|
|
5
|
+
* credential files (see `isCredentialFile`) with `*`, so the archive stays a
|
|
6
|
+
* valid tar that still shows the file existed. Handles ustar prefixes, GNU long
|
|
7
|
+
* names (`L`) and pax `path=` records.
|
|
8
|
+
*/
|
|
9
|
+
export interface TarStats {
|
|
10
|
+
files: number;
|
|
11
|
+
bytes: number;
|
|
12
|
+
blanked: string[];
|
|
13
|
+
}
|
|
14
|
+
export declare function createTarInspector(stats: TarStats): TransformStream<Uint8Array, Uint8Array>;
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
/** Public contracts for `/workspace-export`. */
|
|
2
|
+
/** What kind of customer data a source holds. The manifest groups files by class. */
|
|
3
|
+
export type ExportDataClass = 'workspace' | 'people' | 'conversations' | 'traces' | 'files' | 'knowledge' | 'connections' | 'sandbox' | 'lines' | 'ledgers' | 'billing' | 'records';
|
|
4
|
+
export type ExportRow = Record<string, unknown>;
|
|
5
|
+
interface SourceBase {
|
|
6
|
+
/** Unique within the export; becomes the archive path. `[a-z0-9_.-]`, no slashes. */
|
|
7
|
+
name: string;
|
|
8
|
+
dataClass: ExportDataClass;
|
|
9
|
+
/** One line for the manifest, e.g. which table or prefix this reads. */
|
|
10
|
+
description?: string;
|
|
11
|
+
}
|
|
12
|
+
/** Rows written as NDJSON to `data/<name>.ndjson`. */
|
|
13
|
+
export interface ExportRowsSource extends SourceBase {
|
|
14
|
+
kind: 'rows';
|
|
15
|
+
/** Yield rows or pages of rows. Products decrypt their own encrypted columns here. */
|
|
16
|
+
rows(): AsyncIterable<ExportRow | ExportRow[]>;
|
|
17
|
+
/** The count the database reports, recorded beside the written count. */
|
|
18
|
+
expectedCount?(): Promise<number>;
|
|
19
|
+
/** Columns dropped entirely, in addition to the automatic credential-name policy. */
|
|
20
|
+
omitColumns?: readonly string[];
|
|
21
|
+
}
|
|
22
|
+
export interface ExportFile {
|
|
23
|
+
/** Path under `files/<source>/`. Leading slashes and `..` are removed. */
|
|
24
|
+
path: string;
|
|
25
|
+
/** Bytes, text, a stream, or `null` when the file vanished since listing. */
|
|
26
|
+
open(): Promise<ReadableStream<Uint8Array> | Uint8Array | string | null>;
|
|
27
|
+
}
|
|
28
|
+
/** Individual files written under `files/<name>/`. */
|
|
29
|
+
export interface ExportFilesSource extends SourceBase {
|
|
30
|
+
kind: 'files';
|
|
31
|
+
files(): AsyncIterable<ExportFile>;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* A gzip-compressed tar, normally a sandbox workspace read through the Sandbox
|
|
35
|
+
* SDK (`box.fs.openArchive(dir)`). Written to `sandbox/<name>.tar.gz` after
|
|
36
|
+
* credential files are blanked and credential values masked.
|
|
37
|
+
*/
|
|
38
|
+
export interface ExportArchiveSource extends SourceBase {
|
|
39
|
+
kind: 'archive';
|
|
40
|
+
/** `null` when there is nothing to archive (no sandbox for this workspace). */
|
|
41
|
+
open(): Promise<ReadableStream<Uint8Array> | null>;
|
|
42
|
+
}
|
|
43
|
+
/** One JSON document written to `data/<name>.json`. */
|
|
44
|
+
export interface ExportJsonSource extends SourceBase {
|
|
45
|
+
kind: 'json';
|
|
46
|
+
value(): Promise<unknown>;
|
|
47
|
+
}
|
|
48
|
+
export type ExportSource = ExportRowsSource | ExportFilesSource | ExportArchiveSource | ExportJsonSource;
|
|
49
|
+
export interface ExportPlan {
|
|
50
|
+
sources: ExportSource[];
|
|
51
|
+
/** Extra manifest sections, such as database table coverage. Redacted like rows. */
|
|
52
|
+
notes?: Record<string, unknown>;
|
|
53
|
+
}
|
|
54
|
+
/** Who asked. `role` must be `'owner'`; anything else is refused. */
|
|
55
|
+
export interface ExportPrincipal {
|
|
56
|
+
userId: string;
|
|
57
|
+
role: string;
|
|
58
|
+
}
|
|
59
|
+
export interface StoredEntry {
|
|
60
|
+
/** Path inside the archive. */
|
|
61
|
+
path: string;
|
|
62
|
+
method: 0 | 8;
|
|
63
|
+
crc32: number;
|
|
64
|
+
sha256: string;
|
|
65
|
+
size: number;
|
|
66
|
+
compressedSize: number;
|
|
67
|
+
segments: {
|
|
68
|
+
key: string;
|
|
69
|
+
size: number;
|
|
70
|
+
}[];
|
|
71
|
+
}
|
|
72
|
+
export type UnitStatus = 'pending' | 'done' | 'empty' | 'failed';
|
|
73
|
+
export interface ExportUnit {
|
|
74
|
+
name: string;
|
|
75
|
+
kind: ExportSource['kind'];
|
|
76
|
+
dataClass: ExportDataClass;
|
|
77
|
+
description?: string;
|
|
78
|
+
status: UnitStatus;
|
|
79
|
+
attempts: number;
|
|
80
|
+
entries: StoredEntry[];
|
|
81
|
+
rows?: number;
|
|
82
|
+
expectedRows?: number;
|
|
83
|
+
files?: number;
|
|
84
|
+
/** Members and bytes inside a sandbox archive. */
|
|
85
|
+
archive?: {
|
|
86
|
+
files: number;
|
|
87
|
+
bytes: number;
|
|
88
|
+
blanked: string[];
|
|
89
|
+
};
|
|
90
|
+
redactions: number;
|
|
91
|
+
error?: string;
|
|
92
|
+
}
|
|
93
|
+
export type ExportStatus = 'running' | 'complete' | 'failed';
|
|
94
|
+
export interface ExportJob {
|
|
95
|
+
v: 1;
|
|
96
|
+
id: string;
|
|
97
|
+
workspaceId: string;
|
|
98
|
+
requestedBy: string;
|
|
99
|
+
createdAt: string;
|
|
100
|
+
updatedAt: string;
|
|
101
|
+
completedAt?: string;
|
|
102
|
+
status: ExportStatus;
|
|
103
|
+
error?: string;
|
|
104
|
+
units: ExportUnit[];
|
|
105
|
+
/** manifest.json and README.txt, written when every unit finished. */
|
|
106
|
+
meta?: StoredEntry[];
|
|
107
|
+
lease?: {
|
|
108
|
+
id: string;
|
|
109
|
+
until: number;
|
|
110
|
+
};
|
|
111
|
+
}
|
|
112
|
+
/** What the progress endpoint returns. */
|
|
113
|
+
export interface ExportProgress {
|
|
114
|
+
id: string;
|
|
115
|
+
status: ExportStatus;
|
|
116
|
+
createdAt: string;
|
|
117
|
+
completedAt?: string;
|
|
118
|
+
error?: string;
|
|
119
|
+
unitsTotal: number;
|
|
120
|
+
unitsDone: number;
|
|
121
|
+
current?: string;
|
|
122
|
+
bytes: number;
|
|
123
|
+
units: {
|
|
124
|
+
name: string;
|
|
125
|
+
dataClass: ExportDataClass;
|
|
126
|
+
status: UnitStatus;
|
|
127
|
+
rows?: number;
|
|
128
|
+
files?: number;
|
|
129
|
+
bytes: number;
|
|
130
|
+
error?: string;
|
|
131
|
+
}[];
|
|
132
|
+
/** Signed, expiring link; present once the export is complete. */
|
|
133
|
+
downloadUrl?: string;
|
|
134
|
+
downloadExpiresAt?: string;
|
|
135
|
+
}
|
|
136
|
+
export {};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Streams a zip whose every entry was already written and measured.
|
|
3
|
+
*
|
|
4
|
+
* Because each entry's CRC-32 and sizes are known before the first byte goes
|
|
5
|
+
* out, local headers carry real values (no data descriptors) and the total
|
|
6
|
+
* length is exact, so the download response can send `Content-Length`. Zip64
|
|
7
|
+
* records are added only when a size, offset or entry count needs them, which
|
|
8
|
+
* keeps small archives readable by every unzip tool.
|
|
9
|
+
*/
|
|
10
|
+
export interface ZipEntrySpec {
|
|
11
|
+
/** Path inside the archive, `/`-separated, no leading slash. */
|
|
12
|
+
name: string;
|
|
13
|
+
/** 0 = stored, 8 = deflate. */
|
|
14
|
+
method: 0 | 8;
|
|
15
|
+
crc32: number;
|
|
16
|
+
/** Bytes `open()` yields (after compression for method 8). */
|
|
17
|
+
compressedSize: number;
|
|
18
|
+
uncompressedSize: number;
|
|
19
|
+
modifiedAt: Date;
|
|
20
|
+
open(): Promise<ReadableStream<Uint8Array>>;
|
|
21
|
+
}
|
|
22
|
+
/** Lay out the archive and return its exact byte length and body stream. */
|
|
23
|
+
export declare function createZipStream(entries: ZipEntrySpec[]): {
|
|
24
|
+
length: number;
|
|
25
|
+
stream: ReadableStream<Uint8Array>;
|
|
26
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tangle-network/agent-app",
|
|
3
|
-
"version": "0.60.
|
|
3
|
+
"version": "0.60.55",
|
|
4
4
|
"packageManager": "pnpm@11.24.0",
|
|
5
5
|
"description": "Build agent applications with typed chat, tools, sandboxes, integrations, billing, and evaluation.",
|
|
6
6
|
"keywords": [
|
|
@@ -211,6 +211,16 @@
|
|
|
211
211
|
"import": "./dist/forms/index.js",
|
|
212
212
|
"default": "./dist/forms/index.js"
|
|
213
213
|
},
|
|
214
|
+
"./workspace-export": {
|
|
215
|
+
"types": "./dist/workspace-export/index.d.ts",
|
|
216
|
+
"import": "./dist/workspace-export/index.js",
|
|
217
|
+
"default": "./dist/workspace-export/index.js"
|
|
218
|
+
},
|
|
219
|
+
"./workspace-export/react": {
|
|
220
|
+
"types": "./dist/workspace-export/react.d.ts",
|
|
221
|
+
"import": "./dist/workspace-export/react.js",
|
|
222
|
+
"default": "./dist/workspace-export/react.js"
|
|
223
|
+
},
|
|
214
224
|
"./object-store": {
|
|
215
225
|
"types": "./dist/object-store/index.d.ts",
|
|
216
226
|
"import": "./dist/object-store/index.js",
|
|
File without changes
|
|
File without changes
|
|
File without changes
|