omp-antigravity-acp-provider 0.1.38 → 0.1.39
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/extension/context-transfer.ts +127 -45
- package/extension/runtime.mjs +103 -46
- package/package.json +1 -1
|
@@ -48,6 +48,14 @@ interface RecordItem {
|
|
|
48
48
|
record: HistoryRecord;
|
|
49
49
|
}
|
|
50
50
|
|
|
51
|
+
interface HistoryMetrics {
|
|
52
|
+
jsonBytePrefix: number[];
|
|
53
|
+
imageTextBytePrefix: number[];
|
|
54
|
+
originalDigitBytePrefix: number[];
|
|
55
|
+
attachmentCountPrefix: number[];
|
|
56
|
+
localDigitBytePrefix: number[];
|
|
57
|
+
}
|
|
58
|
+
|
|
51
59
|
// The official harness applies a 64,000-token per-step conversion limit,
|
|
52
60
|
// independently of the model window. Its overflow path keeps only the first
|
|
53
61
|
// 192,000 UTF-8 bytes. Reserve room for USER_REQUEST/time metadata added by ACP;
|
|
@@ -215,6 +223,104 @@ function assembleStep(
|
|
|
215
223
|
return step;
|
|
216
224
|
}
|
|
217
225
|
|
|
226
|
+
function prepareHistoryMetrics(items: readonly RecordItem[]): HistoryMetrics {
|
|
227
|
+
const jsonBytePrefix = [0];
|
|
228
|
+
const imageTextBytePrefix = [0];
|
|
229
|
+
const originalDigitBytePrefix = [0];
|
|
230
|
+
const attachmentCountPrefix = [0];
|
|
231
|
+
const localDigitBytePrefix = [0];
|
|
232
|
+
let attachmentCount = 0;
|
|
233
|
+
for (const item of items) {
|
|
234
|
+
let originalDigits = 0;
|
|
235
|
+
if (item.images.length && Array.isArray(item.record.content)) {
|
|
236
|
+
for (const attachment of item.imageAttachments) {
|
|
237
|
+
originalDigits += String(attachment).length;
|
|
238
|
+
localDigitBytePrefix.push(localDigitBytePrefix.at(-1)! + String(attachmentCount).length);
|
|
239
|
+
attachmentCount++;
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
jsonBytePrefix.push(jsonBytePrefix.at(-1)! + Buffer.byteLength(item.json, "utf8"));
|
|
243
|
+
imageTextBytePrefix.push(imageTextBytePrefix.at(-1)! + promptTextBytes(item.images));
|
|
244
|
+
originalDigitBytePrefix.push(originalDigitBytePrefix.at(-1)! + originalDigits);
|
|
245
|
+
attachmentCountPrefix.push(attachmentCount);
|
|
246
|
+
}
|
|
247
|
+
return { jsonBytePrefix, imageTextBytePrefix, originalDigitBytePrefix, attachmentCountPrefix, localDigitBytePrefix };
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
function historyRangeTextBytes(metrics: HistoryMetrics, start: number, end: number): number {
|
|
251
|
+
if (start === end) return 0;
|
|
252
|
+
const attachmentStart = metrics.attachmentCountPrefix[start]!;
|
|
253
|
+
const attachmentEnd = metrics.attachmentCountPrefix[end]!;
|
|
254
|
+
return HISTORY_ENVELOPE_BYTES
|
|
255
|
+
+ metrics.jsonBytePrefix[end]! - metrics.jsonBytePrefix[start]!
|
|
256
|
+
+ end - start - 1
|
|
257
|
+
+ metrics.imageTextBytePrefix[end]! - metrics.imageTextBytePrefix[start]!
|
|
258
|
+
+ metrics.localDigitBytePrefix[attachmentEnd - attachmentStart]!
|
|
259
|
+
- (metrics.originalDigitBytePrefix[end]! - metrics.originalDigitBytePrefix[start]!);
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
function planHistorySteps(
|
|
263
|
+
instructionsBlock: TransferBlock | undefined,
|
|
264
|
+
items: readonly RecordItem[],
|
|
265
|
+
tailBlocks: TransferBlock[],
|
|
266
|
+
): { prompt: TransferBlock[]; seedSteps: TransferBlock[][] } {
|
|
267
|
+
const metrics = prepareHistoryMetrics(items);
|
|
268
|
+
const instructionBytes = instructionsBlock ? promptTextBytes([instructionsBlock]) : 0;
|
|
269
|
+
const seedTail: TransferBlock[] = [{ type: "text", text: SEED_ACK_TEXT }];
|
|
270
|
+
const seedTailBytes = promptTextBytes(seedTail);
|
|
271
|
+
const spans: { start: number; end: number }[] = [];
|
|
272
|
+
let seedInstructions = instructionsBlock;
|
|
273
|
+
let pendingInstructions = instructionsBlock;
|
|
274
|
+
let finalInstructions: TransferBlock | undefined;
|
|
275
|
+
if (instructionBytes + seedTailBytes > ACP_STEP_TEXT_BYTES) {
|
|
276
|
+
finalInstructions = pendingInstructions;
|
|
277
|
+
seedInstructions = undefined;
|
|
278
|
+
pendingInstructions = undefined;
|
|
279
|
+
}
|
|
280
|
+
let cursor = 0;
|
|
281
|
+
while (cursor < items.length || pendingInstructions) {
|
|
282
|
+
const remainingInstructions = finalInstructions ?? pendingInstructions;
|
|
283
|
+
const remaining = assembleStep(remainingInstructions, items.slice(cursor), tailBlocks);
|
|
284
|
+
if (promptTextBytes(remaining) <= ACP_STEP_TEXT_BYTES) break;
|
|
285
|
+
const start = cursor;
|
|
286
|
+
const chunkInstructions = pendingInstructions;
|
|
287
|
+
const chunkInstructionBytes = chunkInstructions ? instructionBytes : 0;
|
|
288
|
+
while (cursor < items.length) {
|
|
289
|
+
const predicted = chunkInstructionBytes
|
|
290
|
+
+ historyRangeTextBytes(metrics, start, cursor + 1) + seedTailBytes;
|
|
291
|
+
if (predicted <= ACP_STEP_TEXT_BYTES) {
|
|
292
|
+
cursor++;
|
|
293
|
+
continue;
|
|
294
|
+
}
|
|
295
|
+
const rejected = assembleStep(chunkInstructions, items.slice(start, cursor + 1), seedTail);
|
|
296
|
+
const actual = promptTextBytes(rejected);
|
|
297
|
+
if (actual !== predicted || actual <= ACP_STEP_TEXT_BYTES) {
|
|
298
|
+
throw new Error(`History chunk planner predicted ${predicted} bytes for a rejected candidate but rendered ${actual}`);
|
|
299
|
+
}
|
|
300
|
+
break;
|
|
301
|
+
}
|
|
302
|
+
if (!chunkInstructions && cursor === start) {
|
|
303
|
+
checkStepTextBytes(promptTextBytes(assembleStep(undefined, [items[start]!], seedTail)));
|
|
304
|
+
throw new Error("History chunk planner made no progress");
|
|
305
|
+
}
|
|
306
|
+
spans.push({ start, end: cursor });
|
|
307
|
+
pendingInstructions = undefined;
|
|
308
|
+
}
|
|
309
|
+
const seedSteps = spans.map((span, index) => {
|
|
310
|
+
const stepInstructions = index === 0 ? seedInstructions : undefined;
|
|
311
|
+
const predicted = (stepInstructions ? instructionBytes : 0)
|
|
312
|
+
+ historyRangeTextBytes(metrics, span.start, span.end) + seedTailBytes;
|
|
313
|
+
const step = assembleStep(stepInstructions, items.slice(span.start, span.end), seedTail);
|
|
314
|
+
const actual = promptTextBytes(step);
|
|
315
|
+
if (actual !== predicted) throw new Error(`History chunk planner predicted ${predicted} bytes but rendered ${actual}`);
|
|
316
|
+
checkStepTextBytes(actual);
|
|
317
|
+
return step;
|
|
318
|
+
});
|
|
319
|
+
const prompt = assembleStep(finalInstructions ?? pendingInstructions, items.slice(cursor), tailBlocks);
|
|
320
|
+
checkStepTextBytes(promptTextBytes(prompt));
|
|
321
|
+
return { prompt, seedSteps };
|
|
322
|
+
}
|
|
323
|
+
|
|
218
324
|
interface RequestSplit {
|
|
219
325
|
seedSteps: TransferBlock[][];
|
|
220
326
|
tailBlocks: TransferBlock[];
|
|
@@ -328,9 +434,22 @@ function historyRecordItems(
|
|
|
328
434
|
images: TransferBlock[],
|
|
329
435
|
imageAttachments: number[],
|
|
330
436
|
): RecordItem[] {
|
|
331
|
-
const make = (candidate: HistoryRecord
|
|
332
|
-
|
|
333
|
-
|
|
437
|
+
const make = (candidate: HistoryRecord, itemImages: TransferBlock[] = images,
|
|
438
|
+
attachments: number[] = imageAttachments, json?: string): RecordItem => {
|
|
439
|
+
const referenced = new Set<number>();
|
|
440
|
+
let referenceCount = 0;
|
|
441
|
+
if (Array.isArray(candidate.content)) for (const block of candidate.content) {
|
|
442
|
+
if (block.type === "image" && typeof block.attachment === "number") {
|
|
443
|
+
referenceCount++;
|
|
444
|
+
referenced.add(block.attachment);
|
|
445
|
+
}
|
|
446
|
+
}
|
|
447
|
+
if (itemImages.length !== attachments.length * 2 || referenceCount !== attachments.length || referenced.size !== attachments.length ||
|
|
448
|
+
attachments.some(attachment => !Number.isSafeInteger(attachment) || attachment < 0 || !referenced.has(attachment))) {
|
|
449
|
+
throw new Error("Historical image attachments do not match their content or data");
|
|
450
|
+
}
|
|
451
|
+
return { json: json ?? serializeRecord(candidate), images: itemImages, imageAttachments: attachments, record: candidate };
|
|
452
|
+
};
|
|
334
453
|
try {
|
|
335
454
|
return [make(record)];
|
|
336
455
|
} catch (error) {
|
|
@@ -360,7 +479,7 @@ function historyRecordItems(
|
|
|
360
479
|
chunk = takeTextChunk(rest, limit);
|
|
361
480
|
}
|
|
362
481
|
}
|
|
363
|
-
chunks.push(
|
|
482
|
+
chunks.push(make(candidate, [], [], json));
|
|
364
483
|
rest = rest.slice(chunk.length);
|
|
365
484
|
}
|
|
366
485
|
return chunks;
|
|
@@ -422,12 +541,7 @@ function historyRecordItems(
|
|
|
422
541
|
partAttachments.push(block.attachment);
|
|
423
542
|
}
|
|
424
543
|
const candidate = { ...record, content: part };
|
|
425
|
-
chunks.push(
|
|
426
|
-
json: serializeRecord(candidate),
|
|
427
|
-
images: partImages,
|
|
428
|
-
imageAttachments: partAttachments,
|
|
429
|
-
record: candidate,
|
|
430
|
-
});
|
|
544
|
+
chunks.push(make(candidate, partImages, partAttachments));
|
|
431
545
|
}
|
|
432
546
|
return chunks;
|
|
433
547
|
}
|
|
@@ -539,41 +653,9 @@ export function buildPromptParts(context: TransferContext, fresh: boolean, unsee
|
|
|
539
653
|
let prompt = assembleStep(instructionsBlock, recordItems, tailBlocks);
|
|
540
654
|
const historySeedSteps: TransferBlock[][] = [];
|
|
541
655
|
if (promptTextBytes(prompt) > ACP_STEP_TEXT_BYTES) {
|
|
542
|
-
const
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
if (pendingInstructions && promptTextBytes(assembleStep(pendingInstructions, [], seedTail)) > ACP_STEP_TEXT_BYTES) {
|
|
546
|
-
// Instructions that cannot fit beside a seed acknowledgement stay in
|
|
547
|
-
// the final prompt; history seed steps can still be sent without them.
|
|
548
|
-
finalInstructions = pendingInstructions;
|
|
549
|
-
pendingInstructions = undefined;
|
|
550
|
-
}
|
|
551
|
-
let cursor = 0;
|
|
552
|
-
while (cursor < recordItems.length || pendingInstructions) {
|
|
553
|
-
const remainingInstructions = finalInstructions ?? pendingInstructions;
|
|
554
|
-
const remaining = assembleStep(remainingInstructions, recordItems.slice(cursor), tailBlocks);
|
|
555
|
-
if (promptTextBytes(remaining) <= ACP_STEP_TEXT_BYTES) break;
|
|
556
|
-
const chunkItems: RecordItem[] = [];
|
|
557
|
-
const chunkInst = pendingInstructions;
|
|
558
|
-
while (cursor < recordItems.length) {
|
|
559
|
-
const candidate = assembleStep(chunkInst, [...chunkItems, recordItems[cursor]!], seedTail);
|
|
560
|
-
if (promptTextBytes(candidate) <= ACP_STEP_TEXT_BYTES) {
|
|
561
|
-
chunkItems.push(recordItems[cursor]!);
|
|
562
|
-
cursor++;
|
|
563
|
-
} else {
|
|
564
|
-
break;
|
|
565
|
-
}
|
|
566
|
-
}
|
|
567
|
-
if (!chunkInst && chunkItems.length === 0) {
|
|
568
|
-
checkStepTextBytes(promptTextBytes(assembleStep(undefined, [recordItems[cursor]!], seedTail)));
|
|
569
|
-
}
|
|
570
|
-
const seedStep = assembleStep(chunkInst, chunkItems, seedTail);
|
|
571
|
-
checkStepTextBytes(promptTextBytes(seedStep));
|
|
572
|
-
historySeedSteps.push(seedStep);
|
|
573
|
-
pendingInstructions = undefined;
|
|
574
|
-
}
|
|
575
|
-
prompt = assembleStep(finalInstructions ?? pendingInstructions, recordItems.slice(cursor), tailBlocks);
|
|
576
|
-
checkStepTextBytes(promptTextBytes(prompt));
|
|
656
|
+
const planned = planHistorySteps(instructionsBlock, recordItems, tailBlocks);
|
|
657
|
+
prompt = planned.prompt;
|
|
658
|
+
historySeedSteps.push(...planned.seedSteps);
|
|
577
659
|
}
|
|
578
660
|
const seedSteps = historySeedSteps.length || requestSeedSteps.length
|
|
579
661
|
? [...historySeedSteps, ...requestSeedSteps]
|
package/extension/runtime.mjs
CHANGED
|
@@ -60054,6 +60054,90 @@ function assembleStep(instructionsBlock, items, tailBlocks) {
|
|
|
60054
60054
|
for (const block of tailBlocks) step.push(block);
|
|
60055
60055
|
return step;
|
|
60056
60056
|
}
|
|
60057
|
+
function prepareHistoryMetrics(items) {
|
|
60058
|
+
const jsonBytePrefix = [0];
|
|
60059
|
+
const imageTextBytePrefix = [0];
|
|
60060
|
+
const originalDigitBytePrefix = [0];
|
|
60061
|
+
const attachmentCountPrefix = [0];
|
|
60062
|
+
const localDigitBytePrefix = [0];
|
|
60063
|
+
let attachmentCount = 0;
|
|
60064
|
+
for (const item of items) {
|
|
60065
|
+
let originalDigits = 0;
|
|
60066
|
+
if (item.images.length && Array.isArray(item.record.content)) {
|
|
60067
|
+
for (const attachment of item.imageAttachments) {
|
|
60068
|
+
originalDigits += String(attachment).length;
|
|
60069
|
+
localDigitBytePrefix.push(localDigitBytePrefix.at(-1) + String(attachmentCount).length);
|
|
60070
|
+
attachmentCount++;
|
|
60071
|
+
}
|
|
60072
|
+
}
|
|
60073
|
+
jsonBytePrefix.push(jsonBytePrefix.at(-1) + Buffer.byteLength(item.json, "utf8"));
|
|
60074
|
+
imageTextBytePrefix.push(imageTextBytePrefix.at(-1) + promptTextBytes(item.images));
|
|
60075
|
+
originalDigitBytePrefix.push(originalDigitBytePrefix.at(-1) + originalDigits);
|
|
60076
|
+
attachmentCountPrefix.push(attachmentCount);
|
|
60077
|
+
}
|
|
60078
|
+
return { jsonBytePrefix, imageTextBytePrefix, originalDigitBytePrefix, attachmentCountPrefix, localDigitBytePrefix };
|
|
60079
|
+
}
|
|
60080
|
+
function historyRangeTextBytes(metrics, start, end) {
|
|
60081
|
+
if (start === end) return 0;
|
|
60082
|
+
const attachmentStart = metrics.attachmentCountPrefix[start];
|
|
60083
|
+
const attachmentEnd = metrics.attachmentCountPrefix[end];
|
|
60084
|
+
return HISTORY_ENVELOPE_BYTES + metrics.jsonBytePrefix[end] - metrics.jsonBytePrefix[start] + end - start - 1 + metrics.imageTextBytePrefix[end] - metrics.imageTextBytePrefix[start] + metrics.localDigitBytePrefix[attachmentEnd - attachmentStart] - (metrics.originalDigitBytePrefix[end] - metrics.originalDigitBytePrefix[start]);
|
|
60085
|
+
}
|
|
60086
|
+
function planHistorySteps(instructionsBlock, items, tailBlocks) {
|
|
60087
|
+
const metrics = prepareHistoryMetrics(items);
|
|
60088
|
+
const instructionBytes = instructionsBlock ? promptTextBytes([instructionsBlock]) : 0;
|
|
60089
|
+
const seedTail = [{ type: "text", text: SEED_ACK_TEXT }];
|
|
60090
|
+
const seedTailBytes = promptTextBytes(seedTail);
|
|
60091
|
+
const spans = [];
|
|
60092
|
+
let seedInstructions = instructionsBlock;
|
|
60093
|
+
let pendingInstructions = instructionsBlock;
|
|
60094
|
+
let finalInstructions;
|
|
60095
|
+
if (instructionBytes + seedTailBytes > ACP_STEP_TEXT_BYTES) {
|
|
60096
|
+
finalInstructions = pendingInstructions;
|
|
60097
|
+
seedInstructions = void 0;
|
|
60098
|
+
pendingInstructions = void 0;
|
|
60099
|
+
}
|
|
60100
|
+
let cursor = 0;
|
|
60101
|
+
while (cursor < items.length || pendingInstructions) {
|
|
60102
|
+
const remainingInstructions = finalInstructions ?? pendingInstructions;
|
|
60103
|
+
const remaining = assembleStep(remainingInstructions, items.slice(cursor), tailBlocks);
|
|
60104
|
+
if (promptTextBytes(remaining) <= ACP_STEP_TEXT_BYTES) break;
|
|
60105
|
+
const start = cursor;
|
|
60106
|
+
const chunkInstructions = pendingInstructions;
|
|
60107
|
+
const chunkInstructionBytes = chunkInstructions ? instructionBytes : 0;
|
|
60108
|
+
while (cursor < items.length) {
|
|
60109
|
+
const predicted = chunkInstructionBytes + historyRangeTextBytes(metrics, start, cursor + 1) + seedTailBytes;
|
|
60110
|
+
if (predicted <= ACP_STEP_TEXT_BYTES) {
|
|
60111
|
+
cursor++;
|
|
60112
|
+
continue;
|
|
60113
|
+
}
|
|
60114
|
+
const rejected = assembleStep(chunkInstructions, items.slice(start, cursor + 1), seedTail);
|
|
60115
|
+
const actual = promptTextBytes(rejected);
|
|
60116
|
+
if (actual !== predicted || actual <= ACP_STEP_TEXT_BYTES) {
|
|
60117
|
+
throw new Error(`History chunk planner predicted ${predicted} bytes for a rejected candidate but rendered ${actual}`);
|
|
60118
|
+
}
|
|
60119
|
+
break;
|
|
60120
|
+
}
|
|
60121
|
+
if (!chunkInstructions && cursor === start) {
|
|
60122
|
+
checkStepTextBytes(promptTextBytes(assembleStep(void 0, [items[start]], seedTail)));
|
|
60123
|
+
throw new Error("History chunk planner made no progress");
|
|
60124
|
+
}
|
|
60125
|
+
spans.push({ start, end: cursor });
|
|
60126
|
+
pendingInstructions = void 0;
|
|
60127
|
+
}
|
|
60128
|
+
const seedSteps = spans.map((span, index) => {
|
|
60129
|
+
const stepInstructions = index === 0 ? seedInstructions : void 0;
|
|
60130
|
+
const predicted = (stepInstructions ? instructionBytes : 0) + historyRangeTextBytes(metrics, span.start, span.end) + seedTailBytes;
|
|
60131
|
+
const step = assembleStep(stepInstructions, items.slice(span.start, span.end), seedTail);
|
|
60132
|
+
const actual = promptTextBytes(step);
|
|
60133
|
+
if (actual !== predicted) throw new Error(`History chunk planner predicted ${predicted} bytes but rendered ${actual}`);
|
|
60134
|
+
checkStepTextBytes(actual);
|
|
60135
|
+
return step;
|
|
60136
|
+
});
|
|
60137
|
+
const prompt = assembleStep(finalInstructions ?? pendingInstructions, items.slice(cursor), tailBlocks);
|
|
60138
|
+
checkStepTextBytes(promptTextBytes(prompt));
|
|
60139
|
+
return { prompt, seedSteps };
|
|
60140
|
+
}
|
|
60057
60141
|
function requestFinalHeader(inProgress) {
|
|
60058
60142
|
return REQUEST_FINAL_HEADER + (inProgress ? "This request is already in progress; the history includes prior assistant actions and tool results. Continue from those results rather than restarting completed work.\n\n" : "");
|
|
60059
60143
|
}
|
|
@@ -60143,12 +60227,20 @@ function splitOversizedRequest(blocks, inProgress) {
|
|
|
60143
60227
|
return { seedSteps, tailBlocks };
|
|
60144
60228
|
}
|
|
60145
60229
|
function historyRecordItems(record3, images, imageAttachments) {
|
|
60146
|
-
const make = (candidate) =>
|
|
60147
|
-
|
|
60148
|
-
|
|
60149
|
-
|
|
60150
|
-
|
|
60151
|
-
|
|
60230
|
+
const make = (candidate, itemImages = images, attachments = imageAttachments, json3) => {
|
|
60231
|
+
const referenced = /* @__PURE__ */ new Set();
|
|
60232
|
+
let referenceCount = 0;
|
|
60233
|
+
if (Array.isArray(candidate.content)) for (const block of candidate.content) {
|
|
60234
|
+
if (block.type === "image" && typeof block.attachment === "number") {
|
|
60235
|
+
referenceCount++;
|
|
60236
|
+
referenced.add(block.attachment);
|
|
60237
|
+
}
|
|
60238
|
+
}
|
|
60239
|
+
if (itemImages.length !== attachments.length * 2 || referenceCount !== attachments.length || referenced.size !== attachments.length || attachments.some((attachment) => !Number.isSafeInteger(attachment) || attachment < 0 || !referenced.has(attachment))) {
|
|
60240
|
+
throw new Error("Historical image attachments do not match their content or data");
|
|
60241
|
+
}
|
|
60242
|
+
return { json: json3 ?? serializeRecord(candidate), images: itemImages, imageAttachments: attachments, record: candidate };
|
|
60243
|
+
};
|
|
60152
60244
|
try {
|
|
60153
60245
|
return [make(record3)];
|
|
60154
60246
|
} catch (error62) {
|
|
@@ -60175,7 +60267,7 @@ function historyRecordItems(record3, images, imageAttachments) {
|
|
|
60175
60267
|
chunk = takeTextChunk(rest, limit);
|
|
60176
60268
|
}
|
|
60177
60269
|
}
|
|
60178
|
-
chunks.push(
|
|
60270
|
+
chunks.push(make(candidate, [], [], json3));
|
|
60179
60271
|
rest = rest.slice(chunk.length);
|
|
60180
60272
|
}
|
|
60181
60273
|
return chunks;
|
|
@@ -60235,12 +60327,7 @@ function historyRecordItems(record3, images, imageAttachments) {
|
|
|
60235
60327
|
partAttachments.push(block.attachment);
|
|
60236
60328
|
}
|
|
60237
60329
|
const candidate = { ...record3, content: part };
|
|
60238
|
-
chunks.push(
|
|
60239
|
-
json: serializeRecord(candidate),
|
|
60240
|
-
images: partImages,
|
|
60241
|
-
imageAttachments: partAttachments,
|
|
60242
|
-
record: candidate
|
|
60243
|
-
});
|
|
60330
|
+
chunks.push(make(candidate, partImages, partAttachments));
|
|
60244
60331
|
}
|
|
60245
60332
|
return chunks;
|
|
60246
60333
|
}
|
|
@@ -60333,39 +60420,9 @@ ${instructions}` : "";
|
|
|
60333
60420
|
let prompt = assembleStep(instructionsBlock, recordItems, tailBlocks);
|
|
60334
60421
|
const historySeedSteps = [];
|
|
60335
60422
|
if (promptTextBytes(prompt) > ACP_STEP_TEXT_BYTES) {
|
|
60336
|
-
const
|
|
60337
|
-
|
|
60338
|
-
|
|
60339
|
-
if (pendingInstructions && promptTextBytes(assembleStep(pendingInstructions, [], seedTail)) > ACP_STEP_TEXT_BYTES) {
|
|
60340
|
-
finalInstructions = pendingInstructions;
|
|
60341
|
-
pendingInstructions = void 0;
|
|
60342
|
-
}
|
|
60343
|
-
let cursor = 0;
|
|
60344
|
-
while (cursor < recordItems.length || pendingInstructions) {
|
|
60345
|
-
const remainingInstructions = finalInstructions ?? pendingInstructions;
|
|
60346
|
-
const remaining = assembleStep(remainingInstructions, recordItems.slice(cursor), tailBlocks);
|
|
60347
|
-
if (promptTextBytes(remaining) <= ACP_STEP_TEXT_BYTES) break;
|
|
60348
|
-
const chunkItems = [];
|
|
60349
|
-
const chunkInst = pendingInstructions;
|
|
60350
|
-
while (cursor < recordItems.length) {
|
|
60351
|
-
const candidate = assembleStep(chunkInst, [...chunkItems, recordItems[cursor]], seedTail);
|
|
60352
|
-
if (promptTextBytes(candidate) <= ACP_STEP_TEXT_BYTES) {
|
|
60353
|
-
chunkItems.push(recordItems[cursor]);
|
|
60354
|
-
cursor++;
|
|
60355
|
-
} else {
|
|
60356
|
-
break;
|
|
60357
|
-
}
|
|
60358
|
-
}
|
|
60359
|
-
if (!chunkInst && chunkItems.length === 0) {
|
|
60360
|
-
checkStepTextBytes(promptTextBytes(assembleStep(void 0, [recordItems[cursor]], seedTail)));
|
|
60361
|
-
}
|
|
60362
|
-
const seedStep = assembleStep(chunkInst, chunkItems, seedTail);
|
|
60363
|
-
checkStepTextBytes(promptTextBytes(seedStep));
|
|
60364
|
-
historySeedSteps.push(seedStep);
|
|
60365
|
-
pendingInstructions = void 0;
|
|
60366
|
-
}
|
|
60367
|
-
prompt = assembleStep(finalInstructions ?? pendingInstructions, recordItems.slice(cursor), tailBlocks);
|
|
60368
|
-
checkStepTextBytes(promptTextBytes(prompt));
|
|
60423
|
+
const planned = planHistorySteps(instructionsBlock, recordItems, tailBlocks);
|
|
60424
|
+
prompt = planned.prompt;
|
|
60425
|
+
historySeedSteps.push(...planned.seedSteps);
|
|
60369
60426
|
}
|
|
60370
60427
|
const seedSteps = historySeedSteps.length || requestSeedSteps.length ? [...historySeedSteps, ...requestSeedSteps] : void 0;
|
|
60371
60428
|
let imageBytes = 0;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "omp-antigravity-acp-provider",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.39",
|
|
4
4
|
"ompAcpBundle": 1,
|
|
5
5
|
"description": "Google Antigravity ACP provider for Oh My Pi (OMP), with tool bridging and per-model thinking; derived from zacbemis/pi-antigravity-acp-provider",
|
|
6
6
|
"type": "module",
|