@agentknight/sdk 0.9.59 → 0.9.62
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/chunks/{acp-adapter-OGD5QSNI.js → acp-adapter-MBYKOCA2.js} +4 -4
- package/dist/chunks/{chunk-LWJNDBIM.js → chunk-3AMFPDE5.js} +8 -4
- package/dist/chunks/{chunk-5DVJ7Y5W.js → chunk-7CNBPLNE.js} +2 -2
- package/dist/chunks/{chunk-3OIHMMDF.js → chunk-7OGTK7KB.js} +1 -1
- package/dist/chunks/{chunk-2MERNOK6.js → chunk-A4YCCQ3I.js} +1 -1
- package/dist/chunks/{chunk-X3ZG6WMN.js → chunk-ALUQLM54.js} +2 -2
- package/dist/chunks/{chunk-AREU4R62.js → chunk-CHKNC6PD.js} +1 -1
- package/dist/chunks/{chunk-DP5KVGWF.js → chunk-CM5LVXVL.js} +3 -3
- package/dist/chunks/{chunk-NDEJOXSX.js → chunk-H4SHMWQ6.js} +1 -1
- package/dist/chunks/{chunk-LO4ZRE77.js → chunk-P2PH5KMV.js} +101 -50
- package/dist/chunks/{chunk-FDUJP3WA.js → chunk-SIFCCGXF.js} +7 -5
- package/dist/chunks/{chunk-ZDKBJFA2.js → chunk-ZNQ2I5EF.js} +1 -1
- package/dist/chunks/{claude-adapter-DGZBZSWJ.js → claude-adapter-D3JWXMNX.js} +4 -4
- package/dist/chunks/{codex-adapter-2W7RRER3.js → codex-adapter-655KHW7H.js} +4 -4
- package/dist/chunks/{copilot-adapter-ZEHU6CFQ.js → copilot-adapter-EZUXHBE3.js} +55 -20
- package/dist/chunks/{managed-agent-adapter-CGJPJZ2Z.js → managed-agent-adapter-BOJNEJ75.js} +11 -7
- package/dist/chunks/{pi-adapter-WOVSWBGG.js → pi-adapter-LAD5GOCP.js} +4 -4
- package/dist/configuration.js +4 -4
- package/dist/index.d.ts +16 -0
- package/dist/index.js +86 -52
- package/dist/runtime.js +2 -2
- package/dist/session-analytics-worker.js +5 -5
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -10,7 +10,7 @@ import {
|
|
|
10
10
|
PeerChatRequestSchema,
|
|
11
11
|
PeerChatResultSchema,
|
|
12
12
|
validateDataDirectory
|
|
13
|
-
} from "./chunks/chunk-
|
|
13
|
+
} from "./chunks/chunk-CHKNC6PD.js";
|
|
14
14
|
import {
|
|
15
15
|
DeviceIdentitySchema,
|
|
16
16
|
codingAgentPresentation,
|
|
@@ -20,7 +20,7 @@ import {
|
|
|
20
20
|
AgentSelectionSchema,
|
|
21
21
|
assertSelectionSnapshotFits,
|
|
22
22
|
supportsAgentSelection
|
|
23
|
-
} from "./chunks/chunk-
|
|
23
|
+
} from "./chunks/chunk-SIFCCGXF.js";
|
|
24
24
|
import {
|
|
25
25
|
LiveTimelineProjection,
|
|
26
26
|
OperationDiagnostics,
|
|
@@ -46,7 +46,7 @@ import {
|
|
|
46
46
|
sessionRestoreFailure,
|
|
47
47
|
sessionRootIdentity,
|
|
48
48
|
validateOperationResponse
|
|
49
|
-
} from "./chunks/chunk-
|
|
49
|
+
} from "./chunks/chunk-3AMFPDE5.js";
|
|
50
50
|
import {
|
|
51
51
|
SessionImageRelayUrlSchema,
|
|
52
52
|
SessionImagesConfigSchema
|
|
@@ -54,15 +54,15 @@ import {
|
|
|
54
54
|
import {
|
|
55
55
|
ConversationNormalizer,
|
|
56
56
|
isDisplayableHumanMessage
|
|
57
|
-
} from "./chunks/chunk-
|
|
57
|
+
} from "./chunks/chunk-ZNQ2I5EF.js";
|
|
58
58
|
import {
|
|
59
59
|
GroupChatError
|
|
60
|
-
} from "./chunks/chunk-
|
|
60
|
+
} from "./chunks/chunk-ALUQLM54.js";
|
|
61
61
|
import {
|
|
62
62
|
assistantPreview,
|
|
63
63
|
isContentfulAssistant,
|
|
64
64
|
userPreview
|
|
65
|
-
} from "./chunks/chunk-
|
|
65
|
+
} from "./chunks/chunk-H4SHMWQ6.js";
|
|
66
66
|
import {
|
|
67
67
|
AgentModelListingError,
|
|
68
68
|
AgentSessionRenameError,
|
|
@@ -72,11 +72,11 @@ import {
|
|
|
72
72
|
captureResearchAccess,
|
|
73
73
|
captureWorkbenchAccess,
|
|
74
74
|
validateSessionName
|
|
75
|
-
} from "./chunks/chunk-
|
|
75
|
+
} from "./chunks/chunk-7CNBPLNE.js";
|
|
76
76
|
import {
|
|
77
77
|
SessionOperationError,
|
|
78
78
|
SessionOperations
|
|
79
|
-
} from "./chunks/chunk-
|
|
79
|
+
} from "./chunks/chunk-7OGTK7KB.js";
|
|
80
80
|
import {
|
|
81
81
|
A2A_BODY_MAX_LENGTH,
|
|
82
82
|
A2aRelayRequestSchema,
|
|
@@ -102,6 +102,9 @@ import {
|
|
|
102
102
|
EncryptedGroupCreateSchema,
|
|
103
103
|
EncryptedPeerAuthorizationSchema,
|
|
104
104
|
EncryptedPeerMessageSchema,
|
|
105
|
+
FILE_MAX_BYTES,
|
|
106
|
+
FILE_TRANSFER_CAPABILITY,
|
|
107
|
+
FILE_TRANSFER_PACKET_BYTES,
|
|
105
108
|
GROUP_CHAT_CREATE_CAPABILITY,
|
|
106
109
|
GROUP_CHAT_CREATE_OPERATION,
|
|
107
110
|
GROUP_CHAT_CREATE_VERSION,
|
|
@@ -154,6 +157,7 @@ import {
|
|
|
154
157
|
SESSION_FILE_ATTACHMENTS_CAPABILITY,
|
|
155
158
|
SESSION_FILE_DOWNLOAD_MAX_ORIGINAL_BYTES,
|
|
156
159
|
SESSION_FILE_DOWNLOAD_OPERATION,
|
|
160
|
+
SESSION_FILE_DOWNLOAD_V2_VERSION,
|
|
157
161
|
SESSION_FILE_DOWNLOAD_VERSION,
|
|
158
162
|
SESSION_FILE_GZIP_THRESHOLD_BYTES,
|
|
159
163
|
SESSION_FILE_MAX_IMAGE_BYTES,
|
|
@@ -163,6 +167,7 @@ import {
|
|
|
163
167
|
SESSION_FILE_MAX_VIDEO_PIXELS,
|
|
164
168
|
SESSION_FILE_READ_OPERATION,
|
|
165
169
|
SESSION_FILE_READ_V2_VERSION,
|
|
170
|
+
SESSION_FILE_READ_V3_VERSION,
|
|
166
171
|
SESSION_FILE_READ_VERSION,
|
|
167
172
|
SESSION_FILE_V2_MAX_ORIGINAL_BYTES,
|
|
168
173
|
SESSION_GIT_DIFF_GZIP_MIN_BYTES,
|
|
@@ -189,6 +194,7 @@ import {
|
|
|
189
194
|
SESSION_RESOURCE_MAX_IMAGE_PIXELS,
|
|
190
195
|
SESSION_RESOURCE_MAX_ORIGINAL_BYTES,
|
|
191
196
|
SESSION_RESOURCE_READ_OPERATION,
|
|
197
|
+
SESSION_RESOURCE_READ_V2_VERSION,
|
|
192
198
|
SESSION_RESOURCE_READ_VERSION,
|
|
193
199
|
SESSION_STATE_FILES_CAPABILITY,
|
|
194
200
|
SESSION_TIMELINE_PAGE_SIZE,
|
|
@@ -209,9 +215,11 @@ import {
|
|
|
209
215
|
SessionDirectoryListResultDataSchema,
|
|
210
216
|
SessionFileDownloadDataSchema,
|
|
211
217
|
SessionFileDownloadResultDataSchema,
|
|
218
|
+
SessionFileDownloadV2ResultDataSchema,
|
|
212
219
|
SessionFileReadDataSchema,
|
|
213
220
|
SessionFileReadResultDataSchema,
|
|
214
221
|
SessionFileReadV2ResultDataSchema,
|
|
222
|
+
SessionFileReadV3ResultDataSchema,
|
|
215
223
|
SessionGitDiffDataSchema,
|
|
216
224
|
SessionGitDiffGzipResultDataSchema,
|
|
217
225
|
SessionGitDiffPartialResultDataSchema,
|
|
@@ -229,6 +237,7 @@ import {
|
|
|
229
237
|
SessionRenameResultDataSchema,
|
|
230
238
|
SessionResourceReadDataSchema,
|
|
231
239
|
SessionResourceReadResultDataSchema,
|
|
240
|
+
SessionResourceReadV2ResultDataSchema,
|
|
232
241
|
SessionSummarySchema,
|
|
233
242
|
SessionTimelineInvalidatedSchema,
|
|
234
243
|
SessionTimelinePageRequestSchema,
|
|
@@ -286,7 +295,7 @@ import {
|
|
|
286
295
|
sessionCommunicationError,
|
|
287
296
|
sessionCommunicationOperationCapability,
|
|
288
297
|
workbenchCapability
|
|
289
|
-
} from "./chunks/chunk-
|
|
298
|
+
} from "./chunks/chunk-P2PH5KMV.js";
|
|
290
299
|
|
|
291
300
|
// src/initialize.ts
|
|
292
301
|
import { createHash as createHash18 } from "node:crypto";
|
|
@@ -306,7 +315,7 @@ async function createCodingAgentAdapter(config, onDiagnostic, owner) {
|
|
|
306
315
|
switch (engine.kind) {
|
|
307
316
|
case "managed": {
|
|
308
317
|
if (owner === void 0) throw new Error("Managed coding agents require the PC owner identity");
|
|
309
|
-
const { ManagedCodingAgentAdapter } = await import("./chunks/managed-agent-adapter-
|
|
318
|
+
const { ManagedCodingAgentAdapter } = await import("./chunks/managed-agent-adapter-BOJNEJ75.js");
|
|
310
319
|
return new ManagedCodingAgentAdapter({
|
|
311
320
|
dataDirectory: config.dataDirectory,
|
|
312
321
|
owner,
|
|
@@ -369,7 +378,7 @@ async function createCodingAgentAdapter(config, onDiagnostic, owner) {
|
|
|
369
378
|
});
|
|
370
379
|
}
|
|
371
380
|
case "copilot": {
|
|
372
|
-
const { GithubCopilotAdapter } = await import("./chunks/copilot-adapter-
|
|
381
|
+
const { GithubCopilotAdapter } = await import("./chunks/copilot-adapter-EZUXHBE3.js");
|
|
373
382
|
if (owner !== void 0) {
|
|
374
383
|
return new GithubCopilotAdapter(
|
|
375
384
|
void 0,
|
|
@@ -398,13 +407,13 @@ async function createCodingAgentAdapter(config, onDiagnostic, owner) {
|
|
|
398
407
|
}
|
|
399
408
|
case "pi": {
|
|
400
409
|
assertPiRuntimeSupported();
|
|
401
|
-
const { PiCodingAgentAdapter } = await import("./chunks/pi-adapter-
|
|
410
|
+
const { PiCodingAgentAdapter } = await import("./chunks/pi-adapter-LAD5GOCP.js");
|
|
402
411
|
return new PiCodingAgentAdapter(
|
|
403
412
|
engine.agentDirectory === void 0 ? {} : { agentDirectory: resolve(engine.agentDirectory) }
|
|
404
413
|
);
|
|
405
414
|
}
|
|
406
415
|
case "codex": {
|
|
407
|
-
const { CodexCodingAgentAdapter } = await import("./chunks/codex-adapter-
|
|
416
|
+
const { CodexCodingAgentAdapter } = await import("./chunks/codex-adapter-655KHW7H.js");
|
|
408
417
|
return new CodexCodingAgentAdapter({
|
|
409
418
|
dataDirectory: resolve(config.dataDirectory, "coding-agents"),
|
|
410
419
|
...owner === void 0 ? {} : { nativeSessionOwner: owner },
|
|
@@ -413,7 +422,7 @@ async function createCodingAgentAdapter(config, onDiagnostic, owner) {
|
|
|
413
422
|
});
|
|
414
423
|
}
|
|
415
424
|
case "claude": {
|
|
416
|
-
const { ClaudeCodingAgentAdapter } = await import("./chunks/claude-adapter-
|
|
425
|
+
const { ClaudeCodingAgentAdapter } = await import("./chunks/claude-adapter-D3JWXMNX.js");
|
|
417
426
|
return new ClaudeCodingAgentAdapter({
|
|
418
427
|
dataDirectory: resolve(config.dataDirectory, "coding-agents"),
|
|
419
428
|
...engine.command === void 0 ? {} : { command: engine.command },
|
|
@@ -422,7 +431,7 @@ async function createCodingAgentAdapter(config, onDiagnostic, owner) {
|
|
|
422
431
|
});
|
|
423
432
|
}
|
|
424
433
|
case "acp": {
|
|
425
|
-
const { AcpCodingAgentAdapter } = await import("./chunks/acp-adapter-
|
|
434
|
+
const { AcpCodingAgentAdapter } = await import("./chunks/acp-adapter-MBYKOCA2.js");
|
|
426
435
|
return new AcpCodingAgentAdapter({
|
|
427
436
|
command: engine.command,
|
|
428
437
|
args: engine.args,
|
|
@@ -999,8 +1008,8 @@ function one(elements, id) {
|
|
|
999
1008
|
requireVideo(matches.length === 1 && match !== void 0);
|
|
1000
1009
|
return match;
|
|
1001
1010
|
}
|
|
1002
|
-
function validateSessionVideo(bytes, mediaType) {
|
|
1003
|
-
requireVideo(bytes.length > 0 && bytes.length <=
|
|
1011
|
+
function validateSessionVideo(bytes, mediaType, maxBytes = SESSION_FILE_V2_MAX_ORIGINAL_BYTES) {
|
|
1012
|
+
requireVideo(bytes.length > 0 && bytes.length <= maxBytes);
|
|
1004
1013
|
if (mediaType === "video/mp4") validateMp4(bytes);
|
|
1005
1014
|
else validateWebm(bytes);
|
|
1006
1015
|
}
|
|
@@ -1282,23 +1291,27 @@ var SessionFileReader = class {
|
|
|
1282
1291
|
metadata;
|
|
1283
1292
|
#active = 0;
|
|
1284
1293
|
async read(sessionId, path, rootRevision, version = SESSION_FILE_READ_VERSION, space) {
|
|
1285
|
-
if (
|
|
1294
|
+
if (![SESSION_FILE_READ_VERSION, SESSION_FILE_READ_V2_VERSION, SESSION_FILE_READ_V3_VERSION].some((supported) => supported === version)) fail("UNSUPPORTED_OPERATION_VERSION");
|
|
1286
1295
|
if (!SessionFileReadDataSchema.safeParse({ path, rootRevision }).success) fail("INVALID_FILE_PATH");
|
|
1287
|
-
const schema = version === SESSION_FILE_READ_V2_VERSION ? SessionFileReadV2ResultDataSchema : SessionFileReadResultDataSchema;
|
|
1296
|
+
const schema = version === SESSION_FILE_READ_V3_VERSION ? SessionFileReadV3ResultDataSchema : version === SESSION_FILE_READ_V2_VERSION ? SessionFileReadV2ResultDataSchema : SessionFileReadResultDataSchema;
|
|
1288
1297
|
return schema.parse(await this.#run(
|
|
1289
1298
|
(checkDeadline) => this.#read(sessionId, path, rootRevision, checkDeadline, "preview", version, space)
|
|
1290
1299
|
));
|
|
1291
1300
|
}
|
|
1292
|
-
async readResource(sessionId, path, rootRevision, space) {
|
|
1301
|
+
async readResource(sessionId, path, rootRevision, space, version = SESSION_RESOURCE_READ_VERSION) {
|
|
1302
|
+
if (![SESSION_RESOURCE_READ_VERSION, SESSION_RESOURCE_READ_V2_VERSION].some((supported) => supported === version)) fail("UNSUPPORTED_OPERATION_VERSION");
|
|
1293
1303
|
if (!SessionResourceReadDataSchema.safeParse({ path, rootRevision }).success) fail("INVALID_FILE_PATH");
|
|
1294
|
-
|
|
1295
|
-
|
|
1304
|
+
const schema = version === SESSION_RESOURCE_READ_V2_VERSION ? SessionResourceReadV2ResultDataSchema : SessionResourceReadResultDataSchema;
|
|
1305
|
+
return schema.parse(await this.#run(
|
|
1306
|
+
(checkDeadline) => this.#read(sessionId, path, rootRevision, checkDeadline, "resource", version, space)
|
|
1296
1307
|
));
|
|
1297
1308
|
}
|
|
1298
|
-
async download(sessionId, path, rootRevision, space) {
|
|
1309
|
+
async download(sessionId, path, rootRevision, space, version = SESSION_FILE_DOWNLOAD_VERSION) {
|
|
1310
|
+
if (![SESSION_FILE_DOWNLOAD_VERSION, SESSION_FILE_DOWNLOAD_V2_VERSION].some((supported) => supported === version)) fail("UNSUPPORTED_OPERATION_VERSION");
|
|
1299
1311
|
if (!SessionFileDownloadDataSchema.safeParse({ path, rootRevision }).success) fail("INVALID_FILE_PATH");
|
|
1300
|
-
|
|
1301
|
-
|
|
1312
|
+
const schema = version === SESSION_FILE_DOWNLOAD_V2_VERSION ? SessionFileDownloadV2ResultDataSchema : SessionFileDownloadResultDataSchema;
|
|
1313
|
+
return schema.parse(await this.#run(
|
|
1314
|
+
(checkDeadline) => this.#read(sessionId, path, rootRevision, checkDeadline, "download", version, space)
|
|
1302
1315
|
));
|
|
1303
1316
|
}
|
|
1304
1317
|
async #run(read) {
|
|
@@ -1370,7 +1383,8 @@ var SessionFileReader = class {
|
|
|
1370
1383
|
return file;
|
|
1371
1384
|
};
|
|
1372
1385
|
const before = await inspectPath();
|
|
1373
|
-
const
|
|
1386
|
+
const large = download ? version === SESSION_FILE_DOWNLOAD_V2_VERSION : resource ? version === SESSION_RESOURCE_READ_V2_VERSION : version === SESSION_FILE_READ_V3_VERSION;
|
|
1387
|
+
const maxOriginalBytes = large ? FILE_MAX_BYTES : download ? SESSION_FILE_DOWNLOAD_MAX_ORIGINAL_BYTES : resource ? SESSION_RESOURCE_MAX_ORIGINAL_BYTES : version === SESSION_FILE_READ_V2_VERSION ? SESSION_FILE_V2_MAX_ORIGINAL_BYTES : SESSION_FILE_MAX_ORIGINAL_BYTES;
|
|
1374
1388
|
if (before.size > BigInt(maxOriginalBytes)) fail("FILE_TOO_LARGE");
|
|
1375
1389
|
const extension = extname(path).toLowerCase();
|
|
1376
1390
|
const resourceType = resource ? resourceMediaType(extension) : void 0;
|
|
@@ -1425,10 +1439,10 @@ var SessionFileReader = class {
|
|
|
1425
1439
|
mediaType = "image/webp";
|
|
1426
1440
|
canonical = await imagePreview(bytes, `.${detected.ext}`, checkDeadline);
|
|
1427
1441
|
} else if (detected?.mime === "video/mp4" || detected?.mime === "video/webm") {
|
|
1428
|
-
if (version !== SESSION_FILE_READ_V2_VERSION || extension !== (detected.mime === "video/mp4" ? ".mp4" : ".webm")) fail("FILE_UNSUPPORTED");
|
|
1442
|
+
if (version !== SESSION_FILE_READ_V2_VERSION && version !== SESSION_FILE_READ_V3_VERSION || extension !== (detected.mime === "video/mp4" ? ".mp4" : ".webm")) fail("FILE_UNSUPPORTED");
|
|
1429
1443
|
mediaType = detected.mime;
|
|
1430
1444
|
try {
|
|
1431
|
-
validateSessionVideo(bytes, mediaType);
|
|
1445
|
+
validateSessionVideo(bytes, mediaType, maxOriginalBytes);
|
|
1432
1446
|
} catch (error) {
|
|
1433
1447
|
throw new SessionFileReadError("FILE_UNSUPPORTED", { cause: error });
|
|
1434
1448
|
}
|
|
@@ -1457,7 +1471,7 @@ var SessionFileReader = class {
|
|
|
1457
1471
|
throw new SessionFileReadError("FILE_CHANGED", { cause: error });
|
|
1458
1472
|
}
|
|
1459
1473
|
checkDeadline();
|
|
1460
|
-
return (download ? SessionFileDownloadResultDataSchema : resource ? SessionResourceReadResultDataSchema : version === SESSION_FILE_READ_V2_VERSION ? SessionFileReadV2ResultDataSchema : SessionFileReadResultDataSchema).parse({
|
|
1474
|
+
return (download ? version === SESSION_FILE_DOWNLOAD_V2_VERSION ? SessionFileDownloadV2ResultDataSchema : SessionFileDownloadResultDataSchema : resource ? version === SESSION_RESOURCE_READ_V2_VERSION ? SessionResourceReadV2ResultDataSchema : SessionResourceReadResultDataSchema : version === SESSION_FILE_READ_V3_VERSION ? SessionFileReadV3ResultDataSchema : version === SESSION_FILE_READ_V2_VERSION ? SessionFileReadV2ResultDataSchema : SessionFileReadResultDataSchema).parse({
|
|
1461
1475
|
path,
|
|
1462
1476
|
rootRevision,
|
|
1463
1477
|
mediaType,
|
|
@@ -3761,7 +3775,7 @@ function createCommunicationOperations(options) {
|
|
|
3761
3775
|
})),
|
|
3762
3776
|
onError: (error) => unsupportedOperation(error) ?? (error instanceof SessionDirectoryError ? { code: error.code, message: error.message } : { code: "DIRECTORY_UNAVAILABLE", message: "The directory is unavailable" })
|
|
3763
3777
|
}),
|
|
3764
|
-
...[SESSION_FILE_READ_VERSION, SESSION_FILE_READ_V2_VERSION].map((version) => sessionCommunicationOperation({
|
|
3778
|
+
...[SESSION_FILE_READ_VERSION, SESSION_FILE_READ_V2_VERSION, SESSION_FILE_READ_V3_VERSION].map((version) => sessionCommunicationOperation({
|
|
3765
3779
|
operation: SESSION_FILE_READ_OPERATION,
|
|
3766
3780
|
version,
|
|
3767
3781
|
schema: SessionFileReadDataSchema,
|
|
@@ -3771,14 +3785,14 @@ function createCommunicationOperations(options) {
|
|
|
3771
3785
|
message: "The file preview is unavailable"
|
|
3772
3786
|
}
|
|
3773
3787
|
})),
|
|
3774
|
-
sessionCommunicationOperation({
|
|
3788
|
+
...[SESSION_FILE_DOWNLOAD_VERSION, SESSION_FILE_DOWNLOAD_V2_VERSION].map((version) => sessionCommunicationOperation({
|
|
3775
3789
|
operation: SESSION_FILE_DOWNLOAD_OPERATION,
|
|
3776
|
-
version
|
|
3790
|
+
version,
|
|
3777
3791
|
schema: SessionFileDownloadDataSchema,
|
|
3778
3792
|
handle: async ({ path, rootRevision, space }, request2) => {
|
|
3779
3793
|
const assertAccess = options.captureRequestAccess();
|
|
3780
3794
|
assertAccess();
|
|
3781
|
-
const result = await fileReader.download(request2.sessionId, path, rootRevision, space);
|
|
3795
|
+
const result = await fileReader.download(request2.sessionId, path, rootRevision, space, version);
|
|
3782
3796
|
assertAccess();
|
|
3783
3797
|
return result;
|
|
3784
3798
|
},
|
|
@@ -3786,17 +3800,17 @@ function createCommunicationOperations(options) {
|
|
|
3786
3800
|
code: error instanceof SessionFileReadError || error instanceof SessionNotSharedError ? error.code : "FILE_UNAVAILABLE",
|
|
3787
3801
|
message: "The file download is unavailable"
|
|
3788
3802
|
}
|
|
3789
|
-
}),
|
|
3790
|
-
sessionCommunicationOperation({
|
|
3803
|
+
})),
|
|
3804
|
+
...[SESSION_RESOURCE_READ_VERSION, SESSION_RESOURCE_READ_V2_VERSION].map((version) => sessionCommunicationOperation({
|
|
3791
3805
|
operation: SESSION_RESOURCE_READ_OPERATION,
|
|
3792
|
-
version
|
|
3806
|
+
version,
|
|
3793
3807
|
schema: SessionResourceReadDataSchema,
|
|
3794
|
-
handle: ({ path, rootRevision, space }, request2) => fileReader.readResource(request2.sessionId, path, rootRevision, space),
|
|
3808
|
+
handle: ({ path, rootRevision, space }, request2) => fileReader.readResource(request2.sessionId, path, rootRevision, space, version),
|
|
3795
3809
|
onError: (error) => unsupportedOperation(error) ?? {
|
|
3796
3810
|
code: error instanceof SessionFileReadError ? error.code : "FILE_UNAVAILABLE",
|
|
3797
3811
|
message: "The resource is unavailable"
|
|
3798
3812
|
}
|
|
3799
|
-
})
|
|
3813
|
+
}))
|
|
3800
3814
|
],
|
|
3801
3815
|
...getSessionProjectIdentity === void 0 ? [] : [
|
|
3802
3816
|
sessionCommunicationOperation({
|
|
@@ -4799,6 +4813,8 @@ var SessionOptionsHandler = class {
|
|
|
4799
4813
|
...worktreeChoices?.currentBranch === void 0 ? {} : { worktreeCurrentBranch: worktreeChoices.currentBranch },
|
|
4800
4814
|
...request2.sessionId !== void 0 && request2.capabilities?.includes(SESSION_FILE_ATTACHMENTS_CAPABILITY) === true ? { fileAttachmentsSupported: (capabilities.supportsFileAttachments ?? adapter.supportsFileAttachments) === true } : {},
|
|
4801
4815
|
...capabilities.supportsReasoningEffort ? { reasoningEffortConfigurationSupported: true } : {},
|
|
4816
|
+
...request2.sessionId !== void 0 && capabilities.supportsContextTier ? { contextTierConfigurationSupported: true } : {},
|
|
4817
|
+
...current?.contextTier === void 0 ? {} : { currentContextTier: current.contextTier },
|
|
4802
4818
|
...current?.modelId === void 0 ? {} : { currentModelId: current.modelId },
|
|
4803
4819
|
...current === void 0 ? {} : {
|
|
4804
4820
|
currentAgentMode: current.agentMode,
|
|
@@ -4847,6 +4863,8 @@ var SessionOptionsHandler = class {
|
|
|
4847
4863
|
if (configuration !== void 0) {
|
|
4848
4864
|
partial.agentModes = [...capabilities.agentModes];
|
|
4849
4865
|
if (capabilities.supportsReasoningEffort) partial.reasoningEffortConfigurationSupported = true;
|
|
4866
|
+
if (capabilities.supportsContextTier) partial.contextTierConfigurationSupported = true;
|
|
4867
|
+
if (configuration.contextTier !== void 0) partial.currentContextTier = configuration.contextTier;
|
|
4850
4868
|
if (configuration.modelId !== void 0) partial.currentModelId = configuration.modelId;
|
|
4851
4869
|
partial.currentAgentMode = configuration.agentMode;
|
|
4852
4870
|
partial.currentReasoningEffort = configuration.reasoningEffort;
|
|
@@ -5119,11 +5137,15 @@ var SessionCommandsHandler = class {
|
|
|
5119
5137
|
if (request2.configOption !== void 0 && !this.options.supportsAgentControls(scope.clientId)) {
|
|
5120
5138
|
throw new Error("Native agent controls require coding-agent-controls-v1 support");
|
|
5121
5139
|
}
|
|
5140
|
+
if (request2.contextTier !== void 0 && !(adapter.getSessionCapabilities?.(request2.sessionId) ?? adapter).supportsContextTier) {
|
|
5141
|
+
throw new Error("This coding agent does not support context tier configuration");
|
|
5142
|
+
}
|
|
5122
5143
|
const configuration = await adapter.configureSession(request2.sessionId, {
|
|
5123
5144
|
...request2.modelId === void 0 ? {} : { modelId: request2.modelId },
|
|
5124
5145
|
...request2.agentMode === void 0 ? {} : { agentMode: request2.agentMode },
|
|
5125
5146
|
...request2.reasoningEffort === void 0 ? {} : { reasoningEffort: request2.reasoningEffort },
|
|
5126
|
-
...request2.configOption === void 0 ? {} : { configOption: request2.configOption }
|
|
5147
|
+
...request2.configOption === void 0 ? {} : { configOption: request2.configOption },
|
|
5148
|
+
...request2.contextTier === void 0 ? {} : { contextTier: request2.contextTier }
|
|
5127
5149
|
});
|
|
5128
5150
|
emit("session.configure.result", {
|
|
5129
5151
|
ok: true,
|
|
@@ -5133,6 +5155,7 @@ var SessionCommandsHandler = class {
|
|
|
5133
5155
|
...configuration.modelId === void 0 ? {} : { modelId: configuration.modelId },
|
|
5134
5156
|
agentMode: configuration.agentMode,
|
|
5135
5157
|
reasoningEffort: configuration.reasoningEffort,
|
|
5158
|
+
...configuration.contextTier === void 0 ? {} : { contextTier: configuration.contextTier },
|
|
5136
5159
|
...configuration.configOptions === void 0 ? {} : { configOptions: configuration.configOptions }
|
|
5137
5160
|
});
|
|
5138
5161
|
} catch (error) {
|
|
@@ -10196,6 +10219,7 @@ var PcAgent = class {
|
|
|
10196
10219
|
}
|
|
10197
10220
|
#machineCapabilities() {
|
|
10198
10221
|
return [
|
|
10222
|
+
...(this.config.secureMessagePacketBudget ?? DEFAULT_SECURE_PACKET_BUDGET) >= FILE_TRANSFER_PACKET_BYTES ? [FILE_TRANSFER_CAPABILITY] : [],
|
|
10199
10223
|
...this.adapter.agentId === "copilot" || this.adapter.agentId === "managed" ? [SESSION_AVATAR_PERSONA_CAPABILITY] : [],
|
|
10200
10224
|
SESSION_COMMUNICATION_CAPABILITY,
|
|
10201
10225
|
...this.textInputWriter === void 0 ? [] : [DEVICE_TEXT_INPUT_CAPABILITY],
|
|
@@ -10625,30 +10649,28 @@ function createResearchContextReader(options) {
|
|
|
10625
10649
|
throw new Error("The source did not return its current plan");
|
|
10626
10650
|
}
|
|
10627
10651
|
return {
|
|
10628
|
-
|
|
10629
|
-
turnId: plan.turnId,
|
|
10630
|
-
operation: plan.operation,
|
|
10631
|
-
content: plan.content,
|
|
10632
|
-
todos: plan.todos
|
|
10652
|
+
anchorEventId: plan.sourceEventIds.at(-1),
|
|
10653
|
+
plan: { id: plan.id, turnId: plan.turnId, operation: plan.operation, content: plan.content, todos: plan.todos }
|
|
10633
10654
|
};
|
|
10634
10655
|
} catch (error) {
|
|
10635
10656
|
throw new ResearchError("RESEARCH_CONTEXT_UNAVAILABLE", "The current plan could not be read", { cause: error });
|
|
10636
10657
|
}
|
|
10637
10658
|
};
|
|
10638
|
-
const currentPlan = await readPlan();
|
|
10659
|
+
const { plan: currentPlan, anchorEventId: planAnchor } = await readPlan();
|
|
10639
10660
|
let page = await options.readTimeline(sessionId);
|
|
10640
10661
|
if (page.cursorStatus === "expired") throw new ResearchError("RESEARCH_CONTEXT_CHANGED");
|
|
10641
10662
|
const headIdentity = JSON.stringify(page);
|
|
10642
10663
|
let selectedCursor;
|
|
10643
|
-
for (let count = 1; sourceItemId
|
|
10664
|
+
for (let count = 1; (sourceItemId === void 0 ? page.items.length === 0 : !page.items.some((item) => item.id === sourceItemId)) && page.hasMore && count < MAX_ANCHOR_PAGES; count += 1) {
|
|
10644
10665
|
selectedCursor = page.cursor;
|
|
10645
10666
|
page = await options.readTimeline(sessionId, { cursor: selectedCursor });
|
|
10646
10667
|
if (page.cursorStatus === "expired") throw new ResearchError("RESEARCH_CONTEXT_CHANGED");
|
|
10647
10668
|
}
|
|
10648
10669
|
const index = sourceItemId === void 0 ? page.items.length - 1 : page.items.findIndex((item) => item.id === sourceItemId);
|
|
10649
|
-
|
|
10670
|
+
const emptyHistory = sourceItemId === void 0 && page.items.length === 0 && !page.hasMore;
|
|
10671
|
+
if (index < 0 && !emptyHistory) throw new ResearchError("RESEARCH_CONTEXT_UNAVAILABLE");
|
|
10650
10672
|
const items = page.items.slice(0, index + 1);
|
|
10651
|
-
const anchor = items.at(-1)?.sourceEventIds.at(-1);
|
|
10673
|
+
const anchor = emptyHistory ? planAnchor : items.at(-1)?.sourceEventIds.at(-1);
|
|
10652
10674
|
if (anchor === void 0) throw new ResearchError("RESEARCH_CONTEXT_UNAVAILABLE");
|
|
10653
10675
|
const units = [];
|
|
10654
10676
|
for (const item of items) {
|
|
@@ -10662,6 +10684,7 @@ function createResearchContextReader(options) {
|
|
|
10662
10684
|
}
|
|
10663
10685
|
const selected = [];
|
|
10664
10686
|
let length = JSON.stringify({ conversation: [], currentPlan }).length;
|
|
10687
|
+
if (length > MAX_CONTEXT_LENGTH) throw new ResearchError("RESEARCH_CONTEXT_TOO_LARGE");
|
|
10665
10688
|
for (const unit of [...units].reverse()) {
|
|
10666
10689
|
const text = JSON.stringify(unit.map(contextItem));
|
|
10667
10690
|
if (length + text.length + (selected.length > 0 ? 1 : 0) > MAX_CONTEXT_LENGTH) {
|
|
@@ -10672,8 +10695,8 @@ function createResearchContextReader(options) {
|
|
|
10672
10695
|
selected.unshift(text);
|
|
10673
10696
|
length += text.length + (selected.length > 1 ? 1 : 0);
|
|
10674
10697
|
}
|
|
10675
|
-
if (selected.length === 0) throw new ResearchError("RESEARCH_CONTEXT_UNAVAILABLE");
|
|
10676
|
-
if (JSON.stringify(await readPlan()) !== JSON.stringify(currentPlan)) {
|
|
10698
|
+
if (selected.length === 0 && !emptyHistory) throw new ResearchError("RESEARCH_CONTEXT_UNAVAILABLE");
|
|
10699
|
+
if (JSON.stringify((await readPlan()).plan) !== JSON.stringify(currentPlan)) {
|
|
10677
10700
|
throw new ResearchError("RESEARCH_CONTEXT_CHANGED");
|
|
10678
10701
|
}
|
|
10679
10702
|
if (selectedCursor !== void 0 && JSON.stringify(await options.readTimeline(sessionId, { cursor: selectedCursor })) !== JSON.stringify(page)) {
|
|
@@ -11803,7 +11826,7 @@ var preconditionMessages = {
|
|
|
11803
11826
|
RESEARCH_SOURCE_MISMATCH: "The source context does not match this session",
|
|
11804
11827
|
RESEARCH_SOURCE_INVALID: "Choose a main session as the research source",
|
|
11805
11828
|
RESEARCH_CONTEXT_CHANGED: "The source conversation changed; refresh it before starting research",
|
|
11806
|
-
RESEARCH_CONTEXT_UNAVAILABLE: "
|
|
11829
|
+
RESEARCH_CONTEXT_UNAVAILABLE: "The source conversation could not be read. Try sending again.",
|
|
11807
11830
|
RESEARCH_CONTEXT_TOO_LARGE: "The selected conversation unit is too large for research; choose another message",
|
|
11808
11831
|
RESEARCH_OPERATION_CONFLICT: "The operation ID was reused with different research data",
|
|
11809
11832
|
RESEARCH_THREAD_LIMIT: "The research thread limit has been reached",
|
|
@@ -11838,7 +11861,18 @@ function createResearchWorkbench(options) {
|
|
|
11838
11861
|
insights: (sessionId) => researchOperation(() => sessions.insights(sessionId)),
|
|
11839
11862
|
create: (input) => researchOperation(async () => {
|
|
11840
11863
|
const assertAccess = options.captureSourceAccess?.(input.parentSessionId);
|
|
11841
|
-
|
|
11864
|
+
let snapshot;
|
|
11865
|
+
for (let attempt = 0; ; attempt++) {
|
|
11866
|
+
assertAccess?.();
|
|
11867
|
+
try {
|
|
11868
|
+
snapshot = await options.contextSnapshot(input.parentSessionId, input.sourceItemId);
|
|
11869
|
+
break;
|
|
11870
|
+
} catch (error) {
|
|
11871
|
+
if (!(error instanceof ResearchError) || input.sourceItemId !== void 0 || attempt >= 2 || !["RESEARCH_CONTEXT_CHANGED", "RESEARCH_CONTEXT_UNAVAILABLE"].includes(error.code)) throw error;
|
|
11872
|
+
options.onError?.(error);
|
|
11873
|
+
await new Promise((resolve5) => setTimeout(resolve5, 250 * (attempt + 1)));
|
|
11874
|
+
}
|
|
11875
|
+
}
|
|
11842
11876
|
assertAccess?.();
|
|
11843
11877
|
return projectThread(await sessions.create({
|
|
11844
11878
|
operationId: input.operationId,
|
package/dist/runtime.js
CHANGED
|
@@ -3,8 +3,8 @@ import {
|
|
|
3
3
|
PEER_CHAT_TIMEOUT_MS,
|
|
4
4
|
PeerChatRequestSchema,
|
|
5
5
|
PeerChatResultSchema
|
|
6
|
-
} from "./chunks/chunk-
|
|
7
|
-
import "./chunks/chunk-
|
|
6
|
+
} from "./chunks/chunk-CHKNC6PD.js";
|
|
7
|
+
import "./chunks/chunk-P2PH5KMV.js";
|
|
8
8
|
export {
|
|
9
9
|
DataDirectoryLease,
|
|
10
10
|
PEER_CHAT_TIMEOUT_MS,
|
|
@@ -2,12 +2,12 @@ import {
|
|
|
2
2
|
AnalyticsCommandSchema,
|
|
3
3
|
AnalyticsEventSchema,
|
|
4
4
|
openSessionEventLog
|
|
5
|
-
} from "./chunks/chunk-
|
|
6
|
-
import "./chunks/chunk-
|
|
7
|
-
import "./chunks/chunk-
|
|
5
|
+
} from "./chunks/chunk-CM5LVXVL.js";
|
|
6
|
+
import "./chunks/chunk-ZNQ2I5EF.js";
|
|
7
|
+
import "./chunks/chunk-H4SHMWQ6.js";
|
|
8
8
|
import {
|
|
9
9
|
SessionOperationError
|
|
10
|
-
} from "./chunks/chunk-
|
|
10
|
+
} from "./chunks/chunk-7OGTK7KB.js";
|
|
11
11
|
import {
|
|
12
12
|
SessionAnalyticsResultSchema,
|
|
13
13
|
SessionSkillInfoSchema,
|
|
@@ -15,7 +15,7 @@ import {
|
|
|
15
15
|
WorkbenchContextSampleSchema,
|
|
16
16
|
WorkbenchTelemetrySchema,
|
|
17
17
|
WorkbenchUsageCallSchema
|
|
18
|
-
} from "./chunks/chunk-
|
|
18
|
+
} from "./chunks/chunk-P2PH5KMV.js";
|
|
19
19
|
|
|
20
20
|
// src/session-analytics-worker.ts
|
|
21
21
|
import { parentPort, workerData, isMainThread as isMainThread2 } from "node:worker_threads";
|