@caupulican/pi-adaptative 0.85.0 → 0.85.4
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 +54 -0
- package/dist/bundled-resources/runtimes/pi-shell-engine/arithmetic.py +364 -0
- package/dist/bundled-resources/runtimes/pi-shell-engine/context.py +2 -1
- package/dist/bundled-resources/runtimes/pi-shell-engine/errors.py +16 -0
- package/dist/bundled-resources/runtimes/pi-shell-engine/exec.py +137 -14
- package/dist/bundled-resources/runtimes/pi-shell-engine/nodes.py +23 -2
- package/dist/bundled-resources/runtimes/pi-shell-engine/parser.py +134 -6
- package/dist/bundled-resources/runtimes/pi-shell-engine/tokens.py +25 -2
- package/dist/core/agent-session-services.d.ts.map +1 -1
- package/dist/core/agent-session-services.js +2 -0
- package/dist/core/agent-session-services.js.map +1 -1
- package/dist/core/agent-session.d.ts +6 -5
- package/dist/core/agent-session.d.ts.map +1 -1
- package/dist/core/agent-session.js +84 -87
- package/dist/core/agent-session.js.map +1 -1
- package/dist/core/auth-guidance.d.ts.map +1 -1
- package/dist/core/auth-guidance.js +3 -0
- package/dist/core/auth-guidance.js.map +1 -1
- package/dist/core/autonomy/lane-tool-surface.d.ts +2 -0
- package/dist/core/autonomy/lane-tool-surface.d.ts.map +1 -1
- package/dist/core/autonomy/lane-tool-surface.js +4 -3
- package/dist/core/autonomy/lane-tool-surface.js.map +1 -1
- package/dist/core/background-lane-controller.d.ts +4 -0
- package/dist/core/background-lane-controller.d.ts.map +1 -1
- package/dist/core/background-lane-controller.js +2 -0
- package/dist/core/background-lane-controller.js.map +1 -1
- package/dist/core/background-tool-task-controller.d.ts +12 -7
- package/dist/core/background-tool-task-controller.d.ts.map +1 -1
- package/dist/core/background-tool-task-controller.js +55 -19
- package/dist/core/background-tool-task-controller.js.map +1 -1
- package/dist/core/bedrock-scope.d.ts +26 -0
- package/dist/core/bedrock-scope.d.ts.map +1 -0
- package/dist/core/bedrock-scope.js +178 -0
- package/dist/core/bedrock-scope.js.map +1 -0
- package/dist/core/compaction-controller.d.ts +2 -0
- package/dist/core/compaction-controller.d.ts.map +1 -1
- package/dist/core/compaction-controller.js +35 -13
- package/dist/core/compaction-controller.js.map +1 -1
- package/dist/core/delegation/worker-delegation-controller.d.ts.map +1 -1
- package/dist/core/delegation/worker-delegation-controller.js +6 -0
- package/dist/core/delegation/worker-delegation-controller.js.map +1 -1
- package/dist/core/extensions/loader.d.ts.map +1 -1
- package/dist/core/extensions/loader.js +3 -0
- package/dist/core/extensions/loader.js.map +1 -1
- package/dist/core/failure-corpus.d.ts +26 -1
- package/dist/core/failure-corpus.d.ts.map +1 -1
- package/dist/core/failure-corpus.js +17 -0
- package/dist/core/failure-corpus.js.map +1 -1
- package/dist/core/foreground-recovery-controller.d.ts +25 -2
- package/dist/core/foreground-recovery-controller.d.ts.map +1 -1
- package/dist/core/foreground-recovery-controller.js +111 -2
- package/dist/core/foreground-recovery-controller.js.map +1 -1
- package/dist/core/foreground-terminal-handoff-controller.d.ts +27 -0
- package/dist/core/foreground-terminal-handoff-controller.d.ts.map +1 -0
- package/dist/core/foreground-terminal-handoff-controller.js +56 -0
- package/dist/core/foreground-terminal-handoff-controller.js.map +1 -0
- package/dist/core/goal-loop-controller.d.ts.map +1 -1
- package/dist/core/goal-loop-controller.js +5 -0
- package/dist/core/goal-loop-controller.js.map +1 -1
- package/dist/core/goals/goal-auto-continue-controller.d.ts +3 -0
- package/dist/core/goals/goal-auto-continue-controller.d.ts.map +1 -1
- package/dist/core/goals/goal-auto-continue-controller.js +28 -7
- package/dist/core/goals/goal-auto-continue-controller.js.map +1 -1
- package/dist/core/human-input-controller.d.ts +9 -0
- package/dist/core/human-input-controller.d.ts.map +1 -1
- package/dist/core/human-input-controller.js +60 -5
- package/dist/core/human-input-controller.js.map +1 -1
- package/dist/core/human-input.d.ts +12 -0
- package/dist/core/human-input.d.ts.map +1 -1
- package/dist/core/human-input.js +59 -12
- package/dist/core/human-input.js.map +1 -1
- package/dist/core/local-runtime-controller.d.ts.map +1 -1
- package/dist/core/local-runtime-controller.js +15 -9
- package/dist/core/local-runtime-controller.js.map +1 -1
- package/dist/core/memory/providers/file-store.d.ts +1 -0
- package/dist/core/memory/providers/file-store.d.ts.map +1 -1
- package/dist/core/memory/providers/file-store.js +252 -125
- package/dist/core/memory/providers/file-store.js.map +1 -1
- package/dist/core/model-capability.d.ts +15 -1
- package/dist/core/model-capability.d.ts.map +1 -1
- package/dist/core/model-capability.js +24 -1
- package/dist/core/model-capability.js.map +1 -1
- package/dist/core/model-registry.d.ts +5 -0
- package/dist/core/model-registry.d.ts.map +1 -1
- package/dist/core/model-registry.js +18 -0
- package/dist/core/model-registry.js.map +1 -1
- package/dist/core/model-router-controller.d.ts +6 -6
- package/dist/core/model-router-controller.d.ts.map +1 -1
- package/dist/core/model-router-controller.js +5 -5
- package/dist/core/model-router-controller.js.map +1 -1
- package/dist/core/model-tool-protocol.d.ts +3 -2
- package/dist/core/model-tool-protocol.d.ts.map +1 -1
- package/dist/core/model-tool-protocol.js +5 -1
- package/dist/core/model-tool-protocol.js.map +1 -1
- package/dist/core/models/context-sizing.d.ts +1 -0
- package/dist/core/models/context-sizing.d.ts.map +1 -1
- package/dist/core/models/context-sizing.js +4 -1
- package/dist/core/models/context-sizing.js.map +1 -1
- package/dist/core/models/default-model-suggestions.d.ts.map +1 -1
- package/dist/core/models/default-model-suggestions.js +20 -10
- package/dist/core/models/default-model-suggestions.js.map +1 -1
- package/dist/core/models/llamacpp-runtime.d.ts +32 -11
- package/dist/core/models/llamacpp-runtime.d.ts.map +1 -1
- package/dist/core/models/llamacpp-runtime.js +79 -28
- package/dist/core/models/llamacpp-runtime.js.map +1 -1
- package/dist/core/models/local-execution-planner.d.ts +24 -0
- package/dist/core/models/local-execution-planner.d.ts.map +1 -0
- package/dist/core/models/local-execution-planner.js +119 -0
- package/dist/core/models/local-execution-planner.js.map +1 -0
- package/dist/core/models/local-inference-profile.d.ts +34 -0
- package/dist/core/models/local-inference-profile.d.ts.map +1 -0
- package/dist/core/models/local-inference-profile.js +74 -0
- package/dist/core/models/local-inference-profile.js.map +1 -0
- package/dist/core/models/local-runtime.d.ts +23 -4
- package/dist/core/models/local-runtime.d.ts.map +1 -1
- package/dist/core/models/local-runtime.js +11 -8
- package/dist/core/models/local-runtime.js.map +1 -1
- package/dist/core/models/managed-ollama-model.d.ts +26 -0
- package/dist/core/models/managed-ollama-model.d.ts.map +1 -0
- package/dist/core/models/managed-ollama-model.js +59 -0
- package/dist/core/models/managed-ollama-model.js.map +1 -0
- package/dist/core/models/model-ref.js +11 -11
- package/dist/core/models/model-ref.js.map +1 -1
- package/dist/core/models/prism-llamacpp-lifecycle.d.ts +10 -20
- package/dist/core/models/prism-llamacpp-lifecycle.d.ts.map +1 -1
- package/dist/core/models/prism-llamacpp-lifecycle.js +11 -31
- package/dist/core/models/prism-llamacpp-lifecycle.js.map +1 -1
- package/dist/core/models/prism-llamacpp-server-probe.d.ts +10 -0
- package/dist/core/models/prism-llamacpp-server-probe.d.ts.map +1 -0
- package/dist/core/models/prism-llamacpp-server-probe.js +36 -0
- package/dist/core/models/prism-llamacpp-server-probe.js.map +1 -0
- package/dist/core/models/runtime-arbiter.d.ts +3 -0
- package/dist/core/models/runtime-arbiter.d.ts.map +1 -1
- package/dist/core/models/runtime-arbiter.js +2 -1
- package/dist/core/models/runtime-arbiter.js.map +1 -1
- package/dist/core/models/runtime-process.d.ts +7 -1
- package/dist/core/models/runtime-process.d.ts.map +1 -1
- package/dist/core/models/runtime-process.js +4 -2
- package/dist/core/models/runtime-process.js.map +1 -1
- package/dist/core/process-matrix/runtime.js +43 -11
- package/dist/core/process-matrix/runtime.js.map +1 -1
- package/dist/core/research/research-lane-controller.d.ts.map +1 -1
- package/dist/core/research/research-lane-controller.js +14 -5
- package/dist/core/research/research-lane-controller.js.map +1 -1
- package/dist/core/resource-loader.d.ts +2 -0
- package/dist/core/resource-loader.d.ts.map +1 -1
- package/dist/core/resource-loader.js +18 -6
- package/dist/core/resource-loader.js.map +1 -1
- package/dist/core/runtime-builder.d.ts +5 -1
- package/dist/core/runtime-builder.d.ts.map +1 -1
- package/dist/core/runtime-builder.js +37 -4
- package/dist/core/runtime-builder.js.map +1 -1
- package/dist/core/scout-controller.d.ts +3 -2
- package/dist/core/scout-controller.d.ts.map +1 -1
- package/dist/core/scout-controller.js +1 -0
- package/dist/core/scout-controller.js.map +1 -1
- package/dist/core/sdk.d.ts.map +1 -1
- package/dist/core/sdk.js +10 -8
- package/dist/core/sdk.js.map +1 -1
- package/dist/core/settings-manager.d.ts +13 -0
- package/dist/core/settings-manager.d.ts.map +1 -1
- package/dist/core/settings-manager.js +59 -0
- package/dist/core/settings-manager.js.map +1 -1
- package/dist/core/system-prompt-builder.d.ts +5 -2
- package/dist/core/system-prompt-builder.d.ts.map +1 -1
- package/dist/core/system-prompt-builder.js +22 -10
- package/dist/core/system-prompt-builder.js.map +1 -1
- package/dist/core/system-prompt.d.ts +3 -0
- package/dist/core/system-prompt.d.ts.map +1 -1
- package/dist/core/system-prompt.js +181 -55
- package/dist/core/system-prompt.js.map +1 -1
- package/dist/core/tool-protocol-controller.d.ts.map +1 -1
- package/dist/core/tool-protocol-controller.js +5 -3
- package/dist/core/tool-protocol-controller.js.map +1 -1
- package/dist/core/tool-recovery-log-records.d.ts +33 -1
- package/dist/core/tool-recovery-log-records.d.ts.map +1 -1
- package/dist/core/tool-recovery-log-records.js +59 -12
- package/dist/core/tool-recovery-log-records.js.map +1 -1
- package/dist/core/tool-recovery-logger.d.ts +12 -1
- package/dist/core/tool-recovery-logger.d.ts.map +1 -1
- package/dist/core/tool-recovery-logger.js +24 -1
- package/dist/core/tool-recovery-logger.js.map +1 -1
- package/dist/core/tool-repair-health.d.ts.map +1 -1
- package/dist/core/tool-repair-health.js +6 -0
- package/dist/core/tool-repair-health.js.map +1 -1
- package/dist/core/tools/bash.d.ts +2 -2
- package/dist/core/tools/bash.d.ts.map +1 -1
- package/dist/core/tools/bash.js +2 -2
- package/dist/core/tools/bash.js.map +1 -1
- package/dist/core/tools/edit-diff.d.ts +2 -0
- package/dist/core/tools/edit-diff.d.ts.map +1 -1
- package/dist/core/tools/edit-diff.js +9 -1
- package/dist/core/tools/edit-diff.js.map +1 -1
- package/dist/core/tools/edit.d.ts +5 -8
- package/dist/core/tools/edit.d.ts.map +1 -1
- package/dist/core/tools/edit.js +88 -55
- package/dist/core/tools/edit.js.map +1 -1
- package/dist/core/tools/file-mutation-intent.d.ts +42 -15
- package/dist/core/tools/file-mutation-intent.d.ts.map +1 -1
- package/dist/core/tools/file-mutation-intent.js +271 -77
- package/dist/core/tools/file-mutation-intent.js.map +1 -1
- package/dist/core/tools/find.d.ts +2 -1
- package/dist/core/tools/find.d.ts.map +1 -1
- package/dist/core/tools/find.js +2 -6
- package/dist/core/tools/find.js.map +1 -1
- package/dist/core/tools/grep.d.ts +2 -1
- package/dist/core/tools/grep.d.ts.map +1 -1
- package/dist/core/tools/grep.js +2 -6
- package/dist/core/tools/grep.js.map +1 -1
- package/dist/core/tools/index.d.ts +1 -1
- package/dist/core/tools/index.d.ts.map +1 -1
- package/dist/core/tools/index.js +1 -1
- package/dist/core/tools/index.js.map +1 -1
- package/dist/core/tools/managed-search-tool.d.ts +8 -0
- package/dist/core/tools/managed-search-tool.d.ts.map +1 -0
- package/dist/core/tools/managed-search-tool.js +10 -0
- package/dist/core/tools/managed-search-tool.js.map +1 -0
- package/dist/core/tools/shell-command-parser.d.ts +4 -3
- package/dist/core/tools/shell-command-parser.d.ts.map +1 -1
- package/dist/core/tools/shell-command-parser.js +32 -7
- package/dist/core/tools/shell-command-parser.js.map +1 -1
- package/dist/core/tools/shell-contract-router.d.ts.map +1 -1
- package/dist/core/tools/shell-contract-router.js +23 -1
- package/dist/core/tools/shell-contract-router.js.map +1 -1
- package/dist/core/tools/windows-shell-engine.js +1 -1
- package/dist/core/tools/windows-shell-engine.js.map +1 -1
- package/dist/core/tools/write.d.ts +5 -10
- package/dist/core/tools/write.d.ts.map +1 -1
- package/dist/core/tools/write.js +92 -73
- package/dist/core/tools/write.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/modes/interactive/auth-dialogs-controller.d.ts +6 -0
- package/dist/modes/interactive/auth-dialogs-controller.d.ts.map +1 -1
- package/dist/modes/interactive/auth-dialogs-controller.js +59 -12
- package/dist/modes/interactive/auth-dialogs-controller.js.map +1 -1
- package/dist/modes/interactive/local-model-commands.d.ts +1 -1
- package/dist/modes/interactive/local-model-commands.d.ts.map +1 -1
- package/dist/modes/interactive/local-model-commands.js +51 -8
- package/dist/modes/interactive/local-model-commands.js.map +1 -1
- package/dist/utils/paths.js +1 -1
- package/dist/utils/paths.js.map +1 -1
- package/dist/utils/tools-manager.d.ts +18 -1
- package/dist/utils/tools-manager.d.ts.map +1 -1
- package/dist/utils/tools-manager.js +73 -43
- package/dist/utils/tools-manager.js.map +1 -1
- package/docs/models.md +1 -1
- package/docs/providers.md +34 -10
- package/docs/settings.md +1 -1
- package/docs/tool-boundary-performance-roadmap-2026-08-02.md +21 -18
- package/docs/tool-repair.md +3 -3
- package/docs/windows.md +7 -5
- package/examples/extensions/built-in-tool-renderer.ts +1 -1
- package/examples/extensions/custom-provider-anthropic/package-lock.json +2 -2
- package/examples/extensions/custom-provider-anthropic/package.json +1 -1
- package/examples/extensions/custom-provider-gitlab-duo/package.json +1 -1
- package/examples/extensions/minimal-mode.ts +1 -1
- package/examples/extensions/prompt-customizer.ts +2 -2
- package/examples/extensions/sandbox/package-lock.json +2 -2
- package/examples/extensions/sandbox/package.json +1 -1
- package/examples/extensions/ssh.ts +17 -0
- package/examples/extensions/with-deps/package-lock.json +2 -2
- package/examples/extensions/with-deps/package.json +1 -1
- package/npm-shrinkwrap.json +240 -260
- package/package.json +6 -6
package/docs/providers.md
CHANGED
|
@@ -201,6 +201,9 @@ export AZURE_OPENAI_DEPLOYMENT_NAME_MAP=gpt-4=my-gpt4,gpt-4o=my-gpt4o
|
|
|
201
201
|
|
|
202
202
|
### Amazon Bedrock
|
|
203
203
|
|
|
204
|
+
Amazon Bedrock requires an explicit verified region scope. A region from `~/.aws/config` is not
|
|
205
|
+
enough: Pi persists and sends `AWS_REGION` explicitly so discovery and runtime requests cannot drift.
|
|
206
|
+
|
|
204
207
|
```bash
|
|
205
208
|
# Option 1: AWS Profile (recommended for IAM Identity Center / SSO)
|
|
206
209
|
export AWS_PROFILE=your-profile
|
|
@@ -212,31 +215,48 @@ export AWS_SECRET_ACCESS_KEY=...
|
|
|
212
215
|
# Option 3: Bearer Token
|
|
213
216
|
export AWS_BEARER_TOKEN_BEDROCK=...
|
|
214
217
|
|
|
215
|
-
#
|
|
216
|
-
export AWS_REGION=us-
|
|
218
|
+
# Required AWS scope. US inference profiles in Ohio use us-east-2.
|
|
219
|
+
export AWS_REGION=us-east-2
|
|
217
220
|
```
|
|
218
221
|
|
|
219
222
|
For an SSO profile, AWS CLI v2 is required and the modern `sso-session` profile format is recommended.
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
223
|
+
Run `/login amazon-bedrock`, select SSO, and enter the exact profile and region. For IAM keys, bearer
|
|
224
|
+
tokens, ECS roles, or IRSA, select the ambient-credentials option and enter the exact region. Pi then:
|
|
225
|
+
|
|
226
|
+
1. verifies the selected profile and region with STS;
|
|
227
|
+
2. paginates region-scoped system inference profiles;
|
|
228
|
+
3. selects the current US/EU/APAC/global Claude candidate for each available tier;
|
|
229
|
+
4. runs a bounded one-token runtime probe for every candidate; and
|
|
230
|
+
5. persists the exact profile, region, verified model IDs, verification mode, and timestamp in the
|
|
231
|
+
user settings file.
|
|
232
|
+
|
|
233
|
+
Bearer tokens skip STS and control-plane discovery because that auth mode cannot reliably use them;
|
|
234
|
+
Pi instead probes the bounded region-derived candidates directly. A credential alone exposes no
|
|
235
|
+
Bedrock models. If `AWS_PROFILE` or `AWS_REGION` later differs from the saved scope, the saved model
|
|
236
|
+
evidence is rejected until `/login amazon-bedrock` verifies the new scope. Direct Anthropic models are
|
|
237
|
+
unaffected.
|
|
238
|
+
|
|
239
|
+
Pi runs `aws sso login --profile <profile>` without a shell. The AWS SDK refreshes ordinary role
|
|
240
|
+
credentials; if the underlying SSO session later expires, Pi performs one foreground login and
|
|
241
|
+
replays the Bedrock request once, only before a response has started. Background and worker requests
|
|
242
|
+
never open a browser and instead return an authentication-required error to the owning session.
|
|
226
243
|
|
|
227
244
|
Also supports ECS task roles (`AWS_CONTAINER_CREDENTIALS_*`) and IRSA (`AWS_WEB_IDENTITY_TOKEN_FILE`).
|
|
228
245
|
|
|
229
246
|
```bash
|
|
230
|
-
pi --provider amazon-bedrock --model us.anthropic.claude-sonnet-
|
|
247
|
+
pi --provider amazon-bedrock --model us.anthropic.claude-sonnet-5
|
|
231
248
|
```
|
|
232
249
|
|
|
233
250
|
Prompt caching is enabled automatically for Claude models whose ID contains a recognizable model name (base models and system-defined inference profiles). For application inference profiles (whose ARNs don't contain the model name), set `AWS_BEDROCK_FORCE_CACHE=1` to enable cache points:
|
|
234
251
|
|
|
235
252
|
```bash
|
|
236
253
|
export AWS_BEDROCK_FORCE_CACHE=1
|
|
237
|
-
pi --provider amazon-bedrock --model arn:aws:bedrock:us-east-
|
|
254
|
+
pi --provider amazon-bedrock --model arn:aws:bedrock:us-east-2:123456789012:application-inference-profile/abc123
|
|
238
255
|
```
|
|
239
256
|
|
|
257
|
+
An explicitly configured application-inference-profile ARN remains selectable only when its ARN
|
|
258
|
+
region matches the verified scope. It does not expand the discovered system-model allowlist.
|
|
259
|
+
|
|
240
260
|
If you are connecting to a Bedrock API proxy, the following environment variables can be used:
|
|
241
261
|
|
|
242
262
|
```bash
|
|
@@ -250,6 +270,10 @@ export AWS_BEDROCK_SKIP_AUTH=1
|
|
|
250
270
|
export AWS_BEDROCK_FORCE_HTTP1=1
|
|
251
271
|
```
|
|
252
272
|
|
|
273
|
+
An explicit unauthenticated proxy (`AWS_BEDROCK_SKIP_AUTH=1` plus
|
|
274
|
+
`AWS_ENDPOINT_URL_BEDROCK_RUNTIME`) is outside AWS account/region verification and retains its custom
|
|
275
|
+
model surface.
|
|
276
|
+
|
|
253
277
|
### Cloudflare AI Gateway
|
|
254
278
|
|
|
255
279
|
`CLOUDFLARE_API_KEY` can be set via `/login`. The account ID and gateway slug must be set as environment variables.
|
package/docs/settings.md
CHANGED
|
@@ -278,7 +278,7 @@ Worker writes use **review-after-apply** semantics: a grant-authorized direct `w
|
|
|
278
278
|
|
|
279
279
|
Deterministic argument repair is built in and has no settings toggle; schema-valid calls still return unchanged without entering the repair layer. `PI_TOOL_REPAIR_DISABLED=1` remains only an emergency diagnostic kill switch.
|
|
280
280
|
|
|
281
|
-
Text protocol precedence is: `PI_TEXT_TOOL_CALL_PROTOCOL_DISABLED=1` kills it
|
|
281
|
+
Text protocol precedence is: `PI_TEXT_TOOL_CALL_PROTOCOL_DISABLED=1` kills it; a persisted `/toolprobe` native verdict then keeps that exact model on native calls; otherwise `toolRepair.textProtocol` force-enables or disables globally, per-model `textToolCallProtocol` applies, and finally a persisted calibrated text-protocol verdict applies. The phone/text protocol is therefore a fallback lane for models without proven native calls, never a replacement for a proven native path. Failed calibration is stored per host/model and can be cleared with `/toolprotocol-reset <provider/model>`.
|
|
282
282
|
|
|
283
283
|
Environment kill switches override their diagnostic layers: `PI_TOOL_REPAIR_DISABLED=1`, `PI_TOOL_REPAIR_TEACH_DISABLED=1`, and `PI_TEXT_TOOL_CALL_PROTOCOL_DISABLED=1`. See [Tool repair](tool-repair.md) for diagnostics, reset controls, and replay.
|
|
284
284
|
|
|
@@ -7,8 +7,9 @@ not exercised.
|
|
|
7
7
|
|
|
8
8
|
## Required invariants
|
|
9
9
|
|
|
10
|
-
1. Validate cheap authority, path, identity, availability, and collision facts
|
|
11
|
-
|
|
10
|
+
1. Validate cheap authority, path, identity, availability, and collision facts at the earliest harness-owned
|
|
11
|
+
execution boundary, before payload processing or mutation. Never make the model coordinate preparation, and
|
|
12
|
+
recheck mutable facts inside the serialized mutation boundary immediately before the write.
|
|
12
13
|
2. Keep coordinators, payload handles, mutable queues, and retry state session-owned unless cross-session
|
|
13
14
|
coordination is the explicit invariant.
|
|
14
15
|
3. Store large bytes once, outside the JavaScript heap where practical. Context and telemetry retain bounded
|
|
@@ -23,10 +24,10 @@ not exercised.
|
|
|
23
24
|
|
|
24
25
|
| Boundary | Root cause | Fix | Evidence gate |
|
|
25
26
|
| --- | --- | --- | --- |
|
|
26
|
-
| Write collision | `write` accepted the full content before discovering an occupied destination and could overwrite it. |
|
|
27
|
-
| Missing/stale edit | `edit` accepted replacement payloads before existence checks and could apply a plan prepared against older bytes. |
|
|
27
|
+
| Write collision | `write` accepted the full content before discovering an occupied destination and could overwrite it. | One semantic model call; the harness preflights collision and parent access, rechecks inside the path queue, and finishes with atomic no-clobber creation. When the generated payload is valid and only the name collides, its exact bytes move to a bounded session cache so repair supplies only a corrected path and opaque reference. | `test/file-mutation-preflight.test.ts`; `test/file-encoding-policy.test.ts`; `test/phone-filesystem-workflow.test.ts` |
|
|
28
|
+
| Missing/stale edit | `edit` accepted replacement payloads before existence checks and could apply a plan prepared against older bytes. | One semantic model call; the harness snapshots path identity, rechecks after queue admission and immediately before writing, and rejects missing or changed targets. Valid edits paired with only a missing/non-file path receive the same bounded retarget treatment and are fully revalidated against each corrected candidate. | `test/file-mutation-preflight.test.ts`; `test/file-mutation-queue.test.ts`; `test/phone-filesystem-workflow.test.ts` |
|
|
28
29
|
| Repeated exact content | Copying identical generated content to another destination required retransmitting it. | Successful writes/edits return a session-local `contentRef`; the bounded controller hashes the source and performs exclusive verified copies without retaining bytes on the JS heap. | `test/file-mutation-preflight.test.ts` |
|
|
29
|
-
| Encoding corruption | An unsafe text edit could be remembered as a retryable operation and teach repair/re-read loops. | The central execution-error catalogue classifies `PI_FILE_ENCODING_CORRUPTION` as change-approach,
|
|
30
|
+
| Encoding corruption | An unsafe text edit could be remembered as a retryable operation and teach repair/re-read loops. | The central execution-error catalogue classifies `PI_FILE_ENCODING_CORRUPTION` as change-approach, retains no operation arguments, exposes one bounded directive, and expires it after the next assistant response. | `packages/ai/test/tool-execution-error-catalogue.test.ts`; `packages/agent/test/tool-failure-memory.test.ts` |
|
|
30
31
|
| Edit preview flattening | Preview rendering used `JSON.stringify({ path, edits })` during render and result settlement, copying the complete edit payload. | Constant-size request generations fence asynchronous previews; partial renders do not scan accumulated edits. | `test/edit-tool-no-full-redraw.test.ts` |
|
|
31
32
|
| Write preview flattening | Collapsed streamed previews compared the complete prior content prefix, split and highlighted complete snapshots, and retained duplicate full line arrays. | Collapsed rendering inspects at most 8,192 characters, caches by argument-generation identity, and performs one allocation-free final line count; complete text is materialized only on explicit expansion. | `test/tool-execution-component.test.ts` |
|
|
32
33
|
| Loop/failure payload retention | Stall and failure signatures serialized complete tool arguments and stored the normalized string in the loop window. | A streaming structural fingerprint returns 32 hex characters; failure display keeps a bounded structural preview and never serializes the original payload. | `packages/agent/test/tool-failure-memory.test.ts` |
|
|
@@ -74,11 +75,12 @@ the interpreter. An invalid working directory can therefore waste the entire gen
|
|
|
74
75
|
|
|
75
76
|
Required design:
|
|
76
77
|
|
|
77
|
-
-
|
|
78
|
-
|
|
79
|
-
-
|
|
80
|
-
|
|
81
|
-
-
|
|
78
|
+
- Keep one semantic model call. The harness owns cwd/runtime preflight at the start of execution and performs no
|
|
79
|
+
code evaluation or process creation until it passes.
|
|
80
|
+
- Runtime failure or coordinator reset invalidates any internal lease; code is not stored as retry memory and
|
|
81
|
+
no preparation token is exposed to the model.
|
|
82
|
+
- If a provider exposes a complete path before the remaining arguments, speculative streaming preflight may
|
|
83
|
+
warm the same authority check, but final execution remains authoritative and provider-neutral.
|
|
82
84
|
|
|
83
85
|
Acceptance evidence: invalid cwd/runtime tests prove that no `code` field was accepted; stale and cross-session
|
|
84
86
|
intents fail; successful warm preparation meets the same p95 budget as P0.1.
|
|
@@ -102,8 +104,8 @@ path traversal, and cleanup-failure probes; parent session remains responsive an
|
|
|
102
104
|
|
|
103
105
|
### P0.4 Close edit's external-writer race
|
|
104
106
|
|
|
105
|
-
Evidence: edit
|
|
106
|
-
replace the file
|
|
107
|
+
Evidence: edit now verifies identity before `readFile()` and again immediately before `writeFile()`. A non-Pi
|
|
108
|
+
writer can still replace the file in the final check/write gap because the adapter overwrites by path.
|
|
107
109
|
|
|
108
110
|
Required design: bind read/compare/commit to a file handle or an adapter-owned compare-and-replace primitive;
|
|
109
111
|
fail closed when identity changes. Define Windows replace/share semantics explicitly and preserve BOM/newlines.
|
|
@@ -139,9 +141,9 @@ same-timestamp replacement, Windows sharing violations, abort, and cleanup failu
|
|
|
139
141
|
- **Ropes/piece tables for provider payloads:** rejected at the network boundary. Providers still require a
|
|
140
142
|
contiguous JSON/body representation; chunked message ownership, pruning before formatting, and one terminal
|
|
141
143
|
serialization are the useful controls.
|
|
142
|
-
- **
|
|
143
|
-
shows large arguments. Their requests are small, outputs are bounded or artifact-backed, and an
|
|
144
|
-
round trip would cost more than
|
|
144
|
+
- **Model-visible two-call preflight for `read`, `grep`, `find`, `ls`, and artifact retrieval:** rejected unless
|
|
145
|
+
new evidence shows large arguments. Their requests are small, outputs are bounded or artifact-backed, and an
|
|
146
|
+
extra model round trip would cost more than harness-owned validation.
|
|
145
147
|
- **Replacing native JSON globally:** rejected without per-boundary benchmarks. Several provider transports
|
|
146
148
|
require JSON text; changing parsers cannot remove serialization and may add copies. Optimize duplicate
|
|
147
149
|
serialization and retained ownership first.
|
|
@@ -150,11 +152,12 @@ same-timestamp replacement, Windows sharing violations, abort, and cleanup failu
|
|
|
150
152
|
|
|
151
153
|
## Incomplete probes
|
|
152
154
|
|
|
153
|
-
- Windows timing distributions for local and SSH-backed
|
|
155
|
+
- Windows timing distributions for local and SSH-backed automatic preflight/final mutation.
|
|
156
|
+
- Live SSH round-trip coverage for remote retained-payload staging, expiry, retarget, and cleanup; the adapter is compile-checked but this cycle used no SSH fixture.
|
|
154
157
|
- Heap/GC profiles for multi-megabyte skill drafts and extension smoke tests.
|
|
155
158
|
- External-writer race reproduction on NTFS with antivirus/indexer sharing behavior.
|
|
156
|
-
- Provider-specific cost
|
|
157
|
-
|
|
159
|
+
- Provider-specific rejected-payload cost when a one-call mutation fails preflight after response completion,
|
|
160
|
+
plus the portability and cancellation semantics of speculative streaming preflight.
|
|
158
161
|
- Persistent Python protocol throughput and reset cost; no implementation exists yet, so prior process-spawn
|
|
159
162
|
timings are not acceptance evidence.
|
|
160
163
|
|
package/docs/tool-repair.md
CHANGED
|
@@ -11,7 +11,7 @@ Execution failures are not argument repairs. Pi removes their potentially large
|
|
|
11
11
|
- Repair is built-in and has no settings toggle. `PI_TOOL_REPAIR_DISABLED=1` is only an emergency diagnostic kill switch; normal configuration should leave repair on.
|
|
12
12
|
- Teaching can be disabled independently with `toolRepair.teach: false` or `PI_TOOL_REPAIR_TEACH_DISABLED=1`. Repairs can still execute; the in-band "Tool argument repair note" is suppressed.
|
|
13
13
|
- Tool-recovery logging can be disabled with `toolRepair.logging: false`. Repairs still run, but Pi does not enqueue recovery records or spawn the background recovery-log worker.
|
|
14
|
-
- Text tool-call protocol calibration can be enabled per model with `textToolCallProtocol: true` in `models.json`. `/toolprobe [provider/model]` can
|
|
14
|
+
- Text tool-call protocol calibration can be enabled per model with `textToolCallProtocol: true` in `models.json`. `/toolprobe [provider/model]` probes native calls first and can persist a host-local text-protocol verdict only when native calls are absent. A persisted native verdict always keeps that model off the text protocol, including when global or model settings enable it. Use `toolRepair.textProtocol` only as a global emergency force/kill switch for models without native proof; `PI_TEXT_TOOL_CALL_PROTOCOL_DISABLED=1` always disables it.
|
|
15
15
|
|
|
16
16
|
Example project settings:
|
|
17
17
|
|
|
@@ -29,7 +29,7 @@ Example project settings:
|
|
|
29
29
|
|
|
30
30
|
- Interactive tool panels show `[repaired arguments]` when execution used repaired arguments.
|
|
31
31
|
- RPC `tool_execution_start`, `tool_execution_update`, and `tool_execution_end` events include a `repair` object when arguments were repaired.
|
|
32
|
-
- `/toolhealth` prints model adaptation records for this host: tool-probe verdicts, calibrated or failed text protocol, learned standing rules, teach statistics,
|
|
32
|
+
- `/toolhealth` prints model adaptation records for this host: tool-probe verdicts, calibrated or failed text protocol, learned standing rules, teach statistics, recovery-log worker counters, and execution-failure counts by phase.
|
|
33
33
|
- `/toolrule-remove <provider/model> <mode>` removes one learned standing rule from the host-local adaptation store.
|
|
34
34
|
- `/toolprotocol-reset <provider/model>` removes a stored text protocol calibration or failed-calibration record so the next turn can calibrate again.
|
|
35
35
|
- `/toolprobe [provider/model]` probes the current fleet or one explicit model for native tool calls first, then text-protocol fallback, persists the verdict in the host-local adaptation store, and prints a report table.
|
|
@@ -45,7 +45,7 @@ node scripts/tool-repair-replay.mjs ~/.pi/agent/state/failure-corpus.jsonl --jso
|
|
|
45
45
|
node scripts/tool-repair-replay.mjs ~/.pi/agent/sessions/<session>.jsonl --fixtures /tmp/tool-repair-fixtures.json
|
|
46
46
|
```
|
|
47
47
|
|
|
48
|
-
The replay helper reads `tool_validation` corpus records and legacy bounced `tool_argument_validation` session entries. Current recovery telemetry is written by a dedicated `node:worker_threads` worker to `state/tool-recovery-events.jsonl`; bounced
|
|
48
|
+
The replay helper reads `tool_validation` corpus records and legacy bounced `tool_argument_validation` session entries. Current recovery telemetry is written by a dedicated `node:worker_threads` worker to `state/tool-recovery-events.jsonl`; bounced calls append sanitized `tool_validation` corpus rows, while rejected or failed executions append bounded `tool_execution` rows with phase, failure code, optional redacted diagnostic, and next action. Records do not store full tool arguments.
|
|
49
49
|
|
|
50
50
|
## Repair modes
|
|
51
51
|
|
package/docs/windows.md
CHANGED
|
@@ -13,7 +13,7 @@ Pi supports native Windows on x64 and ARM64. The Node.js package runs under Wind
|
|
|
13
13
|
The model always sees one stable `bash` tool contract. On Windows, a deterministic router classifies every command into one of three tiers instead of parsing the full Bash grammar in one place:
|
|
14
14
|
|
|
15
15
|
1. **PowerShell floor** (always available): one simple command — a bounded set of builtin translations or a quoted external argv — converted deterministically to PowerShell, exactly as before this tier existed.
|
|
16
|
-
2. **Bundled Python engine** (uv-provisioned Python 3.13, on by default): pipelines, redirection, chaining, quoting, expansion, globs, and the coreutils vocabulary below, plus every state-mutating command (`cd`, `export`, `unset`), which the engine always owns so there is a single mutator.
|
|
16
|
+
2. **Bundled Python engine** (uv-provisioned Python 3.13, on by default): pipelines, redirection, chaining, word-list and arithmetic `for` loops, loop control, quoting, expansion, globs, and the coreutils vocabulary below, plus every state-mutating command (`cd`, `export`, `unset`), which the engine always owns so there is a single mutator.
|
|
17
17
|
|
|
18
18
|
External programs are not reimplemented. A simple `rg` call runs the installed native `rg.exe` through the persistent PowerShell floor; when a pipeline or chain requires the Python coordinator, it spawns that same `rg.exe` directly without resolving or starting PowerShell. A `.ps1` target in an engine-owned command is adapted through the same selected PowerShell executable as the floor, without starting a nested model-authored shell.
|
|
19
19
|
3. **Named fail-closed refusal**: constructs outside the supported grammar (see below) return an actionable error naming the construct instead of guessing or downgrading silently.
|
|
@@ -36,7 +36,9 @@ The PowerShell tier runs with `-NoLogo -NoProfile -NonInteractive -Command` and
|
|
|
36
36
|
| Sequencing | `a ; b`, newline-separated, `a && b`, `a \|\| b`, `! pipeline` | Left-to-right / short-circuit / negation, bash-standard. |
|
|
37
37
|
| Subshell | `( … )` | Isolated cwd/env copy — inner `cd`/`export` do not leak out. |
|
|
38
38
|
| Brace group | `{ …; }` | Shares state — inner `cd`/`export` persist. |
|
|
39
|
-
|
|
|
39
|
+
| For loop | `for name in words; do …; done`, `for name; do …; done`, `for ((init; condition; update)); do …; done` | Word lists expand once before iteration; the final value remains in the session environment. The omitted-list form iterates shell positional arguments, which Pi does not supply. Arithmetic clauses support integer variables, updates, assignments, comparisons, logical/bitwise operators, and signed 64-bit wrapping. |
|
|
40
|
+
| Loop control | `break [N]`, `continue [N]` | Works across nested word-list and arithmetic loops. An omitted count means one; invalid counts report status 1 without crashing the coordinator. |
|
|
41
|
+
| Redirection | `>`, `>>`, `1>`, `1>>`, `<`, `2>`, `2>>`, `2>&1`, `&>`, `>&` | `/dev/null` maps to `os.devnull`. Unredirected stderr shares Pi's session output; explicit stderr redirection is honored for builtins, state commands, and external programs. |
|
|
40
42
|
| Quoting | `'…'`, `"…"`, `\x`, `$'…'` | Standard single/double/backslash/ANSI-C semantics. |
|
|
41
43
|
| Tilde | `~`, `~/x` | Word-start, unquoted, expands to `$HOME`. `~user` is unsupported (refusal). |
|
|
42
44
|
| Parameter expansion | `$VAR`, `$?`, `${VAR}`, `${V:-w}`, `${V:=w}`, `${V:+w}`, `${V:?w}`, `${#VAR}` | `$?` is the latest foreground pipeline status. POSIX `:`-prefixed (empty-or-unset) semantics only; other `${…}` operators refuse. |
|
|
@@ -53,13 +55,13 @@ Builtins: `cd`, `pwd`, `echo [-n -e -E]`, `printf`, `export`, `unset`, `exit [N]
|
|
|
53
55
|
- `wc`/`uniq -c` column widths reproduce GNU's dynamic field width only for the single-count stdin case; multi-count/file-arg forms use fixed deterministic padding.
|
|
54
56
|
- No shell-variable vs. exported-environment distinction: every `NAME=value` sets engine env.
|
|
55
57
|
- Sorting is always ordinal (`LC_ALL=C`): globs, `ls`, `find`, and default `sort`.
|
|
56
|
-
-
|
|
58
|
+
- Arithmetic loop variables use deterministic signed 64-bit wrapping; invalid shifts, division by zero, negative exponents, and malformed expressions return status 1 with a bounded diagnostic.
|
|
57
59
|
- Globs expand only the final path segment (`dir/*.py` works; `*/x.py` matches the directory part literally).
|
|
58
60
|
- `wc -m` counts UTF-8 characters (bash under `LC_ALL=C` counts bytes).
|
|
59
61
|
|
|
60
62
|
### Named unsupported constructs
|
|
61
63
|
|
|
62
|
-
Each of these fails closed with a named, actionable error instead of an approximation: `job-control` (trailing `&`, `fg`/`bg`/`jobs`/`wait`/`disown`), `process-substitution` (`<(…)`/`>(…)`), `arithmetic-expansion` (`$((…))`, `((…))`, `let`), `brace-expansion` (`{a,b,c}`), `nested-shell` (`bash`/`sh`/`cmd`/`powershell`/`pwsh`/`wsl`/… as a command word), `exec-builtin`, `heredoc`/`here-string` (`<<`, `<<-`, `<<<`), `function-definition`, `control-flow` (`if`/`
|
|
64
|
+
Each of these fails closed with a named, actionable error instead of an approximation: `job-control` (trailing `&`, `fg`/`bg`/`jobs`/`wait`/`disown`), `process-substitution` (`<(…)`/`>(…)`), `arithmetic-expansion` (`$((…))`, standalone `((…))`, and `let`; arithmetic `for` headers are supported), `brace-expansion` (`{a,b,c}`), `nested-shell` (`bash`/`sh`/`cmd`/`powershell`/`pwsh`/`wsl`/… as a command word), `exec-builtin`, `heredoc`/`here-string` (`<<`, `<<-`, `<<<`), `function-definition`, `control-flow` (`if`/`while`/`until`/`case`/`select`), `extended-glob` (`@(…)`, `!(…)`, etc.), `unsupported-builtin` (`eval`, `source`/`.`, `alias`, `trap`, `set`, `shopt`, `read`, `declare`, `local`), `unsupported-flag`, `posix-script` (`*.sh`, `/bin/…`), `cwd-missing`, `tilde-user`, `malformed-syntax` (unbalanced quote/paren/brace, empty pipeline element, missing redirect target, malformed `for` loop), `parameter-expansion` (a `${…}` form outside the supported op set).
|
|
63
65
|
|
|
64
66
|
### State and session semantics
|
|
65
67
|
|
|
@@ -73,7 +75,7 @@ The Python interpreter and engine imports stay warm in one coordinator process p
|
|
|
73
75
|
|
|
74
76
|
`windowsShell.pythonEngine` (default `true`) is the kill switch. Set it to `false` to restore the PowerShell-only contract verbatim: only the simple-command floor is used, and every pipeline/redirection/expansion/chaining form that would have routed to the engine instead returns the same fail-closed error it did before the engine existed.
|
|
75
77
|
|
|
76
|
-
When the setting is left on but the bundled Python runtime cannot be resolved (uv missing, network failure provisioning Python 3.13, or similar), the engine tier is simply unavailable: simple commands still run on the PowerShell floor exactly as always, and any command that needs the engine returns a named error stating the Python runtime is unavailable, that the simple-command floor still works, and to fix `uv`/network to restore pipelines, redirection, expansion, and chaining. There is no silent approximation — a complex command is never downgraded to a plausible-but-wrong simple execution.
|
|
78
|
+
When the setting is left on but the bundled Python runtime cannot be resolved (uv missing, network failure provisioning Python 3.13, or similar), the engine tier is simply unavailable: simple commands still run on the PowerShell floor exactly as always, and any command that needs the engine returns a named error stating the Python runtime is unavailable, that the simple-command floor still works, and to fix `uv`/network to restore loops, pipelines, redirection, expansion, and chaining. There is no silent approximation — a complex command is never downgraded to a plausible-but-wrong simple execution.
|
|
77
79
|
|
|
78
80
|
The native `python` tool uses the same contract on Windows and Unix-like systems. Pi provisions a pinned uv executable, resolves or installs Python 3.13 through uv, then spawns the interpreter directly with UTF-8 and bytecode-cache suppression. Python calls default to 30 seconds. See [Native Python](python.md).
|
|
79
81
|
|
|
@@ -237,7 +237,7 @@ export default function (pi: ExtensionAPI) {
|
|
|
237
237
|
renderCall(args, theme, _context) {
|
|
238
238
|
let text = theme.fg("toolTitle", theme.bold("write "));
|
|
239
239
|
text += theme.fg("accent", args.path);
|
|
240
|
-
const writeContent =
|
|
240
|
+
const writeContent = "content" in args ? args.content : undefined;
|
|
241
241
|
if (writeContent) text += theme.fg("dim", ` (${writeContent.length} characters)`);
|
|
242
242
|
return new Text(text, 0, 0);
|
|
243
243
|
},
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pi-extension-custom-provider",
|
|
3
|
-
"version": "0.85.
|
|
3
|
+
"version": "0.85.4",
|
|
4
4
|
"lockfileVersion": 3,
|
|
5
5
|
"requires": true,
|
|
6
6
|
"packages": {
|
|
7
7
|
"": {
|
|
8
8
|
"name": "pi-extension-custom-provider",
|
|
9
|
-
"version": "0.85.
|
|
9
|
+
"version": "0.85.4",
|
|
10
10
|
"dependencies": {
|
|
11
11
|
"@anthropic-ai/sdk": "^0.52.0"
|
|
12
12
|
}
|
|
@@ -180,7 +180,7 @@ export default function (pi: ExtensionAPI) {
|
|
|
180
180
|
renderCall(args, theme, _context) {
|
|
181
181
|
const path = shortenPath(args.path || "");
|
|
182
182
|
const pathDisplay = path ? theme.fg("accent", path) : theme.fg("toolOutput", "...");
|
|
183
|
-
const writeContent =
|
|
183
|
+
const writeContent = "content" in args ? args.content : undefined;
|
|
184
184
|
const sizeInfo = writeContent ? theme.fg("muted", ` (${writeContent.length} characters)`) : "";
|
|
185
185
|
|
|
186
186
|
return new Text(`${theme.fg("toolTitle", theme.bold("write"))} ${pathDisplay}${sizeInfo}`, 0, 0);
|
|
@@ -37,13 +37,13 @@ function addToolGuidance(options: BuildSystemPromptOptions, basePrompt: string):
|
|
|
37
37
|
|
|
38
38
|
if (hasTool("edit")) {
|
|
39
39
|
parts.push(
|
|
40
|
-
"• Use `edit`
|
|
40
|
+
"• Use `edit` once with the target path and precise replacements. The harness owns preflight and rejects stale targets. Match exact content including whitespace.",
|
|
41
41
|
);
|
|
42
42
|
}
|
|
43
43
|
|
|
44
44
|
if (hasTool("write")) {
|
|
45
45
|
parts.push(
|
|
46
|
-
"• Use `write`
|
|
46
|
+
"• Use `write` once with the target path and content. The harness owns preflight, and creation never overwrites an existing file.",
|
|
47
47
|
);
|
|
48
48
|
}
|
|
49
49
|
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pi-extension-sandbox",
|
|
3
|
-
"version": "0.85.
|
|
3
|
+
"version": "0.85.4",
|
|
4
4
|
"lockfileVersion": 3,
|
|
5
5
|
"requires": true,
|
|
6
6
|
"packages": {
|
|
7
7
|
"": {
|
|
8
8
|
"name": "pi-extension-sandbox",
|
|
9
|
-
"version": "0.85.
|
|
9
|
+
"version": "0.85.4",
|
|
10
10
|
"dependencies": {
|
|
11
11
|
"@anthropic-ai/sandbox-runtime": "^0.0.26"
|
|
12
12
|
}
|
|
@@ -148,7 +148,24 @@ function createRemoteIntentOps(remote: string, remoteCwd: string, localCwd: stri
|
|
|
148
148
|
if (!digest || !/^[0-9a-f]{64}$/i.test(digest)) throw new Error(`Invalid remote sha256 for ${p}`);
|
|
149
149
|
return digest.toLowerCase();
|
|
150
150
|
},
|
|
151
|
+
readPayload: (p) =>
|
|
152
|
+
sshExec(remote, `cat -- ${shellQuote(toRemote(p))}`).then((output) => output.toString("utf8")),
|
|
151
153
|
removeFile: (p) => sshExec(remote, `rm -- ${shellQuote(toRemote(p))}`).then(() => {}),
|
|
154
|
+
async stagePayload(content) {
|
|
155
|
+
const stagedPath = (await sshExec(remote, `umask 077; mktemp "\${TMPDIR:-/tmp}/pi-file-mutation.XXXXXXXXXX"`))
|
|
156
|
+
.toString("utf8")
|
|
157
|
+
.trim();
|
|
158
|
+
if (!stagedPath.startsWith("/") || stagedPath.includes("\n")) {
|
|
159
|
+
throw new Error("Remote mktemp returned an invalid mutation payload path.");
|
|
160
|
+
}
|
|
161
|
+
try {
|
|
162
|
+
await sshExec(remote, `cat > ${shellQuote(stagedPath)}`, content);
|
|
163
|
+
return stagedPath;
|
|
164
|
+
} catch (error) {
|
|
165
|
+
await sshExec(remote, `rm -f -- ${shellQuote(stagedPath)}`).catch(() => {});
|
|
166
|
+
throw error;
|
|
167
|
+
}
|
|
168
|
+
},
|
|
152
169
|
};
|
|
153
170
|
}
|
|
154
171
|
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pi-extension-with-deps",
|
|
3
|
-
"version": "0.85.
|
|
3
|
+
"version": "0.85.4",
|
|
4
4
|
"lockfileVersion": 3,
|
|
5
5
|
"requires": true,
|
|
6
6
|
"packages": {
|
|
7
7
|
"": {
|
|
8
8
|
"name": "pi-extension-with-deps",
|
|
9
|
-
"version": "0.85.
|
|
9
|
+
"version": "0.85.4",
|
|
10
10
|
"dependencies": {
|
|
11
11
|
"ms": "^2.1.3"
|
|
12
12
|
},
|