pi-agent-ide 0.5.0 → 0.5.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 +74 -22
- package/assets/gallery/apply-editing.png +0 -0
- package/assets/gallery/debugging.png +0 -0
- package/assets/gallery/read-web.png +0 -0
- package/assets/gallery/search-replace.png +0 -0
- package/assets/gallery/terminal.png +0 -0
- package/assets/gallery/tool-editing.png +0 -0
- package/dist/chunk-7ALCBKCW.js +26 -0
- package/dist/{chunk-ZUMN6U77.js → chunk-IRECDTJG.js} +1 -1
- package/dist/chunk-NZYDMBM6.js +1 -0
- package/dist/chunk-P7XO5CIP.js +2 -0
- package/dist/entry-47.js +10 -10
- package/dist/entry-48.js +1 -1
- package/dist/entry-76.js +3 -1
- package/dist/pi-agent-ide.js +1 -1
- package/docs/development.md +0 -6
- package/node_modules/pi-agent-doctor/package.json +1 -1
- package/node_modules/pi-agent-filesystem/package.json +6 -6
- package/node_modules/pi-agent-filesystem-image/package.json +3 -3
- package/node_modules/pi-agent-filesystem-pdf/package.json +3 -3
- package/node_modules/pi-agent-filesystem-text/package.json +3 -3
- package/node_modules/pi-agent-ide-ast/package.json +9 -9
- package/node_modules/pi-agent-ide-changes/package.json +6 -6
- package/node_modules/pi-agent-ide-formatter/package.json +3 -3
- package/node_modules/pi-agent-ide-languages/package.json +2 -2
- package/node_modules/pi-agent-ide-lint/package.json +7 -7
- package/node_modules/pi-agent-ide-lsp/package.json +9 -9
- package/node_modules/pi-agent-image/package.json +2 -2
- package/node_modules/pi-agent-invariant/package.json +1 -1
- package/node_modules/pi-agent-pdf/package.json +2 -2
- package/node_modules/pi-agent-read/package.json +6 -6
- package/node_modules/pi-agent-resource/package.json +1 -1
- package/node_modules/pi-agent-search/package.json +3 -3
- package/node_modules/pi-agent-search-text/package.json +6 -6
- package/node_modules/pi-agent-search-text/src/resolvers.ts +32 -27
- package/node_modules/pi-agent-search-text/src/search-session.ts +27 -1
- package/node_modules/pi-agent-text/package.json +2 -2
- package/node_modules/pi-agent-text-anchor-constant/package.json +3 -3
- package/node_modules/pi-agent-text-anchor-exact/package.json +3 -3
- package/node_modules/pi-agent-text-anchor-line-hash/package.json +5 -5
- package/node_modules/pi-agent-text-editor/package.json +8 -8
- package/node_modules/pi-agent-text-editor-renderer/package.json +5 -5
- package/node_modules/pi-agent-text-editor-stale-anchor/package.json +4 -4
- package/node_modules/pi-agent-tool-call-interception/package.json +2 -2
- package/node_modules/pi-agent-tool-ui/package.json +1 -1
- package/node_modules/pi-agent-web/package.json +6 -6
- package/node_modules/pi-agent-web/src/resolver.ts +128 -1
- package/node_modules/pi-agent-web-html/package.json +2 -2
- package/node_modules/pi-agent-web-image/package.json +3 -3
- package/node_modules/pi-agent-web-pdf/package.json +3 -3
- package/node_modules/pi-agent-web-text/package.json +3 -3
- package/package.json +34 -34
- package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/package.json +6 -6
- package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/pi-agent-filesystem-image/package.json +3 -3
- package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/pi-agent-filesystem-pdf/package.json +3 -3
- package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/pi-agent-filesystem-text/package.json +3 -3
- package/src/extensions/pi-agent-read/extensions/pi-agent-web/package.json +6 -6
- package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-html/package.json +2 -2
- package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-image/package.json +3 -3
- package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-pdf/package.json +3 -3
- package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-text/package.json +3 -3
- package/src/extensions/pi-agent-read/extensions/pi-agent-web/src/resolver.ts +128 -1
- package/src/extensions/pi-agent-read/package.json +6 -6
- package/src/extensions/pi-agent-search/package.json +3 -3
- package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/package.json +6 -6
- package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/resolvers.ts +32 -27
- package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/search-session.ts +27 -1
- package/src/extensions/pi-agent-text-editor/package.json +8 -8
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-constant/package.json +3 -3
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-exact/package.json +3 -3
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-line-hash/package.json +5 -5
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/package.json +5 -5
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-stale-anchor/package.json +4 -4
- package/src/plugins/pi-agent-ide-ast/package.json +9 -9
- package/src/plugins/pi-agent-ide-changes/package.json +6 -6
- package/src/plugins/pi-agent-ide-debugger/index.ts +1 -1
- package/src/plugins/pi-agent-ide-formatter/package.json +3 -3
- package/src/plugins/pi-agent-ide-languages/package.json +2 -2
- package/src/plugins/pi-agent-ide-lint/package.json +7 -7
- package/src/plugins/pi-agent-ide-lsp/package.json +9 -9
- package/src/plugins/pi-agent-ide-processes/src/registry.ts +2 -0
- package/src/plugins/pi-agent-ide-processes/src/ui.ts +10 -2
- package/src/plugins/pi-agent-ide-terminal/index.ts +1 -1
- package/src/plugins/pi-agent-ide-terminal/src/process-provider.ts +1 -0
- package/src/plugins/pi-agent-ide-terminal/src/search.ts +32 -2
- package/src/plugins/pi-agent-ide-terminal/src/session-manager.ts +4 -4
- package/src/plugins/pi-agent-ide-terminal/src/tools.ts +2 -2
- package/src/plugins/pi-agent-ide-terminal/src/types.ts +2 -1
- package/src/plugins/pi-agent-ide-terminal/src/ui.ts +1 -1
- package/dist/chunk-BGUSBUUD.js +0 -26
- package/dist/chunk-QH4ZUDOD.js +0 -1
- package/dist/chunk-ZG2MWXCR.js +0 -2
- package/docs/evaluation.md +0 -14
|
@@ -133,6 +133,14 @@ function normalizeRecipe(recipe: SearchRecipe, cwd: string): Record<string, unkn
|
|
|
133
133
|
};
|
|
134
134
|
}
|
|
135
135
|
|
|
136
|
+
/** Indicates that search output is still displayable, but no stable anchors can be registered. */
|
|
137
|
+
export class SearchSnapshotChangedError extends Error {
|
|
138
|
+
public constructor(source: string) {
|
|
139
|
+
super(`Search result in ${source} changed before its anchors were registered.`);
|
|
140
|
+
this.name = "SearchSnapshotChangedError";
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
|
|
136
144
|
/** Stores search snapshots and resolves the stable anchors emitted for them. */
|
|
137
145
|
export class SearchSessionStore {
|
|
138
146
|
readonly #sessions = new Map<string, StoredSearchSession>();
|
|
@@ -176,6 +184,24 @@ export class SearchSessionStore {
|
|
|
176
184
|
return session;
|
|
177
185
|
}
|
|
178
186
|
|
|
187
|
+
/** Registers anchors when every match still describes the current files. */
|
|
188
|
+
public async registerIfCurrent(
|
|
189
|
+
query: string,
|
|
190
|
+
sourceMatches: readonly TextSearchMatch[],
|
|
191
|
+
complete: boolean,
|
|
192
|
+
cwd: string,
|
|
193
|
+
signal?: AbortSignal,
|
|
194
|
+
recipe?: SearchRecipe,
|
|
195
|
+
refresh?: SearchSelectionRegistration["refresh"],
|
|
196
|
+
): Promise<TextSearchSession | undefined> {
|
|
197
|
+
try {
|
|
198
|
+
return await this.register(query, sourceMatches, complete, cwd, signal, recipe, refresh);
|
|
199
|
+
} catch (error) {
|
|
200
|
+
if (error instanceof SearchSnapshotChangedError) return undefined;
|
|
201
|
+
throw error;
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
|
|
179
205
|
/** Repeats each referenced search once, keeping its original scope, limits and fallback rules. */
|
|
180
206
|
public async observeAfterEdit(
|
|
181
207
|
values: readonly unknown[],
|
|
@@ -506,7 +532,7 @@ async function snapshotContents(
|
|
|
506
532
|
for (const match of matches.filter((candidate) => candidate.source === source)) {
|
|
507
533
|
const line = document.lines[match.lineNumber - 1]?.content;
|
|
508
534
|
if (line !== match.lineText || matchedSourceText(document, match) !== match.matchedText) {
|
|
509
|
-
throw new
|
|
535
|
+
throw new SearchSnapshotChangedError(source);
|
|
510
536
|
}
|
|
511
537
|
}
|
|
512
538
|
contentBySource.set(source, content);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pi-agent-text",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"types": "./src/index.ts",
|
|
6
6
|
"imports": {
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
}
|
|
14
14
|
},
|
|
15
15
|
"dependencies": {
|
|
16
|
-
"pi-agent-resource": "0.5.
|
|
16
|
+
"pi-agent-resource": "0.5.1"
|
|
17
17
|
},
|
|
18
18
|
"peerDependencies": {
|
|
19
19
|
"typebox": "*"
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pi-agent-text-anchor-constant",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"imports": {
|
|
6
6
|
"#src/*": "./src/*"
|
|
7
7
|
},
|
|
8
8
|
"dependencies": {
|
|
9
|
-
"pi-agent-text": "0.5.
|
|
10
|
-
"pi-agent-text-editor": "0.5.
|
|
9
|
+
"pi-agent-text": "0.5.1",
|
|
10
|
+
"pi-agent-text-editor": "0.5.1"
|
|
11
11
|
},
|
|
12
12
|
"pi": {
|
|
13
13
|
"extensions": [
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pi-agent-text-anchor-exact",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"imports": {
|
|
6
6
|
"#src/*": "./src/*"
|
|
@@ -13,8 +13,8 @@
|
|
|
13
13
|
},
|
|
14
14
|
"dependencies": {
|
|
15
15
|
"fast-fuzzy": "1.12.0",
|
|
16
|
-
"pi-agent-text": "0.5.
|
|
17
|
-
"pi-agent-text-editor": "0.5.
|
|
16
|
+
"pi-agent-text": "0.5.1",
|
|
17
|
+
"pi-agent-text-editor": "0.5.1"
|
|
18
18
|
},
|
|
19
19
|
"pi": {
|
|
20
20
|
"extensions": [
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pi-agent-text-anchor-line-hash",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"imports": {
|
|
6
6
|
"#src/*": "./src/*"
|
|
@@ -12,10 +12,10 @@
|
|
|
12
12
|
}
|
|
13
13
|
},
|
|
14
14
|
"dependencies": {
|
|
15
|
-
"pi-agent-invariant": "0.5.
|
|
16
|
-
"pi-agent-read": "0.5.
|
|
17
|
-
"pi-agent-text": "0.5.
|
|
18
|
-
"pi-agent-text-editor": "0.5.
|
|
15
|
+
"pi-agent-invariant": "0.5.1",
|
|
16
|
+
"pi-agent-read": "0.5.1",
|
|
17
|
+
"pi-agent-text": "0.5.1",
|
|
18
|
+
"pi-agent-text-editor": "0.5.1"
|
|
19
19
|
},
|
|
20
20
|
"pi": {
|
|
21
21
|
"extensions": [
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pi-agent-text-editor",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"imports": {
|
|
6
6
|
"#src/*": "./src/*"
|
|
@@ -79,13 +79,13 @@
|
|
|
79
79
|
"fs-extra": "^11.4.0",
|
|
80
80
|
"oxfmt": "0.64.0",
|
|
81
81
|
"partial-json": "^0.1.7",
|
|
82
|
-
"pi-agent-invariant": "0.5.
|
|
83
|
-
"pi-agent-read": "0.5.
|
|
84
|
-
"pi-agent-resource": "0.5.
|
|
85
|
-
"pi-agent-search": "0.5.
|
|
86
|
-
"pi-agent-text": "0.5.
|
|
87
|
-
"pi-agent-tool-call-interception": "0.5.
|
|
88
|
-
"pi-agent-tool-ui": "0.5.
|
|
82
|
+
"pi-agent-invariant": "0.5.1",
|
|
83
|
+
"pi-agent-read": "0.5.1",
|
|
84
|
+
"pi-agent-resource": "0.5.1",
|
|
85
|
+
"pi-agent-search": "0.5.1",
|
|
86
|
+
"pi-agent-text": "0.5.1",
|
|
87
|
+
"pi-agent-tool-call-interception": "0.5.1",
|
|
88
|
+
"pi-agent-tool-ui": "0.5.1",
|
|
89
89
|
"run": "2.1.4",
|
|
90
90
|
"typebox-guard": "npm:typebox@^1.1.38"
|
|
91
91
|
},
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pi-agent-text-editor-renderer",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"imports": {
|
|
6
6
|
"#src/*": "./src/*"
|
|
7
7
|
},
|
|
8
8
|
"dependencies": {
|
|
9
9
|
"diff": "^9.0.0",
|
|
10
|
-
"pi-agent-invariant": "0.5.
|
|
11
|
-
"pi-agent-text-editor": "0.5.
|
|
12
|
-
"pi-agent-tool-call-interception": "0.5.
|
|
13
|
-
"pi-agent-tool-ui": "0.5.
|
|
10
|
+
"pi-agent-invariant": "0.5.1",
|
|
11
|
+
"pi-agent-text-editor": "0.5.1",
|
|
12
|
+
"pi-agent-tool-call-interception": "0.5.1",
|
|
13
|
+
"pi-agent-tool-ui": "0.5.1"
|
|
14
14
|
},
|
|
15
15
|
"pi": {
|
|
16
16
|
"extensions": [
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pi-agent-text-editor-stale-anchor",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"dependencies": {
|
|
6
|
-
"pi-agent-invariant": "0.5.
|
|
7
|
-
"pi-agent-read": "0.5.
|
|
8
|
-
"pi-agent-text-editor": "0.5.
|
|
6
|
+
"pi-agent-invariant": "0.5.1",
|
|
7
|
+
"pi-agent-read": "0.5.1",
|
|
8
|
+
"pi-agent-text-editor": "0.5.1"
|
|
9
9
|
},
|
|
10
10
|
"pi": {
|
|
11
11
|
"extensions": [
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pi-agent-tool-call-interception",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"types": "./src/index.ts",
|
|
6
6
|
"exports": {
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
}
|
|
11
11
|
},
|
|
12
12
|
"dependencies": {
|
|
13
|
-
"pi-agent-tool-ui": "0.5.
|
|
13
|
+
"pi-agent-tool-ui": "0.5.1"
|
|
14
14
|
},
|
|
15
15
|
"peerDependencies": {
|
|
16
16
|
"@earendil-works/pi-coding-agent": "*",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pi-agent-web",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"imports": {
|
|
6
6
|
"#src/*": "./src/*"
|
|
@@ -8,11 +8,11 @@
|
|
|
8
8
|
"dependencies": {
|
|
9
9
|
"defuddle": "^0.19.1",
|
|
10
10
|
"linkedom": "^0.18.12",
|
|
11
|
-
"pi-agent-doctor": "0.5.
|
|
12
|
-
"pi-agent-image": "0.5.
|
|
13
|
-
"pi-agent-read": "0.5.
|
|
14
|
-
"pi-agent-resource": "0.5.
|
|
15
|
-
"pi-agent-text": "0.5.
|
|
11
|
+
"pi-agent-doctor": "0.5.1",
|
|
12
|
+
"pi-agent-image": "0.5.1",
|
|
13
|
+
"pi-agent-read": "0.5.1",
|
|
14
|
+
"pi-agent-resource": "0.5.1",
|
|
15
|
+
"pi-agent-text": "0.5.1",
|
|
16
16
|
"playwright-core": "^1.62.1"
|
|
17
17
|
},
|
|
18
18
|
"pi": {
|
|
@@ -9,6 +9,8 @@ import { type BrowserHtmlLoader, createSystemBrowserHtmlLoader } from "./browser
|
|
|
9
9
|
|
|
10
10
|
type WebContentHost = Pick<ContentHost, "convert">;
|
|
11
11
|
|
|
12
|
+
const BINARY_PREVIEW_BYTES = 4096;
|
|
13
|
+
|
|
12
14
|
/** HTTP timeout, transport, and internal browser fallback settings. */
|
|
13
15
|
export interface WebResolverOptions {
|
|
14
16
|
readonly timeoutMs?: number;
|
|
@@ -115,10 +117,20 @@ async function readWebContent(
|
|
|
115
117
|
throw new Error(`HTTP ${response.status}: ${response.statusText}`);
|
|
116
118
|
}
|
|
117
119
|
|
|
120
|
+
const mediaType = response.headers.get("content-type") ?? undefined;
|
|
121
|
+
if (isUnsupportedBinaryMediaType(mediaType) && !hasSupportedDocumentExtension(url)) {
|
|
122
|
+
const preview = await readBoundedBody(response, BINARY_PREVIEW_BYTES, operation.signal);
|
|
123
|
+
return [
|
|
124
|
+
{
|
|
125
|
+
type: "text",
|
|
126
|
+
text: formatUnsupportedBinaryResponse(url, response, mediaType, preview),
|
|
127
|
+
},
|
|
128
|
+
];
|
|
129
|
+
}
|
|
130
|
+
|
|
118
131
|
const bytes = new Uint8Array(await response.arrayBuffer());
|
|
119
132
|
operation.signal.throwIfAborted();
|
|
120
133
|
const source = response.url.length === 0 ? url.href : response.url;
|
|
121
|
-
const mediaType = response.headers.get("content-type") ?? undefined;
|
|
122
134
|
const input = {
|
|
123
135
|
source,
|
|
124
136
|
bytes,
|
|
@@ -191,6 +203,121 @@ async function loadAndConvertBrowser(
|
|
|
191
203
|
);
|
|
192
204
|
}
|
|
193
205
|
|
|
206
|
+
function isUnsupportedBinaryMediaType(mediaType: string | undefined): boolean {
|
|
207
|
+
if (mediaType === undefined) return false;
|
|
208
|
+
const type = mediaType.split(";", 1)[0]?.trim().toLowerCase() ?? "";
|
|
209
|
+
return !(
|
|
210
|
+
type.startsWith("text/") ||
|
|
211
|
+
type.startsWith("image/") ||
|
|
212
|
+
type === "application/json" ||
|
|
213
|
+
type.endsWith("+json") ||
|
|
214
|
+
type === "application/xml" ||
|
|
215
|
+
type.endsWith("+xml") ||
|
|
216
|
+
type === "application/xhtml+xml" ||
|
|
217
|
+
type === "application/pdf"
|
|
218
|
+
);
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
function hasSupportedDocumentExtension(url: URL): boolean {
|
|
222
|
+
return /\.(?:avif|bmp|gif|jpe?g|pdf|png|webp)$/iu.test(url.pathname);
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
async function readBoundedBody(
|
|
226
|
+
response: Response,
|
|
227
|
+
limit: number,
|
|
228
|
+
signal: AbortSignal,
|
|
229
|
+
): Promise<Uint8Array> {
|
|
230
|
+
if (response.body === null) return new Uint8Array();
|
|
231
|
+
const reader = response.body.getReader();
|
|
232
|
+
const chunks: Uint8Array[] = [];
|
|
233
|
+
let length = 0;
|
|
234
|
+
try {
|
|
235
|
+
while (length < limit) {
|
|
236
|
+
signal.throwIfAborted();
|
|
237
|
+
const part = await reader.read();
|
|
238
|
+
if (part.done) break;
|
|
239
|
+
const remaining = limit - length;
|
|
240
|
+
const chunk = part.value.subarray(0, remaining);
|
|
241
|
+
chunks.push(chunk);
|
|
242
|
+
length += chunk.length;
|
|
243
|
+
if (part.value.length > remaining) break;
|
|
244
|
+
}
|
|
245
|
+
} finally {
|
|
246
|
+
await reader.cancel().catch(() => undefined);
|
|
247
|
+
}
|
|
248
|
+
const preview = new Uint8Array(length);
|
|
249
|
+
let offset = 0;
|
|
250
|
+
for (const chunk of chunks) {
|
|
251
|
+
preview.set(chunk, offset);
|
|
252
|
+
offset += chunk.length;
|
|
253
|
+
}
|
|
254
|
+
return preview;
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
function formatUnsupportedBinaryResponse(
|
|
258
|
+
requestedUrl: URL,
|
|
259
|
+
response: Response,
|
|
260
|
+
mediaType: string | undefined,
|
|
261
|
+
preview: Uint8Array,
|
|
262
|
+
): string {
|
|
263
|
+
const lines = [
|
|
264
|
+
"Binary response",
|
|
265
|
+
`URL: ${requestedUrl.href}`,
|
|
266
|
+
`HTTP: ${response.status} ${response.statusText}`.trimEnd(),
|
|
267
|
+
`Content-Type: ${mediaType ?? "unknown"}`,
|
|
268
|
+
];
|
|
269
|
+
const disposition = response.headers.get("content-disposition");
|
|
270
|
+
const filename = disposition === null ? undefined : attachmentFilename(disposition);
|
|
271
|
+
if (filename !== undefined) lines.push(`Filename: ${filename}`);
|
|
272
|
+
const length = response.headers.get("content-length");
|
|
273
|
+
if (length !== null) lines.push(`Content-Length: ${length}`);
|
|
274
|
+
lines.push("", "Headers:");
|
|
275
|
+
for (const [name, value] of [...response.headers].sort(([left], [right]) =>
|
|
276
|
+
left.localeCompare(right),
|
|
277
|
+
)) {
|
|
278
|
+
if (isSensitiveRedirectHeader(name)) continue;
|
|
279
|
+
lines.push(`${name}: ${value}`);
|
|
280
|
+
}
|
|
281
|
+
lines.push(
|
|
282
|
+
"",
|
|
283
|
+
`Preview: first ${preview.length} bytes (hex); the remaining body was not downloaded`,
|
|
284
|
+
formatHexPreview(preview),
|
|
285
|
+
);
|
|
286
|
+
return lines.join("\n");
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
function attachmentFilename(disposition: string): string | undefined {
|
|
290
|
+
const encoded = /filename\*=UTF-8''([^;]+)/iu.exec(disposition)?.[1];
|
|
291
|
+
if (encoded !== undefined) {
|
|
292
|
+
try {
|
|
293
|
+
return decodeURIComponent(encoded).replaceAll(/[\r\n]/gu, "");
|
|
294
|
+
} catch {
|
|
295
|
+
return encoded.replaceAll(/[\r\n]/gu, "");
|
|
296
|
+
}
|
|
297
|
+
}
|
|
298
|
+
return /filename=(?:"([^"]+)"|([^;]+))/iu.exec(disposition)?.slice(1).find(Boolean)?.trim();
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
function isSensitiveRedirectHeader(name: string): boolean {
|
|
302
|
+
return ["content-location", "link", "location", "refresh", "set-cookie"].includes(
|
|
303
|
+
name.toLowerCase(),
|
|
304
|
+
);
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
function formatHexPreview(bytes: Uint8Array): string {
|
|
308
|
+
if (bytes.length === 0) return "(empty body)";
|
|
309
|
+
const rows: string[] = [];
|
|
310
|
+
for (let offset = 0; offset < bytes.length; offset += 16) {
|
|
311
|
+
const chunk = bytes.subarray(offset, offset + 16);
|
|
312
|
+
const hex = [...chunk].map((byte) => byte.toString(16).padStart(2, "0")).join(" ");
|
|
313
|
+
const text = [...chunk]
|
|
314
|
+
.map((byte) => (byte >= 32 && byte <= 126 ? String.fromCodePoint(byte) : "."))
|
|
315
|
+
.join("");
|
|
316
|
+
rows.push(`${offset.toString(16).padStart(8, "0")} ${hex.padEnd(47)} |${text}|`);
|
|
317
|
+
}
|
|
318
|
+
return rows.join("\n");
|
|
319
|
+
}
|
|
320
|
+
|
|
194
321
|
function isHtml(bytes: Uint8Array, mediaType: string | undefined): boolean {
|
|
195
322
|
const normalizedMediaType = mediaType?.split(";", 1)[0]?.trim().toLowerCase();
|
|
196
323
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pi-agent-web-html",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"imports": {
|
|
6
6
|
"#src/*": "./src/*"
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
"dependencies": {
|
|
9
9
|
"defuddle": "^0.19.1",
|
|
10
10
|
"linkedom": "^0.18.12",
|
|
11
|
-
"pi-agent-resource": "0.5.
|
|
11
|
+
"pi-agent-resource": "0.5.1"
|
|
12
12
|
},
|
|
13
13
|
"pi": {
|
|
14
14
|
"extensions": [
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pi-agent-web-image",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"dependencies": {
|
|
6
|
-
"pi-agent-image": "0.5.
|
|
7
|
-
"pi-agent-resource": "0.5.
|
|
6
|
+
"pi-agent-image": "0.5.1",
|
|
7
|
+
"pi-agent-resource": "0.5.1"
|
|
8
8
|
},
|
|
9
9
|
"pi": {
|
|
10
10
|
"extensions": [
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pi-agent-web-pdf",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"dependencies": {
|
|
6
|
-
"pi-agent-pdf": "0.5.
|
|
7
|
-
"pi-agent-resource": "0.5.
|
|
6
|
+
"pi-agent-pdf": "0.5.1",
|
|
7
|
+
"pi-agent-resource": "0.5.1"
|
|
8
8
|
},
|
|
9
9
|
"pi": {
|
|
10
10
|
"extensions": [
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pi-agent-web-text",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"dependencies": {
|
|
6
|
-
"pi-agent-resource": "0.5.
|
|
7
|
-
"pi-agent-text": "0.5.
|
|
6
|
+
"pi-agent-resource": "0.5.1",
|
|
7
|
+
"pi-agent-text": "0.5.1"
|
|
8
8
|
},
|
|
9
9
|
"pi": {
|
|
10
10
|
"extensions": [
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pi-agent-ide",
|
|
3
|
-
"version": "0.5.
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "0.5.1",
|
|
4
|
+
"description": "IDE capabilities for coding agents in Pi.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"agent-tools",
|
|
7
7
|
"code-editing",
|
|
@@ -137,38 +137,38 @@
|
|
|
137
137
|
"oxfmt": "0.64.0",
|
|
138
138
|
"partial-json": "^0.1.7",
|
|
139
139
|
"pdfjs-dist": "^6.2.108",
|
|
140
|
-
"pi-agent-doctor": "0.5.
|
|
141
|
-
"pi-agent-filesystem": "0.5.
|
|
142
|
-
"pi-agent-filesystem-image": "0.5.
|
|
143
|
-
"pi-agent-filesystem-pdf": "0.5.
|
|
144
|
-
"pi-agent-filesystem-text": "0.5.
|
|
145
|
-
"pi-agent-ide-ast": "0.5.
|
|
146
|
-
"pi-agent-ide-changes": "0.5.
|
|
147
|
-
"pi-agent-ide-formatter": "0.5.
|
|
148
|
-
"pi-agent-ide-languages": "0.5.
|
|
149
|
-
"pi-agent-ide-lint": "0.5.
|
|
150
|
-
"pi-agent-ide-lsp": "0.5.
|
|
151
|
-
"pi-agent-image": "0.5.
|
|
152
|
-
"pi-agent-invariant": "0.5.
|
|
153
|
-
"pi-agent-pdf": "0.5.
|
|
154
|
-
"pi-agent-read": "0.5.
|
|
155
|
-
"pi-agent-resource": "0.5.
|
|
156
|
-
"pi-agent-search": "0.5.
|
|
157
|
-
"pi-agent-search-text": "0.5.
|
|
158
|
-
"pi-agent-text": "0.5.
|
|
159
|
-
"pi-agent-text-anchor-constant": "0.5.
|
|
160
|
-
"pi-agent-text-anchor-exact": "0.5.
|
|
161
|
-
"pi-agent-text-anchor-line-hash": "0.5.
|
|
162
|
-
"pi-agent-text-editor": "0.5.
|
|
163
|
-
"pi-agent-text-editor-renderer": "0.5.
|
|
164
|
-
"pi-agent-text-editor-stale-anchor": "0.5.
|
|
165
|
-
"pi-agent-tool-call-interception": "0.5.
|
|
166
|
-
"pi-agent-tool-ui": "0.5.
|
|
167
|
-
"pi-agent-web": "0.5.
|
|
168
|
-
"pi-agent-web-html": "0.5.
|
|
169
|
-
"pi-agent-web-image": "0.5.
|
|
170
|
-
"pi-agent-web-pdf": "0.5.
|
|
171
|
-
"pi-agent-web-text": "0.5.
|
|
140
|
+
"pi-agent-doctor": "0.5.1",
|
|
141
|
+
"pi-agent-filesystem": "0.5.1",
|
|
142
|
+
"pi-agent-filesystem-image": "0.5.1",
|
|
143
|
+
"pi-agent-filesystem-pdf": "0.5.1",
|
|
144
|
+
"pi-agent-filesystem-text": "0.5.1",
|
|
145
|
+
"pi-agent-ide-ast": "0.5.1",
|
|
146
|
+
"pi-agent-ide-changes": "0.5.1",
|
|
147
|
+
"pi-agent-ide-formatter": "0.5.1",
|
|
148
|
+
"pi-agent-ide-languages": "0.5.1",
|
|
149
|
+
"pi-agent-ide-lint": "0.5.1",
|
|
150
|
+
"pi-agent-ide-lsp": "0.5.1",
|
|
151
|
+
"pi-agent-image": "0.5.1",
|
|
152
|
+
"pi-agent-invariant": "0.5.1",
|
|
153
|
+
"pi-agent-pdf": "0.5.1",
|
|
154
|
+
"pi-agent-read": "0.5.1",
|
|
155
|
+
"pi-agent-resource": "0.5.1",
|
|
156
|
+
"pi-agent-search": "0.5.1",
|
|
157
|
+
"pi-agent-search-text": "0.5.1",
|
|
158
|
+
"pi-agent-text": "0.5.1",
|
|
159
|
+
"pi-agent-text-anchor-constant": "0.5.1",
|
|
160
|
+
"pi-agent-text-anchor-exact": "0.5.1",
|
|
161
|
+
"pi-agent-text-anchor-line-hash": "0.5.1",
|
|
162
|
+
"pi-agent-text-editor": "0.5.1",
|
|
163
|
+
"pi-agent-text-editor-renderer": "0.5.1",
|
|
164
|
+
"pi-agent-text-editor-stale-anchor": "0.5.1",
|
|
165
|
+
"pi-agent-tool-call-interception": "0.5.1",
|
|
166
|
+
"pi-agent-tool-ui": "0.5.1",
|
|
167
|
+
"pi-agent-web": "0.5.1",
|
|
168
|
+
"pi-agent-web-html": "0.5.1",
|
|
169
|
+
"pi-agent-web-image": "0.5.1",
|
|
170
|
+
"pi-agent-web-pdf": "0.5.1",
|
|
171
|
+
"pi-agent-web-text": "0.5.1",
|
|
172
172
|
"playwright-core": "^1.62.1",
|
|
173
173
|
"run": "2.1.4",
|
|
174
174
|
"tree-sitter-cpp": "^0.23.4",
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pi-agent-filesystem",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"imports": {
|
|
6
6
|
"#src/*": "./src/*"
|
|
7
7
|
},
|
|
8
8
|
"dependencies": {
|
|
9
|
-
"pi-agent-image": "0.5.
|
|
10
|
-
"pi-agent-read": "0.5.
|
|
11
|
-
"pi-agent-resource": "0.5.
|
|
12
|
-
"pi-agent-text": "0.5.
|
|
13
|
-
"pi-agent-text-editor": "0.5.
|
|
9
|
+
"pi-agent-image": "0.5.1",
|
|
10
|
+
"pi-agent-read": "0.5.1",
|
|
11
|
+
"pi-agent-resource": "0.5.1",
|
|
12
|
+
"pi-agent-text": "0.5.1",
|
|
13
|
+
"pi-agent-text-editor": "0.5.1"
|
|
14
14
|
},
|
|
15
15
|
"pi": {
|
|
16
16
|
"extensions": [
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pi-agent-filesystem-image",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"imports": {
|
|
6
6
|
"#extension": "./index.ts"
|
|
7
7
|
},
|
|
8
8
|
"dependencies": {
|
|
9
|
-
"pi-agent-image": "0.5.
|
|
10
|
-
"pi-agent-resource": "0.5.
|
|
9
|
+
"pi-agent-image": "0.5.1",
|
|
10
|
+
"pi-agent-resource": "0.5.1"
|
|
11
11
|
},
|
|
12
12
|
"pi": {
|
|
13
13
|
"extensions": [
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pi-agent-filesystem-pdf",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"dependencies": {
|
|
6
|
-
"pi-agent-pdf": "0.5.
|
|
7
|
-
"pi-agent-resource": "0.5.
|
|
6
|
+
"pi-agent-pdf": "0.5.1",
|
|
7
|
+
"pi-agent-resource": "0.5.1"
|
|
8
8
|
},
|
|
9
9
|
"pi": {
|
|
10
10
|
"extensions": [
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pi-agent-filesystem-text",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"imports": {
|
|
6
6
|
"#extension": "./index.ts"
|
|
7
7
|
},
|
|
8
8
|
"dependencies": {
|
|
9
|
-
"pi-agent-resource": "0.5.
|
|
10
|
-
"pi-agent-text": "0.5.
|
|
9
|
+
"pi-agent-resource": "0.5.1",
|
|
10
|
+
"pi-agent-text": "0.5.1"
|
|
11
11
|
},
|
|
12
12
|
"pi": {
|
|
13
13
|
"extensions": [
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pi-agent-web",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"imports": {
|
|
6
6
|
"#src/*": "./src/*"
|
|
@@ -8,11 +8,11 @@
|
|
|
8
8
|
"dependencies": {
|
|
9
9
|
"defuddle": "^0.19.1",
|
|
10
10
|
"linkedom": "^0.18.12",
|
|
11
|
-
"pi-agent-doctor": "0.5.
|
|
12
|
-
"pi-agent-image": "0.5.
|
|
13
|
-
"pi-agent-read": "0.5.
|
|
14
|
-
"pi-agent-resource": "0.5.
|
|
15
|
-
"pi-agent-text": "0.5.
|
|
11
|
+
"pi-agent-doctor": "0.5.1",
|
|
12
|
+
"pi-agent-image": "0.5.1",
|
|
13
|
+
"pi-agent-read": "0.5.1",
|
|
14
|
+
"pi-agent-resource": "0.5.1",
|
|
15
|
+
"pi-agent-text": "0.5.1",
|
|
16
16
|
"playwright-core": "^1.62.1"
|
|
17
17
|
},
|
|
18
18
|
"pi": {
|