pi-openai-toolkit 0.14.13 → 0.15.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.
- package/README.md +250 -241
- package/README.zh.md +250 -241
- package/config.schema.json +352 -0
- package/docs/configuration.md +176 -0
- package/docs/internals.md +139 -128
- package/package.json +135 -127
- package/src/auto-mode/extension.ts +35 -13
- package/src/config/legacy.ts +717 -0
- package/src/config/migration.ts +100 -0
- package/src/config/notifications.ts +28 -0
- package/src/config/policy.ts +122 -0
- package/src/config/v2.ts +1347 -0
- package/src/config-command.ts +73 -0
- package/src/config.ts +318 -739
- package/src/context-management/tools.ts +353 -347
- package/src/context-management/window-manager.ts +696 -693
- package/src/debug.ts +5 -5
- package/src/deferred-tool-carryover.ts +3 -1
- package/src/extension-runtime.ts +1375 -1329
- package/src/image-generation/extension.ts +14 -18
- package/src/image-generation/protocol.ts +10 -4
- package/src/image-generation/service.ts +9 -3
- package/src/request-context-cache.ts +2 -1
- package/src/types.ts +641 -628
- package/src/web-search/alpha-client.ts +876 -875
- package/src/web-search/extension.ts +529 -523
- package/src/web-search/payload.ts +299 -295
- package/src/web-search/prompt.ts +60 -59
- package/src/web-search/types.ts +144 -144
package/src/debug.ts
CHANGED
|
@@ -10,7 +10,7 @@ import {
|
|
|
10
10
|
type ArtifactSessionInfo,
|
|
11
11
|
type DebugArtifactEnvelope,
|
|
12
12
|
type DebugArtifactKind,
|
|
13
|
-
type
|
|
13
|
+
type DebugConfig,
|
|
14
14
|
type RedactOptions,
|
|
15
15
|
} from "./types";
|
|
16
16
|
|
|
@@ -96,7 +96,7 @@ export function redactValue(value: unknown, options: RedactOptions = {}): unknow
|
|
|
96
96
|
return redactWithKeyPattern(value, SENSITIVE_KEY_RE, options);
|
|
97
97
|
}
|
|
98
98
|
|
|
99
|
-
export function resolveArtifactPaths(settings:
|
|
99
|
+
export function resolveArtifactPaths(settings: DebugConfig, context: ArtifactContext): ArtifactPaths {
|
|
100
100
|
const sessionInfo = toSessionInfo(context);
|
|
101
101
|
const rootDir = settings.artifactRoot.startsWith("~/")
|
|
102
102
|
? path.join(os.homedir(), settings.artifactRoot.slice(2))
|
|
@@ -127,7 +127,7 @@ function selectArtifactDirectory(paths: ArtifactPaths, kind: DebugArtifactKind):
|
|
|
127
127
|
}
|
|
128
128
|
}
|
|
129
129
|
|
|
130
|
-
function shouldWriteArtifact(kind: DebugArtifactKind, settings:
|
|
130
|
+
function shouldWriteArtifact(kind: DebugArtifactKind, settings: DebugConfig): boolean {
|
|
131
131
|
switch (kind) {
|
|
132
132
|
case "provider-request":
|
|
133
133
|
return settings.logProviderPayloads;
|
|
@@ -144,7 +144,7 @@ function shouldWriteArtifact(kind: DebugArtifactKind, settings: CompactionConfig
|
|
|
144
144
|
export function writeDebugArtifact(
|
|
145
145
|
kind: DebugArtifactKind,
|
|
146
146
|
data: unknown,
|
|
147
|
-
settings:
|
|
147
|
+
settings: DebugConfig,
|
|
148
148
|
context: ArtifactContext,
|
|
149
149
|
): string | undefined {
|
|
150
150
|
if (!shouldWriteArtifact(kind, settings)) {
|
|
@@ -196,7 +196,7 @@ export function writeReplayFailureArtifact(
|
|
|
196
196
|
api?: string;
|
|
197
197
|
model?: string;
|
|
198
198
|
},
|
|
199
|
-
settings:
|
|
199
|
+
settings: DebugConfig,
|
|
200
200
|
context: ArtifactContext,
|
|
201
201
|
): string | undefined {
|
|
202
202
|
try {
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { ResponsesCompatibleRequestPayload } from "./runtime";
|
|
2
2
|
import { isDeferredToolCarryover, type DeferredToolCarryoverV1 } from "./types";
|
|
3
|
+
import { LOCAL_WEB_SEARCH_TOOL_NAME, WEB_RUN_TOOL_NAME } from "./web-search/types";
|
|
3
4
|
|
|
4
5
|
type JsonObject = Record<string, unknown>;
|
|
5
6
|
|
|
@@ -223,10 +224,11 @@ export function rewritePayloadWithDeferredToolCarryover(args: {
|
|
|
223
224
|
}
|
|
224
225
|
if (!Array.isArray(args.payload.tools)) return unchanged;
|
|
225
226
|
|
|
227
|
+
// Search routing needs its local callable at the top level on every request.
|
|
226
228
|
const carryoverNames = new Set(
|
|
227
229
|
args.carryover.toolNames
|
|
228
230
|
.map((name) => name.trim())
|
|
229
|
-
.filter((name) => name.length > 0 && name !==
|
|
231
|
+
.filter((name) => name.length > 0 && name !== LOCAL_WEB_SEARCH_TOOL_NAME && name !== WEB_RUN_TOOL_NAME),
|
|
230
232
|
);
|
|
231
233
|
if (carryoverNames.size === 0) return unchanged;
|
|
232
234
|
|