@astralyn/pi 1.4.6 → 1.4.7
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 +22 -0
- package/dist/bundle/chunks/{chunk-KDO6L76C.js → chunk-FODCTZXW.js} +4 -4
- package/dist/bundle/chunks/{chunk-EYKC6ESU.js → chunk-FYKNSJG6.js} +1 -1
- package/dist/bundle/chunks/{chunk-AXFWZIHH.js → chunk-MG5XDTXV.js} +1 -1
- package/dist/bundle/chunks/{chunk-ALHAFUHP.js → chunk-PU2IWWXV.js} +1 -1
- package/dist/bundle/chunks/{chunk-5M3YJ54Z.js → chunk-RO2VH6UZ.js} +1 -1
- package/dist/bundle/chunks/{chunk-RBTJBQWX.js → chunk-YJTSOLP2.js} +73 -74
- package/dist/bundle/chunks/{cli-FH77R7JR.js → cli-MEL7SGJD.js} +1 -1
- package/dist/bundle/chunks/{execute-5ZQUS52M.js → execute-4CWRNHPO.js} +1 -1
- package/dist/bundle/chunks/{runtime-R5CMHJ5P.js → runtime-R3X67XMR.js} +1 -1
- package/dist/bundle/chunks/{virtual-modules-KCQU7LOC.js → virtual-modules-PKEOKGYI.js} +1 -1
- package/dist/bundle/cli.js +1 -1
- package/dist/bundle/index.js +1 -1
- package/dist/bundle/rpc-entry.js +1 -1
- package/dist/core/agent-session.d.ts +0 -3
- package/dist/core/agent-session.d.ts.map +1 -1
- package/dist/core/agent-session.js +0 -4
- package/dist/core/agent-session.js.map +1 -1
- package/dist/core/extensions/index.d.ts +1 -1
- package/dist/core/extensions/index.d.ts.map +1 -1
- package/dist/core/extensions/index.js.map +1 -1
- package/dist/core/package-manager.d.ts +7 -1
- package/dist/core/package-manager.d.ts.map +1 -1
- package/dist/core/package-manager.js +72 -1
- package/dist/core/package-manager.js.map +1 -1
- package/dist/core/resource-loader.d.ts +1 -0
- package/dist/core/resource-loader.d.ts.map +1 -1
- package/dist/core/resource-loader.js +23 -7
- package/dist/core/resource-loader.js.map +1 -1
- package/dist/core/settings-manager.d.ts +4 -2
- package/dist/core/settings-manager.d.ts.map +1 -1
- package/dist/core/settings-manager.js +11 -0
- package/dist/core/settings-manager.js.map +1 -1
- package/dist/core/settings-schema.d.ts +7 -0
- package/dist/core/settings-schema.d.ts.map +1 -1
- package/dist/core/settings-schema.js +6 -0
- package/dist/core/settings-schema.js.map +1 -1
- package/dist/core/skills.d.ts +10 -0
- package/dist/core/skills.d.ts.map +1 -1
- package/dist/core/skills.js +23 -0
- package/dist/core/skills.js.map +1 -1
- package/dist/core/tasks/delivery.d.ts +11 -4
- package/dist/core/tasks/delivery.d.ts.map +1 -1
- package/dist/core/tasks/delivery.js +9 -9
- package/dist/core/tasks/delivery.js.map +1 -1
- package/dist/core/tasks/execution.d.ts +10 -3
- package/dist/core/tasks/execution.d.ts.map +1 -1
- package/dist/core/tasks/execution.js +72 -52
- package/dist/core/tasks/execution.js.map +1 -1
- package/dist/core/tasks/format.d.ts +0 -2
- package/dist/core/tasks/format.d.ts.map +1 -1
- package/dist/core/tasks/format.js +1 -16
- package/dist/core/tasks/format.js.map +1 -1
- package/dist/core/tasks/limits.d.ts +12 -1
- package/dist/core/tasks/limits.d.ts.map +1 -1
- package/dist/core/tasks/limits.js +20 -1
- package/dist/core/tasks/limits.js.map +1 -1
- package/dist/core/tasks/output.d.ts +6 -12
- package/dist/core/tasks/output.d.ts.map +1 -1
- package/dist/core/tasks/output.js +35 -32
- package/dist/core/tasks/output.js.map +1 -1
- package/dist/core/tasks/record.d.ts +45 -0
- package/dist/core/tasks/record.d.ts.map +1 -0
- package/dist/core/tasks/record.js +80 -0
- package/dist/core/tasks/record.js.map +1 -0
- package/dist/core/tasks/runtime.d.ts +14 -14
- package/dist/core/tasks/runtime.d.ts.map +1 -1
- package/dist/core/tasks/runtime.js +111 -93
- package/dist/core/tasks/runtime.js.map +1 -1
- package/dist/core/tasks/session.d.ts +0 -1
- package/dist/core/tasks/session.d.ts.map +1 -1
- package/dist/core/tasks/session.js +7 -8
- package/dist/core/tasks/session.js.map +1 -1
- package/dist/core/tasks/store.d.ts +18 -25
- package/dist/core/tasks/store.d.ts.map +1 -1
- package/dist/core/tasks/store.js +42 -40
- package/dist/core/tasks/store.js.map +1 -1
- package/dist/core/tasks/types.d.ts +96 -17
- package/dist/core/tasks/types.d.ts.map +1 -1
- package/dist/core/tasks/types.js.map +1 -1
- package/dist/core/tools/shell-execution.d.ts +8 -7
- package/dist/core/tools/shell-execution.d.ts.map +1 -1
- package/dist/core/tools/shell-execution.js +18 -26
- package/dist/core/tools/shell-execution.js.map +1 -1
- package/dist/core/tools/shell-tool.d.ts.map +1 -1
- package/dist/core/tools/shell-tool.js +31 -29
- package/dist/core/tools/shell-tool.js.map +1 -1
- package/dist/core/usage-totals.d.ts +3 -0
- package/dist/core/usage-totals.d.ts.map +1 -1
- package/dist/core/usage-totals.js +15 -0
- package/dist/core/usage-totals.js.map +1 -1
- package/dist/extensions/agent/progress.d.ts.map +1 -1
- package/dist/extensions/agent/progress.js +1 -11
- package/dist/extensions/agent/progress.js.map +1 -1
- package/dist/extensions/agent/tool.d.ts.map +1 -1
- package/dist/extensions/agent/tool.js +9 -5
- package/dist/extensions/agent/tool.js.map +1 -1
- package/dist/extensions/agent/worker.d.ts.map +1 -1
- package/dist/extensions/agent/worker.js +3 -5
- package/dist/extensions/agent/worker.js.map +1 -1
- package/dist/extensions/btw/agent.d.ts +1 -1
- package/dist/extensions/btw/agent.d.ts.map +1 -1
- package/dist/extensions/btw/agent.js +3 -20
- package/dist/extensions/btw/agent.js.map +1 -1
- package/dist/extensions/cached-compaction/index.d.ts.map +1 -1
- package/dist/extensions/cached-compaction/index.js +3 -22
- package/dist/extensions/cached-compaction/index.js.map +1 -1
- package/dist/extensions/cached-compaction/render.d.ts +1 -0
- package/dist/extensions/cached-compaction/render.d.ts.map +1 -1
- package/dist/extensions/cached-compaction/render.js +42 -14
- package/dist/extensions/cached-compaction/render.js.map +1 -1
- package/dist/extensions/deepwiki/client.d.ts.map +1 -1
- package/dist/extensions/deepwiki/client.js +6 -78
- package/dist/extensions/deepwiki/client.js.map +1 -1
- package/dist/extensions/deepwiki/transport.d.ts +3 -0
- package/dist/extensions/deepwiki/transport.d.ts.map +1 -0
- package/dist/extensions/deepwiki/transport.js +96 -0
- package/dist/extensions/deepwiki/transport.js.map +1 -0
- package/dist/extensions/provider/ui/builtin-data.d.ts +3 -3
- package/dist/extensions/provider/ui/builtin-data.d.ts.map +1 -1
- package/dist/extensions/provider/ui/builtin-data.js.map +1 -1
- package/dist/extensions/provider/ui/compat.d.ts +3 -3
- package/dist/extensions/provider/ui/compat.d.ts.map +1 -1
- package/dist/extensions/provider/ui/compat.js.map +1 -1
- package/dist/extensions/provider/ui/controls.d.ts +2 -2
- package/dist/extensions/provider/ui/controls.d.ts.map +1 -1
- package/dist/extensions/provider/ui/controls.js.map +1 -1
- package/dist/extensions/provider/ui/dialogs.d.ts +3 -3
- package/dist/extensions/provider/ui/dialogs.d.ts.map +1 -1
- package/dist/extensions/provider/ui/dialogs.js.map +1 -1
- package/dist/extensions/provider/ui/dictionary.d.ts +2 -2
- package/dist/extensions/provider/ui/dictionary.d.ts.map +1 -1
- package/dist/extensions/provider/ui/dictionary.js.map +1 -1
- package/dist/extensions/provider/ui/editor.d.ts.map +1 -1
- package/dist/extensions/provider/ui/editor.js +1 -3
- package/dist/extensions/provider/ui/editor.js.map +1 -1
- package/dist/extensions/provider/ui/fetch-models.d.ts +2 -2
- package/dist/extensions/provider/ui/fetch-models.d.ts.map +1 -1
- package/dist/extensions/provider/ui/fetch-models.js.map +1 -1
- package/dist/extensions/provider/ui/model-fields.d.ts +2 -2
- package/dist/extensions/provider/ui/model-fields.d.ts.map +1 -1
- package/dist/extensions/provider/ui/model-fields.js.map +1 -1
- package/dist/extensions/provider/ui/model-options.d.ts +6 -6
- package/dist/extensions/provider/ui/model-options.d.ts.map +1 -1
- package/dist/extensions/provider/ui/model-options.js.map +1 -1
- package/dist/extensions/provider/ui/pane.d.ts +21 -12
- package/dist/extensions/provider/ui/pane.d.ts.map +1 -1
- package/dist/extensions/provider/ui/pane.js.map +1 -1
- package/dist/extensions/provider/ui/provider-fields.d.ts +3 -3
- package/dist/extensions/provider/ui/provider-fields.d.ts.map +1 -1
- package/dist/extensions/provider/ui/provider-fields.js.map +1 -1
- package/dist/extensions/provider/ui/thinking-map.d.ts +2 -2
- package/dist/extensions/provider/ui/thinking-map.d.ts.map +1 -1
- package/dist/extensions/provider/ui/thinking-map.js.map +1 -1
- package/dist/extensions/run-summary/format.js +1 -1
- package/dist/extensions/run-summary/format.js.map +1 -1
- package/dist/extensions/statusline/usage.d.ts.map +1 -1
- package/dist/extensions/statusline/usage.js +2 -6
- package/dist/extensions/statusline/usage.js.map +1 -1
- package/dist/extensions/tasks/tool/actions.d.ts +1 -1
- package/dist/extensions/tasks/tool/actions.d.ts.map +1 -1
- package/dist/extensions/tasks/tool/actions.js +49 -106
- package/dist/extensions/tasks/tool/actions.js.map +1 -1
- package/dist/extensions/tasks/tool/constants.d.ts +1 -6
- package/dist/extensions/tasks/tool/constants.d.ts.map +1 -1
- package/dist/extensions/tasks/tool/constants.js +1 -6
- package/dist/extensions/tasks/tool/constants.js.map +1 -1
- package/dist/extensions/tasks/tool/schema.d.ts +0 -3
- package/dist/extensions/tasks/tool/schema.d.ts.map +1 -1
- package/dist/extensions/tasks/tool/schema.js +4 -13
- package/dist/extensions/tasks/tool/schema.js.map +1 -1
- package/dist/extensions/tasks/tool.d.ts.map +1 -1
- package/dist/extensions/tasks/tool.js +2 -2
- package/dist/extensions/tasks/tool.js.map +1 -1
- package/dist/extensions/tasks/ui/completion-render.d.ts.map +1 -1
- package/dist/extensions/tasks/ui/completion-render.js +31 -33
- package/dist/extensions/tasks/ui/completion-render.js.map +1 -1
- package/dist/extensions/tasks/ui/layout.d.ts +7 -7
- package/dist/extensions/tasks/ui/layout.d.ts.map +1 -1
- package/dist/extensions/tasks/ui/layout.js +17 -19
- package/dist/extensions/tasks/ui/layout.js.map +1 -1
- package/dist/extensions/tasks/ui/list.d.ts.map +1 -1
- package/dist/extensions/tasks/ui/list.js +2 -3
- package/dist/extensions/tasks/ui/list.js.map +1 -1
- package/dist/extensions/tasks/ui/manager.d.ts +16 -7
- package/dist/extensions/tasks/ui/manager.d.ts.map +1 -1
- package/dist/extensions/tasks/ui/manager.js +163 -131
- package/dist/extensions/tasks/ui/manager.js.map +1 -1
- package/dist/extensions/tasks/ui/model.d.ts +25 -0
- package/dist/extensions/tasks/ui/model.d.ts.map +1 -1
- package/dist/extensions/tasks/ui/model.js +4 -0
- package/dist/extensions/tasks/ui/model.js.map +1 -1
- package/dist/extensions/tasks/ui/render.d.ts +1 -1
- package/dist/extensions/tasks/ui/render.d.ts.map +1 -1
- package/dist/extensions/tasks/ui/render.js +11 -7
- package/dist/extensions/tasks/ui/render.js.map +1 -1
- package/dist/extensions/tasks/ui/status.d.ts +15 -0
- package/dist/extensions/tasks/ui/status.d.ts.map +1 -0
- package/dist/extensions/tasks/ui/status.js +16 -0
- package/dist/extensions/tasks/ui/status.js.map +1 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/modes/interactive/components/config-selector.d.ts +14 -1
- package/dist/modes/interactive/components/config-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/config-selector.js +258 -7
- package/dist/modes/interactive/components/config-selector.js.map +1 -1
- package/dist/modes/interactive/components/status-marker.d.ts +2 -1
- package/dist/modes/interactive/components/status-marker.d.ts.map +1 -1
- package/dist/modes/interactive/components/status-marker.js +0 -1
- package/dist/modes/interactive/components/status-marker.js.map +1 -1
- package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-mode.js +7 -1
- package/dist/modes/interactive/interactive-mode.js.map +1 -1
- package/dist/utils/duration.d.ts +3 -0
- package/dist/utils/duration.d.ts.map +1 -0
- package/dist/utils/duration.js +17 -0
- package/dist/utils/duration.js.map +1 -0
- package/dist/utils/number.d.ts +3 -0
- package/dist/utils/number.d.ts.map +1 -0
- package/dist/utils/number.js +5 -0
- package/dist/utils/number.js.map +1 -0
- package/docs/bundled/extensions/agent.md +3 -3
- package/docs/bundled/extensions/cached-compaction.md +13 -4
- package/docs/bundled/extensions/deepwiki.md +3 -1
- package/docs/extensions.md +5 -5
- package/docs/packages.md +5 -3
- package/docs/sdk.md +1 -1
- package/docs/session-format.md +1 -1
- package/docs/settings.md +11 -0
- package/docs/skills.md +23 -0
- package/npm-shrinkwrap.json +2 -2
- package/package.json +1 -1
- package/schemas/settings.schema.json +36 -0
- package/dist/extensions/deepwiki/http.d.ts +0 -13
- package/dist/extensions/deepwiki/http.d.ts.map +0 -1
- package/dist/extensions/deepwiki/http.js +0 -88
- package/dist/extensions/deepwiki/http.js.map +0 -1
- package/dist/extensions/tasks/ui/task-view.d.ts +0 -8
- package/dist/extensions/tasks/ui/task-view.d.ts.map +0 -1
- package/dist/extensions/tasks/ui/task-view.js +0 -13
- package/dist/extensions/tasks/ui/task-view.js.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"duration.d.ts","sourceRoot":"","sources":["../../src/utils/duration.ts"],"names":[],"mappings":"AAAA,2EAA2E;AAC3E,wBAAgB,cAAc,CAAC,EAAE,EAAE,MAAM,GAAG,MAAM,CAYjD"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/** Compact elapsed time shared by tool responses and interactive views. */
|
|
2
|
+
export function formatDuration(ms) {
|
|
3
|
+
if (ms < 500)
|
|
4
|
+
return "<1s";
|
|
5
|
+
const seconds = Math.round(ms / 1000);
|
|
6
|
+
if (seconds < 60)
|
|
7
|
+
return `${seconds}s`;
|
|
8
|
+
const minutes = Math.floor(seconds / 60);
|
|
9
|
+
if (minutes < 60) {
|
|
10
|
+
const remainder = seconds % 60;
|
|
11
|
+
return remainder === 0 ? `${minutes}m` : `${minutes}m ${remainder}s`;
|
|
12
|
+
}
|
|
13
|
+
const hours = Math.floor(minutes / 60);
|
|
14
|
+
const remainder = minutes % 60;
|
|
15
|
+
return remainder === 0 ? `${hours}h` : `${hours}h ${remainder}m`;
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=duration.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"duration.js","sourceRoot":"","sources":["../../src/utils/duration.ts"],"names":[],"mappings":"AAAA,2EAA2E;AAC3E,MAAM,UAAU,cAAc,CAAC,EAAU;IACxC,IAAI,EAAE,GAAG,GAAG;QAAE,OAAO,KAAK,CAAC;IAC3B,MAAM,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,EAAE,GAAG,IAAI,CAAC,CAAC;IACtC,IAAI,OAAO,GAAG,EAAE;QAAE,OAAO,GAAG,OAAO,GAAG,CAAC;IACvC,MAAM,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,OAAO,GAAG,EAAE,CAAC,CAAC;IACzC,IAAI,OAAO,GAAG,EAAE,EAAE,CAAC;QAClB,MAAM,SAAS,GAAG,OAAO,GAAG,EAAE,CAAC;QAC/B,OAAO,SAAS,KAAK,CAAC,CAAC,CAAC,CAAC,GAAG,OAAO,GAAG,CAAC,CAAC,CAAC,GAAG,OAAO,KAAK,SAAS,GAAG,CAAC;IACtE,CAAC;IACD,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,OAAO,GAAG,EAAE,CAAC,CAAC;IACvC,MAAM,SAAS,GAAG,OAAO,GAAG,EAAE,CAAC;IAC/B,OAAO,SAAS,KAAK,CAAC,CAAC,CAAC,CAAC,GAAG,KAAK,GAAG,CAAC,CAAC,CAAC,GAAG,KAAK,KAAK,SAAS,GAAG,CAAC;AAClE,CAAC","sourcesContent":["/** Compact elapsed time shared by tool responses and interactive views. */\nexport function formatDuration(ms: number): string {\n\tif (ms < 500) return \"<1s\";\n\tconst seconds = Math.round(ms / 1000);\n\tif (seconds < 60) return `${seconds}s`;\n\tconst minutes = Math.floor(seconds / 60);\n\tif (minutes < 60) {\n\t\tconst remainder = seconds % 60;\n\t\treturn remainder === 0 ? `${minutes}m` : `${minutes}m ${remainder}s`;\n\t}\n\tconst hours = Math.floor(minutes / 60);\n\tconst remainder = minutes % 60;\n\treturn remainder === 0 ? `${hours}h` : `${hours}h ${remainder}m`;\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"number.d.ts","sourceRoot":"","sources":["../../src/utils/number.ts"],"names":[],"mappings":"AAAA,6HAA6H;AAC7H,wBAAgB,WAAW,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,EAAE,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,MAAM,CAEhG"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/** A non-negative integer limit: `fallback` for a missing or non-finite value, otherwise floored and capped at `ceiling`. */
|
|
2
|
+
export function finiteLimit(value, fallback, ceiling) {
|
|
3
|
+
return value === undefined || !Number.isFinite(value) ? fallback : Math.max(0, Math.min(ceiling, Math.floor(value)));
|
|
4
|
+
}
|
|
5
|
+
//# sourceMappingURL=number.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"number.js","sourceRoot":"","sources":["../../src/utils/number.ts"],"names":[],"mappings":"AAAA,6HAA6H;AAC7H,MAAM,UAAU,WAAW,CAAC,KAAyB,EAAE,QAAgB,EAAE,OAAe;IACvF,OAAO,KAAK,KAAK,SAAS,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC,GAAG,CAAC,OAAO,EAAE,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;AACtH,CAAC","sourcesContent":["/** A non-negative integer limit: `fallback` for a missing or non-finite value, otherwise floored and capped at `ceiling`. */\nexport function finiteLimit(value: number | undefined, fallback: number, ceiling: number): number {\n\treturn value === undefined || !Number.isFinite(value) ? fallback : Math.max(0, Math.min(ceiling, Math.floor(value)));\n}\n"]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Agent — lightweight delegation
|
|
2
2
|
|
|
3
|
-
The bundled `Agent` extension adds the `Agent` tool and `/agent` settings command. One call delegates one self-contained task to a temporary Agent and returns its final report; the Agent does not converse with its parent while it runs. Use it
|
|
3
|
+
The bundled `Agent` extension adds the `Agent` tool and `/agent` settings command. One call delegates one self-contained task to a temporary Agent and returns its final report; the Agent does not converse with its parent while it runs. Use it when independent work clearly benefits from separate context or parallel execution. Keep design and substantial coding in the main session; Agents are primarily for independent research, verification, and well-specified, self-contained implementation. Handle known-path reads and small edits directly. There are no General/Explore profiles, batch arrays, persistent worker identities, chain modes, or mid-run messaging and steering.
|
|
4
4
|
|
|
5
5
|
## Tool contract
|
|
6
6
|
|
|
@@ -12,8 +12,8 @@ The bundled `Agent` extension adds the `Agent` tool and `/agent` settings comman
|
|
|
12
12
|
}
|
|
13
13
|
```
|
|
14
14
|
|
|
15
|
-
- `prompt` is required, must be self-contained, and is limited to 16 KiB. The Agent cannot see the parent conversation.
|
|
16
|
-
- `description` is an optional short label for the Transcript and `/tasks`; otherwise Pi derives one from the prompt.
|
|
15
|
+
- `prompt` is required, must be self-contained, and is limited to 16 KiB. The Agent cannot see the parent conversation. Include the goal and rationale, prior findings, relevant paths and constraints, whether to investigate or edit, and expected verification. For open investigations, hand over the question rather than a fragile step-by-step procedure.
|
|
16
|
+
- `description` is an optional short (3–5 word) label for the Transcript and `/tasks`; otherwise Pi derives one from the prompt.
|
|
17
17
|
- `background` is optional. Foreground waits for the report; `true` returns a Task ID once the Agent has initialized, or at once while it waits for a slot, and delivers the report automatically. Interactive **Ctrl+B** can detach a foreground call without restarting it.
|
|
18
18
|
|
|
19
19
|
Issue parallel `Agent` calls for independent work. Each call is a separate Transcript row and Task, including its own completion notification; there is no aggregate batch view. At most four Agents run at once in a session; additional calls wait as queued Tasks and start when a slot frees. A queued background call returns its Task ID immediately, and **Ctrl+B** can move a queued foreground call to the background before it starts. Parallel tasks must not perform overlapping writes.
|
|
@@ -23,13 +23,22 @@ Native compaction accepts the same native file-list shape in extension-provided
|
|
|
23
23
|
|
|
24
24
|
## Result card
|
|
25
25
|
|
|
26
|
-
A successful cached-path compaction adds a persistent display-only card
|
|
26
|
+
A successful cached-path compaction adds a persistent display-only card, a one-line footnote under the compaction summary:
|
|
27
27
|
|
|
28
28
|
```text
|
|
29
|
-
|
|
30
|
-
Cache 641.2k/648.8k (98.8%) · output 2.8k · 18.4s
|
|
29
|
+
From cache · CH 98.8% · ↓2.8k · 18s
|
|
31
30
|
```
|
|
32
31
|
|
|
33
|
-
Automatic compaction
|
|
32
|
+
Automatic compaction adds `auto` after `From cache`. `CH` is the summary request's cache hit rate, its actual `cacheRead` divided by `input + cacheRead + cacheWrite`, written with the same `↑ ↓ R W CH` units as the footer; it is green from 80%, a warning color below 50%, and omitted when the provider reported no cache activity. The card then shows output tokens and elapsed time.
|
|
33
|
+
|
|
34
|
+
Expanding tool output (Ctrl+O) expands the card with the summary, adding the reason and the prompt broken down by billing:
|
|
35
|
+
|
|
36
|
+
```text
|
|
37
|
+
From cache · manual · CH 98.8% · 18s
|
|
38
|
+
Prompt 649k = R641k cached + W4.5k written + ↑3.1k uncached
|
|
39
|
+
Output ↓2.8k
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
The card contains no cost estimate and never enters model context. Native fallback adds no card.
|
|
34
43
|
|
|
35
44
|
The extension registers no commands or settings.
|
|
@@ -52,11 +52,13 @@ Avoid DeepWiki when the authoritative source is local or time-sensitive:
|
|
|
52
52
|
|
|
53
53
|
- A repository may not be indexed. DeepWiki can return that as normal text, so the extension treats repository-not-found messages as tool errors.
|
|
54
54
|
- All model-facing responses are capped at 120,000 characters. `contents` prefers `# Page:` boundaries (whole pages kept in order; at least the first page survives, cut mid-page if it alone exceeds the budget). Its trailing notice reports shown/total pages, the full length, up to 20 omitted page titles, and points at `page` reads and `action: "question"` for the rest. `structure` and `question` append a focused-request truncation notice. Details carry `shownPages` / `truncatedChars` when applicable; `outputLength` always reflects the full cached response. Single-page reads set `requestedPage` / `pageIndex` and share the same hard budget.
|
|
55
|
-
- Each transport response is streamed with an 8 MiB byte limit before JSON/SSE parsing; oversized, failed, aborted, and timed-out responses never enter the cache. Network
|
|
55
|
+
- Each transport response is streamed with an 8 MiB byte limit before JSON/SSE parsing; oversized, failed, aborted, and timed-out responses never enter the cache. Network failures and transient HTTP statuses (408, 425, 429, 500, 502, 503, 504) are retried up to twice without delay; caller cancellation and timeouts are not retried. The whole call, retries included, times out after 45 seconds and surfaces as a Pi tool error.
|
|
56
56
|
- Use local Pi tools (`read`, `grep`, `find`, `ls`) for workspace state. DeepWiki answers describe repository snapshots indexed by DeepWiki, not local uncommitted files.
|
|
57
57
|
|
|
58
58
|
## Implementation notes
|
|
59
59
|
|
|
60
|
+
Each uncached call is one stateless JSON-RPC `tools/call` POST: DeepWiki's endpoint issues no MCP session, so the extension skips the initialize handshake that `McpClient` would add to every call. It validates the response with `@earendil-works/pi-mcp`'s JSON-RPC parser and reads either a JSON or an SSE body.
|
|
61
|
+
|
|
60
62
|
DeepWiki's public MCP endpoint exposes exactly three operations: list a wiki's page titles, return the whole generated wiki as one document, and answer a question. There is no per-page fetch upstream — `page` is implemented by this extension: it fetches the full wiki (or reuses the 10-minute cache) and slices out the requested page locally. The first `contents` call for a repo pays the network cost; subsequent page reads within the cache window are instant and free.
|
|
61
63
|
|
|
62
64
|
DeepWiki may return generated explanations with source-file citations and "related pages" links. The TUI uses a local renderer (`render.ts`) rather than Pi's generic fallback, which would dump the full (often large) `content` text. Call questions, page names, and result titles are whitespace-normalized into bounded one-line summaries. Collapsed result text uses the quieter tool-output color and keeps the configured expand hint on the same logical line; expanding renders the complete response as Markdown. Historical malformed titles, requested pages, and error messages are bounded and fall back safely instead of breaking transcript rendering.
|
package/docs/extensions.md
CHANGED
|
@@ -554,6 +554,7 @@ pi.on("session_compact", async (event, ctx) => {
|
|
|
554
554
|
// event.fromExtension - whether extension provided it
|
|
555
555
|
// event.reason - "manual" (/compact), "threshold", or "overflow"
|
|
556
556
|
// event.willRetry - whether overflow recovery will actually retry after retained-context verification
|
|
557
|
+
// Entries appended here with pi.appendEntry() render after the compaction summary.
|
|
557
558
|
});
|
|
558
559
|
|
|
559
560
|
pi.on("session_compact_failed", async (event, ctx) => {
|
|
@@ -1259,14 +1260,13 @@ Session-bound `TasksContext` supervises native and extension-owned execution. Fo
|
|
|
1259
1260
|
| `execute<T>(execution)` | Returns `{ kind: "result", result, status, error? }` or `{ kind: "background", task }` |
|
|
1260
1261
|
| `list()` / `get(id)` | Bounded, read-only (frozen) retained snapshots; IDs support unique prefixes |
|
|
1261
1262
|
| `read(id, options?)` | Bounded head, tail, or byte-offset model-readable output; excludes human-only display text |
|
|
1262
|
-
| `wait(id, timeoutMs
|
|
1263
|
-
| `waitAny(
|
|
1263
|
+
| `wait(id, options?)` | One observation of one task. `options`: `timeoutMs`, `signal`, `toolCallId`, and `read: { bytes?, sinceBytes? }`. Returns `{ outcome, waitedMs, task, read? }` where `outcome` is `settled`, `timed_out`, `interrupted` (host steering), or `closed` (host shut down; state unconfirmed). Timeout, cancellation, or interruption ends the wait, not execution |
|
|
1264
|
+
| `waitAny(options?)` | Observes the first task running at call time to settle, with `timeoutMs`, `signal`, `toolCallId`, and `read: { bytes? }`. Returns `{ outcome, waitedMs, task?, read?, running }`; `outcome` adds `no_tasks` for an empty cohort. Later tasks are excluded |
|
|
1264
1265
|
| `kill(id)` | Requests cancellation; `stopping` is not a terminal status |
|
|
1265
1266
|
| `detach(id)` / `detachForeground()` | Hands off one task, or eligible foreground tasks oldest first while background slots remain, without restarting them; throws when every background slot is taken |
|
|
1266
1267
|
| `canDetach(id)` | Reports whether an execution can move now, including host policy and available background slots; does not change the execution |
|
|
1267
1268
|
| `subscribe(listener)` | Observes task state and progress |
|
|
1268
1269
|
| `retain(id)` | Returns an idempotent release function protecting retained data, without delaying notifications |
|
|
1269
|
-
| `holdDelivery(id)` | Explicitly retains data and delays automatic delivery until released |
|
|
1270
1270
|
|
|
1271
1271
|
`TaskExecution<T>` supplies `kind`, `title`, `toolCallId`, and `run(control)`, plus optional fields:
|
|
1272
1272
|
|
|
@@ -1287,7 +1287,7 @@ A caller can be handed off to the background while its task is queued, before `r
|
|
|
1287
1287
|
|
|
1288
1288
|
`TaskControl<T>` exposes `id`, `signal`, `mode`, `onModeChange(listener)`, `accept()`, `publish(update)`, `attachOutput(path, cleanup?)`, and `cancel()`. `publish({ result, display?, usage? })` replaces the bounded model-readable result and optionally the human-only Output suffix and cumulative usage; `/tasks` combines result and display, while model reads and completion notifications use only the result. A task with an attached output file is read from that file instead. Call `accept()` after whole-invocation preflight, before allowing a background handoff. Use the control's signal throughout execution. Parent-call cancellation is disconnected after handoff, while runtime shutdown still cancels the task. Mode subscriptions concern only this task; executors do not need the global registry to observe their own handoff or cancel themselves.
|
|
1289
1289
|
|
|
1290
|
-
Completion messages store `{ version: 3, task }` in `details`, a bounded terminal `TaskSnapshot`; only their bounded `content` enters model context. Built-in `tasks wait` binds delivery to the actual tool call, and the host confirms it after successful persistence; a settled waitAny binds only its winning task.
|
|
1290
|
+
Completion messages store `{ version: 3, task }` in `details`, a bounded terminal `TaskSnapshot`; only their bounded `content` enters model context. Built-in `tasks wait` binds delivery to the actual tool call, and the host confirms it after successful persistence; a settled waitAny binds only its winning task. Reads and waits without a `toolCallId`, including `waitAny`, do not acknowledge delivery, and arbitrary tool-result detail fields cannot acknowledge a task.
|
|
1291
1291
|
|
|
1292
1292
|
```typescript
|
|
1293
1293
|
const outcome = await ctx.tasks.execute({
|
|
@@ -1309,7 +1309,7 @@ if (outcome.kind === "result") return outcome.result;
|
|
|
1309
1309
|
return { content: [{ type: "text", text: `Task ${outcome.task.id} continues in the background.` }], details: undefined };
|
|
1310
1310
|
```
|
|
1311
1311
|
|
|
1312
|
-
When Pi attaches the runtime to its durable session lifecycle, `ctx.tasks.session` exposes
|
|
1312
|
+
When Pi attaches the runtime to its durable session lifecycle, `ctx.tasks.session` exposes `stoppedByTreeNavigation(targetId)`, which lists running tasks that navigating to an entry would cancel. Standalone runtimes omit it. Wait receipts and steering interruption are not extension concerns: the runtime applies them inside `wait()` and `waitAny()`. In a session host, passing the tool call's `toolCallId` keeps a settled background task out of automatic notifications from before the wait until that tool result is persisted, so the persisted result acknowledges it exactly once; without a `toolCallId`, or in a standalone runtime, a wait is purely observational.
|
|
1313
1313
|
|
|
1314
1314
|
`TaskRuntime`, `TaskRuntimeOptions`, and the public `Task*`/`TasksContext`/`TasksSessionContext` types are exported from `@astralyn/pi`. Captured capabilities close with their runtime; obtain the replacement from the new session context after reload or session replacement.
|
|
1315
1315
|
|
package/docs/packages.md
CHANGED
|
@@ -199,9 +199,10 @@ Filter what a package loads using the object form in settings:
|
|
|
199
199
|
{
|
|
200
200
|
"source": "npm:my-package",
|
|
201
201
|
"extensions": ["extensions/*.ts", "!extensions/legacy.ts"],
|
|
202
|
-
"skills": [],
|
|
202
|
+
"skills": ["skills"],
|
|
203
203
|
"prompts": ["prompts/review.md"],
|
|
204
|
-
"themes": ["+themes/legacy.json"]
|
|
204
|
+
"themes": ["+themes/legacy.json"],
|
|
205
|
+
"skillInvocationOverrides": { "skills/pdf": "user-only" }
|
|
205
206
|
}
|
|
206
207
|
]
|
|
207
208
|
}
|
|
@@ -215,10 +216,11 @@ Filter what a package loads using the object form in settings:
|
|
|
215
216
|
- `+path` force-includes an exact path.
|
|
216
217
|
- `-path` force-excludes an exact path.
|
|
217
218
|
- Filters layer on top of the manifest. They narrow down what is already allowed.
|
|
219
|
+
- `skillInvocationOverrides` uses package-relative skill files or directories and accepts `"model-and-user"` or `"user-only"`. It controls model visibility, not resource loading.
|
|
218
220
|
|
|
219
221
|
## Enable and Disable Resources
|
|
220
222
|
|
|
221
|
-
Use `pi config` to enable or disable extensions,
|
|
223
|
+
Use `pi config` to enable or disable extensions, prompt templates, and themes, and to switch skills between On, User only, and Off. User-only skills remain available as `/skill:name` but are omitted from the model's system prompt. `pi config` starts in global settings (`~/.pi/agent/settings.json`); press Tab to switch between global and project-local modes. Use `pi config -l` to start in project overrides (`.pi/settings.json`) with inherited global resources dimmed.
|
|
222
224
|
|
|
223
225
|
## Scope and Deduplication
|
|
224
226
|
|
package/docs/sdk.md
CHANGED
|
@@ -254,7 +254,7 @@ The host must choose:
|
|
|
254
254
|
|
|
255
255
|
- **Lifetime and cancellation:** a settled main-agent turn is not the end of background work. `session.abort()` cancels foreground-owned work, not detached work. Use `session.tasks.kill(id)` for a whole execution, or `await session.tasks.shutdown(graceMs?)` to close admission, cancel all owned work and drain within a bounded grace period (default 2 seconds, maximum 60 seconds). A non-cooperating executor can outlive that grace period.
|
|
256
256
|
- **Result-driven turns and cost:** automatic completions join the host's prompt queue, so a running turn receives them as steering and an idle session starts a completion turn. Use the nestable `session.pauseTaskNotifications()` to defer delivery; its returned release function is idempotent. Pausing does not stop execution or its costs. Budget worker activity and completion-triggered turns explicitly.
|
|
257
|
-
- **Observation and delivery:** `session.tasks` exposes the [public supervision methods](extensions.md#ctxtasks). `read()`, `wait()`, and `waitAny()` observe; a terminal snapshot alone does not acknowledge model delivery. `waitAny()` covers only tasks running at call time and
|
|
257
|
+
- **Observation and delivery:** `session.tasks` exposes the [public supervision methods](extensions.md#ctxtasks). `read()`, `wait()`, and `waitAny()` observe; a terminal snapshot alone does not acknowledge model delivery. `waitAny()` covers only tasks running at call time and reports `no_tasks` for an empty cohort. Both return a typed `outcome` (`settled`, `timed_out`, `interrupted`, or `closed`), and steering interrupts only waits, never execution. The built-in `tasks wait` tool passes its tool-call ID as `toolCallId`, so the runtime holds the observed result back from notifications and the host confirms it only after persisting that tool result, even if extensions rewrite its details. A direct SDK waiter that consumes the result outside model history omits `toolCallId` and can explicitly call `session.tasks.markDelivered(task.id)` after successful consumption. A timeout or cancelled wait does not stop the execution. Failed notification delivery leaves the result available for inspection; after fixing the host failure, call `session.retryTaskNotifications()` explicitly. Pi does not retry a failed delivery forever on a timer.
|
|
258
258
|
- **Shutdown:** `await runtime.dispose()` handles background shutdown and extension lifecycle when using the runtime API. For a directly owned session, drain Background, abort the main agent, then dispose; synchronous `session.dispose()` alone is not an awaited drain.
|
|
259
259
|
|
|
260
260
|
A deliberately single-turn embedding can suppress completion-triggered turns and cancel leftover work on exit:
|
package/docs/session-format.md
CHANGED
|
@@ -381,7 +381,7 @@ A shell completion's `details` can look like this:
|
|
|
381
381
|
|
|
382
382
|
The message carries everything needed for replay after `/reload`, branch navigation, history eviction or restart; rendering does not open the saved log or query a live task. Unsupported or malformed completion details, including versions 1 and 2, use bounded plain message text. There is no legacy text parser, dual-format reconstruction or migration.
|
|
383
383
|
|
|
384
|
-
A completion is acknowledged only after its message is persisted. A terminal `tasks wait` binds a host-owned receipt to the tool-call ID. Only persisting that tool result acknowledges delivery, even if its details were rewritten; aborting during an output read cannot consume a notification. Direct `TasksContext.wait()`
|
|
384
|
+
A completion is acknowledged only after its message is persisted. A terminal `tasks wait` binds a host-owned receipt to the tool-call ID. Only persisting that tool result acknowledges delivery, even if its details were rewritten; aborting during an output read cannot consume a notification. Direct `TasksContext.wait()` and `waitAny()` are observational unless given a `toolCallId` in a session host. Snapshots and repeated reads do not create more usage. Historical extension-owned `background-task` notifications and old `bg create` tool results remain transcript history shown as saved text, not new runnable tasks.
|
|
385
385
|
|
|
386
386
|
Session-wide statistics aggregate the ledger across all entries; the bundled Statusline uses the active branch. Accrued retries, failures, cancellations and worker compaction count when usage is reported. No usage is invented for a provider that does not expose it, and worker billing does not occupy the parent's context window. See [SDK session statistics](sdk.md#session-statistics).
|
|
387
387
|
|
package/docs/settings.md
CHANGED
|
@@ -346,12 +346,23 @@ Paths in `~/.pi/agent/settings.json` resolve relative to `~/.pi/agent`. Paths in
|
|
|
346
346
|
| `packages` | array | `[]` | npm/git packages to load resources from |
|
|
347
347
|
| `extensions` | string[] | `[]` | Local extension file paths or directories |
|
|
348
348
|
| `skills` | string[] | `[]` | Local skill file paths or directories |
|
|
349
|
+
| `skillInvocationOverrides` | object | `{}` | Per-skill invocation policy: `"model-and-user"` or `"user-only"` |
|
|
349
350
|
| `prompts` | string[] | `[]` | Local prompt template paths or directories |
|
|
350
351
|
| `themes` | string[] | `[]` | Local theme file paths or directories |
|
|
351
352
|
| `enableSkillCommands` | boolean | `true` | Register skills as `/skill:name` commands |
|
|
352
353
|
|
|
353
354
|
Arrays support glob patterns and exclusions. Use `!pattern` to exclude. Use `+path` to force-include an exact path and `-path` to force-exclude an exact path.
|
|
354
355
|
|
|
356
|
+
`skillInvocationOverrides` uses exact skill file or directory paths as keys. It changes model visibility without changing whether the skill loads; user-only skills remain available as `/skill:name`. Project values override global values. With no override, the skill's `disable-model-invocation` frontmatter applies.
|
|
357
|
+
|
|
358
|
+
```json
|
|
359
|
+
{
|
|
360
|
+
"skillInvocationOverrides": {
|
|
361
|
+
"skills/pdf/SKILL.md": "user-only"
|
|
362
|
+
}
|
|
363
|
+
}
|
|
364
|
+
```
|
|
365
|
+
|
|
355
366
|
#### packages
|
|
356
367
|
|
|
357
368
|
String form loads all resources from a package:
|
package/docs/skills.md
CHANGED
|
@@ -82,6 +82,29 @@ Skills register as `/skill:name` commands:
|
|
|
82
82
|
|
|
83
83
|
Arguments after the command are appended to the skill content as `User: <args>`.
|
|
84
84
|
|
|
85
|
+
### Invocation Policy
|
|
86
|
+
|
|
87
|
+
Use `pi config` to cycle each skill through three states:
|
|
88
|
+
|
|
89
|
+
- **On:** the skill is loaded, advertised to the model, and available as `/skill:name`.
|
|
90
|
+
- **User only:** the skill is loaded and available as `/skill:name`, but omitted from the system prompt.
|
|
91
|
+
- **Off:** the skill is not loaded.
|
|
92
|
+
|
|
93
|
+
Project mode also supports inheriting the global state or explicitly overriding it. Without an override, `disable-model-invocation` in `SKILL.md` determines whether a loaded skill starts as On or User only.
|
|
94
|
+
|
|
95
|
+
For settings-based configuration, keep using the `skills` array to control loading and add `skillInvocationOverrides` for invocation policy. Keys name exact skill files or directories, and values are `"model-and-user"` or `"user-only"`:
|
|
96
|
+
|
|
97
|
+
```json
|
|
98
|
+
{
|
|
99
|
+
"skillInvocationOverrides": {
|
|
100
|
+
"skills/pdf/SKILL.md": "user-only",
|
|
101
|
+
"skills/formatter": "model-and-user"
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
Project overrides take precedence over global overrides. An explicit `"model-and-user"` also overrides author-level `disable-model-invocation`; removing the override restores the frontmatter default. Invocation overrides do not force a disabled skill to load.
|
|
107
|
+
|
|
85
108
|
Toggle skill commands via `/settings` in interactive mode or in `settings.json`:
|
|
86
109
|
|
|
87
110
|
```json
|
package/npm-shrinkwrap.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@astralyn/pi",
|
|
3
|
-
"version": "1.4.
|
|
3
|
+
"version": "1.4.7",
|
|
4
4
|
"lockfileVersion": 3,
|
|
5
5
|
"requires": true,
|
|
6
6
|
"packages": {
|
|
7
7
|
"": {
|
|
8
8
|
"name": "@astralyn/pi",
|
|
9
|
-
"version": "1.4.
|
|
9
|
+
"version": "1.4.7",
|
|
10
10
|
"license": "MIT",
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"@earendil-works/pi-agent-core": "1.4.0",
|
package/package.json
CHANGED
|
@@ -338,6 +338,24 @@
|
|
|
338
338
|
"items": {
|
|
339
339
|
"type": "string"
|
|
340
340
|
}
|
|
341
|
+
},
|
|
342
|
+
"skillInvocationOverrides": {
|
|
343
|
+
"type": "object",
|
|
344
|
+
"patternProperties": {
|
|
345
|
+
"^.*$": {
|
|
346
|
+
"anyOf": [
|
|
347
|
+
{
|
|
348
|
+
"type": "string",
|
|
349
|
+
"const": "model-and-user"
|
|
350
|
+
},
|
|
351
|
+
{
|
|
352
|
+
"type": "string",
|
|
353
|
+
"const": "user-only"
|
|
354
|
+
}
|
|
355
|
+
]
|
|
356
|
+
}
|
|
357
|
+
},
|
|
358
|
+
"description": "Per-skill invocation overrides, keyed by skill file or directory path."
|
|
341
359
|
}
|
|
342
360
|
}
|
|
343
361
|
}
|
|
@@ -383,6 +401,24 @@
|
|
|
383
401
|
],
|
|
384
402
|
"description": "Local skill file paths or directories."
|
|
385
403
|
},
|
|
404
|
+
"skillInvocationOverrides": {
|
|
405
|
+
"type": "object",
|
|
406
|
+
"patternProperties": {
|
|
407
|
+
"^.*$": {
|
|
408
|
+
"anyOf": [
|
|
409
|
+
{
|
|
410
|
+
"type": "string",
|
|
411
|
+
"const": "model-and-user"
|
|
412
|
+
},
|
|
413
|
+
{
|
|
414
|
+
"type": "string",
|
|
415
|
+
"const": "user-only"
|
|
416
|
+
}
|
|
417
|
+
]
|
|
418
|
+
}
|
|
419
|
+
},
|
|
420
|
+
"description": "Per-skill invocation overrides, keyed by skill file or directory path."
|
|
421
|
+
},
|
|
386
422
|
"prompts": {
|
|
387
423
|
"type": "array",
|
|
388
424
|
"items": {
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
export declare const DEEPWIKI_RESPONSE_BODY_BYTES: number;
|
|
2
|
-
export interface FetchRetryOptions {
|
|
3
|
-
timeoutMs: number;
|
|
4
|
-
retries?: number;
|
|
5
|
-
signal?: AbortSignal;
|
|
6
|
-
label?: string;
|
|
7
|
-
}
|
|
8
|
-
/** Fetch with a per-attempt timeout and bounded retries for transient failures. */
|
|
9
|
-
export declare function fetchWithRetry(url: string, request: RequestInit, options: FetchRetryOptions): Promise<{
|
|
10
|
-
response: Response;
|
|
11
|
-
text: string;
|
|
12
|
-
}>;
|
|
13
|
-
//# sourceMappingURL=http.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"http.d.ts","sourceRoot":"","sources":["../../../src/extensions/deepwiki/http.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,4BAA4B,QAAkB,CAAC;AAG5D,MAAM,WAAW,iBAAiB;IACjC,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,MAAM,CAAC,EAAE,WAAW,CAAC;IACrB,KAAK,CAAC,EAAE,MAAM,CAAC;CACf;AAkED,mFAAmF;AACnF,wBAAsB,cAAc,CACnC,GAAG,EAAE,MAAM,EACX,OAAO,EAAE,WAAW,EACpB,OAAO,EAAE,iBAAiB,GACxB,OAAO,CAAC;IAAE,QAAQ,EAAE,QAAQ,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,CAAC,CAwB/C"}
|
|
@@ -1,88 +0,0 @@
|
|
|
1
|
-
import { readResponseTextBounded } from "../../utils/http-response.js";
|
|
2
|
-
export const DEEPWIKI_RESPONSE_BODY_BYTES = 8 * 1024 * 1024;
|
|
3
|
-
const DEEPWIKI_RESPONSE_OVERFLOW_MESSAGE = `DeepWiki response exceeded ${DEEPWIKI_RESPONSE_BODY_BYTES} bytes`;
|
|
4
|
-
function delay(milliseconds, label, signal) {
|
|
5
|
-
return new Promise((resolve, reject) => {
|
|
6
|
-
const handleAbort = () => {
|
|
7
|
-
cleanup();
|
|
8
|
-
reject(new Error(`${label} request aborted`));
|
|
9
|
-
};
|
|
10
|
-
const timer = setTimeout(() => {
|
|
11
|
-
cleanup();
|
|
12
|
-
resolve();
|
|
13
|
-
}, milliseconds);
|
|
14
|
-
const cleanup = () => {
|
|
15
|
-
clearTimeout(timer);
|
|
16
|
-
signal?.removeEventListener("abort", handleAbort);
|
|
17
|
-
};
|
|
18
|
-
if (signal?.aborted) {
|
|
19
|
-
handleAbort();
|
|
20
|
-
return;
|
|
21
|
-
}
|
|
22
|
-
signal?.addEventListener("abort", handleAbort, { once: true });
|
|
23
|
-
});
|
|
24
|
-
}
|
|
25
|
-
async function attemptOnce(url, request, timeoutMs, label, signal) {
|
|
26
|
-
const controller = new AbortController();
|
|
27
|
-
let timedOut = false;
|
|
28
|
-
const abortFromParent = () => controller.abort(signal?.reason);
|
|
29
|
-
const timeout = setTimeout(() => {
|
|
30
|
-
timedOut = true;
|
|
31
|
-
controller.abort();
|
|
32
|
-
}, timeoutMs);
|
|
33
|
-
if (signal?.aborted)
|
|
34
|
-
abortFromParent();
|
|
35
|
-
else
|
|
36
|
-
signal?.addEventListener("abort", abortFromParent, { once: true });
|
|
37
|
-
try {
|
|
38
|
-
const response = await fetch(url, { ...request, signal: controller.signal });
|
|
39
|
-
const text = await readResponseTextBounded(response, {
|
|
40
|
-
maxBytes: DEEPWIKI_RESPONSE_BODY_BYTES,
|
|
41
|
-
overflowMessage: DEEPWIKI_RESPONSE_OVERFLOW_MESSAGE,
|
|
42
|
-
signal: controller.signal,
|
|
43
|
-
});
|
|
44
|
-
return { ok: true, response, text };
|
|
45
|
-
}
|
|
46
|
-
catch (error) {
|
|
47
|
-
if (timedOut)
|
|
48
|
-
throw new Error(`${label} request timed out after ${timeoutMs / 1000}s`);
|
|
49
|
-
if (signal?.aborted)
|
|
50
|
-
throw new Error(`${label} request aborted`);
|
|
51
|
-
const normalizedError = error instanceof Error ? error : new Error(String(error));
|
|
52
|
-
return {
|
|
53
|
-
ok: false,
|
|
54
|
-
error: normalizedError,
|
|
55
|
-
retryable: normalizedError.message !== DEEPWIKI_RESPONSE_OVERFLOW_MESSAGE,
|
|
56
|
-
};
|
|
57
|
-
}
|
|
58
|
-
finally {
|
|
59
|
-
clearTimeout(timeout);
|
|
60
|
-
signal?.removeEventListener("abort", abortFromParent);
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
/** Fetch with a per-attempt timeout and bounded retries for transient failures. */
|
|
64
|
-
export async function fetchWithRetry(url, request, options) {
|
|
65
|
-
const retries = options.retries ?? 2;
|
|
66
|
-
const label = options.label ?? "HTTP";
|
|
67
|
-
let lastError;
|
|
68
|
-
for (let attemptIndex = 0; attemptIndex <= retries; attemptIndex++) {
|
|
69
|
-
if (attemptIndex > 0)
|
|
70
|
-
await delay(1000 * attemptIndex, label, options.signal);
|
|
71
|
-
const outcome = await attemptOnce(url, request, options.timeoutMs, label, options.signal);
|
|
72
|
-
if (!outcome.ok) {
|
|
73
|
-
lastError = outcome.error;
|
|
74
|
-
if (!outcome.retryable)
|
|
75
|
-
throw outcome.error;
|
|
76
|
-
continue;
|
|
77
|
-
}
|
|
78
|
-
const { response, text } = outcome;
|
|
79
|
-
const retryable = response.status >= 500 || response.status === 429;
|
|
80
|
-
if (!response.ok && retryable && attemptIndex < retries) {
|
|
81
|
-
lastError = new Error(`${label} HTTP ${response.status}`);
|
|
82
|
-
continue;
|
|
83
|
-
}
|
|
84
|
-
return { response, text };
|
|
85
|
-
}
|
|
86
|
-
throw lastError ?? new Error(`${label} request failed`);
|
|
87
|
-
}
|
|
88
|
-
//# sourceMappingURL=http.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"http.js","sourceRoot":"","sources":["../../../src/extensions/deepwiki/http.ts"],"names":[],"mappings":"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","sourcesContent":["import { readResponseTextBounded } from \"../../utils/http-response.ts\";\n\nexport const DEEPWIKI_RESPONSE_BODY_BYTES = 8 * 1024 * 1024;\nconst DEEPWIKI_RESPONSE_OVERFLOW_MESSAGE = `DeepWiki response exceeded ${DEEPWIKI_RESPONSE_BODY_BYTES} bytes`;\n\nexport interface FetchRetryOptions {\n\ttimeoutMs: number;\n\tretries?: number;\n\tsignal?: AbortSignal;\n\tlabel?: string;\n}\n\nfunction delay(milliseconds: number, label: string, signal: AbortSignal | undefined): Promise<void> {\n\treturn new Promise((resolve, reject) => {\n\t\tconst handleAbort = () => {\n\t\t\tcleanup();\n\t\t\treject(new Error(`${label} request aborted`));\n\t\t};\n\t\tconst timer = setTimeout(() => {\n\t\t\tcleanup();\n\t\t\tresolve();\n\t\t}, milliseconds);\n\t\tconst cleanup = () => {\n\t\t\tclearTimeout(timer);\n\t\t\tsignal?.removeEventListener(\"abort\", handleAbort);\n\t\t};\n\n\t\tif (signal?.aborted) {\n\t\t\thandleAbort();\n\t\t\treturn;\n\t\t}\n\t\tsignal?.addEventListener(\"abort\", handleAbort, { once: true });\n\t});\n}\n\nasync function attemptOnce(\n\turl: string,\n\trequest: RequestInit,\n\ttimeoutMs: number,\n\tlabel: string,\n\tsignal: AbortSignal | undefined,\n): Promise<{ ok: true; response: Response; text: string } | { ok: false; error: Error; retryable: boolean }> {\n\tconst controller = new AbortController();\n\tlet timedOut = false;\n\tconst abortFromParent = () => controller.abort(signal?.reason);\n\tconst timeout = setTimeout(() => {\n\t\ttimedOut = true;\n\t\tcontroller.abort();\n\t}, timeoutMs);\n\n\tif (signal?.aborted) abortFromParent();\n\telse signal?.addEventListener(\"abort\", abortFromParent, { once: true });\n\n\ttry {\n\t\tconst response = await fetch(url, { ...request, signal: controller.signal });\n\t\tconst text = await readResponseTextBounded(response, {\n\t\t\tmaxBytes: DEEPWIKI_RESPONSE_BODY_BYTES,\n\t\t\toverflowMessage: DEEPWIKI_RESPONSE_OVERFLOW_MESSAGE,\n\t\t\tsignal: controller.signal,\n\t\t});\n\t\treturn { ok: true, response, text };\n\t} catch (error) {\n\t\tif (timedOut) throw new Error(`${label} request timed out after ${timeoutMs / 1000}s`);\n\t\tif (signal?.aborted) throw new Error(`${label} request aborted`);\n\t\tconst normalizedError = error instanceof Error ? error : new Error(String(error));\n\t\treturn {\n\t\t\tok: false,\n\t\t\terror: normalizedError,\n\t\t\tretryable: normalizedError.message !== DEEPWIKI_RESPONSE_OVERFLOW_MESSAGE,\n\t\t};\n\t} finally {\n\t\tclearTimeout(timeout);\n\t\tsignal?.removeEventListener(\"abort\", abortFromParent);\n\t}\n}\n\n/** Fetch with a per-attempt timeout and bounded retries for transient failures. */\nexport async function fetchWithRetry(\n\turl: string,\n\trequest: RequestInit,\n\toptions: FetchRetryOptions,\n): Promise<{ response: Response; text: string }> {\n\tconst retries = options.retries ?? 2;\n\tconst label = options.label ?? \"HTTP\";\n\tlet lastError: Error | undefined;\n\n\tfor (let attemptIndex = 0; attemptIndex <= retries; attemptIndex++) {\n\t\tif (attemptIndex > 0) await delay(1000 * attemptIndex, label, options.signal);\n\t\tconst outcome = await attemptOnce(url, request, options.timeoutMs, label, options.signal);\n\t\tif (!outcome.ok) {\n\t\t\tlastError = outcome.error;\n\t\t\tif (!outcome.retryable) throw outcome.error;\n\t\t\tcontinue;\n\t\t}\n\n\t\tconst { response, text } = outcome;\n\t\tconst retryable = response.status >= 500 || response.status === 429;\n\t\tif (!response.ok && retryable && attemptIndex < retries) {\n\t\t\tlastError = new Error(`${label} HTTP ${response.status}`);\n\t\t\tcontinue;\n\t\t}\n\t\treturn { response, text };\n\t}\n\n\tthrow lastError ?? new Error(`${label} request failed`);\n}\n"]}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
/** Human-facing status labels shared by the /tasks panel and transcript renderers. */
|
|
2
|
-
import type { TaskStatus } from "../../../core/tasks/types.ts";
|
|
3
|
-
import { type StatusMarkerColor } from "../../../modes/interactive/components/status-marker.ts";
|
|
4
|
-
export declare function statusName(status: string): string;
|
|
5
|
-
/** Static marker for transcripts; the /tasks panel animates running rows via statusMarker(status, { now }). */
|
|
6
|
-
export declare function statusGlyph(status: TaskStatus): string;
|
|
7
|
-
export declare function statusColor(status: TaskStatus): StatusMarkerColor;
|
|
8
|
-
//# sourceMappingURL=task-view.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"task-view.d.ts","sourceRoot":"","sources":["../../../../src/extensions/tasks/ui/task-view.ts"],"names":[],"mappings":"AAAA,sFAAsF;AAEtF,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,8BAA8B,CAAC;AAC/D,OAAO,EAAE,KAAK,iBAAiB,EAAgB,MAAM,wDAAwD,CAAC;AAE9G,wBAAgB,UAAU,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAEjD;AAED,+GAA+G;AAC/G,wBAAgB,WAAW,CAAC,MAAM,EAAE,UAAU,GAAG,MAAM,CAEtD;AAED,wBAAgB,WAAW,CAAC,MAAM,EAAE,UAAU,GAAG,iBAAiB,CAEjE"}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
/** Human-facing status labels shared by the /tasks panel and transcript renderers. */
|
|
2
|
-
import { statusMarker } from "../../../modes/interactive/components/status-marker.js";
|
|
3
|
-
export function statusName(status) {
|
|
4
|
-
return status === "timeout" ? "Timed out" : status ? status[0].toUpperCase() + status.slice(1) : "Unknown";
|
|
5
|
-
}
|
|
6
|
-
/** Static marker for transcripts; the /tasks panel animates running rows via statusMarker(status, { now }). */
|
|
7
|
-
export function statusGlyph(status) {
|
|
8
|
-
return statusMarker(status).glyph;
|
|
9
|
-
}
|
|
10
|
-
export function statusColor(status) {
|
|
11
|
-
return statusMarker(status).color;
|
|
12
|
-
}
|
|
13
|
-
//# sourceMappingURL=task-view.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"task-view.js","sourceRoot":"","sources":["../../../../src/extensions/tasks/ui/task-view.ts"],"names":[],"mappings":"AAAA,sFAAsF;AAGtF,OAAO,EAA0B,YAAY,EAAE,MAAM,wDAAwD,CAAC;AAE9G,MAAM,UAAU,UAAU,CAAC,MAAc;IACxC,OAAO,MAAM,KAAK,SAAS,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAE,CAAC,WAAW,EAAE,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;AAC7G,CAAC;AAED,+GAA+G;AAC/G,MAAM,UAAU,WAAW,CAAC,MAAkB;IAC7C,OAAO,YAAY,CAAC,MAAM,CAAC,CAAC,KAAK,CAAC;AACnC,CAAC;AAED,MAAM,UAAU,WAAW,CAAC,MAAkB;IAC7C,OAAO,YAAY,CAAC,MAAM,CAAC,CAAC,KAAK,CAAC;AACnC,CAAC","sourcesContent":["/** Human-facing status labels shared by the /tasks panel and transcript renderers. */\n\nimport type { TaskStatus } from \"../../../core/tasks/types.ts\";\nimport { type StatusMarkerColor, statusMarker } from \"../../../modes/interactive/components/status-marker.ts\";\n\nexport function statusName(status: string): string {\n\treturn status === \"timeout\" ? \"Timed out\" : status ? status[0]!.toUpperCase() + status.slice(1) : \"Unknown\";\n}\n\n/** Static marker for transcripts; the /tasks panel animates running rows via statusMarker(status, { now }). */\nexport function statusGlyph(status: TaskStatus): string {\n\treturn statusMarker(status).glyph;\n}\n\nexport function statusColor(status: TaskStatus): StatusMarkerColor {\n\treturn statusMarker(status).color;\n}\n"]}
|