@psnext/slingcli 2.4.20260526-1 → 2.4.20260527-3
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/bin/sling.js +4 -1
- package/node_modules/@aws-sdk/core/package.json +2 -2
- package/node_modules/@aws-sdk/credential-provider-env/package.json +2 -2
- package/node_modules/@aws-sdk/credential-provider-http/dist-cjs/fromHttp/fromHttp.js +12 -6
- package/node_modules/@aws-sdk/credential-provider-http/dist-es/fromHttp/fromHttp.js +12 -6
- package/node_modules/@aws-sdk/credential-provider-http/package.json +3 -2
- package/node_modules/@aws-sdk/credential-provider-ini/package.json +9 -9
- package/node_modules/@aws-sdk/credential-provider-login/package.json +3 -3
- package/node_modules/@aws-sdk/credential-provider-node/package.json +7 -7
- package/node_modules/@aws-sdk/credential-provider-process/package.json +2 -2
- package/node_modules/@aws-sdk/credential-provider-sso/node_modules/@aws-sdk/token-providers/package.json +3 -3
- package/node_modules/@aws-sdk/credential-provider-sso/package.json +4 -4
- package/node_modules/@aws-sdk/credential-provider-web-identity/package.json +3 -3
- package/node_modules/@aws-sdk/middleware-websocket/package.json +2 -2
- package/node_modules/@aws-sdk/nested-clients/dist-cjs/submodules/cognito-identity/index.js +1 -1
- package/node_modules/@aws-sdk/nested-clients/dist-cjs/submodules/signin/index.js +1 -1
- package/node_modules/@aws-sdk/nested-clients/dist-cjs/submodules/sso/index.js +1 -1
- package/node_modules/@aws-sdk/nested-clients/dist-cjs/submodules/sso-oidc/index.js +1 -1
- package/node_modules/@aws-sdk/nested-clients/dist-cjs/submodules/sts/index.js +1 -1
- package/node_modules/@aws-sdk/nested-clients/package.json +3 -3
- package/node_modules/@aws-sdk/signature-v4-multi-region/package.json +1 -2
- package/node_modules/@aws-sdk/xml-builder/package.json +2 -2
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/compaction/compaction.js +18 -24
- package/node_modules/@earendil-works/pi-agent-core/package.json +2 -2
- package/node_modules/@earendil-works/pi-ai/dist/cli.js +14 -0
- package/node_modules/@earendil-works/pi-ai/dist/models.generated.js +88 -107
- package/node_modules/@earendil-works/pi-ai/dist/providers/amazon-bedrock.js +2 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/anthropic.js +8 -22
- package/node_modules/@earendil-works/pi-ai/dist/providers/azure-openai-responses.js +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/images/openrouter.js +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/openai-codex-responses.js +47 -30
- package/node_modules/@earendil-works/pi-ai/dist/providers/openai-completions.js +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/openai-responses.js +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/utils/oauth/device-code.js +55 -0
- package/node_modules/@earendil-works/pi-ai/dist/utils/oauth/github-copilot.js +45 -69
- package/node_modules/@earendil-works/pi-ai/dist/utils/oauth/index.js +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/utils/overflow.js +5 -2
- package/node_modules/@earendil-works/pi-ai/package.json +4 -3
- package/node_modules/@earendil-works/pi-coding-agent/dist/cli/file-processor.js +2 -3
- package/node_modules/@earendil-works/pi-coding-agent/dist/config.js +18 -12
- package/node_modules/@earendil-works/pi-coding-agent/dist/core/agent-session-runtime.js +2 -1
- package/node_modules/@earendil-works/pi-coding-agent/dist/core/agent-session-services.js +3 -2
- package/node_modules/@earendil-works/pi-coding-agent/dist/core/agent-session.js +8 -2
- package/node_modules/@earendil-works/pi-coding-agent/dist/core/auth-storage.js +2 -1
- package/node_modules/@earendil-works/pi-coding-agent/dist/core/compaction/compaction.js +18 -24
- package/node_modules/@earendil-works/pi-coding-agent/dist/core/export-html/index.js +8 -6
- package/node_modules/@earendil-works/pi-coding-agent/dist/core/export-html/template.js +6 -3
- package/node_modules/@earendil-works/pi-coding-agent/dist/core/extensions/loader.js +12 -29
- package/node_modules/@earendil-works/pi-coding-agent/dist/core/model-registry.js +5 -1
- package/node_modules/@earendil-works/pi-coding-agent/dist/core/output-guard.js +52 -22
- package/node_modules/@earendil-works/pi-coding-agent/dist/core/package-manager.js +63 -36
- package/node_modules/@earendil-works/pi-coding-agent/dist/core/prompt-templates.js +6 -20
- package/node_modules/@earendil-works/pi-coding-agent/dist/core/resource-loader.js +38 -31
- package/node_modules/@earendil-works/pi-coding-agent/dist/core/sdk.js +9 -4
- package/node_modules/@earendil-works/pi-coding-agent/dist/core/session-manager.js +32 -24
- package/node_modules/@earendil-works/pi-coding-agent/dist/core/settings-manager.js +6 -13
- package/node_modules/@earendil-works/pi-coding-agent/dist/core/skills.js +8 -22
- package/node_modules/@earendil-works/pi-coding-agent/dist/core/tools/bash.js +54 -53
- package/node_modules/@earendil-works/pi-coding-agent/dist/core/tools/edit-diff.js +8 -1
- package/node_modules/@earendil-works/pi-coding-agent/dist/core/tools/edit.js +44 -81
- package/node_modules/@earendil-works/pi-coding-agent/dist/core/tools/file-mutation-queue.js +27 -12
- package/node_modules/@earendil-works/pi-coding-agent/dist/core/tools/find.js +2 -3
- package/node_modules/@earendil-works/pi-coding-agent/dist/core/tools/grep.js +3 -3
- package/node_modules/@earendil-works/pi-coding-agent/dist/core/tools/ls.js +5 -5
- package/node_modules/@earendil-works/pi-coding-agent/dist/core/tools/output-accumulator.js +9 -3
- package/node_modules/@earendil-works/pi-coding-agent/dist/core/tools/path-utils.js +39 -21
- package/node_modules/@earendil-works/pi-coding-agent/dist/core/tools/read.js +9 -8
- package/node_modules/@earendil-works/pi-coding-agent/dist/core/tools/truncate.js +12 -2
- package/node_modules/@earendil-works/pi-coding-agent/dist/core/tools/write.js +20 -35
- package/node_modules/@earendil-works/pi-coding-agent/dist/main.js +5 -6
- package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/components/config-selector.js +1 -1
- package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/components/footer.js +14 -5
- package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/components/login-dialog.js +29 -4
- package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/components/user-message.js +1 -1
- package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/interactive-mode.js +4 -4
- package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/theme/theme.js +37 -28
- package/node_modules/@earendil-works/pi-coding-agent/dist/modes/rpc/rpc-client.js +64 -7
- package/node_modules/@earendil-works/pi-coding-agent/dist/modes/rpc/rpc-mode.js +15 -3
- package/node_modules/@earendil-works/pi-coding-agent/dist/utils/clipboard-native.js +14 -8
- package/node_modules/@earendil-works/pi-coding-agent/dist/utils/image-resize-core.js +124 -0
- package/node_modules/@earendil-works/pi-coding-agent/dist/utils/image-resize-worker.js +31 -0
- package/node_modules/@earendil-works/pi-coding-agent/dist/utils/image-resize.js +75 -115
- package/node_modules/@earendil-works/pi-coding-agent/dist/utils/paths.js +33 -7
- package/node_modules/@earendil-works/pi-coding-agent/npm-shrinkwrap.json +13 -26
- package/node_modules/@earendil-works/pi-coding-agent/package.json +6 -6
- package/node_modules/@earendil-works/pi-tui/dist/components/editor.js +40 -55
- package/node_modules/@earendil-works/pi-tui/dist/components/input.js +2 -2
- package/node_modules/@earendil-works/pi-tui/dist/components/markdown.js +12 -2
- package/node_modules/@earendil-works/pi-tui/dist/native-modifiers.js +53 -0
- package/node_modules/@earendil-works/pi-tui/dist/terminal-image.js +4 -1
- package/node_modules/@earendil-works/pi-tui/dist/terminal.js +38 -16
- package/node_modules/@earendil-works/pi-tui/dist/utils.js +19 -12
- package/node_modules/@earendil-works/pi-tui/native/darwin/prebuilds/darwin-arm64/darwin-modifiers.node +0 -0
- package/node_modules/@earendil-works/pi-tui/native/darwin/prebuilds/darwin-x64/darwin-modifiers.node +0 -0
- package/node_modules/@earendil-works/pi-tui/native/win32/prebuilds/win32-arm64/win32-console-mode.node +0 -0
- package/node_modules/@earendil-works/pi-tui/native/win32/prebuilds/win32-x64/win32-console-mode.node +0 -0
- package/node_modules/@earendil-works/pi-tui/package.json +3 -5
- package/node_modules/@smithy/core/dist-cjs/index.js +3 -4
- package/node_modules/@smithy/core/dist-cjs/submodules/client/index.js +3 -11
- package/node_modules/@smithy/core/dist-cjs/submodules/config/index.browser.js +2 -2
- package/node_modules/@smithy/core/dist-cjs/submodules/config/index.js +2 -2
- package/node_modules/@smithy/core/dist-cjs/submodules/config/index.native.js +2 -2
- package/node_modules/@smithy/core/dist-cjs/submodules/endpoints/index.browser.js +9 -40
- package/node_modules/@smithy/core/dist-cjs/submodules/endpoints/index.js +9 -40
- package/node_modules/@smithy/core/dist-cjs/submodules/protocols/index.js +12 -142
- package/node_modules/@smithy/core/dist-cjs/submodules/schema/index.js +7 -9
- package/node_modules/@smithy/core/dist-cjs/submodules/serde/index.browser.js +2 -2
- package/node_modules/@smithy/core/dist-cjs/submodules/serde/index.js +2 -2
- package/node_modules/@smithy/core/dist-cjs/submodules/serde/index.native.js +2 -2
- package/node_modules/@smithy/core/dist-cjs/submodules/transport/index.js +184 -0
- package/node_modules/@smithy/core/dist-es/index.js +6 -6
- package/node_modules/@smithy/core/dist-es/submodules/client/index.js +2 -2
- package/node_modules/@smithy/core/dist-es/submodules/config/config-resolver/regionConfig/checkRegion.js +1 -1
- package/node_modules/@smithy/core/dist-es/submodules/endpoints/index.browser.js +2 -2
- package/node_modules/@smithy/core/dist-es/submodules/endpoints/index.js +2 -2
- package/node_modules/@smithy/core/dist-es/submodules/endpoints/middleware-endpoint/adaptors/toEndpointV1.js +1 -1
- package/node_modules/@smithy/core/dist-es/submodules/endpoints/middleware-endpoint/resolveEndpointConfig.js +1 -1
- package/node_modules/@smithy/core/dist-es/submodules/endpoints/util-endpoints/lib/index.js +1 -1
- package/node_modules/@smithy/core/dist-es/submodules/protocols/HttpBindingProtocol.js +1 -1
- package/node_modules/@smithy/core/dist-es/submodules/protocols/HttpProtocol.js +1 -2
- package/node_modules/@smithy/core/dist-es/submodules/protocols/RpcProtocol.js +1 -1
- package/node_modules/@smithy/core/dist-es/submodules/protocols/index.js +5 -5
- package/node_modules/@smithy/core/dist-es/submodules/protocols/middleware-content-length/contentLengthMiddleware.js +1 -1
- package/node_modules/@smithy/core/dist-es/submodules/protocols/requestBuilder.js +1 -1
- package/node_modules/@smithy/core/dist-es/submodules/schema/middleware/schemaDeserializationMiddleware.js +3 -4
- package/node_modules/@smithy/core/dist-es/submodules/schema/middleware/schemaSerializationMiddleware.js +1 -2
- package/node_modules/@smithy/core/dist-es/submodules/serde/middleware-serde/deserializerMiddleware.js +1 -1
- package/node_modules/@smithy/core/dist-es/submodules/transport/index.js +9 -0
- package/node_modules/@smithy/core/dist-es/submodules/{protocols/url-parser → transport}/parseUrl.js +1 -1
- package/node_modules/@smithy/core/dist-es/submodules/{endpoints → transport}/toEndpointV1.js +1 -1
- package/node_modules/@smithy/core/dist-types/index.d.ts +10 -6
- package/node_modules/@smithy/core/dist-types/submodules/client/index.d.ts +2 -2
- package/node_modules/@smithy/core/dist-types/submodules/endpoints/index.browser.d.ts +2 -2
- package/node_modules/@smithy/core/dist-types/submodules/endpoints/index.d.ts +2 -2
- package/node_modules/@smithy/core/dist-types/submodules/endpoints/middleware-endpoint/adaptors/toEndpointV1.d.ts +2 -2
- package/node_modules/@smithy/core/dist-types/submodules/endpoints/util-endpoints/lib/index.d.ts +1 -1
- package/node_modules/@smithy/core/dist-types/submodules/protocols/HttpBindingProtocol.d.ts +1 -1
- package/node_modules/@smithy/core/dist-types/submodules/protocols/index.d.ts +5 -5
- package/node_modules/@smithy/core/dist-types/submodules/protocols/protocol-http/httpHandler.d.ts +1 -2
- package/node_modules/@smithy/core/dist-types/submodules/protocols/requestBuilder.d.ts +1 -1
- package/node_modules/@smithy/core/dist-types/submodules/transport/index.d.ts +9 -0
- package/node_modules/@smithy/core/package.json +19 -10
- package/node_modules/@smithy/core/transport.d.ts +5 -0
- package/node_modules/@smithy/core/transport.js +5 -0
- package/node_modules/@smithy/credential-provider-imds/package.json +2 -2
- package/node_modules/@smithy/fetch-http-handler/package.json +2 -2
- package/node_modules/@smithy/node-http-handler/package.json +2 -2
- package/node_modules/@smithy/signature-v4/package.json +2 -2
- package/node_modules/lru-cache/dist/commonjs/browser/index.d.ts +2 -2
- package/node_modules/lru-cache/dist/commonjs/browser/index.d.ts.map +1 -1
- package/node_modules/lru-cache/dist/commonjs/browser/index.js.map +1 -1
- package/node_modules/lru-cache/dist/commonjs/browser/index.min.js.map +1 -1
- package/node_modules/lru-cache/dist/commonjs/index.d.ts +2 -2
- package/node_modules/lru-cache/dist/commonjs/index.d.ts.map +1 -1
- package/node_modules/lru-cache/dist/commonjs/index.js.map +1 -1
- package/node_modules/lru-cache/dist/commonjs/index.min.js.map +1 -1
- package/node_modules/lru-cache/dist/commonjs/node/index.d.ts +2 -2
- package/node_modules/lru-cache/dist/commonjs/node/index.d.ts.map +1 -1
- package/node_modules/lru-cache/dist/commonjs/node/index.js.map +1 -1
- package/node_modules/lru-cache/dist/commonjs/node/index.min.js.map +1 -1
- package/node_modules/lru-cache/dist/esm/browser/index.d.ts +2 -2
- package/node_modules/lru-cache/dist/esm/browser/index.d.ts.map +1 -1
- package/node_modules/lru-cache/dist/esm/browser/index.js.map +1 -1
- package/node_modules/lru-cache/dist/esm/browser/index.min.js.map +1 -1
- package/node_modules/lru-cache/dist/esm/index.d.ts +2 -2
- package/node_modules/lru-cache/dist/esm/index.d.ts.map +1 -1
- package/node_modules/lru-cache/dist/esm/index.js.map +1 -1
- package/node_modules/lru-cache/dist/esm/index.min.js.map +1 -1
- package/node_modules/lru-cache/dist/esm/node/index.d.ts +2 -2
- package/node_modules/lru-cache/dist/esm/node/index.d.ts.map +1 -1
- package/node_modules/lru-cache/dist/esm/node/index.js.map +1 -1
- package/node_modules/lru-cache/dist/esm/node/index.min.js.map +1 -1
- package/node_modules/lru-cache/package.json +1 -1
- package/package.json +6 -6
- package/slingshot/index.js +246 -244
- package/node_modules/@smithy/core/dist-cjs/getSmithyContext.js +0 -6
- package/node_modules/@smithy/core/dist-cjs/middleware-http-auth-scheme/getHttpAuthSchemeEndpointRuleSetPlugin.js +0 -21
- package/node_modules/@smithy/core/dist-cjs/middleware-http-auth-scheme/getHttpAuthSchemePlugin.js +0 -21
- package/node_modules/@smithy/core/dist-cjs/middleware-http-auth-scheme/httpAuthSchemeMiddleware.js +0 -46
- package/node_modules/@smithy/core/dist-cjs/middleware-http-auth-scheme/index.js +0 -6
- package/node_modules/@smithy/core/dist-cjs/middleware-http-auth-scheme/resolveAuthOptions.js +0 -24
- package/node_modules/@smithy/core/dist-cjs/middleware-http-signing/getHttpSigningMiddleware.js +0 -19
- package/node_modules/@smithy/core/dist-cjs/middleware-http-signing/httpSigningMiddleware.js +0 -27
- package/node_modules/@smithy/core/dist-cjs/middleware-http-signing/index.js +0 -5
- package/node_modules/@smithy/core/dist-cjs/normalizeProvider.js +0 -10
- package/node_modules/@smithy/core/dist-cjs/pagination/createPaginator.js +0 -44
- package/node_modules/@smithy/core/dist-cjs/request-builder/requestBuilder.js +0 -5
- package/node_modules/@smithy/core/dist-cjs/setFeature.js +0 -14
- package/node_modules/@smithy/core/dist-cjs/util-identity-and-auth/DefaultIdentityProviderConfig.js +0 -18
- package/node_modules/@smithy/core/dist-cjs/util-identity-and-auth/httpAuthSchemes/httpApiKeyAuth.js +0 -38
- package/node_modules/@smithy/core/dist-cjs/util-identity-and-auth/httpAuthSchemes/httpBearerAuth.js +0 -15
- package/node_modules/@smithy/core/dist-cjs/util-identity-and-auth/httpAuthSchemes/index.js +0 -6
- package/node_modules/@smithy/core/dist-cjs/util-identity-and-auth/httpAuthSchemes/noAuth.js +0 -9
- package/node_modules/@smithy/core/dist-cjs/util-identity-and-auth/index.js +0 -6
- package/node_modules/@smithy/core/dist-cjs/util-identity-and-auth/memoizeIdentityProvider.js +0 -61
- package/node_modules/@smithy/core/dist-es/request-builder/requestBuilder.js +0 -1
- package/node_modules/@smithy/core/dist-es/submodules/client/util-middleware/getSmithyContext.js +0 -2
- package/node_modules/@smithy/core/dist-es/submodules/event-streams/eventstream-codec/TestVectors.fixture.js +0 -146
- package/node_modules/@smithy/core/dist-es/submodules/event-streams/eventstream-codec/vectorTypes.fixture.js +0 -1
- package/node_modules/@smithy/core/dist-types/request-builder/requestBuilder.d.ts +0 -6
- package/node_modules/@smithy/core/dist-types/submodules/client/util-middleware/getSmithyContext.d.ts +0 -5
- package/node_modules/@smithy/core/dist-types/submodules/event-streams/eventstream-codec/TestVectors.fixture.d.ts +0 -2
- package/node_modules/@smithy/core/dist-types/submodules/event-streams/eventstream-codec/vectorTypes.fixture.d.ts +0 -12
- package/node_modules/@smithy/credential-provider-imds/dist-es/remoteProvider/index.js +0 -2
- package/node_modules/@smithy/credential-provider-imds/dist-types/remoteProvider/index.d.ts +0 -8
- package/node_modules/@smithy/signature-v4/dist-es/suite.fixture.js +0 -399
- package/node_modules/@smithy/signature-v4/dist-types/suite.fixture.d.ts +0 -14
- package/node_modules/koffi/CHANGELOG.md +0 -1093
- package/node_modules/koffi/LICENSE.txt +0 -22
- package/node_modules/koffi/README.md +0 -43
- package/node_modules/koffi/build/koffi/darwin_arm64/koffi.node +0 -0
- package/node_modules/koffi/build/koffi/darwin_x64/koffi.node +0 -0
- package/node_modules/koffi/build/koffi/freebsd_arm64/koffi.node +0 -0
- package/node_modules/koffi/build/koffi/freebsd_ia32/koffi.node +0 -0
- package/node_modules/koffi/build/koffi/freebsd_x64/koffi.node +0 -0
- package/node_modules/koffi/build/koffi/linux_arm64/koffi.node +0 -0
- package/node_modules/koffi/build/koffi/linux_armhf/koffi.node +0 -0
- package/node_modules/koffi/build/koffi/linux_ia32/koffi.node +0 -0
- package/node_modules/koffi/build/koffi/linux_loong64/koffi.node +0 -0
- package/node_modules/koffi/build/koffi/linux_riscv64d/koffi.node +0 -0
- package/node_modules/koffi/build/koffi/linux_x64/koffi.node +0 -0
- package/node_modules/koffi/build/koffi/musl_arm64/koffi.node +0 -0
- package/node_modules/koffi/build/koffi/musl_x64/koffi.node +0 -0
- package/node_modules/koffi/build/koffi/openbsd_ia32/koffi.node +0 -0
- package/node_modules/koffi/build/koffi/openbsd_x64/koffi.node +0 -0
- package/node_modules/koffi/build/koffi/win32_arm64/koffi.exp +0 -0
- package/node_modules/koffi/build/koffi/win32_arm64/koffi.lib +0 -0
- package/node_modules/koffi/build/koffi/win32_arm64/koffi.node +0 -0
- package/node_modules/koffi/build/koffi/win32_ia32/koffi.exp +0 -0
- package/node_modules/koffi/build/koffi/win32_ia32/koffi.lib +0 -0
- package/node_modules/koffi/build/koffi/win32_ia32/koffi.node +0 -0
- package/node_modules/koffi/build/koffi/win32_x64/koffi.exp +0 -0
- package/node_modules/koffi/build/koffi/win32_x64/koffi.lib +0 -0
- package/node_modules/koffi/build/koffi/win32_x64/koffi.node +0 -0
- package/node_modules/koffi/doc/benchmarks.md +0 -126
- package/node_modules/koffi/doc/callbacks.md +0 -210
- package/node_modules/koffi/doc/contribute.md +0 -148
- package/node_modules/koffi/doc/functions.md +0 -250
- package/node_modules/koffi/doc/index.md +0 -61
- package/node_modules/koffi/doc/input.md +0 -471
- package/node_modules/koffi/doc/migration.md +0 -159
- package/node_modules/koffi/doc/misc.md +0 -180
- package/node_modules/koffi/doc/output.md +0 -305
- package/node_modules/koffi/doc/packaging.md +0 -88
- package/node_modules/koffi/doc/platforms.md +0 -36
- package/node_modules/koffi/doc/pointers.md +0 -328
- package/node_modules/koffi/doc/start.md +0 -118
- package/node_modules/koffi/doc/unions.md +0 -186
- package/node_modules/koffi/doc/variables.md +0 -102
- package/node_modules/koffi/index.d.ts +0 -288
- package/node_modules/koffi/index.js +0 -634
- package/node_modules/koffi/indirect.js +0 -533
- package/node_modules/koffi/lib/native/base/base.cc +0 -11015
- package/node_modules/koffi/lib/native/base/base.hh +0 -6003
- package/node_modules/koffi/lib/native/base/crc.inc +0 -2214
- package/node_modules/koffi/lib/native/base/crc_gen.py +0 -72
- package/node_modules/koffi/lib/native/base/mimetypes.inc +0 -1248
- package/node_modules/koffi/lib/native/base/mimetypes_gen.py +0 -58
- package/node_modules/koffi/lib/native/base/tower.cc +0 -821
- package/node_modules/koffi/lib/native/base/tower.hh +0 -81
- package/node_modules/koffi/lib/native/base/unicode.inc +0 -408
- package/node_modules/koffi/lib/native/base/unicode_gen.py +0 -152
- package/node_modules/koffi/package.json +0 -38
- package/node_modules/koffi/src/cnoke/LICENSE.txt +0 -22
- package/node_modules/koffi/src/cnoke/README.md +0 -99
- package/node_modules/koffi/src/cnoke/assets/FindCNoke.cmake +0 -127
- package/node_modules/koffi/src/cnoke/assets/toolchains.json +0 -126
- package/node_modules/koffi/src/cnoke/assets/win_delay_hook.c +0 -36
- package/node_modules/koffi/src/cnoke/cnoke.js +0 -170
- package/node_modules/koffi/src/cnoke/package.json +0 -24
- package/node_modules/koffi/src/cnoke/src/builder.js +0 -511
- package/node_modules/koffi/src/cnoke/src/index.js +0 -10
- package/node_modules/koffi/src/cnoke/src/tools.js +0 -407
- package/node_modules/koffi/src/koffi/CMakeLists.txt +0 -182
- package/node_modules/koffi/src/koffi/src/abi_arm32.cc +0 -1018
- package/node_modules/koffi/src/koffi/src/abi_arm32_asm.S +0 -169
- package/node_modules/koffi/src/koffi/src/abi_arm64.cc +0 -1295
- package/node_modules/koffi/src/koffi/src/abi_arm64_asm.S +0 -195
- package/node_modules/koffi/src/koffi/src/abi_arm64_asm.asm +0 -174
- package/node_modules/koffi/src/koffi/src/abi_loong64.cc +0 -5
- package/node_modules/koffi/src/koffi/src/abi_loong64_asm.S +0 -204
- package/node_modules/koffi/src/koffi/src/abi_riscv64.cc +0 -915
- package/node_modules/koffi/src/koffi/src/abi_riscv64_asm.S +0 -203
- package/node_modules/koffi/src/koffi/src/abi_x64_sysv.cc +0 -939
- package/node_modules/koffi/src/koffi/src/abi_x64_sysv_asm.S +0 -231
- package/node_modules/koffi/src/koffi/src/abi_x64_win.cc +0 -715
- package/node_modules/koffi/src/koffi/src/abi_x64_win_asm.S +0 -166
- package/node_modules/koffi/src/koffi/src/abi_x64_win_asm.asm +0 -192
- package/node_modules/koffi/src/koffi/src/abi_x86.cc +0 -860
- package/node_modules/koffi/src/koffi/src/abi_x86_asm.S +0 -193
- package/node_modules/koffi/src/koffi/src/abi_x86_asm.asm +0 -177
- package/node_modules/koffi/src/koffi/src/call.cc +0 -1326
- package/node_modules/koffi/src/koffi/src/call.hh +0 -179
- package/node_modules/koffi/src/koffi/src/errno.inc +0 -462
- package/node_modules/koffi/src/koffi/src/ffi.cc +0 -2702
- package/node_modules/koffi/src/koffi/src/ffi.hh +0 -354
- package/node_modules/koffi/src/koffi/src/init.js +0 -105
- package/node_modules/koffi/src/koffi/src/parser.cc +0 -220
- package/node_modules/koffi/src/koffi/src/parser.hh +0 -54
- package/node_modules/koffi/src/koffi/src/util.cc +0 -1807
- package/node_modules/koffi/src/koffi/src/util.hh +0 -221
- package/node_modules/koffi/src/koffi/src/uv.cc +0 -193
- package/node_modules/koffi/src/koffi/src/uv.def +0 -10
- package/node_modules/koffi/src/koffi/src/uv.hh +0 -40
- package/node_modules/koffi/src/koffi/src/win32.cc +0 -198
- package/node_modules/koffi/src/koffi/src/win32.hh +0 -119
- package/node_modules/koffi/src/koffi/tools/write_trampolines.js +0 -77
- package/node_modules/koffi/vendor/node-addon-api/LICENSE.md +0 -9
- package/node_modules/koffi/vendor/node-addon-api/README.md +0 -95
- package/node_modules/koffi/vendor/node-addon-api/napi-inl.deprecated.h +0 -186
- package/node_modules/koffi/vendor/node-addon-api/napi-inl.h +0 -7033
- package/node_modules/koffi/vendor/node-addon-api/napi.h +0 -3309
- package/node_modules/koffi/vendor/node-api-headers/LICENSE +0 -21
- package/node_modules/koffi/vendor/node-api-headers/README.md +0 -95
- package/node_modules/koffi/vendor/node-api-headers/def/js_native_api.def +0 -125
- package/node_modules/koffi/vendor/node-api-headers/def/node_api.def +0 -157
- package/node_modules/koffi/vendor/node-api-headers/include/js_native_api.h +0 -591
- package/node_modules/koffi/vendor/node-api-headers/include/js_native_api_types.h +0 -210
- package/node_modules/koffi/vendor/node-api-headers/include/node_api.h +0 -265
- package/node_modules/koffi/vendor/node-api-headers/include/node_api_types.h +0 -58
- package/node_modules/koffi/vendor/node-api-headers/include/uv/aix.h +0 -32
- package/node_modules/koffi/vendor/node-api-headers/include/uv/bsd.h +0 -34
- package/node_modules/koffi/vendor/node-api-headers/include/uv/darwin.h +0 -61
- package/node_modules/koffi/vendor/node-api-headers/include/uv/errno.h +0 -483
- package/node_modules/koffi/vendor/node-api-headers/include/uv/linux.h +0 -34
- package/node_modules/koffi/vendor/node-api-headers/include/uv/os390.h +0 -33
- package/node_modules/koffi/vendor/node-api-headers/include/uv/posix.h +0 -31
- package/node_modules/koffi/vendor/node-api-headers/include/uv/sunos.h +0 -44
- package/node_modules/koffi/vendor/node-api-headers/include/uv/threadpool.h +0 -37
- package/node_modules/koffi/vendor/node-api-headers/include/uv/tree.h +0 -521
- package/node_modules/koffi/vendor/node-api-headers/include/uv/unix.h +0 -512
- package/node_modules/koffi/vendor/node-api-headers/include/uv/version.h +0 -43
- package/node_modules/koffi/vendor/node-api-headers/include/uv/win.h +0 -698
- package/node_modules/koffi/vendor/node-api-headers/include/uv.h +0 -1990
- /package/node_modules/@smithy/core/dist-es/{middleware-http-auth-scheme → legacy-root-exports/middleware-http-auth-scheme}/getHttpAuthSchemeEndpointRuleSetPlugin.js +0 -0
- /package/node_modules/@smithy/core/dist-es/{middleware-http-auth-scheme → legacy-root-exports/middleware-http-auth-scheme}/getHttpAuthSchemePlugin.js +0 -0
- /package/node_modules/@smithy/core/dist-es/{middleware-http-auth-scheme → legacy-root-exports/middleware-http-auth-scheme}/httpAuthSchemeMiddleware.js +0 -0
- /package/node_modules/@smithy/core/dist-es/{middleware-http-auth-scheme → legacy-root-exports/middleware-http-auth-scheme}/index.js +0 -0
- /package/node_modules/@smithy/core/dist-es/{middleware-http-auth-scheme → legacy-root-exports/middleware-http-auth-scheme}/resolveAuthOptions.js +0 -0
- /package/node_modules/@smithy/core/dist-es/{middleware-http-signing → legacy-root-exports/middleware-http-signing}/getHttpSigningMiddleware.js +0 -0
- /package/node_modules/@smithy/core/dist-es/{middleware-http-signing → legacy-root-exports/middleware-http-signing}/httpSigningMiddleware.js +0 -0
- /package/node_modules/@smithy/core/dist-es/{middleware-http-signing → legacy-root-exports/middleware-http-signing}/index.js +0 -0
- /package/node_modules/@smithy/core/dist-es/{pagination → legacy-root-exports/pagination}/createPaginator.js +0 -0
- /package/node_modules/@smithy/core/dist-es/{util-identity-and-auth → legacy-root-exports/util-identity-and-auth}/DefaultIdentityProviderConfig.js +0 -0
- /package/node_modules/@smithy/core/dist-es/{util-identity-and-auth → legacy-root-exports/util-identity-and-auth}/httpAuthSchemes/httpApiKeyAuth.js +0 -0
- /package/node_modules/@smithy/core/dist-es/{util-identity-and-auth → legacy-root-exports/util-identity-and-auth}/httpAuthSchemes/httpBearerAuth.js +0 -0
- /package/node_modules/@smithy/core/dist-es/{util-identity-and-auth → legacy-root-exports/util-identity-and-auth}/httpAuthSchemes/index.js +0 -0
- /package/node_modules/@smithy/core/dist-es/{util-identity-and-auth → legacy-root-exports/util-identity-and-auth}/httpAuthSchemes/noAuth.js +0 -0
- /package/node_modules/@smithy/core/dist-es/{util-identity-and-auth → legacy-root-exports/util-identity-and-auth}/index.js +0 -0
- /package/node_modules/@smithy/core/dist-es/{util-identity-and-auth → legacy-root-exports/util-identity-and-auth}/memoizeIdentityProvider.js +0 -0
- /package/node_modules/@smithy/core/dist-es/{getSmithyContext.js → submodules/transport/getSmithyContext.js} +0 -0
- /package/node_modules/@smithy/core/dist-es/submodules/{protocols/protocol-http → transport}/httpRequest.js +0 -0
- /package/node_modules/@smithy/core/dist-es/submodules/{protocols/protocol-http → transport}/httpResponse.js +0 -0
- /package/node_modules/@smithy/core/dist-es/submodules/{endpoints/util-endpoints/lib → transport}/isValidHostLabel.js +0 -0
- /package/node_modules/@smithy/core/dist-es/submodules/{protocols/protocol-http → transport}/isValidHostname.js +0 -0
- /package/node_modules/@smithy/core/dist-es/submodules/{client/util-middleware → transport}/normalizeProvider.js +0 -0
- /package/node_modules/@smithy/core/dist-es/submodules/{protocols/querystring-parser → transport}/parseQueryString.js +0 -0
- /package/node_modules/@smithy/core/dist-types/{middleware-http-auth-scheme → legacy-root-exports/middleware-http-auth-scheme}/getHttpAuthSchemeEndpointRuleSetPlugin.d.ts +0 -0
- /package/node_modules/@smithy/core/dist-types/{middleware-http-auth-scheme → legacy-root-exports/middleware-http-auth-scheme}/getHttpAuthSchemePlugin.d.ts +0 -0
- /package/node_modules/@smithy/core/dist-types/{middleware-http-auth-scheme → legacy-root-exports/middleware-http-auth-scheme}/httpAuthSchemeMiddleware.d.ts +0 -0
- /package/node_modules/@smithy/core/dist-types/{middleware-http-auth-scheme → legacy-root-exports/middleware-http-auth-scheme}/index.d.ts +0 -0
- /package/node_modules/@smithy/core/dist-types/{middleware-http-auth-scheme → legacy-root-exports/middleware-http-auth-scheme}/resolveAuthOptions.d.ts +0 -0
- /package/node_modules/@smithy/core/dist-types/{middleware-http-signing → legacy-root-exports/middleware-http-signing}/getHttpSigningMiddleware.d.ts +0 -0
- /package/node_modules/@smithy/core/dist-types/{middleware-http-signing → legacy-root-exports/middleware-http-signing}/httpSigningMiddleware.d.ts +0 -0
- /package/node_modules/@smithy/core/dist-types/{middleware-http-signing → legacy-root-exports/middleware-http-signing}/index.d.ts +0 -0
- /package/node_modules/@smithy/core/dist-types/{pagination → legacy-root-exports/pagination}/createPaginator.d.ts +0 -0
- /package/node_modules/@smithy/core/dist-types/{util-identity-and-auth → legacy-root-exports/util-identity-and-auth}/DefaultIdentityProviderConfig.d.ts +0 -0
- /package/node_modules/@smithy/core/dist-types/{util-identity-and-auth → legacy-root-exports/util-identity-and-auth}/httpAuthSchemes/httpApiKeyAuth.d.ts +0 -0
- /package/node_modules/@smithy/core/dist-types/{util-identity-and-auth → legacy-root-exports/util-identity-and-auth}/httpAuthSchemes/httpBearerAuth.d.ts +0 -0
- /package/node_modules/@smithy/core/dist-types/{util-identity-and-auth → legacy-root-exports/util-identity-and-auth}/httpAuthSchemes/index.d.ts +0 -0
- /package/node_modules/@smithy/core/dist-types/{util-identity-and-auth → legacy-root-exports/util-identity-and-auth}/httpAuthSchemes/noAuth.d.ts +0 -0
- /package/node_modules/@smithy/core/dist-types/{util-identity-and-auth → legacy-root-exports/util-identity-and-auth}/index.d.ts +0 -0
- /package/node_modules/@smithy/core/dist-types/{util-identity-and-auth → legacy-root-exports/util-identity-and-auth}/memoizeIdentityProvider.d.ts +0 -0
- /package/node_modules/@smithy/core/dist-types/{getSmithyContext.d.ts → submodules/transport/getSmithyContext.d.ts} +0 -0
- /package/node_modules/@smithy/core/dist-types/submodules/{protocols/protocol-http → transport}/httpRequest.d.ts +0 -0
- /package/node_modules/@smithy/core/dist-types/submodules/{protocols/protocol-http → transport}/httpResponse.d.ts +0 -0
- /package/node_modules/@smithy/core/dist-types/submodules/{endpoints/util-endpoints/lib → transport}/isValidHostLabel.d.ts +0 -0
- /package/node_modules/@smithy/core/dist-types/submodules/{protocols/protocol-http → transport}/isValidHostname.d.ts +0 -0
- /package/node_modules/@smithy/core/dist-types/submodules/{client/util-middleware → transport}/normalizeProvider.d.ts +0 -0
- /package/node_modules/@smithy/core/dist-types/submodules/{protocols/querystring-parser → transport}/parseQueryString.d.ts +0 -0
- /package/node_modules/@smithy/core/dist-types/submodules/{protocols/url-parser → transport}/parseUrl.d.ts +0 -0
- /package/node_modules/@smithy/core/dist-types/submodules/{endpoints → transport}/toEndpointV1.d.ts +0 -0
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import { existsSync, readdirSync, readFileSync, statSync } from "node:fs";
|
|
2
|
-
import { homedir } from "node:os";
|
|
3
2
|
import { join, resolve, sep } from "node:path";
|
|
4
3
|
import chalk from "chalk";
|
|
5
4
|
import { CONFIG_DIR_NAME } from "../config.js";
|
|
6
5
|
import { loadThemeFromPath } from "../modes/interactive/theme/theme.js";
|
|
7
|
-
import { canonicalizePath, isLocalPath } from "../utils/paths.js";
|
|
6
|
+
import { canonicalizePath, isLocalPath, resolvePath } from "../utils/paths.js";
|
|
8
7
|
import { createEventBus } from "./event-bus.js";
|
|
9
8
|
import { createExtensionRuntime, loadExtensionFromFactory, loadExtensions } from "./extensions/loader.js";
|
|
10
9
|
import { DefaultPackageManager } from "./package-manager.js";
|
|
@@ -46,8 +45,8 @@ function loadContextFileFromDir(dir) {
|
|
|
46
45
|
return null;
|
|
47
46
|
}
|
|
48
47
|
export function loadProjectContextFiles(options) {
|
|
49
|
-
const resolvedCwd = options.cwd;
|
|
50
|
-
const resolvedAgentDir = options.agentDir;
|
|
48
|
+
const resolvedCwd = resolvePath(options.cwd);
|
|
49
|
+
const resolvedAgentDir = resolvePath(options.agentDir);
|
|
51
50
|
const contextFiles = [];
|
|
52
51
|
const seenPaths = new Set();
|
|
53
52
|
const globalContext = loadContextFileFromDir(resolvedAgentDir);
|
|
@@ -116,8 +115,8 @@ export class DefaultResourceLoader {
|
|
|
116
115
|
lastPromptPaths;
|
|
117
116
|
lastThemePaths;
|
|
118
117
|
constructor(options) {
|
|
119
|
-
this.cwd = options.cwd;
|
|
120
|
-
this.agentDir = options.agentDir;
|
|
118
|
+
this.cwd = resolvePath(options.cwd);
|
|
119
|
+
this.agentDir = resolvePath(options.agentDir);
|
|
121
120
|
this.settingsManager = options.settingsManager ?? SettingsManager.create(this.cwd, this.agentDir);
|
|
122
121
|
this.eventBus = options.eventBus ?? createEventBus();
|
|
123
122
|
this.packageManager = new DefaultPackageManager({
|
|
@@ -283,8 +282,11 @@ export class DefaultResourceLoader {
|
|
|
283
282
|
extensionsResult.errors.push({ path: conflict.path, error: conflict.message });
|
|
284
283
|
}
|
|
285
284
|
for (const p of this.additionalExtensionPaths) {
|
|
286
|
-
if (isLocalPath(p)
|
|
287
|
-
|
|
285
|
+
if (isLocalPath(p)) {
|
|
286
|
+
const resolved = this.resolveResourcePath(p);
|
|
287
|
+
if (!existsSync(resolved)) {
|
|
288
|
+
extensionsResult.errors.push({ path: resolved, error: `Extension path does not exist: ${resolved}` });
|
|
289
|
+
}
|
|
288
290
|
}
|
|
289
291
|
}
|
|
290
292
|
this.extensionsResult = this.extensionsOverride ? this.extensionsOverride(extensionsResult) : extensionsResult;
|
|
@@ -295,8 +297,11 @@ export class DefaultResourceLoader {
|
|
|
295
297
|
this.lastSkillPaths = skillPaths;
|
|
296
298
|
this.updateSkillsFromPaths(skillPaths, metadataByPath);
|
|
297
299
|
for (const p of this.additionalSkillPaths) {
|
|
298
|
-
if (isLocalPath(p)
|
|
299
|
-
this.
|
|
300
|
+
if (isLocalPath(p)) {
|
|
301
|
+
const resolved = this.resolveResourcePath(p);
|
|
302
|
+
if (!existsSync(resolved) && !this.skillDiagnostics.some((d) => d.path === resolved)) {
|
|
303
|
+
this.skillDiagnostics.push({ type: "error", message: "Skill path does not exist", path: resolved });
|
|
304
|
+
}
|
|
300
305
|
}
|
|
301
306
|
}
|
|
302
307
|
const promptPaths = this.noPromptTemplates
|
|
@@ -305,8 +310,15 @@ export class DefaultResourceLoader {
|
|
|
305
310
|
this.lastPromptPaths = promptPaths;
|
|
306
311
|
this.updatePromptsFromPaths(promptPaths, metadataByPath);
|
|
307
312
|
for (const p of this.additionalPromptTemplatePaths) {
|
|
308
|
-
if (isLocalPath(p)
|
|
309
|
-
this.
|
|
313
|
+
if (isLocalPath(p)) {
|
|
314
|
+
const resolved = this.resolveResourcePath(p);
|
|
315
|
+
if (!existsSync(resolved) && !this.promptDiagnostics.some((d) => d.path === resolved)) {
|
|
316
|
+
this.promptDiagnostics.push({
|
|
317
|
+
type: "error",
|
|
318
|
+
message: "Prompt template path does not exist",
|
|
319
|
+
path: resolved,
|
|
320
|
+
});
|
|
321
|
+
}
|
|
310
322
|
}
|
|
311
323
|
}
|
|
312
324
|
const themePaths = this.noThemes
|
|
@@ -315,8 +327,9 @@ export class DefaultResourceLoader {
|
|
|
315
327
|
this.lastThemePaths = themePaths;
|
|
316
328
|
this.updateThemesFromPaths(themePaths, metadataByPath);
|
|
317
329
|
for (const p of this.additionalThemePaths) {
|
|
318
|
-
|
|
319
|
-
|
|
330
|
+
const resolved = this.resolveResourcePath(p);
|
|
331
|
+
if (!existsSync(resolved) && !this.themeDiagnostics.some((d) => d.path === resolved)) {
|
|
332
|
+
this.themeDiagnostics.push({ type: "error", message: "Theme path does not exist", path: resolved });
|
|
320
333
|
}
|
|
321
334
|
}
|
|
322
335
|
const agentsFiles = {
|
|
@@ -336,10 +349,15 @@ export class DefaultResourceLoader {
|
|
|
336
349
|
: baseAppend;
|
|
337
350
|
}
|
|
338
351
|
normalizeExtensionPaths(entries) {
|
|
339
|
-
return entries.map((entry) =>
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
352
|
+
return entries.map((entry) => {
|
|
353
|
+
const metadata = entry.metadata.baseDir
|
|
354
|
+
? { ...entry.metadata, baseDir: this.resolveResourcePath(entry.metadata.baseDir) }
|
|
355
|
+
: entry.metadata;
|
|
356
|
+
return {
|
|
357
|
+
path: this.resolveResourcePath(entry.path),
|
|
358
|
+
metadata,
|
|
359
|
+
};
|
|
360
|
+
});
|
|
343
361
|
}
|
|
344
362
|
updateSkillsFromPaths(skillPaths, metadataByPath) {
|
|
345
363
|
let skillsResult;
|
|
@@ -507,18 +525,7 @@ export class DefaultResourceLoader {
|
|
|
507
525
|
return merged;
|
|
508
526
|
}
|
|
509
527
|
resolveResourcePath(p) {
|
|
510
|
-
|
|
511
|
-
let expanded = trimmed;
|
|
512
|
-
if (trimmed === "~") {
|
|
513
|
-
expanded = homedir();
|
|
514
|
-
}
|
|
515
|
-
else if (trimmed.startsWith("~/")) {
|
|
516
|
-
expanded = join(homedir(), trimmed.slice(2));
|
|
517
|
-
}
|
|
518
|
-
else if (trimmed.startsWith("~")) {
|
|
519
|
-
expanded = join(homedir(), trimmed.slice(1));
|
|
520
|
-
}
|
|
521
|
-
return resolve(this.cwd, expanded);
|
|
528
|
+
return resolvePath(p, this.cwd, { trim: true });
|
|
522
529
|
}
|
|
523
530
|
loadThemes(paths, includeDefaults = true) {
|
|
524
531
|
const themes = [];
|
|
@@ -530,7 +537,7 @@ export class DefaultResourceLoader {
|
|
|
530
537
|
}
|
|
531
538
|
}
|
|
532
539
|
for (const p of paths) {
|
|
533
|
-
const resolved =
|
|
540
|
+
const resolved = this.resolveResourcePath(p);
|
|
534
541
|
if (!existsSync(resolved)) {
|
|
535
542
|
diagnostics.push({ type: "warning", message: "theme path does not exist", path: resolved });
|
|
536
543
|
continue;
|
|
@@ -2,6 +2,7 @@ import { join } from "node:path";
|
|
|
2
2
|
import { Agent } from "@earendil-works/pi-agent-core";
|
|
3
3
|
import { clampThinkingLevel, streamSimple } from "@earendil-works/pi-ai";
|
|
4
4
|
import { getAgentDir } from "../config.js";
|
|
5
|
+
import { resolvePath } from "../utils/paths.js";
|
|
5
6
|
import { AgentSession } from "./agent-session.js";
|
|
6
7
|
import { formatNoModelsAvailableMessage } from "./auth-guidance.js";
|
|
7
8
|
import { AuthStorage } from "./auth-storage.js";
|
|
@@ -24,7 +25,11 @@ createCodingTools, createReadOnlyTools, createReadTool, createBashTool, createEd
|
|
|
24
25
|
function getDefaultAgentDir() {
|
|
25
26
|
return getAgentDir();
|
|
26
27
|
}
|
|
27
|
-
function getAttributionHeaders(model, settingsManager) {
|
|
28
|
+
function getAttributionHeaders(model, settingsManager, sessionId) {
|
|
29
|
+
if (sessionId &&
|
|
30
|
+
(model.provider === "opencode" || model.provider === "opencode-go" || model.baseUrl.includes("opencode.ai"))) {
|
|
31
|
+
return { "x-opencode-session": sessionId, "x-opencode-client": "pi" };
|
|
32
|
+
}
|
|
28
33
|
if (!isInstallTelemetryEnabled(settingsManager)) {
|
|
29
34
|
return undefined;
|
|
30
35
|
}
|
|
@@ -81,8 +86,8 @@ function getAttributionHeaders(model, settingsManager) {
|
|
|
81
86
|
* ```
|
|
82
87
|
*/
|
|
83
88
|
export async function createAgentSession(options = {}) {
|
|
84
|
-
const cwd = options.cwd ?? options.sessionManager?.getCwd() ?? process.cwd();
|
|
85
|
-
const agentDir = options.agentDir
|
|
89
|
+
const cwd = resolvePath(options.cwd ?? options.sessionManager?.getCwd() ?? process.cwd());
|
|
90
|
+
const agentDir = options.agentDir ? resolvePath(options.agentDir) : getDefaultAgentDir();
|
|
86
91
|
let resourceLoader = options.resourceLoader;
|
|
87
92
|
// Use provided or create AuthStorage and ModelRegistry
|
|
88
93
|
const authPath = options.agentDir ? join(agentDir, "auth.json") : undefined;
|
|
@@ -201,7 +206,7 @@ export async function createAgentSession(options = {}) {
|
|
|
201
206
|
throw new Error(auth.error);
|
|
202
207
|
}
|
|
203
208
|
const providerRetrySettings = settingsManager.getProviderRetrySettings();
|
|
204
|
-
const attributionHeaders = getAttributionHeaders(model, settingsManager);
|
|
209
|
+
const attributionHeaders = getAttributionHeaders(model, settingsManager, options?.sessionId);
|
|
205
210
|
return streamSimple(model, context, {
|
|
206
211
|
...options,
|
|
207
212
|
apiKey: auth.apiKey,
|
|
@@ -4,6 +4,7 @@ import { appendFileSync, closeSync, existsSync, mkdirSync, openSync, readdirSync
|
|
|
4
4
|
import { readdir, readFile, stat } from "fs/promises";
|
|
5
5
|
import { join, resolve } from "path";
|
|
6
6
|
import { getAgentDir as getDefaultAgentDir, getSessionsDir } from "../config.js";
|
|
7
|
+
import { normalizePath, resolvePath } from "../utils/paths.js";
|
|
7
8
|
import { createBranchSummaryMessage, createCompactionSummaryMessage, createCustomMessage, } from "./messages.js";
|
|
8
9
|
export const CURRENT_SESSION_VERSION = 3;
|
|
9
10
|
function createSessionId() {
|
|
@@ -210,8 +211,10 @@ export function buildSessionContext(entries, leafId, byId) {
|
|
|
210
211
|
* Encodes cwd into a safe directory name under ~/.pi/agent/sessions/.
|
|
211
212
|
*/
|
|
212
213
|
export function getDefaultSessionDir(cwd, agentDir = getDefaultAgentDir()) {
|
|
213
|
-
const
|
|
214
|
-
const
|
|
214
|
+
const resolvedCwd = resolvePath(cwd);
|
|
215
|
+
const resolvedAgentDir = resolvePath(agentDir);
|
|
216
|
+
const safePath = `--${resolvedCwd.replace(/^[/\\]/, "").replace(/[/\\:]/g, "-")}--`;
|
|
217
|
+
const sessionDir = join(resolvedAgentDir, "sessions", safePath);
|
|
215
218
|
if (!existsSync(sessionDir)) {
|
|
216
219
|
mkdirSync(sessionDir, { recursive: true });
|
|
217
220
|
}
|
|
@@ -219,9 +222,10 @@ export function getDefaultSessionDir(cwd, agentDir = getDefaultAgentDir()) {
|
|
|
219
222
|
}
|
|
220
223
|
/** Exported for testing */
|
|
221
224
|
export function loadEntriesFromFile(filePath) {
|
|
222
|
-
|
|
225
|
+
const resolvedFilePath = normalizePath(filePath);
|
|
226
|
+
if (!existsSync(resolvedFilePath))
|
|
223
227
|
return [];
|
|
224
|
-
const content = readFileSync(
|
|
228
|
+
const content = readFileSync(resolvedFilePath, "utf8");
|
|
225
229
|
const entries = [];
|
|
226
230
|
const lines = content.trim().split("\n");
|
|
227
231
|
for (const line of lines) {
|
|
@@ -262,10 +266,11 @@ function isValidSessionFile(filePath) {
|
|
|
262
266
|
}
|
|
263
267
|
/** Exported for testing */
|
|
264
268
|
export function findMostRecentSession(sessionDir) {
|
|
269
|
+
const resolvedSessionDir = normalizePath(sessionDir);
|
|
265
270
|
try {
|
|
266
|
-
const files = readdirSync(
|
|
271
|
+
const files = readdirSync(resolvedSessionDir)
|
|
267
272
|
.filter((f) => f.endsWith(".jsonl"))
|
|
268
|
-
.map((f) => join(
|
|
273
|
+
.map((f) => join(resolvedSessionDir, f))
|
|
269
274
|
.filter(isValidSessionFile)
|
|
270
275
|
.map((path) => ({ path, mtime: statSync(path).mtime }))
|
|
271
276
|
.sort((a, b) => b.mtime.getTime() - a.mtime.getTime());
|
|
@@ -471,11 +476,11 @@ export class SessionManager {
|
|
|
471
476
|
labelTimestampsById = new Map();
|
|
472
477
|
leafId = null;
|
|
473
478
|
constructor(cwd, sessionDir, sessionFile, persist) {
|
|
474
|
-
this.cwd = cwd;
|
|
475
|
-
this.sessionDir = sessionDir;
|
|
479
|
+
this.cwd = resolvePath(cwd);
|
|
480
|
+
this.sessionDir = normalizePath(sessionDir);
|
|
476
481
|
this.persist = persist;
|
|
477
|
-
if (persist && sessionDir && !existsSync(sessionDir)) {
|
|
478
|
-
mkdirSync(sessionDir, { recursive: true });
|
|
482
|
+
if (persist && this.sessionDir && !existsSync(this.sessionDir)) {
|
|
483
|
+
mkdirSync(this.sessionDir, { recursive: true });
|
|
479
484
|
}
|
|
480
485
|
if (sessionFile) {
|
|
481
486
|
this.setSessionFile(sessionFile);
|
|
@@ -486,7 +491,7 @@ export class SessionManager {
|
|
|
486
491
|
}
|
|
487
492
|
/** Switch to a different session file (used for resume and branching) */
|
|
488
493
|
setSessionFile(sessionFile) {
|
|
489
|
-
this.sessionFile =
|
|
494
|
+
this.sessionFile = resolvePath(sessionFile);
|
|
490
495
|
if (existsSync(this.sessionFile)) {
|
|
491
496
|
this.fileEntries = loadEntriesFromFile(this.sessionFile);
|
|
492
497
|
// If file was empty or corrupted (no valid header), truncate and start fresh
|
|
@@ -1000,7 +1005,7 @@ export class SessionManager {
|
|
|
1000
1005
|
* @param sessionDir Optional session directory. If omitted, uses default (~/.pi/agent/sessions/<encoded-cwd>/).
|
|
1001
1006
|
*/
|
|
1002
1007
|
static create(cwd, sessionDir) {
|
|
1003
|
-
const dir = sessionDir
|
|
1008
|
+
const dir = sessionDir ? normalizePath(sessionDir) : getDefaultSessionDir(cwd);
|
|
1004
1009
|
return new SessionManager(cwd, dir, undefined, true);
|
|
1005
1010
|
}
|
|
1006
1011
|
/**
|
|
@@ -1010,13 +1015,14 @@ export class SessionManager {
|
|
|
1010
1015
|
* @param cwdOverride Optional cwd override instead of the session header cwd.
|
|
1011
1016
|
*/
|
|
1012
1017
|
static open(path, sessionDir, cwdOverride) {
|
|
1018
|
+
const resolvedPath = resolvePath(path);
|
|
1013
1019
|
// Extract cwd from session header if possible, otherwise use process.cwd()
|
|
1014
|
-
const entries = loadEntriesFromFile(
|
|
1020
|
+
const entries = loadEntriesFromFile(resolvedPath);
|
|
1015
1021
|
const header = entries.find((e) => e.type === "session");
|
|
1016
1022
|
const cwd = cwdOverride ?? header?.cwd ?? process.cwd();
|
|
1017
1023
|
// If no sessionDir provided, derive from file's parent directory
|
|
1018
|
-
const dir = sessionDir
|
|
1019
|
-
return new SessionManager(cwd, dir,
|
|
1024
|
+
const dir = sessionDir ? normalizePath(sessionDir) : resolve(resolvedPath, "..");
|
|
1025
|
+
return new SessionManager(cwd, dir, resolvedPath, true);
|
|
1020
1026
|
}
|
|
1021
1027
|
/**
|
|
1022
1028
|
* Continue the most recent session, or create new if none.
|
|
@@ -1024,7 +1030,7 @@ export class SessionManager {
|
|
|
1024
1030
|
* @param sessionDir Optional session directory. If omitted, uses default (~/.pi/agent/sessions/<encoded-cwd>/).
|
|
1025
1031
|
*/
|
|
1026
1032
|
static continueRecent(cwd, sessionDir) {
|
|
1027
|
-
const dir = sessionDir
|
|
1033
|
+
const dir = sessionDir ? normalizePath(sessionDir) : getDefaultSessionDir(cwd);
|
|
1028
1034
|
const mostRecent = findMostRecentSession(dir);
|
|
1029
1035
|
if (mostRecent) {
|
|
1030
1036
|
return new SessionManager(cwd, dir, mostRecent, true);
|
|
@@ -1043,15 +1049,17 @@ export class SessionManager {
|
|
|
1043
1049
|
* @param sessionDir Optional session directory. If omitted, uses default for targetCwd.
|
|
1044
1050
|
*/
|
|
1045
1051
|
static forkFrom(sourcePath, targetCwd, sessionDir) {
|
|
1046
|
-
const
|
|
1052
|
+
const resolvedSourcePath = resolvePath(sourcePath);
|
|
1053
|
+
const resolvedTargetCwd = resolvePath(targetCwd);
|
|
1054
|
+
const sourceEntries = loadEntriesFromFile(resolvedSourcePath);
|
|
1047
1055
|
if (sourceEntries.length === 0) {
|
|
1048
|
-
throw new Error(`Cannot fork: source session file is empty or invalid: ${
|
|
1056
|
+
throw new Error(`Cannot fork: source session file is empty or invalid: ${resolvedSourcePath}`);
|
|
1049
1057
|
}
|
|
1050
1058
|
const sourceHeader = sourceEntries.find((e) => e.type === "session");
|
|
1051
1059
|
if (!sourceHeader) {
|
|
1052
|
-
throw new Error(`Cannot fork: source session has no header: ${
|
|
1060
|
+
throw new Error(`Cannot fork: source session has no header: ${resolvedSourcePath}`);
|
|
1053
1061
|
}
|
|
1054
|
-
const dir = sessionDir
|
|
1062
|
+
const dir = sessionDir ? normalizePath(sessionDir) : getDefaultSessionDir(resolvedTargetCwd);
|
|
1055
1063
|
if (!existsSync(dir)) {
|
|
1056
1064
|
mkdirSync(dir, { recursive: true });
|
|
1057
1065
|
}
|
|
@@ -1066,8 +1074,8 @@ export class SessionManager {
|
|
|
1066
1074
|
version: CURRENT_SESSION_VERSION,
|
|
1067
1075
|
id: newSessionId,
|
|
1068
1076
|
timestamp,
|
|
1069
|
-
cwd:
|
|
1070
|
-
parentSession:
|
|
1077
|
+
cwd: resolvedTargetCwd,
|
|
1078
|
+
parentSession: resolvedSourcePath,
|
|
1071
1079
|
};
|
|
1072
1080
|
appendFileSync(newSessionFile, `${JSON.stringify(newHeader)}\n`);
|
|
1073
1081
|
// Copy all non-header entries from source
|
|
@@ -1076,7 +1084,7 @@ export class SessionManager {
|
|
|
1076
1084
|
appendFileSync(newSessionFile, `${JSON.stringify(entry)}\n`);
|
|
1077
1085
|
}
|
|
1078
1086
|
}
|
|
1079
|
-
return new SessionManager(
|
|
1087
|
+
return new SessionManager(resolvedTargetCwd, dir, newSessionFile, true);
|
|
1080
1088
|
}
|
|
1081
1089
|
/**
|
|
1082
1090
|
* List all sessions for a directory.
|
|
@@ -1085,7 +1093,7 @@ export class SessionManager {
|
|
|
1085
1093
|
* @param onProgress Optional callback for progress updates (loaded, total)
|
|
1086
1094
|
*/
|
|
1087
1095
|
static async list(cwd, sessionDir, onProgress) {
|
|
1088
|
-
const dir = sessionDir
|
|
1096
|
+
const dir = sessionDir ? normalizePath(sessionDir) : getDefaultSessionDir(cwd);
|
|
1089
1097
|
const sessions = await listSessionsFromDir(dir, onProgress);
|
|
1090
1098
|
sessions.sort((a, b) => b.modified.getTime() - a.modified.getTime());
|
|
1091
1099
|
return sessions;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { existsSync, mkdirSync, readFileSync, writeFileSync } from "fs";
|
|
2
|
-
import { homedir } from "os";
|
|
3
2
|
import { dirname, join } from "path";
|
|
4
3
|
import lockfile from "proper-lockfile";
|
|
5
4
|
import { CONFIG_DIR_NAME, getAgentDir } from "../config.js";
|
|
5
|
+
import { normalizePath, resolvePath } from "../utils/paths.js";
|
|
6
6
|
import { DEFAULT_HTTP_IDLE_TIMEOUT_MS, parseHttpIdleTimeoutMs } from "./http-dispatcher.js";
|
|
7
7
|
/** Deep merge settings: project/overrides take precedence, nested objects merge recursively */
|
|
8
8
|
function deepMergeSettings(base, overrides) {
|
|
@@ -33,8 +33,10 @@ export class FileSettingsStorage {
|
|
|
33
33
|
globalSettingsPath;
|
|
34
34
|
projectSettingsPath;
|
|
35
35
|
constructor(cwd, agentDir) {
|
|
36
|
-
|
|
37
|
-
|
|
36
|
+
const resolvedCwd = resolvePath(cwd);
|
|
37
|
+
const resolvedAgentDir = resolvePath(agentDir);
|
|
38
|
+
this.globalSettingsPath = join(resolvedAgentDir, "settings.json");
|
|
39
|
+
this.projectSettingsPath = join(resolvedCwd, CONFIG_DIR_NAME, "settings.json");
|
|
38
40
|
}
|
|
39
41
|
acquireLockSyncWithRetry(path) {
|
|
40
42
|
const maxAttempts = 10;
|
|
@@ -375,16 +377,7 @@ export class SettingsManager {
|
|
|
375
377
|
}
|
|
376
378
|
getSessionDir() {
|
|
377
379
|
const sessionDir = this.settings.sessionDir;
|
|
378
|
-
|
|
379
|
-
return sessionDir;
|
|
380
|
-
}
|
|
381
|
-
if (sessionDir === "~") {
|
|
382
|
-
return homedir();
|
|
383
|
-
}
|
|
384
|
-
if (sessionDir.startsWith("~/")) {
|
|
385
|
-
return join(homedir(), sessionDir.slice(2));
|
|
386
|
-
}
|
|
387
|
-
return sessionDir;
|
|
380
|
+
return sessionDir ? normalizePath(sessionDir) : sessionDir;
|
|
388
381
|
}
|
|
389
382
|
getDefaultProvider() {
|
|
390
383
|
return this.settings.defaultProvider;
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import { existsSync, readdirSync, readFileSync, statSync } from "fs";
|
|
2
2
|
import ignore from "ignore";
|
|
3
|
-
import {
|
|
4
|
-
import { basename, dirname, isAbsolute, join, relative, resolve, sep } from "path";
|
|
3
|
+
import { basename, dirname, join, relative, resolve, sep } from "path";
|
|
5
4
|
import { CONFIG_DIR_NAME, getAgentDir } from "../config.js";
|
|
6
5
|
import { parseFrontmatter } from "../utils/frontmatter.js";
|
|
7
|
-
import { canonicalizePath } from "../utils/paths.js";
|
|
6
|
+
import { canonicalizePath, resolvePath } from "../utils/paths.js";
|
|
8
7
|
import { createSyntheticSourceInfo } from "./source-info.js";
|
|
9
8
|
/** Max name length per spec */
|
|
10
9
|
const MAX_NAME_LENGTH = 64;
|
|
@@ -285,28 +284,15 @@ function escapeXml(str) {
|
|
|
285
284
|
.replace(/"/g, """)
|
|
286
285
|
.replace(/'/g, "'");
|
|
287
286
|
}
|
|
288
|
-
function normalizePath(input) {
|
|
289
|
-
const trimmed = input.trim();
|
|
290
|
-
if (trimmed === "~")
|
|
291
|
-
return homedir();
|
|
292
|
-
if (trimmed.startsWith("~/"))
|
|
293
|
-
return join(homedir(), trimmed.slice(2));
|
|
294
|
-
if (trimmed.startsWith("~"))
|
|
295
|
-
return join(homedir(), trimmed.slice(1));
|
|
296
|
-
return trimmed;
|
|
297
|
-
}
|
|
298
|
-
function resolveSkillPath(p, cwd) {
|
|
299
|
-
const normalized = normalizePath(p);
|
|
300
|
-
return isAbsolute(normalized) ? normalized : resolve(cwd, normalized);
|
|
301
|
-
}
|
|
302
287
|
/**
|
|
303
288
|
* Load skills from all configured locations.
|
|
304
289
|
* Returns skills and any validation diagnostics.
|
|
305
290
|
*/
|
|
306
291
|
export function loadSkills(options) {
|
|
307
|
-
const {
|
|
292
|
+
const { agentDir, skillPaths, includeDefaults } = options;
|
|
308
293
|
// Resolve agentDir - if not provided, use default from config
|
|
309
|
-
const
|
|
294
|
+
const resolvedCwd = resolvePath(options.cwd);
|
|
295
|
+
const resolvedAgentDir = resolvePath(agentDir ?? getAgentDir());
|
|
310
296
|
const skillMap = new Map();
|
|
311
297
|
const realPathSet = new Set();
|
|
312
298
|
const allDiagnostics = [];
|
|
@@ -342,10 +328,10 @@ export function loadSkills(options) {
|
|
|
342
328
|
}
|
|
343
329
|
if (includeDefaults) {
|
|
344
330
|
addSkills(loadSkillsFromDirInternal(join(resolvedAgentDir, "skills"), "user", true));
|
|
345
|
-
addSkills(loadSkillsFromDirInternal(resolve(
|
|
331
|
+
addSkills(loadSkillsFromDirInternal(resolve(resolvedCwd, CONFIG_DIR_NAME, "skills"), "project", true));
|
|
346
332
|
}
|
|
347
333
|
const userSkillsDir = join(resolvedAgentDir, "skills");
|
|
348
|
-
const projectSkillsDir = resolve(
|
|
334
|
+
const projectSkillsDir = resolve(resolvedCwd, CONFIG_DIR_NAME, "skills");
|
|
349
335
|
const isUnderPath = (target, root) => {
|
|
350
336
|
const normalizedRoot = resolve(root);
|
|
351
337
|
if (target === normalizedRoot) {
|
|
@@ -364,7 +350,7 @@ export function loadSkills(options) {
|
|
|
364
350
|
return "path";
|
|
365
351
|
};
|
|
366
352
|
for (const rawPath of skillPaths) {
|
|
367
|
-
const resolvedPath =
|
|
353
|
+
const resolvedPath = resolvePath(rawPath, resolvedCwd, { trim: true });
|
|
368
354
|
if (!existsSync(resolvedPath)) {
|
|
369
355
|
allDiagnostics.push({ type: "warning", message: "skill path does not exist", path: resolvedPath });
|
|
370
356
|
continue;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { constants } from "node:fs";
|
|
2
|
+
import { access as fsAccess } from "node:fs/promises";
|
|
2
3
|
import { Container, Text, truncateToWidth } from "@earendil-works/pi-tui";
|
|
3
4
|
import { spawn } from "child_process";
|
|
4
5
|
import { Type } from "typebox";
|
|
@@ -23,24 +24,33 @@ const bashSchema = Type.Object({
|
|
|
23
24
|
*/
|
|
24
25
|
export function createLocalBashOperations(options) {
|
|
25
26
|
return {
|
|
26
|
-
exec: (command, cwd, { onData, signal, timeout, env }) => {
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
27
|
+
exec: async (command, cwd, { onData, signal, timeout, env }) => {
|
|
28
|
+
const { shell, args } = getShellConfig(options?.shellPath);
|
|
29
|
+
try {
|
|
30
|
+
await fsAccess(cwd, constants.F_OK);
|
|
31
|
+
}
|
|
32
|
+
catch {
|
|
33
|
+
throw new Error(`Working directory does not exist: ${cwd}\nCannot execute bash commands.`);
|
|
34
|
+
}
|
|
35
|
+
if (signal?.aborted) {
|
|
36
|
+
throw new Error("aborted");
|
|
37
|
+
}
|
|
38
|
+
const child = spawn(shell, [...args, command], {
|
|
39
|
+
cwd,
|
|
40
|
+
detached: process.platform !== "win32",
|
|
41
|
+
env: env ?? getShellEnv(),
|
|
42
|
+
stdio: ["ignore", "pipe", "pipe"],
|
|
43
|
+
windowsHide: true,
|
|
44
|
+
});
|
|
45
|
+
if (child.pid)
|
|
46
|
+
trackDetachedChildPid(child.pid);
|
|
47
|
+
let timedOut = false;
|
|
48
|
+
let timeoutHandle;
|
|
49
|
+
const onAbort = () => {
|
|
40
50
|
if (child.pid)
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
51
|
+
killProcessTree(child.pid);
|
|
52
|
+
};
|
|
53
|
+
try {
|
|
44
54
|
// Set timeout if provided.
|
|
45
55
|
if (timeout !== undefined && timeout > 0) {
|
|
46
56
|
timeoutHandle = setTimeout(() => {
|
|
@@ -53,10 +63,6 @@ export function createLocalBashOperations(options) {
|
|
|
53
63
|
child.stdout?.on("data", onData);
|
|
54
64
|
child.stderr?.on("data", onData);
|
|
55
65
|
// Handle abort signal by killing the entire process tree.
|
|
56
|
-
const onAbort = () => {
|
|
57
|
-
if (child.pid)
|
|
58
|
-
killProcessTree(child.pid);
|
|
59
|
-
};
|
|
60
66
|
if (signal) {
|
|
61
67
|
if (signal.aborted)
|
|
62
68
|
onAbort();
|
|
@@ -65,34 +71,23 @@ export function createLocalBashOperations(options) {
|
|
|
65
71
|
}
|
|
66
72
|
// Handle shell spawn errors and wait for the process to terminate without hanging
|
|
67
73
|
// on inherited stdio handles held by detached descendants.
|
|
68
|
-
waitForChildProcess(child)
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
})
|
|
86
|
-
.catch((err) => {
|
|
87
|
-
if (child.pid)
|
|
88
|
-
untrackDetachedChildPid(child.pid);
|
|
89
|
-
if (timeoutHandle)
|
|
90
|
-
clearTimeout(timeoutHandle);
|
|
91
|
-
if (signal)
|
|
92
|
-
signal.removeEventListener("abort", onAbort);
|
|
93
|
-
reject(err);
|
|
94
|
-
});
|
|
95
|
-
});
|
|
74
|
+
const exitCode = await waitForChildProcess(child);
|
|
75
|
+
if (signal?.aborted) {
|
|
76
|
+
throw new Error("aborted");
|
|
77
|
+
}
|
|
78
|
+
if (timedOut) {
|
|
79
|
+
throw new Error(`timeout:${timeout}`);
|
|
80
|
+
}
|
|
81
|
+
return { exitCode };
|
|
82
|
+
}
|
|
83
|
+
finally {
|
|
84
|
+
if (child.pid)
|
|
85
|
+
untrackDetachedChildPid(child.pid);
|
|
86
|
+
if (timeoutHandle)
|
|
87
|
+
clearTimeout(timeoutHandle);
|
|
88
|
+
if (signal)
|
|
89
|
+
signal.removeEventListener("abort", onAbort);
|
|
90
|
+
}
|
|
96
91
|
},
|
|
97
92
|
};
|
|
98
93
|
}
|
|
@@ -122,7 +117,15 @@ function formatBashCall(args) {
|
|
|
122
117
|
function rebuildBashResultRenderComponent(component, result, options, showImages, startedAt, endedAt) {
|
|
123
118
|
const state = component.state;
|
|
124
119
|
component.clear();
|
|
125
|
-
|
|
120
|
+
let output = getTextOutput(result, showImages).trim();
|
|
121
|
+
const truncation = result.details?.truncation;
|
|
122
|
+
const fullOutputPath = result.details?.fullOutputPath;
|
|
123
|
+
if (!options.isPartial && truncation?.truncated && fullOutputPath && output.endsWith("]")) {
|
|
124
|
+
const footerStart = output.lastIndexOf("\n\n[");
|
|
125
|
+
if (footerStart !== -1 && output.slice(footerStart).includes(fullOutputPath)) {
|
|
126
|
+
output = output.slice(0, footerStart).trimEnd();
|
|
127
|
+
}
|
|
128
|
+
}
|
|
126
129
|
if (output) {
|
|
127
130
|
const styledOutput = output
|
|
128
131
|
.split("\n")
|
|
@@ -155,8 +158,6 @@ function rebuildBashResultRenderComponent(component, result, options, showImages
|
|
|
155
158
|
});
|
|
156
159
|
}
|
|
157
160
|
}
|
|
158
|
-
const truncation = result.details?.truncation;
|
|
159
|
-
const fullOutputPath = result.details?.fullOutputPath;
|
|
160
161
|
if (truncation?.truncated || fullOutputPath) {
|
|
161
162
|
const warnings = [];
|
|
162
163
|
if (fullOutputPath) {
|
|
@@ -184,8 +184,15 @@ export function applyEditsToNormalizedContent(normalizedContent, edits, path) {
|
|
|
184
184
|
}
|
|
185
185
|
return { baseContent, newContent };
|
|
186
186
|
}
|
|
187
|
+
/** Generate a standard unified patch. */
|
|
188
|
+
export function generateUnifiedPatch(path, oldContent, newContent, contextLines = 4) {
|
|
189
|
+
return Diff.createTwoFilesPatch(path, path, oldContent, newContent, undefined, undefined, {
|
|
190
|
+
context: contextLines,
|
|
191
|
+
headerOptions: Diff.FILE_HEADERS_ONLY,
|
|
192
|
+
});
|
|
193
|
+
}
|
|
187
194
|
/**
|
|
188
|
-
* Generate a
|
|
195
|
+
* Generate a display-oriented diff string with line numbers and context.
|
|
189
196
|
* Returns both the diff string and the first changed line number (in the new file).
|
|
190
197
|
*/
|
|
191
198
|
export function generateDiffString(oldContent, newContent, contextLines = 4) {
|