omp-antigravity-acp-provider 0.1.30 → 0.1.31
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 +15 -2
- package/extension/runtime.mjs +13 -4
- package/package.json +1 -1
|
@@ -78,8 +78,20 @@ export function historyBudget(_contextWindow = 32_768, env = process.env, config
|
|
|
78
78
|
return bytes;
|
|
79
79
|
}
|
|
80
80
|
|
|
81
|
+
// OMP /retry drops the generated answer from its branch and resends the same
|
|
82
|
+
// context. The warm ACP session already holds the request, so regeneration is
|
|
83
|
+
// requested explicitly instead of replaying history into a cold session.
|
|
84
|
+
function retryRequestText(content: string | TransferBlock[]): string {
|
|
85
|
+
const restate = typeof content === "string" ? content.trim()
|
|
86
|
+
: content.filter(block => block.type === "text").map(block => block.text ?? "").join("\n\n").trim();
|
|
87
|
+
return "\n\n# OMP retry request\n\n" +
|
|
88
|
+
"The user discarded the previous response to the current user request. " +
|
|
89
|
+
"Produce a completely new answer for it. Do not continue, quote or repeat the discarded response." +
|
|
90
|
+
(restate ? `\n\n# Original request\n\n${restate}` : "");
|
|
91
|
+
}
|
|
92
|
+
|
|
81
93
|
export function buildPromptParts(context: TransferContext, fresh: boolean, unseenStart?: number,
|
|
82
|
-
limits: { contextWindow?: number; maxTokens?: number; policy?: ContextOptions } = {}) {
|
|
94
|
+
limits: { contextWindow?: number; maxTokens?: number; policy?: ContextOptions } = {}, retryResend = false) {
|
|
83
95
|
// The runtime hot path always passes a fully resolved ompContextPolicy
|
|
84
96
|
// (see scripts/build.mjs); re-resolution is only needed for partial input.
|
|
85
97
|
const policy = limits.policy;
|
|
@@ -138,7 +150,8 @@ export function buildPromptParts(context: TransferContext, fresh: boolean, unsee
|
|
|
138
150
|
for (const block of images) prompt.push(block);
|
|
139
151
|
const tailBlocks: TransferBlock[] = [];
|
|
140
152
|
if (!fresh && start > latest) {
|
|
141
|
-
const continuation = { type: "text", text:
|
|
153
|
+
const continuation = { type: "text", text: retryResend ? retryRequestText(messages[latest]!.content) :
|
|
154
|
+
"\n\n# Continue the active OMP request\n\n" +
|
|
142
155
|
"The new context/tool results above belong to the user request already received in this session. " +
|
|
143
156
|
"Finish that request from those results. Do not answer historical user requests or repeat completed tool actions." };
|
|
144
157
|
prompt.push(continuation);
|
package/extension/runtime.mjs
CHANGED
|
@@ -59484,7 +59484,15 @@ function historyBudget(_contextWindow = 32768, env2 = process.env, configured =
|
|
|
59484
59484
|
}
|
|
59485
59485
|
return bytes;
|
|
59486
59486
|
}
|
|
59487
|
-
function
|
|
59487
|
+
function retryRequestText(content) {
|
|
59488
|
+
const restate = typeof content === "string" ? content.trim() : content.filter((block) => block.type === "text").map((block) => block.text ?? "").join("\n\n").trim();
|
|
59489
|
+
return "\n\n# OMP retry request\n\nThe user discarded the previous response to the current user request. Produce a completely new answer for it. Do not continue, quote or repeat the discarded response." + (restate ? `
|
|
59490
|
+
|
|
59491
|
+
# Original request
|
|
59492
|
+
|
|
59493
|
+
${restate}` : "");
|
|
59494
|
+
}
|
|
59495
|
+
function buildPromptParts(context, fresh, unseenStart, limits = {}, retryResend = false) {
|
|
59488
59496
|
const policy = limits.policy;
|
|
59489
59497
|
const options = policy && typeof policy.inputTokenBudget === "number" && typeof policy.maxTransferBytes === "number" && typeof policy.maxImageBytes === "number" ? policy : resolveContextOptions(
|
|
59490
59498
|
{ id: "transfer", contextWindow: limits.contextWindow ?? 32768, maxTokens: limits.maxTokens ?? 8192 },
|
|
@@ -59537,7 +59545,7 @@ ${instructions}` : "";
|
|
|
59537
59545
|
for (const block of images) prompt.push(block);
|
|
59538
59546
|
const tailBlocks = [];
|
|
59539
59547
|
if (!fresh && start > latest) {
|
|
59540
|
-
const continuation = { type: "text", text: "\n\n# Continue the active OMP request\n\nThe new context/tool results above belong to the user request already received in this session. Finish that request from those results. Do not answer historical user requests or repeat completed tool actions." };
|
|
59548
|
+
const continuation = { type: "text", text: retryResend ? retryRequestText(messages[latest].content) : "\n\n# Continue the active OMP request\n\nThe new context/tool results above belong to the user request already received in this session. Finish that request from those results. Do not answer historical user requests or repeat completed tool actions." };
|
|
59541
59549
|
prompt.push(continuation);
|
|
59542
59550
|
tailBlocks.push(continuation);
|
|
59543
59551
|
} else {
|
|
@@ -60178,10 +60186,11 @@ var AntigravityRuntime = class {
|
|
|
60178
60186
|
await this.modeChanges;
|
|
60179
60187
|
this.assertEpoch(epoch);
|
|
60180
60188
|
binding = await this.getBinding(key, model, acpModelId, options.apiKey, writer, tools, options.signal);
|
|
60189
|
+
const ompRetryResend = binding.messageCount > 0 && context.messages.length === binding.messageCount && this.ompMessagesFingerprint(context.messages) === binding.historyFingerprint;
|
|
60181
60190
|
if (ompQueuedBehindTurn && binding.modelId === acpModelId && !binding.ompCancelledCheckpoint && binding.expectedAssistantFingerprint && context.messages.length === binding.messageCount && this.ompMessagesFingerprint(context.messages) === binding.historyFingerprint) {
|
|
60182
60191
|
throw new AntigravityAcpError("invalid_input", "ACP request was already processed by the preceding turn; refusing duplicate dispatch");
|
|
60183
60192
|
}
|
|
60184
|
-
if (binding.needsReconstruction || binding.cwd !== process.cwd() || binding.expectedAssistantFingerprint && context.messages[binding.messageCount]?.role === "assistant" && this.ompMessageFingerprint(context.messages[binding.messageCount]) !== binding.expectedAssistantFingerprint || (binding.ompExpectedAssistantHasOutput || binding.ompCancelledCheckpoint && binding.ompCancelledHadOutput) && context.messages[binding.messageCount]?.role !== "assistant" || binding.mode !== this.permissionMode || this.confirmedMode(binding) !== this.permissionMode || binding.toolFingerprint !== this.ompToolsFingerprint(tools) || context.messages.length < binding.messageCount || this.ompMessagesFingerprint(context.messages.slice(0, binding.messageCount)) !== binding.historyFingerprint) {
|
|
60193
|
+
if (binding.needsReconstruction || binding.cwd !== process.cwd() || binding.expectedAssistantFingerprint && context.messages[binding.messageCount]?.role === "assistant" && this.ompMessageFingerprint(context.messages[binding.messageCount]) !== binding.expectedAssistantFingerprint || (binding.ompExpectedAssistantHasOutput || binding.ompCancelledCheckpoint && binding.ompCancelledHadOutput) && context.messages[binding.messageCount]?.role !== "assistant" && !ompRetryResend || binding.mode !== this.permissionMode || this.confirmedMode(binding) !== this.permissionMode || binding.toolFingerprint !== this.ompToolsFingerprint(tools) || context.messages.length < binding.messageCount || this.ompMessagesFingerprint(context.messages.slice(0, binding.messageCount)) !== binding.historyFingerprint) {
|
|
60185
60194
|
await this.dropBinding(key, binding, true);
|
|
60186
60195
|
binding = await this.getBinding(key, model, acpModelId, options.apiKey, writer, tools, options.signal);
|
|
60187
60196
|
}
|
|
@@ -60197,7 +60206,7 @@ var AntigravityRuntime = class {
|
|
|
60197
60206
|
unseenStart += 1;
|
|
60198
60207
|
}
|
|
60199
60208
|
const parts = adaptPromptToCapabilities(
|
|
60200
|
-
buildPromptParts(context, fresh, unseenStart, { contextWindow: model.contextWindow, maxTokens: model.maxTokens, policy: model.ompContextPolicy }),
|
|
60209
|
+
buildPromptParts(context, fresh, unseenStart, { contextWindow: model.contextWindow, maxTokens: model.maxTokens, policy: model.ompContextPolicy }, ompRetryResend),
|
|
60201
60210
|
binding.initialize
|
|
60202
60211
|
);
|
|
60203
60212
|
await this.modeChanges;
|
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.31",
|
|
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",
|