@myagentroam/protocol 0.9.68 → 0.9.70
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/direct-transfer.d.ts +894 -123
- package/dist/direct-transfer.js +62 -33
- package/dist/enterprise.d.ts +4 -4
- package/dist/index.d.ts +444 -432
- package/package.json +1 -1
package/dist/direct-transfer.js
CHANGED
|
@@ -18,10 +18,11 @@ const sdpSchema = z
|
|
|
18
18
|
const candidateSchema = z.string().min(1).max(4096);
|
|
19
19
|
export const workspaceDirectTransferCapabilitySchema = z
|
|
20
20
|
.object({
|
|
21
|
-
apiVersion: z.literal(
|
|
22
|
-
|
|
21
|
+
apiVersion: z.literal(2),
|
|
22
|
+
transport: z.boolean(),
|
|
23
23
|
upload: z.boolean(),
|
|
24
24
|
download: z.boolean(),
|
|
25
|
+
range: z.boolean(),
|
|
25
26
|
gitCommitBlob: z.boolean(),
|
|
26
27
|
maxChunkBytes: z
|
|
27
28
|
.number()
|
|
@@ -30,9 +31,8 @@ export const workspaceDirectTransferCapabilitySchema = z
|
|
|
30
31
|
.max(1024 * 1024)
|
|
31
32
|
})
|
|
32
33
|
.strict();
|
|
33
|
-
export const directTransferPurposeSchema = z.enum(['
|
|
34
|
+
export const directTransferPurposeSchema = z.enum(['TRANSPORT', 'TRANSFER']);
|
|
34
35
|
export const directTransferDirectionSchema = z.enum(['UPLOAD', 'DOWNLOAD']);
|
|
35
|
-
export const directTransferProbeResultSchema = z.enum(['DIRECT_AVAILABLE', 'RELAY_ONLY', 'STALE']);
|
|
36
36
|
const workspaceFileResourceSchema = z
|
|
37
37
|
.object({
|
|
38
38
|
kind: z.literal('WORKSPACE_FILE'),
|
|
@@ -55,13 +55,17 @@ export const directTransferResourceSchema = z.discriminatedUnion('kind', [
|
|
|
55
55
|
workspaceFileResourceSchema,
|
|
56
56
|
gitCommitBlobResourceSchema
|
|
57
57
|
]);
|
|
58
|
-
|
|
58
|
+
const directTransferDescriptorBaseSchema = z
|
|
59
59
|
.object({
|
|
60
|
-
direction: directTransferDirectionSchema,
|
|
61
60
|
resource: directTransferResourceSchema,
|
|
62
61
|
fileName: z.string().trim().min(1).max(512),
|
|
63
62
|
size: safeIntegerSchema,
|
|
64
|
-
sha256: sha256Schema
|
|
63
|
+
sha256: sha256Schema
|
|
64
|
+
})
|
|
65
|
+
.strict();
|
|
66
|
+
const directUploadDescriptorSchema = directTransferDescriptorBaseSchema
|
|
67
|
+
.extend({
|
|
68
|
+
direction: z.literal('UPLOAD'),
|
|
65
69
|
overwrite: z.boolean().optional(),
|
|
66
70
|
resumeOffset: safeIntegerSchema.optional(),
|
|
67
71
|
composerAttachment: z
|
|
@@ -80,20 +84,42 @@ export const directTransferDescriptorSchema = z
|
|
|
80
84
|
path: ['resumeOffset'],
|
|
81
85
|
message: 'resume offset cannot exceed the file size'
|
|
82
86
|
});
|
|
83
|
-
if (descriptor.direction === 'DOWNLOAD' && descriptor.overwrite !== undefined)
|
|
84
|
-
context.addIssue({
|
|
85
|
-
code: 'custom',
|
|
86
|
-
path: ['overwrite'],
|
|
87
|
-
message: 'download descriptors cannot request overwrite'
|
|
88
|
-
});
|
|
89
87
|
if (descriptor.composerAttachment !== undefined &&
|
|
90
|
-
|
|
88
|
+
descriptor.resource.kind !== 'WORKSPACE_FILE')
|
|
91
89
|
context.addIssue({
|
|
92
90
|
code: 'custom',
|
|
93
91
|
path: ['composerAttachment'],
|
|
94
92
|
message: 'composer attachments are supported only for Workspace uploads'
|
|
95
93
|
});
|
|
96
94
|
});
|
|
95
|
+
const directDownloadDescriptorSchema = directTransferDescriptorBaseSchema
|
|
96
|
+
.extend({
|
|
97
|
+
direction: z.literal('DOWNLOAD'),
|
|
98
|
+
revision: z.string().trim().min(1).max(512),
|
|
99
|
+
range: z
|
|
100
|
+
.object({
|
|
101
|
+
offset: safeIntegerSchema,
|
|
102
|
+
length: safeIntegerSchema,
|
|
103
|
+
sha256: sha256Schema
|
|
104
|
+
})
|
|
105
|
+
.strict()
|
|
106
|
+
.optional()
|
|
107
|
+
})
|
|
108
|
+
.strict()
|
|
109
|
+
.superRefine((descriptor, context) => {
|
|
110
|
+
if (descriptor.range !== undefined &&
|
|
111
|
+
(descriptor.range.length === 0 ||
|
|
112
|
+
descriptor.range.offset + descriptor.range.length > descriptor.size))
|
|
113
|
+
context.addIssue({
|
|
114
|
+
code: 'custom',
|
|
115
|
+
path: ['range'],
|
|
116
|
+
message: 'download range must be non-empty and fit within the file size'
|
|
117
|
+
});
|
|
118
|
+
});
|
|
119
|
+
export const directTransferDescriptorSchema = z.union([
|
|
120
|
+
directUploadDescriptorSchema,
|
|
121
|
+
directDownloadDescriptorSchema
|
|
122
|
+
]);
|
|
97
123
|
const directPrepareBaseSchema = z
|
|
98
124
|
.object({
|
|
99
125
|
type: z.literal('direct.prepare'),
|
|
@@ -103,10 +129,11 @@ const directPrepareBaseSchema = z
|
|
|
103
129
|
})
|
|
104
130
|
.strict();
|
|
105
131
|
export const directPrepareRequestSchema = z.discriminatedUnion('purpose', [
|
|
106
|
-
directPrepareBaseSchema.extend({ purpose: z.literal('
|
|
132
|
+
directPrepareBaseSchema.extend({ purpose: z.literal('TRANSPORT') }).strict(),
|
|
107
133
|
directPrepareBaseSchema
|
|
108
134
|
.extend({
|
|
109
135
|
purpose: z.literal('TRANSFER'),
|
|
136
|
+
transportSessionId: identifierSchema,
|
|
110
137
|
transfer: directTransferDescriptorSchema
|
|
111
138
|
})
|
|
112
139
|
.strict()
|
|
@@ -172,6 +199,7 @@ export const directServerMessageSchema = z.discriminatedUnion('type', [
|
|
|
172
199
|
nodeGeneration: identifierSchema,
|
|
173
200
|
purpose: directTransferPurposeSchema,
|
|
174
201
|
expiresAt: timestampSchema,
|
|
202
|
+
transportSessionId: identifierSchema.optional(),
|
|
175
203
|
resumeOffset: safeIntegerSchema.optional()
|
|
176
204
|
})
|
|
177
205
|
.strict(),
|
|
@@ -186,13 +214,6 @@ export const directServerMessageSchema = z.discriminatedUnion('type', [
|
|
|
186
214
|
expiresAt: timestampSchema
|
|
187
215
|
})
|
|
188
216
|
.strict(),
|
|
189
|
-
directSessionIdentitySchema
|
|
190
|
-
.extend({
|
|
191
|
-
type: z.literal('direct.probe-result'),
|
|
192
|
-
result: z.enum(['DIRECT_AVAILABLE', 'RELAY_ONLY']),
|
|
193
|
-
routingHint: z.string().min(8).max(512).optional()
|
|
194
|
-
})
|
|
195
|
-
.strict(),
|
|
196
217
|
directSessionIdentitySchema
|
|
197
218
|
.extend({
|
|
198
219
|
type: z.literal('direct.heartbeat'),
|
|
@@ -229,16 +250,28 @@ export const directServerMessageSchema = z.discriminatedUnion('type', [
|
|
|
229
250
|
})
|
|
230
251
|
.strict()
|
|
231
252
|
]);
|
|
232
|
-
export const directNodeCommandSchema = z.
|
|
253
|
+
export const directNodeCommandSchema = z.union([
|
|
233
254
|
z
|
|
234
255
|
.object({
|
|
235
256
|
type: z.literal('direct.prepare'),
|
|
236
257
|
directSessionId: identifierSchema,
|
|
237
258
|
workbenchConnectionId: identifierSchema,
|
|
238
259
|
nodeGeneration: identifierSchema,
|
|
239
|
-
purpose:
|
|
260
|
+
purpose: z.literal('TRANSPORT'),
|
|
240
261
|
expiresAt: timestampSchema,
|
|
241
|
-
|
|
262
|
+
userAuthorization: z.unknown()
|
|
263
|
+
})
|
|
264
|
+
.strict(),
|
|
265
|
+
z
|
|
266
|
+
.object({
|
|
267
|
+
type: z.literal('direct.prepare'),
|
|
268
|
+
directSessionId: identifierSchema,
|
|
269
|
+
transportSessionId: identifierSchema,
|
|
270
|
+
workbenchConnectionId: identifierSchema,
|
|
271
|
+
nodeGeneration: identifierSchema,
|
|
272
|
+
purpose: z.literal('TRANSFER'),
|
|
273
|
+
expiresAt: timestampSchema,
|
|
274
|
+
transfer: directTransferDescriptorSchema,
|
|
242
275
|
userAuthorization: z.unknown()
|
|
243
276
|
})
|
|
244
277
|
.strict(),
|
|
@@ -248,6 +281,7 @@ export const directNodeCommandSchema = z.discriminatedUnion('type', [
|
|
|
248
281
|
directSessionIdentitySchema
|
|
249
282
|
.extend({
|
|
250
283
|
type: z.literal('direct.grant'),
|
|
284
|
+
transportSessionId: identifierSchema,
|
|
251
285
|
grant: z.string().min(32).max(4096),
|
|
252
286
|
browserFingerprint: fingerprintSchema,
|
|
253
287
|
nodeFingerprint: fingerprintSchema,
|
|
@@ -255,7 +289,9 @@ export const directNodeCommandSchema = z.discriminatedUnion('type', [
|
|
|
255
289
|
expiresAt: timestampSchema
|
|
256
290
|
})
|
|
257
291
|
.strict(),
|
|
258
|
-
directSessionIdentitySchema
|
|
292
|
+
directSessionIdentitySchema
|
|
293
|
+
.extend({ type: z.literal('direct.heartbeat'), expiresAt: timestampSchema })
|
|
294
|
+
.strict(),
|
|
259
295
|
directSessionIdentitySchema
|
|
260
296
|
.extend({
|
|
261
297
|
type: z.literal('direct.cancel'),
|
|
@@ -268,13 +304,6 @@ export const directNodeEventSchema = z.discriminatedUnion('type', [
|
|
|
268
304
|
.extend({ type: z.literal('direct.signal'), signal: directSignalSchema })
|
|
269
305
|
.strict(),
|
|
270
306
|
directSessionIdentitySchema.extend({ type: z.literal('direct.connected') }).strict(),
|
|
271
|
-
directSessionIdentitySchema
|
|
272
|
-
.extend({
|
|
273
|
-
type: z.literal('direct.probe-result'),
|
|
274
|
-
result: z.enum(['DIRECT_AVAILABLE', 'RELAY_ONLY']),
|
|
275
|
-
routingHint: z.string().min(8).max(512).optional()
|
|
276
|
-
})
|
|
277
|
-
.strict(),
|
|
278
307
|
directSessionIdentitySchema
|
|
279
308
|
.extend({
|
|
280
309
|
type: z.literal('direct.opened'),
|
package/dist/enterprise.d.ts
CHANGED
|
@@ -224,9 +224,9 @@ export declare const auditEventSchema: z.ZodObject<{
|
|
|
224
224
|
metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<[z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull]>>>;
|
|
225
225
|
}, "strict", z.ZodTypeAny, {
|
|
226
226
|
id: string;
|
|
227
|
-
result: "SUCCESS" | "DENIED" | "FAILED";
|
|
228
227
|
eventType: string;
|
|
229
228
|
occurredAt: number;
|
|
229
|
+
result: "SUCCESS" | "DENIED" | "FAILED";
|
|
230
230
|
authenticationMethod: "PASSWORD" | "OAUTH2" | "SYSTEM";
|
|
231
231
|
workspaceId?: string | null | undefined;
|
|
232
232
|
requestId?: string | null | undefined;
|
|
@@ -250,9 +250,9 @@ export declare const auditEventSchema: z.ZodObject<{
|
|
|
250
250
|
metadata?: Record<string, string | number | boolean | null> | undefined;
|
|
251
251
|
}, {
|
|
252
252
|
id: string;
|
|
253
|
-
result: "SUCCESS" | "DENIED" | "FAILED";
|
|
254
253
|
eventType: string;
|
|
255
254
|
occurredAt: number;
|
|
255
|
+
result: "SUCCESS" | "DENIED" | "FAILED";
|
|
256
256
|
authenticationMethod: "PASSWORD" | "OAUTH2" | "SYSTEM";
|
|
257
257
|
workspaceId?: string | null | undefined;
|
|
258
258
|
requestId?: string | null | undefined;
|
|
@@ -357,9 +357,9 @@ export declare const auditEventDetailSchema: z.ZodObject<{
|
|
|
357
357
|
}>>;
|
|
358
358
|
}, "strict", z.ZodTypeAny, {
|
|
359
359
|
id: string;
|
|
360
|
-
result: "SUCCESS" | "DENIED" | "FAILED";
|
|
361
360
|
eventType: string;
|
|
362
361
|
occurredAt: number;
|
|
362
|
+
result: "SUCCESS" | "DENIED" | "FAILED";
|
|
363
363
|
authenticationMethod: "PASSWORD" | "OAUTH2" | "SYSTEM";
|
|
364
364
|
workspaceId?: string | null | undefined;
|
|
365
365
|
requestId?: string | null | undefined;
|
|
@@ -389,9 +389,9 @@ export declare const auditEventDetailSchema: z.ZodObject<{
|
|
|
389
389
|
} | undefined;
|
|
390
390
|
}, {
|
|
391
391
|
id: string;
|
|
392
|
-
result: "SUCCESS" | "DENIED" | "FAILED";
|
|
393
392
|
eventType: string;
|
|
394
393
|
occurredAt: number;
|
|
394
|
+
result: "SUCCESS" | "DENIED" | "FAILED";
|
|
395
395
|
authenticationMethod: "PASSWORD" | "OAUTH2" | "SYSTEM";
|
|
396
396
|
workspaceId?: string | null | undefined;
|
|
397
397
|
requestId?: string | null | undefined;
|