@morty-build/cli 0.4.3 → 0.4.5
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/{chunk-OEX63ZJX.js → chunk-DUNSEOXK.js} +2 -2
- package/dist/{chunk-OEX63ZJX.js.map → chunk-DUNSEOXK.js.map} +1 -1
- package/dist/{chunk-DVSX6ALB.js → chunk-IOB4UFOK.js} +763 -780
- package/dist/{chunk-DVSX6ALB.js.map → chunk-IOB4UFOK.js.map} +4 -4
- package/dist/{cli-3TKBBY7N.js → cli-SYW44S5V.js} +3 -3
- package/dist/cli.js +2 -2
- package/dist/engine/generated/acp-session-store-migrations.d.ts +6 -0
- package/dist/engine/generated/acp-session-store-migrations.d.ts.map +1 -1
- package/dist/engine/generated/acp-session-store-migrations.js +9 -1
- package/dist/engine/generated/acp-session-store-migrations.js.map +1 -1
- package/dist/engine/runtime/command/registry/prompt.d.ts.map +1 -1
- package/dist/engine/runtime/command/registry/prompt.js +16 -3
- package/dist/engine/runtime/command/registry/prompt.js.map +1 -1
- package/dist/engine/schema/{command-cancellation/cancelled-command.d.ts → acp-session-store/command-outcome.d.ts} +10 -7
- package/dist/engine/schema/acp-session-store/command-outcome.d.ts.map +1 -0
- package/dist/engine/schema/acp-session-store/command-outcome.js +10 -0
- package/dist/engine/schema/acp-session-store/command-outcome.js.map +1 -0
- package/dist/engine/schema/acp-session-store/{execution-receipt.d.ts → command.d.ts} +20 -32
- package/dist/engine/schema/acp-session-store/command.d.ts.map +1 -0
- package/dist/engine/schema/acp-session-store/command.js +24 -0
- package/dist/engine/schema/acp-session-store/command.js.map +1 -0
- package/dist/engine/schema/acp-session-store/index.d.ts +2 -2
- package/dist/engine/schema/acp-session-store/index.d.ts.map +1 -1
- package/dist/engine/schema/acp-session-store/index.js +2 -2
- package/dist/engine/schema/acp-session-store/index.js.map +1 -1
- package/dist/engine/session/api/session-api.d.ts +0 -2
- package/dist/engine/session/api/session-api.d.ts.map +1 -1
- package/dist/engine/session/api/session-api.js.map +1 -1
- package/dist/engine/session/api/session-layer.d.ts.map +1 -1
- package/dist/engine/session/api/session-layer.js +3 -7
- package/dist/engine/session/api/session-layer.js.map +1 -1
- package/dist/engine/session/prompt/execute-prompt.d.ts +4 -9
- package/dist/engine/session/prompt/execute-prompt.d.ts.map +1 -1
- package/dist/engine/session/prompt/execute-prompt.js +9 -19
- package/dist/engine/session/prompt/execute-prompt.js.map +1 -1
- package/dist/engine/session/prompt/prompt-lifecycle.d.ts +2 -1
- package/dist/engine/session/prompt/prompt-lifecycle.d.ts.map +1 -1
- package/dist/engine/session/prompt/prompt-lifecycle.js +9 -6
- package/dist/engine/session/prompt/prompt-lifecycle.js.map +1 -1
- package/dist/engine/session/turn/active-turn.d.ts +17 -2
- package/dist/engine/session/turn/active-turn.d.ts.map +1 -1
- package/dist/engine/session/turn/active-turn.js +23 -15
- package/dist/engine/session/turn/active-turn.js.map +1 -1
- package/dist/engine/session/turn/execution-receipts.d.ts +28 -21
- package/dist/engine/session/turn/execution-receipts.d.ts.map +1 -1
- package/dist/engine/session/turn/execution-receipts.js +173 -259
- package/dist/engine/session/turn/execution-receipts.js.map +1 -1
- package/dist/engine/session/turn/session-execution.d.ts +7 -10
- package/dist/engine/session/turn/session-execution.d.ts.map +1 -1
- package/dist/engine/session/turn/session-execution.js +13 -19
- package/dist/engine/session/turn/session-execution.js.map +1 -1
- package/dist/engine/session/turn/session-turns.d.ts +2 -3
- package/dist/engine/session/turn/session-turns.d.ts.map +1 -1
- package/dist/engine/session/turn/session-turns.js.map +1 -1
- package/dist/engine/storage/session/command-ledger-table.d.ts +68 -0
- package/dist/engine/storage/session/command-ledger-table.d.ts.map +1 -0
- package/dist/engine/storage/session/command-ledger-table.js +172 -0
- package/dist/engine/storage/session/command-ledger-table.js.map +1 -0
- package/dist/engine/storage/sqlite/local-databases.d.ts +0 -3
- package/dist/engine/storage/sqlite/local-databases.d.ts.map +1 -1
- package/dist/engine/storage/sqlite/local-databases.js +0 -4
- package/dist/engine/storage/sqlite/local-databases.js.map +1 -1
- package/dist/engine.js +2 -2
- package/package.json +1 -1
- package/dist/engine/generated/command-cancellation-migrations.d.ts +0 -5
- package/dist/engine/generated/command-cancellation-migrations.d.ts.map +0 -1
- package/dist/engine/generated/command-cancellation-migrations.js +0 -9
- package/dist/engine/generated/command-cancellation-migrations.js.map +0 -1
- package/dist/engine/schema/acp-session-store/execution-identity.d.ts +0 -57
- package/dist/engine/schema/acp-session-store/execution-identity.d.ts.map +0 -1
- package/dist/engine/schema/acp-session-store/execution-identity.js +0 -8
- package/dist/engine/schema/acp-session-store/execution-identity.js.map +0 -1
- package/dist/engine/schema/acp-session-store/execution-receipt.d.ts.map +0 -1
- package/dist/engine/schema/acp-session-store/execution-receipt.js +0 -12
- package/dist/engine/schema/acp-session-store/execution-receipt.js.map +0 -1
- package/dist/engine/schema/command-cancellation/cancelled-command.d.ts.map +0 -1
- package/dist/engine/schema/command-cancellation/cancelled-command.js +0 -7
- package/dist/engine/schema/command-cancellation/cancelled-command.js.map +0 -1
- package/dist/engine/schema/command-cancellation/index.d.ts +0 -2
- package/dist/engine/schema/command-cancellation/index.d.ts.map +0 -1
- package/dist/engine/schema/command-cancellation/index.js +0 -2
- package/dist/engine/schema/command-cancellation/index.js.map +0 -1
- package/dist/engine/storage/session/command-cancellation-table.d.ts +0 -17
- package/dist/engine/storage/session/command-cancellation-table.d.ts.map +0 -1
- package/dist/engine/storage/session/command-cancellation-table.js +0 -28
- package/dist/engine/storage/session/command-cancellation-table.js.map +0 -1
- package/dist/engine/storage/session/execution-receipt-table.d.ts +0 -28
- package/dist/engine/storage/session/execution-receipt-table.d.ts.map +0 -1
- package/dist/engine/storage/session/execution-receipt-table.js +0 -87
- package/dist/engine/storage/session/execution-receipt-table.js.map +0 -1
- /package/dist/{cli-3TKBBY7N.js.map → cli-SYW44S5V.js.map} +0 -0
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
__export,
|
|
4
4
|
__using,
|
|
5
5
|
package_default
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-DUNSEOXK.js";
|
|
7
7
|
|
|
8
8
|
// src/engine/runtime/relay/runtime-revocation.ts
|
|
9
9
|
var runtimeRevocationCloseCode = 1008;
|
|
@@ -1285,9 +1285,9 @@ function sizeCaps(defChecks) {
|
|
|
1285
1285
|
const d8 = ch._zod.def;
|
|
1286
1286
|
if (!/_(length|size)$|_equals$/.test(d8.check))
|
|
1287
1287
|
break;
|
|
1288
|
-
const
|
|
1289
|
-
if (
|
|
1290
|
-
caps.push([
|
|
1288
|
+
const max2 = d8.maximum ?? d8.length ?? d8.size;
|
|
1289
|
+
if (max2 >= 0)
|
|
1290
|
+
caps.push([max2, ch]);
|
|
1291
1291
|
}
|
|
1292
1292
|
return caps;
|
|
1293
1293
|
}
|
|
@@ -1335,14 +1335,14 @@ function codePointLength(str) {
|
|
|
1335
1335
|
const units = str.length;
|
|
1336
1336
|
if (!highSurrogate.test(str))
|
|
1337
1337
|
return units;
|
|
1338
|
-
let
|
|
1338
|
+
let count2 = units;
|
|
1339
1339
|
for (let i = 0; i < units - 1; i++) {
|
|
1340
1340
|
if ((str.charCodeAt(i) & 64512) === 55296 && (str.charCodeAt(i + 1) & 64512) === 56320) {
|
|
1341
|
-
|
|
1341
|
+
count2--;
|
|
1342
1342
|
i++;
|
|
1343
1343
|
}
|
|
1344
1344
|
}
|
|
1345
|
-
return
|
|
1345
|
+
return count2;
|
|
1346
1346
|
}
|
|
1347
1347
|
function getLengthableOrigin(input2) {
|
|
1348
1348
|
if (Array.isArray(input2))
|
|
@@ -3177,13 +3177,13 @@ var CC_SANITIZE = /[- ]/g;
|
|
|
3177
3177
|
function isLuhnAlgo(digits) {
|
|
3178
3178
|
let length = digits.length;
|
|
3179
3179
|
let bit = 1;
|
|
3180
|
-
let
|
|
3180
|
+
let sum2 = 0;
|
|
3181
3181
|
while (length) {
|
|
3182
3182
|
const value = digits.charCodeAt(--length) - 48;
|
|
3183
3183
|
bit ^= 1;
|
|
3184
|
-
|
|
3184
|
+
sum2 += bit ? [0, 2, 4, 6, 8, 1, 3, 5, 7, 9][value] : value;
|
|
3185
3185
|
}
|
|
3186
|
-
return
|
|
3186
|
+
return sum2 % 10 === 0;
|
|
3187
3187
|
}
|
|
3188
3188
|
function isValidCreditCard(input2) {
|
|
3189
3189
|
if (!creditCard.test(input2))
|
|
@@ -3476,8 +3476,8 @@ function capSize(inst, size) {
|
|
|
3476
3476
|
inst._zod.parse = (payload, ctx) => {
|
|
3477
3477
|
const n = size(payload.value);
|
|
3478
3478
|
if (n > cap && !ctx?.skipChecks && ctx?.direction !== "backward") {
|
|
3479
|
-
for (const [
|
|
3480
|
-
if (n >
|
|
3479
|
+
for (const [max2, ch] of sizeCaps(inst._zod.def.checks)) {
|
|
3480
|
+
if (n > max2 && ch._zod.def.when(payload)) {
|
|
3481
3481
|
const start = payload.issues.length;
|
|
3482
3482
|
ch._zod.check(payload);
|
|
3483
3483
|
payload.issues[start].continue = false;
|
|
@@ -5183,7 +5183,7 @@ function isRecursive(inst, stack, resolve19) {
|
|
|
5183
5183
|
return PROVEN;
|
|
5184
5184
|
stack.add(inst);
|
|
5185
5185
|
let result = NONE;
|
|
5186
|
-
const
|
|
5186
|
+
const check3 = (child) => {
|
|
5187
5187
|
if (result !== PROVEN && child?._zod) {
|
|
5188
5188
|
const answer = isRecursive(child, stack, resolve19);
|
|
5189
5189
|
if (answer > result)
|
|
@@ -5212,32 +5212,32 @@ function isRecursive(inst, stack, resolve19) {
|
|
|
5212
5212
|
case "object": {
|
|
5213
5213
|
const raw = rawShape(def);
|
|
5214
5214
|
merge2(raw ? shape(raw, true) : ASSUMED);
|
|
5215
|
-
|
|
5215
|
+
check3(def.catchall);
|
|
5216
5216
|
break;
|
|
5217
5217
|
}
|
|
5218
5218
|
case "array":
|
|
5219
|
-
|
|
5219
|
+
check3(def.element);
|
|
5220
5220
|
break;
|
|
5221
5221
|
case "tuple":
|
|
5222
5222
|
for (const el2 of def.items)
|
|
5223
|
-
|
|
5224
|
-
|
|
5223
|
+
check3(el2);
|
|
5224
|
+
check3(def.rest);
|
|
5225
5225
|
break;
|
|
5226
5226
|
case "record":
|
|
5227
5227
|
case "map":
|
|
5228
|
-
|
|
5229
|
-
|
|
5228
|
+
check3(def.keyType);
|
|
5229
|
+
check3(def.valueType);
|
|
5230
5230
|
break;
|
|
5231
5231
|
case "set":
|
|
5232
|
-
|
|
5232
|
+
check3(def.valueType);
|
|
5233
5233
|
break;
|
|
5234
5234
|
case "union":
|
|
5235
5235
|
for (const el2 of def.options)
|
|
5236
|
-
|
|
5236
|
+
check3(el2);
|
|
5237
5237
|
break;
|
|
5238
5238
|
case "intersection":
|
|
5239
|
-
|
|
5240
|
-
|
|
5239
|
+
check3(def.left);
|
|
5240
|
+
check3(def.right);
|
|
5241
5241
|
break;
|
|
5242
5242
|
case "optional":
|
|
5243
5243
|
case "nullable":
|
|
@@ -5248,15 +5248,15 @@ function isRecursive(inst, stack, resolve19) {
|
|
|
5248
5248
|
case "nonoptional":
|
|
5249
5249
|
case "promise":
|
|
5250
5250
|
case "success":
|
|
5251
|
-
|
|
5251
|
+
check3(def.innerType);
|
|
5252
5252
|
break;
|
|
5253
5253
|
case "pipe":
|
|
5254
|
-
|
|
5255
|
-
|
|
5254
|
+
check3(def.in);
|
|
5255
|
+
check3(def.out);
|
|
5256
5256
|
break;
|
|
5257
5257
|
case "function":
|
|
5258
|
-
|
|
5259
|
-
|
|
5258
|
+
check3(def.input);
|
|
5259
|
+
check3(def.output);
|
|
5260
5260
|
break;
|
|
5261
5261
|
// `$ZodLazy` caches its inner on the def, so a resolved edge is followed exactly
|
|
5262
5262
|
case "lazy": {
|
|
@@ -5297,10 +5297,10 @@ function isRecursive(inst, stack, resolve19) {
|
|
|
5297
5297
|
if (!value || typeof value !== "object")
|
|
5298
5298
|
continue;
|
|
5299
5299
|
if (value._zod)
|
|
5300
|
-
|
|
5300
|
+
check3(value);
|
|
5301
5301
|
else if (Array.isArray(value))
|
|
5302
5302
|
for (const el2 of value)
|
|
5303
|
-
|
|
5303
|
+
check3(el2);
|
|
5304
5304
|
}
|
|
5305
5305
|
}
|
|
5306
5306
|
}
|
|
@@ -5725,8 +5725,8 @@ function az_default() {
|
|
|
5725
5725
|
}
|
|
5726
5726
|
|
|
5727
5727
|
// ../../node_modules/.pnpm/zod@4.6.7/node_modules/zod/v4/locales/be.js
|
|
5728
|
-
function getBelarusianPlural(
|
|
5729
|
-
const absCount = Math.abs(
|
|
5728
|
+
function getBelarusianPlural(count2, one2, few, many) {
|
|
5729
|
+
const absCount = Math.abs(count2);
|
|
5730
5730
|
const lastDigit = absCount % 10;
|
|
5731
5731
|
const lastTwoDigits = absCount % 100;
|
|
5732
5732
|
if (lastTwoDigits >= 11 && lastTwoDigits <= 19) {
|
|
@@ -8373,8 +8373,8 @@ function hu_default() {
|
|
|
8373
8373
|
}
|
|
8374
8374
|
|
|
8375
8375
|
// ../../node_modules/.pnpm/zod@4.6.7/node_modules/zod/v4/locales/hy.js
|
|
8376
|
-
function getArmenianPlural(
|
|
8377
|
-
return Math.abs(
|
|
8376
|
+
function getArmenianPlural(count2, one2, many) {
|
|
8377
|
+
return Math.abs(count2) === 1 ? one2 : many;
|
|
8378
8378
|
}
|
|
8379
8379
|
function withDefiniteArticle(word) {
|
|
8380
8380
|
if (!word)
|
|
@@ -11112,8 +11112,8 @@ function ro_default() {
|
|
|
11112
11112
|
}
|
|
11113
11113
|
|
|
11114
11114
|
// ../../node_modules/.pnpm/zod@4.6.7/node_modules/zod/v4/locales/ru.js
|
|
11115
|
-
function getRussianPlural(
|
|
11116
|
-
const absCount = Math.abs(
|
|
11115
|
+
function getRussianPlural(count2, one2, few, many) {
|
|
11116
|
+
const absCount = Math.abs(count2);
|
|
11117
11117
|
const lastDigit = absCount % 10;
|
|
11118
11118
|
const lastTwoDigits = absCount % 100;
|
|
11119
11119
|
if (lastTwoDigits >= 11 && lastTwoDigits <= 19) {
|
|
@@ -13246,8 +13246,8 @@ function generateChecks(doc, ctx, schema, accessor) {
|
|
|
13246
13246
|
if (!schemaChecks || schemaChecks.length === 0)
|
|
13247
13247
|
return accessor;
|
|
13248
13248
|
let currentAccessor = accessor;
|
|
13249
|
-
for (const
|
|
13250
|
-
const def =
|
|
13249
|
+
for (const check3 of schemaChecks) {
|
|
13250
|
+
const def = check3._zod.def;
|
|
13251
13251
|
if (def.when && !WHEN_DEFAULTED_CHECKS.has(def.check)) {
|
|
13252
13252
|
throw new ZodCompileUnsupportedError(`check with a custom "when" condition`);
|
|
13253
13253
|
}
|
|
@@ -13265,15 +13265,15 @@ function generateChecks(doc, ctx, schema, accessor) {
|
|
|
13265
13265
|
generateNumberFormatCheck(doc, def, currentAccessor);
|
|
13266
13266
|
break;
|
|
13267
13267
|
case "min_length": {
|
|
13268
|
-
const
|
|
13269
|
-
const len = codePointLengthVar(doc, ctx, currentAccessor, `${currentAccessor}.length >= ${
|
|
13270
|
-
doc.write(`if (${len} < ${
|
|
13268
|
+
const min2 = numericOperand(def.minimum, "min_length");
|
|
13269
|
+
const len = codePointLengthVar(doc, ctx, currentAccessor, `${currentAccessor}.length >= ${min2} && ${currentAccessor}.length < ${def.minimum * 2}`);
|
|
13270
|
+
doc.write(`if (${len} < ${min2}) return INVALID;`);
|
|
13271
13271
|
break;
|
|
13272
13272
|
}
|
|
13273
13273
|
case "max_length": {
|
|
13274
|
-
const
|
|
13275
|
-
const len = codePointLengthVar(doc, ctx, currentAccessor, `${currentAccessor}.length > ${
|
|
13276
|
-
doc.write(`if (${len} > ${
|
|
13274
|
+
const max2 = numericOperand(def.maximum, "max_length");
|
|
13275
|
+
const len = codePointLengthVar(doc, ctx, currentAccessor, `${currentAccessor}.length > ${max2}`);
|
|
13276
|
+
doc.write(`if (${len} > ${max2}) return INVALID;`);
|
|
13277
13277
|
break;
|
|
13278
13278
|
}
|
|
13279
13279
|
case "length_equals": {
|
|
@@ -13295,7 +13295,7 @@ function generateChecks(doc, ctx, schema, accessor) {
|
|
|
13295
13295
|
currentAccessor = generateStringFormatCheck(doc, ctx, def, currentAccessor);
|
|
13296
13296
|
break;
|
|
13297
13297
|
case "custom":
|
|
13298
|
-
currentAccessor = generateCustomRefineCheck(doc, ctx,
|
|
13298
|
+
currentAccessor = generateCustomRefineCheck(doc, ctx, check3, currentAccessor);
|
|
13299
13299
|
break;
|
|
13300
13300
|
case "bigint_format":
|
|
13301
13301
|
generateBigIntFormatCheck(doc, def, currentAccessor);
|
|
@@ -13311,7 +13311,7 @@ function generateChecks(doc, ctx, schema, accessor) {
|
|
|
13311
13311
|
break;
|
|
13312
13312
|
case "overwrite": {
|
|
13313
13313
|
const newAccessor = newVar(ctx);
|
|
13314
|
-
generateOverwriteCheck(doc, ctx,
|
|
13314
|
+
generateOverwriteCheck(doc, ctx, check3, currentAccessor, newAccessor);
|
|
13315
13315
|
currentAccessor = newAccessor;
|
|
13316
13316
|
break;
|
|
13317
13317
|
}
|
|
@@ -13434,8 +13434,8 @@ function generatePropertyCheck(doc, ctx, def, accessor) {
|
|
|
13434
13434
|
const propAccessor = `${accessor}[${JSON.stringify(def.property)}]`;
|
|
13435
13435
|
generateCheck(doc, ctx, def.schema, propAccessor);
|
|
13436
13436
|
}
|
|
13437
|
-
function generateOverwriteCheck(doc, ctx,
|
|
13438
|
-
const tx2 =
|
|
13437
|
+
function generateOverwriteCheck(doc, ctx, check3, currentAccessor, newAccessor) {
|
|
13438
|
+
const tx2 = check3._zod.def.tx;
|
|
13439
13439
|
if (!tx2) {
|
|
13440
13440
|
throw new ZodCompileUnsupportedError("overwrite check without a transform function");
|
|
13441
13441
|
}
|
|
@@ -13451,8 +13451,8 @@ function throwAsync() {
|
|
|
13451
13451
|
function pushIssue(issue2) {
|
|
13452
13452
|
this.issues.push(issue2);
|
|
13453
13453
|
}
|
|
13454
|
-
function generateCustomRefineCheck(doc, ctx,
|
|
13455
|
-
const def =
|
|
13454
|
+
function generateCustomRefineCheck(doc, ctx, check3, accessor) {
|
|
13455
|
+
const def = check3._zod.def;
|
|
13456
13456
|
if (def.fn) {
|
|
13457
13457
|
if (isAsyncFunction(def.fn)) {
|
|
13458
13458
|
throw new ZodCompileAsyncError("z.compile: async .refine() predicates are not supported");
|
|
@@ -13465,11 +13465,11 @@ function generateCustomRefineCheck(doc, ctx, check2, accessor) {
|
|
|
13465
13465
|
doc.write(`if (!${resVar}) return INVALID;`);
|
|
13466
13466
|
return accessor;
|
|
13467
13467
|
}
|
|
13468
|
-
if (
|
|
13469
|
-
if (isAsyncFunction(
|
|
13468
|
+
if (check3._zod.check) {
|
|
13469
|
+
if (isAsyncFunction(check3._zod.check)) {
|
|
13470
13470
|
throw new ZodCompileAsyncError("z.compile: async .superRefine() / check functions are not supported");
|
|
13471
13471
|
}
|
|
13472
|
-
const checkFn =
|
|
13472
|
+
const checkFn = check3._zod.check;
|
|
13473
13473
|
const helperFn = (value) => {
|
|
13474
13474
|
const fakePayload = { value, issues: [], addIssue: pushIssue };
|
|
13475
13475
|
const result = checkFn(fakePayload);
|
|
@@ -14091,8 +14091,8 @@ function generateNullableCheck(doc, ctx, schema, accessor, buildsValue = true) {
|
|
|
14091
14091
|
return outputVar;
|
|
14092
14092
|
}
|
|
14093
14093
|
function generateSizeGate(doc, schema, size) {
|
|
14094
|
-
for (const [
|
|
14095
|
-
doc.write(`if (${size} > ${numericOperand(
|
|
14094
|
+
for (const [max2, check3] of sizeCaps(schema._zod.def.checks)) {
|
|
14095
|
+
doc.write(`if (${size} > ${numericOperand(max2, check3._zod.def.check)}) return INVALID;`);
|
|
14096
14096
|
}
|
|
14097
14097
|
}
|
|
14098
14098
|
function generateArrayCheck(doc, ctx, schema, accessor, buildsValue = true) {
|
|
@@ -17392,8 +17392,8 @@ var ZodType = /* @__PURE__ */ $constructor("ZodType", (inst, def) => {
|
|
|
17392
17392
|
reg.add(this, meta3);
|
|
17393
17393
|
return this;
|
|
17394
17394
|
},
|
|
17395
|
-
refine(
|
|
17396
|
-
return this.check(refine(
|
|
17395
|
+
refine(check3, params) {
|
|
17396
|
+
return this.check(refine(check3, params));
|
|
17397
17397
|
},
|
|
17398
17398
|
superRefine(refinement, params) {
|
|
17399
17399
|
return this.check(superRefine(refinement, params));
|
|
@@ -21199,8 +21199,8 @@ var sessionPrepareCommandSchema = external_exports.object({
|
|
|
21199
21199
|
sessionState: external_exports.literal("provisioned").optional(),
|
|
21200
21200
|
/** Marks an inspection-only Session preparation. */
|
|
21201
21201
|
transient: external_exports.boolean().optional()
|
|
21202
|
-
}).superRefine((
|
|
21203
|
-
if (
|
|
21202
|
+
}).superRefine((command2, context) => {
|
|
21203
|
+
if (command2.transient === true && command2.sessionState === "provisioned") {
|
|
21204
21204
|
context.addIssue({
|
|
21205
21205
|
code: "custom",
|
|
21206
21206
|
message: "A transient Session cannot already be provisioned",
|
|
@@ -21310,8 +21310,7 @@ var SESSION_PROMPT_DISPOSITION_KIND = "session.prompt.disposition";
|
|
|
21310
21310
|
var SESSION_CANCEL_KIND = "session.cancel";
|
|
21311
21311
|
var SESSION_CANCEL_BEFORE_START_KIND = "session.cancel-before-start";
|
|
21312
21312
|
var SessionPromptDisposition = Object.freeze({
|
|
21313
|
-
|
|
21314
|
-
Reject: "reject",
|
|
21313
|
+
Append: "append",
|
|
21315
21314
|
Steer: "steer"
|
|
21316
21315
|
});
|
|
21317
21316
|
var SessionHistoryPolicy = Object.freeze({
|
|
@@ -21339,18 +21338,21 @@ var promptAttachmentSchema = external_exports.object({
|
|
|
21339
21338
|
uri: external_exports.string().min(1).max(4096)
|
|
21340
21339
|
}).readonly();
|
|
21341
21340
|
var decodePromptAttachmentsValue = (value) => decodeZodValue(value, external_exports.array(promptAttachmentSchema).max(16).readonly());
|
|
21342
|
-
function
|
|
21343
|
-
|
|
21344
|
-
|
|
21345
|
-
|
|
21346
|
-
|
|
21347
|
-
|
|
21348
|
-
|
|
21349
|
-
|
|
21350
|
-
|
|
21351
|
-
|
|
21341
|
+
function readPromptPlacement(value) {
|
|
21342
|
+
switch (value["disposition"]) {
|
|
21343
|
+
case SessionPromptDisposition.Append:
|
|
21344
|
+
if (Object.hasOwn(value, "targetCommandId")) {
|
|
21345
|
+
throw new ProtocolMessageError("An appended prompt names no target command");
|
|
21346
|
+
}
|
|
21347
|
+
return { disposition: SessionPromptDisposition.Append };
|
|
21348
|
+
case SessionPromptDisposition.Steer:
|
|
21349
|
+
return {
|
|
21350
|
+
disposition: SessionPromptDisposition.Steer,
|
|
21351
|
+
targetCommandId: readIdentifier(value, "targetCommandId")
|
|
21352
|
+
};
|
|
21353
|
+
default:
|
|
21354
|
+
throw new ProtocolMessageError("Invalid value field: disposition");
|
|
21352
21355
|
}
|
|
21353
|
-
throw new ProtocolMessageError("Invalid value field: disposition");
|
|
21354
21356
|
}
|
|
21355
21357
|
function decodeSessionPromptCommand(encoded) {
|
|
21356
21358
|
const value = parseJson(encoded);
|
|
@@ -21365,11 +21367,7 @@ function decodeSessionPromptCommand(encoded) {
|
|
|
21365
21367
|
if (prompt.trim().length === 0 && attachments.length === 0) {
|
|
21366
21368
|
throw new ProtocolMessageError("Prompt must contain content");
|
|
21367
21369
|
}
|
|
21368
|
-
const
|
|
21369
|
-
const targetCommandId = readText(value, "targetCommandId", 128);
|
|
21370
|
-
if (disposition === SessionPromptDisposition.Reject && targetCommandId.length > 0 || disposition !== SessionPromptDisposition.Reject && !isIdentifier(targetCommandId)) {
|
|
21371
|
-
throw new ProtocolMessageError("Prompt disposition has an invalid target command");
|
|
21372
|
-
}
|
|
21370
|
+
const placement = readPromptPlacement(value);
|
|
21373
21371
|
const sessionConfigurations = hasSessionConfigurations ? decodeSessionConfigurationSelections(value["sessionConfigurations"]) : [];
|
|
21374
21372
|
if (new Set(sessionConfigurations.map((selection) => selection.configId)).size !== sessionConfigurations.length) {
|
|
21375
21373
|
throw new ProtocolMessageError("Session configuration identifiers must be unique");
|
|
@@ -21380,14 +21378,13 @@ function decodeSessionPromptCommand(encoded) {
|
|
|
21380
21378
|
bindingId: readIdentifier(value, "bindingId"),
|
|
21381
21379
|
commandId: readIdentifier(value, "commandId"),
|
|
21382
21380
|
directoryId: readDirectoryIdentifier(value, "directoryId"),
|
|
21383
|
-
disposition,
|
|
21384
21381
|
attachments,
|
|
21385
21382
|
historyPolicy: readHistoryPolicy(value),
|
|
21386
21383
|
kind: SESSION_PROMPT_KIND,
|
|
21387
21384
|
prompt,
|
|
21388
21385
|
...hasSessionConfigurations ? { sessionConfigurations } : {},
|
|
21389
21386
|
sessionId: readIdentifier(value, "sessionId"),
|
|
21390
|
-
|
|
21387
|
+
...placement
|
|
21391
21388
|
};
|
|
21392
21389
|
}
|
|
21393
21390
|
function readHistoryPolicy(value) {
|
|
@@ -21409,7 +21406,7 @@ function decodeSessionCancelCommand(encoded) {
|
|
|
21409
21406
|
function decodeSessionPromptDispositionCommand(encoded) {
|
|
21410
21407
|
const value = parseJson(encoded);
|
|
21411
21408
|
assertKind(value, SESSION_PROMPT_DISPOSITION_KIND);
|
|
21412
|
-
if (
|
|
21409
|
+
if (value["disposition"] !== SessionPromptDisposition.Steer) {
|
|
21413
21410
|
throw new ProtocolMessageError("Only queued prompts can be steered");
|
|
21414
21411
|
}
|
|
21415
21412
|
return {
|
|
@@ -25276,9 +25273,9 @@ var Connection = class {
|
|
|
25276
25273
|
return;
|
|
25277
25274
|
}
|
|
25278
25275
|
const responseBatch = isResponseBatch(batch);
|
|
25279
|
-
const responseCount = responseBatch ? 0 : batch.reduce((
|
|
25276
|
+
const responseCount = responseBatch ? 0 : batch.reduce((count2, message) => count2 + (isNotificationMessage(message) ? 0 : 1), 0);
|
|
25280
25277
|
let remaining = responseCount;
|
|
25281
|
-
let remainingNotifications = batch.reduce((
|
|
25278
|
+
let remainingNotifications = batch.reduce((count2, message) => count2 + (isNotificationMessage(message) ? 1 : 0), 0);
|
|
25282
25279
|
let responseSent = false;
|
|
25283
25280
|
const responses = [];
|
|
25284
25281
|
const sendResponsesIfReady = async () => {
|
|
@@ -67253,8 +67250,8 @@ var ClaudeAcpAgent = class {
|
|
|
67253
67250
|
return response;
|
|
67254
67251
|
}
|
|
67255
67252
|
async goal(params) {
|
|
67256
|
-
const
|
|
67257
|
-
const prompt = [{ type: "text", text:
|
|
67253
|
+
const command2 = params.action === "set" ? `/goal ${params.objective}` : "/goal clear";
|
|
67254
|
+
const prompt = [{ type: "text", text: command2 }];
|
|
67258
67255
|
const steering = await this.steer({
|
|
67259
67256
|
sessionId: params.sessionId,
|
|
67260
67257
|
prompt,
|
|
@@ -67922,8 +67919,8 @@ var ClaudeAcpAgent = class {
|
|
|
67922
67919
|
type: "content",
|
|
67923
67920
|
content: { type: "text", text: m.content }
|
|
67924
67921
|
})) : [];
|
|
67925
|
-
const
|
|
67926
|
-
const title2 = isSynthesis ? "Recalled synthesized memory" : `Recalled ${
|
|
67922
|
+
const count2 = message.memories.length;
|
|
67923
|
+
const title2 = isSynthesis ? "Recalled synthesized memory" : `Recalled ${count2} ${count2 === 1 ? "memory" : "memories"}`;
|
|
67927
67924
|
await sendUpdate({
|
|
67928
67925
|
sessionId: message.session_id,
|
|
67929
67926
|
update: {
|
|
@@ -69947,7 +69944,7 @@ function modelUsageIncrement(current, previous) {
|
|
|
69947
69944
|
cachedReadTokens: usage.cachedReadTokens - base.cachedReadTokens,
|
|
69948
69945
|
cachedWriteTokens: usage.cachedWriteTokens - base.cachedWriteTokens
|
|
69949
69946
|
} : usage;
|
|
69950
|
-
const rewound = Object.values(subtracted).some((
|
|
69947
|
+
const rewound = Object.values(subtracted).some((count2) => count2 < 0);
|
|
69951
69948
|
const resolved = rewound ? usage : subtracted;
|
|
69952
69949
|
if (tallyTotal(resolved) > 0) {
|
|
69953
69950
|
increment[model] = resolved;
|
|
@@ -70463,20 +70460,20 @@ function getAvailableSlashCommands(commands, terminalCommands) {
|
|
|
70463
70460
|
"release-notes",
|
|
70464
70461
|
"todos"
|
|
70465
70462
|
];
|
|
70466
|
-
return commands.filter((
|
|
70467
|
-
const input2 =
|
|
70468
|
-
hint: Array.isArray(
|
|
70463
|
+
return commands.filter((command2) => !terminalCommands?.includes(command2.name)).map((command2) => {
|
|
70464
|
+
const input2 = command2.argumentHint ? {
|
|
70465
|
+
hint: Array.isArray(command2.argumentHint) ? command2.argumentHint.join(" ") : command2.argumentHint
|
|
70469
70466
|
} : null;
|
|
70470
|
-
let name2 =
|
|
70471
|
-
if (
|
|
70467
|
+
let name2 = command2.name;
|
|
70468
|
+
if (command2.name.endsWith(" (MCP)")) {
|
|
70472
70469
|
name2 = `mcp:${name2.replace(" (MCP)", "")}`;
|
|
70473
70470
|
}
|
|
70474
70471
|
return {
|
|
70475
70472
|
name: name2,
|
|
70476
|
-
description:
|
|
70473
|
+
description: command2.description || "",
|
|
70477
70474
|
input: input2
|
|
70478
70475
|
};
|
|
70479
|
-
}).filter((
|
|
70476
|
+
}).filter((command2) => !UNSUPPORTED_COMMANDS.includes(command2.name));
|
|
70480
70477
|
}
|
|
70481
70478
|
function promptToClaude(prompt) {
|
|
70482
70479
|
const content = [];
|
|
@@ -70487,8 +70484,8 @@ function promptToClaude(prompt) {
|
|
|
70487
70484
|
let text2 = chunk.text;
|
|
70488
70485
|
const mcpMatch = text2.match(/^\/mcp:([^:\s]+):(\S+)(?:\s(.*))?$/);
|
|
70489
70486
|
if (mcpMatch) {
|
|
70490
|
-
const [, server,
|
|
70491
|
-
text2 = `/${server}:${
|
|
70487
|
+
const [, server, command2, args] = mcpMatch;
|
|
70488
|
+
text2 = `/${server}:${command2} (MCP)${args ? ` ${args}` : ""}`;
|
|
70492
70489
|
}
|
|
70493
70490
|
content.push({ type: "text", text: text2 });
|
|
70494
70491
|
break;
|
|
@@ -71339,7 +71336,7 @@ var posixOperations2 = {
|
|
|
71339
71336
|
await access2(target, constants3.X_OK);
|
|
71340
71337
|
return target;
|
|
71341
71338
|
},
|
|
71342
|
-
executableLaunch: (
|
|
71339
|
+
executableLaunch: (command2, args) => ({ command: command2, arguments: args }),
|
|
71343
71340
|
spawnOptions: { detached: true, windowsHide: true },
|
|
71344
71341
|
signalCapturedProcesses,
|
|
71345
71342
|
terminateProcess
|
|
@@ -71523,17 +71520,17 @@ async function resolveExecutableTarget(path7) {
|
|
|
71523
71520
|
}
|
|
71524
71521
|
return resolvedPath;
|
|
71525
71522
|
}
|
|
71526
|
-
function executableLaunch(
|
|
71527
|
-
if (/\.(?:js|mjs|cjs)$/iu.test(
|
|
71528
|
-
return { command: process.execPath, arguments: [
|
|
71523
|
+
function executableLaunch(command2, args) {
|
|
71524
|
+
if (/\.(?:js|mjs|cjs)$/iu.test(command2)) {
|
|
71525
|
+
return { command: process.execPath, arguments: [command2, ...args] };
|
|
71529
71526
|
}
|
|
71530
|
-
if (/\.(?:cmd|bat)$/iu.test(
|
|
71527
|
+
if (/\.(?:cmd|bat)$/iu.test(command2)) {
|
|
71531
71528
|
throw new ProcessExecutionError(
|
|
71532
71529
|
"process_unsupported_script",
|
|
71533
71530
|
"Use a native executable or a verified Node entrypoint"
|
|
71534
71531
|
);
|
|
71535
71532
|
}
|
|
71536
|
-
return { command, arguments: args };
|
|
71533
|
+
return { command: command2, arguments: args };
|
|
71537
71534
|
}
|
|
71538
71535
|
function readProcessTable() {
|
|
71539
71536
|
const systemRoot = environmentValue2(process.env, "SystemRoot");
|
|
@@ -71932,8 +71929,8 @@ async function runBoundedProcess(options) {
|
|
|
71932
71929
|
}
|
|
71933
71930
|
}
|
|
71934
71931
|
}
|
|
71935
|
-
function executableLaunch2(
|
|
71936
|
-
return hostPlatform.executableLaunch(
|
|
71932
|
+
function executableLaunch2(command2, args) {
|
|
71933
|
+
return hostPlatform.executableLaunch(command2, args);
|
|
71937
71934
|
}
|
|
71938
71935
|
var platformSpawnOptions = hostPlatform.spawnOptions;
|
|
71939
71936
|
|
|
@@ -73403,8 +73400,8 @@ var CodexOwnedAcpAgent = class {
|
|
|
73403
73400
|
return;
|
|
73404
73401
|
}
|
|
73405
73402
|
const params = decoded.data;
|
|
73406
|
-
const
|
|
73407
|
-
const title2 = (
|
|
73403
|
+
const command2 = "command" in params ? params.command : void 0;
|
|
73404
|
+
const title2 = (command2 ?? params.reason ?? "Approve a local change").slice(0, APPROVAL_REASON_CHARACTER_LIMIT);
|
|
73408
73405
|
const turn = this.#turn;
|
|
73409
73406
|
const decision = await this.#askPermission(
|
|
73410
73407
|
title2,
|
|
@@ -76428,8 +76425,8 @@ function isBashTool(toolName) {
|
|
|
76428
76425
|
}
|
|
76429
76426
|
function bashCommand(value) {
|
|
76430
76427
|
const record2 = value;
|
|
76431
|
-
const
|
|
76432
|
-
return typeof
|
|
76428
|
+
const command2 = record2?.command ?? record2?.cmd ?? record2?.args?.command ?? record2?.args?.cmd ?? record2?.input?.command ?? record2?.input?.cmd ?? record2?.rawInput?.command ?? record2?.rawInput?.cmd ?? record2?.toolInput?.command ?? record2?.toolInput?.cmd ?? record2?.details?.command ?? record2?.details?.cmd;
|
|
76429
|
+
return typeof command2 === "string" && command2.trim() ? command2 : void 0;
|
|
76433
76430
|
}
|
|
76434
76431
|
function bashResultText(result) {
|
|
76435
76432
|
const record2 = result;
|
|
@@ -77784,7 +77781,7 @@ var PiAcpAgent = class {
|
|
|
77784
77781
|
const cmd = space === -1 ? trimmed.slice(1) : trimmed.slice(1, space);
|
|
77785
77782
|
const argsString = space === -1 ? "" : trimmed.slice(space + 1);
|
|
77786
77783
|
const args = parseCommandArgs(argsString);
|
|
77787
|
-
if (builtinAvailableCommands().some((
|
|
77784
|
+
if (builtinAvailableCommands().some((command2) => command2.name === cmd)) {
|
|
77788
77785
|
this.conn.startUserMessage();
|
|
77789
77786
|
}
|
|
77790
77787
|
if (cmd === "compact") {
|
|
@@ -79394,7 +79391,7 @@ var AcpAgentDefinition = class _AcpAgentDefinition {
|
|
|
79394
79391
|
label;
|
|
79395
79392
|
runtimeExecutables;
|
|
79396
79393
|
#connectionFactory;
|
|
79397
|
-
constructor(id, label,
|
|
79394
|
+
constructor(id, label, command2, createConnection, environment = {}, agentVersion = "", agentIdentity = readExecutableIdentity(command2), capabilities = unsupportedSessionCapabilities(), adapterVersion = agentVersion, runtimeExecutables = [agentIdentity]) {
|
|
79398
79395
|
this.agentIdentity = agentIdentity;
|
|
79399
79396
|
this.agentVersion = agentVersion;
|
|
79400
79397
|
this.adapterVersion = adapterVersion;
|
|
@@ -80413,11 +80410,11 @@ var AdapterSessionConnection = class {
|
|
|
80413
80410
|
event = {
|
|
80414
80411
|
kind: "commands",
|
|
80415
80412
|
payload,
|
|
80416
|
-
commands: update.availableCommands.slice(0, 500).map((
|
|
80417
|
-
description: truncate(
|
|
80418
|
-
inputHint: truncate(
|
|
80419
|
-
name: truncate(
|
|
80420
|
-
})).filter((
|
|
80413
|
+
commands: update.availableCommands.slice(0, 500).map((command2) => ({
|
|
80414
|
+
description: truncate(command2.description, 500),
|
|
80415
|
+
inputHint: truncate(command2.input?.hint ?? "", 255),
|
|
80416
|
+
name: truncate(command2.name, 128)
|
|
80417
|
+
})).filter((command2) => command2.name.length > 0)
|
|
80421
80418
|
};
|
|
80422
80419
|
break;
|
|
80423
80420
|
case "config_option_update":
|
|
@@ -82146,14 +82143,14 @@ var acpSessionStoreMigrations = [
|
|
|
82146
82143
|
{
|
|
82147
82144
|
"name": "0011_receipt_admission_order_required.sql",
|
|
82148
82145
|
"sql": 'PRAGMA foreign_keys=OFF;--> statement-breakpoint\nCREATE TABLE `__new_execution_receipt` (\n `command_id` text PRIMARY KEY NOT NULL,\n `session_id` text NOT NULL,\n `command_hash` text NOT NULL,\n `attempt_id` text NOT NULL,\n `admission_order` integer NOT NULL,\n `started` integer NOT NULL,\n `outcome` text,\n `updated_at` text NOT NULL\n);\n--> statement-breakpoint\nINSERT INTO `__new_execution_receipt`("command_id", "session_id", "command_hash", "attempt_id", "admission_order", "started", "outcome", "updated_at") SELECT "command_id", "session_id", "command_hash", "attempt_id", "admission_order", "started", "outcome", "updated_at" FROM `execution_receipt`;--> statement-breakpoint\nDROP TABLE `execution_receipt`;--> statement-breakpoint\nALTER TABLE `__new_execution_receipt` RENAME TO `execution_receipt`;--> statement-breakpoint\nPRAGMA foreign_keys=ON;'
|
|
82149
|
-
}
|
|
82150
|
-
];
|
|
82151
|
-
|
|
82152
|
-
// src/engine/generated/command-cancellation-migrations.ts
|
|
82153
|
-
var commandCancellationMigrations = [
|
|
82146
|
+
},
|
|
82154
82147
|
{
|
|
82155
|
-
"name": "
|
|
82156
|
-
"sql": "
|
|
82148
|
+
"name": "0012_retire_execution_receipts.sql",
|
|
82149
|
+
"sql": "DROP TABLE `execution_identity`;--> statement-breakpoint\nDROP TABLE `execution_receipt`;"
|
|
82150
|
+
},
|
|
82151
|
+
{
|
|
82152
|
+
"name": "0013_command_ledger.sql",
|
|
82153
|
+
"sql": 'CREATE TABLE `command` (\n `command_id` text PRIMARY KEY NOT NULL,\n `session_id` text NOT NULL,\n `command_hash` text NOT NULL,\n `attempt_id` text NOT NULL,\n `admission_order` integer NOT NULL,\n `fate` text NOT NULL,\n `started_at` text,\n CONSTRAINT "command_fate" CHECK("command"."fate" IN (\'pending\', \'started\', \'cancelled\', \'settled-before-start\', \'settled-after-start\')),\n CONSTRAINT "command_started_at" CHECK(("command"."fate" IN (\'started\', \'settled-after-start\')) = ("command"."started_at" IS NOT NULL))\n);\n--> statement-breakpoint\nCREATE UNIQUE INDEX `command_admission_order_idx` ON `command` (`admission_order`);--> statement-breakpoint\nCREATE INDEX `command_session_idx` ON `command` (`session_id`,`admission_order`);--> statement-breakpoint\nCREATE TABLE `command_outcome` (\n `command_id` text PRIMARY KEY NOT NULL,\n `outcome` text NOT NULL\n);\n'
|
|
82157
82154
|
}
|
|
82158
82155
|
];
|
|
82159
82156
|
|
|
@@ -84087,6 +84084,32 @@ function sqliteTableWithCasing(casing) {
|
|
|
84087
84084
|
}
|
|
84088
84085
|
var sqliteTable = sqliteTableWithCasing(void 0);
|
|
84089
84086
|
|
|
84087
|
+
// ../../node_modules/.pnpm/drizzle-orm@1.0.0-rc.4_@cloudflare+workers-types@5.20261028.1_@types+better-sqlite3@7.6_12a6406e88a0f7753ae87b6d067c841c/node_modules/drizzle-orm/sqlite-core/checks.js
|
|
84088
|
+
var CheckBuilder = class {
|
|
84089
|
+
static [entityKind] = "SQLiteCheckBuilder";
|
|
84090
|
+
brand;
|
|
84091
|
+
constructor(name2, value) {
|
|
84092
|
+
this.name = name2;
|
|
84093
|
+
this.value = value;
|
|
84094
|
+
}
|
|
84095
|
+
build(table) {
|
|
84096
|
+
return new Check(table, this);
|
|
84097
|
+
}
|
|
84098
|
+
};
|
|
84099
|
+
var Check = class {
|
|
84100
|
+
static [entityKind] = "SQLiteCheck";
|
|
84101
|
+
name;
|
|
84102
|
+
value;
|
|
84103
|
+
constructor(table, builder) {
|
|
84104
|
+
this.table = table;
|
|
84105
|
+
this.name = builder.name;
|
|
84106
|
+
this.value = builder.value;
|
|
84107
|
+
}
|
|
84108
|
+
};
|
|
84109
|
+
function check2(name2, value) {
|
|
84110
|
+
return new CheckBuilder(name2, value);
|
|
84111
|
+
}
|
|
84112
|
+
|
|
84090
84113
|
// ../../node_modules/.pnpm/drizzle-orm@1.0.0-rc.4_@cloudflare+workers-types@5.20261028.1_@types+better-sqlite3@7.6_12a6406e88a0f7753ae87b6d067c841c/node_modules/drizzle-orm/sqlite-core/indexes.js
|
|
84091
84114
|
var IndexBuilderOn = class {
|
|
84092
84115
|
static [entityKind] = "SQLiteIndexBuilderOn";
|
|
@@ -84137,6 +84160,9 @@ var Index = class {
|
|
|
84137
84160
|
function index(name2) {
|
|
84138
84161
|
return new IndexBuilderOn(name2, false);
|
|
84139
84162
|
}
|
|
84163
|
+
function uniqueIndex(name2) {
|
|
84164
|
+
return new IndexBuilderOn(name2, true);
|
|
84165
|
+
}
|
|
84140
84166
|
|
|
84141
84167
|
// ../../node_modules/.pnpm/drizzle-orm@1.0.0-rc.4_@cloudflare+workers-types@5.20261028.1_@types+better-sqlite3@7.6_12a6406e88a0f7753ae87b6d067c841c/node_modules/drizzle-orm/sqlite-core/primary-keys.js
|
|
84142
84168
|
function primaryKey(...config2) {
|
|
@@ -84960,11 +84986,11 @@ function exists(subquery) {
|
|
|
84960
84986
|
function notExists(subquery) {
|
|
84961
84987
|
return sql`not exists ${subquery}`;
|
|
84962
84988
|
}
|
|
84963
|
-
function between(column,
|
|
84964
|
-
return sql`${column} between ${bindIfParam(
|
|
84989
|
+
function between(column, min2, max2) {
|
|
84990
|
+
return sql`${column} between ${bindIfParam(min2, column)} and ${bindIfParam(max2, column)}`;
|
|
84965
84991
|
}
|
|
84966
|
-
function notBetween(column,
|
|
84967
|
-
return sql`${column} not between ${bindIfParam(
|
|
84992
|
+
function notBetween(column, min2, max2) {
|
|
84993
|
+
return sql`${column} not between ${bindIfParam(min2, column)} and ${bindIfParam(max2, column)}`;
|
|
84968
84994
|
}
|
|
84969
84995
|
function like(column, value) {
|
|
84970
84996
|
return sql`${column} like ${value}`;
|
|
@@ -85011,6 +85037,11 @@ function desc(column) {
|
|
|
85011
85037
|
return sql`${column} desc`;
|
|
85012
85038
|
}
|
|
85013
85039
|
|
|
85040
|
+
// ../../node_modules/.pnpm/drizzle-orm@1.0.0-rc.4_@cloudflare+workers-types@5.20261028.1_@types+better-sqlite3@7.6_12a6406e88a0f7753ae87b6d067c841c/node_modules/drizzle-orm/sql/functions/aggregate.js
|
|
85041
|
+
function max(expression) {
|
|
85042
|
+
return sql`max(${expression})`.mapWith(is(expression, Column) ? expression : String);
|
|
85043
|
+
}
|
|
85044
|
+
|
|
85014
85045
|
// ../../node_modules/.pnpm/drizzle-orm@1.0.0-rc.4_@cloudflare+workers-types@5.20261028.1_@types+better-sqlite3@7.6_12a6406e88a0f7753ae87b6d067c841c/node_modules/drizzle-orm/relations.js
|
|
85015
85046
|
var Relation = class {
|
|
85016
85047
|
static [entityKind] = "RelationV2";
|
|
@@ -87096,7 +87127,6 @@ var LocalSqliteDatabase = class {
|
|
|
87096
87127
|
function channelSessionDatabasePaths(stateDirectory, channelId) {
|
|
87097
87128
|
const channelHash = createHash4("sha256").update(channelId).digest("hex");
|
|
87098
87129
|
return {
|
|
87099
|
-
cancellations: join23(stateDirectory, "sessions", `${channelHash}.cancellations.sqlite`),
|
|
87100
87130
|
events: join23(stateDirectory, "sessions", `${channelHash}.events.sqlite`),
|
|
87101
87131
|
sessions: join23(stateDirectory, "sessions", `${channelHash}.sqlite`)
|
|
87102
87132
|
};
|
|
@@ -87104,7 +87134,6 @@ function channelSessionDatabasePaths(stateDirectory, channelId) {
|
|
|
87104
87134
|
var openAcpSessionDatabase = (path7) => {
|
|
87105
87135
|
return new LocalSqliteDatabase(path7, "ACP Session database", acpSessionStoreMigrations);
|
|
87106
87136
|
};
|
|
87107
|
-
var openCommandCancellationDatabase = (path7) => new LocalSqliteDatabase(path7, "Command cancellation database", commandCancellationMigrations);
|
|
87108
87137
|
var openSessionEventCacheDatabase = (path7) => new LocalSqliteDatabase(path7, "V2 Session event cache", sessionEventCacheMigrations, [
|
|
87109
87138
|
"PRAGMA journal_mode = WAL",
|
|
87110
87139
|
"PRAGMA synchronous = OFF",
|
|
@@ -88868,23 +88897,39 @@ var acpSession = sqliteTable("acp_session", {
|
|
|
88868
88897
|
updatedAt: text("updated_at").notNull()
|
|
88869
88898
|
});
|
|
88870
88899
|
|
|
88871
|
-
// src/engine/schema/acp-session-store/
|
|
88872
|
-
var
|
|
88873
|
-
|
|
88874
|
-
|
|
88875
|
-
|
|
88876
|
-
|
|
88900
|
+
// src/engine/schema/acp-session-store/command.ts
|
|
88901
|
+
var command = sqliteTable(
|
|
88902
|
+
"command",
|
|
88903
|
+
{
|
|
88904
|
+
commandId: text("command_id").primaryKey(),
|
|
88905
|
+
sessionId: text("session_id").notNull(),
|
|
88906
|
+
commandHash: text("command_hash").notNull(),
|
|
88907
|
+
attemptId: text("attempt_id").notNull(),
|
|
88908
|
+
admissionOrder: integer2("admission_order").notNull(),
|
|
88909
|
+
fate: text("fate", {
|
|
88910
|
+
enum: ["pending", "started", "cancelled", "settled-before-start", "settled-after-start"]
|
|
88911
|
+
}).notNull(),
|
|
88912
|
+
/** When the Agent received the command; only a command that started has one. */
|
|
88913
|
+
startedAt: text("started_at")
|
|
88914
|
+
},
|
|
88915
|
+
(table) => [
|
|
88916
|
+
uniqueIndex("command_admission_order_idx").on(table.admissionOrder),
|
|
88917
|
+
index("command_session_idx").on(table.sessionId, table.admissionOrder),
|
|
88918
|
+
check2(
|
|
88919
|
+
"command_fate",
|
|
88920
|
+
sql`${table.fate} IN ('pending', 'started', 'cancelled', 'settled-before-start', 'settled-after-start')`
|
|
88921
|
+
),
|
|
88922
|
+
check2(
|
|
88923
|
+
"command_started_at",
|
|
88924
|
+
sql`(${table.fate} IN ('started', 'settled-after-start')) = (${table.startedAt} IS NOT NULL)`
|
|
88925
|
+
)
|
|
88926
|
+
]
|
|
88927
|
+
);
|
|
88877
88928
|
|
|
88878
|
-
// src/engine/schema/acp-session-store/
|
|
88879
|
-
var
|
|
88929
|
+
// src/engine/schema/acp-session-store/command-outcome.ts
|
|
88930
|
+
var commandOutcome = sqliteTable("command_outcome", {
|
|
88880
88931
|
commandId: text("command_id").primaryKey(),
|
|
88881
|
-
|
|
88882
|
-
commandHash: text("command_hash").notNull(),
|
|
88883
|
-
attemptId: text("attempt_id").notNull(),
|
|
88884
|
-
admissionOrder: integer2("admission_order").notNull(),
|
|
88885
|
-
started: integer2("started", { mode: "boolean" }).notNull(),
|
|
88886
|
-
outcome: text("outcome"),
|
|
88887
|
-
updatedAt: text("updated_at").notNull()
|
|
88932
|
+
outcome: text("outcome").notNull()
|
|
88888
88933
|
});
|
|
88889
88934
|
|
|
88890
88935
|
// src/engine/schema/acp-session-store/session-live-event-position-allocation.ts
|
|
@@ -88928,90 +88973,111 @@ var AcpSessionTable = class {
|
|
|
88928
88973
|
};
|
|
88929
88974
|
};
|
|
88930
88975
|
|
|
88931
|
-
// src/engine/
|
|
88932
|
-
var
|
|
88933
|
-
|
|
88934
|
-
sessionId: text("session_id").notNull()
|
|
88935
|
-
});
|
|
88936
|
-
|
|
88937
|
-
// src/engine/storage/session/command-cancellation-table.ts
|
|
88938
|
-
var cancellationSchema = external_exports.object({ commandId: external_exports.string(), sessionId: external_exports.string() }).readonly();
|
|
88939
|
-
var CommandCancellationTable = class {
|
|
88940
|
-
#database;
|
|
88941
|
-
constructor(database) {
|
|
88942
|
-
this.#database = database;
|
|
88943
|
-
}
|
|
88944
|
-
close = () => this.#database.close();
|
|
88945
|
-
read = (commandId) => {
|
|
88946
|
-
const row = this.#database.orm.select().from(cancelledCommand).where(eq2(cancelledCommand.commandId, commandId)).get();
|
|
88947
|
-
return row === void 0 ? void 0 : cancellationSchema.parse(row);
|
|
88948
|
-
};
|
|
88949
|
-
retain = (cancellations) => {
|
|
88950
|
-
this.#database.transaction(() => {
|
|
88951
|
-
for (const cancellation of cancellations) {
|
|
88952
|
-
this.#database.orm.insert(cancelledCommand).values(cancellation).onConflictDoNothing().run();
|
|
88953
|
-
}
|
|
88954
|
-
});
|
|
88955
|
-
};
|
|
88956
|
-
};
|
|
88957
|
-
|
|
88958
|
-
// src/engine/storage/session/execution-receipt-table.ts
|
|
88959
|
-
var receiptSchema = external_exports.object({
|
|
88976
|
+
// src/engine/storage/session/command-ledger-table.ts
|
|
88977
|
+
var OUTCOMES_PER_SESSION = 1024;
|
|
88978
|
+
var rowSchema = external_exports.object({
|
|
88960
88979
|
commandId: external_exports.string(),
|
|
88961
88980
|
sessionId: external_exports.string(),
|
|
88962
88981
|
commandHash: external_exports.string(),
|
|
88963
88982
|
attemptId: external_exports.string(),
|
|
88964
88983
|
admissionOrder: external_exports.number().int().positive().safe(),
|
|
88965
|
-
|
|
88966
|
-
|
|
88984
|
+
fate: external_exports.enum(["pending", "started", "cancelled", "settled-before-start", "settled-after-start"]),
|
|
88985
|
+
startedAt: external_exports.string().nullable(),
|
|
88967
88986
|
outcome: external_exports.string().nullable()
|
|
88968
88987
|
}).readonly();
|
|
88969
|
-
|
|
88970
|
-
|
|
88988
|
+
function ledgerCommand({ fate, startedAt, outcome, ...identity2 }) {
|
|
88989
|
+
const invalid = () => {
|
|
88990
|
+
throw new Error("The command ledger holds an invalid row", { cause: { commandId: identity2.commandId, fate } });
|
|
88991
|
+
};
|
|
88992
|
+
switch (fate) {
|
|
88993
|
+
case "pending":
|
|
88994
|
+
return outcome === null ? { ...identity2, fate: { kind: fate } } : invalid();
|
|
88995
|
+
case "started":
|
|
88996
|
+
return startedAt !== null && outcome === null ? { ...identity2, fate: { kind: fate, startedAt } } : invalid();
|
|
88997
|
+
case "cancelled":
|
|
88998
|
+
return { ...identity2, fate: { kind: fate, outcome } };
|
|
88999
|
+
case "settled-before-start":
|
|
89000
|
+
return outcome === null ? invalid() : { ...identity2, fate: { kind: fate, outcome } };
|
|
89001
|
+
case "settled-after-start":
|
|
89002
|
+
return startedAt === null ? invalid() : { ...identity2, fate: { kind: fate, startedAt, outcome } };
|
|
89003
|
+
default:
|
|
89004
|
+
return fate;
|
|
89005
|
+
}
|
|
89006
|
+
}
|
|
89007
|
+
var CommandLedgerTable = class {
|
|
88971
89008
|
#database;
|
|
88972
89009
|
constructor(database) {
|
|
88973
89010
|
this.#database = database;
|
|
88974
89011
|
}
|
|
88975
|
-
|
|
88976
|
-
|
|
88977
|
-
|
|
89012
|
+
#select = () => this.#database.orm.select({
|
|
89013
|
+
commandId: command.commandId,
|
|
89014
|
+
sessionId: command.sessionId,
|
|
89015
|
+
commandHash: command.commandHash,
|
|
89016
|
+
attemptId: command.attemptId,
|
|
89017
|
+
admissionOrder: command.admissionOrder,
|
|
89018
|
+
fate: command.fate,
|
|
89019
|
+
startedAt: command.startedAt,
|
|
89020
|
+
outcome: commandOutcome.outcome
|
|
89021
|
+
}).from(command).leftJoin(commandOutcome, eq2(commandOutcome.commandId, command.commandId));
|
|
89022
|
+
read = (commandId) => {
|
|
89023
|
+
const row = this.#select().where(eq2(command.commandId, commandId)).get();
|
|
89024
|
+
return row === void 0 ? void 0 : ledgerCommand(rowSchema.parse(row));
|
|
89025
|
+
};
|
|
89026
|
+
/** The Session's commands in admission order. */
|
|
89027
|
+
session = (sessionId) => this.#select().where(eq2(command.sessionId, sessionId)).orderBy(asc(command.admissionOrder)).all().map((row) => ledgerCommand(rowSchema.parse(row)));
|
|
89028
|
+
/** Every command in admission order. */
|
|
89029
|
+
all = () => this.#select().orderBy(asc(command.admissionOrder)).all().map((row) => ledgerCommand(rowSchema.parse(row)));
|
|
89030
|
+
/** The commands that have not settled. */
|
|
89031
|
+
unsettled = () => this.#database.orm.select({ commandId: command.commandId }).from(command).where(inArray(command.fate, ["pending", "started"])).all().map((row) => row.commandId);
|
|
89032
|
+
/**
|
|
89033
|
+
* Admits a command after every other. An earlier admission of the identifier that settled before it started is
|
|
89034
|
+
* replaced; any other earlier admission makes this one fail.
|
|
89035
|
+
*/
|
|
89036
|
+
admit = (identity2) => {
|
|
89037
|
+
this.#database.transaction(() => {
|
|
89038
|
+
const replaced = this.#database.orm.delete(command).where(and(eq2(command.commandId, identity2.commandId), eq2(command.fate, "settled-before-start"))).returning({ commandId: command.commandId }).get();
|
|
89039
|
+
if (replaced !== void 0) {
|
|
89040
|
+
this.#database.orm.delete(commandOutcome).where(eq2(commandOutcome.commandId, replaced.commandId)).run();
|
|
89041
|
+
}
|
|
89042
|
+
this.#database.orm.insert(command).values({ ...identity2, admissionOrder: this.#nextAdmissionOrder(), fate: "pending" }).run();
|
|
89043
|
+
});
|
|
89044
|
+
};
|
|
89045
|
+
/** Records that a pending command was handed to its Agent. */
|
|
89046
|
+
start = (commandId, startedAt) => {
|
|
89047
|
+
this.#database.orm.update(command).set({ fate: "started", startedAt }).where(and(eq2(command.commandId, commandId), eq2(command.fate, "pending"))).run();
|
|
88978
89048
|
};
|
|
88979
|
-
|
|
88980
|
-
|
|
88981
|
-
|
|
88982
|
-
|
|
89049
|
+
/**
|
|
89050
|
+
* Settles an unsettled command with its outcome and drops the outcomes the Session no longer keeps. Returns the
|
|
89051
|
+
* commands whose outcome was dropped.
|
|
89052
|
+
*/
|
|
89053
|
+
settle = (commandId, fate, outcome) => this.#database.transaction(() => {
|
|
89054
|
+
const settled = this.#database.orm.update(command).set(fate === "settled-after-start" ? { fate } : { fate, startedAt: null }).where(and(eq2(command.commandId, commandId), inArray(command.fate, ["pending", "started"]))).returning({ sessionId: command.sessionId }).get();
|
|
89055
|
+
if (settled === void 0) {
|
|
88983
89056
|
return [];
|
|
88984
89057
|
}
|
|
88985
|
-
|
|
88986
|
-
|
|
88987
|
-
return this.#remove(
|
|
88988
|
-
and(
|
|
88989
|
-
eq2(executionReceipt.sessionId, receipt.sessionId),
|
|
88990
|
-
isNotNull(executionReceipt.outcome),
|
|
88991
|
-
notInArray(
|
|
88992
|
-
executionReceipt.commandId,
|
|
88993
|
-
retained.map((row) => row.commandId)
|
|
88994
|
-
)
|
|
88995
|
-
)
|
|
88996
|
-
);
|
|
88997
|
-
}
|
|
88998
|
-
return [];
|
|
89058
|
+
this.#database.orm.insert(commandOutcome).values({ commandId, outcome }).run();
|
|
89059
|
+
return this.#dropOutcomes(settled.sessionId);
|
|
88999
89060
|
});
|
|
89000
|
-
|
|
89001
|
-
|
|
89002
|
-
|
|
89003
|
-
|
|
89004
|
-
|
|
89005
|
-
|
|
89061
|
+
/** Admits an unseen command as already cancelled, so the identifier can never run. */
|
|
89062
|
+
admitCancelled = (identity2, outcome) => this.#database.transaction(() => {
|
|
89063
|
+
this.#database.orm.insert(command).values({ ...identity2, admissionOrder: this.#nextAdmissionOrder(), fate: "cancelled" }).run();
|
|
89064
|
+
this.#database.orm.insert(commandOutcome).values({ commandId: identity2.commandId, outcome }).run();
|
|
89065
|
+
return this.#dropOutcomes(identity2.sessionId);
|
|
89066
|
+
});
|
|
89067
|
+
#nextAdmissionOrder = () => (this.#database.orm.select({ latest: max(command.admissionOrder) }).from(command).get()?.latest ?? 0) + 1;
|
|
89068
|
+
/** Keeps the outcomes of the Session's latest settled commands; a command that never started goes with its outcome. */
|
|
89069
|
+
#dropOutcomes = (sessionId) => {
|
|
89070
|
+
const boundary = this.#database.orm.select({ admissionOrder: command.admissionOrder }).from(command).innerJoin(commandOutcome, eq2(commandOutcome.commandId, command.commandId)).where(eq2(command.sessionId, sessionId)).orderBy(desc(command.admissionOrder)).limit(1).offset(OUTCOMES_PER_SESSION - 1).get();
|
|
89071
|
+
if (boundary === void 0) {
|
|
89072
|
+
return [];
|
|
89073
|
+
}
|
|
89074
|
+
const dropped = this.#database.orm.select({ commandId: command.commandId, fate: command.fate }).from(command).innerJoin(commandOutcome, eq2(commandOutcome.commandId, command.commandId)).where(and(eq2(command.sessionId, sessionId), lt2(command.admissionOrder, boundary.admissionOrder))).all();
|
|
89075
|
+
const commandIds = dropped.map((row) => row.commandId);
|
|
89076
|
+
if (commandIds.length > 0) {
|
|
89077
|
+
this.#database.orm.delete(commandOutcome).where(inArray(commandOutcome.commandId, commandIds)).run();
|
|
89078
|
+
this.#database.orm.delete(command).where(and(inArray(command.commandId, commandIds), eq2(command.fate, "settled-before-start"))).run();
|
|
89006
89079
|
}
|
|
89007
|
-
|
|
89008
|
-
this.#database.orm.select({
|
|
89009
|
-
commandId: executionReceipt.commandId,
|
|
89010
|
-
sessionId: executionReceipt.sessionId,
|
|
89011
|
-
commandHash: executionReceipt.commandHash
|
|
89012
|
-
}).from(executionReceipt).where(and(condition, eq2(executionReceipt.started, true)))
|
|
89013
|
-
).onConflictDoNothing().run();
|
|
89014
|
-
return this.#database.orm.delete(executionReceipt).where(condition).returning({ commandId: executionReceipt.commandId }).all().map((row) => row.commandId);
|
|
89080
|
+
return commandIds;
|
|
89015
89081
|
};
|
|
89016
89082
|
};
|
|
89017
89083
|
|
|
@@ -91991,8 +92057,8 @@ var NativeSessionService = class {
|
|
|
91991
92057
|
this.#sessions = sessions;
|
|
91992
92058
|
this.#activeTurn = activeTurn;
|
|
91993
92059
|
}
|
|
91994
|
-
execute = async (
|
|
91995
|
-
return await this.#operations.run({ signal }, (scoped) => this.#execute(
|
|
92060
|
+
execute = async (command2, signal) => {
|
|
92061
|
+
return await this.#operations.run({ signal }, (scoped) => this.#execute(command2, scoped.signal));
|
|
91996
92062
|
};
|
|
91997
92063
|
close = () => this.#operations.close(async () => void 0);
|
|
91998
92064
|
readSessionHistory = async (options, nativeSessionId, eventLimit, cursor) => this.#operations.run(
|
|
@@ -92010,31 +92076,31 @@ var NativeSessionService = class {
|
|
|
92010
92076
|
})
|
|
92011
92077
|
)
|
|
92012
92078
|
);
|
|
92013
|
-
#execute = async (
|
|
92079
|
+
#execute = async (command2, signal) => {
|
|
92014
92080
|
signal.throwIfAborted();
|
|
92015
|
-
const cwd = await this.#directories.resolve(this.#bindingId,
|
|
92081
|
+
const cwd = await this.#directories.resolve(this.#bindingId, command2.directoryId, signal);
|
|
92016
92082
|
const additionalDirectories = await this.#directories.resolveMany(
|
|
92017
92083
|
this.#bindingId,
|
|
92018
|
-
|
|
92084
|
+
command2.additionalDirectoryIds,
|
|
92019
92085
|
signal
|
|
92020
92086
|
);
|
|
92021
92087
|
signal.throwIfAborted();
|
|
92022
92088
|
const options = {
|
|
92023
92089
|
additionalDirectories,
|
|
92024
|
-
...await this.#resolveAgent(
|
|
92090
|
+
...await this.#resolveAgent(command2.agentId, signal),
|
|
92025
92091
|
cwd,
|
|
92026
|
-
sessionId:
|
|
92092
|
+
sessionId: command2.sessionId,
|
|
92027
92093
|
signal
|
|
92028
92094
|
};
|
|
92029
|
-
if (
|
|
92030
|
-
nativeSessionIdSchema.parse(
|
|
92095
|
+
if (command2.action === "active-turn") {
|
|
92096
|
+
nativeSessionIdSchema.parse(command2.targetSessionId);
|
|
92031
92097
|
return {
|
|
92032
92098
|
action: "active-turn",
|
|
92033
92099
|
kind: "native.session.result",
|
|
92034
|
-
requestId:
|
|
92035
|
-
sessionId:
|
|
92036
|
-
targetSessionId:
|
|
92037
|
-
...await this.#activeTurn(
|
|
92100
|
+
requestId: command2.requestId,
|
|
92101
|
+
sessionId: command2.sessionId,
|
|
92102
|
+
targetSessionId: command2.targetSessionId,
|
|
92103
|
+
...await this.#activeTurn(command2, options),
|
|
92038
92104
|
queuedCancellation: "before-start"
|
|
92039
92105
|
};
|
|
92040
92106
|
}
|
|
@@ -92046,10 +92112,10 @@ var NativeSessionService = class {
|
|
|
92046
92112
|
"native_session_unsupported"
|
|
92047
92113
|
);
|
|
92048
92114
|
}
|
|
92049
|
-
const entryScope = JSON.stringify([
|
|
92115
|
+
const entryScope = JSON.stringify([command2.agentId, command2.bindingId, command2.sessionId]);
|
|
92050
92116
|
const cursorScope = JSON.stringify([entryScope, cwd]);
|
|
92051
92117
|
const register = async (info) => {
|
|
92052
|
-
const authorized = await this.authorizeEntry(
|
|
92118
|
+
const authorized = await this.authorizeEntry(command2, options, info);
|
|
92053
92119
|
if (authorized === null) {
|
|
92054
92120
|
return null;
|
|
92055
92121
|
}
|
|
@@ -92065,7 +92131,7 @@ var NativeSessionService = class {
|
|
|
92065
92131
|
});
|
|
92066
92132
|
return {
|
|
92067
92133
|
entryId,
|
|
92068
|
-
mortySessionIds: this.#sessions.findLinkedSessions(
|
|
92134
|
+
mortySessionIds: this.#sessions.findLinkedSessions(command2.agentId, info.sessionId).filter((session) => session.prompted && session.cwd === authorized.cwd).map((session) => decodeIdentifier(session.sessionId)),
|
|
92069
92135
|
nativeSessionId: decodeIdentifier(info.sessionId),
|
|
92070
92136
|
title: info.title ?? "Untitled session",
|
|
92071
92137
|
directoryId: authorized.directoryId,
|
|
@@ -92076,13 +92142,13 @@ var NativeSessionService = class {
|
|
|
92076
92142
|
};
|
|
92077
92143
|
const envelope2 = {
|
|
92078
92144
|
kind: "native.session.result",
|
|
92079
|
-
requestId:
|
|
92080
|
-
sessionId:
|
|
92145
|
+
requestId: command2.requestId,
|
|
92146
|
+
sessionId: command2.sessionId
|
|
92081
92147
|
};
|
|
92082
|
-
if (
|
|
92148
|
+
if (command2.action === "list") {
|
|
92083
92149
|
let cursor = null;
|
|
92084
|
-
if (
|
|
92085
|
-
const known = this.#cursors.get(
|
|
92150
|
+
if (command2.cursor !== null) {
|
|
92151
|
+
const known = this.#cursors.get(command2.cursor);
|
|
92086
92152
|
if (known?.scope !== cursorScope) {
|
|
92087
92153
|
throw new AcpExecutionError(
|
|
92088
92154
|
"Refresh the native session list before continuing",
|
|
@@ -92126,10 +92192,10 @@ var NativeSessionService = class {
|
|
|
92126
92192
|
nextCursor
|
|
92127
92193
|
};
|
|
92128
92194
|
}
|
|
92129
|
-
if (
|
|
92195
|
+
if (command2.action === "find") {
|
|
92130
92196
|
const found = await options.adapter.findSession({
|
|
92131
92197
|
query: nativeSessionQuery(options),
|
|
92132
|
-
nativeSessionId:
|
|
92198
|
+
nativeSessionId: command2.nativeSessionId,
|
|
92133
92199
|
budget: {
|
|
92134
92200
|
maximumPages: 500,
|
|
92135
92201
|
maximumEntries: 500
|
|
@@ -92141,7 +92207,7 @@ var NativeSessionService = class {
|
|
|
92141
92207
|
}
|
|
92142
92208
|
throw new AcpExecutionError("The native session was not found", {}, "native_session_not_found");
|
|
92143
92209
|
}
|
|
92144
|
-
const selected = this.#entries.get(
|
|
92210
|
+
const selected = this.#entries.get(command2.entryId);
|
|
92145
92211
|
if (selected?.scope !== entryScope) {
|
|
92146
92212
|
throw new AcpExecutionError(
|
|
92147
92213
|
"Select a session from a fresh native session list",
|
|
@@ -92156,8 +92222,8 @@ var NativeSessionService = class {
|
|
|
92156
92222
|
"native_session_target_changed"
|
|
92157
92223
|
);
|
|
92158
92224
|
}
|
|
92159
|
-
const target = await this.resolveTarget(
|
|
92160
|
-
const action =
|
|
92225
|
+
const target = await this.resolveTarget(command2, options, selected);
|
|
92226
|
+
const action = command2.action;
|
|
92161
92227
|
if (action === "import" && !capabilities.loadSession && !capabilities.resumeSession) {
|
|
92162
92228
|
throw new AcpExecutionError("This Agent cannot import native sessions", {}, "native_session_unsupported");
|
|
92163
92229
|
}
|
|
@@ -92181,7 +92247,7 @@ var NativeSessionService = class {
|
|
|
92181
92247
|
{
|
|
92182
92248
|
...options,
|
|
92183
92249
|
cwd: target.cwd,
|
|
92184
|
-
sessionId:
|
|
92250
|
+
sessionId: command2.targetSessionId,
|
|
92185
92251
|
additionalDirectories: target.additionalDirectories
|
|
92186
92252
|
},
|
|
92187
92253
|
action === "fork" ? { kind: "fork", nativeSessionId: target.info.sessionId, title: title2 } : { kind: "import", nativeSessionId: target.info.sessionId, title: title2 },
|
|
@@ -92190,7 +92256,7 @@ var NativeSessionService = class {
|
|
|
92190
92256
|
signal.throwIfAborted();
|
|
92191
92257
|
const ready = {
|
|
92192
92258
|
additionalDirectories: target.additionalEntries,
|
|
92193
|
-
agentId:
|
|
92259
|
+
agentId: command2.agentId,
|
|
92194
92260
|
agentName: opened.prepared.agentName,
|
|
92195
92261
|
agentVersion: opened.prepared.agentVersion,
|
|
92196
92262
|
capabilities: opened.prepared.capabilities,
|
|
@@ -92200,7 +92266,7 @@ var NativeSessionService = class {
|
|
|
92200
92266
|
directoryId: target.directoryId,
|
|
92201
92267
|
directoryLabel: target.directoryLabel,
|
|
92202
92268
|
kind: "session.ready",
|
|
92203
|
-
requestId:
|
|
92269
|
+
requestId: command2.requestId,
|
|
92204
92270
|
restored: true,
|
|
92205
92271
|
sessionId: opened.sessionId
|
|
92206
92272
|
};
|
|
@@ -92208,7 +92274,7 @@ var NativeSessionService = class {
|
|
|
92208
92274
|
...envelope2,
|
|
92209
92275
|
action,
|
|
92210
92276
|
ready,
|
|
92211
|
-
targetSessionId:
|
|
92277
|
+
targetSessionId: command2.targetSessionId,
|
|
92212
92278
|
title: title2
|
|
92213
92279
|
};
|
|
92214
92280
|
};
|
|
@@ -92242,14 +92308,14 @@ var NativeSessionService = class {
|
|
|
92242
92308
|
}
|
|
92243
92309
|
return entries;
|
|
92244
92310
|
};
|
|
92245
|
-
authorizeEntry = async (
|
|
92311
|
+
authorizeEntry = async (command2, options, info) => {
|
|
92246
92312
|
try {
|
|
92247
|
-
const primary = await this.#directories.identify(
|
|
92313
|
+
const primary = await this.#directories.identify(command2.bindingId, info.cwd, options.signal);
|
|
92248
92314
|
const additionalDirectories = [];
|
|
92249
92315
|
const additionalEntries = [];
|
|
92250
92316
|
const paths = /* @__PURE__ */ new Set([primary.path]);
|
|
92251
92317
|
for (const path7 of info.additionalDirectories) {
|
|
92252
|
-
const directory = await this.#directories.identify(
|
|
92318
|
+
const directory = await this.#directories.identify(command2.bindingId, path7, options.signal);
|
|
92253
92319
|
if (paths.has(directory.path)) {
|
|
92254
92320
|
throw new LocalAuthorizationError("Native session roots must be distinct");
|
|
92255
92321
|
}
|
|
@@ -92276,7 +92342,7 @@ var NativeSessionService = class {
|
|
|
92276
92342
|
throw error62;
|
|
92277
92343
|
}
|
|
92278
92344
|
};
|
|
92279
|
-
resolveTarget = async (
|
|
92345
|
+
resolveTarget = async (command2, options, selected) => {
|
|
92280
92346
|
const info = await options.adapter.findSession({
|
|
92281
92347
|
query: nativeSessionQuery(options),
|
|
92282
92348
|
nativeSessionId: selected.nativeSessionId,
|
|
@@ -92295,7 +92361,7 @@ var NativeSessionService = class {
|
|
|
92295
92361
|
}
|
|
92296
92362
|
throw cause;
|
|
92297
92363
|
});
|
|
92298
|
-
const target = await this.authorizeEntry(
|
|
92364
|
+
const target = await this.authorizeEntry(command2, options, info);
|
|
92299
92365
|
if (target === null) {
|
|
92300
92366
|
throw new LocalAuthorizationError("The selected native session is not authorized");
|
|
92301
92367
|
}
|
|
@@ -92376,12 +92442,12 @@ async function resolvePromptArtifacts(read, attachments, signal) {
|
|
|
92376
92442
|
}
|
|
92377
92443
|
|
|
92378
92444
|
// src/engine/session/prompt/prompt-lifecycle.ts
|
|
92379
|
-
function promptContent(
|
|
92445
|
+
function promptContent(command2) {
|
|
92380
92446
|
const content = [];
|
|
92381
|
-
if (
|
|
92382
|
-
content.push({ text:
|
|
92447
|
+
if (command2.prompt.length > 0) {
|
|
92448
|
+
content.push({ text: command2.prompt, type: "text" });
|
|
92383
92449
|
}
|
|
92384
|
-
for (const attachment of
|
|
92450
|
+
for (const attachment of command2.attachments) {
|
|
92385
92451
|
content.push(
|
|
92386
92452
|
attachment.kind === "image" ? {
|
|
92387
92453
|
byteLength: attachment.byteLength,
|
|
@@ -92418,31 +92484,30 @@ var PromptLifecycle = class {
|
|
|
92418
92484
|
this.#executions = executions;
|
|
92419
92485
|
this.#sink = sink;
|
|
92420
92486
|
}
|
|
92421
|
-
requested = (
|
|
92422
|
-
this.#queued.set(
|
|
92423
|
-
commandId:
|
|
92424
|
-
content: promptContent(
|
|
92425
|
-
|
|
92487
|
+
requested = (command2) => {
|
|
92488
|
+
this.#queued.set(command2.commandId, {
|
|
92489
|
+
commandId: command2.commandId,
|
|
92490
|
+
content: promptContent(command2),
|
|
92491
|
+
disposition: command2.disposition,
|
|
92426
92492
|
context: {
|
|
92427
|
-
agentId:
|
|
92428
|
-
directoryId:
|
|
92429
|
-
additionalDirectoryIds:
|
|
92493
|
+
agentId: command2.agentId,
|
|
92494
|
+
directoryId: command2.directoryId,
|
|
92495
|
+
additionalDirectoryIds: command2.additionalDirectoryIds
|
|
92430
92496
|
},
|
|
92431
|
-
sessionId:
|
|
92432
|
-
...
|
|
92497
|
+
sessionId: command2.sessionId,
|
|
92498
|
+
...command2.disposition === SessionPromptDisposition.Steer ? { targetCommandId: command2.targetCommandId } : {}
|
|
92433
92499
|
});
|
|
92434
92500
|
};
|
|
92435
92501
|
/** The lifecycle metadata the Agent session records when it starts this claimed command. */
|
|
92436
|
-
lifecycle = (sessionId, commandId, attemptId, epoch,
|
|
92502
|
+
lifecycle = (sessionId, commandId, attemptId, epoch, dispatch) => {
|
|
92437
92503
|
const request = this.#queued.get(commandId);
|
|
92438
92504
|
if (request?.sessionId === sessionId) {
|
|
92439
92505
|
return {
|
|
92440
92506
|
attemptId,
|
|
92441
92507
|
content: request.content,
|
|
92442
|
-
disposition,
|
|
92443
92508
|
epoch,
|
|
92444
92509
|
context: request.context,
|
|
92445
|
-
...
|
|
92510
|
+
...dispatch.kind === "steer" ? { disposition: SessionPromptDisposition.Steer, targetCommandId: dispatch.targetCommandId } : { disposition: SessionPromptDisposition.Append }
|
|
92446
92511
|
};
|
|
92447
92512
|
}
|
|
92448
92513
|
throw new Error("The executing prompt was not registered in the V2 queue");
|
|
@@ -92611,69 +92676,44 @@ async function settleAbandonedTurn(projection, operations, cancellation) {
|
|
|
92611
92676
|
|
|
92612
92677
|
// src/engine/session/turn/execution-receipts.ts
|
|
92613
92678
|
import { createHash as createHash8, randomUUID as randomUUID15 } from "node:crypto";
|
|
92614
|
-
var
|
|
92615
|
-
|
|
92616
|
-
|
|
92617
|
-
|
|
92618
|
-
|
|
92619
|
-
|
|
92620
|
-
|
|
92621
|
-
|
|
92622
|
-
|
|
92623
|
-
default: {
|
|
92624
|
-
const unreachable2 = state;
|
|
92625
|
-
throw new Error("Unexpected execution state", { cause: unreachable2 });
|
|
92626
|
-
}
|
|
92627
|
-
}
|
|
92679
|
+
var isStarted = (fate) => fate.kind === "started" || fate.kind === "settled-after-start";
|
|
92680
|
+
var isUnsettled = (fate) => fate.kind === "pending" || fate.kind === "started";
|
|
92681
|
+
var lifecyclePayload = (outcome) => {
|
|
92682
|
+
const event = decodeKnownSessionEventPayload(JSON.parse(outcome));
|
|
92683
|
+
return event?.type === "lifecycle-metadata" ? event.payload : void 0;
|
|
92684
|
+
};
|
|
92685
|
+
function restartedBeforeStart(outcome) {
|
|
92686
|
+
const payload = lifecyclePayload(outcome);
|
|
92687
|
+
return payload?.kind === "prompt.failed-before-start" && payload.code === "runtime_restarted";
|
|
92628
92688
|
}
|
|
92629
|
-
function
|
|
92630
|
-
if (
|
|
92631
|
-
return
|
|
92689
|
+
function settledFate(fate, outcome) {
|
|
92690
|
+
if (fate.kind === "started") {
|
|
92691
|
+
return { kind: "settled-after-start", startedAt: fate.startedAt, outcome };
|
|
92632
92692
|
}
|
|
92633
|
-
const
|
|
92634
|
-
return
|
|
92693
|
+
const payload = lifecyclePayload(outcome);
|
|
92694
|
+
return payload?.kind === "prompt.completed" && promptCompletion(payload).kind === "cancelled" ? { kind: "cancelled", outcome } : { kind: "settled-before-start", outcome };
|
|
92635
92695
|
}
|
|
92636
|
-
function
|
|
92637
|
-
if (
|
|
92638
|
-
return
|
|
92696
|
+
function commandStanding(command2, sessionId) {
|
|
92697
|
+
if (command2 === void 0) {
|
|
92698
|
+
return { kind: "unseen" };
|
|
92639
92699
|
}
|
|
92640
|
-
|
|
92641
|
-
|
|
92642
|
-
}
|
|
92643
|
-
|
|
92644
|
-
switch (
|
|
92700
|
+
if (command2.sessionId !== sessionId) {
|
|
92701
|
+
return { kind: "foreign" };
|
|
92702
|
+
}
|
|
92703
|
+
const fate = command2.fate;
|
|
92704
|
+
switch (fate.kind) {
|
|
92645
92705
|
case "pending":
|
|
92646
92706
|
case "started":
|
|
92647
|
-
return
|
|
92707
|
+
return { kind: "retained", command: command2 };
|
|
92708
|
+
case "cancelled":
|
|
92709
|
+
return fate.outcome === null ? { kind: "cancelled" } : { kind: "retained", command: command2 };
|
|
92648
92710
|
case "settled-before-start":
|
|
92711
|
+
return restartedBeforeStart(fate.outcome) ? { kind: "retryable" } : { kind: "retained", command: command2 };
|
|
92649
92712
|
case "settled-after-start":
|
|
92650
|
-
return
|
|
92651
|
-
default:
|
|
92652
|
-
|
|
92653
|
-
throw new Error("Unexpected execution state", { cause: unreachable2 });
|
|
92654
|
-
}
|
|
92655
|
-
}
|
|
92656
|
-
}
|
|
92657
|
-
function settledExecution(state, outcome) {
|
|
92658
|
-
return { kind: executionStarted(state) ? "settled-after-start" : "settled-before-start", outcome };
|
|
92659
|
-
}
|
|
92660
|
-
function commandStanding({ receipt, identity: identity2, cancellation }, sessionId) {
|
|
92661
|
-
if (receipt !== void 0) {
|
|
92662
|
-
if (receipt.sessionId !== sessionId) {
|
|
92663
|
-
return { kind: "foreign" };
|
|
92664
|
-
}
|
|
92665
|
-
if (!executionStarted(receipt.state) && !cancelledBeforeStart(receipt.state) && cancellation?.sessionId === sessionId) {
|
|
92666
|
-
return { kind: "cancelled", receipt };
|
|
92667
|
-
}
|
|
92668
|
-
return restartedBeforeStart(receipt.state) ? { kind: "retryable", receipt } : { kind: "retained", receipt };
|
|
92669
|
-
}
|
|
92670
|
-
if (identity2 !== void 0) {
|
|
92671
|
-
return identity2.sessionId === sessionId ? { kind: "expired", commandHash: identity2.commandHash } : { kind: "foreign" };
|
|
92672
|
-
}
|
|
92673
|
-
if (cancellation !== void 0) {
|
|
92674
|
-
return cancellation.sessionId === sessionId ? { kind: "cancelled", receipt: void 0 } : { kind: "foreign" };
|
|
92713
|
+
return fate.outcome === null ? { kind: "expired", commandHash: command2.commandHash } : { kind: "retained", command: command2 };
|
|
92714
|
+
default:
|
|
92715
|
+
return fate;
|
|
92675
92716
|
}
|
|
92676
|
-
return { kind: "unseen" };
|
|
92677
92717
|
}
|
|
92678
92718
|
var cancelledBeforeStartOutcome = (commandId) => ({
|
|
92679
92719
|
type: "lifecycle-metadata",
|
|
@@ -92684,95 +92724,69 @@ var storedOutcome = (stored) => {
|
|
|
92684
92724
|
const event = decodeKnownSessionEventPayload(parsed);
|
|
92685
92725
|
return event === null ? void 0 : { event, recordedAt: external_exports.object({ recordedAt: external_exports.string() }).parse(parsed).recordedAt };
|
|
92686
92726
|
};
|
|
92687
|
-
var unexpectedStanding = (standing) => {
|
|
92688
|
-
throw new Error("Unexpected command standing", { cause: standing });
|
|
92689
|
-
};
|
|
92690
92727
|
var ExecutionReceipts = class {
|
|
92691
|
-
#
|
|
92692
|
-
#table;
|
|
92693
|
-
#cancellations;
|
|
92694
|
-
#closing = false;
|
|
92728
|
+
#ledger;
|
|
92695
92729
|
#onCount;
|
|
92696
|
-
|
|
92730
|
+
/**
|
|
92731
|
+
* The terminal events this process recorded with the Agent's own failure text. That text can quote user input, so
|
|
92732
|
+
* it never enters the ledger, which keeps the content-free form; clients of this process still read the original.
|
|
92733
|
+
*/
|
|
92734
|
+
#agentOutcomes = /* @__PURE__ */ new Map();
|
|
92735
|
+
/**
|
|
92736
|
+
* Settlements reached while this process shuts down. They are artifacts of stopping, not of the commands, so the
|
|
92737
|
+
* ledger keeps the commands unsettled and the next process reports that the restart interrupted them.
|
|
92738
|
+
*/
|
|
92739
|
+
#shutdownSettlements = /* @__PURE__ */ new Map();
|
|
92740
|
+
#closing = false;
|
|
92741
|
+
constructor(ledger, onCount = () => void 0) {
|
|
92742
|
+
this.#ledger = ledger;
|
|
92697
92743
|
this.#onCount = onCount;
|
|
92698
|
-
this.#table = table;
|
|
92699
|
-
this.#cancellations = cancellations;
|
|
92700
|
-
const retained = [];
|
|
92701
|
-
for (const { commandId, started, outcome, updatedAt: _updatedAt, ...identity2 } of table.list()) {
|
|
92702
|
-
const pending = { kind: started ? "started" : "pending" };
|
|
92703
|
-
const state = outcome === null ? pending : settledExecution(pending, outcome);
|
|
92704
|
-
this.#executions.set(commandId, {
|
|
92705
|
-
...identity2,
|
|
92706
|
-
state
|
|
92707
|
-
});
|
|
92708
|
-
if (cancelledBeforeStart(state)) {
|
|
92709
|
-
retained.push({ commandId, sessionId: identity2.sessionId });
|
|
92710
|
-
}
|
|
92711
|
-
}
|
|
92712
|
-
cancellations.retain(retained);
|
|
92713
92744
|
}
|
|
92714
|
-
|
|
92715
|
-
|
|
92716
|
-
|
|
92717
|
-
const final = receipt !== void 0 && (executionStarted(receipt.state) || cancelledBeforeStart(receipt.state));
|
|
92718
|
-
return commandStanding(
|
|
92719
|
-
{
|
|
92720
|
-
receipt,
|
|
92721
|
-
identity: receipt === void 0 ? this.#table.identity(commandId) : void 0,
|
|
92722
|
-
cancellation: final ? void 0 : this.#cancellations.read(commandId)
|
|
92723
|
-
},
|
|
92724
|
-
sessionId
|
|
92725
|
-
);
|
|
92745
|
+
#withShutdownSettlement = (command2) => {
|
|
92746
|
+
const fate = this.#shutdownSettlements.get(command2.commandId);
|
|
92747
|
+
return fate === void 0 ? command2 : { ...command2, fate };
|
|
92726
92748
|
};
|
|
92727
|
-
#
|
|
92728
|
-
this.#
|
|
92729
|
-
|
|
92730
|
-
this.#executions.delete(evictedCommandId);
|
|
92731
|
-
}
|
|
92732
|
-
let activeCount = 0;
|
|
92733
|
-
for (const entry of this.#executions.values()) {
|
|
92734
|
-
if (executionOutcome(entry.state) === null) {
|
|
92735
|
-
activeCount += 1;
|
|
92736
|
-
}
|
|
92737
|
-
}
|
|
92738
|
-
this.#onCount(activeCount);
|
|
92749
|
+
#read = (commandId) => {
|
|
92750
|
+
const command2 = this.#ledger.read(commandId);
|
|
92751
|
+
return command2 === void 0 ? void 0 : this.#withShutdownSettlement(command2);
|
|
92739
92752
|
};
|
|
92740
|
-
#
|
|
92741
|
-
|
|
92742
|
-
|
|
92743
|
-
|
|
92744
|
-
|
|
92753
|
+
#standing = (commandId, sessionId) => commandStanding(this.#read(commandId), sessionId);
|
|
92754
|
+
/** The outcome clients read for a settled command: what this process recorded, else the ledger's form. */
|
|
92755
|
+
#outcome = ({ commandId, fate }) => {
|
|
92756
|
+
if (isUnsettled(fate) || fate.outcome === null) {
|
|
92757
|
+
return void 0;
|
|
92745
92758
|
}
|
|
92746
|
-
|
|
92747
|
-
{
|
|
92748
|
-
...identity2,
|
|
92749
|
-
commandId,
|
|
92750
|
-
started: executionStarted(state),
|
|
92751
|
-
outcome: durableOutcome,
|
|
92752
|
-
updatedAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
92753
|
-
},
|
|
92754
|
-
MAX_TERMINAL_RECEIPTS
|
|
92755
|
-
);
|
|
92756
|
-
this.#remember(commandId, receipt, evicted);
|
|
92759
|
+
return this.#agentOutcomes.get(commandId) ?? fate.outcome;
|
|
92757
92760
|
};
|
|
92758
|
-
#
|
|
92759
|
-
|
|
92760
|
-
|
|
92761
|
-
|
|
92761
|
+
#publishCount = () => {
|
|
92762
|
+
this.#onCount(this.#ledger.unsettled().filter((commandId) => !this.#shutdownSettlements.has(commandId)).length);
|
|
92763
|
+
};
|
|
92764
|
+
/** Settles an unsettled command. `agentOutcome` is the outcome with the Agent's text, when it differs. */
|
|
92765
|
+
#settle = (commandId, fate, outcome, agentOutcome) => {
|
|
92766
|
+
const settled = settledFate(fate, outcome);
|
|
92767
|
+
if (agentOutcome !== void 0) {
|
|
92768
|
+
this.#agentOutcomes.set(commandId, agentOutcome);
|
|
92769
|
+
}
|
|
92770
|
+
if (this.#closing) {
|
|
92771
|
+
this.#shutdownSettlements.set(commandId, settled);
|
|
92772
|
+
} else {
|
|
92773
|
+
for (const dropped of this.#ledger.settle(commandId, settled.kind, outcome)) {
|
|
92774
|
+
this.#agentOutcomes.delete(dropped);
|
|
92775
|
+
}
|
|
92762
92776
|
}
|
|
92763
|
-
|
|
92777
|
+
this.#publishCount();
|
|
92764
92778
|
};
|
|
92765
92779
|
beginShutdown = () => {
|
|
92766
92780
|
this.#closing = true;
|
|
92767
92781
|
};
|
|
92768
92782
|
outcome = (commandId) => this.restatedOutcome(commandId)?.event;
|
|
92769
|
-
/** The outcome the
|
|
92783
|
+
/** The outcome the ledger keeps for the command, with the time it was recorded. */
|
|
92770
92784
|
restatedOutcome = (commandId) => {
|
|
92771
|
-
const
|
|
92772
|
-
const outcome =
|
|
92773
|
-
return outcome ===
|
|
92785
|
+
const command2 = this.#read(commandId);
|
|
92786
|
+
const outcome = command2 === void 0 ? void 0 : this.#outcome(command2);
|
|
92787
|
+
return outcome === void 0 ? void 0 : storedOutcome(outcome);
|
|
92774
92788
|
};
|
|
92775
|
-
/** The command's delivery as
|
|
92789
|
+
/** The command's delivery as the ledger knows it; another Session's command reads as unknown. */
|
|
92776
92790
|
delivery = (commandId, sessionId) => {
|
|
92777
92791
|
const standing = this.#standing(commandId, sessionId);
|
|
92778
92792
|
switch (standing.kind) {
|
|
@@ -92787,9 +92801,10 @@ var ExecutionReceipts = class {
|
|
|
92787
92801
|
case "retained":
|
|
92788
92802
|
break;
|
|
92789
92803
|
default:
|
|
92790
|
-
return
|
|
92804
|
+
return standing;
|
|
92791
92805
|
}
|
|
92792
|
-
|
|
92806
|
+
const command2 = this.#read(commandId);
|
|
92807
|
+
if (command2 === void 0 || isUnsettled(command2.fate)) {
|
|
92793
92808
|
return { state: "accepted" };
|
|
92794
92809
|
}
|
|
92795
92810
|
const outcome = this.outcome(commandId);
|
|
@@ -92805,62 +92820,54 @@ var ExecutionReceipts = class {
|
|
|
92805
92820
|
}
|
|
92806
92821
|
};
|
|
92807
92822
|
/**
|
|
92808
|
-
* How the Session's most recently admitted turn ended.
|
|
92809
|
-
*
|
|
92810
|
-
*
|
|
92811
|
-
*
|
|
92812
|
-
* restart interrupted it) keeps its own outcome. Undefined while the latest turn runs or none is
|
|
92813
|
-
* retained.
|
|
92823
|
+
* How the Session's most recently admitted turn ended. Commands that never started (queued, or reserved for
|
|
92824
|
+
* cancellation) are not turns, unless they failed before starting. A steering command that completed as `steered`
|
|
92825
|
+
* joined the turn it steered, which reports for both; a steer not known to have joined (it failed, or a restart
|
|
92826
|
+
* interrupted it) keeps its own outcome. Undefined while the latest turn runs or its outcome is no longer kept.
|
|
92814
92827
|
*/
|
|
92815
92828
|
lastTurn = (sessionId) => {
|
|
92816
92829
|
let last;
|
|
92817
|
-
|
|
92818
|
-
|
|
92819
|
-
|
|
92820
|
-
continue;
|
|
92821
|
-
}
|
|
92822
|
-
const outcome2 = this.outcome(commandId);
|
|
92830
|
+
for (const stored of this.#ledger.session(sessionId)) {
|
|
92831
|
+
const command2 = this.#withShutdownSettlement(stored);
|
|
92832
|
+
const outcome2 = this.outcome(command2.commandId);
|
|
92823
92833
|
const payload = outcome2?.type === "lifecycle-metadata" ? outcome2.payload : void 0;
|
|
92824
92834
|
const failedBeforeStart = payload?.kind === "prompt.failed-before-start";
|
|
92825
92835
|
const steered = payload?.kind === "prompt.completed" && promptCompletion(payload).kind === "steered";
|
|
92826
|
-
|
|
92827
|
-
|
|
92828
|
-
|
|
92836
|
+
const kept = command2.fate.kind === "started" || outcome2 !== void 0;
|
|
92837
|
+
if (kept && (isStarted(command2.fate) || failedBeforeStart) && !steered) {
|
|
92838
|
+
last = { commandId: command2.commandId, outcome: outcome2 };
|
|
92829
92839
|
}
|
|
92830
92840
|
}
|
|
92831
|
-
const outcome = last
|
|
92841
|
+
const outcome = last?.outcome;
|
|
92832
92842
|
if (last === void 0 || outcome?.type !== "lifecycle-metadata" || !isPromptTerminal(outcome.payload)) {
|
|
92833
92843
|
return void 0;
|
|
92834
92844
|
}
|
|
92835
92845
|
switch (outcome.payload.kind) {
|
|
92836
92846
|
case "prompt.completed":
|
|
92837
|
-
return { commandId: last, state: "completed", stopReason: outcome.payload.stopReason };
|
|
92847
|
+
return { commandId: last.commandId, state: "completed", stopReason: outcome.payload.stopReason };
|
|
92838
92848
|
case "prompt.failed":
|
|
92839
92849
|
case "prompt.failed-before-start":
|
|
92840
92850
|
return {
|
|
92841
92851
|
code: outcome.payload.code,
|
|
92842
|
-
commandId: last,
|
|
92852
|
+
commandId: last.commandId,
|
|
92843
92853
|
message: outcome.payload.message,
|
|
92844
92854
|
state: "failed"
|
|
92845
92855
|
};
|
|
92846
92856
|
}
|
|
92847
92857
|
};
|
|
92848
|
-
/** When the Session's running command started
|
|
92858
|
+
/** When the Session's running command started. */
|
|
92849
92859
|
startedAt = (commandId, sessionId) => {
|
|
92850
|
-
const
|
|
92851
|
-
return
|
|
92860
|
+
const command2 = this.#read(commandId);
|
|
92861
|
+
return command2?.sessionId === sessionId && command2.fate.kind === "started" ? command2.fate.startedAt : void 0;
|
|
92852
92862
|
};
|
|
92853
92863
|
/**
|
|
92854
92864
|
* The recorded terminal events of the Session's settled prompts whose Agent reported the user message they
|
|
92855
|
-
* recorded, while
|
|
92865
|
+
* recorded, while the ledger keeps their outcomes.
|
|
92856
92866
|
*/
|
|
92857
92867
|
promptOutcomes = (sessionId) => {
|
|
92858
92868
|
const outcomes = [];
|
|
92859
|
-
for (const
|
|
92860
|
-
|
|
92861
|
-
continue;
|
|
92862
|
-
}
|
|
92863
|
-
const outcome = this.restatedOutcome(commandId);
|
|
92869
|
+
for (const command2 of this.#ledger.session(sessionId)) {
|
|
92870
|
+
const outcome = this.restatedOutcome(command2.commandId);
|
|
92864
92871
|
const event = outcome?.event;
|
|
92865
92872
|
if (outcome?.recordedAt !== void 0 && event?.type === "lifecycle-metadata" && (event.payload.kind === "prompt.completed" || event.payload.kind === "prompt.failed") && event.payload.messageId !== void 0) {
|
|
92866
92873
|
outcomes.push({ payload: event.payload, recordedAt: outcome.recordedAt });
|
|
@@ -92868,7 +92875,7 @@ var ExecutionReceipts = class {
|
|
|
92868
92875
|
}
|
|
92869
92876
|
return outcomes;
|
|
92870
92877
|
};
|
|
92871
|
-
/**
|
|
92878
|
+
/** A command that started stays started after its outcome is no longer kept. */
|
|
92872
92879
|
hasStarted = (commandId, sessionId) => {
|
|
92873
92880
|
const standing = this.#standing(commandId, sessionId);
|
|
92874
92881
|
switch (standing.kind) {
|
|
@@ -92880,9 +92887,9 @@ var ExecutionReceipts = class {
|
|
|
92880
92887
|
case "expired":
|
|
92881
92888
|
return true;
|
|
92882
92889
|
case "retained":
|
|
92883
|
-
return
|
|
92890
|
+
return isStarted(standing.command.fate);
|
|
92884
92891
|
default:
|
|
92885
|
-
return
|
|
92892
|
+
return standing;
|
|
92886
92893
|
}
|
|
92887
92894
|
};
|
|
92888
92895
|
/**
|
|
@@ -92909,7 +92916,7 @@ var ExecutionReceipts = class {
|
|
|
92909
92916
|
case "unseen":
|
|
92910
92917
|
break;
|
|
92911
92918
|
default:
|
|
92912
|
-
return
|
|
92919
|
+
return standing;
|
|
92913
92920
|
}
|
|
92914
92921
|
const outcome = cancelledBeforeStartOutcome(commandId);
|
|
92915
92922
|
const commandHash = createHash8("sha256").update(
|
|
@@ -92919,22 +92926,18 @@ var ExecutionReceipts = class {
|
|
|
92919
92926
|
sessionId
|
|
92920
92927
|
})
|
|
92921
92928
|
).digest("hex");
|
|
92922
|
-
this.#
|
|
92923
|
-
|
|
92924
|
-
|
|
92925
|
-
|
|
92926
|
-
|
|
92927
|
-
|
|
92928
|
-
kind: "settled-before-start",
|
|
92929
|
-
outcome: JSON.stringify({ ...outcome, recordedAt: (/* @__PURE__ */ new Date()).toISOString() })
|
|
92930
|
-
}
|
|
92931
|
-
});
|
|
92929
|
+
for (const dropped of this.#ledger.admitCancelled(
|
|
92930
|
+
{ attemptId: randomUUID15(), commandHash, commandId, sessionId },
|
|
92931
|
+
JSON.stringify({ ...outcome, recordedAt: (/* @__PURE__ */ new Date()).toISOString() })
|
|
92932
|
+
)) {
|
|
92933
|
+
this.#agentOutcomes.delete(dropped);
|
|
92934
|
+
}
|
|
92932
92935
|
return { kind: "recorded", outcome };
|
|
92933
92936
|
};
|
|
92934
92937
|
/**
|
|
92935
|
-
*
|
|
92938
|
+
* The ledger follows each command's recorded lifecycle. `prompt.started` is recorded where the command is handed
|
|
92936
92939
|
* to the Agent, so the started mark and the event clients see are one transition; a terminal event settles the
|
|
92937
|
-
*
|
|
92940
|
+
* command. Nothing else marks a command started.
|
|
92938
92941
|
*/
|
|
92939
92942
|
record = (event) => {
|
|
92940
92943
|
if (event.type !== "lifecycle-metadata") {
|
|
@@ -92942,70 +92945,66 @@ var ExecutionReceipts = class {
|
|
|
92942
92945
|
}
|
|
92943
92946
|
const payload = event.payload;
|
|
92944
92947
|
if (payload.kind === "prompt.started") {
|
|
92945
|
-
|
|
92946
|
-
if (receipt2?.state.kind === "pending") {
|
|
92947
|
-
this.#save(payload.commandId, {
|
|
92948
|
-
...receipt2,
|
|
92949
|
-
state: { kind: "started", startedAt: event.recordedAt }
|
|
92950
|
-
});
|
|
92951
|
-
}
|
|
92948
|
+
this.#ledger.start(payload.commandId, event.recordedAt);
|
|
92952
92949
|
return;
|
|
92953
92950
|
}
|
|
92954
92951
|
if (!isPromptTerminal(payload)) {
|
|
92955
92952
|
return;
|
|
92956
92953
|
}
|
|
92957
|
-
const
|
|
92958
|
-
if (
|
|
92954
|
+
const fate = this.#read(payload.commandId)?.fate;
|
|
92955
|
+
if (fate === void 0 || !isUnsettled(fate)) {
|
|
92959
92956
|
return;
|
|
92960
92957
|
}
|
|
92961
|
-
const sanitized = payload.kind === "prompt.completed" ? payload : { ...payload, message: "The local Agent could not complete the request" };
|
|
92962
92958
|
const outcome = { type: "lifecycle-metadata", payload, recordedAt: event.recordedAt };
|
|
92963
|
-
|
|
92959
|
+
if (payload.kind === "prompt.completed") {
|
|
92960
|
+
this.#settle(payload.commandId, fate, JSON.stringify(outcome));
|
|
92961
|
+
return;
|
|
92962
|
+
}
|
|
92963
|
+
const contentFree = { ...payload, message: "The local Agent could not complete the request" };
|
|
92964
|
+
this.#settle(
|
|
92964
92965
|
payload.commandId,
|
|
92965
|
-
|
|
92966
|
-
JSON.stringify({ ...outcome, payload:
|
|
92966
|
+
fate,
|
|
92967
|
+
JSON.stringify({ ...outcome, payload: contentFree }),
|
|
92968
|
+
JSON.stringify(outcome)
|
|
92967
92969
|
);
|
|
92968
92970
|
};
|
|
92969
92971
|
recover = () => {
|
|
92970
92972
|
const recovered = [];
|
|
92971
|
-
for (const
|
|
92972
|
-
const
|
|
92973
|
-
|
|
92974
|
-
|
|
92973
|
+
for (const command2 of this.#ledger.all()) {
|
|
92974
|
+
const fate = command2.fate;
|
|
92975
|
+
if (!isUnsettled(fate)) {
|
|
92976
|
+
const restated = fate.outcome === null ? void 0 : storedOutcome(fate.outcome);
|
|
92977
|
+
if (restated !== void 0) {
|
|
92978
|
+
recovered.push({ kind: "restated", sessionId: command2.sessionId, outcome: restated });
|
|
92979
|
+
}
|
|
92980
|
+
continue;
|
|
92981
|
+
}
|
|
92982
|
+
const event = {
|
|
92975
92983
|
type: "lifecycle-metadata",
|
|
92976
|
-
payload:
|
|
92984
|
+
payload: fate.kind === "started" ? {
|
|
92977
92985
|
kind: "prompt.failed",
|
|
92978
|
-
commandId,
|
|
92979
|
-
attemptId:
|
|
92986
|
+
commandId: command2.commandId,
|
|
92987
|
+
attemptId: command2.attemptId,
|
|
92980
92988
|
code: "runtime_restarted",
|
|
92981
92989
|
message: "The local runtime restarted while this request was running"
|
|
92982
92990
|
} : {
|
|
92983
92991
|
kind: "prompt.failed-before-start",
|
|
92984
|
-
commandId,
|
|
92992
|
+
commandId: command2.commandId,
|
|
92985
92993
|
code: "runtime_restarted",
|
|
92986
92994
|
message: "The local runtime restarted before this request started"
|
|
92987
92995
|
}
|
|
92988
|
-
}
|
|
92989
|
-
if (event === null) {
|
|
92990
|
-
continue;
|
|
92991
|
-
}
|
|
92992
|
-
if (!restoreCancellation && outcome !== null) {
|
|
92993
|
-
const restated = storedOutcome(outcome);
|
|
92994
|
-
if (restated !== void 0) {
|
|
92995
|
-
recovered.push({ kind: "restated", sessionId: receipt.sessionId, outcome: restated });
|
|
92996
|
-
}
|
|
92997
|
-
continue;
|
|
92998
|
-
}
|
|
92996
|
+
};
|
|
92999
92997
|
const recordedAt = (/* @__PURE__ */ new Date()).toISOString();
|
|
93000
|
-
recovered.push({ kind: "recorded", sessionId:
|
|
93001
|
-
this.#
|
|
93002
|
-
...receipt,
|
|
93003
|
-
state: settledExecution(receipt.state, JSON.stringify({ ...event, recordedAt }))
|
|
93004
|
-
});
|
|
92998
|
+
recovered.push({ kind: "recorded", sessionId: command2.sessionId, event, recordedAt });
|
|
92999
|
+
this.#settle(command2.commandId, fate, JSON.stringify({ ...event, recordedAt }));
|
|
93005
93000
|
}
|
|
93006
93001
|
return recovered;
|
|
93007
93002
|
};
|
|
93008
|
-
|
|
93003
|
+
/**
|
|
93004
|
+
* Claims a command's identifier for the Session. A known identifier is answered from the ledger; a new command is
|
|
93005
|
+
* recorded only when `admits` accepts it in the same step, so a command the Session refuses leaves no record.
|
|
93006
|
+
*/
|
|
93007
|
+
claimExecution = (commandId, sessionId, commandJson, admits) => {
|
|
93009
93008
|
const commandHash = createHash8("sha256").update(commandJson).digest("hex");
|
|
93010
93009
|
const standing = this.#standing(commandId, sessionId);
|
|
93011
93010
|
switch (standing.kind) {
|
|
@@ -93013,48 +93012,44 @@ var ExecutionReceipts = class {
|
|
|
93013
93012
|
case "cancelled":
|
|
93014
93013
|
return { kind: "conflict" };
|
|
93015
93014
|
case "retained":
|
|
93016
|
-
if (standing.
|
|
93015
|
+
if (standing.command.commandHash !== commandHash) {
|
|
93017
93016
|
return { kind: "conflict" };
|
|
93018
93017
|
}
|
|
93019
93018
|
return {
|
|
93020
|
-
attemptId: standing.
|
|
93019
|
+
attemptId: standing.command.attemptId,
|
|
93021
93020
|
commandId,
|
|
93022
93021
|
kind: "duplicate",
|
|
93023
|
-
state:
|
|
93022
|
+
state: isUnsettled(standing.command.fate) ? "unsettled" : "settled"
|
|
93024
93023
|
};
|
|
93025
93024
|
case "expired":
|
|
93026
93025
|
return standing.commandHash === commandHash ? { kind: "expired" } : { kind: "conflict" };
|
|
93027
93026
|
case "retryable":
|
|
93028
|
-
|
|
93029
|
-
this.#executions.delete(commandId);
|
|
93030
|
-
return this.claimExecution(commandId, sessionId, commandJson);
|
|
93027
|
+
// A restart failed it before it started: the admission replaces that failure.
|
|
93031
93028
|
case "unseen":
|
|
93032
93029
|
break;
|
|
93033
93030
|
default:
|
|
93034
|
-
return
|
|
93031
|
+
return standing;
|
|
93032
|
+
}
|
|
93033
|
+
if (!admits()) {
|
|
93034
|
+
return { kind: "refused" };
|
|
93035
93035
|
}
|
|
93036
93036
|
const attemptId = randomUUID15();
|
|
93037
|
-
this.#
|
|
93038
|
-
|
|
93039
|
-
attemptId,
|
|
93040
|
-
commandHash,
|
|
93041
|
-
sessionId,
|
|
93042
|
-
state: { kind: "pending" }
|
|
93043
|
-
});
|
|
93037
|
+
this.#ledger.admit({ attemptId, commandHash, commandId, sessionId });
|
|
93038
|
+
this.#publishCount();
|
|
93044
93039
|
return { attemptId, commandId, kind: "accepted" };
|
|
93045
93040
|
};
|
|
93046
93041
|
/** Only commands without a terminal result can still be cancelled. */
|
|
93047
93042
|
findUnsettledAttemptId = (commandId, sessionId) => {
|
|
93048
|
-
const
|
|
93049
|
-
return
|
|
93043
|
+
const command2 = this.#read(commandId);
|
|
93044
|
+
return command2?.sessionId === sessionId && isUnsettled(command2.fate) ? command2.attemptId : null;
|
|
93050
93045
|
};
|
|
93051
93046
|
isTerminalExecution = (commandId, sessionId) => {
|
|
93052
|
-
const
|
|
93053
|
-
return
|
|
93047
|
+
const command2 = this.#read(commandId);
|
|
93048
|
+
return command2?.sessionId === sessionId && !isUnsettled(command2.fate);
|
|
93054
93049
|
};
|
|
93055
93050
|
close = () => {
|
|
93056
|
-
this.#
|
|
93057
|
-
this.#
|
|
93051
|
+
this.#agentOutcomes.clear();
|
|
93052
|
+
this.#shutdownSettlements.clear();
|
|
93058
93053
|
};
|
|
93059
93054
|
};
|
|
93060
93055
|
|
|
@@ -93163,9 +93158,9 @@ var ActiveRuntimeTurn = class {
|
|
|
93163
93158
|
* `started` and `startedAt` read the command's execution receipt, the single owner of whether and when the command
|
|
93164
93159
|
* started.
|
|
93165
93160
|
*/
|
|
93166
|
-
constructor(
|
|
93161
|
+
constructor(command2, attemptId, started, startedAt) {
|
|
93167
93162
|
this.attemptId = attemptId;
|
|
93168
|
-
this.command =
|
|
93163
|
+
this.command = command2;
|
|
93169
93164
|
this.#controller = new AbortController();
|
|
93170
93165
|
this.#started = started;
|
|
93171
93166
|
this.#startedAt = startedAt;
|
|
@@ -93177,16 +93172,16 @@ var ActiveRuntimeTurn = class {
|
|
|
93177
93172
|
this.#admission = { kind: "queued", promotion: Promise.withResolvers() };
|
|
93178
93173
|
};
|
|
93179
93174
|
/** Whether the prompt was admitted to its Session's queue, whatever happened to it afterwards. */
|
|
93180
|
-
enteredQueue = () => this.
|
|
93181
|
-
isQueued = () => (this.#admission.kind === "queued" || this.#admission.kind === "admitted" && this.#admission.
|
|
93175
|
+
enteredQueue = () => this.#admission.kind === "queued" || this.#admission.kind === "promoted" || this.#admission.kind === "admitted" && this.#admission.fromQueue;
|
|
93176
|
+
isQueued = () => (this.#admission.kind === "queued" || this.#admission.kind === "admitted" && this.#admission.fromQueue && this.#admission.dispatch.kind === "own") && !this.#started() && !this.#controller.signal.aborted;
|
|
93182
93177
|
abortRuntime = () => {
|
|
93183
93178
|
this.#controller.abort();
|
|
93184
93179
|
};
|
|
93185
93180
|
finish = () => {
|
|
93186
93181
|
this.#finished.resolve();
|
|
93187
93182
|
};
|
|
93188
|
-
promoteQueuedPrompt = (
|
|
93189
|
-
if (
|
|
93183
|
+
promoteQueuedPrompt = (command2) => {
|
|
93184
|
+
if (command2.commandId !== this.command.commandId || command2.sessionId !== this.command.sessionId || this.#controller.signal.aborted) {
|
|
93190
93185
|
return "unavailable";
|
|
93191
93186
|
}
|
|
93192
93187
|
switch (this.#admission.kind) {
|
|
@@ -93199,15 +93194,19 @@ var ActiveRuntimeTurn = class {
|
|
|
93199
93194
|
case "promoted":
|
|
93200
93195
|
return "accepted";
|
|
93201
93196
|
case "admitted":
|
|
93202
|
-
return this.#admission.
|
|
93197
|
+
return this.#admission.dispatch.kind === "steer" ? "accepted" : "already-started";
|
|
93203
93198
|
case "waiting":
|
|
93204
93199
|
return "unavailable";
|
|
93205
93200
|
}
|
|
93206
93201
|
};
|
|
93207
|
-
|
|
93208
|
-
|
|
93209
|
-
|
|
93210
|
-
|
|
93202
|
+
/**
|
|
93203
|
+
* Fixes how the prompt executes before asynchronous Agent preparation, so a late promotion cannot change a dispatch
|
|
93204
|
+
* that execution has already selected.
|
|
93205
|
+
*/
|
|
93206
|
+
admit = (dispatch) => {
|
|
93207
|
+
const fromQueue = this.enteredQueue();
|
|
93208
|
+
this.#admission = { kind: "admitted", dispatch, fromQueue };
|
|
93209
|
+
return dispatch;
|
|
93211
93210
|
};
|
|
93212
93211
|
queuePromotion = () => {
|
|
93213
93212
|
if (this.#admission.kind === "queued") {
|
|
@@ -93215,19 +93214,21 @@ var ActiveRuntimeTurn = class {
|
|
|
93215
93214
|
}
|
|
93216
93215
|
return this.#admission.kind === "promoted" ? Promise.resolve() : null;
|
|
93217
93216
|
};
|
|
93218
|
-
|
|
93217
|
+
/** Whether the prompt joins another turn's execution instead of owning one, so it holds no place in the queue. */
|
|
93218
|
+
isSteering = () => {
|
|
93219
93219
|
switch (this.#admission.kind) {
|
|
93220
93220
|
case "waiting":
|
|
93221
|
+
return this.command.disposition === SessionPromptDisposition.Steer;
|
|
93221
93222
|
case "queued":
|
|
93222
|
-
return
|
|
93223
|
+
return false;
|
|
93223
93224
|
case "promoted":
|
|
93224
|
-
return
|
|
93225
|
+
return true;
|
|
93225
93226
|
case "admitted":
|
|
93226
|
-
return this.#admission.
|
|
93227
|
+
return this.#admission.dispatch.kind === "steer";
|
|
93227
93228
|
}
|
|
93228
93229
|
};
|
|
93229
93230
|
/** A steering prompt joins the execution of the turn it steers; every other prompt owns its execution. */
|
|
93230
|
-
execution = () => this.
|
|
93231
|
+
execution = () => this.#admission.kind === "admitted" && this.#admission.dispatch.kind === "steer" ? this.#admission.dispatch.targetCommandId : this.command.commandId;
|
|
93231
93232
|
recordEvent = (event) => {
|
|
93232
93233
|
if (event.sessionId !== this.command.sessionId || "commandId" in event && event.commandId !== this.command.commandId) {
|
|
93233
93234
|
return event;
|
|
@@ -93312,14 +93313,14 @@ var SessionExecutionState = class {
|
|
|
93312
93313
|
this.#operations = operations;
|
|
93313
93314
|
}
|
|
93314
93315
|
isEmpty = () => this.#turnsByCommandId.size === 0;
|
|
93315
|
-
start = (
|
|
93316
|
+
start = (command2, attemptId) => {
|
|
93316
93317
|
const turn = new ActiveRuntimeTurn(
|
|
93317
|
-
|
|
93318
|
+
command2,
|
|
93318
93319
|
attemptId,
|
|
93319
|
-
() => this.#operations.hasStarted(
|
|
93320
|
-
() => this.#operations.startedAt(
|
|
93320
|
+
() => this.#operations.hasStarted(command2.commandId, this.#sessionId),
|
|
93321
|
+
() => this.#operations.startedAt(command2.commandId, this.#sessionId)
|
|
93321
93322
|
);
|
|
93322
|
-
this.#turnsByCommandId.set(
|
|
93323
|
+
this.#turnsByCommandId.set(command2.commandId, turn);
|
|
93323
93324
|
return turn;
|
|
93324
93325
|
};
|
|
93325
93326
|
get = (commandId) => this.#turnsByCommandId.get(commandId);
|
|
@@ -93351,31 +93352,27 @@ var SessionExecutionState = class {
|
|
|
93351
93352
|
}
|
|
93352
93353
|
await Promise.all(turns.map((turn) => turn.completion));
|
|
93353
93354
|
};
|
|
93355
|
+
/**
|
|
93356
|
+
* Admits the turn in arrival order. A steering prompt joins the running turn it names. An appended prompt runs
|
|
93357
|
+
* when no earlier turn owns an execution, and otherwise waits in the queue until every earlier one ended or the
|
|
93358
|
+
* user promotes it to steer the turn it waits behind. Admission never refuses an appended prompt.
|
|
93359
|
+
*/
|
|
93354
93360
|
admitAndWait = async (turn, waitSignal, onQueued) => {
|
|
93355
|
-
const
|
|
93361
|
+
const command2 = turn.command;
|
|
93356
93362
|
waitSignal.throwIfAborted();
|
|
93357
|
-
|
|
93358
|
-
|
|
93359
|
-
|
|
93360
|
-
|
|
93361
|
-
|
|
93362
|
-
if ((target === turn || target?.command.commandId !== command.targetCommandId) && !this.#operations.isTerminalExecution(command.targetCommandId, this.#sessionId)) {
|
|
93363
|
-
return { kind: "queue-target-unavailable" };
|
|
93364
|
-
}
|
|
93363
|
+
if (command2.disposition === SessionPromptDisposition.Steer) {
|
|
93364
|
+
return turn.admit({ kind: "steer", targetCommandId: command2.targetCommandId });
|
|
93365
|
+
}
|
|
93366
|
+
const head = () => [...this.#turnsByCommandId.values()].find((candidate) => !candidate.isSteering());
|
|
93367
|
+
if (head() !== turn) {
|
|
93365
93368
|
turn.enqueue();
|
|
93366
93369
|
onQueued();
|
|
93367
93370
|
}
|
|
93368
|
-
if (turn.effectiveDisposition() === SessionPromptDisposition.Steer) {
|
|
93369
|
-
return { disposition: turn.admit(), kind: "available" };
|
|
93370
|
-
}
|
|
93371
93371
|
for (; ; ) {
|
|
93372
93372
|
waitSignal.throwIfAborted();
|
|
93373
93373
|
const first = head();
|
|
93374
93374
|
if (first === void 0 || first === turn) {
|
|
93375
|
-
return
|
|
93376
|
-
}
|
|
93377
|
-
if (command.disposition !== SessionPromptDisposition.Queue) {
|
|
93378
|
-
return { kind: "busy" };
|
|
93375
|
+
return turn.admit({ kind: "own" });
|
|
93379
93376
|
}
|
|
93380
93377
|
const promotion = turn.queuePromotion();
|
|
93381
93378
|
if (promotion === null) {
|
|
@@ -93386,7 +93383,7 @@ var SessionExecutionState = class {
|
|
|
93386
93383
|
promotion.then(() => "promoted")
|
|
93387
93384
|
]);
|
|
93388
93385
|
if (decision === "promoted") {
|
|
93389
|
-
return
|
|
93386
|
+
return turn.admit({ kind: "steer", targetCommandId: first.command.commandId });
|
|
93390
93387
|
}
|
|
93391
93388
|
}
|
|
93392
93389
|
};
|
|
@@ -93411,8 +93408,8 @@ var SessionTurns = class {
|
|
|
93411
93408
|
return session;
|
|
93412
93409
|
};
|
|
93413
93410
|
get = (commandId, sessionId) => this.#bySessionId.get(sessionId)?.get(commandId);
|
|
93414
|
-
start = (
|
|
93415
|
-
const turn = this.session(
|
|
93411
|
+
start = (command2, attemptId) => {
|
|
93412
|
+
const turn = this.session(command2.sessionId).start(command2, attemptId);
|
|
93416
93413
|
this.#activity.start(turn);
|
|
93417
93414
|
return turn;
|
|
93418
93415
|
};
|
|
@@ -93673,20 +93670,13 @@ function buildSessionLayer(options) {
|
|
|
93673
93670
|
const sessionDatabase = openAcpSessionDatabase(databases.sessions);
|
|
93674
93671
|
let events;
|
|
93675
93672
|
let operations;
|
|
93676
|
-
let cancellations;
|
|
93677
93673
|
try {
|
|
93678
|
-
|
|
93679
|
-
operations = new ExecutionReceipts(
|
|
93680
|
-
new ExecutionReceiptTable(sessionDatabase),
|
|
93681
|
-
cancellations,
|
|
93682
|
-
options.onExecutionCountChange
|
|
93683
|
-
);
|
|
93674
|
+
operations = new ExecutionReceipts(new CommandLedgerTable(sessionDatabase), options.onExecutionCountChange);
|
|
93684
93675
|
events = new CachedSessionEventStore(
|
|
93685
93676
|
new SessionEventCacheTable(openSessionEventCacheDatabase(databases.events)),
|
|
93686
93677
|
new SqliteSessionLiveEventPosition(new LiveEventPositionTable(sessionDatabase))
|
|
93687
93678
|
);
|
|
93688
93679
|
} catch (error62) {
|
|
93689
|
-
cancellations?.close();
|
|
93690
93680
|
sessionDatabase.close();
|
|
93691
93681
|
throw error62;
|
|
93692
93682
|
}
|
|
@@ -93734,14 +93724,14 @@ function buildSessionLayer(options) {
|
|
|
93734
93724
|
directories,
|
|
93735
93725
|
manager,
|
|
93736
93726
|
async (request, requestOptions) => {
|
|
93737
|
-
const snapshot = await activeSessions.executionSnapshot(async (
|
|
93738
|
-
if (
|
|
93727
|
+
const snapshot = await activeSessions.executionSnapshot(async (command2) => {
|
|
93728
|
+
if (command2.sessionId !== request.targetSessionId || command2.agentId !== request.agentId) {
|
|
93739
93729
|
return false;
|
|
93740
93730
|
}
|
|
93741
|
-
const cwd = await directories.resolve(
|
|
93731
|
+
const cwd = await directories.resolve(command2.bindingId, command2.directoryId, requestOptions.signal);
|
|
93742
93732
|
const additionalDirectories = await directories.resolveMany(
|
|
93743
|
-
|
|
93744
|
-
|
|
93733
|
+
command2.bindingId,
|
|
93734
|
+
command2.additionalDirectoryIds,
|
|
93745
93735
|
requestOptions.signal
|
|
93746
93736
|
);
|
|
93747
93737
|
return cwd === requestOptions.cwd && additionalDirectories.length === requestOptions.additionalDirectories.length && additionalDirectories.every(
|
|
@@ -94519,7 +94509,7 @@ async function refreshAgentCatalog(config2, discover, signal) {
|
|
|
94519
94509
|
|
|
94520
94510
|
// src/engine/runtime/catalog/handle-agent-catalog-discovery.ts
|
|
94521
94511
|
var CATALOG_DISCOVERY_TIMEOUT_MILLISECONDS = 9e4;
|
|
94522
|
-
function discoveredEvent(
|
|
94512
|
+
function discoveredEvent(command2, agents) {
|
|
94523
94513
|
return {
|
|
94524
94514
|
agents: agents.map((agent2) => ({
|
|
94525
94515
|
agentVersion: agent2.agentVersion,
|
|
@@ -94527,7 +94517,7 @@ function discoveredEvent(command, agents) {
|
|
|
94527
94517
|
label: agent2.label
|
|
94528
94518
|
})),
|
|
94529
94519
|
kind: "agent.catalog.discovered",
|
|
94530
|
-
requestId:
|
|
94520
|
+
requestId: command2.requestId
|
|
94531
94521
|
};
|
|
94532
94522
|
}
|
|
94533
94523
|
function createAgentCatalogDiscoveryHandler(dependencies) {
|
|
@@ -94535,20 +94525,20 @@ function createAgentCatalogDiscoveryHandler(dependencies) {
|
|
|
94535
94525
|
const requestIds = /* @__PURE__ */ new Set();
|
|
94536
94526
|
let controller = null;
|
|
94537
94527
|
let completion = null;
|
|
94538
|
-
const handle = (
|
|
94539
|
-
if (requestIds.has(
|
|
94528
|
+
const handle = (command2) => {
|
|
94529
|
+
if (requestIds.has(command2.requestId) || controller !== null) {
|
|
94540
94530
|
if (socket.readyState === WebSocket3.OPEN) {
|
|
94541
94531
|
send(socket, {
|
|
94542
94532
|
code: "agent_catalog_discovery_busy",
|
|
94543
94533
|
kind: AGENT_CATALOG_DISCOVERY_FAILED_KIND,
|
|
94544
94534
|
message: "An Agent catalog discovery is already running",
|
|
94545
|
-
requestId:
|
|
94535
|
+
requestId: command2.requestId
|
|
94546
94536
|
});
|
|
94547
94537
|
}
|
|
94548
94538
|
return;
|
|
94549
94539
|
}
|
|
94550
94540
|
controller = new AbortController();
|
|
94551
|
-
requestIds.add(
|
|
94541
|
+
requestIds.add(command2.requestId);
|
|
94552
94542
|
const operationSignal = AbortSignal.any([signal, controller.signal]);
|
|
94553
94543
|
const timeout = timer.schedule(
|
|
94554
94544
|
() => controller?.abort(new Error("Agent catalog discovery timed out")),
|
|
@@ -94562,7 +94552,7 @@ function createAgentCatalogDiscoveryHandler(dependencies) {
|
|
|
94562
94552
|
send(
|
|
94563
94553
|
socket,
|
|
94564
94554
|
discoveredEvent(
|
|
94565
|
-
|
|
94555
|
+
command2,
|
|
94566
94556
|
published.agents.map((agent2) => ({
|
|
94567
94557
|
agentVersion: agent2.agentVersion,
|
|
94568
94558
|
id: agent2.id,
|
|
@@ -94574,7 +94564,7 @@ function createAgentCatalogDiscoveryHandler(dependencies) {
|
|
|
94574
94564
|
} catch (error62) {
|
|
94575
94565
|
diagnostics.daemonDiagnostic(
|
|
94576
94566
|
"agent_catalog_discovery_failed",
|
|
94577
|
-
|
|
94567
|
+
command2.requestId,
|
|
94578
94568
|
{ code: operationErrorCode(error62) },
|
|
94579
94569
|
error62
|
|
94580
94570
|
);
|
|
@@ -94583,12 +94573,12 @@ function createAgentCatalogDiscoveryHandler(dependencies) {
|
|
|
94583
94573
|
code: operationErrorCode(error62),
|
|
94584
94574
|
kind: AGENT_CATALOG_DISCOVERY_FAILED_KIND,
|
|
94585
94575
|
message: operationErrorMessage(error62),
|
|
94586
|
-
requestId:
|
|
94576
|
+
requestId: command2.requestId
|
|
94587
94577
|
});
|
|
94588
94578
|
}
|
|
94589
94579
|
} finally {
|
|
94590
94580
|
timeout.cancel();
|
|
94591
|
-
requestIds.delete(
|
|
94581
|
+
requestIds.delete(command2.requestId);
|
|
94592
94582
|
controller = null;
|
|
94593
94583
|
completion = null;
|
|
94594
94584
|
}
|
|
@@ -94700,9 +94690,9 @@ function isUnavailableModel(cause, modelSettingId, requestedModel) {
|
|
|
94700
94690
|
function unsupportedModelIds(unsupportedModels) {
|
|
94701
94691
|
return [...new Set(unsupportedModels.map((item) => item.requestedValue))];
|
|
94702
94692
|
}
|
|
94703
|
-
async function discoverAgentSettings(
|
|
94704
|
-
const { agent: agent2, adapter: harnessAdapter } = await resolveAgent(
|
|
94705
|
-
const directoryId =
|
|
94693
|
+
async function discoverAgentSettings(command2, resolveAgent, bindingId, directories, sessions, signal) {
|
|
94694
|
+
const { agent: agent2, adapter: harnessAdapter } = await resolveAgent(command2.agentId, signal);
|
|
94695
|
+
const directoryId = command2.directoryId ?? "default";
|
|
94706
94696
|
const cwd = await directories.resolve(bindingId, directoryId, signal);
|
|
94707
94697
|
const inspectedBaseSnapshot = await sessions.inspectAgentSettings({
|
|
94708
94698
|
adapter: harnessAdapter,
|
|
@@ -94720,12 +94710,12 @@ async function discoverAgentSettings(command, resolveAgent, bindingId, directori
|
|
|
94720
94710
|
const baseModel = modelOption(baseSnapshot.configOptions);
|
|
94721
94711
|
const unsupportedModels = [];
|
|
94722
94712
|
let selectedSnapshot = baseSnapshot;
|
|
94723
|
-
if (
|
|
94724
|
-
if (baseModel === void 0 || baseModel.type !== "select" || !baseModel.values.some((value) => value.value ===
|
|
94713
|
+
if (command2.model !== void 0) {
|
|
94714
|
+
if (baseModel === void 0 || baseModel.type !== "select" || !baseModel.values.some((value) => value.value === command2.model)) {
|
|
94725
94715
|
unsupportedModels.push(
|
|
94726
94716
|
new AcpConfigurationValueUnavailableError(
|
|
94727
94717
|
baseModel?.id ?? "model",
|
|
94728
|
-
|
|
94718
|
+
command2.model,
|
|
94729
94719
|
baseModel?.values.map((value) => value.value) ?? []
|
|
94730
94720
|
)
|
|
94731
94721
|
);
|
|
@@ -94736,12 +94726,12 @@ async function discoverAgentSettings(command, resolveAgent, bindingId, directori
|
|
|
94736
94726
|
additionalDirectories: [],
|
|
94737
94727
|
agent: agent2,
|
|
94738
94728
|
cwd,
|
|
94739
|
-
model:
|
|
94729
|
+
model: command2.model,
|
|
94740
94730
|
signal
|
|
94741
94731
|
});
|
|
94742
94732
|
} catch (cause) {
|
|
94743
94733
|
signal.throwIfAborted();
|
|
94744
|
-
if (!isUnavailableModel(cause, baseModel.id,
|
|
94734
|
+
if (!isUnavailableModel(cause, baseModel.id, command2.model)) {
|
|
94745
94735
|
throw cause;
|
|
94746
94736
|
}
|
|
94747
94737
|
unsupportedModels.push(cause);
|
|
@@ -94750,7 +94740,7 @@ async function discoverAgentSettings(command, resolveAgent, bindingId, directori
|
|
|
94750
94740
|
}
|
|
94751
94741
|
const adapter = agentSettingsAdapterForAgent(agent2.id);
|
|
94752
94742
|
const modelEffort = await discoverModelEffort(
|
|
94753
|
-
|
|
94743
|
+
command2,
|
|
94754
94744
|
agent2,
|
|
94755
94745
|
harnessAdapter,
|
|
94756
94746
|
adapter.modelEffortResolution,
|
|
@@ -94774,13 +94764,13 @@ async function discoverAgentSettings(command, resolveAgent, bindingId, directori
|
|
|
94774
94764
|
);
|
|
94775
94765
|
return {
|
|
94776
94766
|
event: {
|
|
94777
|
-
agentId:
|
|
94767
|
+
agentId: command2.agentId,
|
|
94778
94768
|
agentName: selectedSnapshot.agentName,
|
|
94779
94769
|
agentVersion: selectedSnapshot.agentVersion,
|
|
94780
94770
|
directoryId,
|
|
94781
94771
|
kind: AGENT_SETTINGS_DISCOVERED_KIND,
|
|
94782
94772
|
modelEffort,
|
|
94783
|
-
requestId:
|
|
94773
|
+
requestId: command2.requestId,
|
|
94784
94774
|
settings,
|
|
94785
94775
|
settingsRevision: settingsRevision(agent2, baseSnapshot.agentVersion, baseSettings, modelEffort)
|
|
94786
94776
|
},
|
|
@@ -94851,7 +94841,7 @@ function unavailableModelEffort() {
|
|
|
94851
94841
|
valuesByModel: {}
|
|
94852
94842
|
};
|
|
94853
94843
|
}
|
|
94854
|
-
async function discoverModelEffort(
|
|
94844
|
+
async function discoverModelEffort(command2, agent2, harnessAdapter, resolution, initialOptions, selectedOptions, initiallyUnsupportedModels, discoveredModelEffort, cwd, sessions, signal) {
|
|
94855
94845
|
const model = modelOption(initialOptions);
|
|
94856
94846
|
const unsupportedModels = initiallyUnsupportedModels;
|
|
94857
94847
|
if (resolution !== AGENT_MODEL_EFFORT_RESOLUTION_COMPLETE && resolution !== AGENT_MODEL_EFFORT_RESOLUTION_ON_MODEL_SELECTION) {
|
|
@@ -94903,11 +94893,11 @@ async function discoverModelEffort(command, agent2, harnessAdapter, resolution,
|
|
|
94903
94893
|
valuesByModel
|
|
94904
94894
|
};
|
|
94905
94895
|
}
|
|
94906
|
-
if (
|
|
94907
|
-
const modelUnsupported = unsupportedModels.some((diagnostic) => diagnostic.requestedValue ===
|
|
94896
|
+
if (command2.model !== void 0) {
|
|
94897
|
+
const modelUnsupported = unsupportedModels.some((diagnostic) => diagnostic.requestedValue === command2.model);
|
|
94908
94898
|
const selectedEffort2 = effortOption(selectedOptions);
|
|
94909
94899
|
if (!modelUnsupported) {
|
|
94910
|
-
valuesByModel[
|
|
94900
|
+
valuesByModel[command2.model] = selectedEffort2?.type === "select" ? selectedEffort2.values : [];
|
|
94911
94901
|
}
|
|
94912
94902
|
return {
|
|
94913
94903
|
effortSettingId: selectedEffort2?.id ?? "",
|
|
@@ -94966,24 +94956,24 @@ function settingsRevision(agent2, reportedAgentVersion, settings, modelEffort) {
|
|
|
94966
94956
|
function createAgentSettingsDiscoveryHandler(dependencies) {
|
|
94967
94957
|
const { config: config2, directories, sessions, diagnostics, socket, signal, timer } = dependencies;
|
|
94968
94958
|
const agentSettingsDiscoveries = /* @__PURE__ */ new Map();
|
|
94969
|
-
const handle = (
|
|
94970
|
-
const directoryId =
|
|
94959
|
+
const handle = (command2) => {
|
|
94960
|
+
const directoryId = command2.directoryId ?? "default";
|
|
94971
94961
|
const existing = [...agentSettingsDiscoveries.values()].find(
|
|
94972
|
-
(request) => request.agentId ===
|
|
94962
|
+
(request) => request.agentId === command2.agentId && request.directoryId === directoryId && !request.controller.signal.aborted
|
|
94973
94963
|
);
|
|
94974
|
-
if ([...agentSettingsDiscoveries.values()].some((request) => request.requestIds.has(
|
|
94964
|
+
if ([...agentSettingsDiscoveries.values()].some((request) => request.requestIds.has(command2.requestId))) {
|
|
94975
94965
|
if (socket.readyState === WebSocket4.OPEN) {
|
|
94976
94966
|
send(socket, {
|
|
94977
94967
|
code: "agent_settings_discovery_busy",
|
|
94978
94968
|
kind: AGENT_SETTINGS_DISCOVERY_FAILED_KIND,
|
|
94979
94969
|
message: "This settings discovery request is already running",
|
|
94980
|
-
requestId:
|
|
94970
|
+
requestId: command2.requestId
|
|
94981
94971
|
});
|
|
94982
94972
|
}
|
|
94983
94973
|
return;
|
|
94984
94974
|
}
|
|
94985
|
-
if (existing !== void 0 && existing.model ===
|
|
94986
|
-
existing.requestIds.add(
|
|
94975
|
+
if (existing !== void 0 && existing.model === command2.model && existing.requestIds.size < 16) {
|
|
94976
|
+
existing.requestIds.add(command2.requestId);
|
|
94987
94977
|
return;
|
|
94988
94978
|
}
|
|
94989
94979
|
if (existing !== void 0) {
|
|
@@ -94992,7 +94982,7 @@ function createAgentSettingsDiscoveryHandler(dependencies) {
|
|
|
94992
94982
|
code: "agent_settings_discovery_busy",
|
|
94993
94983
|
kind: AGENT_SETTINGS_DISCOVERY_FAILED_KIND,
|
|
94994
94984
|
message: "Another settings discovery is already running for this Agent",
|
|
94995
|
-
requestId:
|
|
94985
|
+
requestId: command2.requestId
|
|
94996
94986
|
});
|
|
94997
94987
|
}
|
|
94998
94988
|
return;
|
|
@@ -95003,13 +94993,13 @@ function createAgentSettingsDiscoveryHandler(dependencies) {
|
|
|
95003
94993
|
code: "agent_settings_discovery_busy",
|
|
95004
94994
|
kind: AGENT_SETTINGS_DISCOVERY_FAILED_KIND,
|
|
95005
94995
|
message: "Too many Agent settings discoveries are running",
|
|
95006
|
-
requestId:
|
|
94996
|
+
requestId: command2.requestId
|
|
95007
94997
|
});
|
|
95008
94998
|
}
|
|
95009
94999
|
return;
|
|
95010
95000
|
}
|
|
95011
95001
|
const controller = new AbortController();
|
|
95012
|
-
const requestIds = /* @__PURE__ */ new Set([
|
|
95002
|
+
const requestIds = /* @__PURE__ */ new Set([command2.requestId]);
|
|
95013
95003
|
const operationSignal = AbortSignal.any([signal, controller.signal]);
|
|
95014
95004
|
const timeout = timer.schedule(
|
|
95015
95005
|
() => controller.abort(
|
|
@@ -95020,7 +95010,7 @@ function createAgentSettingsDiscoveryHandler(dependencies) {
|
|
|
95020
95010
|
const completion = (async () => {
|
|
95021
95011
|
try {
|
|
95022
95012
|
const result = await discoverAgentSettings(
|
|
95023
|
-
|
|
95013
|
+
command2,
|
|
95024
95014
|
dependencies.resolveAgent,
|
|
95025
95015
|
config2.bindingId,
|
|
95026
95016
|
directories,
|
|
@@ -95028,10 +95018,10 @@ function createAgentSettingsDiscoveryHandler(dependencies) {
|
|
|
95028
95018
|
operationSignal
|
|
95029
95019
|
);
|
|
95030
95020
|
for (const diagnostic of result.unsupportedModels) {
|
|
95031
|
-
const details = agentSettingsFailureDetails(
|
|
95032
|
-
diagnostics.daemonDiagnostic("agent_settings_model_unsupported",
|
|
95021
|
+
const details = agentSettingsFailureDetails(command2.agentId, diagnostic);
|
|
95022
|
+
diagnostics.daemonDiagnostic("agent_settings_model_unsupported", command2.requestId, details);
|
|
95033
95023
|
process.stderr.write(
|
|
95034
|
-
`Morty daemon diagnostic ${JSON.stringify({ event: "agent_settings_model_unsupported", requestId:
|
|
95024
|
+
`Morty daemon diagnostic ${JSON.stringify({ event: "agent_settings_model_unsupported", requestId: command2.requestId, ...details })}
|
|
95035
95025
|
`
|
|
95036
95026
|
);
|
|
95037
95027
|
}
|
|
@@ -95042,11 +95032,11 @@ function createAgentSettingsDiscoveryHandler(dependencies) {
|
|
|
95042
95032
|
}
|
|
95043
95033
|
} catch (error62) {
|
|
95044
95034
|
const failure2 = operationSignal.aborted ? controller.signal.reason ?? new SessionError("agent_settings_discovery_cancelled", "Agent settings discovery cancelled") : error62;
|
|
95045
|
-
const details = agentSettingsFailureDetails(
|
|
95046
|
-
diagnostics.daemonDiagnostic("agent_settings_discovery_failed",
|
|
95035
|
+
const details = agentSettingsFailureDetails(command2.agentId, failure2);
|
|
95036
|
+
diagnostics.daemonDiagnostic("agent_settings_discovery_failed", command2.requestId, details, failure2);
|
|
95047
95037
|
if (failure2 instanceof OperationError && failure2.code === "invalid_session_configuration") {
|
|
95048
95038
|
process.stderr.write(
|
|
95049
|
-
`Morty daemon diagnostic ${JSON.stringify({ event: "agent_settings_discovery_failed", requestId:
|
|
95039
|
+
`Morty daemon diagnostic ${JSON.stringify({ event: "agent_settings_discovery_failed", requestId: command2.requestId, ...details })}
|
|
95050
95040
|
`
|
|
95051
95041
|
);
|
|
95052
95042
|
}
|
|
@@ -95062,13 +95052,13 @@ function createAgentSettingsDiscoveryHandler(dependencies) {
|
|
|
95062
95052
|
}
|
|
95063
95053
|
} finally {
|
|
95064
95054
|
timeout.cancel();
|
|
95065
|
-
agentSettingsDiscoveries.delete(
|
|
95055
|
+
agentSettingsDiscoveries.delete(command2.requestId);
|
|
95066
95056
|
}
|
|
95067
95057
|
})();
|
|
95068
|
-
agentSettingsDiscoveries.set(
|
|
95069
|
-
agentId:
|
|
95058
|
+
agentSettingsDiscoveries.set(command2.requestId, {
|
|
95059
|
+
agentId: command2.agentId,
|
|
95070
95060
|
directoryId,
|
|
95071
|
-
model:
|
|
95061
|
+
model: command2.model,
|
|
95072
95062
|
requestIds,
|
|
95073
95063
|
completion,
|
|
95074
95064
|
controller
|
|
@@ -95112,14 +95102,14 @@ import { createHash as createHash11 } from "node:crypto";
|
|
|
95112
95102
|
function createContentWriteCommands(context) {
|
|
95113
95103
|
const pending = /* @__PURE__ */ new Map();
|
|
95114
95104
|
const operations = /* @__PURE__ */ new Set();
|
|
95115
|
-
const fail = (
|
|
95116
|
-
pending.delete(
|
|
95105
|
+
const fail = (command2, error62) => {
|
|
95106
|
+
pending.delete(command2.requestId);
|
|
95117
95107
|
send(context.socket, {
|
|
95118
95108
|
code: "content_write_failed",
|
|
95119
95109
|
kind: FILE_FAILED_KIND,
|
|
95120
95110
|
message: error62 instanceof Error ? error62.message : "The content could not be stored",
|
|
95121
|
-
requestId:
|
|
95122
|
-
sessionId:
|
|
95111
|
+
requestId: command2.requestId,
|
|
95112
|
+
sessionId: command2.sessionId
|
|
95123
95113
|
});
|
|
95124
95114
|
};
|
|
95125
95115
|
const write = {
|
|
@@ -95273,15 +95263,15 @@ async function resolveFile(value, workingDirectory, signal) {
|
|
|
95273
95263
|
}
|
|
95274
95264
|
return null;
|
|
95275
95265
|
}
|
|
95276
|
-
async function streamLocalFile(
|
|
95277
|
-
const external = await externalContent.resolve(
|
|
95278
|
-
const target = external?.path ?? await resolveFile(
|
|
95266
|
+
async function streamLocalFile(command2, send2, sendChunk, signal, workingDirectory, externalContent) {
|
|
95267
|
+
const external = await externalContent.resolve(command2.sessionId, command2.path, signal);
|
|
95268
|
+
const target = external?.path ?? await resolveFile(command2.path, workingDirectory, signal);
|
|
95279
95269
|
if (target === null) {
|
|
95280
95270
|
throw new Error("The local file is unavailable");
|
|
95281
95271
|
}
|
|
95282
95272
|
const before = await readPathMetadata(target);
|
|
95283
95273
|
signal.throwIfAborted();
|
|
95284
|
-
if (before.kind !== "file" || before.size < 1 || before.size >
|
|
95274
|
+
if (before.kind !== "file" || before.size < 1 || before.size > command2.maxBytes) {
|
|
95285
95275
|
throw new Error("The local file is too large to read");
|
|
95286
95276
|
}
|
|
95287
95277
|
const raster = external === null ? await readLocalRaster(target, signal) : null;
|
|
@@ -95291,12 +95281,12 @@ async function streamLocalFile(command, send2, sendChunk, signal, workingDirecto
|
|
|
95291
95281
|
mediaType: external?.mediaType ?? raster?.mimeType ?? (extname3(target).toLowerCase() === ".svg" ? "image/svg+xml" : "application/octet-stream"),
|
|
95292
95282
|
modifiedAt: before.modifiedAt.toISOString(),
|
|
95293
95283
|
name: external?.name ?? (basename8(target) || "file"),
|
|
95294
|
-
requestId:
|
|
95295
|
-
sessionId:
|
|
95284
|
+
requestId: command2.requestId,
|
|
95285
|
+
sessionId: command2.sessionId
|
|
95296
95286
|
});
|
|
95297
95287
|
let sequence = 0;
|
|
95298
95288
|
for await (const bytes of readFileChunks(target, CONTENT_CHUNK_MAX_BYTES, signal)) {
|
|
95299
|
-
sendChunk(
|
|
95289
|
+
sendChunk(command2.requestId, sequence, bytes);
|
|
95300
95290
|
sequence += 1;
|
|
95301
95291
|
}
|
|
95302
95292
|
const after = await readPathMetadata(target);
|
|
@@ -95306,8 +95296,8 @@ async function streamLocalFile(command, send2, sendChunk, signal, workingDirecto
|
|
|
95306
95296
|
}
|
|
95307
95297
|
send2({
|
|
95308
95298
|
kind: FILE_END_KIND,
|
|
95309
|
-
requestId:
|
|
95310
|
-
sessionId:
|
|
95299
|
+
requestId: command2.requestId,
|
|
95300
|
+
sessionId: command2.sessionId
|
|
95311
95301
|
});
|
|
95312
95302
|
}
|
|
95313
95303
|
|
|
@@ -95436,10 +95426,10 @@ async function loadHistoryPage(sessionId, eventLimit, initialCursor, queuedPromp
|
|
|
95436
95426
|
queuedPromptRequests
|
|
95437
95427
|
};
|
|
95438
95428
|
}
|
|
95439
|
-
async function executeSessionHistoryPageLoad(socket,
|
|
95429
|
+
async function executeSessionHistoryPageLoad(socket, command2, config2, resolveAgent, directories, diagnostics, sessions, nativeSessions, eventProjection, signal) {
|
|
95440
95430
|
let agentId;
|
|
95441
95431
|
try {
|
|
95442
|
-
const [entry] = await nativeSessions.querySessions([
|
|
95432
|
+
const [entry] = await nativeSessions.querySessions([command2.sessionId], signal);
|
|
95443
95433
|
if (entry === void 0) {
|
|
95444
95434
|
throw new SessionError("session_not_found", "The Session was not found");
|
|
95445
95435
|
}
|
|
@@ -95453,17 +95443,17 @@ async function executeSessionHistoryPageLoad(socket, command, config2, resolveAg
|
|
|
95453
95443
|
);
|
|
95454
95444
|
const loadOptions = {
|
|
95455
95445
|
additionalDirectories: resolved.additionalDirectories,
|
|
95456
|
-
...await resolveAgent(entry.agentId, signal,
|
|
95446
|
+
...await resolveAgent(entry.agentId, signal, command2.sessionId),
|
|
95457
95447
|
cwd: resolved.cwd,
|
|
95458
|
-
sessionId:
|
|
95448
|
+
sessionId: command2.sessionId,
|
|
95459
95449
|
signal
|
|
95460
95450
|
};
|
|
95461
|
-
const recovery = eventProjection.promptRequestRecovery(
|
|
95462
|
-
const settled = eventProjection.promptOutcomes(
|
|
95451
|
+
const recovery = eventProjection.promptRequestRecovery(command2.sessionId);
|
|
95452
|
+
const settled = eventProjection.promptOutcomes(command2.sessionId);
|
|
95463
95453
|
const events = await loadHistoryPage(
|
|
95464
|
-
|
|
95465
|
-
|
|
95466
|
-
|
|
95454
|
+
command2.sessionId,
|
|
95455
|
+
command2.eventLimit,
|
|
95456
|
+
command2.cursor,
|
|
95467
95457
|
recovery.queuedPromptRequests,
|
|
95468
95458
|
async (eventLimit, cursor) => await sessions.loadSessionEvents(loadOptions, eventLimit, cursor)
|
|
95469
95459
|
);
|
|
@@ -95477,68 +95467,68 @@ async function executeSessionHistoryPageLoad(socket, command, config2, resolveAg
|
|
|
95477
95467
|
}
|
|
95478
95468
|
},
|
|
95479
95469
|
kind: SESSION_HISTORY_PAGE_LOADED_KIND,
|
|
95480
|
-
requestId:
|
|
95481
|
-
sessionId:
|
|
95470
|
+
requestId: command2.requestId,
|
|
95471
|
+
sessionId: command2.sessionId
|
|
95482
95472
|
});
|
|
95483
95473
|
} catch (error62) {
|
|
95484
95474
|
if (!signal.aborted) {
|
|
95485
95475
|
diagnostics.daemonDiagnostic(
|
|
95486
95476
|
"session_history_v2_load_failed",
|
|
95487
|
-
|
|
95477
|
+
command2.requestId,
|
|
95488
95478
|
{
|
|
95489
95479
|
...agentId === void 0 ? {} : { agentId },
|
|
95490
95480
|
code: operationErrorCode(error62),
|
|
95491
|
-
sessionId:
|
|
95481
|
+
sessionId: command2.sessionId
|
|
95492
95482
|
},
|
|
95493
95483
|
error62
|
|
95494
95484
|
);
|
|
95495
|
-
reportOperationFailure(socket,
|
|
95485
|
+
reportOperationFailure(socket, command2.requestId, command2.sessionId, error62);
|
|
95496
95486
|
}
|
|
95497
95487
|
}
|
|
95498
95488
|
}
|
|
95499
|
-
async function executeSessionPreviewHistoryPageLoad(socket,
|
|
95489
|
+
async function executeSessionPreviewHistoryPageLoad(socket, command2, config2, resolveAgent, directories, diagnostics, nativeSessions, signal) {
|
|
95500
95490
|
try {
|
|
95501
95491
|
const resolved = await resolveSessionDirectories(
|
|
95502
95492
|
directories,
|
|
95503
95493
|
config2.bindingId,
|
|
95504
|
-
|
|
95505
|
-
|
|
95494
|
+
command2.directoryId,
|
|
95495
|
+
command2.additionalDirectoryIds,
|
|
95506
95496
|
signal
|
|
95507
95497
|
);
|
|
95508
95498
|
const loadOptions = {
|
|
95509
95499
|
additionalDirectories: resolved.additionalDirectories,
|
|
95510
|
-
...await resolveAgent(
|
|
95500
|
+
...await resolveAgent(command2.agentId, signal, command2.sessionId),
|
|
95511
95501
|
cwd: resolved.cwd,
|
|
95512
|
-
sessionId:
|
|
95502
|
+
sessionId: command2.sessionId,
|
|
95513
95503
|
signal
|
|
95514
95504
|
};
|
|
95515
95505
|
const events = await loadHistoryPage(
|
|
95516
|
-
|
|
95517
|
-
|
|
95518
|
-
|
|
95506
|
+
command2.sessionId,
|
|
95507
|
+
command2.eventLimit,
|
|
95508
|
+
command2.cursor,
|
|
95519
95509
|
[],
|
|
95520
|
-
async (eventLimit, cursor) => await nativeSessions.readSessionHistory(loadOptions,
|
|
95510
|
+
async (eventLimit, cursor) => await nativeSessions.readSessionHistory(loadOptions, command2.sessionId, eventLimit, cursor)
|
|
95521
95511
|
);
|
|
95522
95512
|
signal.throwIfAborted();
|
|
95523
95513
|
send(socket, {
|
|
95524
95514
|
events,
|
|
95525
95515
|
kind: SESSION_PREVIEW_HISTORY_PAGE_LOADED_KIND,
|
|
95526
|
-
requestId:
|
|
95527
|
-
sessionId:
|
|
95516
|
+
requestId: command2.requestId,
|
|
95517
|
+
sessionId: command2.sessionId
|
|
95528
95518
|
});
|
|
95529
95519
|
} catch (error62) {
|
|
95530
95520
|
if (!signal.aborted) {
|
|
95531
95521
|
diagnostics.daemonDiagnostic(
|
|
95532
95522
|
"session_history_v2_load_failed",
|
|
95533
|
-
|
|
95523
|
+
command2.requestId,
|
|
95534
95524
|
{
|
|
95535
|
-
agentId:
|
|
95525
|
+
agentId: command2.agentId,
|
|
95536
95526
|
code: operationErrorCode(error62),
|
|
95537
|
-
sessionId:
|
|
95527
|
+
sessionId: command2.sessionId
|
|
95538
95528
|
},
|
|
95539
95529
|
error62
|
|
95540
95530
|
);
|
|
95541
|
-
reportOperationFailure(socket,
|
|
95531
|
+
reportOperationFailure(socket, command2.requestId, command2.sessionId, error62);
|
|
95542
95532
|
}
|
|
95543
95533
|
}
|
|
95544
95534
|
}
|
|
@@ -95706,21 +95696,21 @@ import { WebSocket as WebSocket6 } from "undici";
|
|
|
95706
95696
|
function createNativeSessionRequestHandler(dependencies) {
|
|
95707
95697
|
const { diagnostics, nativeSessions, signal, socket, timer } = dependencies;
|
|
95708
95698
|
const pending = /* @__PURE__ */ new Map();
|
|
95709
|
-
const cancel = (
|
|
95710
|
-
const request = pending.get(
|
|
95711
|
-
if (request?.sessionId ===
|
|
95699
|
+
const cancel = (command2) => {
|
|
95700
|
+
const request = pending.get(command2.requestId);
|
|
95701
|
+
if (request?.sessionId === command2.sessionId) {
|
|
95712
95702
|
request.controller.abort(
|
|
95713
95703
|
new SessionError("native_session_cancelled", "Native session operation cancelled")
|
|
95714
95704
|
);
|
|
95715
95705
|
}
|
|
95716
95706
|
};
|
|
95717
|
-
const handle = (
|
|
95718
|
-
const previous = [...pending.values()].filter((request) => request.agentId ===
|
|
95719
|
-
if (pending.has(
|
|
95707
|
+
const handle = (command2) => {
|
|
95708
|
+
const previous = [...pending.values()].filter((request) => request.agentId === command2.agentId);
|
|
95709
|
+
if (pending.has(command2.requestId) || pending.size >= 4) {
|
|
95720
95710
|
reportOperationFailure(
|
|
95721
95711
|
socket,
|
|
95722
|
-
|
|
95723
|
-
|
|
95712
|
+
command2.requestId,
|
|
95713
|
+
command2.sessionId,
|
|
95724
95714
|
new SessionError("native_session_busy", "Another native session operation is running")
|
|
95725
95715
|
);
|
|
95726
95716
|
return;
|
|
@@ -95734,7 +95724,7 @@ function createNativeSessionRequestHandler(dependencies) {
|
|
|
95734
95724
|
const completion = (async () => {
|
|
95735
95725
|
try {
|
|
95736
95726
|
operationSignal.throwIfAborted();
|
|
95737
|
-
const skipPrevious =
|
|
95727
|
+
const skipPrevious = command2.action === "active-turn";
|
|
95738
95728
|
if (previous.length > 0 && !skipPrevious) {
|
|
95739
95729
|
await new Promise((resolve19, reject2) => {
|
|
95740
95730
|
const onAbort = () => reject2(operationSignal.reason);
|
|
@@ -95752,7 +95742,7 @@ function createNativeSessionRequestHandler(dependencies) {
|
|
|
95752
95742
|
});
|
|
95753
95743
|
}
|
|
95754
95744
|
operationSignal.throwIfAborted();
|
|
95755
|
-
const result = await nativeSessions.execute(
|
|
95745
|
+
const result = await nativeSessions.execute(command2, operationSignal);
|
|
95756
95746
|
if (socket.readyState === WebSocket6.OPEN) {
|
|
95757
95747
|
send(socket, result);
|
|
95758
95748
|
}
|
|
@@ -95761,24 +95751,24 @@ function createNativeSessionRequestHandler(dependencies) {
|
|
|
95761
95751
|
const event = "native_session_operation_failed";
|
|
95762
95752
|
diagnostics.daemonDiagnostic(
|
|
95763
95753
|
event,
|
|
95764
|
-
|
|
95754
|
+
command2.requestId,
|
|
95765
95755
|
{
|
|
95766
|
-
action:
|
|
95767
|
-
agentId:
|
|
95756
|
+
action: command2.action,
|
|
95757
|
+
agentId: command2.agentId,
|
|
95768
95758
|
code: operationErrorCode(failure2),
|
|
95769
|
-
sessionId:
|
|
95759
|
+
sessionId: command2.sessionId
|
|
95770
95760
|
},
|
|
95771
95761
|
failure2
|
|
95772
95762
|
);
|
|
95773
|
-
reportOperationFailure(socket,
|
|
95763
|
+
reportOperationFailure(socket, command2.requestId, command2.sessionId, failure2);
|
|
95774
95764
|
} finally {
|
|
95775
95765
|
timeout.cancel();
|
|
95776
|
-
pending.delete(
|
|
95766
|
+
pending.delete(command2.requestId);
|
|
95777
95767
|
}
|
|
95778
95768
|
})();
|
|
95779
|
-
pending.set(
|
|
95780
|
-
agentId:
|
|
95781
|
-
sessionId:
|
|
95769
|
+
pending.set(command2.requestId, {
|
|
95770
|
+
agentId: command2.agentId,
|
|
95771
|
+
sessionId: command2.sessionId,
|
|
95782
95772
|
controller,
|
|
95783
95773
|
completion
|
|
95784
95774
|
});
|
|
@@ -96013,7 +96003,7 @@ function warnIgnoredSetting(event, commandId, sessionId, agentId, selection, cat
|
|
|
96013
96003
|
// src/engine/session/prompt/execute-prompt.ts
|
|
96014
96004
|
async function executePrompt({
|
|
96015
96005
|
eventProjection,
|
|
96016
|
-
command,
|
|
96006
|
+
command: command2,
|
|
96017
96007
|
resolveAgent,
|
|
96018
96008
|
readArtifact,
|
|
96019
96009
|
reportFailure,
|
|
@@ -96021,53 +96011,43 @@ async function executePrompt({
|
|
|
96021
96011
|
sessions,
|
|
96022
96012
|
attemptId,
|
|
96023
96013
|
epoch,
|
|
96024
|
-
|
|
96014
|
+
waitForSessionAdmission,
|
|
96025
96015
|
signal,
|
|
96026
96016
|
cancellationRequested
|
|
96027
96017
|
}) {
|
|
96028
96018
|
try {
|
|
96029
96019
|
const resolved = await resolveSessionDirectories(
|
|
96030
96020
|
directories,
|
|
96031
|
-
|
|
96032
|
-
|
|
96033
|
-
|
|
96021
|
+
command2.bindingId,
|
|
96022
|
+
command2.directoryId,
|
|
96023
|
+
command2.additionalDirectoryIds,
|
|
96034
96024
|
signal
|
|
96035
96025
|
);
|
|
96036
96026
|
const { agent: agent2, adapter, externalizeSessionUpdate } = await resolveAgent(
|
|
96037
|
-
|
|
96027
|
+
command2.agentId,
|
|
96038
96028
|
signal,
|
|
96039
|
-
|
|
96029
|
+
command2.sessionId
|
|
96040
96030
|
);
|
|
96041
|
-
const
|
|
96042
|
-
if (
|
|
96043
|
-
throw new AcpExecutionError("
|
|
96044
|
-
}
|
|
96045
|
-
if (availability.kind === "queue-target-unavailable") {
|
|
96046
|
-
throw new AcpExecutionError(
|
|
96047
|
-
"The queued prompt target is unavailable",
|
|
96048
|
-
{},
|
|
96049
|
-
"prompt_queue_target_unavailable"
|
|
96050
|
-
);
|
|
96051
|
-
}
|
|
96052
|
-
if (availability.disposition === SessionPromptDisposition.Steer && !sessions.acceptsSteering(command.sessionId, command.targetCommandId)) {
|
|
96053
|
-
throw new AcpExecutionError("The steering target is unavailable", {}, "prompt_queue_target_unavailable");
|
|
96031
|
+
const dispatch = await waitForSessionAdmission(signal);
|
|
96032
|
+
if (dispatch.kind === "steer" && !sessions.acceptsSteering(command2.sessionId, dispatch.targetCommandId)) {
|
|
96033
|
+
throw new AcpExecutionError("The steering target is unavailable", {}, "steering_target_unavailable");
|
|
96054
96034
|
}
|
|
96055
|
-
const appliedSettings =
|
|
96035
|
+
const appliedSettings = command2.sessionConfigurations === void 0 ? void 0 : agentForSessionConfiguration(agent2, command2.sessionConfigurations);
|
|
96056
96036
|
const executionAgent = appliedSettings?.agent ?? agent2;
|
|
96057
96037
|
const sessionConfigurations = appliedSettings?.sessionConfigurations;
|
|
96058
|
-
const recovery =
|
|
96038
|
+
const recovery = command2.historyPolicy === SessionHistoryPolicy.ExecutionOnly ? { kind: "execution-only" } : { kind: "interactive-only" };
|
|
96059
96039
|
const preparation = {
|
|
96060
96040
|
adapter,
|
|
96061
96041
|
...externalizeSessionUpdate === void 0 ? {} : { externalizeSessionUpdate },
|
|
96062
96042
|
additionalDirectories: resolved.additionalDirectories,
|
|
96063
96043
|
agent: executionAgent,
|
|
96064
96044
|
cwd: resolved.cwd,
|
|
96065
|
-
sessionId:
|
|
96045
|
+
sessionId: command2.sessionId,
|
|
96066
96046
|
signal,
|
|
96067
96047
|
recovery
|
|
96068
96048
|
};
|
|
96069
96049
|
let prepared = await sessions.prepareExecutionSession(preparation);
|
|
96070
|
-
if (
|
|
96050
|
+
if (command2.sessionConfigurations !== void 0 && dispatch.kind !== "steer") {
|
|
96071
96051
|
await applyCompleteSessionConfiguration(
|
|
96072
96052
|
sessions,
|
|
96073
96053
|
prepared.configOptions,
|
|
@@ -96076,44 +96056,38 @@ async function executePrompt({
|
|
|
96076
96056
|
adapter,
|
|
96077
96057
|
resolved.cwd,
|
|
96078
96058
|
resolved.additionalDirectories,
|
|
96079
|
-
|
|
96080
|
-
|
|
96059
|
+
command2.commandId,
|
|
96060
|
+
command2.sessionId,
|
|
96081
96061
|
signal
|
|
96082
96062
|
);
|
|
96083
96063
|
prepared = await sessions.prepareExecutionSession(preparation);
|
|
96084
96064
|
}
|
|
96085
96065
|
signal.throwIfAborted();
|
|
96086
|
-
const lifecycle = eventProjection.lifecycle(
|
|
96087
|
-
|
|
96088
|
-
|
|
96089
|
-
attemptId,
|
|
96090
|
-
epoch,
|
|
96091
|
-
availability.disposition
|
|
96092
|
-
);
|
|
96093
|
-
const attachments = await resolvePromptArtifacts(readArtifact, command.attachments, signal);
|
|
96094
|
-
const skipped = command.attachments.length - attachments.images.length - attachments.resources.length;
|
|
96066
|
+
const lifecycle = eventProjection.lifecycle(command2.sessionId, command2.commandId, attemptId, epoch, dispatch);
|
|
96067
|
+
const attachments = await resolvePromptArtifacts(readArtifact, command2.attachments, signal);
|
|
96068
|
+
const skipped = command2.attachments.length - attachments.images.length - attachments.resources.length;
|
|
96095
96069
|
if (skipped > 0) {
|
|
96096
|
-
reportFailure("prompt_attachments_skipped",
|
|
96070
|
+
reportFailure("prompt_attachments_skipped", command2.commandId, { count: skipped.toString() });
|
|
96097
96071
|
}
|
|
96098
|
-
if (
|
|
96072
|
+
if (command2.prompt.trim().length === 0 && attachments.images.length === 0 && attachments.resources.length === 0) {
|
|
96099
96073
|
throw new PromptArtifactError("prompt_attachments_unsupported", "No supported prompt content remains");
|
|
96100
96074
|
}
|
|
96101
96075
|
let stopReason;
|
|
96102
|
-
if (
|
|
96076
|
+
if (dispatch.kind === "steer") {
|
|
96103
96077
|
await sessions.steerPrompt({
|
|
96104
96078
|
adapter,
|
|
96105
96079
|
...externalizeSessionUpdate === void 0 ? {} : { externalizeSessionUpdate },
|
|
96106
96080
|
additionalDirectories: resolved.additionalDirectories,
|
|
96107
96081
|
agent: executionAgent,
|
|
96108
|
-
commandId:
|
|
96082
|
+
commandId: command2.commandId,
|
|
96109
96083
|
cwd: resolved.cwd,
|
|
96110
96084
|
images: attachments.images,
|
|
96111
96085
|
lifecycle,
|
|
96112
|
-
prompt:
|
|
96086
|
+
prompt: command2.prompt,
|
|
96113
96087
|
resources: attachments.resources,
|
|
96114
|
-
sessionId:
|
|
96088
|
+
sessionId: command2.sessionId,
|
|
96115
96089
|
signal,
|
|
96116
|
-
targetCommandId:
|
|
96090
|
+
targetCommandId: dispatch.targetCommandId
|
|
96117
96091
|
});
|
|
96118
96092
|
stopReason = "steered";
|
|
96119
96093
|
} else {
|
|
@@ -96123,35 +96097,33 @@ async function executePrompt({
|
|
|
96123
96097
|
...externalizeSessionUpdate === void 0 ? {} : { externalizeSessionUpdate },
|
|
96124
96098
|
additionalDirectories: resolved.additionalDirectories,
|
|
96125
96099
|
agent: executionAgent,
|
|
96126
|
-
commandId:
|
|
96100
|
+
commandId: command2.commandId,
|
|
96127
96101
|
cwd: resolved.cwd,
|
|
96128
|
-
disposition: availability.disposition,
|
|
96129
96102
|
images: attachments.images,
|
|
96130
96103
|
lifecycle,
|
|
96131
|
-
prompt:
|
|
96104
|
+
prompt: command2.prompt,
|
|
96132
96105
|
resources: attachments.resources,
|
|
96133
|
-
sessionId:
|
|
96106
|
+
sessionId: command2.sessionId,
|
|
96134
96107
|
signal,
|
|
96135
|
-
targetCommandId: command.targetCommandId,
|
|
96136
96108
|
recovery
|
|
96137
96109
|
});
|
|
96138
96110
|
stopReason = result.stopReason;
|
|
96139
96111
|
}
|
|
96140
|
-
await eventProjection.completed(
|
|
96112
|
+
await eventProjection.completed(command2.sessionId, command2.commandId, stopReason);
|
|
96141
96113
|
} catch (error62) {
|
|
96142
96114
|
if (signal.aborted && cancellationRequested()) {
|
|
96143
|
-
await eventProjection.completed(
|
|
96115
|
+
await eventProjection.completed(command2.sessionId, command2.commandId, "cancelled");
|
|
96144
96116
|
return;
|
|
96145
96117
|
}
|
|
96146
96118
|
const code = operationErrorCode(error62);
|
|
96147
96119
|
const failureCode = code === "session_operation_failed" ? "agent_execution_failed" : code;
|
|
96148
96120
|
const failureMessage = code === "session_operation_failed" ? "The local agent could not complete the request" : operationErrorMessage(error62);
|
|
96149
|
-
await eventProjection.failed(
|
|
96150
|
-
reportFailure("session_prompt_failed",
|
|
96151
|
-
agentId:
|
|
96121
|
+
await eventProjection.failed(command2.sessionId, command2.commandId, attemptId, failureCode, failureMessage);
|
|
96122
|
+
reportFailure("session_prompt_failed", command2.commandId, {
|
|
96123
|
+
agentId: command2.agentId,
|
|
96152
96124
|
code: failureCode,
|
|
96153
|
-
commandId:
|
|
96154
|
-
sessionId:
|
|
96125
|
+
commandId: command2.commandId,
|
|
96126
|
+
sessionId: command2.sessionId
|
|
96155
96127
|
});
|
|
96156
96128
|
console.error("Morty daemon command failed", error62);
|
|
96157
96129
|
}
|
|
@@ -96177,8 +96149,19 @@ var sessionPromptCommand = {
|
|
|
96177
96149
|
const receipt = context.operations.claimExecution(
|
|
96178
96150
|
message.commandId,
|
|
96179
96151
|
message.sessionId,
|
|
96180
|
-
encodeSessionPromptCommand(message)
|
|
96152
|
+
encodeSessionPromptCommand(message),
|
|
96153
|
+
() => message.disposition === SessionPromptDisposition.Append || context.sessions.acceptsSteering(message.sessionId, message.targetCommandId)
|
|
96181
96154
|
);
|
|
96155
|
+
if (receipt.kind === "refused") {
|
|
96156
|
+
send(context.socket, {
|
|
96157
|
+
code: "steering_target_unavailable",
|
|
96158
|
+
requestId: message.commandId,
|
|
96159
|
+
kind: "session.operation.failed",
|
|
96160
|
+
message: "The turn to steer is not running.",
|
|
96161
|
+
sessionId: message.sessionId
|
|
96162
|
+
});
|
|
96163
|
+
return;
|
|
96164
|
+
}
|
|
96182
96165
|
if (receipt.kind === "conflict") {
|
|
96183
96166
|
send(context.socket, {
|
|
96184
96167
|
code: "command_identity_conflict",
|
|
@@ -96239,7 +96222,7 @@ var sessionPromptCommand = {
|
|
|
96239
96222
|
sessions: context.sessions,
|
|
96240
96223
|
attemptId: receipt.attemptId,
|
|
96241
96224
|
epoch: turn.epoch,
|
|
96242
|
-
|
|
96225
|
+
waitForSessionAdmission: (signal) => context.sessionTurns.admitAndWait(turn, signal, () => {
|
|
96243
96226
|
queueChanged();
|
|
96244
96227
|
}),
|
|
96245
96228
|
signal: turn.signal,
|
|
@@ -96361,83 +96344,83 @@ var runtimePingCommand = {
|
|
|
96361
96344
|
};
|
|
96362
96345
|
|
|
96363
96346
|
// src/engine/runtime/command/registry/session.ts
|
|
96364
|
-
async function prepareSession(
|
|
96347
|
+
async function prepareSession(command2, recovery, closed, config2, resolveAgent, directories, sessions, metrics, signal) {
|
|
96365
96348
|
return await metrics.measure("prepare-total", async () => {
|
|
96366
96349
|
const resolved = await metrics.measure(
|
|
96367
96350
|
"workspace-resolve",
|
|
96368
96351
|
async () => await resolveSessionDirectories(
|
|
96369
96352
|
directories,
|
|
96370
96353
|
config2.bindingId,
|
|
96371
|
-
|
|
96372
|
-
|
|
96354
|
+
command2.directoryId,
|
|
96355
|
+
command2.additionalDirectoryIds,
|
|
96373
96356
|
signal
|
|
96374
96357
|
)
|
|
96375
96358
|
);
|
|
96376
|
-
const resolvedAgent = await resolveAgent(
|
|
96359
|
+
const resolvedAgent = await resolveAgent(command2.agentId, signal, command2.sessionId);
|
|
96377
96360
|
const preparation = {
|
|
96378
96361
|
additionalDirectories: resolved.additionalDirectories,
|
|
96379
96362
|
...resolvedAgent,
|
|
96380
96363
|
cwd: resolved.cwd,
|
|
96381
|
-
sessionId:
|
|
96364
|
+
sessionId: command2.sessionId,
|
|
96382
96365
|
signal
|
|
96383
96366
|
};
|
|
96384
|
-
const prepared =
|
|
96385
|
-
const configuration =
|
|
96367
|
+
const prepared = command2.transient === true ? await sessions.inspectSession(preparation, metrics) : recovery.kind === "history-required" ? await sessions.restoreSession(preparation, metrics, closed) : await sessions.prepareSession(preparation, metrics, closed);
|
|
96368
|
+
const configuration = command2.configuration;
|
|
96386
96369
|
const snapshot = configuration === void 0 ? prepared : await metrics.measure(
|
|
96387
96370
|
"configuration",
|
|
96388
96371
|
async () => await sessions.applySessionConfiguration({
|
|
96389
96372
|
...preparation,
|
|
96390
96373
|
booleanValue: configuration.booleanValue,
|
|
96391
96374
|
configId: configuration.configId,
|
|
96392
|
-
requestId:
|
|
96375
|
+
requestId: command2.requestId,
|
|
96393
96376
|
value: configuration.value,
|
|
96394
96377
|
valueType: configuration.valueType
|
|
96395
96378
|
})
|
|
96396
96379
|
);
|
|
96397
96380
|
return {
|
|
96398
96381
|
additionalDirectories: resolved.additionalDirectoryEntries,
|
|
96399
|
-
agentId:
|
|
96382
|
+
agentId: command2.agentId,
|
|
96400
96383
|
agentName: prepared.agentName,
|
|
96401
96384
|
agentVersion: prepared.agentVersion,
|
|
96402
96385
|
capabilities: prepared.capabilities,
|
|
96403
96386
|
commands: prepared.commands,
|
|
96404
96387
|
configOptions: snapshot.configOptions,
|
|
96405
96388
|
configurationRevision: snapshot.configurationRevision,
|
|
96406
|
-
directoryId:
|
|
96389
|
+
directoryId: command2.directoryId,
|
|
96407
96390
|
directoryLabel: resolved.directoryLabel,
|
|
96408
96391
|
kind: "session.ready",
|
|
96409
|
-
requestId:
|
|
96392
|
+
requestId: command2.requestId,
|
|
96410
96393
|
restored: prepared.restored,
|
|
96411
|
-
sessionId:
|
|
96394
|
+
sessionId: command2.sessionId
|
|
96412
96395
|
};
|
|
96413
96396
|
});
|
|
96414
96397
|
}
|
|
96415
|
-
async function executeWorkspaceList(socket,
|
|
96398
|
+
async function executeWorkspaceList(socket, command2, directories, signal) {
|
|
96416
96399
|
try {
|
|
96417
|
-
const listing =
|
|
96418
|
-
directoryId:
|
|
96400
|
+
const listing = command2.view === "metadata" ? await directories.describe(command2.bindingId, command2.directoryId, signal).then((directory) => ({
|
|
96401
|
+
directoryId: command2.directoryId,
|
|
96419
96402
|
directoryLabel: directory.label,
|
|
96420
96403
|
entries: [],
|
|
96421
96404
|
parentDirectoryId: directory.parentDirectoryId
|
|
96422
|
-
})) : await directories.list(
|
|
96405
|
+
})) : await directories.list(command2.bindingId, command2.directoryId, signal);
|
|
96423
96406
|
send(socket, {
|
|
96424
|
-
bindingId:
|
|
96407
|
+
bindingId: command2.bindingId,
|
|
96425
96408
|
directoryId: listing.directoryId,
|
|
96426
96409
|
directoryLabel: listing.directoryLabel,
|
|
96427
96410
|
entries: listing.entries,
|
|
96428
96411
|
kind: "workspace.entries",
|
|
96429
96412
|
parentDirectoryId: listing.parentDirectoryId,
|
|
96430
|
-
requestId:
|
|
96413
|
+
requestId: command2.requestId
|
|
96431
96414
|
});
|
|
96432
96415
|
} catch (error62) {
|
|
96433
|
-
reportOperationFailure(socket,
|
|
96416
|
+
reportOperationFailure(socket, command2.requestId, "", error62);
|
|
96434
96417
|
}
|
|
96435
96418
|
}
|
|
96436
|
-
async function executeSessionPrepare(socket,
|
|
96419
|
+
async function executeSessionPrepare(socket, command2, config2, resolveAgent, directories, sessions, diagnostics, signal) {
|
|
96437
96420
|
const metrics = new AccumulatingOperationMetrics();
|
|
96438
96421
|
try {
|
|
96439
96422
|
const readyEvent = await prepareSession(
|
|
96440
|
-
|
|
96423
|
+
command2,
|
|
96441
96424
|
{ kind: "interactive-only" },
|
|
96442
96425
|
"reopen",
|
|
96443
96426
|
config2,
|
|
@@ -96454,22 +96437,22 @@ async function executeSessionPrepare(socket, command, config2, resolveAgent, dir
|
|
|
96454
96437
|
} catch (error62) {
|
|
96455
96438
|
diagnostics.daemonDiagnostic(
|
|
96456
96439
|
"session_prepare_failed",
|
|
96457
|
-
|
|
96440
|
+
command2.requestId,
|
|
96458
96441
|
{
|
|
96459
|
-
agentId:
|
|
96442
|
+
agentId: command2.agentId,
|
|
96460
96443
|
code: operationErrorCode(error62),
|
|
96461
|
-
sessionId:
|
|
96444
|
+
sessionId: command2.sessionId
|
|
96462
96445
|
},
|
|
96463
96446
|
error62
|
|
96464
96447
|
);
|
|
96465
|
-
reportOperationFailure(socket,
|
|
96448
|
+
reportOperationFailure(socket, command2.requestId, command2.sessionId, error62, metrics.snapshot());
|
|
96466
96449
|
}
|
|
96467
96450
|
}
|
|
96468
|
-
async function executeSessionRestore(socket,
|
|
96451
|
+
async function executeSessionRestore(socket, command2, config2, resolveAgent, directories, sessions, nativeSessions, diagnostics, signal) {
|
|
96469
96452
|
const metrics = new AccumulatingOperationMetrics();
|
|
96470
96453
|
try {
|
|
96471
96454
|
const entry = await metrics.measure("session-lookup", async () => {
|
|
96472
|
-
const [found] = await nativeSessions.querySessions([
|
|
96455
|
+
const [found] = await nativeSessions.querySessions([command2.sessionId], signal);
|
|
96473
96456
|
if (found === void 0) {
|
|
96474
96457
|
throw new SessionError("session_not_found", "The Session was not found");
|
|
96475
96458
|
}
|
|
@@ -96482,8 +96465,8 @@ async function executeSessionRestore(socket, command, config2, resolveAgent, dir
|
|
|
96482
96465
|
bindingId: config2.bindingId,
|
|
96483
96466
|
directoryId: entry.directoryId,
|
|
96484
96467
|
kind: "session.prepare",
|
|
96485
|
-
requestId:
|
|
96486
|
-
sessionId:
|
|
96468
|
+
requestId: command2.requestId,
|
|
96469
|
+
sessionId: command2.sessionId,
|
|
96487
96470
|
sessionState: "provisioned"
|
|
96488
96471
|
},
|
|
96489
96472
|
{ kind: "history-required" },
|
|
@@ -96499,24 +96482,24 @@ async function executeSessionRestore(socket, command, config2, resolveAgent, dir
|
|
|
96499
96482
|
entry,
|
|
96500
96483
|
kind: "session.restored",
|
|
96501
96484
|
ready: { ...ready, runtimeTimings: metrics.snapshot() },
|
|
96502
|
-
requestId:
|
|
96485
|
+
requestId: command2.requestId
|
|
96503
96486
|
});
|
|
96504
96487
|
} catch (error62) {
|
|
96505
96488
|
diagnostics.daemonDiagnostic(
|
|
96506
96489
|
"session_restore_failed",
|
|
96507
|
-
|
|
96490
|
+
command2.requestId,
|
|
96508
96491
|
{
|
|
96509
96492
|
code: operationErrorCode(error62),
|
|
96510
|
-
sessionId:
|
|
96493
|
+
sessionId: command2.sessionId
|
|
96511
96494
|
},
|
|
96512
96495
|
error62
|
|
96513
96496
|
);
|
|
96514
|
-
reportOperationFailure(socket,
|
|
96497
|
+
reportOperationFailure(socket, command2.requestId, command2.sessionId, error62, metrics.snapshot());
|
|
96515
96498
|
}
|
|
96516
96499
|
}
|
|
96517
|
-
async function executeSessionRename(socket,
|
|
96500
|
+
async function executeSessionRename(socket, command2, config2, resolveAgent, directories, sessions, nativeSessions, signal) {
|
|
96518
96501
|
try {
|
|
96519
|
-
const [entry] = await nativeSessions.querySessions([
|
|
96502
|
+
const [entry] = await nativeSessions.querySessions([command2.sessionId], signal);
|
|
96520
96503
|
if (entry === void 0) {
|
|
96521
96504
|
throw new SessionError("session_not_found", "The Session was not found");
|
|
96522
96505
|
}
|
|
@@ -96530,17 +96513,17 @@ async function executeSessionRename(socket, command, config2, resolveAgent, dire
|
|
|
96530
96513
|
const renamed = await sessions.renameSession(
|
|
96531
96514
|
{
|
|
96532
96515
|
additionalDirectories: resolved.additionalDirectories,
|
|
96533
|
-
...await resolveAgent(entry.agentId, signal,
|
|
96516
|
+
...await resolveAgent(entry.agentId, signal, command2.sessionId),
|
|
96534
96517
|
cwd: resolved.cwd,
|
|
96535
|
-
sessionId:
|
|
96518
|
+
sessionId: command2.sessionId,
|
|
96536
96519
|
signal
|
|
96537
96520
|
},
|
|
96538
|
-
|
|
96521
|
+
command2.title
|
|
96539
96522
|
);
|
|
96540
96523
|
send(socket, {
|
|
96541
96524
|
kind: "session.renamed",
|
|
96542
|
-
requestId:
|
|
96543
|
-
sessionId:
|
|
96525
|
+
requestId: command2.requestId,
|
|
96526
|
+
sessionId: command2.sessionId,
|
|
96544
96527
|
title: renamed.title,
|
|
96545
96528
|
updatedAt: renamed.updatedAt
|
|
96546
96529
|
});
|
|
@@ -96548,42 +96531,42 @@ async function executeSessionRename(socket, command, config2, resolveAgent, dire
|
|
|
96548
96531
|
if (signal.aborted) {
|
|
96549
96532
|
signal.throwIfAborted();
|
|
96550
96533
|
}
|
|
96551
|
-
reportOperationFailure(socket,
|
|
96534
|
+
reportOperationFailure(socket, command2.requestId, command2.sessionId, error62);
|
|
96552
96535
|
}
|
|
96553
96536
|
}
|
|
96554
|
-
async function executeSessionConfigure(socket,
|
|
96537
|
+
async function executeSessionConfigure(socket, command2, config2, resolveAgent, directories, sessions, signal) {
|
|
96555
96538
|
try {
|
|
96556
96539
|
const resolved = await resolveSessionDirectories(
|
|
96557
96540
|
directories,
|
|
96558
96541
|
config2.bindingId,
|
|
96559
|
-
|
|
96560
|
-
|
|
96542
|
+
command2.directoryId,
|
|
96543
|
+
command2.additionalDirectoryIds,
|
|
96561
96544
|
signal
|
|
96562
96545
|
);
|
|
96563
96546
|
const snapshot = await sessions.configureSession({
|
|
96564
96547
|
additionalDirectories: resolved.additionalDirectories,
|
|
96565
|
-
...await resolveAgent(
|
|
96566
|
-
booleanValue:
|
|
96567
|
-
configId:
|
|
96568
|
-
expectedConfigurationRevision:
|
|
96548
|
+
...await resolveAgent(command2.agentId, signal, command2.sessionId),
|
|
96549
|
+
booleanValue: command2.booleanValue,
|
|
96550
|
+
configId: command2.configId,
|
|
96551
|
+
expectedConfigurationRevision: command2.expectedConfigurationRevision,
|
|
96569
96552
|
cwd: resolved.cwd,
|
|
96570
|
-
requestId:
|
|
96571
|
-
sessionId:
|
|
96553
|
+
requestId: command2.requestId,
|
|
96554
|
+
sessionId: command2.sessionId,
|
|
96572
96555
|
signal,
|
|
96573
|
-
value:
|
|
96574
|
-
valueType:
|
|
96556
|
+
value: command2.value,
|
|
96557
|
+
valueType: command2.valueType
|
|
96575
96558
|
});
|
|
96576
96559
|
send(socket, {
|
|
96577
96560
|
...snapshot,
|
|
96578
96561
|
kind: "session.config.updated",
|
|
96579
|
-
requestId:
|
|
96580
|
-
sessionId:
|
|
96562
|
+
requestId: command2.requestId,
|
|
96563
|
+
sessionId: command2.sessionId
|
|
96581
96564
|
});
|
|
96582
96565
|
} catch (error62) {
|
|
96583
96566
|
if (signal.aborted) {
|
|
96584
96567
|
signal.throwIfAborted();
|
|
96585
96568
|
}
|
|
96586
|
-
reportOperationFailure(socket,
|
|
96569
|
+
reportOperationFailure(socket, command2.requestId, command2.sessionId, error62);
|
|
96587
96570
|
}
|
|
96588
96571
|
}
|
|
96589
96572
|
var workspaceListCommand = {
|
|
@@ -96667,11 +96650,11 @@ var sessionRenameCommand = {
|
|
|
96667
96650
|
);
|
|
96668
96651
|
}
|
|
96669
96652
|
};
|
|
96670
|
-
async function executeSessionConfigRead(socket,
|
|
96653
|
+
async function executeSessionConfigRead(socket, command2, config2, resolveAgent, directories, sessions, nativeSessions, diagnostics, signal) {
|
|
96671
96654
|
const metrics = new AccumulatingOperationMetrics();
|
|
96672
96655
|
try {
|
|
96673
96656
|
const entry = await metrics.measure("session-lookup", async () => {
|
|
96674
|
-
const [found] = await nativeSessions.querySessions([
|
|
96657
|
+
const [found] = await nativeSessions.querySessions([command2.sessionId], signal);
|
|
96675
96658
|
if (found === void 0) {
|
|
96676
96659
|
throw new SessionError("session_not_found", "The Session was not found");
|
|
96677
96660
|
}
|
|
@@ -96684,8 +96667,8 @@ async function executeSessionConfigRead(socket, command, config2, resolveAgent,
|
|
|
96684
96667
|
bindingId: config2.bindingId,
|
|
96685
96668
|
directoryId: entry.directoryId,
|
|
96686
96669
|
kind: "session.prepare",
|
|
96687
|
-
requestId:
|
|
96688
|
-
sessionId:
|
|
96670
|
+
requestId: command2.requestId,
|
|
96671
|
+
sessionId: command2.sessionId,
|
|
96689
96672
|
sessionState: "provisioned"
|
|
96690
96673
|
},
|
|
96691
96674
|
// A settings read must not force history loading: Agents without
|
|
@@ -96705,20 +96688,20 @@ async function executeSessionConfigRead(socket, command, config2, resolveAgent,
|
|
|
96705
96688
|
configOptions: ready.configOptions,
|
|
96706
96689
|
configurationRevision: ready.configurationRevision,
|
|
96707
96690
|
kind: SESSION_CONFIG_READ_RESULT_KIND,
|
|
96708
|
-
requestId:
|
|
96709
|
-
sessionId:
|
|
96691
|
+
requestId: command2.requestId,
|
|
96692
|
+
sessionId: command2.sessionId
|
|
96710
96693
|
});
|
|
96711
96694
|
} catch (error62) {
|
|
96712
96695
|
diagnostics.daemonDiagnostic(
|
|
96713
96696
|
"session_config_read_failed",
|
|
96714
|
-
|
|
96697
|
+
command2.requestId,
|
|
96715
96698
|
{
|
|
96716
96699
|
code: operationErrorCode(error62),
|
|
96717
|
-
sessionId:
|
|
96700
|
+
sessionId: command2.sessionId
|
|
96718
96701
|
},
|
|
96719
96702
|
error62
|
|
96720
96703
|
);
|
|
96721
|
-
reportOperationFailure(socket,
|
|
96704
|
+
reportOperationFailure(socket, command2.requestId, command2.sessionId, error62, metrics.snapshot());
|
|
96722
96705
|
}
|
|
96723
96706
|
}
|
|
96724
96707
|
var sessionConfigReadCommand = {
|
|
@@ -96770,11 +96753,11 @@ function createCommandRegistry(context) {
|
|
|
96770
96753
|
];
|
|
96771
96754
|
return {
|
|
96772
96755
|
dispatch: (message) => {
|
|
96773
|
-
const
|
|
96774
|
-
if (
|
|
96756
|
+
const command2 = commands.find((candidate) => candidate.kind === message.kind);
|
|
96757
|
+
if (command2 === void 0) {
|
|
96775
96758
|
throw new Error("Unsupported protocol message");
|
|
96776
96759
|
}
|
|
96777
|
-
|
|
96760
|
+
command2.handle(context, message);
|
|
96778
96761
|
},
|
|
96779
96762
|
dispatchChunk: (message) => {
|
|
96780
96763
|
const frame = (() => {
|
|
@@ -96794,7 +96777,7 @@ function createCommandRegistry(context) {
|
|
|
96794
96777
|
settle: async () => {
|
|
96795
96778
|
await Promise.all([
|
|
96796
96779
|
contentWrites.settle(),
|
|
96797
|
-
...commands.flatMap((
|
|
96780
|
+
...commands.flatMap((command2) => command2.settle === void 0 ? [] : [command2.settle()])
|
|
96798
96781
|
]);
|
|
96799
96782
|
}
|
|
96800
96783
|
};
|
|
@@ -97777,8 +97760,8 @@ var RuntimeLoop = class {
|
|
|
97777
97760
|
await runRuntime(config2, signal, void 0, {
|
|
97778
97761
|
...this.#options.turnActivity === void 0 ? {} : { turnActivity: this.#options.turnActivity },
|
|
97779
97762
|
...this.#options.agentProcesses === void 0 ? {} : { agentProcesses: this.#options.agentProcesses },
|
|
97780
|
-
onExecutionCountChange: (
|
|
97781
|
-
this.#options.onExecutionCountChange?.(
|
|
97763
|
+
onExecutionCountChange: (count2) => {
|
|
97764
|
+
this.#options.onExecutionCountChange?.(count2);
|
|
97782
97765
|
},
|
|
97783
97766
|
...this.#options.onConnectionStatus === void 0 ? {} : { onConnectionStatus: this.#options.onConnectionStatus },
|
|
97784
97767
|
...this.#options.reportUpgradeAvailability === void 0 ? {} : { reportUpgradeAvailability: this.#options.reportUpgradeAvailability },
|
|
@@ -97924,4 +97907,4 @@ export {
|
|
|
97924
97907
|
* MIT Licensed
|
|
97925
97908
|
*)
|
|
97926
97909
|
*/
|
|
97927
|
-
//# sourceMappingURL=chunk-
|
|
97910
|
+
//# sourceMappingURL=chunk-IOB4UFOK.js.map
|