pi-agent-ide 0.7.1 → 0.7.2
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 +37 -0
- package/dist/chunk-6U5OU77O.js +3 -0
- package/dist/chunk-EURHXLN3.js +2 -0
- package/dist/{chunk-WMO6RNE2.js → chunk-F6IWZKOG.js} +6 -6
- package/dist/{chunk-HZEY4GT4.js → chunk-H445SHSJ.js} +2 -2
- package/dist/chunk-IG56UGSO.js +2 -0
- package/dist/chunk-IICJXZBU.js +6 -0
- package/dist/{chunk-XYS4FSCC.js → chunk-IM24DB3K.js} +1 -1
- package/dist/{chunk-PKKDDIWW.js → chunk-KOVPDKSJ.js} +1 -1
- package/dist/chunk-MXLSGMRZ.js +3 -0
- package/dist/chunk-OB46OPMZ.js +1 -0
- package/dist/chunk-PKSQT6TC.js +1 -0
- package/dist/{chunk-PNU3E7IO.js → chunk-Q6CZ6GBR.js} +2 -2
- package/dist/chunk-QUYXINGZ.js +7 -0
- package/dist/{chunk-OMVRLWMX.js → chunk-SBP3ABH4.js} +1 -1
- package/dist/{chunk-4GCWGE2C.js → chunk-SJ4UZ4GU.js} +1 -1
- package/dist/{chunk-2TRHFMCZ.js → chunk-SNF7PDDX.js} +1 -1
- package/dist/{chunk-YP46DVVP.js → chunk-STBJO3Z3.js} +1 -1
- package/dist/{chunk-76ZK5ODR.js → chunk-TQGE7RH6.js} +13 -13
- package/dist/{chunk-LEEQIQ7D.js → chunk-XDG7EQRN.js} +6 -6
- package/dist/chunk-YWQS33DF.js +1 -0
- package/dist/chunk-ZIWPKIBZ.js +1 -0
- package/dist/entry-11.js +1 -1
- package/dist/entry-13.js +1 -1
- package/dist/entry-14.js +1 -1
- package/dist/entry-15.js +1 -1
- package/dist/entry-17.js +1 -1
- package/dist/entry-25.js +1 -1
- package/dist/entry-26.js +1 -1
- package/dist/entry-27.js +1 -1
- package/dist/entry-28.js +1 -1
- package/dist/entry-29.js +1 -1
- package/dist/entry-31.js +13 -12
- package/dist/entry-33.js +2 -1
- package/dist/entry-37.js +2 -2
- package/dist/entry-42.js +1 -1
- package/dist/entry-44.js +1 -1
- package/dist/entry-45.js +20 -12
- package/dist/entry-46.js +1 -1
- package/dist/entry-49.js +1 -1
- package/dist/entry-50.js +1 -1
- package/dist/entry-51.js +7 -6
- package/dist/entry-52.js +1 -1
- package/dist/entry-53.js +1 -1
- package/dist/entry-54.js +1 -1
- package/dist/entry-56.js +1 -1
- package/dist/entry-58.js +1 -1
- package/dist/entry-60.js +1 -1
- package/dist/entry-62.js +1 -1
- package/dist/entry-65.js +1 -1
- package/dist/entry-66.js +1 -1
- package/dist/entry-68.js +1 -1
- package/dist/entry-70.js +1 -1
- package/dist/entry-75.js +1 -1
- package/dist/entry-77.js +51 -42
- package/dist/entry-78.js +14 -14
- package/dist/entry-79.js +1 -1
- package/dist/entry-82.js +5 -5
- package/dist/entry-83.js +1 -1
- package/dist/entry-84.js +1 -1
- package/dist/entry-85.js +1 -1
- package/dist/entry-86.js +1 -1
- package/dist/pi-agent-ide.js +34 -11
- package/docs/agent-guides/editing.md +5 -5
- package/docs/agent-guides/git-changes.md +10 -0
- package/docs/agent-guides/read-resources.md +9 -46
- package/docs/agent-guides/search-code.md +7 -1
- package/docs/agent-guides/select-code.md +1 -0
- package/docs/agent-guides/terminal.md +9 -1
- package/docs/configuration.md +1 -1
- package/docs/releases.md +4 -0
- package/docs/research/native-codemode-batch-decision.md +2 -0
- package/docs/structured-results.md +2 -2
- package/docs/tools.md +10 -2
- package/node_modules/pi-agent-doctor/package.json +1 -1
- package/node_modules/pi-agent-documentation/package.json +1 -1
- package/node_modules/pi-agent-filesystem/package.json +7 -7
- package/node_modules/pi-agent-filesystem-image/package.json +3 -3
- package/node_modules/pi-agent-filesystem-jq/package.json +5 -5
- package/node_modules/pi-agent-filesystem-jq/src/jq.ts +4 -1
- 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 +13 -13
- package/node_modules/pi-agent-ide-ast/src/extension.ts +0 -2
- package/node_modules/pi-agent-ide-ast/src/overflow-handler.ts +2 -2
- package/node_modules/pi-agent-ide-ast/src/search-resolver.ts +0 -3
- package/node_modules/pi-agent-ide-ast/src/select-schema.ts +8 -6
- package/node_modules/pi-agent-ide-ast/src/tool-select.ts +13 -5
- package/node_modules/pi-agent-ide-changes/package.json +8 -8
- package/node_modules/pi-agent-ide-changes/src/tool-index-change.ts +66 -4
- package/node_modules/pi-agent-ide-changes/src/tool-text-undo.ts +8 -11
- 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-ide-lsp/src/search-resolver.ts +0 -1
- 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 +7 -7
- package/node_modules/pi-agent-read/src/api/read-parameters.ts +3 -3
- package/node_modules/pi-agent-read/src/api/tools/read.ts +11 -0
- package/node_modules/pi-agent-read/src/core/extension.ts +1 -1
- package/node_modules/pi-agent-read/src/core/read-core.ts +5 -1
- package/node_modules/pi-agent-read/src/core/tools/read/output-truncation.ts +91 -18
- package/node_modules/pi-agent-read/src/core/tools/read/raw-read.ts +8 -2
- package/node_modules/pi-agent-read/src/core/tools/read/read-renderer.ts +38 -1
- package/node_modules/pi-agent-read/src/core/tools/read/read-result.ts +57 -2
- package/node_modules/pi-agent-read/src/core/tools/tool-read.ts +99 -44
- package/node_modules/pi-agent-resource/package.json +1 -1
- package/node_modules/pi-agent-resource/src/index.ts +1 -0
- package/node_modules/pi-agent-resource/src/result-targets.ts +6 -3
- package/node_modules/{pi-agent-read/src/core/tools/read → pi-agent-resource/src}/temp-resource-store.ts +17 -7
- package/node_modules/pi-agent-search/package.json +5 -5
- package/node_modules/pi-agent-search/src/api/fuzzy.ts +5 -1
- package/node_modules/pi-agent-search/src/api/search-parameters.ts +2 -2
- package/node_modules/pi-agent-search/src/core/extension.ts +2 -1
- package/node_modules/pi-agent-search/src/core/search-core.ts +13 -4
- package/node_modules/pi-agent-search-text/package.json +7 -7
- package/node_modules/pi-agent-search-text/src/resolvers.ts +11 -1
- package/node_modules/pi-agent-search-text/src/scoped-search.ts +1 -1
- package/node_modules/pi-agent-search-text/src/search-presentation.ts +42 -32
- package/node_modules/pi-agent-search-text/src/search-recipe.ts +1 -1
- package/node_modules/pi-agent-search-text/src/search-renderer.ts +6 -0
- package/node_modules/pi-agent-search-text/src/search-result.ts +17 -3
- 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 +9 -9
- package/node_modules/pi-agent-text-editor/src/api/edit-completion.ts +2 -2
- package/node_modules/pi-agent-text-editor/src/api/mutation-result.ts +1 -2
- package/node_modules/pi-agent-text-editor/src/api/native-edit-batch-event.ts +4 -0
- package/node_modules/pi-agent-text-editor/src/api/stale-anchor-message.ts +1 -1
- package/node_modules/pi-agent-text-editor/src/core/diff-tool.ts +54 -12
- package/node_modules/pi-agent-text-editor/src/core/editing-guidelines.ts +1 -1
- package/node_modules/pi-agent-text-editor/src/core/mutation-result/file-mutation-agent-result.ts +35 -6
- package/node_modules/pi-agent-text-editor/src/core/mutation-result/file-mutation-result.ts +19 -1
- package/node_modules/pi-agent-text-editor/src/core/mutation-result-targets.ts +132 -11
- package/node_modules/pi-agent-text-editor/src/core/native-text-edit-batch.ts +232 -151
- package/node_modules/pi-agent-text-editor/src/core/post-edit-scope.ts +34 -10
- package/node_modules/pi-agent-text-editor/src/core/result-input.ts +24 -4
- package/node_modules/pi-agent-text-editor/src/core/result-transfer.ts +7 -2
- package/node_modules/pi-agent-text-editor/src/core/structured-result.ts +14 -13
- package/node_modules/pi-agent-text-editor/src/core/text-change-engine.ts +5 -1
- package/node_modules/pi-agent-text-editor/src/core/text-edit-batch-registrar.ts +152 -22
- package/node_modules/pi-agent-text-editor/src/core/text-edit-batch.ts +4 -0
- package/node_modules/pi-agent-text-editor/src/core/text-editor-core.ts +76 -32
- package/node_modules/pi-agent-text-editor/src/core/text-mutation.ts +381 -187
- package/node_modules/pi-agent-text-editor/src/tools/text-tool-schema-properties.ts +4 -2
- package/node_modules/pi-agent-text-editor/src/tools/tool-text-copy.ts +9 -2
- package/node_modules/pi-agent-text-editor/src/tools/tool-text-delete.ts +9 -4
- package/node_modules/pi-agent-text-editor/src/tools/tool-text-insert.ts +7 -8
- package/node_modules/pi-agent-text-editor/src/tools/tool-text-replace.ts +2 -3
- package/node_modules/pi-agent-text-editor/src/tools/tool-text-write.ts +10 -4
- package/node_modules/pi-agent-text-editor-renderer/package.json +5 -5
- package/node_modules/pi-agent-text-editor-renderer/src/mutation-panel.ts +11 -0
- package/node_modules/pi-agent-text-editor-renderer/src/renderer.ts +54 -5
- package/node_modules/pi-agent-text-editor-renderer/src/status-summary.ts +18 -3
- 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 +7 -7
- package/node_modules/pi-agent-web/src/resolver.ts +11 -13
- 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 +35 -35
- package/src/composite/nested-tool-rendering.ts +64 -6
- package/src/composite/output-limits.ts +125 -0
- package/src/composite/responses-tools.ts +25 -0
- package/src/composite/text-results.ts +158 -7
- package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/package.json +7 -7
- 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-jq/package.json +5 -5
- package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/pi-agent-filesystem-jq/src/jq.ts +4 -1
- 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 +7 -7
- 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 +11 -13
- package/src/extensions/pi-agent-read/package.json +7 -7
- package/src/extensions/pi-agent-read/src/api/read-parameters.ts +3 -3
- package/src/extensions/pi-agent-read/src/api/tools/read.ts +11 -0
- package/src/extensions/pi-agent-read/src/core/extension.ts +1 -1
- package/src/extensions/pi-agent-read/src/core/read-core.ts +5 -1
- package/src/extensions/pi-agent-read/src/core/tools/read/output-truncation.ts +91 -18
- package/src/extensions/pi-agent-read/src/core/tools/read/raw-read.ts +8 -2
- package/src/extensions/pi-agent-read/src/core/tools/read/read-renderer.ts +38 -1
- package/src/extensions/pi-agent-read/src/core/tools/read/read-result.ts +57 -2
- package/src/extensions/pi-agent-read/src/core/tools/tool-read.ts +99 -44
- package/src/extensions/pi-agent-search/package.json +5 -5
- package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/package.json +7 -7
- package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/resolvers.ts +11 -1
- package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/scoped-search.ts +1 -1
- package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/search-presentation.ts +42 -32
- package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/search-recipe.ts +1 -1
- package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/search-renderer.ts +6 -0
- package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/search-result.ts +17 -3
- package/src/extensions/pi-agent-search/src/api/fuzzy.ts +5 -1
- package/src/extensions/pi-agent-search/src/api/search-parameters.ts +2 -2
- package/src/extensions/pi-agent-search/src/core/extension.ts +2 -1
- package/src/extensions/pi-agent-search/src/core/search-core.ts +13 -4
- package/src/extensions/pi-agent-text-editor/package.json +9 -9
- 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-renderer/src/mutation-panel.ts +11 -0
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/src/renderer.ts +54 -5
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/src/status-summary.ts +18 -3
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-stale-anchor/package.json +4 -4
- package/src/extensions/pi-agent-text-editor/src/api/edit-completion.ts +2 -2
- package/src/extensions/pi-agent-text-editor/src/api/mutation-result.ts +1 -2
- package/src/extensions/pi-agent-text-editor/src/api/native-edit-batch-event.ts +4 -0
- package/src/extensions/pi-agent-text-editor/src/api/stale-anchor-message.ts +1 -1
- package/src/extensions/pi-agent-text-editor/src/core/diff-tool.ts +54 -12
- package/src/extensions/pi-agent-text-editor/src/core/editing-guidelines.ts +1 -1
- package/src/extensions/pi-agent-text-editor/src/core/mutation-result/file-mutation-agent-result.ts +35 -6
- package/src/extensions/pi-agent-text-editor/src/core/mutation-result/file-mutation-result.ts +19 -1
- package/src/extensions/pi-agent-text-editor/src/core/mutation-result-targets.ts +132 -11
- package/src/extensions/pi-agent-text-editor/src/core/native-text-edit-batch.ts +232 -151
- package/src/extensions/pi-agent-text-editor/src/core/post-edit-scope.ts +34 -10
- package/src/extensions/pi-agent-text-editor/src/core/result-input.ts +24 -4
- package/src/extensions/pi-agent-text-editor/src/core/result-transfer.ts +7 -2
- package/src/extensions/pi-agent-text-editor/src/core/structured-result.ts +14 -13
- package/src/extensions/pi-agent-text-editor/src/core/text-change-engine.ts +5 -1
- package/src/extensions/pi-agent-text-editor/src/core/text-edit-batch-registrar.ts +152 -22
- package/src/extensions/pi-agent-text-editor/src/core/text-edit-batch.ts +4 -0
- package/src/extensions/pi-agent-text-editor/src/core/text-editor-core.ts +76 -32
- package/src/extensions/pi-agent-text-editor/src/core/text-mutation.ts +381 -187
- package/src/extensions/pi-agent-text-editor/src/tools/text-tool-schema-properties.ts +4 -2
- package/src/extensions/pi-agent-text-editor/src/tools/tool-text-copy.ts +9 -2
- package/src/extensions/pi-agent-text-editor/src/tools/tool-text-delete.ts +9 -4
- package/src/extensions/pi-agent-text-editor/src/tools/tool-text-insert.ts +7 -8
- package/src/extensions/pi-agent-text-editor/src/tools/tool-text-replace.ts +2 -3
- package/src/extensions/pi-agent-text-editor/src/tools/tool-text-write.ts +10 -4
- package/src/pi-agent-ide.ts +11 -0
- package/src/plugins/pi-agent-ide-ast/package.json +13 -13
- package/src/plugins/pi-agent-ide-ast/src/extension.ts +0 -2
- package/src/plugins/pi-agent-ide-ast/src/overflow-handler.ts +2 -2
- package/src/plugins/pi-agent-ide-ast/src/search-resolver.ts +0 -3
- package/src/plugins/pi-agent-ide-ast/src/select-schema.ts +8 -6
- package/src/plugins/pi-agent-ide-ast/src/tool-select.ts +13 -5
- package/src/plugins/pi-agent-ide-changes/package.json +8 -8
- package/src/plugins/pi-agent-ide-changes/src/tool-index-change.ts +66 -4
- package/src/plugins/pi-agent-ide-changes/src/tool-text-undo.ts +8 -11
- package/src/plugins/pi-agent-ide-debugger/index.ts +17 -7
- package/src/plugins/pi-agent-ide-debugger/src/dap-client.ts +5 -0
- package/src/plugins/pi-agent-ide-debugger/src/session-manager.ts +93 -38
- package/src/plugins/pi-agent-ide-diagnostics/src/extension.ts +3 -2
- 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-lsp/src/search-resolver.ts +0 -1
- package/src/plugins/pi-agent-ide-terminal/src/output-limits.ts +3 -3
- package/src/plugins/pi-agent-ide-terminal/src/tools.ts +3 -3
- package/src/plugins/pi-agent-ide-vision/index.ts +1 -0
- package/src/post-edit/gate.ts +13 -2
- package/dist/chunk-4XMY4H4V.js +0 -1
- package/dist/chunk-64M3SQPG.js +0 -3
- package/dist/chunk-CWD4O5PM.js +0 -3
- package/dist/chunk-D3WTDA6V.js +0 -2
- package/dist/chunk-EAZGN5ND.js +0 -7
- package/dist/chunk-GXEGY7GV.js +0 -1
- package/dist/chunk-MBUXFKIW.js +0 -3
- package/dist/chunk-PGIVHICI.js +0 -1
- package/dist/chunk-VMTR74FF.js +0 -2
- package/dist/chunk-WU6ZK6YD.js +0 -1
- package/src/extensions/pi-agent-read/src/core/tools/read/temp-resource-store.ts +0 -105
|
@@ -11,18 +11,20 @@ export function sourcePathProperty(description: string) {
|
|
|
11
11
|
return Type.Optional(Type.String({ description }));
|
|
12
12
|
}
|
|
13
13
|
|
|
14
|
-
/** Build
|
|
15
|
-
export function sourceRangeProperties() {
|
|
14
|
+
/** Build shared source-range selectors, with optional tool-specific descriptions. */
|
|
15
|
+
export function sourceRangeProperties(descriptions: Partial<Record<"start" | "end", string>> = {}) {
|
|
16
16
|
return {
|
|
17
17
|
start: Type.Optional(
|
|
18
18
|
Type.String({
|
|
19
19
|
description:
|
|
20
|
+
descriptions.start ??
|
|
20
21
|
"Anchor or unique exact text. Alone, selects that fragment; a line anchor selects only its line. Omit when path already selects text through a supported resource reference. With end, selects a whole-line range.",
|
|
21
22
|
}),
|
|
22
23
|
),
|
|
23
24
|
end: Type.Optional(
|
|
24
25
|
Type.String({
|
|
25
26
|
description:
|
|
27
|
+
descriptions.end ??
|
|
26
28
|
"Optional anchor or unique exact text. Range includes start's first line through end's last line, even for SEARCH :match. Mixed types allowed; boundaries must be unique, in one file, and forward-ordered. Omit when start already selects the intended content; do not repeat start. The end line is included, not a stopping point before it.",
|
|
27
29
|
}),
|
|
28
30
|
),
|
|
@@ -77,7 +77,11 @@ export const copyMutationTool: TextMutationToolRegistration<typeof copySchema> =
|
|
|
77
77
|
const targetStarts = await context.resolveAnchors("targetStart");
|
|
78
78
|
if (parameters.targetEnd === undefined) {
|
|
79
79
|
const [target, change] = insertionAfterAnchor(context, targetStarts, "targetStart", copied);
|
|
80
|
-
return {
|
|
80
|
+
return {
|
|
81
|
+
edits: new Map([
|
|
82
|
+
[target, { changes: [{ ...change, allowUnchanged: true }], action: "edited" }],
|
|
83
|
+
]),
|
|
84
|
+
};
|
|
81
85
|
}
|
|
82
86
|
|
|
83
87
|
const targetEnds = await context.resolveAnchors("targetEnd");
|
|
@@ -92,7 +96,10 @@ export const copyMutationTool: TextMutationToolRegistration<typeof copySchema> =
|
|
|
92
96
|
edits: new Map([
|
|
93
97
|
[
|
|
94
98
|
targetSpan.source,
|
|
95
|
-
{
|
|
99
|
+
{
|
|
100
|
+
changes: [{ ...replaceAnchorSpan(context, targetSpan, copied), allowUnchanged: true }],
|
|
101
|
+
action: "edited",
|
|
102
|
+
},
|
|
96
103
|
],
|
|
97
104
|
]),
|
|
98
105
|
};
|
|
@@ -18,9 +18,13 @@ import type { TextMutationToolRegistration } from "#src/api/mutation-tool.js";
|
|
|
18
18
|
export const deleteSchema = Type.Object(
|
|
19
19
|
{
|
|
20
20
|
path: resultSourceProperty(
|
|
21
|
-
"File path, unchanged source result or its UUID. A result input
|
|
21
|
+
"File path, shell:<session>, debug:<session>, debug:<session>/breakpoint/<id>, unchanged source result or its UUID, or an array of results. An ordinary file path without start/end deletes the file. A text result input removes only selected text and keeps the file, even for a whole-file selection. For Read results from symbol:<file>#<selector>, deletion removes only the declaration text; imports and references are unchanged. Omit start/end for result inputs. Omit path when a supplied text anchor identifies the file.",
|
|
22
22
|
),
|
|
23
|
-
...sourceRangeProperties(
|
|
23
|
+
...sourceRangeProperties({
|
|
24
|
+
start:
|
|
25
|
+
"Anchor or unique exact text locating the text to remove. Without end, exact text selects only that fragment; a line anchor selects its whole line. Omit when path already selects text.",
|
|
26
|
+
end: "Anchor or unique exact text locating the last line to remove. With start, removes whole lines including both boundary lines, even for SEARCH :match anchors. Both boundaries must be unique, in one file, and in forward order. Mixed anchor types are allowed. Omit when start alone selects the intended text.",
|
|
27
|
+
}),
|
|
24
28
|
},
|
|
25
29
|
{ additionalProperties: false },
|
|
26
30
|
);
|
|
@@ -34,9 +38,10 @@ export const deleteMutationTool: TextMutationToolRegistration<typeof deleteSchem
|
|
|
34
38
|
name: "delete",
|
|
35
39
|
wholeFileOperation: "delete",
|
|
36
40
|
description:
|
|
37
|
-
"Use delete to permanently delete
|
|
41
|
+
"Use delete to remove selected text, permanently delete a regular file, terminate a terminal or debugger session, or remove a debugger breakpoint. Whole-file deletion rejects directories and symlinks.",
|
|
38
42
|
|
|
39
|
-
promptSnippet:
|
|
43
|
+
promptSnippet:
|
|
44
|
+
"Delete files or selected text, terminate terminal or debugger sessions, or remove debugger breakpoints",
|
|
40
45
|
parameters: deleteSchema,
|
|
41
46
|
source: { field: "path", inherited: true },
|
|
42
47
|
anchors: [
|
|
@@ -15,30 +15,30 @@ export const insertSchema = Type.Object(
|
|
|
15
15
|
path: Type.Optional(
|
|
16
16
|
Type.String({
|
|
17
17
|
description:
|
|
18
|
-
"
|
|
18
|
+
"Pass a file path, source resource reference, unchanged Read/Search/Select/edit result, or its UUID. Result inputs select only their registered ranges.",
|
|
19
19
|
}),
|
|
20
20
|
),
|
|
21
21
|
anchor: Type.Optional(
|
|
22
22
|
Type.String({
|
|
23
23
|
description:
|
|
24
|
-
"
|
|
24
|
+
"For text edits, use a registered anchor or unique exact text to locate the insertion. Omit anchor when path already supplies the intended selection; otherwise it is required. For live resources, follow the action rules above.",
|
|
25
25
|
}),
|
|
26
26
|
),
|
|
27
27
|
text: Type.String({
|
|
28
28
|
minLength: 1,
|
|
29
29
|
description:
|
|
30
|
-
"
|
|
30
|
+
"For text edits, supply non-empty new text. The tool adds missing line breaks between the insertion and existing text. Add a leading newline only for an intentional blank line, not to start a new line. Payload newlines are kept, with line endings converted to the file's LF/CRLF style. No trailing newline is added at EOF.",
|
|
31
31
|
}),
|
|
32
32
|
separation: Type.Optional(
|
|
33
33
|
Type.Union([Type.Literal("line"), Type.Literal("blank-line")], {
|
|
34
34
|
description:
|
|
35
|
-
"
|
|
35
|
+
"For text edits, defaults to line: separate inserted text from existing lines without adding extra blank lines. Use blank-line to add only missing blank lines between the insertion and existing text.",
|
|
36
36
|
}),
|
|
37
37
|
),
|
|
38
38
|
before: Type.Optional(
|
|
39
39
|
Type.Boolean({
|
|
40
40
|
description:
|
|
41
|
-
"
|
|
41
|
+
"For text edits, defaults to false: insert after the last containing line of each selection. With true, insert before its first containing line. Selected text is kept. Multiple selections on the same insertion line produce one insertion.",
|
|
42
42
|
}),
|
|
43
43
|
),
|
|
44
44
|
},
|
|
@@ -56,10 +56,9 @@ interface InsertParameters {
|
|
|
56
56
|
export const insertMutationTool: TextMutationToolRegistration<typeof insertSchema> = {
|
|
57
57
|
name: "insert",
|
|
58
58
|
description:
|
|
59
|
-
"Use insert to add new text before or after selected lines while keeping existing text. Insertion is line-based, including for exact-text and SEARCH :match anchors.",
|
|
59
|
+
"Use insert to edit text or act on a live resource. For text edits, add new text before or after selected lines while keeping existing text. Insertion is line-based, including for exact-text and SEARCH :match anchors. An empty result selection makes no changes and is not an error.",
|
|
60
60
|
|
|
61
|
-
promptSnippet:
|
|
62
|
-
"Make precise file edits by inserting text before or after exact matches or anchors",
|
|
61
|
+
promptSnippet: "Insert file text, send terminal keys, or perform debugger actions",
|
|
63
62
|
parameters: insertSchema,
|
|
64
63
|
source: { field: "path", inherited: true },
|
|
65
64
|
anchors: [
|
|
@@ -23,7 +23,7 @@ export const replaceSchema = Type.Object(
|
|
|
23
23
|
...sourceRangeProperties(),
|
|
24
24
|
text: Type.String({
|
|
25
25
|
description:
|
|
26
|
-
"Replacement text. Empty text removes the selection; a whole-line selection removes its lines without inserting a blank line. Adjacent unselected lines are kept.",
|
|
26
|
+
"Replacement text for each selected range. Empty text removes the selection; a whole-line selection removes its lines without inserting a blank line. Adjacent unselected lines are kept.",
|
|
27
27
|
}),
|
|
28
28
|
},
|
|
29
29
|
{ additionalProperties: false },
|
|
@@ -37,8 +37,7 @@ interface ReplaceParameters {
|
|
|
37
37
|
|
|
38
38
|
export const replaceMutationTool: TextMutationToolRegistration<typeof replaceSchema> = {
|
|
39
39
|
name: "replace",
|
|
40
|
-
description:
|
|
41
|
-
"Use replace to change an existing text fragment, an inclusive line range, or every selected search match.",
|
|
40
|
+
description: "Use replace to replace a text fragment or each selected range.",
|
|
42
41
|
|
|
43
42
|
promptSnippet: "Make precise file edits by replacing text using exact matches or anchors",
|
|
44
43
|
parameters: replaceSchema,
|
|
@@ -8,9 +8,12 @@ export const writeSchema = Type.Object(
|
|
|
8
8
|
path: {
|
|
9
9
|
...resultInputSchema,
|
|
10
10
|
description:
|
|
11
|
-
"
|
|
11
|
+
"File path or one whole-file source result. Partial file scopes and multiple files are rejected. Use shell:<session> to send input to a running terminal.",
|
|
12
12
|
},
|
|
13
|
-
content: Type.String({
|
|
13
|
+
content: Type.String({
|
|
14
|
+
description:
|
|
15
|
+
"Complete file contents, or exact terminal input. Terminal input does not add Enter.",
|
|
16
|
+
}),
|
|
14
17
|
},
|
|
15
18
|
{ additionalProperties: false },
|
|
16
19
|
);
|
|
@@ -23,7 +26,7 @@ interface WriteParameters {
|
|
|
23
26
|
export const writeMutationTool: TextMutationToolRegistration<typeof writeSchema> = {
|
|
24
27
|
name: "write",
|
|
25
28
|
description:
|
|
26
|
-
"Use write to create
|
|
29
|
+
"Use write to create or deliberately overwrite a whole file, or send input to a running terminal.",
|
|
27
30
|
|
|
28
31
|
promptSnippet: "Create or overwrite files",
|
|
29
32
|
parameters: writeSchema,
|
|
@@ -34,7 +37,10 @@ export const writeMutationTool: TextMutationToolRegistration<typeof writeSchema>
|
|
|
34
37
|
[
|
|
35
38
|
context.sourceFor("path"),
|
|
36
39
|
{
|
|
37
|
-
changes:
|
|
40
|
+
changes:
|
|
41
|
+
context.sourceDocument.content === parameters.content
|
|
42
|
+
? []
|
|
43
|
+
: [context.sourceDocument.replaceAll(parameters.content)],
|
|
38
44
|
action: "overwritten",
|
|
39
45
|
},
|
|
40
46
|
],
|
package/src/pi-agent-ide.ts
CHANGED
|
@@ -11,6 +11,7 @@ import { createFeatureFlags } from "#src/composite/feature-flags.js";
|
|
|
11
11
|
import { createIdeToolAvailability } from "#src/composite/tool-availability.js";
|
|
12
12
|
import { createNestedIdeRendering } from "#src/composite/nested-tool-rendering.js";
|
|
13
13
|
import { createIdeTextResults } from "#src/composite/text-results.js";
|
|
14
|
+
import { preserveResponsesToolOmission } from "#src/composite/responses-tools.js";
|
|
14
15
|
|
|
15
16
|
import { VERSION } from "@earendil-works/pi-coding-agent";
|
|
16
17
|
import { getCurrentTools } from "@earendil-works/pi-ai";
|
|
@@ -25,6 +26,16 @@ export default async function registerUnifiedPiAgentIde(pi: ExtensionAPI): Promi
|
|
|
25
26
|
const nestedRendering = createNestedIdeRendering(pi);
|
|
26
27
|
const textResults = createIdeTextResults(nestedRendering.api);
|
|
27
28
|
const availability = createIdeToolAvailability(textResults.api);
|
|
29
|
+
pi.on("before_provider_request", (event, context) => {
|
|
30
|
+
if (context.model?.api !== "openai-responses") return;
|
|
31
|
+
const names = new Set(
|
|
32
|
+
pi
|
|
33
|
+
.getAllTools()
|
|
34
|
+
.filter((tool) => tool.namespace?.name.startsWith("ide_"))
|
|
35
|
+
.map((tool) => tool.name),
|
|
36
|
+
);
|
|
37
|
+
return preserveResponsesToolOmission(event.payload, names);
|
|
38
|
+
});
|
|
28
39
|
pi.on("session_start", (event, context) => {
|
|
29
40
|
const restored =
|
|
30
41
|
event.reason === "reload"
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pi-agent-ide-ast",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.2",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"imports": {
|
|
6
6
|
"#src/*": "./src/*"
|
|
@@ -31,17 +31,17 @@
|
|
|
31
31
|
"@tree-sitter-grammars/tree-sitter-toml": "^0.7.0",
|
|
32
32
|
"@tree-sitter-grammars/tree-sitter-yaml": "^0.7.1",
|
|
33
33
|
"cross-spawn": "^7.0.6",
|
|
34
|
-
"pi-agent-doctor": "0.7.
|
|
35
|
-
"pi-agent-documentation": "0.7.
|
|
36
|
-
"pi-agent-invariant": "0.7.
|
|
37
|
-
"pi-agent-read": "0.7.
|
|
38
|
-
"pi-agent-resource": "0.7.
|
|
39
|
-
"pi-agent-search": "0.7.
|
|
40
|
-
"pi-agent-search-text": "0.7.
|
|
41
|
-
"pi-agent-text": "0.7.
|
|
42
|
-
"pi-agent-text-editor": "0.7.
|
|
43
|
-
"pi-agent-tool-call-interception": "0.7.
|
|
44
|
-
"pi-agent-tool-ui": "0.7.
|
|
34
|
+
"pi-agent-doctor": "0.7.2",
|
|
35
|
+
"pi-agent-documentation": "0.7.2",
|
|
36
|
+
"pi-agent-invariant": "0.7.2",
|
|
37
|
+
"pi-agent-read": "0.7.2",
|
|
38
|
+
"pi-agent-resource": "0.7.2",
|
|
39
|
+
"pi-agent-search": "0.7.2",
|
|
40
|
+
"pi-agent-search-text": "0.7.2",
|
|
41
|
+
"pi-agent-text": "0.7.2",
|
|
42
|
+
"pi-agent-text-editor": "0.7.2",
|
|
43
|
+
"pi-agent-tool-call-interception": "0.7.2",
|
|
44
|
+
"pi-agent-tool-ui": "0.7.2",
|
|
45
45
|
"tree-sitter-cpp": "^0.23.4",
|
|
46
46
|
"tree-sitter-javascript": "^0.25.0",
|
|
47
47
|
"tree-sitter-json": "^0.24.8",
|
|
@@ -58,7 +58,7 @@
|
|
|
58
58
|
"peerDependencies": {
|
|
59
59
|
"@earendil-works/pi-coding-agent": "*",
|
|
60
60
|
"@earendil-works/pi-tui": "*",
|
|
61
|
-
"pi-agent-ide": "0.7.
|
|
61
|
+
"pi-agent-ide": "0.7.2",
|
|
62
62
|
"typebox": "*"
|
|
63
63
|
},
|
|
64
64
|
"peerDependenciesMeta": {
|
|
@@ -58,8 +58,6 @@ export default async function registerAst(pi: ExtensionAPI): Promise<void> {
|
|
|
58
58
|
api.describe({
|
|
59
59
|
path: "ast:<path> — compact declaration outline for a code file.",
|
|
60
60
|
views: "ast — scope boundaries alongside source text.",
|
|
61
|
-
offset:
|
|
62
|
-
"Oversized code reads may return an outline with source line numbers; offset/limit select a smaller source range.",
|
|
63
61
|
});
|
|
64
62
|
await registerSelect(pi, api);
|
|
65
63
|
},
|
|
@@ -22,8 +22,8 @@ export const reduceAstReadOutput: ReadOutputReducer = async (result, context, bu
|
|
|
22
22
|
if (!isSupportedOutlinePath(source)) return undefined;
|
|
23
23
|
const format = (outline: SourceViewBlock): string =>
|
|
24
24
|
[
|
|
25
|
-
`
|
|
26
|
-
|
|
25
|
+
`Code overview of ${outline.path}, source lines 1-${outline.totalLines}: the requested text exceeded the output limit.`,
|
|
26
|
+
`Some source text is omitted. Read ${JSON.stringify(source)} with offset and limit for exact source text.`,
|
|
27
27
|
...outline.renderedLines.map(
|
|
28
28
|
(line) => `${line.sourceLine?.lineNumber ?? "…"} | ${line.text}`,
|
|
29
29
|
),
|
|
@@ -233,9 +233,6 @@ export function createAstSearchResolver(
|
|
|
233
233
|
|
|
234
234
|
if (result.complete)
|
|
235
235
|
lines.unshift(`SEARCH#${result.sessionId}:all:match selects all exact AST matches.`);
|
|
236
|
-
if (!result.complete) {
|
|
237
|
-
lines.push("Result limit reached.");
|
|
238
|
-
}
|
|
239
236
|
|
|
240
237
|
return {
|
|
241
238
|
content: [{ type: "text", text: lines.join("\n") }],
|
|
@@ -211,7 +211,7 @@ const structuralOperationSchema = Type.Union([
|
|
|
211
211
|
{
|
|
212
212
|
additionalProperties: false,
|
|
213
213
|
description:
|
|
214
|
-
"Select an exact direct JS/TS call argument or parenthesized function parameter. inside keeps the element; around includes owned comma/whitespace.
|
|
214
|
+
"Select an exact direct JS/TS call argument or parenthesized function parameter. inside keeps the element; around includes owned comma/whitespace. around includes the following gap; the last element without a trailing comma includes the preceding gap, and an only element includes the whole list interior. Adjacent boundary comments reject around. No destination syntax repair.",
|
|
215
215
|
},
|
|
216
216
|
),
|
|
217
217
|
Type.Object(
|
|
@@ -289,11 +289,13 @@ export const selectSchema = Type.Object(
|
|
|
289
289
|
description:
|
|
290
290
|
"File path, unchanged Read/Search/Select/edit result, its UUID, or an array of such results. Pass the whole result; do not rebuild it from preview text.",
|
|
291
291
|
},
|
|
292
|
-
operation: Type.Union(
|
|
293
|
-
structuralOperationSchema,
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
292
|
+
operation: Type.Union(
|
|
293
|
+
[structuralOperationSchema, textOperationSchema, geometryOperationSchema],
|
|
294
|
+
{
|
|
295
|
+
description:
|
|
296
|
+
"Choose a text, syntax or range-set operation. Text operations apply separately to each input region; range/lines require one source. Use UTF-16 bounds that do not split surrogate pairs or CRLF. Range-set operations match sources and snapshots, not array positions.",
|
|
297
|
+
},
|
|
298
|
+
),
|
|
297
299
|
},
|
|
298
300
|
{ additionalProperties: false },
|
|
299
301
|
);
|
|
@@ -25,17 +25,22 @@ import {
|
|
|
25
25
|
/** Show selected text and opaque item references, never the internal selection record. */
|
|
26
26
|
function selectionText(data: SelectionData): string {
|
|
27
27
|
const rows = [`${data.totalItems} selection(s)${data.complete ? "" : " · incomplete input"}`];
|
|
28
|
-
if (data.
|
|
28
|
+
if (!data.complete)
|
|
29
|
+
rows.push("Obtain complete source selections before checking absence or editing.");
|
|
30
|
+
if (data.missingInputs) rows.push(`${data.missingInputs} input range(s) produced no selection`);
|
|
29
31
|
for (const item of data.items) {
|
|
30
32
|
const range = item.range;
|
|
31
33
|
rows.push(
|
|
32
34
|
`${item.target} ${item.source}:${range.startLine}:${range.startColumn}–${range.endLine}:${range.endColumn}${item.syntax ? ` ${item.syntax.object}${item.syntax.part ? `/${item.syntax.part}` : ""}` : ""}`,
|
|
33
35
|
item.preview,
|
|
34
36
|
);
|
|
37
|
+
if (range.startLine === range.endLine && range.startColumn === range.endColumn)
|
|
38
|
+
rows.push("Zero-width position; no text selected.");
|
|
35
39
|
if (item.textTruncated)
|
|
36
|
-
rows.push("… preview shortened; reference
|
|
40
|
+
rows.push("… preview shortened; pass this item reference to consume the full selection");
|
|
37
41
|
}
|
|
38
|
-
if (data.truncated)
|
|
42
|
+
if (data.truncated)
|
|
43
|
+
rows.push("… more selections retained; pass the whole result to consume all selections");
|
|
39
44
|
return rows.join("\n");
|
|
40
45
|
}
|
|
41
46
|
|
|
@@ -128,7 +133,7 @@ export async function registerSelect(pi: ExtensionAPI, read: ReadPluginApi): Pro
|
|
|
128
133
|
openWorldHint: false,
|
|
129
134
|
},
|
|
130
135
|
description:
|
|
131
|
-
"Use select to derive
|
|
136
|
+
"Use select to derive text ranges or positions, navigate JavaScript/TypeScript constructs and their parts (without JSX/TSX), and combine source-local selections. Pass the returned result or an item reference to Read, Search or an edit tool. Select does not change files.",
|
|
132
137
|
promptSnippet:
|
|
133
138
|
"Derive text and AST boundaries, navigate constructs and combine source-range sets",
|
|
134
139
|
promptGuidelines: [
|
|
@@ -252,7 +257,10 @@ export async function registerSelect(pi: ExtensionAPI, read: ReadPluginApi): Pro
|
|
|
252
257
|
return withStructuredResult<ResultPanelModel | undefined, never>(
|
|
253
258
|
{
|
|
254
259
|
content: [
|
|
255
|
-
{
|
|
260
|
+
{
|
|
261
|
+
type: "text",
|
|
262
|
+
text: `${error instanceof Error ? error.message : String(error)}\nResolve the reported error before retrying. Do not treat a failed selection as an empty result.`,
|
|
263
|
+
},
|
|
256
264
|
],
|
|
257
265
|
details: undefined,
|
|
258
266
|
},
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pi-agent-ide-changes",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.2",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"imports": {
|
|
6
6
|
"#src/*": "./src/*"
|
|
@@ -13,13 +13,13 @@
|
|
|
13
13
|
},
|
|
14
14
|
"dependencies": {
|
|
15
15
|
"diff": "^9.0.0",
|
|
16
|
-
"pi-agent-doctor": "0.7.
|
|
17
|
-
"pi-agent-documentation": "0.7.
|
|
18
|
-
"pi-agent-invariant": "0.7.
|
|
19
|
-
"pi-agent-read": "0.7.
|
|
20
|
-
"pi-agent-resource": "0.7.
|
|
21
|
-
"pi-agent-text": "0.7.
|
|
22
|
-
"pi-agent-text-editor": "0.7.
|
|
16
|
+
"pi-agent-doctor": "0.7.2",
|
|
17
|
+
"pi-agent-documentation": "0.7.2",
|
|
18
|
+
"pi-agent-invariant": "0.7.2",
|
|
19
|
+
"pi-agent-read": "0.7.2",
|
|
20
|
+
"pi-agent-resource": "0.7.2",
|
|
21
|
+
"pi-agent-text": "0.7.2",
|
|
22
|
+
"pi-agent-text-editor": "0.7.2"
|
|
23
23
|
},
|
|
24
24
|
"pi": {
|
|
25
25
|
"extensions": [
|
|
@@ -45,6 +45,22 @@ export const indexChangeSchema = Type.Object(
|
|
|
45
45
|
{ additionalProperties: false },
|
|
46
46
|
);
|
|
47
47
|
|
|
48
|
+
const unstageChangeSchema = Type.Object(
|
|
49
|
+
{
|
|
50
|
+
file: {
|
|
51
|
+
...indexChangeSchema.properties.file,
|
|
52
|
+
description:
|
|
53
|
+
"Path to a tracked text file in the current Git worktree. Relative paths resolve from the workspace.",
|
|
54
|
+
},
|
|
55
|
+
change: {
|
|
56
|
+
...indexChangeSchema.properties.change,
|
|
57
|
+
description:
|
|
58
|
+
'Select one complete current CHANGE#HASH anchor returned by read with views: ["changes"].',
|
|
59
|
+
},
|
|
60
|
+
},
|
|
61
|
+
{ additionalProperties: false },
|
|
62
|
+
);
|
|
63
|
+
|
|
48
64
|
interface IndexChangeToolDetails {
|
|
49
65
|
readonly action: ChangeIndexAction;
|
|
50
66
|
readonly change: string;
|
|
@@ -70,6 +86,24 @@ export function createIndexChangeTool(
|
|
|
70
86
|
) {
|
|
71
87
|
const execute = createIndexChangeExecutor(action, executor, queue);
|
|
72
88
|
const pastTense = action === "stage" ? "Staged" : "Unstaged";
|
|
89
|
+
const parameters =
|
|
90
|
+
action === "stage"
|
|
91
|
+
? {
|
|
92
|
+
...indexChangeSchema,
|
|
93
|
+
properties: {
|
|
94
|
+
file: {
|
|
95
|
+
...indexChangeSchema.properties.file,
|
|
96
|
+
description:
|
|
97
|
+
"Path to the tracked text file, absolute or relative to the current working directory.",
|
|
98
|
+
},
|
|
99
|
+
change: {
|
|
100
|
+
...indexChangeSchema.properties.change,
|
|
101
|
+
description:
|
|
102
|
+
'Use the complete current CHANGE#HASH anchor shown by read with views: ["changes"].',
|
|
103
|
+
},
|
|
104
|
+
},
|
|
105
|
+
}
|
|
106
|
+
: unstageChangeSchema;
|
|
73
107
|
|
|
74
108
|
return defineTool<typeof indexChangeSchema, IndexChangeToolDetails>({
|
|
75
109
|
name: action,
|
|
@@ -87,8 +121,11 @@ export function createIndexChangeTool(
|
|
|
87
121
|
label: action,
|
|
88
122
|
|
|
89
123
|
promptSnippet: `${pastTense.slice(0, -1)} a selected Git change`,
|
|
90
|
-
description:
|
|
91
|
-
|
|
124
|
+
description:
|
|
125
|
+
action === "stage"
|
|
126
|
+
? "Use stage to add one selected Git change to the index without changing the worktree file."
|
|
127
|
+
: "Use unstage to remove one selected Git change from the index. Worktree content is kept.",
|
|
128
|
+
parameters,
|
|
92
129
|
outputSchema: indexOutputSchema,
|
|
93
130
|
async execute(_toolCallId, parameters, signal, _onUpdate, context) {
|
|
94
131
|
try {
|
|
@@ -148,7 +185,11 @@ export function createIndexChangeExecutor(
|
|
|
148
185
|
const creation = await ChangeService.create(executor, context.cwd, signal);
|
|
149
186
|
|
|
150
187
|
if (creation.status !== "ready") {
|
|
151
|
-
throw new Error(
|
|
188
|
+
throw new Error(
|
|
189
|
+
action === "stage"
|
|
190
|
+
? `Cannot stage ${parameters.file}: ${creation.message}`
|
|
191
|
+
: creation.message,
|
|
192
|
+
);
|
|
152
193
|
}
|
|
153
194
|
|
|
154
195
|
const result = await creation.service.changeIndex(
|
|
@@ -163,10 +204,31 @@ export function createIndexChangeExecutor(
|
|
|
163
204
|
);
|
|
164
205
|
|
|
165
206
|
if (result.status === "unavailable") {
|
|
166
|
-
|
|
207
|
+
if (action === "stage" && result.reason === "stale-selector") {
|
|
208
|
+
throw new Error(
|
|
209
|
+
`${result.message}. Read ${parameters.file} with views: ["changes"] and use a current CHANGE# anchor.`,
|
|
210
|
+
);
|
|
211
|
+
}
|
|
212
|
+
if (action === "stage" && result.reason === "index-write-failed" && !signal?.aborted) {
|
|
213
|
+
throw new Error(
|
|
214
|
+
`${result.message}\nThe index may have changed. Read ${parameters.file} with views: ["changes"] before retrying.`,
|
|
215
|
+
);
|
|
216
|
+
}
|
|
217
|
+
throw new Error(
|
|
218
|
+
action === "stage" && result.reason !== "index-write-failed"
|
|
219
|
+
? `Cannot stage ${parameters.file}: ${result.message}`
|
|
220
|
+
: result.message,
|
|
221
|
+
);
|
|
167
222
|
}
|
|
168
223
|
|
|
169
224
|
if (result.status === "not-applicable") {
|
|
225
|
+
if (action === "stage") {
|
|
226
|
+
const reason =
|
|
227
|
+
result.reason === "clean"
|
|
228
|
+
? "the worktree text matches HEAD"
|
|
229
|
+
: "the file is not present in HEAD";
|
|
230
|
+
throw new Error(`Cannot stage ${parameters.file}: ${reason}.`);
|
|
231
|
+
}
|
|
170
232
|
throw new Error(`${action} is not applicable to ${file}: ${result.reason}`);
|
|
171
233
|
}
|
|
172
234
|
|
|
@@ -15,22 +15,20 @@ export const undoSchema = Type.Object(
|
|
|
15
15
|
file: Type.Optional({
|
|
16
16
|
...resultInputSchema,
|
|
17
17
|
description:
|
|
18
|
-
"File
|
|
18
|
+
"File path or one whole-file source result. Partial and multi-file selections are rejected. Omit file to use the supplied CHANGE anchor's file or the last resolved source.",
|
|
19
|
+
}),
|
|
20
|
+
change: Type.String({
|
|
21
|
+
description:
|
|
22
|
+
'Use a complete current CHANGE#HASH anchor from read with views: ["changes"] to restore that change to HEAD in both worktree and index. Use last to restore the file\'s latest saved text-editor transaction.',
|
|
23
|
+
pattern: "^(?:CHANGE#[0-9A-F]{4,64}|last)$",
|
|
19
24
|
}),
|
|
20
|
-
change: Type.Optional(
|
|
21
|
-
Type.String({
|
|
22
|
-
description:
|
|
23
|
-
"Complete CHANGE#HASH anchor shown by read, or last for this file's latest text-editor transaction",
|
|
24
|
-
pattern: "^(?:CHANGE#[0-9A-F]{4,64}|last)$",
|
|
25
|
-
}),
|
|
26
|
-
),
|
|
27
25
|
},
|
|
28
26
|
{ additionalProperties: false },
|
|
29
27
|
);
|
|
30
28
|
|
|
31
29
|
interface UndoParameters {
|
|
32
30
|
readonly file?: unknown;
|
|
33
|
-
readonly change
|
|
31
|
+
readonly change: string;
|
|
34
32
|
}
|
|
35
33
|
|
|
36
34
|
export function createUndoMutationTool(
|
|
@@ -41,7 +39,7 @@ export function createUndoMutationTool(
|
|
|
41
39
|
return {
|
|
42
40
|
name: "undo",
|
|
43
41
|
description:
|
|
44
|
-
"Use undo to
|
|
42
|
+
"Use undo to restore one selected uncommitted Git change or a file's latest text-editor transaction.",
|
|
45
43
|
|
|
46
44
|
promptSnippet: "Restore a Git change or latest text edit",
|
|
47
45
|
parameters: undoSchema,
|
|
@@ -56,7 +54,6 @@ export function createUndoMutationTool(
|
|
|
56
54
|
},
|
|
57
55
|
],
|
|
58
56
|
async mutate(context, parameters: UndoParameters) {
|
|
59
|
-
if (parameters.change === undefined) throw new Error("change is required");
|
|
60
57
|
const source = context.sourceFor("file");
|
|
61
58
|
let restoredText: string;
|
|
62
59
|
let afterWrite: (() => Promise<void>) | undefined;
|
|
@@ -134,7 +134,8 @@ const debugParameters = Type.Object(
|
|
|
134
134
|
}),
|
|
135
135
|
source: Type.Optional(
|
|
136
136
|
Type.String({
|
|
137
|
-
description:
|
|
137
|
+
description:
|
|
138
|
+
"Source file used for anchored breakpoints. Defaults to program. Relative paths resolve from cwd.",
|
|
138
139
|
}),
|
|
139
140
|
),
|
|
140
141
|
args: Type.Optional(
|
|
@@ -147,7 +148,10 @@ const debugParameters = Type.Object(
|
|
|
147
148
|
}),
|
|
148
149
|
),
|
|
149
150
|
cwd: Type.Optional(
|
|
150
|
-
Type.String({
|
|
151
|
+
Type.String({
|
|
152
|
+
description:
|
|
153
|
+
"Working directory. Defaults to the workspace. Relative paths resolve from the workspace.",
|
|
154
|
+
}),
|
|
151
155
|
),
|
|
152
156
|
},
|
|
153
157
|
{ additionalProperties: false },
|
|
@@ -229,6 +233,11 @@ export default async function registerDebugger(pi: ExtensionAPI): Promise<void>
|
|
|
229
233
|
id: "debugger",
|
|
230
234
|
setup(api) {
|
|
231
235
|
api.addResolver({ resolver: editorResolver });
|
|
236
|
+
api
|
|
237
|
+
.tool("insert")
|
|
238
|
+
.describe(
|
|
239
|
+
'For debug:<session>, omit anchor and put start, continue, step over, step into, step out, or evaluate <expression> in text. Evaluate requires a stopped frame. For debug:<session>/source, use a fresh Read/Search line anchor and text "breakpoint"; the result reports pending or verified readiness. These actions do not edit source text.',
|
|
240
|
+
);
|
|
232
241
|
api.tool("insert").addSemanticHandler({
|
|
233
242
|
matches: (input) => matchesDebugInsert(input, manager),
|
|
234
243
|
execute: async (context, input) => {
|
|
@@ -250,7 +259,7 @@ export default async function registerDebugger(pi: ExtensionAPI): Promise<void>
|
|
|
250
259
|
);
|
|
251
260
|
return {
|
|
252
261
|
source: breakpoint.source,
|
|
253
|
-
summary: `Breakpoint ${breakpoint.source}
|
|
262
|
+
summary: `Breakpoint ${breakpoint.source} registered at ${path.relative(session.options.cwd, breakpoint.file)}:${breakpoint.line} (${breakpoint.verified ? "verified" : "pending"}).`,
|
|
254
263
|
data: {
|
|
255
264
|
kind: "debug-breakpoint",
|
|
256
265
|
session: session.source,
|
|
@@ -384,9 +393,9 @@ export default async function registerDebugger(pi: ExtensionAPI): Promise<void>
|
|
|
384
393
|
openWorldHint: false,
|
|
385
394
|
},
|
|
386
395
|
label: "Debug session",
|
|
387
|
-
promptSnippet: "
|
|
396
|
+
promptSnippet: "Configure a local debugger session",
|
|
388
397
|
description:
|
|
389
|
-
"Use debug to
|
|
398
|
+
"Use debug to configure a local debugger session without launching the adapter or program.",
|
|
390
399
|
parameters: debugParameters,
|
|
391
400
|
outputSchema: debugOutputSchema,
|
|
392
401
|
async execute(_toolCallId, input, _signal, _onUpdate, context) {
|
|
@@ -409,7 +418,7 @@ export default async function registerDebugger(pi: ExtensionAPI): Promise<void>
|
|
|
409
418
|
content: [
|
|
410
419
|
{
|
|
411
420
|
type: "text",
|
|
412
|
-
text: `${renderDebugSession(session)}\nSource: ${details.sourceResource}\nBreakpoints: ${details.breakpointsResource}\n\nNext: read ${details.sourceResource} with views ["anchors"], then insert
|
|
421
|
+
text: `${renderDebugSession(session)}\nSource: ${details.sourceResource}\nBreakpoints: ${details.breakpointsResource}\n\nNext: read ${session.source} to inspect the configured session. To set a breakpoint, read ${details.sourceResource} with views ["anchors"], then insert "breakpoint" at an anchor.`,
|
|
413
422
|
},
|
|
414
423
|
],
|
|
415
424
|
details,
|
|
@@ -481,6 +490,7 @@ function createDebugResourceResolver(manager: DebugSessionManager, id: string):
|
|
|
481
490
|
resource: {
|
|
482
491
|
source,
|
|
483
492
|
async read() {
|
|
493
|
+
await manager.refresh(session);
|
|
484
494
|
const sourceFile = manager.sourceFile(source);
|
|
485
495
|
if (sourceFile !== undefined) {
|
|
486
496
|
return [debugSourceContent(sourceFile, await manager.readSource(source))];
|
|
@@ -608,7 +618,7 @@ function renderBreakpointList(session: DebugSession): string {
|
|
|
608
618
|
return [...session.breakpoints.values()]
|
|
609
619
|
.map(
|
|
610
620
|
(breakpoint) =>
|
|
611
|
-
`${breakpoint.verified ? "●" : "○"} ${breakpoint.file}:${breakpoint.line} · ${breakpoint.source}`,
|
|
621
|
+
`${breakpoint.verified ? "●" : "○"} ${breakpoint.file}:${breakpoint.line} · ${breakpoint.source} (${breakpoint.verified ? "verified" : "pending"})`,
|
|
612
622
|
)
|
|
613
623
|
.join("\n");
|
|
614
624
|
}
|