@oh-my-pi/pi-agent-core 18.17.0 → 18.18.1
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.
|
@@ -205,6 +205,8 @@ export declare const AUTO_HANDOFF_THRESHOLD_FOCUS: string;
|
|
|
205
205
|
export interface SummaryOptions {
|
|
206
206
|
promptOverride?: string;
|
|
207
207
|
extraContext?: string[];
|
|
208
|
+
/** Additional summary context fetched only when a compaction request consumes it. */
|
|
209
|
+
loadExtraContext?: () => Promise<string[] | undefined>;
|
|
208
210
|
remoteEndpoint?: string;
|
|
209
211
|
/** Stable system-prompt segments from the live turn, preserved for provider cache reuse. */
|
|
210
212
|
remoteSystemPrompt?: string[];
|
package/dist/types/types.d.ts
CHANGED
|
@@ -1132,8 +1132,15 @@ export interface AgentTool<TParameters extends TSchema = TSchema, TDetails = any
|
|
|
1132
1132
|
*/
|
|
1133
1133
|
approvalCacheTargets?: (args: unknown) => readonly string[] | undefined;
|
|
1134
1134
|
/**
|
|
1135
|
-
*
|
|
1136
|
-
*
|
|
1135
|
+
* Capture per-invocation targets after extension preflight, before final approval and execution.
|
|
1136
|
+
* The coding-agent wrapper calls this once with the final approval args, even without a prompt
|
|
1137
|
+
* or restricted folders. Restriction queries and approval details may then read the binding.
|
|
1138
|
+
*/
|
|
1139
|
+
bindApprovalTargets?: (args: unknown) => void;
|
|
1140
|
+
/**
|
|
1141
|
+
* Query paths a call reads beyond its working directory, matched against restricted folders when
|
|
1142
|
+
* it reports no `approvalCacheTargets`. Never capture bindings here: this also runs before preflight.
|
|
1143
|
+
* Unlike cache targets these paths never key a remembered grant.
|
|
1137
1144
|
*/
|
|
1138
1145
|
approvalRestrictionPaths?: (args: unknown) => readonly string[] | undefined;
|
|
1139
1146
|
/** The main execution callback for this tool. */
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"type": "module",
|
|
3
3
|
"name": "@oh-my-pi/pi-agent-core",
|
|
4
|
-
"version": "18.
|
|
4
|
+
"version": "18.18.1",
|
|
5
5
|
"description": "General-purpose agent with transport abstraction, state management, and attachment support",
|
|
6
6
|
"homepage": "https://omp.sh",
|
|
7
7
|
"author": {
|
|
@@ -38,16 +38,16 @@
|
|
|
38
38
|
"fmt": "oxfmt --no-error-on-unmatched-pattern 'src/**/*.{ts,tsx}' '{test,bench,examples,scripts}/**/*.ts' '*.ts'"
|
|
39
39
|
},
|
|
40
40
|
"dependencies": {
|
|
41
|
-
"@oh-my-pi/pi-ai": "18.
|
|
42
|
-
"@oh-my-pi/pi-catalog": "18.
|
|
43
|
-
"@oh-my-pi/pi-natives": "18.
|
|
44
|
-
"@oh-my-pi/pi-utils": "18.
|
|
45
|
-
"@oh-my-pi/pi-wire": "18.
|
|
46
|
-
"@oh-my-pi/snapcompact": "18.
|
|
41
|
+
"@oh-my-pi/pi-ai": "18.18.1",
|
|
42
|
+
"@oh-my-pi/pi-catalog": "18.18.1",
|
|
43
|
+
"@oh-my-pi/pi-natives": "18.18.1",
|
|
44
|
+
"@oh-my-pi/pi-utils": "18.18.1",
|
|
45
|
+
"@oh-my-pi/pi-wire": "18.18.1",
|
|
46
|
+
"@oh-my-pi/snapcompact": "18.18.1",
|
|
47
47
|
"@opentelemetry/api": "^1.9.1"
|
|
48
48
|
},
|
|
49
49
|
"devDependencies": {
|
|
50
|
-
"@oh-my-pi/omptype": "18.
|
|
50
|
+
"@oh-my-pi/omptype": "18.18.1",
|
|
51
51
|
"@opentelemetry/context-async-hooks": "2.9.0",
|
|
52
52
|
"@opentelemetry/sdk-trace-base": "2.9.0",
|
|
53
53
|
"@types/bun": "^1.3.14"
|
|
@@ -691,6 +691,8 @@ function shouldRetryHandoffWithAutoToolChoice(response: AssistantMessage): boole
|
|
|
691
691
|
export interface SummaryOptions {
|
|
692
692
|
promptOverride?: string;
|
|
693
693
|
extraContext?: string[];
|
|
694
|
+
/** Additional summary context fetched only when a compaction request consumes it. */
|
|
695
|
+
loadExtraContext?: () => Promise<string[] | undefined>;
|
|
694
696
|
remoteEndpoint?: string;
|
|
695
697
|
/** Stable system-prompt segments from the live turn, preserved for provider cache reuse. */
|
|
696
698
|
remoteSystemPrompt?: string[];
|
|
@@ -1781,6 +1783,14 @@ export async function compact(
|
|
|
1781
1783
|
// an outer retry loop multiplies with the inner one (see SummaryOptions).
|
|
1782
1784
|
oneshotRetry: options?.oneshotRetry,
|
|
1783
1785
|
};
|
|
1786
|
+
let extraContextLoaded = false;
|
|
1787
|
+
const ensureExtraContext = async (): Promise<void> => {
|
|
1788
|
+
if (extraContextLoaded || !options?.loadExtraContext) return;
|
|
1789
|
+
const context = await options.loadExtraContext();
|
|
1790
|
+
signal?.throwIfAborted();
|
|
1791
|
+
if (context?.length) summaryOptions.extraContext = [...(summaryOptions.extraContext ?? []), ...context];
|
|
1792
|
+
extraContextLoaded = true;
|
|
1793
|
+
};
|
|
1784
1794
|
|
|
1785
1795
|
// An archive keeps the reasoning policy of the model it was rendered for;
|
|
1786
1796
|
// Claude refuses inputs that reproduce reasoning (issue #6093), so a
|
|
@@ -2214,6 +2224,7 @@ export async function compact(
|
|
|
2214
2224
|
].filter(files => files.after >= filesDueBefore);
|
|
2215
2225
|
if (carried.length > 0) nativeRetainedFiles = carried;
|
|
2216
2226
|
}
|
|
2227
|
+
await ensureExtraContext();
|
|
2217
2228
|
try {
|
|
2218
2229
|
// The live turn's own system prompt, wire tools and transformed
|
|
2219
2230
|
// history when the host can build them: kept thinking remains valid
|
|
@@ -2274,6 +2285,7 @@ export async function compact(
|
|
|
2274
2285
|
if (!usedRemoteCompaction && nativeCompactionError !== undefined && !summaryOptions.remoteEndpoint) {
|
|
2275
2286
|
throw new NativeCompactionError(nativeCompactionError);
|
|
2276
2287
|
}
|
|
2288
|
+
if (!usedRemoteCompaction && nativeSummary === undefined) await ensureExtraContext();
|
|
2277
2289
|
|
|
2278
2290
|
// Generate summaries (can be parallel if both needed) and merge into one
|
|
2279
2291
|
let summary: string;
|
|
@@ -2332,11 +2344,7 @@ export async function compact(
|
|
|
2332
2344
|
|
|
2333
2345
|
const shortSummary = usedRemoteCompaction
|
|
2334
2346
|
? "Remote compaction"
|
|
2335
|
-
: await generateShortSummary(recentMessages, summary, model, reserveTokens, apiKey, signal,
|
|
2336
|
-
...summaryOptions,
|
|
2337
|
-
extraContext: options?.extraContext,
|
|
2338
|
-
thinkingLevel: options?.thinkingLevel,
|
|
2339
|
-
});
|
|
2347
|
+
: await generateShortSummary(recentMessages, summary, model, reserveTokens, apiKey, signal, summaryOptions);
|
|
2340
2348
|
|
|
2341
2349
|
// Compute file lists and append to summary
|
|
2342
2350
|
const { readFiles, modifiedFiles } = snapcompact.computeFileLists(fileOps);
|
package/src/types.ts
CHANGED
|
@@ -1276,8 +1276,16 @@ export interface AgentTool<
|
|
|
1276
1276
|
approvalCacheTargets?: (args: unknown) => readonly string[] | undefined;
|
|
1277
1277
|
|
|
1278
1278
|
/**
|
|
1279
|
-
*
|
|
1280
|
-
*
|
|
1279
|
+
* Capture per-invocation targets after extension preflight, before final approval and execution.
|
|
1280
|
+
* The coding-agent wrapper calls this once with the final approval args, even without a prompt
|
|
1281
|
+
* or restricted folders. Restriction queries and approval details may then read the binding.
|
|
1282
|
+
*/
|
|
1283
|
+
bindApprovalTargets?: (args: unknown) => void;
|
|
1284
|
+
|
|
1285
|
+
/**
|
|
1286
|
+
* Query paths a call reads beyond its working directory, matched against restricted folders when
|
|
1287
|
+
* it reports no `approvalCacheTargets`. Never capture bindings here: this also runs before preflight.
|
|
1288
|
+
* Unlike cache targets these paths never key a remembered grant.
|
|
1281
1289
|
*/
|
|
1282
1290
|
approvalRestrictionPaths?: (args: unknown) => readonly string[] | undefined;
|
|
1283
1291
|
|