@ponythewhite/base-context 1.0.6 → 1.0.8
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/CHANGELOG.md +25 -0
- package/dist/base-context-runtime/pyproject.toml +1 -1
- package/dist/base-context-runtime/src/rlm/__init__.py +3 -0
- package/dist/base-context-runtime/src/rlm/harness.py +86 -48
- package/dist/base-context-runtime/test/test_harness.py +215 -140
- package/dist/base-context-runtime/uv.lock +1 -1
- package/dist/build-info.json +1 -1
- package/dist/bundle/amazon-bedrock.js +3 -3
- package/dist/bundle/{anthropic-UV5GZDGU.js → anthropic-5PSCZEER.js} +2 -7
- package/dist/bundle/{azure-openai-responses-WSNPXLYC.js → azure-openai-responses-AYTLJR33.js} +2 -2
- package/dist/bundle/{bundled-modules-MEACET4U.js → bundled-modules-IGMJH2MU.js} +5 -5
- package/dist/bundle/{chunk-UPVDERMD.js → chunk-2IPDSTDR.js} +11 -9
- package/dist/bundle/chunk-D3KOF57W.js +22040 -0
- package/dist/bundle/{chunk-QKI6KEGP.js → chunk-EXEFSSF4.js} +1509 -577
- package/dist/bundle/{chunk-VSIYFWYI.js → chunk-KT2BNEPE.js} +21 -8
- package/dist/bundle/{chunk-KTNETTHI.js → chunk-Q3MBSBEB.js} +3 -101
- package/dist/bundle/{chunk-LFPWHI42.js → chunk-QKIFBA7N.js} +2 -2
- package/dist/bundle/{chunk-LIZVVGHR.js → chunk-RVJVXZCS.js} +13 -10
- package/dist/bundle/{cli-main-ANUJY7Y4.js → cli-main-BUK7QTHO.js} +4 -4
- package/dist/bundle/cli.js +1 -1
- package/dist/bundle/{google-T32FMD4G.js → google-HTMCUJ7X.js} +2 -2
- package/dist/bundle/{google-vertex-56KP6I3B.js → google-vertex-ZQO65AXF.js} +2 -2
- package/dist/bundle/{main-4GIKOHIT.js → main-2FWHT2WZ.js} +5 -5
- package/dist/bundle/{mistral-WGBMYIVU.js → mistral-SB7LU56G.js} +1 -1
- package/dist/bundle/{openai-codex-responses-PIV2RQ3G.js → openai-codex-responses-5CEW4VN3.js} +53 -27
- package/dist/bundle/{openai-completions-64C3JPR4.js → openai-completions-BAZJQSS2.js} +1 -1
- package/dist/bundle/{openai-responses-UI7RSTDV.js → openai-responses-VHOE427P.js} +48 -5
- package/dist/core/agent-session.d.ts +6 -1
- package/dist/core/agent-session.d.ts.map +1 -1
- package/dist/core/agent-session.js +189 -31
- package/dist/core/agent-session.js.map +1 -1
- package/dist/core/canonical-context.d.ts +8 -0
- package/dist/core/canonical-context.d.ts.map +1 -1
- package/dist/core/canonical-context.js +37 -5
- package/dist/core/canonical-context.js.map +1 -1
- package/dist/core/compaction/compaction.d.ts +2 -2
- package/dist/core/compaction/compaction.d.ts.map +1 -1
- package/dist/core/compaction/compaction.js +31 -13
- package/dist/core/compaction/compaction.js.map +1 -1
- package/dist/core/context-epoch.d.ts +1 -1
- package/dist/core/context-epoch.d.ts.map +1 -1
- package/dist/core/context-epoch.js +20 -12
- package/dist/core/context-epoch.js.map +1 -1
- package/dist/core/extensions/types.d.ts +2 -2
- package/dist/core/extensions/types.d.ts.map +1 -1
- package/dist/core/extensions/types.js.map +1 -1
- package/dist/core/history-index-worker.d.ts.map +1 -1
- package/dist/core/history-index-worker.js +29 -8
- package/dist/core/history-index-worker.js.map +1 -1
- package/dist/core/history-index.d.ts +11 -1
- package/dist/core/history-index.d.ts.map +1 -1
- package/dist/core/history-index.js +2 -1
- package/dist/core/history-index.js.map +1 -1
- package/dist/core/inference-coordinator.d.ts.map +1 -1
- package/dist/core/inference-coordinator.js +110 -13
- package/dist/core/inference-coordinator.js.map +1 -1
- package/dist/core/kernel/bootstrap.d.ts.map +1 -1
- package/dist/core/kernel/bootstrap.js +97 -107
- package/dist/core/kernel/bootstrap.js.map +1 -1
- package/dist/core/kernel/repl-manager.d.ts.map +1 -1
- package/dist/core/kernel/repl-manager.js +11 -0
- package/dist/core/kernel/repl-manager.js.map +1 -1
- package/dist/core/kernel/shared.d.ts +2 -0
- package/dist/core/kernel/shared.d.ts.map +1 -1
- package/dist/core/kernel/shared.js.map +1 -1
- package/dist/core/messages.d.ts.map +1 -1
- package/dist/core/messages.js +4 -1
- package/dist/core/messages.js.map +1 -1
- package/dist/core/prompts/rlm.d.ts.map +1 -1
- package/dist/core/prompts/rlm.js +4 -2
- package/dist/core/prompts/rlm.js.map +1 -1
- package/dist/core/public-context.d.ts.map +1 -1
- package/dist/core/public-context.js +16 -0
- package/dist/core/public-context.js.map +1 -1
- package/dist/core/refinement/refinement.d.ts +19 -5
- package/dist/core/refinement/refinement.d.ts.map +1 -1
- package/dist/core/refinement/refinement.js +90 -35
- package/dist/core/refinement/refinement.js.map +1 -1
- package/dist/core/request-view-selection.d.ts +12 -4
- package/dist/core/request-view-selection.d.ts.map +1 -1
- package/dist/core/request-view-selection.js +242 -100
- package/dist/core/request-view-selection.js.map +1 -1
- package/dist/core/retained-tool-output.d.ts +28 -0
- package/dist/core/retained-tool-output.d.ts.map +1 -0
- package/dist/core/retained-tool-output.js +102 -0
- package/dist/core/retained-tool-output.js.map +1 -0
- package/dist/core/sdk.d.ts.map +1 -1
- package/dist/core/sdk.js +1 -1
- package/dist/core/sdk.js.map +1 -1
- package/dist/core/selective-recovery.d.ts +47 -3
- package/dist/core/selective-recovery.d.ts.map +1 -1
- package/dist/core/selective-recovery.js +428 -109
- package/dist/core/selective-recovery.js.map +1 -1
- package/dist/core/session-history-index.d.ts +3 -1
- package/dist/core/session-history-index.d.ts.map +1 -1
- package/dist/core/session-history-index.js +1 -1
- package/dist/core/session-history-index.js.map +1 -1
- package/dist/core/settings-manager.d.ts +5 -0
- package/dist/core/settings-manager.d.ts.map +1 -1
- package/dist/core/settings-manager.js +3 -0
- package/dist/core/settings-manager.js.map +1 -1
- package/dist/core/system-prompt.d.ts +3 -1
- package/dist/core/system-prompt.d.ts.map +1 -1
- package/dist/core/system-prompt.js +3 -3
- package/dist/core/system-prompt.js.map +1 -1
- package/dist/core/task-frame.d.ts +1 -1
- package/dist/core/task-frame.d.ts.map +1 -1
- package/dist/core/task-frame.js +21 -1
- package/dist/core/task-frame.js.map +1 -1
- package/dist/core/task-state-reader.d.ts +10 -2
- package/dist/core/task-state-reader.d.ts.map +1 -1
- package/dist/core/task-state-reader.js +75 -9
- package/dist/core/task-state-reader.js.map +1 -1
- package/dist/core/tools/ipython.d.ts +5 -0
- package/dist/core/tools/ipython.d.ts.map +1 -1
- package/dist/core/tools/ipython.js +59 -17
- package/dist/core/tools/ipython.js.map +1 -1
- package/dist/core/tools/prime-context.d.ts.map +1 -1
- package/dist/core/tools/prime-context.js +1 -1
- package/dist/core/tools/prime-context.js.map +1 -1
- package/dist/core/view-units.d.ts +4 -0
- package/dist/core/view-units.d.ts.map +1 -1
- package/dist/core/view-units.js +28 -19
- package/dist/core/view-units.js.map +1 -1
- package/dist/installer.mjs +98 -77
- package/dist/modes/interactive/components/refinement-outcome-message.d.ts.map +1 -1
- package/dist/modes/interactive/components/refinement-outcome-message.js.map +1 -1
- package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-mode.js +5 -5
- package/dist/modes/interactive/interactive-mode.js.map +1 -1
- package/dist/skills/skill-creator/SKILL.md +18 -1
- package/docs/settings.md +45 -0
- package/docs/skills.md +77 -2
- package/package.json +4 -4
- package/skills/skill-creator/SKILL.md +18 -1
- package/dist/bundle/chunk-W46VZFI6.js +0 -21681
|
@@ -10,7 +10,7 @@ import {
|
|
|
10
10
|
convertResponsesMessages,
|
|
11
11
|
convertResponsesTools,
|
|
12
12
|
processResponsesStream
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-KT2BNEPE.js";
|
|
14
14
|
import "./chunk-NQB5DCFC.js";
|
|
15
15
|
import {
|
|
16
16
|
OpenAI
|
|
@@ -30,9 +30,10 @@ import {
|
|
|
30
30
|
ProviderAttemptTracker,
|
|
31
31
|
clampThinkingLevel,
|
|
32
32
|
formatStreamFailureMessage,
|
|
33
|
+
openAIVisibleInput,
|
|
33
34
|
recordStreamFailure,
|
|
34
35
|
streamFailureFromStopReason
|
|
35
|
-
} from "./chunk-
|
|
36
|
+
} from "./chunk-D3KOF57W.js";
|
|
36
37
|
import "./chunk-BAWSWWEU.js";
|
|
37
38
|
|
|
38
39
|
// ../ai/src/providers/openai-responses.ts
|
|
@@ -81,6 +82,7 @@ var streamOpenAIResponses = (model, context, options) => {
|
|
|
81
82
|
const cacheRetention = resolveCacheRetention(options?.cacheRetention);
|
|
82
83
|
const cacheSessionId = cacheRetention === "none" ? void 0 : options?.sessionId;
|
|
83
84
|
let client = createClient(model, context, apiKey, options?.headers, cacheSessionId);
|
|
85
|
+
const preparationClient = client;
|
|
84
86
|
if (attempts.enabled) {
|
|
85
87
|
client = client.withOptions({});
|
|
86
88
|
client.fetchWithTimeout = attempts.wrapHttp(client.fetchWithTimeout.bind(client));
|
|
@@ -104,7 +106,7 @@ var streamOpenAIResponses = (model, context, options) => {
|
|
|
104
106
|
params = nextParams;
|
|
105
107
|
}
|
|
106
108
|
attempts.configure({ effort: params.reasoning?.effort ?? void 0, serviceTier: params.service_tier });
|
|
107
|
-
if (attempts.hasRequestBudget) {
|
|
109
|
+
if (attempts.hasRequestBudget || options?.attempts?.prepareRequest) {
|
|
108
110
|
let pendingPublicBody;
|
|
109
111
|
const body = JSON.stringify(params);
|
|
110
112
|
const serialized = JSON.parse(body);
|
|
@@ -119,7 +121,47 @@ var streamOpenAIResponses = (model, context, options) => {
|
|
|
119
121
|
}
|
|
120
122
|
);
|
|
121
123
|
}
|
|
122
|
-
const
|
|
124
|
+
const canCount = model.provider === "openai" && requestUrl === "https://api.openai.com/v1/responses" && serialized.model === model.id && !serialized.previous_response_id && !serialized.conversation && openAIVisibleInput(model.api, model.provider, JSON.parse(body)) !== void 0;
|
|
125
|
+
const countInput = canCount ? async (request) => {
|
|
126
|
+
const candidate = JSON.parse(request.body);
|
|
127
|
+
if (request.api !== model.api || request.provider !== model.provider || request.url !== requestUrl || request.retainedPrefix || candidate.model !== model.id || candidate.previous_response_id || candidate.conversation || !openAIVisibleInput(model.api, model.provider, candidate))
|
|
128
|
+
throw new Error("Input count requires the supported prepared stateless OpenAI request");
|
|
129
|
+
const countBody = Object.fromEntries(
|
|
130
|
+
[
|
|
131
|
+
"model",
|
|
132
|
+
"input",
|
|
133
|
+
"instructions",
|
|
134
|
+
"tools",
|
|
135
|
+
"text",
|
|
136
|
+
"tool_choice",
|
|
137
|
+
"parallel_tool_calls",
|
|
138
|
+
"personality",
|
|
139
|
+
"reasoning",
|
|
140
|
+
"truncation"
|
|
141
|
+
].filter((key) => candidate[key] !== void 0).map((key) => [key, candidate[key]])
|
|
142
|
+
);
|
|
143
|
+
const countClient = preparationClient.withOptions({ maxRetries: 0 });
|
|
144
|
+
countClient.fetchWithTimeout = attempts.wrapHttp(
|
|
145
|
+
countClient.fetchWithTimeout.bind(countClient),
|
|
146
|
+
"input-count"
|
|
147
|
+
);
|
|
148
|
+
try {
|
|
149
|
+
const result = await countClient.responses.inputTokens.count(countBody, {
|
|
150
|
+
signal: options?.signal,
|
|
151
|
+
...options?.timeoutMs !== void 0 ? { timeout: options.timeoutMs } : {},
|
|
152
|
+
maxRetries: 0
|
|
153
|
+
});
|
|
154
|
+
if (!Number.isSafeInteger(result.input_tokens) || result.input_tokens < 0)
|
|
155
|
+
throw new Error("Invalid provider input token count");
|
|
156
|
+
await attempts.settle("completed");
|
|
157
|
+
options?.signal?.throwIfAborted();
|
|
158
|
+
return result.input_tokens;
|
|
159
|
+
} catch (error) {
|
|
160
|
+
await attempts.settle(options?.signal?.aborted ? "cancelled" : "failed");
|
|
161
|
+
throw error;
|
|
162
|
+
}
|
|
163
|
+
} : void 0;
|
|
164
|
+
const selected = await attempts.prepareRequest({ url: requestUrl, body }, requestProjection, countInput);
|
|
123
165
|
if (options?.attempts?.pendingPublicMessageGroups?.length && (pendingPublicBody === void 0 || selected !== pendingPublicBody))
|
|
124
166
|
throw new Error("Pending original tool groups were not accepted as public");
|
|
125
167
|
params = JSON.parse(selected);
|
|
@@ -218,7 +260,8 @@ function createClient(model, context, apiKey, optionsHeaders, sessionId) {
|
|
|
218
260
|
function buildParams(model, context, requestUrl, options, onProjection) {
|
|
219
261
|
const messages = convertResponsesMessages(model, context, OPENAI_TOOL_CALL_PROVIDERS, {
|
|
220
262
|
onProjection,
|
|
221
|
-
pendingPublicMessageGroups: options?.attempts?.pendingPublicMessageGroups
|
|
263
|
+
pendingPublicMessageGroups: options?.attempts?.pendingPublicMessageGroups,
|
|
264
|
+
responsesMessageIds: options?.attempts?.responsesMessageIds
|
|
222
265
|
});
|
|
223
266
|
const cacheRetention = resolveCacheRetention(options?.cacheRetention);
|
|
224
267
|
const compat = getCompat(model, requestUrl);
|
|
@@ -380,6 +380,7 @@ export declare class AgentSession {
|
|
|
380
380
|
readonly requests: InferenceCoordinator;
|
|
381
381
|
readonly runtimeServices: SessionRuntimeServices;
|
|
382
382
|
private readonly _contextCompiler;
|
|
383
|
+
private _failedAutomaticCompaction?;
|
|
383
384
|
private readonly _contextEpochsEnabled;
|
|
384
385
|
private readonly _initialContextMode;
|
|
385
386
|
private _contextMode;
|
|
@@ -527,6 +528,8 @@ export declare class AgentSession {
|
|
|
527
528
|
private _modelRegistry;
|
|
528
529
|
private _toolRegistry;
|
|
529
530
|
private _nativeRecoveryTools;
|
|
531
|
+
private _nativeRecoveryCursors;
|
|
532
|
+
private _nativeRecoveryCursorSource?;
|
|
530
533
|
private _nativeRecoveryProducer;
|
|
531
534
|
private _toolDefinitions;
|
|
532
535
|
private _toolPromptSnippets;
|
|
@@ -535,6 +538,7 @@ export declare class AgentSession {
|
|
|
535
538
|
private _baseSystemPromptOptions;
|
|
536
539
|
private _assistantTurnsSinceAutoRefine;
|
|
537
540
|
private _lastAutoRefineReviewAt;
|
|
541
|
+
private _lastAutoRefineEvidence?;
|
|
538
542
|
private _autoRefineInProgress;
|
|
539
543
|
private _autoRefineAdmissionClosed;
|
|
540
544
|
private readonly _autoRefineOperations;
|
|
@@ -1082,8 +1086,9 @@ export declare class AgentSession {
|
|
|
1082
1086
|
private _maybeAutoRefine;
|
|
1083
1087
|
private _runApprovedRefine;
|
|
1084
1088
|
private _resolveRefinementModel;
|
|
1089
|
+
private _autoRefineEvidence;
|
|
1085
1090
|
private _reviewAutoRefine;
|
|
1086
|
-
/**
|
|
1091
|
+
/** Merge existing session/global memory with the selected project's workspace memory. */
|
|
1087
1092
|
private _loadMergedHarnessState;
|
|
1088
1093
|
private _loadRefinementHistory;
|
|
1089
1094
|
/**
|