@opengeni/runtime 4.0.3-canary.36079201993001 → 4.0.3
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/assets/codemode-client.json +1 -1
- package/dist/{chunk-OGG5NQLA.js → chunk-LL2YQO5H.js} +22 -75
- package/dist/chunk-LL2YQO5H.js.map +1 -0
- package/dist/context-compaction.d.ts +2 -4
- package/dist/index.d.ts +6 -8
- package/dist/index.js +1 -3
- package/dist/operational-instructions.d.ts +1 -1
- package/dist/workspace-tool-gateway.js +1 -1
- package/package.json +11 -11
- package/src/context-compaction.ts +3 -19
- package/src/index.ts +36 -91
- package/src/operational-instructions.ts +1 -1
- package/dist/chunk-OGG5NQLA.js.map +0 -1
|
@@ -581,9 +581,6 @@ import {
|
|
|
581
581
|
} from "@opengeni/codex";
|
|
582
582
|
var COMPACTION_SUMMARY_MARKER = "opengeni_context_summary";
|
|
583
583
|
var SUMMARY_BUFFER_TOKENS = 2e4;
|
|
584
|
-
function compactionSummaryOutputTokens(contextWindowTokens) {
|
|
585
|
-
return Math.min(SUMMARY_BUFFER_TOKENS, Math.max(1, Math.floor(contextWindowTokens / 4)));
|
|
586
|
-
}
|
|
587
584
|
var COMPACT_USER_MESSAGE_MAX_TOKENS = 2e4;
|
|
588
585
|
var REMOTE_V2_RETAINED_MESSAGE_TOKEN_BUDGET = 64e3;
|
|
589
586
|
var REMOTE_COMPACTION_V2_IMPLEMENTATION = "responses_compaction_v2";
|
|
@@ -1328,7 +1325,7 @@ var EmptyCompactionSummaryError = class extends Error {
|
|
|
1328
1325
|
constructor(diagnostics = {}) {
|
|
1329
1326
|
const compact = JSON.stringify(diagnostics).slice(0, 2e3);
|
|
1330
1327
|
super(
|
|
1331
|
-
`Compaction
|
|
1328
|
+
`Compaction summarizer returned no assistant text; active history was preserved${compact ? ` (${compact})` : ""}`
|
|
1332
1329
|
);
|
|
1333
1330
|
this.name = "EmptyCompactionSummaryError";
|
|
1334
1331
|
this.diagnostics = diagnostics;
|
|
@@ -1484,18 +1481,10 @@ function omitOpaqueArtifactsFromPortableCompactionHistory(items) {
|
|
|
1484
1481
|
}
|
|
1485
1482
|
if (type === "reasoning" && hasOpaqueProviderArtifact(item)) {
|
|
1486
1483
|
const projected = projectRejectedReasoningArtifact(item);
|
|
1487
|
-
if (Object.keys(projected).length === 1) {
|
|
1488
|
-
changed = true;
|
|
1489
|
-
continue;
|
|
1490
|
-
}
|
|
1491
1484
|
changed ||= projected !== item;
|
|
1492
1485
|
out.push(projected);
|
|
1493
1486
|
continue;
|
|
1494
1487
|
}
|
|
1495
|
-
if (type === "reasoning" && Object.keys(item).length === 1) {
|
|
1496
|
-
changed = true;
|
|
1497
|
-
continue;
|
|
1498
|
-
}
|
|
1499
1488
|
out.push(item);
|
|
1500
1489
|
}
|
|
1501
1490
|
return changed ? out : items;
|
|
@@ -1560,12 +1549,9 @@ function oldestLogicalUnitCuts(items) {
|
|
|
1560
1549
|
cuts.push(items.length);
|
|
1561
1550
|
return cuts;
|
|
1562
1551
|
}
|
|
1563
|
-
function buildCompactionReplacementHistory(items, summaryBody, retainedItemTokens = (item) => estimateTokens([item])
|
|
1552
|
+
function buildCompactionReplacementHistory(items, summaryBody, retainedItemTokens = (item) => estimateTokens([item])) {
|
|
1564
1553
|
const retainedReversed = [];
|
|
1565
|
-
let remaining =
|
|
1566
|
-
0,
|
|
1567
|
-
Math.min(COMPACT_USER_MESSAGE_MAX_TOKENS, retainedMessageBudgetTokens)
|
|
1568
|
-
);
|
|
1554
|
+
let remaining = COMPACT_USER_MESSAGE_MAX_TOKENS;
|
|
1569
1555
|
for (let index = items.length - 1; index >= 0 && remaining > 0; index -= 1) {
|
|
1570
1556
|
const item = items[index];
|
|
1571
1557
|
if (!isUserMessage(item) || isCompactionSummary(item) || isAttachmentCatalog(item)) {
|
|
@@ -10404,7 +10390,7 @@ Skills are reusable instructions supplied dynamically for the current session. W
|
|
|
10404
10390
|
|
|
10405
10391
|
# Integration setup
|
|
10406
10392
|
|
|
10407
|
-
Use available integration tools directly. If
|
|
10393
|
+
Use available integration tools directly. If the task needs an integration you cannot access, discover it with \`capability_catalog_search\` before declaring a setup blocker. For a suitable match with \`setup.nextAction\`, call \`capability_authorization_request\` with the returned capability ID and a brief task-specific rationale to show its Connect card in chat. Requesting the card does not need integration-management permission; the authenticated human must authorize setup. A card is for an integration required by the authorized design, including established or delegated choices. Resolve out-of-scope architecture choices before requesting setup. After setup, rediscover the tools and continue the task, verifying the access it needs. If access remains blocked, explain the specific blocker from the returned facts. If either setup tool is unavailable, report the missing setup path.
|
|
10408
10394
|
|
|
10409
10395
|
# Session coordination
|
|
10410
10396
|
|
|
@@ -12363,7 +12349,7 @@ import { existsSync, readdirSync } from "fs";
|
|
|
12363
12349
|
// ../sdk/package.json
|
|
12364
12350
|
var package_default = {
|
|
12365
12351
|
name: "@opengeni/sdk",
|
|
12366
|
-
version: "7.1.1
|
|
12352
|
+
version: "7.1.1",
|
|
12367
12353
|
description: "Framework-agnostic TypeScript SDK for the OpenGeni API: typed client, session lifecycle, SSE event streaming with reconnect + replay-by-sequence, and proxy re-streaming helpers.",
|
|
12368
12354
|
license: "Apache-2.0",
|
|
12369
12355
|
repository: {
|
|
@@ -12515,7 +12501,7 @@ var package_default = {
|
|
|
12515
12501
|
// ../react/package.json
|
|
12516
12502
|
var package_default2 = {
|
|
12517
12503
|
name: "@opengeni/react",
|
|
12518
|
-
version: "7.1.2
|
|
12504
|
+
version: "7.1.2",
|
|
12519
12505
|
description: "React hooks and styled components for OpenGeni: live session streaming, chat composer, message timeline, session status, and fleet views \u2014 token-themed (CSS variables), dark-first, built on Tailwind v4 + Radix + Motion.",
|
|
12520
12506
|
license: "Apache-2.0",
|
|
12521
12507
|
repository: {
|
|
@@ -12768,7 +12754,7 @@ var package_default2 = {
|
|
|
12768
12754
|
// ../codemode/package.json
|
|
12769
12755
|
var package_default3 = {
|
|
12770
12756
|
name: "@opengeni/codemode",
|
|
12771
|
-
version: "0.6.2
|
|
12757
|
+
version: "0.6.2",
|
|
12772
12758
|
description: "Attempt-frozen programmatic tool catalog and execution authority for OpenGeni.",
|
|
12773
12759
|
license: "Apache-2.0",
|
|
12774
12760
|
repository: {
|
|
@@ -12818,7 +12804,7 @@ var package_default3 = {
|
|
|
12818
12804
|
// ../ogtool/package.json
|
|
12819
12805
|
var package_default4 = {
|
|
12820
12806
|
name: "@opengeni/ogtool",
|
|
12821
|
-
version: "0.3.44
|
|
12807
|
+
version: "0.3.44",
|
|
12822
12808
|
description: "Codemode CLI and typed client entrypoint for an OpenGeni execution attempt.",
|
|
12823
12809
|
license: "Apache-2.0",
|
|
12824
12810
|
repository: {
|
|
@@ -17286,24 +17272,17 @@ async function summarizeForCompaction(settings, input, options = {}) {
|
|
|
17286
17272
|
const model = options.model ?? settings.openaiModel;
|
|
17287
17273
|
const provider = options.provider ?? configuredProviders2(settings)[0];
|
|
17288
17274
|
if (!provider) throw new Error("Built-in model provider is unavailable");
|
|
17289
|
-
const
|
|
17290
|
-
const maxTokens = options.maxOutputTokens ?? compactionSummaryOutputTokens(settings.contextWindowTokens);
|
|
17275
|
+
const maxTokens = options.maxOutputTokens ?? SUMMARY_BUFFER_TOKENS;
|
|
17291
17276
|
if (api === "chat") {
|
|
17292
17277
|
const transcript = renderCompactionPromptInputForChat(input);
|
|
17293
17278
|
let completion;
|
|
17294
17279
|
try {
|
|
17295
|
-
completion = await client.chat.completions.create(
|
|
17296
|
-
|
|
17297
|
-
|
|
17298
|
-
|
|
17299
|
-
|
|
17300
|
-
|
|
17301
|
-
{ role: "user", content: transcript }
|
|
17302
|
-
],
|
|
17303
|
-
...options.promptCacheKey ? { prompt_cache_key: options.promptCacheKey } : {}
|
|
17304
|
-
},
|
|
17305
|
-
options.signal ? { signal: options.signal } : void 0
|
|
17306
|
-
);
|
|
17280
|
+
completion = await client.chat.completions.create({
|
|
17281
|
+
model,
|
|
17282
|
+
max_tokens: maxTokens,
|
|
17283
|
+
messages: [{ role: "user", content: transcript }],
|
|
17284
|
+
...options.promptCacheKey ? { prompt_cache_key: options.promptCacheKey } : {}
|
|
17285
|
+
});
|
|
17307
17286
|
} catch (error) {
|
|
17308
17287
|
throw new CompactionProviderResponseError(compactionProviderFailureDiagnostics(error), error);
|
|
17309
17288
|
}
|
|
@@ -17311,62 +17290,31 @@ async function summarizeForCompaction(settings, input, options = {}) {
|
|
|
17311
17290
|
if (usage2) {
|
|
17312
17291
|
await options.onUsage?.(usage2);
|
|
17313
17292
|
}
|
|
17314
|
-
const
|
|
17315
|
-
if (choice?.finish_reason !== "stop") {
|
|
17316
|
-
throw new EmptyCompactionSummaryError({
|
|
17317
|
-
stage: "chat_completion",
|
|
17318
|
-
reason: "non_stop_finish",
|
|
17319
|
-
finishReason: ["length", "content_filter", "tool_calls", "function_call"].includes(
|
|
17320
|
-
String(choice?.finish_reason)
|
|
17321
|
-
) ? choice?.finish_reason : "unknown"
|
|
17322
|
-
});
|
|
17323
|
-
}
|
|
17324
|
-
const text = choice.message?.content;
|
|
17293
|
+
const text = completion.choices?.[0]?.message?.content;
|
|
17325
17294
|
const summary2 = typeof text === "string" ? text.trim() : "";
|
|
17326
17295
|
if (!summary2) {
|
|
17327
17296
|
throw new EmptyCompactionSummaryError(compactionResponseDiagnostics(completion, summary2));
|
|
17328
17297
|
}
|
|
17329
17298
|
return summary2;
|
|
17330
17299
|
}
|
|
17331
|
-
const
|
|
17332
|
-
const { store: _priorStore, ...preparedModelSettings } = preparedPrefix?.modelSettings ?? {};
|
|
17333
|
-
const request = preparedPrefix ? {
|
|
17334
|
-
...preparedPrefix,
|
|
17335
|
-
// The history copy is still portable: dependent stored response ids are
|
|
17336
|
-
// removed, and the final checkpoint instruction is appended by the caller.
|
|
17337
|
-
input: input.map(detachCompactionResponseItemIdentity),
|
|
17338
|
-
modelSettings: {
|
|
17339
|
-
...preparedModelSettings,
|
|
17340
|
-
maxTokens,
|
|
17341
|
-
// Retain schemas for the warm prefix without letting the checkpoint
|
|
17342
|
-
// model select or execute a tool (including a historical Azure tool).
|
|
17343
|
-
toolChoice: "none",
|
|
17344
|
-
// The selected provider, not the deployment default, owns this wire
|
|
17345
|
-
// policy. Override any inherited value on a prepared Azure request.
|
|
17346
|
-
...azureResponses ? {} : { store: false }
|
|
17347
|
-
},
|
|
17348
|
-
outputType: "text",
|
|
17349
|
-
tracing: false,
|
|
17350
|
-
...options.signal ? { signal: options.signal } : {}
|
|
17351
|
-
} : {
|
|
17300
|
+
const request = {
|
|
17352
17301
|
systemInstructions: options.systemInstructions ?? "",
|
|
17353
17302
|
input: input.map(detachCompactionResponseItemIdentity),
|
|
17354
17303
|
modelSettings: {
|
|
17355
17304
|
maxTokens,
|
|
17356
17305
|
// Azure can select a historical tool despite empty schemas. Keep this
|
|
17357
17306
|
// verified policy off subscription/gateway transports with other contracts.
|
|
17358
|
-
...
|
|
17307
|
+
...provider.wireProfile === "azure-openai" ? { toolChoice: "none" } : {},
|
|
17359
17308
|
// Azure rejects store:false; the Codex subscription transport enforces
|
|
17360
|
-
// it independently.
|
|
17361
|
-
...
|
|
17309
|
+
// it independently. The OpenAI platform path remains explicitly storeless.
|
|
17310
|
+
...settings.openaiProvider === "azure" ? {} : { store: false },
|
|
17362
17311
|
...options.promptCacheKey ? { providerData: { prompt_cache_key: options.promptCacheKey } } : {}
|
|
17363
17312
|
},
|
|
17364
17313
|
tools: [],
|
|
17365
17314
|
toolsExplicitlyProvided: true,
|
|
17366
17315
|
outputType: "text",
|
|
17367
17316
|
handoffs: [],
|
|
17368
|
-
tracing: false
|
|
17369
|
-
...options.signal ? { signal: options.signal } : {}
|
|
17317
|
+
tracing: false
|
|
17370
17318
|
};
|
|
17371
17319
|
let response;
|
|
17372
17320
|
try {
|
|
@@ -24218,7 +24166,6 @@ export {
|
|
|
24218
24166
|
serializedRunStateHasOpaqueProviderArtifact,
|
|
24219
24167
|
COMPACTION_SUMMARY_MARKER,
|
|
24220
24168
|
SUMMARY_BUFFER_TOKENS,
|
|
24221
|
-
compactionSummaryOutputTokens,
|
|
24222
24169
|
COMPACT_USER_MESSAGE_MAX_TOKENS,
|
|
24223
24170
|
REMOTE_V2_RETAINED_MESSAGE_TOKEN_BUDGET,
|
|
24224
24171
|
REMOTE_COMPACTION_V2_IMPLEMENTATION,
|
|
@@ -24473,4 +24420,4 @@ export {
|
|
|
24473
24420
|
runAzureCliLoginHook,
|
|
24474
24421
|
renderSessionGoalContext2 as renderSessionGoalContext
|
|
24475
24422
|
};
|
|
24476
|
-
//# sourceMappingURL=chunk-
|
|
24423
|
+
//# sourceMappingURL=chunk-LL2YQO5H.js.map
|