@bastani/atomic 0.9.12 → 0.9.13-alpha.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +150 -0
- package/README.md +35 -17
- package/dist/builtin/i-have-adhd/CHANGELOG.md +17 -0
- package/dist/builtin/i-have-adhd/LICENSE +21 -0
- package/dist/builtin/i-have-adhd/README.md +18 -0
- package/dist/builtin/i-have-adhd/index.ts +238 -0
- package/dist/builtin/i-have-adhd/package.json +56 -0
- package/dist/builtin/i-have-adhd/skills/i-have-adhd/SKILL.md +140 -0
- package/dist/builtin/intercom/CHANGELOG.md +25 -0
- package/dist/builtin/intercom/README.md +30 -16
- package/dist/builtin/intercom/broker/bounded-stderr-install.ts +18 -0
- package/dist/builtin/intercom/broker/bounded-stderr.ts +132 -0
- package/dist/builtin/intercom/broker/broker.ts +12 -23
- package/dist/builtin/intercom/broker/client.ts +81 -5
- package/dist/builtin/intercom/broker/paths.ts +9 -0
- package/dist/builtin/intercom/broker/presence-handler.ts +103 -0
- package/dist/builtin/intercom/broker/spawn.ts +128 -29
- package/dist/builtin/intercom/contact-supervisor-tool.ts +13 -3
- package/dist/builtin/intercom/foreground-detach-handoff.ts +30 -14
- package/dist/builtin/intercom/group.ts +64 -25
- package/dist/builtin/intercom/index-heavy.ts +51 -8
- package/dist/builtin/intercom/index.ts +50 -22
- package/dist/builtin/intercom/intercom-tool.ts +82 -5
- package/dist/builtin/intercom/intercom-utils.ts +15 -29
- package/dist/builtin/intercom/lazy-subagent-ack.ts +11 -6
- package/dist/builtin/intercom/package.json +2 -3
- package/dist/builtin/intercom/runtime-group.ts +13 -0
- package/dist/builtin/intercom/skills/intercom/SKILL.md +30 -2
- package/dist/builtin/intercom/source-ownership.ts +9 -12
- package/dist/builtin/intercom/subagent-relay.ts +32 -16
- package/dist/builtin/intercom/terminal-ordering-barrier.ts +21 -4
- package/dist/builtin/intercom/types.ts +3 -1
- package/dist/builtin/intercom/ui/compose.ts +8 -6
- package/dist/builtin/intercom/ui/session-list.ts +7 -5
- package/dist/builtin/mcp/CHANGELOG.md +19 -0
- package/dist/builtin/mcp/README.md +3 -1
- package/dist/builtin/mcp/glimpse-ui.ts +2 -1
- package/dist/builtin/mcp/index.ts +10 -26
- package/dist/builtin/mcp/mcp-panel.ts +35 -34
- package/dist/builtin/mcp/mcp-setup-panel.ts +35 -33
- package/dist/builtin/mcp/npx-resolver.ts +3 -2
- package/dist/builtin/mcp/package.json +3 -3
- package/dist/builtin/mcp/sampling-handler.ts +5 -1
- package/dist/builtin/mcp/server-manager.ts +4 -7
- package/dist/builtin/mcp/startup-warmup.ts +20 -8
- package/dist/builtin/subagents/CHANGELOG.md +63 -0
- package/dist/builtin/subagents/README.md +144 -351
- package/dist/builtin/subagents/agents/worker.md +1 -1
- package/dist/builtin/subagents/package.json +5 -5
- package/dist/builtin/subagents/prompts/parallel-context-build.md +2 -2
- package/dist/builtin/subagents/prompts/parallel-handoff-plan.md +4 -4
- package/dist/builtin/subagents/prompts/review-loop.md +1 -1
- package/dist/builtin/subagents/skills/subagent/SKILL.md +39 -102
- package/dist/builtin/subagents/src/agents/agent-discovery.ts +1 -29
- package/dist/builtin/subagents/src/agents/agent-loaders.ts +1 -40
- package/dist/builtin/subagents/src/agents/agent-management-helpers.ts +6 -135
- package/dist/builtin/subagents/src/agents/agent-management.ts +52 -282
- package/dist/builtin/subagents/src/agents/agent-paths.ts +0 -22
- package/dist/builtin/subagents/src/agents/agent-types.ts +0 -40
- package/dist/builtin/subagents/src/agents/agents.ts +0 -3
- package/dist/builtin/subagents/src/agents/identity.ts +2 -4
- package/dist/builtin/subagents/src/agents/skills-paths.ts +8 -1
- package/dist/builtin/subagents/src/extension/doctor.ts +4 -24
- package/dist/builtin/subagents/src/extension/fanout-child.ts +76 -56
- package/dist/builtin/subagents/src/extension/index.ts +32 -39
- package/dist/builtin/subagents/src/extension/prompt-guidance.ts +2 -2
- package/dist/builtin/subagents/src/extension/schemas.ts +1 -157
- package/dist/builtin/subagents/src/extension/startup-maintenance.ts +25 -46
- package/dist/builtin/subagents/src/extension/tool-description.ts +4 -13
- package/dist/builtin/subagents/src/intercom/intercom-bridge.ts +6 -2
- package/dist/builtin/subagents/src/intercom/result-intercom.ts +27 -29
- package/dist/builtin/subagents/src/intercom/supervisor-authorization.ts +9 -2
- package/dist/builtin/subagents/src/runs/background/async-job-tracker.ts +248 -435
- package/dist/builtin/subagents/src/runs/background/completion-notification.ts +8 -3
- package/dist/builtin/subagents/src/runs/background/notify.ts +83 -26
- package/dist/builtin/subagents/src/runs/foreground/execution-run-sync.ts +1 -281
- package/dist/builtin/subagents/src/runs/foreground/execution-updates.ts +0 -5
- package/dist/builtin/subagents/src/runs/foreground/execution.ts +1 -4
- package/dist/builtin/subagents/src/runs/foreground/inprocess-run-sync.ts +559 -0
- package/dist/builtin/subagents/src/runs/foreground/subagent-executor-async.ts +103 -259
- package/dist/builtin/subagents/src/runs/foreground/subagent-executor-context.ts +29 -31
- package/dist/builtin/subagents/src/runs/foreground/subagent-executor-input.ts +10 -173
- package/dist/builtin/subagents/src/runs/foreground/subagent-executor-parallel-task.ts +7 -5
- package/dist/builtin/subagents/src/runs/foreground/subagent-executor-parallel.ts +13 -6
- package/dist/builtin/subagents/src/runs/foreground/subagent-executor-resume.ts +1 -646
- package/dist/builtin/subagents/src/runs/foreground/subagent-executor-runtime.ts +2 -7
- package/dist/builtin/subagents/src/runs/foreground/subagent-executor-single.ts +14 -7
- package/dist/builtin/subagents/src/runs/foreground/subagent-executor-status.ts +39 -20
- package/dist/builtin/subagents/src/runs/foreground/subagent-executor-types.ts +16 -11
- package/dist/builtin/subagents/src/runs/foreground/subagent-executor-worktree.ts +1 -14
- package/dist/builtin/subagents/src/runs/foreground/subagent-executor.ts +194 -104
- package/dist/builtin/subagents/src/runs/inprocess/background-single.ts +195 -0
- package/dist/builtin/subagents/src/runs/inprocess/background.ts +90 -0
- package/dist/builtin/subagents/src/runs/inprocess/child-policy.ts +27 -0
- package/dist/builtin/subagents/src/runs/inprocess/control-registry.ts +55 -0
- package/dist/builtin/subagents/src/runs/inprocess/control-status.ts +106 -0
- package/dist/builtin/subagents/src/runs/inprocess/index.ts +50 -0
- package/dist/builtin/subagents/src/runs/inprocess/nested-routing.ts +218 -0
- package/dist/builtin/subagents/src/runs/{shared/subagent-prompt-runtime.ts → inprocess/prompt-behavior.ts} +37 -75
- package/dist/builtin/subagents/src/runs/inprocess/runner.ts +1392 -0
- package/dist/builtin/subagents/src/runs/{shared/nested-events.ts → inprocess/runtime-support/nested-api.ts} +13 -7
- package/dist/builtin/subagents/src/runs/{shared/nested-events-control.ts → inprocess/runtime-support/nested-control.ts} +18 -17
- package/dist/builtin/subagents/src/runs/{shared/nested-events-core.ts → inprocess/runtime-support/nested-core.ts} +14 -61
- package/dist/builtin/subagents/src/runs/{shared/nested-events-projection.ts → inprocess/runtime-support/nested-projection.ts} +4 -12
- package/dist/builtin/subagents/src/runs/{shared/nested-events-registry.ts → inprocess/runtime-support/nested-registry.ts} +19 -4
- package/dist/builtin/subagents/src/runs/{shared/nested-render.ts → inprocess/runtime-support/nested-rendering.ts} +3 -3
- package/dist/builtin/subagents/src/runs/{shared/nested-events-sanitize.ts → inprocess/runtime-support/nested-sanitize.ts} +4 -6
- package/dist/builtin/subagents/src/runs/inprocess.ts +1 -0
- package/dist/builtin/subagents/src/runs/shared/intercom-group.ts +23 -7
- package/dist/builtin/subagents/src/runs/shared/model-candidate-filter.ts +0 -1
- package/dist/builtin/subagents/src/runs/shared/model-fallback.ts +15 -492
- package/dist/builtin/subagents/src/runs/shared/parallel-utils.ts +13 -97
- package/dist/builtin/subagents/src/runs/shared/run-history.ts +3 -5
- package/dist/builtin/subagents/src/runs/shared/single-output.ts +4 -4
- package/dist/builtin/subagents/src/runs/shared/worktree.ts +7 -2
- package/dist/builtin/subagents/src/shared/formatters.ts +2 -56
- package/dist/builtin/subagents/src/shared/settings.ts +14 -350
- package/dist/builtin/subagents/src/shared/types-async.ts +8 -32
- package/dist/builtin/subagents/src/shared/types-config.ts +29 -13
- package/dist/builtin/subagents/src/shared/types-depth.ts +30 -56
- package/dist/builtin/subagents/src/shared/types-results.ts +18 -60
- package/dist/builtin/subagents/src/shared/types-runtime.ts +0 -1
- package/dist/builtin/subagents/src/shared/utils.ts +5 -0
- package/dist/builtin/subagents/src/slash/bridge-settlement.ts +87 -0
- package/dist/builtin/subagents/src/slash/prompt-template-bridge.ts +49 -10
- package/dist/builtin/subagents/src/slash/slash-bridge.ts +27 -7
- package/dist/builtin/subagents/src/slash/slash-commands.ts +37 -82
- package/dist/builtin/subagents/src/slash/slash-live-state.ts +3 -94
- package/dist/builtin/subagents/src/tui/render-event-formatting.ts +3 -35
- package/dist/builtin/subagents/src/tui/render-progress.ts +89 -0
- package/dist/builtin/subagents/src/tui/render-result-compact.ts +77 -68
- package/dist/builtin/subagents/src/tui/render-result.ts +79 -99
- package/dist/builtin/subagents/src/tui/render-stable-output.ts +1 -6
- package/dist/builtin/subagents/src/tui/render-status-progress.ts +8 -5
- package/dist/builtin/subagents/src/tui/render-widget-graph.ts +6 -63
- package/dist/builtin/subagents/src/tui/render-widget.ts +0 -24
- package/dist/builtin/web-access/CHANGELOG.md +14 -0
- package/dist/builtin/web-access/chrome-cookies.ts +3 -2
- package/dist/builtin/web-access/github-api.ts +7 -6
- package/dist/builtin/web-access/github-extract.ts +2 -1
- package/dist/builtin/web-access/package.json +3 -3
- package/dist/builtin/web-access/subprocess.ts +3 -1
- package/dist/builtin/web-access/summary-review.ts +2 -2
- package/dist/builtin/web-access/web-search-features.ts +38 -22
- package/dist/builtin/web-access/web-search-summary.ts +2 -2
- package/dist/builtin/workflows/CHANGELOG.md +70 -0
- package/dist/builtin/workflows/README.md +54 -4
- package/dist/builtin/workflows/builtin/open-claude-design-utils.ts +3 -0
- package/dist/builtin/workflows/builtin/ralph-models.ts +25 -20
- package/dist/builtin/workflows/builtin/shared-prompts.ts +5 -2
- package/dist/builtin/workflows/package.json +2 -2
- package/dist/builtin/workflows/src/durable/backend.ts +25 -1
- package/dist/builtin/workflows/src/durable/completed-catalog-stage-groups.ts +60 -3
- package/dist/builtin/workflows/src/durable/completed-catalog.ts +67 -1
- package/dist/builtin/workflows/src/durable/completed-subtree.ts +22 -7
- package/dist/builtin/workflows/src/durable/dbos-metadata.ts +15 -1
- package/dist/builtin/workflows/src/durable/local-command.ts +2 -1
- package/dist/builtin/workflows/src/durable/resume-runtime.ts +1 -0
- package/dist/builtin/workflows/src/durable/tool-primitive.ts +4 -28
- package/dist/builtin/workflows/src/durable/types.ts +22 -1
- package/dist/builtin/workflows/src/durable/workflow-child-result.ts +3 -1
- package/dist/builtin/workflows/src/engine/primitives/workflow.ts +1 -1
- package/dist/builtin/workflows/src/engine/run-durable-finalize.ts +10 -2
- package/dist/builtin/workflows/src/engine/run-durable-topology.ts +9 -2
- package/dist/builtin/workflows/src/engine/run.ts +17 -1
- package/dist/builtin/workflows/src/extension/atomic-stage-session.ts +18 -39
- package/dist/builtin/workflows/src/extension/companions.ts +1 -1
- package/dist/builtin/workflows/src/extension/config-file-loader.ts +10 -1
- package/dist/builtin/workflows/src/extension/config-loader.ts +1 -1
- package/dist/builtin/workflows/src/extension/dispatcher.ts +4 -0
- package/dist/builtin/workflows/src/extension/index.bundle.mjs +2095 -1181
- package/dist/builtin/workflows/src/extension/lifecycle-notifications.ts +332 -39
- package/dist/builtin/workflows/src/extension/mcp.ts +13 -2
- package/dist/builtin/workflows/src/extension/render-result.ts +5 -0
- package/dist/builtin/workflows/src/extension/runtime-durable-resume.ts +6 -3
- package/dist/builtin/workflows/src/extension/runtime.ts +7 -1
- package/dist/builtin/workflows/src/extension/ui-surface.ts +7 -20
- package/dist/builtin/workflows/src/extension/wiring.ts +86 -17
- package/dist/builtin/workflows/src/extension/workflow-command-registration.ts +12 -3
- package/dist/builtin/workflows/src/extension/workflow-durable-resume-command.ts +5 -2
- package/dist/builtin/workflows/src/extension/workflow-ports.ts +14 -6
- package/dist/builtin/workflows/src/extension/workflow-prompts.ts +11 -6
- package/dist/builtin/workflows/src/extension/workflow-run-control-command.ts +17 -7
- package/dist/builtin/workflows/src/extension/workflow-status-summary.ts +11 -0
- package/dist/builtin/workflows/src/extension/workflow-tool-content.ts +18 -1
- package/dist/builtin/workflows/src/extension/workflow-tool-control.ts +12 -8
- package/dist/builtin/workflows/src/extension/workflow-tool.ts +9 -4
- package/dist/builtin/workflows/src/intercom/intercom-routing.ts +12 -6
- package/dist/builtin/workflows/src/intercom/result-intercom.ts +35 -4
- package/dist/builtin/workflows/src/runs/background/quit.ts +28 -4
- package/dist/builtin/workflows/src/runs/background/resume-acknowledgements.ts +2 -1
- package/dist/builtin/workflows/src/runs/background/status.ts +70 -8
- package/dist/builtin/workflows/src/runs/foreground/executor-abort.ts +11 -3
- package/dist/builtin/workflows/src/runs/foreground/executor-child-boundary.ts +2 -1
- package/dist/builtin/workflows/src/runs/foreground/executor-direct-helpers.ts +4 -0
- package/dist/builtin/workflows/src/runs/foreground/executor-exit-manager.ts +26 -2
- package/dist/builtin/workflows/src/runs/foreground/executor-prompt-nodes.ts +3 -1
- package/dist/builtin/workflows/src/runs/foreground/executor-run-finalizers.ts +3 -2
- package/dist/builtin/workflows/src/runs/foreground/executor-stage-control.ts +1 -1
- package/dist/builtin/workflows/src/runs/foreground/stage-runner-context.ts +1 -1
- package/dist/builtin/workflows/src/runs/foreground/stage-runner-controller.ts +688 -38
- package/dist/builtin/workflows/src/runs/foreground/stage-runner-types.ts +3 -1
- package/dist/builtin/workflows/src/runs/shared/model-fallback-failures.ts +19 -514
- package/dist/builtin/workflows/src/runs/shared/retry.ts +44 -0
- package/dist/builtin/workflows/src/runs/shared/worktree-git-runner.ts +5 -2
- package/dist/builtin/workflows/src/runs/shared/worktree-setup.ts +2 -0
- package/dist/builtin/workflows/src/shared/authoring-contract-stage.d.ts +10 -3
- package/dist/builtin/workflows/src/shared/authoring-contract-stage.ts +11 -3
- package/dist/builtin/workflows/src/shared/authoring-contract-ui.d.ts +5 -1
- package/dist/builtin/workflows/src/shared/authoring-contract-ui.ts +5 -0
- package/dist/builtin/workflows/src/shared/graph-store-snapshot.ts +34 -2
- package/dist/builtin/workflows/src/shared/persistence-restore-helpers.ts +28 -6
- package/dist/builtin/workflows/src/shared/persistence-restore.ts +3 -0
- package/dist/builtin/workflows/src/shared/persistence-session-entries.ts +4 -0
- package/dist/builtin/workflows/src/shared/run-indicator-status.ts +75 -0
- package/dist/builtin/workflows/src/shared/stage-ui-broker.ts +10 -4
- package/dist/builtin/workflows/src/shared/store-public-types.ts +47 -9
- package/dist/builtin/workflows/src/shared/store-run-methods.ts +42 -8
- package/dist/builtin/workflows/src/shared/store-stage-methods.ts +31 -8
- package/dist/builtin/workflows/src/shared/store-types.ts +35 -1
- package/dist/builtin/workflows/src/shared/timing.ts +10 -0
- package/dist/builtin/workflows/src/shared/workflow-artifact-env.ts +21 -0
- package/dist/builtin/workflows/src/shared/workflow-artifacts.ts +2 -5
- package/dist/builtin/workflows/src/tui/chat-surface-message.ts +22 -2
- package/dist/builtin/workflows/src/tui/dispatch-confirm.ts +37 -2
- package/dist/builtin/workflows/src/tui/graph-view-constants.ts +0 -15
- package/dist/builtin/workflows/src/tui/graph-view-graph-render.ts +38 -47
- package/dist/builtin/workflows/src/tui/graph-view-input.ts +48 -45
- package/dist/builtin/workflows/src/tui/graph-view-layout.ts +266 -0
- package/dist/builtin/workflows/src/tui/graph-view-render-helpers.ts +1 -86
- package/dist/builtin/workflows/src/tui/graph-view-render.ts +209 -91
- package/dist/builtin/workflows/src/tui/graph-view-state.ts +5 -7
- package/dist/builtin/workflows/src/tui/graph-view-types.ts +13 -7
- package/dist/builtin/workflows/src/tui/inline-form-editor.ts +8 -6
- package/dist/builtin/workflows/src/tui/inline-form-overlay.ts +2 -1
- package/dist/builtin/workflows/src/tui/inputs-overlay.ts +7 -4
- package/dist/builtin/workflows/src/tui/inputs-picker-input.ts +66 -0
- package/dist/builtin/workflows/src/tui/keybindings-adapter.ts +1 -0
- package/dist/builtin/workflows/src/tui/node-card.ts +1 -1
- package/dist/builtin/workflows/src/tui/overlay-adapter.ts +18 -46
- package/dist/builtin/workflows/src/tui/overlay-terminal-modes.ts +15 -26
- package/dist/builtin/workflows/src/tui/session-list.ts +1 -1
- package/dist/builtin/workflows/src/tui/session-overlays.ts +19 -12
- package/dist/builtin/workflows/src/tui/session-picker.ts +47 -4
- package/dist/builtin/workflows/src/tui/stage-chat-view-footer-status.ts +5 -14
- package/dist/builtin/workflows/src/tui/stage-chat-view-input.ts +8 -7
- package/dist/builtin/workflows/src/tui/stage-chat-view-state.ts +12 -3
- package/dist/builtin/workflows/src/tui/stage-chat-view-types.ts +1 -11
- package/dist/builtin/workflows/src/tui/stage-chat-view.ts +0 -8
- package/dist/builtin/workflows/src/tui/status-list.ts +32 -47
- package/dist/builtin/workflows/src/tui/store-widget-installer.ts +9 -5
- package/dist/builtin/workflows/src/tui/widget.ts +16 -46
- package/dist/builtin/workflows/src/tui/workflow-attach-pane-types.ts +0 -15
- package/dist/builtin/workflows/src/tui/workflow-attach-pane.ts +2 -26
- package/dist/builtin/workflows/src/tui/workflow-status.ts +3 -3
- package/dist/bun/split-loader.js +2 -0
- package/dist/bun/split-loader.js.map +1 -1
- package/dist/cli/args.d.ts.map +1 -1
- package/dist/cli/args.js +6 -2
- package/dist/cli/args.js.map +1 -1
- package/dist/cli/auth-check.d.ts +35 -0
- package/dist/cli/auth-check.d.ts.map +1 -0
- package/dist/cli/auth-check.js +100 -0
- package/dist/cli/auth-check.js.map +1 -0
- package/dist/cli/auth-command.d.ts +27 -0
- package/dist/cli/auth-command.d.ts.map +1 -0
- package/dist/cli/auth-command.js +150 -0
- package/dist/cli/auth-command.js.map +1 -0
- package/dist/cli/config-selector.js +2 -2
- package/dist/cli/config-selector.js.map +1 -1
- package/dist/cli/credential-print.d.ts +18 -23
- package/dist/cli/credential-print.d.ts.map +1 -1
- package/dist/cli/credential-print.js +42 -88
- package/dist/cli/credential-print.js.map +1 -1
- package/dist/cli/experimental/auth.d.ts +16 -0
- package/dist/cli/experimental/auth.d.ts.map +1 -0
- package/dist/cli/experimental/auth.js +13 -0
- package/dist/cli/experimental/auth.js.map +1 -0
- package/dist/cli/experimental/cli.d.ts +6 -0
- package/dist/cli/experimental/cli.d.ts.map +1 -0
- package/dist/cli/experimental/cli.js +5 -0
- package/dist/cli/experimental/cli.js.map +1 -0
- package/dist/cli/experimental/command-options.d.ts +17 -0
- package/dist/cli/experimental/command-options.d.ts.map +1 -0
- package/dist/cli/experimental/command-options.js +35 -0
- package/dist/cli/experimental/command-options.js.map +1 -0
- package/dist/cli/experimental/command.d.ts +63 -0
- package/dist/cli/experimental/command.d.ts.map +1 -0
- package/dist/cli/experimental/command.js +127 -0
- package/dist/cli/experimental/command.js.map +1 -0
- package/dist/cli/experimental/commands/client.d.ts +13 -0
- package/dist/cli/experimental/commands/client.d.ts.map +1 -0
- package/dist/cli/experimental/commands/client.js +25 -0
- package/dist/cli/experimental/commands/client.js.map +1 -0
- package/dist/cli/experimental/commands/pi.d.ts +15 -0
- package/dist/cli/experimental/commands/pi.d.ts.map +1 -0
- package/dist/cli/experimental/commands/pi.js +28 -0
- package/dist/cli/experimental/commands/pi.js.map +1 -0
- package/dist/cli/experimental/commands/server.d.ts +13 -0
- package/dist/cli/experimental/commands/server.d.ts.map +1 -0
- package/dist/cli/experimental/commands/server.js +25 -0
- package/dist/cli/experimental/commands/server.js.map +1 -0
- package/dist/cli/experimental/transport-address.d.ts +10 -0
- package/dist/cli/experimental/transport-address.d.ts.map +1 -0
- package/dist/cli/experimental/transport-address.js +38 -0
- package/dist/cli/experimental/transport-address.js.map +1 -0
- package/dist/cli/session-picker.js +2 -2
- package/dist/cli/session-picker.js.map +1 -1
- package/dist/cli/startup-ui.d.ts.map +1 -1
- package/dist/cli/startup-ui.js +4 -10
- package/dist/cli/startup-ui.js.map +1 -1
- package/dist/cli.js +2 -0
- package/dist/cli.js.map +1 -1
- package/dist/client/index.d.ts +3 -0
- package/dist/client/index.d.ts.map +1 -0
- package/dist/client/index.js +3 -0
- package/dist/client/index.js.map +1 -0
- package/dist/client/remote-session.d.ts +64 -0
- package/dist/client/remote-session.d.ts.map +1 -0
- package/dist/client/remote-session.js +351 -0
- package/dist/client/remote-session.js.map +1 -0
- package/dist/client/transcript.d.ts +12 -0
- package/dist/client/transcript.d.ts.map +1 -0
- package/dist/client/transcript.js +98 -0
- package/dist/client/transcript.js.map +1 -0
- package/dist/core/agent-session-auto-compaction.d.ts +17 -13
- package/dist/core/agent-session-auto-compaction.d.ts.map +1 -1
- package/dist/core/agent-session-auto-compaction.js +192 -67
- package/dist/core/agent-session-auto-compaction.js.map +1 -1
- package/dist/core/agent-session-bash.d.ts.map +1 -1
- package/dist/core/agent-session-bash.js +2 -0
- package/dist/core/agent-session-bash.js.map +1 -1
- package/dist/core/agent-session-compaction.d.ts +3 -6
- package/dist/core/agent-session-compaction.d.ts.map +1 -1
- package/dist/core/agent-session-compaction.js +64 -28
- package/dist/core/agent-session-compaction.js.map +1 -1
- package/dist/core/agent-session-events.d.ts +1 -11
- package/dist/core/agent-session-events.d.ts.map +1 -1
- package/dist/core/agent-session-events.js +64 -37
- package/dist/core/agent-session-events.js.map +1 -1
- package/dist/core/agent-session-extension-bindings.d.ts.map +1 -1
- package/dist/core/agent-session-extension-bindings.js +4 -2
- package/dist/core/agent-session-extension-bindings.js.map +1 -1
- package/dist/core/agent-session-methods.d.ts +19 -2
- package/dist/core/agent-session-methods.d.ts.map +1 -1
- package/dist/core/agent-session-methods.js.map +1 -1
- package/dist/core/agent-session-models.d.ts +1 -0
- package/dist/core/agent-session-models.d.ts.map +1 -1
- package/dist/core/agent-session-models.js +23 -5
- package/dist/core/agent-session-models.js.map +1 -1
- package/dist/core/agent-session-post-tool-compaction.d.ts.map +1 -1
- package/dist/core/agent-session-post-tool-compaction.js +22 -6
- package/dist/core/agent-session-post-tool-compaction.js.map +1 -1
- package/dist/core/agent-session-prompt.d.ts.map +1 -1
- package/dist/core/agent-session-prompt.js +4 -0
- package/dist/core/agent-session-prompt.js.map +1 -1
- package/dist/core/agent-session-retry.d.ts +21 -4
- package/dist/core/agent-session-retry.d.ts.map +1 -1
- package/dist/core/agent-session-retry.js +232 -106
- package/dist/core/agent-session-retry.js.map +1 -1
- package/dist/core/agent-session-runtime-auth.d.ts.map +1 -1
- package/dist/core/agent-session-runtime-auth.js +3 -0
- package/dist/core/agent-session-runtime-auth.js.map +1 -1
- package/dist/core/agent-session-state.d.ts.map +1 -1
- package/dist/core/agent-session-state.js +2 -1
- package/dist/core/agent-session-state.js.map +1 -1
- package/dist/core/agent-session-tool-hooks.d.ts.map +1 -1
- package/dist/core/agent-session-tool-hooks.js +37 -14
- package/dist/core/agent-session-tool-hooks.js.map +1 -1
- package/dist/core/agent-session-tool-registry.d.ts.map +1 -1
- package/dist/core/agent-session-tool-registry.js +5 -1
- package/dist/core/agent-session-tool-registry.js.map +1 -1
- package/dist/core/agent-session-types.d.ts +5 -1
- package/dist/core/agent-session-types.d.ts.map +1 -1
- package/dist/core/agent-session-types.js.map +1 -1
- package/dist/core/agent-session.d.ts +18 -1
- package/dist/core/agent-session.d.ts.map +1 -1
- package/dist/core/agent-session.js +37 -0
- package/dist/core/agent-session.js.map +1 -1
- package/dist/core/atomic-guide-command.d.ts.map +1 -1
- package/dist/core/atomic-guide-command.js +2 -3
- package/dist/core/atomic-guide-command.js.map +1 -1
- package/dist/core/auth-storage.d.ts +18 -1
- package/dist/core/auth-storage.d.ts.map +1 -1
- package/dist/core/auth-storage.js +83 -0
- package/dist/core/auth-storage.js.map +1 -1
- package/dist/core/bash-executor.d.ts +5 -0
- package/dist/core/bash-executor.d.ts.map +1 -1
- package/dist/core/bash-executor.js +43 -19
- package/dist/core/bash-executor.js.map +1 -1
- package/dist/core/builtin-packages.d.ts.map +1 -1
- package/dist/core/builtin-packages.js +6 -0
- package/dist/core/builtin-packages.js.map +1 -1
- package/dist/core/codex-fast-mode.d.ts.map +1 -1
- package/dist/core/codex-fast-mode.js +8 -3
- package/dist/core/codex-fast-mode.js.map +1 -1
- package/dist/core/exec.d.ts.map +1 -1
- package/dist/core/exec.js +4 -3
- package/dist/core/exec.js.map +1 -1
- package/dist/core/extensions/agent-events.d.ts +0 -1
- package/dist/core/extensions/agent-events.d.ts.map +1 -1
- package/dist/core/extensions/agent-events.js.map +1 -1
- package/dist/core/extensions/api-types.d.ts +5 -3
- package/dist/core/extensions/api-types.d.ts.map +1 -1
- package/dist/core/extensions/api-types.js.map +1 -1
- package/dist/core/extensions/context-types.d.ts +40 -0
- package/dist/core/extensions/context-types.d.ts.map +1 -1
- package/dist/core/extensions/context-types.js.map +1 -1
- package/dist/core/extensions/event-results.d.ts +5 -0
- package/dist/core/extensions/event-results.d.ts.map +1 -1
- package/dist/core/extensions/event-results.js.map +1 -1
- package/dist/core/extensions/index.d.ts +2 -1
- package/dist/core/extensions/index.d.ts.map +1 -1
- package/dist/core/extensions/index.js +1 -0
- package/dist/core/extensions/index.js.map +1 -1
- package/dist/core/extensions/loader-api.d.ts.map +1 -1
- package/dist/core/extensions/loader-api.js +14 -1
- package/dist/core/extensions/loader-api.js.map +1 -1
- package/dist/core/extensions/loader-discovery.d.ts.map +1 -1
- package/dist/core/extensions/loader-discovery.js +3 -23
- package/dist/core/extensions/loader-discovery.js.map +1 -1
- package/dist/core/extensions/loader-runtime.d.ts.map +1 -1
- package/dist/core/extensions/loader-runtime.js +20 -3
- package/dist/core/extensions/loader-runtime.js.map +1 -1
- package/dist/core/extensions/loader-virtual-modules.d.ts.map +1 -1
- package/dist/core/extensions/loader-virtual-modules.js +7 -1
- package/dist/core/extensions/loader-virtual-modules.js.map +1 -1
- package/dist/core/extensions/message-types.d.ts +6 -0
- package/dist/core/extensions/message-types.d.ts.map +1 -1
- package/dist/core/extensions/message-types.js.map +1 -1
- package/dist/core/extensions/provider-types.d.ts +9 -3
- package/dist/core/extensions/provider-types.d.ts.map +1 -1
- package/dist/core/extensions/provider-types.js.map +1 -1
- package/dist/core/extensions/runner-context.d.ts +2 -1
- package/dist/core/extensions/runner-context.d.ts.map +1 -1
- package/dist/core/extensions/runner-context.js +4 -0
- package/dist/core/extensions/runner-context.js.map +1 -1
- package/dist/core/extensions/runner-registries.d.ts +2 -1
- package/dist/core/extensions/runner-registries.d.ts.map +1 -1
- package/dist/core/extensions/runner-registries.js +3 -0
- package/dist/core/extensions/runner-registries.js.map +1 -1
- package/dist/core/extensions/runner-ui.d.ts.map +1 -1
- package/dist/core/extensions/runner-ui.js +1 -0
- package/dist/core/extensions/runner-ui.js.map +1 -1
- package/dist/core/extensions/runner.d.ts +4 -2
- package/dist/core/extensions/runner.d.ts.map +1 -1
- package/dist/core/extensions/runner.js +9 -3
- package/dist/core/extensions/runner.js.map +1 -1
- package/dist/core/extensions/runtime-types.d.ts +4 -1
- package/dist/core/extensions/runtime-types.d.ts.map +1 -1
- package/dist/core/extensions/runtime-types.js.map +1 -1
- package/dist/core/extensions/stale-context.d.ts +5 -0
- package/dist/core/extensions/stale-context.d.ts.map +1 -0
- package/dist/core/extensions/stale-context.js +11 -0
- package/dist/core/extensions/stale-context.js.map +1 -0
- package/dist/core/extensions/ui-types.d.ts +14 -11
- package/dist/core/extensions/ui-types.d.ts.map +1 -1
- package/dist/core/extensions/ui-types.js.map +1 -1
- package/dist/core/footer-data-provider.d.ts.map +1 -1
- package/dist/core/footer-data-provider.js +3 -2
- package/dist/core/footer-data-provider.js.map +1 -1
- package/dist/core/index.d.ts +1 -1
- package/dist/core/index.d.ts.map +1 -1
- package/dist/core/index.js.map +1 -1
- package/dist/core/intercom-runtime-group.d.ts +13 -0
- package/dist/core/intercom-runtime-group.d.ts.map +1 -0
- package/dist/core/intercom-runtime-group.js +23 -0
- package/dist/core/intercom-runtime-group.js.map +1 -0
- package/dist/core/keybindings.d.ts +44 -4
- package/dist/core/keybindings.d.ts.map +1 -1
- package/dist/core/model-config.d.ts +39 -5
- package/dist/core/model-config.d.ts.map +1 -1
- package/dist/core/model-config.js +6 -0
- package/dist/core/model-config.js.map +1 -1
- package/dist/core/model-fallback-failures.d.ts +30 -0
- package/dist/core/model-fallback-failures.d.ts.map +1 -0
- package/dist/core/model-fallback-failures.js +610 -0
- package/dist/core/model-fallback-failures.js.map +1 -0
- package/dist/core/model-registry.d.ts +12 -5
- package/dist/core/model-registry.d.ts.map +1 -1
- package/dist/core/model-registry.js +20 -12
- package/dist/core/model-registry.js.map +1 -1
- package/dist/core/model-resolver-cli.d.ts.map +1 -1
- package/dist/core/model-resolver-cli.js +46 -14
- package/dist/core/model-resolver-cli.js.map +1 -1
- package/dist/core/model-resolver-defaults.d.ts.map +1 -1
- package/dist/core/model-resolver-defaults.js +2 -0
- package/dist/core/model-resolver-defaults.js.map +1 -1
- package/dist/core/model-resolver-scope.d.ts +2 -0
- package/dist/core/model-resolver-scope.d.ts.map +1 -1
- package/dist/core/model-resolver-scope.js +12 -9
- package/dist/core/model-resolver-scope.js.map +1 -1
- package/dist/core/model-resolver.d.ts +1 -1
- package/dist/core/model-resolver.d.ts.map +1 -1
- package/dist/core/model-resolver.js +1 -1
- package/dist/core/model-resolver.js.map +1 -1
- package/dist/core/model-runtime-snapshot.d.ts +10 -0
- package/dist/core/model-runtime-snapshot.d.ts.map +1 -1
- package/dist/core/model-runtime-snapshot.js +14 -1
- package/dist/core/model-runtime-snapshot.js.map +1 -1
- package/dist/core/model-runtime-streaming.d.ts +3 -1
- package/dist/core/model-runtime-streaming.d.ts.map +1 -1
- package/dist/core/model-runtime-streaming.js +16 -0
- package/dist/core/model-runtime-streaming.js.map +1 -1
- package/dist/core/model-runtime-types.d.ts +2 -0
- package/dist/core/model-runtime-types.d.ts.map +1 -1
- package/dist/core/model-runtime-types.js.map +1 -1
- package/dist/core/model-runtime.d.ts +37 -10
- package/dist/core/model-runtime.d.ts.map +1 -1
- package/dist/core/model-runtime.js +312 -113
- package/dist/core/model-runtime.js.map +1 -1
- package/dist/core/oauth-login.d.ts.map +1 -1
- package/dist/core/oauth-login.js +2 -1
- package/dist/core/oauth-login.js.map +1 -1
- package/dist/core/openai-responses-payload-sanitizer.d.ts.map +1 -1
- package/dist/core/openai-responses-payload-sanitizer.js +18 -2
- package/dist/core/openai-responses-payload-sanitizer.js.map +1 -1
- package/dist/core/package-manager-git.d.ts.map +1 -1
- package/dist/core/package-manager-git.js +56 -10
- package/dist/core/package-manager-git.js.map +1 -1
- package/dist/core/package-manager-manifest.d.ts +1 -1
- package/dist/core/package-manager-manifest.d.ts.map +1 -1
- package/dist/core/package-manager-manifest.js +19 -9
- package/dist/core/package-manager-manifest.js.map +1 -1
- package/dist/core/package-manager-resource-collector.js.map +1 -1
- package/dist/core/package-manager-resource-files.d.ts.map +1 -1
- package/dist/core/package-manager-resource-files.js +1 -2
- package/dist/core/package-manager-resource-files.js.map +1 -1
- package/dist/core/provider-composer-internal.d.ts +10 -2
- package/dist/core/provider-composer-internal.d.ts.map +1 -1
- package/dist/core/provider-composer-internal.js +7 -3
- package/dist/core/provider-composer-internal.js.map +1 -1
- package/dist/core/provider-composer.d.ts.map +1 -1
- package/dist/core/provider-composer.js +19 -12
- package/dist/core/provider-composer.js.map +1 -1
- package/dist/core/provider-display-names.d.ts.map +1 -1
- package/dist/core/provider-display-names.js +2 -0
- package/dist/core/provider-display-names.js.map +1 -1
- package/dist/core/remote-catalog-provider.d.ts.map +1 -1
- package/dist/core/remote-catalog-provider.js +77 -67
- package/dist/core/remote-catalog-provider.js.map +1 -1
- package/dist/core/resolve-config-value.d.ts.map +1 -1
- package/dist/core/resolve-config-value.js +3 -0
- package/dist/core/resolve-config-value.js.map +1 -1
- package/dist/core/resource-loader-context-files.d.ts.map +1 -1
- package/dist/core/resource-loader-context-files.js +13 -5
- package/dist/core/resource-loader-context-files.js.map +1 -1
- package/dist/core/retry-policy.d.ts +30 -0
- package/dist/core/retry-policy.d.ts.map +1 -0
- package/dist/core/retry-policy.js +25 -0
- package/dist/core/retry-policy.js.map +1 -0
- package/dist/core/runtime-credentials.d.ts +5 -5
- package/dist/core/runtime-credentials.d.ts.map +1 -1
- package/dist/core/runtime-credentials.js +8 -8
- package/dist/core/runtime-credentials.js.map +1 -1
- package/dist/core/sdk-types.d.ts +8 -2
- package/dist/core/sdk-types.d.ts.map +1 -1
- package/dist/core/sdk-types.js.map +1 -1
- package/dist/core/sdk.d.ts.map +1 -1
- package/dist/core/sdk.js +6 -1
- package/dist/core/sdk.js.map +1 -1
- package/dist/core/session-manager-core.d.ts +2 -0
- package/dist/core/session-manager-core.d.ts.map +1 -1
- package/dist/core/session-manager-core.js +7 -0
- package/dist/core/session-manager-core.js.map +1 -1
- package/dist/core/session-manager-list.d.ts.map +1 -1
- package/dist/core/session-manager-list.js +3 -1
- package/dist/core/session-manager-list.js.map +1 -1
- package/dist/core/settings-manager-ui-accessors.d.ts +8 -1
- package/dist/core/settings-manager-ui-accessors.d.ts.map +1 -1
- package/dist/core/settings-manager-ui-accessors.js +31 -0
- package/dist/core/settings-manager-ui-accessors.js.map +1 -1
- package/dist/core/settings-manager.d.ts +2 -1
- package/dist/core/settings-manager.d.ts.map +1 -1
- package/dist/core/settings-manager.js.map +1 -1
- package/dist/core/settings-merge.d.ts.map +1 -1
- package/dist/core/settings-merge.js +13 -16
- package/dist/core/settings-merge.js.map +1 -1
- package/dist/core/settings-types.d.ts +5 -0
- package/dist/core/settings-types.d.ts.map +1 -1
- package/dist/core/settings-types.js.map +1 -1
- package/dist/core/slash-commands.d.ts.map +1 -1
- package/dist/core/slash-commands.js +0 -2
- package/dist/core/slash-commands.js.map +1 -1
- package/dist/core/tools/ask-user-question/state/questionnaire-session.d.ts +2 -2
- package/dist/core/tools/ask-user-question/state/questionnaire-session.d.ts.map +1 -1
- package/dist/core/tools/ask-user-question/state/questionnaire-session.js +39 -2
- package/dist/core/tools/ask-user-question/state/questionnaire-session.js.map +1 -1
- package/dist/core/tools/bash-async-execution.d.ts +2 -0
- package/dist/core/tools/bash-async-execution.d.ts.map +1 -1
- package/dist/core/tools/bash-async-execution.js +4 -1
- package/dist/core/tools/bash-async-execution.js.map +1 -1
- package/dist/core/tools/bash-async-output.d.ts +1 -0
- package/dist/core/tools/bash-async-output.d.ts.map +1 -1
- package/dist/core/tools/bash-async-output.js +62 -27
- package/dist/core/tools/bash-async-output.js.map +1 -1
- package/dist/core/tools/bash-pty-native.d.ts.map +1 -1
- package/dist/core/tools/bash-pty-native.js +2 -1
- package/dist/core/tools/bash-pty-native.js.map +1 -1
- package/dist/core/tools/bash.d.ts +9 -0
- package/dist/core/tools/bash.d.ts.map +1 -1
- package/dist/core/tools/bash.js +34 -16
- package/dist/core/tools/bash.js.map +1 -1
- package/dist/core/tools/directory-tree.d.ts +11 -0
- package/dist/core/tools/directory-tree.d.ts.map +1 -1
- package/dist/core/tools/directory-tree.js +26 -0
- package/dist/core/tools/directory-tree.js.map +1 -1
- package/dist/core/tools/edit.d.ts +4 -0
- package/dist/core/tools/edit.d.ts.map +1 -1
- package/dist/core/tools/edit.js +12 -8
- package/dist/core/tools/edit.js.map +1 -1
- package/dist/core/tools/errno.d.ts +25 -0
- package/dist/core/tools/errno.d.ts.map +1 -0
- package/dist/core/tools/errno.js +29 -0
- package/dist/core/tools/errno.js.map +1 -0
- package/dist/core/tools/find.d.ts +8 -1
- package/dist/core/tools/find.d.ts.map +1 -1
- package/dist/core/tools/find.js +20 -15
- package/dist/core/tools/find.js.map +1 -1
- package/dist/core/tools/grep.d.ts.map +1 -1
- package/dist/core/tools/grep.js +5 -1
- package/dist/core/tools/grep.js.map +1 -1
- package/dist/core/tools/index.d.ts +7 -7
- package/dist/core/tools/index.d.ts.map +1 -1
- package/dist/core/tools/index.js +7 -7
- package/dist/core/tools/index.js.map +1 -1
- package/dist/core/tools/ls.d.ts +4 -0
- package/dist/core/tools/ls.d.ts.map +1 -1
- package/dist/core/tools/ls.js +5 -1
- package/dist/core/tools/ls.js.map +1 -1
- package/dist/core/tools/output-accumulator.d.ts +8 -1
- package/dist/core/tools/output-accumulator.d.ts.map +1 -1
- package/dist/core/tools/output-accumulator.js +50 -28
- package/dist/core/tools/output-accumulator.js.map +1 -1
- package/dist/core/tools/oversized-tool-result.d.ts.map +1 -1
- package/dist/core/tools/oversized-tool-result.js +129 -22
- package/dist/core/tools/oversized-tool-result.js.map +1 -1
- package/dist/core/tools/persisted-output-file.d.ts +80 -0
- package/dist/core/tools/persisted-output-file.d.ts.map +1 -0
- package/dist/core/tools/persisted-output-file.js +284 -0
- package/dist/core/tools/persisted-output-file.js.map +1 -0
- package/dist/core/tools/read.d.ts +10 -0
- package/dist/core/tools/read.d.ts.map +1 -1
- package/dist/core/tools/read.js +20 -8
- package/dist/core/tools/read.js.map +1 -1
- package/dist/core/tools/search.d.ts +4 -0
- package/dist/core/tools/search.d.ts.map +1 -1
- package/dist/core/tools/search.js +5 -1
- package/dist/core/tools/search.js.map +1 -1
- package/dist/core/tools/session-temp-cleanup.d.ts +133 -0
- package/dist/core/tools/session-temp-cleanup.d.ts.map +1 -0
- package/dist/core/tools/session-temp-cleanup.js +669 -0
- package/dist/core/tools/session-temp-cleanup.js.map +1 -0
- package/dist/core/tools/session-temp-dir.d.ts +116 -0
- package/dist/core/tools/session-temp-dir.d.ts.map +1 -0
- package/dist/core/tools/session-temp-dir.js +409 -0
- package/dist/core/tools/session-temp-dir.js.map +1 -0
- package/dist/core/tools/tool-definition-wrapper.d.ts.map +1 -1
- package/dist/core/tools/tool-definition-wrapper.js +2 -0
- package/dist/core/tools/tool-definition-wrapper.js.map +1 -1
- package/dist/core/tools/tool-limits.d.ts +11 -0
- package/dist/core/tools/tool-limits.d.ts.map +1 -1
- package/dist/core/tools/tool-limits.js +11 -0
- package/dist/core/tools/tool-limits.js.map +1 -1
- package/dist/core/tools/windows-directory-security.d.ts +82 -0
- package/dist/core/tools/windows-directory-security.d.ts.map +1 -0
- package/dist/core/tools/windows-directory-security.js +238 -0
- package/dist/core/tools/windows-directory-security.js.map +1 -0
- package/dist/core/tools/write.d.ts +4 -0
- package/dist/core/tools/write.d.ts.map +1 -1
- package/dist/core/tools/write.js +8 -4
- package/dist/core/tools/write.js.map +1 -1
- package/dist/core/trust-manager.js +1 -1
- package/dist/core/trust-manager.js.map +1 -1
- package/dist/extensions/llama/huggingface-ui.d.ts +1 -1
- package/dist/extensions/llama/huggingface-ui.d.ts.map +1 -1
- package/dist/extensions/llama/huggingface-ui.js +6 -5
- package/dist/extensions/llama/huggingface-ui.js.map +1 -1
- package/dist/extensions/llama/index.d.ts.map +1 -1
- package/dist/extensions/llama/index.js +11 -2
- package/dist/extensions/llama/index.js.map +1 -1
- package/dist/extensions/llama/provider.d.ts.map +1 -1
- package/dist/extensions/llama/provider.js +24 -8
- package/dist/extensions/llama/provider.js.map +1 -1
- package/dist/extensions/llama/ui.d.ts.map +1 -1
- package/dist/extensions/llama/ui.js +5 -2
- package/dist/extensions/llama/ui.js.map +1 -1
- package/dist/index-extensions.d.ts +2 -2
- package/dist/index-extensions.d.ts.map +1 -1
- package/dist/index-extensions.js +1 -1
- package/dist/index-extensions.js.map +1 -1
- package/dist/index.d.ts +8 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +8 -2
- package/dist/index.js.map +1 -1
- package/dist/main-runtime-api-key.d.ts +2 -2
- package/dist/main-runtime-api-key.d.ts.map +1 -1
- package/dist/main-runtime-api-key.js +7 -2
- package/dist/main-runtime-api-key.js.map +1 -1
- package/dist/main-session.js +2 -2
- package/dist/main-session.js.map +1 -1
- package/dist/main.d.ts.map +1 -1
- package/dist/main.js +130 -26
- package/dist/main.js.map +1 -1
- package/dist/modes/index.d.ts +1 -0
- package/dist/modes/index.d.ts.map +1 -1
- package/dist/modes/index.js.map +1 -1
- package/dist/modes/interactive/components/assistant-message.d.ts +6 -2
- package/dist/modes/interactive/components/assistant-message.d.ts.map +1 -1
- package/dist/modes/interactive/components/assistant-message.js +18 -5
- package/dist/modes/interactive/components/assistant-message.js.map +1 -1
- package/dist/modes/interactive/components/bordered-loader.d.ts +1 -1
- package/dist/modes/interactive/components/bordered-loader.d.ts.map +1 -1
- package/dist/modes/interactive/components/bordered-loader.js +5 -4
- package/dist/modes/interactive/components/bordered-loader.js.map +1 -1
- package/dist/modes/interactive/components/branch-summary-message.d.ts +2 -1
- package/dist/modes/interactive/components/branch-summary-message.d.ts.map +1 -1
- package/dist/modes/interactive/components/branch-summary-message.js +3 -2
- package/dist/modes/interactive/components/branch-summary-message.js.map +1 -1
- package/dist/modes/interactive/components/chat-message-renderer.d.ts +17 -7
- package/dist/modes/interactive/components/chat-message-renderer.d.ts.map +1 -1
- package/dist/modes/interactive/components/chat-message-renderer.js +35 -69
- package/dist/modes/interactive/components/chat-message-renderer.js.map +1 -1
- package/dist/modes/interactive/components/chat-session-host-actions.d.ts.map +1 -1
- package/dist/modes/interactive/components/chat-session-host-actions.js +11 -3
- package/dist/modes/interactive/components/chat-session-host-actions.js.map +1 -1
- package/dist/modes/interactive/components/chat-session-host-events.d.ts.map +1 -1
- package/dist/modes/interactive/components/chat-session-host-events.js +25 -15
- package/dist/modes/interactive/components/chat-session-host-events.js.map +1 -1
- package/dist/modes/interactive/components/chat-session-host-rendering.d.ts.map +1 -1
- package/dist/modes/interactive/components/chat-session-host-rendering.js +9 -4
- package/dist/modes/interactive/components/chat-session-host-rendering.js.map +1 -1
- package/dist/modes/interactive/components/chat-session-host-state.d.ts +2 -0
- package/dist/modes/interactive/components/chat-session-host-state.d.ts.map +1 -1
- package/dist/modes/interactive/components/chat-session-host-state.js +2 -0
- package/dist/modes/interactive/components/chat-session-host-state.js.map +1 -1
- package/dist/modes/interactive/components/chat-session-host.d.ts +9 -0
- package/dist/modes/interactive/components/chat-session-host.d.ts.map +1 -1
- package/dist/modes/interactive/components/chat-session-host.js +14 -0
- package/dist/modes/interactive/components/chat-session-host.js.map +1 -1
- package/dist/modes/interactive/components/chat-transcript.d.ts +32 -0
- package/dist/modes/interactive/components/chat-transcript.d.ts.map +1 -1
- package/dist/modes/interactive/components/chat-transcript.js +173 -5
- package/dist/modes/interactive/components/chat-transcript.js.map +1 -1
- package/dist/modes/interactive/components/config-selector-list.d.ts +1 -1
- package/dist/modes/interactive/components/config-selector-list.d.ts.map +1 -1
- package/dist/modes/interactive/components/config-selector-list.js +9 -8
- package/dist/modes/interactive/components/config-selector-list.js.map +1 -1
- package/dist/modes/interactive/components/custom-editor.d.ts +1 -1
- package/dist/modes/interactive/components/custom-editor.d.ts.map +1 -1
- package/dist/modes/interactive/components/custom-editor.js +32 -10
- package/dist/modes/interactive/components/custom-editor.js.map +1 -1
- package/dist/modes/interactive/components/custom-message.d.ts +2 -1
- package/dist/modes/interactive/components/custom-message.d.ts.map +1 -1
- package/dist/modes/interactive/components/custom-message.js +3 -2
- package/dist/modes/interactive/components/custom-message.js.map +1 -1
- package/dist/modes/interactive/components/extension-editor.d.ts +1 -1
- package/dist/modes/interactive/components/extension-editor.d.ts.map +1 -1
- package/dist/modes/interactive/components/extension-editor.js +3 -2
- package/dist/modes/interactive/components/extension-editor.js.map +1 -1
- package/dist/modes/interactive/components/extension-input.d.ts +1 -1
- package/dist/modes/interactive/components/extension-input.d.ts.map +1 -1
- package/dist/modes/interactive/components/extension-input.js +1 -0
- package/dist/modes/interactive/components/extension-input.js.map +1 -1
- package/dist/modes/interactive/components/extension-selector.d.ts +1 -1
- package/dist/modes/interactive/components/extension-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/extension-selector.js +4 -0
- package/dist/modes/interactive/components/extension-selector.js.map +1 -1
- package/dist/modes/interactive/components/fast-mode-selector.d.ts +1 -1
- package/dist/modes/interactive/components/fast-mode-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/fast-mode-selector.js +7 -5
- package/dist/modes/interactive/components/fast-mode-selector.js.map +1 -1
- package/dist/modes/interactive/components/first-time-setup.d.ts +1 -1
- package/dist/modes/interactive/components/first-time-setup.d.ts.map +1 -1
- package/dist/modes/interactive/components/first-time-setup.js +3 -0
- package/dist/modes/interactive/components/first-time-setup.js.map +1 -1
- package/dist/modes/interactive/components/footer.js +1 -1
- package/dist/modes/interactive/components/footer.js.map +1 -1
- package/dist/modes/interactive/components/host-input-form.d.ts +1 -1
- package/dist/modes/interactive/components/host-input-form.d.ts.map +1 -1
- package/dist/modes/interactive/components/host-input-form.js +6 -5
- package/dist/modes/interactive/components/host-input-form.js.map +1 -1
- package/dist/modes/interactive/components/index.d.ts +1 -1
- package/dist/modes/interactive/components/index.d.ts.map +1 -1
- package/dist/modes/interactive/components/index.js.map +1 -1
- package/dist/modes/interactive/components/login-dialog.d.ts +1 -1
- package/dist/modes/interactive/components/login-dialog.d.ts.map +1 -1
- package/dist/modes/interactive/components/login-dialog.js +2 -1
- package/dist/modes/interactive/components/login-dialog.js.map +1 -1
- package/dist/modes/interactive/components/markdown-transform.d.ts +3 -0
- package/dist/modes/interactive/components/markdown-transform.d.ts.map +1 -0
- package/dist/modes/interactive/components/markdown-transform.js +19 -0
- package/dist/modes/interactive/components/markdown-transform.js.map +1 -0
- package/dist/modes/interactive/components/mermaid.d.ts +11 -0
- package/dist/modes/interactive/components/mermaid.d.ts.map +1 -0
- package/dist/modes/interactive/components/mermaid.js +81 -0
- package/dist/modes/interactive/components/mermaid.js.map +1 -0
- package/dist/modes/interactive/components/model-selector.d.ts +2 -2
- package/dist/modes/interactive/components/model-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/model-selector.js +9 -6
- package/dist/modes/interactive/components/model-selector.js.map +1 -1
- package/dist/modes/interactive/components/oauth-selector.d.ts +1 -1
- package/dist/modes/interactive/components/oauth-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/oauth-selector.js +3 -2
- package/dist/modes/interactive/components/oauth-selector.js.map +1 -1
- package/dist/modes/interactive/components/scoped-models-selector.d.ts +6 -2
- package/dist/modes/interactive/components/scoped-models-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/scoped-models-selector.js +39 -13
- package/dist/modes/interactive/components/scoped-models-selector.js.map +1 -1
- package/dist/modes/interactive/components/session-selector-delete.d.ts.map +1 -1
- package/dist/modes/interactive/components/session-selector-delete.js +2 -1
- package/dist/modes/interactive/components/session-selector-delete.js.map +1 -1
- package/dist/modes/interactive/components/session-selector-list.d.ts +1 -1
- package/dist/modes/interactive/components/session-selector-list.d.ts.map +1 -1
- package/dist/modes/interactive/components/session-selector-list.js +12 -11
- package/dist/modes/interactive/components/session-selector-list.js.map +1 -1
- package/dist/modes/interactive/components/session-selector.d.ts +1 -1
- package/dist/modes/interactive/components/session-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/session-selector.js +3 -3
- package/dist/modes/interactive/components/session-selector.js.map +1 -1
- package/dist/modes/interactive/components/settings-selector-handlers.d.ts.map +1 -1
- package/dist/modes/interactive/components/settings-selector-handlers.js +9 -0
- package/dist/modes/interactive/components/settings-selector-handlers.js.map +1 -1
- package/dist/modes/interactive/components/settings-selector-items.d.ts.map +1 -1
- package/dist/modes/interactive/components/settings-selector-items.js +21 -0
- package/dist/modes/interactive/components/settings-selector-items.js.map +1 -1
- package/dist/modes/interactive/components/settings-selector-submenus.d.ts +3 -3
- package/dist/modes/interactive/components/settings-selector-submenus.d.ts.map +1 -1
- package/dist/modes/interactive/components/settings-selector-submenus.js +6 -1
- package/dist/modes/interactive/components/settings-selector-submenus.js.map +1 -1
- package/dist/modes/interactive/components/settings-selector-types.d.ts +8 -1
- package/dist/modes/interactive/components/settings-selector-types.d.ts.map +1 -1
- package/dist/modes/interactive/components/settings-selector-types.js.map +1 -1
- package/dist/modes/interactive/components/skill-invocation-message.d.ts +2 -1
- package/dist/modes/interactive/components/skill-invocation-message.d.ts.map +1 -1
- package/dist/modes/interactive/components/skill-invocation-message.js +3 -2
- package/dist/modes/interactive/components/skill-invocation-message.js.map +1 -1
- package/dist/modes/interactive/components/tool-execution.d.ts +2 -0
- package/dist/modes/interactive/components/tool-execution.d.ts.map +1 -1
- package/dist/modes/interactive/components/tool-execution.js +50 -27
- package/dist/modes/interactive/components/tool-execution.js.map +1 -1
- package/dist/modes/interactive/components/tree-selector-component.d.ts +1 -1
- package/dist/modes/interactive/components/tree-selector-component.d.ts.map +1 -1
- package/dist/modes/interactive/components/tree-selector-component.js +2 -3
- package/dist/modes/interactive/components/tree-selector-component.js.map +1 -1
- package/dist/modes/interactive/components/tree-selector-help.d.ts +1 -1
- package/dist/modes/interactive/components/tree-selector-help.d.ts.map +1 -1
- package/dist/modes/interactive/components/tree-selector-help.js +3 -1
- package/dist/modes/interactive/components/tree-selector-help.js.map +1 -1
- package/dist/modes/interactive/components/tree-selector-label-input.d.ts +1 -1
- package/dist/modes/interactive/components/tree-selector-label-input.d.ts.map +1 -1
- package/dist/modes/interactive/components/tree-selector-label-input.js +1 -0
- package/dist/modes/interactive/components/tree-selector-label-input.js.map +1 -1
- package/dist/modes/interactive/components/tree-selector-list.d.ts +1 -1
- package/dist/modes/interactive/components/tree-selector-list.d.ts.map +1 -1
- package/dist/modes/interactive/components/tree-selector-list.js +3 -0
- package/dist/modes/interactive/components/tree-selector-list.js.map +1 -1
- package/dist/modes/interactive/components/trust-selector.d.ts +1 -1
- package/dist/modes/interactive/components/trust-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/trust-selector.js +4 -0
- package/dist/modes/interactive/components/trust-selector.js.map +1 -1
- package/dist/modes/interactive/components/user-message-selector.d.ts +1 -1
- package/dist/modes/interactive/components/user-message-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/user-message-selector.js +4 -0
- package/dist/modes/interactive/components/user-message-selector.js.map +1 -1
- package/dist/modes/interactive/components/user-message.d.ts +4 -1
- package/dist/modes/interactive/components/user-message.d.ts.map +1 -1
- package/dist/modes/interactive/components/user-message.js +10 -2
- package/dist/modes/interactive/components/user-message.js.map +1 -1
- package/dist/modes/interactive/external-editor.d.ts.map +1 -1
- package/dist/modes/interactive/external-editor.js +2 -1
- package/dist/modes/interactive/external-editor.js.map +1 -1
- package/dist/modes/interactive/interactive-agent-events.js +36 -18
- package/dist/modes/interactive/interactive-agent-events.js.map +1 -1
- package/dist/modes/interactive/interactive-auth-login.js +9 -2
- package/dist/modes/interactive/interactive-auth-login.js.map +1 -1
- package/dist/modes/interactive/interactive-auth-routing.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-auth-routing.js +5 -1
- package/dist/modes/interactive/interactive-auth-routing.js.map +1 -1
- package/dist/modes/interactive/interactive-bash-compact.js +16 -4
- package/dist/modes/interactive/interactive-bash-compact.js.map +1 -1
- package/dist/modes/interactive/interactive-deferred-startup.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-deferred-startup.js +3 -0
- package/dist/modes/interactive/interactive-deferred-startup.js.map +1 -1
- package/dist/modes/interactive/interactive-editor-actions.js +2 -0
- package/dist/modes/interactive/interactive-editor-actions.js.map +1 -1
- package/dist/modes/interactive/interactive-extension-context.js +12 -7
- package/dist/modes/interactive/interactive-extension-context.js.map +1 -1
- package/dist/modes/interactive/interactive-extension-custom-ui.js +1 -0
- package/dist/modes/interactive/interactive-extension-custom-ui.js.map +1 -1
- package/dist/modes/interactive/interactive-extension-dialogs.js +7 -0
- package/dist/modes/interactive/interactive-extension-dialogs.js.map +1 -1
- package/dist/modes/interactive/interactive-extension-widgets.js +7 -24
- package/dist/modes/interactive/interactive-extension-widgets.js.map +1 -1
- package/dist/modes/interactive/interactive-input-handling.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-input-handling.js +9 -8
- package/dist/modes/interactive/interactive-input-handling.js.map +1 -1
- package/dist/modes/interactive/interactive-mode-base.d.ts +52 -3
- package/dist/modes/interactive/interactive-mode-base.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-mode-base.js +143 -5
- package/dist/modes/interactive/interactive-mode-base.js.map +1 -1
- package/dist/modes/interactive/interactive-mode-deps.d.ts +2 -2
- package/dist/modes/interactive/interactive-mode-deps.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-mode-deps.js +2 -2
- package/dist/modes/interactive/interactive-mode-deps.js.map +1 -1
- package/dist/modes/interactive/interactive-mode-surface.d.ts +9 -3
- package/dist/modes/interactive/interactive-mode-surface.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-mode-surface.js.map +1 -1
- package/dist/modes/interactive/interactive-mode.d.ts +1 -0
- package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-mode.js +1 -0
- package/dist/modes/interactive/interactive-mode.js.map +1 -1
- package/dist/modes/interactive/interactive-model-routing.js +107 -41
- package/dist/modes/interactive/interactive-model-routing.js.map +1 -1
- package/dist/modes/interactive/interactive-process-lifecycle.js +1 -1
- package/dist/modes/interactive/interactive-process-lifecycle.js.map +1 -1
- package/dist/modes/interactive/interactive-render-chat.js +24 -6
- package/dist/modes/interactive/interactive-render-chat.js.map +1 -1
- package/dist/modes/interactive/interactive-selectors.js +44 -5
- package/dist/modes/interactive/interactive-selectors.js.map +1 -1
- package/dist/modes/interactive/interactive-session-runtime.js +1 -0
- package/dist/modes/interactive/interactive-session-runtime.js.map +1 -1
- package/dist/modes/interactive/interactive-slash-commands.js +9 -4
- package/dist/modes/interactive/interactive-slash-commands.js.map +1 -1
- package/dist/modes/interactive/interactive-startup.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-startup.js +37 -18
- package/dist/modes/interactive/interactive-startup.js.map +1 -1
- package/dist/modes/interactive/interactive-tui.d.ts +21 -0
- package/dist/modes/interactive/interactive-tui.d.ts.map +1 -0
- package/dist/modes/interactive/interactive-tui.js +279 -0
- package/dist/modes/interactive/interactive-tui.js.map +1 -0
- package/dist/modes/interactive/streaming-assistant-message.d.ts +34 -0
- package/dist/modes/interactive/streaming-assistant-message.d.ts.map +1 -0
- package/dist/modes/interactive/streaming-assistant-message.js +76 -0
- package/dist/modes/interactive/streaming-assistant-message.js.map +1 -0
- package/dist/modes/interactive/theme/catppuccin-frappe.json +1 -0
- package/dist/modes/interactive/theme/catppuccin-latte.json +1 -0
- package/dist/modes/interactive/theme/catppuccin-macchiato.json +1 -0
- package/dist/modes/interactive/theme/catppuccin-mocha.json +1 -0
- package/dist/modes/interactive/theme/dark.json +1 -0
- package/dist/modes/interactive/theme/light.json +1 -0
- package/dist/modes/interactive/theme/terminal-detection.d.ts +10 -0
- package/dist/modes/interactive/theme/terminal-detection.d.ts.map +1 -1
- package/dist/modes/interactive/theme/terminal-detection.js +19 -0
- package/dist/modes/interactive/theme/terminal-detection.js.map +1 -1
- package/dist/modes/interactive/theme/theme-class.d.ts +2 -2
- package/dist/modes/interactive/theme/theme-class.d.ts.map +1 -1
- package/dist/modes/interactive/theme/theme-class.js +5 -1
- package/dist/modes/interactive/theme/theme-class.js.map +1 -1
- package/dist/modes/interactive/theme/theme-controller.d.ts +3 -1
- package/dist/modes/interactive/theme/theme-controller.d.ts.map +1 -1
- package/dist/modes/interactive/theme/theme-controller.js +10 -13
- package/dist/modes/interactive/theme/theme-controller.js.map +1 -1
- package/dist/modes/interactive/theme/theme-loading.d.ts.map +1 -1
- package/dist/modes/interactive/theme/theme-loading.js +1 -0
- package/dist/modes/interactive/theme/theme-loading.js.map +1 -1
- package/dist/modes/interactive/theme/theme-schema.d.ts +4 -0
- package/dist/modes/interactive/theme/theme-schema.d.ts.map +1 -1
- package/dist/modes/interactive/theme/theme-schema.js +2 -1
- package/dist/modes/interactive/theme/theme-schema.js.map +1 -1
- package/dist/modes/interactive/theme/theme-schema.json +5 -1
- package/dist/modes/interactive/theme/theme.d.ts +1 -1
- package/dist/modes/interactive/theme/theme.d.ts.map +1 -1
- package/dist/modes/interactive/theme/theme.js +1 -1
- package/dist/modes/interactive/theme/theme.js.map +1 -1
- package/dist/modes/interactive-engine/engine-custom-ui.d.ts +1 -1
- package/dist/modes/interactive-engine/engine-custom-ui.d.ts.map +1 -1
- package/dist/modes/interactive-engine/engine-custom-ui.js +28 -11
- package/dist/modes/interactive-engine/engine-custom-ui.js.map +1 -1
- package/dist/modes/interactive-engine/engine-render-service.js +3 -3
- package/dist/modes/interactive-engine/engine-render-service.js.map +1 -1
- package/dist/modes/interactive-engine/extension-ui-bridge.d.ts +2 -1
- package/dist/modes/interactive-engine/extension-ui-bridge.d.ts.map +1 -1
- package/dist/modes/interactive-engine/extension-ui-bridge.js +2 -2
- package/dist/modes/interactive-engine/extension-ui-bridge.js.map +1 -1
- package/dist/modes/interactive-engine/isolated-runtime.d.ts +7 -0
- package/dist/modes/interactive-engine/isolated-runtime.d.ts.map +1 -1
- package/dist/modes/interactive-engine/isolated-runtime.js +7 -0
- package/dist/modes/interactive-engine/isolated-runtime.js.map +1 -1
- package/dist/modes/interactive-engine/protocol.d.ts +12 -10
- package/dist/modes/interactive-engine/protocol.d.ts.map +1 -1
- package/dist/modes/interactive-engine/protocol.js +14 -11
- package/dist/modes/interactive-engine/protocol.js.map +1 -1
- package/dist/modes/interactive-engine/remote-component.d.ts +11 -1
- package/dist/modes/interactive-engine/remote-component.d.ts.map +1 -1
- package/dist/modes/interactive-engine/remote-component.js +48 -8
- package/dist/modes/interactive-engine/remote-component.js.map +1 -1
- package/dist/modes/interactive-engine/terminal-mode-controller.d.ts +19 -12
- package/dist/modes/interactive-engine/terminal-mode-controller.d.ts.map +1 -1
- package/dist/modes/interactive-engine/terminal-mode-controller.js +54 -35
- package/dist/modes/interactive-engine/terminal-mode-controller.js.map +1 -1
- package/dist/modes/json-event.d.ts +28 -0
- package/dist/modes/json-event.d.ts.map +1 -0
- package/dist/modes/json-event.js +12 -0
- package/dist/modes/json-event.js.map +1 -0
- package/dist/modes/print-mode.d.ts.map +1 -1
- package/dist/modes/print-mode.js +2 -1
- package/dist/modes/print-mode.js.map +1 -1
- package/dist/modes/rpc/rpc-client-process.d.ts +1 -0
- package/dist/modes/rpc/rpc-client-process.d.ts.map +1 -1
- package/dist/modes/rpc/rpc-client-process.js +5 -1
- package/dist/modes/rpc/rpc-client-process.js.map +1 -1
- package/dist/modes/rpc/rpc-client.d.ts.map +1 -1
- package/dist/modes/rpc/rpc-client.js +7 -2
- package/dist/modes/rpc/rpc-client.js.map +1 -1
- package/dist/modes/rpc/rpc-command-handler.js +1 -1
- package/dist/modes/rpc/rpc-command-handler.js.map +1 -1
- package/dist/modes/rpc/rpc-event-buffer.d.ts +9 -0
- package/dist/modes/rpc/rpc-event-buffer.d.ts.map +1 -1
- package/dist/modes/rpc/rpc-event-buffer.js +10 -5
- package/dist/modes/rpc/rpc-event-buffer.js.map +1 -1
- package/dist/modes/rpc/rpc-extension-ui.d.ts.map +1 -1
- package/dist/modes/rpc/rpc-extension-ui.js +3 -0
- package/dist/modes/rpc/rpc-extension-ui.js.map +1 -1
- package/dist/modes/rpc/rpc-input.js +1 -1
- package/dist/modes/rpc/rpc-input.js.map +1 -1
- package/dist/modes/rpc/rpc-output-buffer.d.ts +9 -0
- package/dist/modes/rpc/rpc-output-buffer.d.ts.map +1 -1
- package/dist/modes/rpc/rpc-output-buffer.js +10 -5
- package/dist/modes/rpc/rpc-output-buffer.js.map +1 -1
- package/dist/modes/rpc/rpc-provider-auth.d.ts.map +1 -1
- package/dist/modes/rpc/rpc-provider-auth.js +3 -0
- package/dist/modes/rpc/rpc-provider-auth.js.map +1 -1
- package/dist/modes/rpc/rpc-responses.d.ts +1 -1
- package/dist/modes/rpc/rpc-responses.d.ts.map +1 -1
- package/dist/modes/rpc/rpc-responses.js +13 -1
- package/dist/modes/rpc/rpc-responses.js.map +1 -1
- package/dist/modes/rpc/rpc-session-binding.d.ts.map +1 -1
- package/dist/modes/rpc/rpc-session-binding.js +2 -1
- package/dist/modes/rpc/rpc-session-binding.js.map +1 -1
- package/dist/modes/rpc/rpc-types.d.ts +9 -2
- package/dist/modes/rpc/rpc-types.d.ts.map +1 -1
- package/dist/modes/rpc/rpc-types.js.map +1 -1
- package/dist/rpc-entry.js +2 -0
- package/dist/rpc-entry.js.map +1 -1
- package/dist/self-update-plan.d.ts.map +1 -1
- package/dist/self-update-plan.js +5 -4
- package/dist/self-update-plan.js.map +1 -1
- package/dist/server/create-harness.d.ts +53 -0
- package/dist/server/create-harness.d.ts.map +1 -0
- package/dist/server/create-harness.js +349 -0
- package/dist/server/create-harness.js.map +1 -0
- package/dist/utils/agent-attribution.d.ts +2 -0
- package/dist/utils/agent-attribution.d.ts.map +1 -0
- package/dist/utils/agent-attribution.js +2 -0
- package/dist/utils/agent-attribution.js.map +1 -0
- package/dist/utils/child-process.d.ts +3 -1
- package/dist/utils/child-process.d.ts.map +1 -1
- package/dist/utils/child-process.js +24 -4
- package/dist/utils/child-process.js.map +1 -1
- package/dist/utils/clipboard-image.d.ts.map +1 -1
- package/dist/utils/clipboard-image.js +2 -1
- package/dist/utils/clipboard-image.js.map +1 -1
- package/dist/utils/clipboard.d.ts.map +1 -1
- package/dist/utils/clipboard.js +12 -3
- package/dist/utils/clipboard.js.map +1 -1
- package/dist/utils/management-http.d.ts +23 -0
- package/dist/utils/management-http.d.ts.map +1 -0
- package/dist/utils/management-http.js +50 -0
- package/dist/utils/management-http.js.map +1 -0
- package/dist/utils/open-browser.d.ts.map +1 -1
- package/dist/utils/open-browser.js +2 -1
- package/dist/utils/open-browser.js.map +1 -1
- package/dist/utils/paths.d.ts +2 -0
- package/dist/utils/paths.d.ts.map +1 -1
- package/dist/utils/paths.js +13 -0
- package/dist/utils/paths.js.map +1 -1
- package/dist/utils/shell.d.ts.map +1 -1
- package/dist/utils/shell.js +17 -4
- package/dist/utils/shell.js.map +1 -1
- package/dist/utils/tool-result-images.d.ts +17 -0
- package/dist/utils/tool-result-images.d.ts.map +1 -0
- package/dist/utils/tool-result-images.js +41 -0
- package/dist/utils/tool-result-images.js.map +1 -0
- package/dist/utils/tools-manager.d.ts.map +1 -1
- package/dist/utils/tools-manager.js +7 -8
- package/dist/utils/tools-manager.js.map +1 -1
- package/dist/utils/version-check.d.ts +4 -0
- package/dist/utils/version-check.d.ts.map +1 -1
- package/dist/utils/version-check.js +20 -2
- package/dist/utils/version-check.js.map +1 -1
- package/docs/compaction.md +2 -1
- package/docs/custom-provider.md +15 -7
- package/docs/development.md +1 -0
- package/docs/docs.json +1 -0
- package/docs/environment-variables.md +4 -0
- package/docs/extensions.md +102 -18
- package/docs/i-have-adhd.md +36 -0
- package/docs/intercom.md +31 -16
- package/docs/json.md +2 -2
- package/docs/keybindings.md +55 -12
- package/docs/models/model-selection.md +34 -8
- package/docs/models.md +28 -3
- package/docs/providers.md +20 -2
- package/docs/quickstart.md +5 -5
- package/docs/rpc.md +18 -12
- package/docs/sdk.md +43 -7
- package/docs/security.md +10 -10
- package/docs/sessions.md +2 -0
- package/docs/settings.md +32 -6
- package/docs/subagents.md +30 -45
- package/docs/themes.md +5 -3
- package/docs/tools.md +21 -1
- package/docs/tui.md +41 -24
- package/docs/usage.md +40 -14
- package/docs/windows.md +2 -0
- package/docs/workflows.md +237 -25
- package/examples/extensions/custom-provider-anthropic/index.ts +9 -2
- package/examples/extensions/custom-provider-gitlab-duo/index.ts +9 -2
- package/examples/extensions/gondolin/package-lock.json +3 -3
- package/examples/extensions/modal-editor.ts +8 -10
- package/examples/extensions/rainbow-editor.ts +3 -2
- package/examples/extensions/subagent/README.md +16 -45
- package/examples/extensions/subagent/index.ts +6 -96
- package/examples/extensions/subagent/render.ts +0 -78
- package/examples/extensions/subagent/runner.ts +0 -3
- package/examples/extensions/subagent/schemas.ts +0 -13
- package/examples/extensions/subagent/types.ts +1 -2
- package/examples/sdk/09-api-keys-and-oauth.ts +6 -2
- package/examples/sdk/12-full-control.ts +8 -2
- package/examples/sdk/README.md +4 -1
- package/npm-shrinkwrap.json +191 -634
- package/package.json +14 -7
- package/dist/builtin/subagents/src/agents/chain-serializer.ts +0 -257
- package/dist/builtin/subagents/src/runs/background/async-event-journal.ts +0 -112
- package/dist/builtin/subagents/src/runs/background/async-execution-chain.ts +0 -543
- package/dist/builtin/subagents/src/runs/background/async-execution-common.ts +0 -140
- package/dist/builtin/subagents/src/runs/background/async-execution-single.ts +0 -279
- package/dist/builtin/subagents/src/runs/background/async-execution-types.ts +0 -99
- package/dist/builtin/subagents/src/runs/background/async-execution.ts +0 -17
- package/dist/builtin/subagents/src/runs/background/async-resume.ts +0 -402
- package/dist/builtin/subagents/src/runs/background/async-status.ts +0 -411
- package/dist/builtin/subagents/src/runs/background/completion-claims.ts +0 -196
- package/dist/builtin/subagents/src/runs/background/completion-dedupe.ts +0 -102
- package/dist/builtin/subagents/src/runs/background/parallel-groups.ts +0 -59
- package/dist/builtin/subagents/src/runs/background/result-delivery-processor.ts +0 -300
- package/dist/builtin/subagents/src/runs/background/result-file-claims.ts +0 -166
- package/dist/builtin/subagents/src/runs/background/result-quarantine.ts +0 -77
- package/dist/builtin/subagents/src/runs/background/result-retry-scheduler.ts +0 -48
- package/dist/builtin/subagents/src/runs/background/result-status.ts +0 -87
- package/dist/builtin/subagents/src/runs/background/result-watcher-data.ts +0 -72
- package/dist/builtin/subagents/src/runs/background/result-watcher.ts +0 -320
- package/dist/builtin/subagents/src/runs/background/run-id-resolver.ts +0 -105
- package/dist/builtin/subagents/src/runs/background/run-status.ts +0 -358
- package/dist/builtin/subagents/src/runs/background/stale-run-reconciler.ts +0 -457
- package/dist/builtin/subagents/src/runs/background/subagent-runner-dynamic.ts +0 -376
- package/dist/builtin/subagents/src/runs/background/subagent-runner-finalize.ts +0 -150
- package/dist/builtin/subagents/src/runs/background/subagent-runner-output.ts +0 -109
- package/dist/builtin/subagents/src/runs/background/subagent-runner-parallel-helpers.ts +0 -128
- package/dist/builtin/subagents/src/runs/background/subagent-runner-parallel.ts +0 -309
- package/dist/builtin/subagents/src/runs/background/subagent-runner-sequential.ts +0 -173
- package/dist/builtin/subagents/src/runs/background/subagent-runner-state.ts +0 -578
- package/dist/builtin/subagents/src/runs/background/subagent-runner-step.ts +0 -330
- package/dist/builtin/subagents/src/runs/background/subagent-runner-streaming.ts +0 -330
- package/dist/builtin/subagents/src/runs/background/subagent-runner-types.ts +0 -210
- package/dist/builtin/subagents/src/runs/background/subagent-runner-utils.ts +0 -69
- package/dist/builtin/subagents/src/runs/background/subagent-runner.ts +0 -90
- package/dist/builtin/subagents/src/runs/background/top-level-async.ts +0 -12
- package/dist/builtin/subagents/src/runs/foreground/chain-execution-details.ts +0 -38
- package/dist/builtin/subagents/src/runs/foreground/chain-execution-dynamic-step.ts +0 -280
- package/dist/builtin/subagents/src/runs/foreground/chain-execution-parallel-runner.ts +0 -217
- package/dist/builtin/subagents/src/runs/foreground/chain-execution-parallel-step.ts +0 -271
- package/dist/builtin/subagents/src/runs/foreground/chain-execution-sequential-step.ts +0 -271
- package/dist/builtin/subagents/src/runs/foreground/chain-execution-types.ts +0 -200
- package/dist/builtin/subagents/src/runs/foreground/chain-execution.ts +0 -184
- package/dist/builtin/subagents/src/runs/foreground/execution-attempt-control.ts +0 -140
- package/dist/builtin/subagents/src/runs/foreground/execution-attempt-finalize.ts +0 -108
- package/dist/builtin/subagents/src/runs/foreground/execution-attempt-types.ts +0 -17
- package/dist/builtin/subagents/src/runs/foreground/execution-attempt.ts +0 -558
- package/dist/builtin/subagents/src/runs/foreground/execution-structured-retries.ts +0 -83
- package/dist/builtin/subagents/src/runs/foreground/subagent-executor-chain.ts +0 -109
- package/dist/builtin/subagents/src/runs/shared/attempt-watchdog.ts +0 -126
- package/dist/builtin/subagents/src/runs/shared/chain-outputs.ts +0 -126
- package/dist/builtin/subagents/src/runs/shared/dynamic-fanout.ts +0 -387
- package/dist/builtin/subagents/src/runs/shared/final-drain.ts +0 -39
- package/dist/builtin/subagents/src/runs/shared/pi-args.ts +0 -339
- package/dist/builtin/subagents/src/runs/shared/pi-spawn.ts +0 -165
- package/dist/builtin/subagents/src/runs/shared/spawn-env.ts +0 -21
- package/dist/builtin/subagents/src/runs/shared/structured-output.ts +0 -150
- package/dist/builtin/subagents/src/runs/shared/workflow-graph.ts +0 -232
- package/dist/builtin/subagents/src/shared/post-exit-stdio-guard.ts +0 -86
- package/dist/builtin/subagents/src/slash/saved-chain-mapping.ts +0 -60
- package/dist/builtin/subagents/src/tui/render-chain-graph.ts +0 -335
- package/examples/extensions/subagent/prompts/implement-and-review.md +0 -10
- package/examples/extensions/subagent/prompts/implement.md +0 -10
- package/examples/extensions/subagent/prompts/scout-and-plan.md +0 -9
- /package/dist/builtin/subagents/src/runs/{shared/nested-path.ts → inprocess/runtime-support/nested-paths.ts} +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"package-manager-git.js","sourceRoot":"","sources":["../../src/core/package-manager-git.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AACrE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACnD,OAAO,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAC;AAEpD,OAAO,EAAE,UAAU,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AAC7E,OAAO,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAC;AACpE,OAAO,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;AAChE,OAAO,EAAE,eAAe,EAAE,2BAA2B,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AACvG,OAAO,EAAE,mBAAmB,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AACvG,OAAO,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAC;AAG7D,SAAS,aAAa,CACrB,OAA8B,EAC9B,OAAe,EACf,IAAc,EACd,OAA0B;IAE1B,OAAO,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC,UAAU,CAAC,OAAO,EAAE,IAAI,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,OAAO,EAAE,IAAI,EAAE,OAAO,CAAC,CAAC;AAChH,CAAC;AAED,SAAS,iBAAiB,CACzB,OAA8B,EAC9B,OAAe,EACf,IAAc,EACd,OAA4E;IAE5E,OAAO,OAAO,CAAC,MAAM;QACpB,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC,iBAAiB,CAAC,OAAO,EAAE,IAAI,EAAE,OAAO,CAAC;QAC1D,CAAC,CAAC,iBAAiB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rD;aACD,CAAC;QACH,CAAC;QACD,OAAO;YACN,GAAG,EAAE,aAAa;YAClB,IAAI;YACJ,SAAS,EAAE,CAAC,OAAO,EAAE,SAAS,EAAE,WAAW,EAAE,QAAQ,EAAE,gCAAgC,CAAC;SACxF,CAAC;IACH,CAAC;AACF,CAAC;AAED,KAAK,UAAU,iBAAiB,CAAC,OAA8B,EAAE,aAAqB;IACrF,IAAI,CAAC;QACJ,MAAM,QAAQ,GAAG,MAAM,iBAAiB,CAAC,OAAO,EAAE,KAAK,EAAE,CAAC,WAAW,EAAE,cAAc,EAAE,aAAa,CAAC,EAAE;YACtG,GAAG,EAAE,aAAa;YAClB,SAAS,EAAE,kBAAkB;SAC7B,CAAC,CAAC;QACH,MAAM,OAAO,GAAG,QAAQ,CAAC,IAAI,EAAE,CAAC;QAChC,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,SAAS,CAAC;YAAE,OAAO,SAAS,CAAC;QACrD,MAAM,MAAM,GAAG,OAAO,CAAC,KAAK,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC;QAC/C,OAAO,MAAM,CAAC,CAAC,CAAC,cAAc,MAAM,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC;IACpD,CAAC;IAAC,MAAM,CAAC;QACR,OAAO,SAAS,CAAC;IAClB,CAAC;AACF,CAAC;AAED,SAAS,mBAAmB,CAAC,OAA8B,EAAE,aAAqB,EAAE,IAAc;IACjG,OAAO,iBAAiB,CAAC,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE;QAC9C,GAAG,EAAE,aAAa;QAClB,SAAS,EAAE,kBAAkB;QAC7B,GAAG,EAAE,EAAE,mBAAmB,EAAE,GAAG,EAAE;KACjC,CAAC,CAAC;AACJ,CAAC","sourcesContent":["import { existsSync, mkdirSync, readdirSync, rmSync } from \"node:fs\";\nimport { dirname, join, resolve } from \"node:path\";\nimport { getProjectConfigDirs } from \"../config.ts\";\nimport type { GitSource } from \"../utils/git.ts\";\nimport { runCommand, runCommandCapture } from \"./package-manager-command.ts\";\nimport { NETWORK_TIMEOUT_MS } from \"./package-manager-constants.ts\";\nimport { isOfflineModeEnabled } from \"./package-manager-env.ts\";\nimport { ensureGitIgnore, getGitDependencyInstallArgs, runNpmCommand } from \"./package-manager-npm.ts\";\nimport { getBaseDirsForScope, getGitInstallPath, getGitInstallRoot } from \"./package-manager-paths.ts\";\nimport { withProgress } from \"./package-manager-progress.ts\";\nimport type { GitUpdateTargetInfo, PackageManagerContext, SourceScope } from \"./package-manager-types.ts\";\n\nfunction runGitProcess(\n\tcontext: PackageManagerContext,\n\tcommand: string,\n\targs: string[],\n\toptions?: { cwd?: string },\n): Promise<void> {\n\treturn context.driver ? context.driver.runCommand(command, args, options) : runCommand(command, args, options);\n}\n\nfunction captureGitProcess(\n\tcontext: PackageManagerContext,\n\tcommand: string,\n\targs: string[],\n\toptions?: { cwd?: string; timeoutMs?: number; env?: Record<string, string> },\n): Promise<string> {\n\treturn context.driver\n\t\t? context.driver.runCommandCapture(command, args, options)\n\t\t: runCommandCapture(command, args, options);\n}\n\nfunction getSafeGitRef(ref: string): string {\n\tif (!isSafeGitRef(ref)) {\n\t\tthrow new Error(`Invalid git ref: ${JSON.stringify(ref)}`);\n\t}\n\treturn ref;\n}\n\nfunction isSafeGitRef(ref: string): boolean {\n\tif (!ref || ref === \"@\" || ref.startsWith(\"-\") || ref.endsWith(\".\") || ref.endsWith(\"/\")) {\n\t\treturn false;\n\t}\n\tif (/[\\x00-\\x1f\\x7f\\s~^:?*[\\]\\\\]/u.test(ref)) {\n\t\treturn false;\n\t}\n\tif (ref.includes(\"..\") || ref.includes(\"@{\") || ref.includes(\"//\")) {\n\t\treturn false;\n\t}\n\treturn ref\n\t\t.split(\"/\")\n\t\t.every((part) => part && part !== \".\" && part !== \"..\" && !part.startsWith(\".\") && !part.endsWith(\".lock\"));\n}\n\nexport function getExistingGitInstallPath(\n\tcontext: PackageManagerContext,\n\tsource: GitSource,\n\tscope: SourceScope,\n): string | undefined {\n\tconst candidates = [getGitInstallPath(context, source, scope)];\n\tif (scope === \"project\") {\n\t\tfor (const configDir of getProjectConfigDirs(context.cwd)) {\n\t\t\tcandidates.push(join(configDir, \"git\", source.host, source.path));\n\t\t}\n\t} else if (scope === \"user\") {\n\t\tfor (const agentDir of getBaseDirsForScope(context, \"user\")) {\n\t\t\tcandidates.push(join(agentDir, \"git\", source.host, source.path));\n\t\t}\n\t}\n\tfor (const candidate of Array.from(new Set(candidates))) {\n\t\tif (existsSync(candidate)) return candidate;\n\t}\n\treturn undefined;\n}\n\nexport async function installGit(context: PackageManagerContext, source: GitSource, scope: SourceScope): Promise<void> {\n\tconst safeRef = source.ref ? getSafeGitRef(source.ref) : undefined;\n\tconst targetDir = getGitInstallPath(context, source, scope);\n\tif (existsSync(targetDir)) {\n\t\tif (safeRef) {\n\t\t\tawait ensureGitRef(context, targetDir, [\"fetch\", \"origin\", \"--\", safeRef], \"FETCH_HEAD\");\n\t\t\treturn;\n\t\t}\n\t\tconst target = context.driver\n\t\t\t? await context.driver.getLocalGitUpdateTarget(targetDir)\n\t\t\t: await getLocalGitUpdateTarget(context, targetDir);\n\t\tawait ensureGitRef(context, targetDir, target.fetchArgs, target.ref);\n\t\treturn;\n\t}\n\tconst gitRoot = getGitInstallRoot(context, scope);\n\tif (gitRoot) {\n\t\tensureGitIgnore(gitRoot);\n\t}\n\tmkdirSync(dirname(targetDir), { recursive: true });\n\n\t// Defense-in-depth: the clone URL is already parsed/validated upstream, but\n\t// assert it contains only shell-safe characters immediately before it reaches\n\t// `git clone`, so no metacharacter can ever reach a shell even on platforms\n\t// that wrap process spawns. Capture the validated value in a local so the\n\t// guard sanitizes exactly the binding handed to the spawn.\n\tconst cloneUrl = source.repo;\n\tif (!/^[A-Za-z0-9._~:@/%+-]+$/.test(cloneUrl)) {\n\t\tthrow new Error(`Refusing to clone repository with unsafe URL: ${cloneUrl}`);\n\t}\n\ttry {\n\t\tawait runGitProcess(context, \"git\", [\"clone\", \"--\", cloneUrl, targetDir]);\n\t\tif (safeRef) {\n\t\t\tawait runGitProcess(context, \"git\", [\"checkout\", safeRef], { cwd: targetDir });\n\t\t}\n\t\tconst packageJsonPath = join(targetDir, \"package.json\");\n\t\tif (existsSync(packageJsonPath)) {\n\t\t\tawait runNpmCommand(context, getGitDependencyInstallArgs(context), { cwd: targetDir });\n\t\t}\n\t} catch (error) {\n\t\t// A half-written clone would otherwise be treated as installed by the\n\t\t// `existsSync(targetDir)` check above, so the next install silently skips\n\t\t// the repair. Remove it, then drop the now-empty host/owner directories.\n\t\trmSync(targetDir, { recursive: true, force: true });\n\t\tpruneEmptyGitParents(targetDir, gitRoot);\n\t\tthrow error;\n\t}\n}\n\nexport async function updateGit(context: PackageManagerContext, source: GitSource, scope: SourceScope): Promise<void> {\n\tconst safeRef = source.ref ? getSafeGitRef(source.ref) : undefined;\n\tconst targetDir = getExistingGitInstallPath(context, source, scope) ?? getGitInstallPath(context, source, scope);\n\tif (!existsSync(targetDir)) {\n\t\tawait installGit(context, source, scope);\n\t\treturn;\n\t}\n\tif (safeRef) {\n\t\tawait ensureGitRef(context, targetDir, [\"fetch\", \"origin\", \"--\", safeRef], \"FETCH_HEAD\");\n\t\treturn;\n\t}\n\tconst target = context.driver\n\t\t? await context.driver.getLocalGitUpdateTarget(targetDir)\n\t\t: await getLocalGitUpdateTarget(context, targetDir);\n\tawait ensureGitRef(context, targetDir, target.fetchArgs, target.ref);\n}\n\nasync function ensureGitRef(\n\tcontext: PackageManagerContext,\n\ttargetDir: string,\n\tfetchArgs: string[],\n\tref: string,\n): Promise<void> {\n\tawait runGitProcess(context, \"git\", fetchArgs, { cwd: targetDir });\n\n\tconst localHead = await captureGitProcess(context, \"git\", [\"rev-parse\", \"HEAD\"], {\n\t\tcwd: targetDir,\n\t\ttimeoutMs: NETWORK_TIMEOUT_MS,\n\t});\n\tconst commitRef = `${ref}^{commit}`;\n\tconst targetHead = await captureGitProcess(context, \"git\", [\"rev-parse\", commitRef], {\n\t\tcwd: targetDir,\n\t\ttimeoutMs: NETWORK_TIMEOUT_MS,\n\t});\n\tif (localHead.trim() === targetHead.trim()) {\n\t\treturn;\n\t}\n\n\tawait runGitProcess(context, \"git\", [\"reset\", \"--hard\", commitRef], { cwd: targetDir });\n\tawait runGitProcess(context, \"git\", [\"clean\", \"-fdx\"], { cwd: targetDir });\n\n\tconst packageJsonPath = join(targetDir, \"package.json\");\n\tif (existsSync(packageJsonPath)) {\n\t\tawait runNpmCommand(context, getGitDependencyInstallArgs(context), { cwd: targetDir });\n\t}\n}\n\nexport async function refreshTemporaryGitSource(\n\tcontext: PackageManagerContext,\n\tsource: GitSource,\n\tsourceStr: string,\n): Promise<void> {\n\tif (isOfflineModeEnabled()) {\n\t\treturn;\n\t}\n\ttry {\n\t\tawait withProgress(context, \"pull\", sourceStr, `Refreshing ${sourceStr}...`, async () => {\n\t\t\tawait updateGit(context, source, \"temporary\");\n\t\t});\n\t} catch {}\n}\n\nexport async function removeGit(context: PackageManagerContext, source: GitSource, scope: SourceScope): Promise<void> {\n\tconst targetDir = getGitInstallPath(context, source, scope);\n\tif (!existsSync(targetDir)) return;\n\trmSync(targetDir, { recursive: true, force: true });\n\tpruneEmptyGitParents(targetDir, getGitInstallRoot(context, scope));\n}\n\nfunction pruneEmptyGitParents(targetDir: string, installRoot: string | undefined): void {\n\tif (!installRoot) return;\n\tconst resolvedRoot = resolve(installRoot);\n\tlet current = dirname(targetDir);\n\twhile (current.startsWith(resolvedRoot) && current !== resolvedRoot) {\n\t\tif (!existsSync(current)) {\n\t\t\tcurrent = dirname(current);\n\t\t\tcontinue;\n\t\t}\n\t\tconst entries = readdirSync(current);\n\t\tif (entries.length > 0) break;\n\t\ttry {\n\t\t\trmSync(current, { recursive: true, force: true });\n\t\t} catch {\n\t\t\tbreak;\n\t\t}\n\t\tcurrent = dirname(current);\n\t}\n}\n\nexport async function gitHasAvailableUpdate(context: PackageManagerContext, installedPath: string): Promise<boolean> {\n\tif (isOfflineModeEnabled()) {\n\t\treturn false;\n\t}\n\ttry {\n\t\tconst localHead = await captureGitProcess(context, \"git\", [\"rev-parse\", \"HEAD\"], {\n\t\t\tcwd: installedPath,\n\t\t\ttimeoutMs: NETWORK_TIMEOUT_MS,\n\t\t});\n\t\tconst remoteHead = await getRemoteGitHead(context, installedPath);\n\t\treturn localHead.trim() !== remoteHead.trim();\n\t} catch {\n\t\treturn false;\n\t}\n}\n\nasync function getRemoteGitHead(context: PackageManagerContext, installedPath: string): Promise<string> {\n\tconst upstreamRef = await getGitUpstreamRef(context, installedPath);\n\tif (upstreamRef) {\n\t\tconst remoteHead = await runGitRemoteCommand(context, installedPath, [\"ls-remote\", \"origin\", upstreamRef]);\n\t\tconst match = remoteHead.match(/^([0-9a-f]{40})\\s+/m);\n\t\tif (match?.[1]) return match[1];\n\t}\n\n\tconst remoteHead = await runGitRemoteCommand(context, installedPath, [\"ls-remote\", \"origin\", \"HEAD\"]);\n\tconst match = remoteHead.match(/^([0-9a-f]{40})\\s+HEAD$/m);\n\tif (!match?.[1]) {\n\t\tthrow new Error(\"Failed to determine remote HEAD\");\n\t}\n\treturn match[1];\n}\n\nexport async function getLocalGitUpdateTarget(\n\tcontext: PackageManagerContext,\n\tinstalledPath: string,\n): Promise<GitUpdateTargetInfo> {\n\ttry {\n\t\tconst upstream = await captureGitProcess(context, \"git\", [\"rev-parse\", \"--abbrev-ref\", \"@{upstream}\"], {\n\t\t\tcwd: installedPath,\n\t\t\ttimeoutMs: NETWORK_TIMEOUT_MS,\n\t\t});\n\t\tconst trimmedUpstream = upstream.trim();\n\t\tif (!trimmedUpstream.startsWith(\"origin/\")) throw new Error(`Unsupported upstream remote: ${trimmedUpstream}`);\n\t\tconst branch = trimmedUpstream.slice(\"origin/\".length);\n\t\tif (!branch) throw new Error(\"Missing upstream branch name\");\n\t\tconst head = await captureGitProcess(context, \"git\", [\"rev-parse\", \"@{upstream}\"], {\n\t\t\tcwd: installedPath,\n\t\t\ttimeoutMs: NETWORK_TIMEOUT_MS,\n\t\t});\n\t\treturn {\n\t\t\tref: \"@{upstream}\",\n\t\t\thead,\n\t\t\tfetchArgs: [\"fetch\", \"--prune\", \"--no-tags\", \"origin\", `+refs/heads/${branch}:refs/remotes/origin/${branch}`],\n\t\t};\n\t} catch {\n\t\tawait runGitProcess(context, \"git\", [\"remote\", \"set-head\", \"origin\", \"-a\"], { cwd: installedPath }).catch(\n\t\t\t() => {},\n\t\t);\n\t\tconst head = await captureGitProcess(context, \"git\", [\"rev-parse\", \"origin/HEAD\"], {\n\t\t\tcwd: installedPath,\n\t\t\ttimeoutMs: NETWORK_TIMEOUT_MS,\n\t\t});\n\t\tconst originHeadRef = await captureGitProcess(context, \"git\", [\"symbolic-ref\", \"refs/remotes/origin/HEAD\"], {\n\t\t\tcwd: installedPath,\n\t\t\ttimeoutMs: NETWORK_TIMEOUT_MS,\n\t\t}).catch(() => \"\");\n\t\tconst branch = originHeadRef.trim().replace(/^refs\\/remotes\\/origin\\//, \"\");\n\t\tif (branch) {\n\t\t\treturn {\n\t\t\t\tref: \"origin/HEAD\",\n\t\t\t\thead,\n\t\t\t\tfetchArgs: [\n\t\t\t\t\t\"fetch\",\n\t\t\t\t\t\"--prune\",\n\t\t\t\t\t\"--no-tags\",\n\t\t\t\t\t\"origin\",\n\t\t\t\t\t`+refs/heads/${branch}:refs/remotes/origin/${branch}`,\n\t\t\t\t],\n\t\t\t};\n\t\t}\n\t\treturn {\n\t\t\tref: \"origin/HEAD\",\n\t\t\thead,\n\t\t\tfetchArgs: [\"fetch\", \"--prune\", \"--no-tags\", \"origin\", \"+HEAD:refs/remotes/origin/HEAD\"],\n\t\t};\n\t}\n}\n\nasync function getGitUpstreamRef(context: PackageManagerContext, installedPath: string): Promise<string | undefined> {\n\ttry {\n\t\tconst upstream = await captureGitProcess(context, \"git\", [\"rev-parse\", \"--abbrev-ref\", \"@{upstream}\"], {\n\t\t\tcwd: installedPath,\n\t\t\ttimeoutMs: NETWORK_TIMEOUT_MS,\n\t\t});\n\t\tconst trimmed = upstream.trim();\n\t\tif (!trimmed.startsWith(\"origin/\")) return undefined;\n\t\tconst branch = trimmed.slice(\"origin/\".length);\n\t\treturn branch ? `refs/heads/${branch}` : undefined;\n\t} catch {\n\t\treturn undefined;\n\t}\n}\n\nfunction runGitRemoteCommand(context: PackageManagerContext, installedPath: string, args: string[]): Promise<string> {\n\treturn captureGitProcess(context, \"git\", args, {\n\t\tcwd: installedPath,\n\t\ttimeoutMs: NETWORK_TIMEOUT_MS,\n\t\tenv: { GIT_TERMINAL_PROMPT: \"0\" },\n\t});\n}\n"]}
|
|
1
|
+
{"version":3,"file":"package-manager-git.js","sourceRoot":"","sources":["../../src/core/package-manager-git.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAClG,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,WAAW,CAAC;AAClE,OAAO,EAAE,QAAQ,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAC;AAE9D,OAAO,EAAE,UAAU,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AAC7E,OAAO,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAC;AACpE,OAAO,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;AAChE,OAAO,EAAE,eAAe,EAAE,2BAA2B,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AACvG,OAAO,EAAE,mBAAmB,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AACvG,OAAO,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAC;AAG7D,SAAS,aAAa,CACrB,OAA8B,EAC9B,OAAe,EACf,IAAc,EACd,OAA0B;IAE1B,OAAO,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC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BACP,SAAS;oBACT,WAAW;oBACX,QAAQ;oBACR,eAAe,MAAM,wBAAwB,MAAM,EAAE;iBACrD;aACD,CAAC;QACH,CAAC;QACD,OAAO;YACN,GAAG,EAAE,aAAa;YAClB,IAAI;YACJ,SAAS,EAAE,CAAC,OAAO,EAAE,SAAS,EAAE,WAAW,EAAE,QAAQ,EAAE,gCAAgC,CAAC;SACxF,CAAC;IACH,CAAC;AACF,CAAC;AAED,KAAK,UAAU,iBAAiB,CAAC,OAA8B,EAAE,aAAqB;IACrF,IAAI,CAAC;QACJ,MAAM,QAAQ,GAAG,MAAM,iBAAiB,CAAC,OAAO,EAAE,KAAK,EAAE,CAAC,WAAW,EAAE,cAAc,EAAE,aAAa,CAAC,EAAE;YACtG,GAAG,EAAE,aAAa;YAClB,SAAS,EAAE,kBAAkB;SAC7B,CAAC,CAAC;QACH,MAAM,OAAO,GAAG,QAAQ,CAAC,IAAI,EAAE,CAAC;QAChC,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,SAAS,CAAC;YAAE,OAAO,SAAS,CAAC;QACrD,MAAM,MAAM,GAAG,OAAO,CAAC,KAAK,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC;QAC/C,OAAO,MAAM,CAAC,CAAC,CAAC,cAAc,MAAM,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC;IACpD,CAAC;IAAC,MAAM,CAAC;QACR,OAAO,SAAS,CAAC;IAClB,CAAC;AACF,CAAC;AAED,SAAS,mBAAmB,CAAC,OAA8B,EAAE,aAAqB,EAAE,IAAc;IACjG,OAAO,iBAAiB,CAAC,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE;QAC9C,GAAG,EAAE,aAAa;QAClB,SAAS,EAAE,kBAAkB;QAC7B,GAAG,EAAE,EAAE,mBAAmB,EAAE,GAAG,EAAE;KACjC,CAAC,CAAC;AACJ,CAAC","sourcesContent":["import { existsSync, mkdirSync, readdirSync, readFileSync, rmSync, writeFileSync } from \"node:fs\";\nimport { basename, dirname, join, resolve, sep } from \"node:path\";\nimport { APP_NAME, getProjectConfigDirs } from \"../config.ts\";\nimport type { GitSource } from \"../utils/git.ts\";\nimport { runCommand, runCommandCapture } from \"./package-manager-command.ts\";\nimport { NETWORK_TIMEOUT_MS } from \"./package-manager-constants.ts\";\nimport { isOfflineModeEnabled } from \"./package-manager-env.ts\";\nimport { ensureGitIgnore, getGitDependencyInstallArgs, runNpmCommand } from \"./package-manager-npm.ts\";\nimport { getBaseDirsForScope, getGitInstallPath, getGitInstallRoot } from \"./package-manager-paths.ts\";\nimport { withProgress } from \"./package-manager-progress.ts\";\nimport type { GitUpdateTargetInfo, PackageManagerContext, SourceScope } from \"./package-manager-types.ts\";\n\nfunction runGitProcess(\n\tcontext: PackageManagerContext,\n\tcommand: string,\n\targs: string[],\n\toptions?: { cwd?: string },\n): Promise<void> {\n\treturn context.driver ? context.driver.runCommand(command, args, options) : runCommand(command, args, options);\n}\n\nfunction captureGitProcess(\n\tcontext: PackageManagerContext,\n\tcommand: string,\n\targs: string[],\n\toptions?: { cwd?: string; timeoutMs?: number; env?: Record<string, string> },\n): Promise<string> {\n\treturn context.driver\n\t\t? context.driver.runCommandCapture(command, args, options)\n\t\t: runCommandCapture(command, args, options);\n}\n\nfunction getSafeGitRef(ref: string): string {\n\tif (!isSafeGitRef(ref)) {\n\t\tthrow new Error(`Invalid git ref: ${JSON.stringify(ref)}`);\n\t}\n\treturn ref;\n}\n\nfunction isSafeGitRef(ref: string): boolean {\n\tif (!ref || ref === \"@\" || ref.startsWith(\"-\") || ref.endsWith(\".\") || ref.endsWith(\"/\")) {\n\t\treturn false;\n\t}\n\tif (/[\\x00-\\x1f\\x7f\\s~^:?*[\\]\\\\]/u.test(ref)) {\n\t\treturn false;\n\t}\n\tif (ref.includes(\"..\") || ref.includes(\"@{\") || ref.includes(\"//\")) {\n\t\treturn false;\n\t}\n\treturn ref\n\t\t.split(\"/\")\n\t\t.every((part) => part && part !== \".\" && part !== \"..\" && !part.startsWith(\".\") && !part.endsWith(\".lock\"));\n}\n\nexport function getExistingGitInstallPath(\n\tcontext: PackageManagerContext,\n\tsource: GitSource,\n\tscope: SourceScope,\n): string | undefined {\n\tconst candidates = [getGitInstallPath(context, source, scope)];\n\tif (scope === \"project\") {\n\t\tfor (const configDir of getProjectConfigDirs(context.cwd)) {\n\t\t\tcandidates.push(join(configDir, \"git\", source.host, source.path));\n\t\t}\n\t} else if (scope === \"user\") {\n\t\tfor (const agentDir of getBaseDirsForScope(context, \"user\")) {\n\t\t\tcandidates.push(join(agentDir, \"git\", source.host, source.path));\n\t\t}\n\t}\n\tfor (const candidate of Array.from(new Set(candidates))) {\n\t\tif (existsSync(candidate)) return candidate;\n\t}\n\treturn undefined;\n}\n\nfunction getGitUpdateMarkerPath(targetDir: string): string {\n\treturn join(dirname(targetDir), `.${basename(targetDir)}.${APP_NAME}-update-incomplete`);\n}\n\nfunction hasMissingGitDependencies(targetDir: string): boolean {\n\tconst packageJsonPath = join(targetDir, \"package.json\");\n\tif (!existsSync(packageJsonPath)) return false;\n\ttry {\n\t\tconst manifest = JSON.parse(readFileSync(packageJsonPath, \"utf-8\")) as { dependencies?: unknown };\n\t\tif (!manifest.dependencies || typeof manifest.dependencies !== \"object\" || Array.isArray(manifest.dependencies)) {\n\t\t\treturn false;\n\t\t}\n\t\tconst nodeModulesDir = resolve(targetDir, \"node_modules\");\n\t\treturn Object.keys(manifest.dependencies).some((name) => {\n\t\t\tconst dependencyPath = resolve(nodeModulesDir, name);\n\t\t\tif (!dependencyPath.startsWith(`${nodeModulesDir}${sep}`)) return false;\n\t\t\treturn !existsSync(dependencyPath);\n\t\t});\n\t} catch {\n\t\treturn false;\n\t}\n}\n\nasync function repairMissingGitDependencies(context: PackageManagerContext, targetDir: string): Promise<void> {\n\tif (!hasMissingGitDependencies(targetDir)) return;\n\tawait runNpmCommand(context, getGitDependencyInstallArgs(context), { cwd: targetDir });\n}\n\nasync function cleanAndInstallGitDependencies(\n\tcontext: PackageManagerContext,\n\ttargetDir: string,\n\tmarkerPath: string,\n): Promise<void> {\n\ttry {\n\t\tawait runGitProcess(context, \"git\", [\"clean\", \"-fdx\"], { cwd: targetDir });\n\t} catch (error) {\n\t\tawait repairMissingGitDependencies(context, targetDir).catch(() => {});\n\t\tthrow error;\n\t}\n\tif (existsSync(join(targetDir, \"package.json\"))) {\n\t\tawait runNpmCommand(context, getGitDependencyInstallArgs(context), { cwd: targetDir });\n\t}\n\trmSync(markerPath, { force: true });\n}\n\nexport async function installGit(context: PackageManagerContext, source: GitSource, scope: SourceScope): Promise<void> {\n\tconst safeRef = source.ref ? getSafeGitRef(source.ref) : undefined;\n\tconst targetDir = getGitInstallPath(context, source, scope);\n\tif (existsSync(targetDir)) {\n\t\tif (safeRef) {\n\t\t\tawait ensureGitRef(context, targetDir, [\"fetch\", \"origin\", \"--\", safeRef], \"FETCH_HEAD\");\n\t\t\treturn;\n\t\t}\n\t\tconst target = context.driver\n\t\t\t? await context.driver.getLocalGitUpdateTarget(targetDir)\n\t\t\t: await getLocalGitUpdateTarget(context, targetDir);\n\t\tawait ensureGitRef(context, targetDir, target.fetchArgs, target.ref);\n\t\treturn;\n\t}\n\tconst gitRoot = getGitInstallRoot(context, scope);\n\tif (gitRoot) {\n\t\tensureGitIgnore(gitRoot);\n\t}\n\tmkdirSync(dirname(targetDir), { recursive: true });\n\trmSync(getGitUpdateMarkerPath(targetDir), { force: true });\n\n\t// Defense-in-depth: the clone URL is already parsed/validated upstream, but\n\t// assert it contains only shell-safe characters immediately before it reaches\n\t// `git clone`, so no metacharacter can ever reach a shell even on platforms\n\t// that wrap process spawns. Capture the validated value in a local so the\n\t// guard sanitizes exactly the binding handed to the spawn.\n\tconst cloneUrl = source.repo;\n\tif (!/^[A-Za-z0-9._~:@/%+-]+$/.test(cloneUrl)) {\n\t\tthrow new Error(`Refusing to clone repository with unsafe URL: ${cloneUrl}`);\n\t}\n\ttry {\n\t\tawait runGitProcess(context, \"git\", [\"clone\", \"--\", cloneUrl, targetDir]);\n\t\tif (safeRef) {\n\t\t\tawait runGitProcess(context, \"git\", [\"checkout\", safeRef], { cwd: targetDir });\n\t\t}\n\t\tconst packageJsonPath = join(targetDir, \"package.json\");\n\t\tif (existsSync(packageJsonPath)) {\n\t\t\tawait runNpmCommand(context, getGitDependencyInstallArgs(context), { cwd: targetDir });\n\t\t}\n\t} catch (error) {\n\t\t// A half-written clone would otherwise be treated as installed by the\n\t\t// `existsSync(targetDir)` check above, so the next install silently skips\n\t\t// the repair. Remove it, then drop the now-empty host/owner directories.\n\t\trmSync(targetDir, { recursive: true, force: true });\n\t\tpruneEmptyGitParents(targetDir, gitRoot);\n\t\tthrow error;\n\t}\n}\n\nexport async function updateGit(context: PackageManagerContext, source: GitSource, scope: SourceScope): Promise<void> {\n\tconst safeRef = source.ref ? getSafeGitRef(source.ref) : undefined;\n\tconst targetDir = getExistingGitInstallPath(context, source, scope) ?? getGitInstallPath(context, source, scope);\n\tif (!existsSync(targetDir)) {\n\t\tawait installGit(context, source, scope);\n\t\treturn;\n\t}\n\tif (safeRef) {\n\t\tawait ensureGitRef(context, targetDir, [\"fetch\", \"origin\", \"--\", safeRef], \"FETCH_HEAD\");\n\t\treturn;\n\t}\n\tconst target = context.driver\n\t\t? await context.driver.getLocalGitUpdateTarget(targetDir)\n\t\t: await getLocalGitUpdateTarget(context, targetDir);\n\tawait ensureGitRef(context, targetDir, target.fetchArgs, target.ref);\n}\n\nasync function ensureGitRef(\n\tcontext: PackageManagerContext,\n\ttargetDir: string,\n\tfetchArgs: string[],\n\tref: string,\n): Promise<void> {\n\tawait runGitProcess(context, \"git\", fetchArgs, { cwd: targetDir });\n\n\tconst localHead = await captureGitProcess(context, \"git\", [\"rev-parse\", \"HEAD\"], {\n\t\tcwd: targetDir,\n\t\ttimeoutMs: NETWORK_TIMEOUT_MS,\n\t});\n\tconst commitRef = `${ref}^{commit}`;\n\tconst targetHead = await captureGitProcess(context, \"git\", [\"rev-parse\", commitRef], {\n\t\tcwd: targetDir,\n\t\ttimeoutMs: NETWORK_TIMEOUT_MS,\n\t});\n\tconst markerPath = getGitUpdateMarkerPath(targetDir);\n\tif (localHead.trim() === targetHead.trim()) {\n\t\tif (existsSync(markerPath)) {\n\t\t\tawait cleanAndInstallGitDependencies(context, targetDir, markerPath);\n\t\t} else {\n\t\t\tawait repairMissingGitDependencies(context, targetDir);\n\t\t}\n\t\treturn;\n\t}\n\n\twriteFileSync(markerPath, \"\", \"utf-8\");\n\tawait runGitProcess(context, \"git\", [\"reset\", \"--hard\", commitRef], { cwd: targetDir });\n\tawait cleanAndInstallGitDependencies(context, targetDir, markerPath);\n}\n\nexport async function refreshTemporaryGitSource(\n\tcontext: PackageManagerContext,\n\tsource: GitSource,\n\tsourceStr: string,\n): Promise<void> {\n\tif (isOfflineModeEnabled()) {\n\t\treturn;\n\t}\n\ttry {\n\t\tawait withProgress(context, \"pull\", sourceStr, `Refreshing ${sourceStr}...`, async () => {\n\t\t\tawait updateGit(context, source, \"temporary\");\n\t\t});\n\t} catch {}\n}\n\nexport async function removeGit(context: PackageManagerContext, source: GitSource, scope: SourceScope): Promise<void> {\n\tconst targetDir = getGitInstallPath(context, source, scope);\n\trmSync(targetDir, { recursive: true, force: true });\n\trmSync(getGitUpdateMarkerPath(targetDir), { force: true });\n\tpruneEmptyGitParents(targetDir, getGitInstallRoot(context, scope));\n}\n\nfunction pruneEmptyGitParents(targetDir: string, installRoot: string | undefined): void {\n\tif (!installRoot) return;\n\tconst resolvedRoot = resolve(installRoot);\n\tlet current = dirname(targetDir);\n\twhile (current.startsWith(resolvedRoot) && current !== resolvedRoot) {\n\t\tif (!existsSync(current)) {\n\t\t\tcurrent = dirname(current);\n\t\t\tcontinue;\n\t\t}\n\t\tconst entries = readdirSync(current);\n\t\tif (entries.length > 0) break;\n\t\ttry {\n\t\t\trmSync(current, { recursive: true, force: true });\n\t\t} catch {\n\t\t\tbreak;\n\t\t}\n\t\tcurrent = dirname(current);\n\t}\n}\n\nexport async function gitHasAvailableUpdate(context: PackageManagerContext, installedPath: string): Promise<boolean> {\n\tif (isOfflineModeEnabled()) {\n\t\treturn false;\n\t}\n\ttry {\n\t\tconst localHead = await captureGitProcess(context, \"git\", [\"rev-parse\", \"HEAD\"], {\n\t\t\tcwd: installedPath,\n\t\t\ttimeoutMs: NETWORK_TIMEOUT_MS,\n\t\t});\n\t\tconst remoteHead = await getRemoteGitHead(context, installedPath);\n\t\treturn localHead.trim() !== remoteHead.trim();\n\t} catch {\n\t\treturn false;\n\t}\n}\n\nasync function getRemoteGitHead(context: PackageManagerContext, installedPath: string): Promise<string> {\n\tconst upstreamRef = await getGitUpstreamRef(context, installedPath);\n\tif (upstreamRef) {\n\t\tconst remoteHead = await runGitRemoteCommand(context, installedPath, [\"ls-remote\", \"origin\", upstreamRef]);\n\t\tconst match = remoteHead.match(/^([0-9a-f]{40})\\s+/m);\n\t\tif (match?.[1]) return match[1];\n\t}\n\n\tconst remoteHead = await runGitRemoteCommand(context, installedPath, [\"ls-remote\", \"origin\", \"HEAD\"]);\n\tconst match = remoteHead.match(/^([0-9a-f]{40})\\s+HEAD$/m);\n\tif (!match?.[1]) {\n\t\tthrow new Error(\"Failed to determine remote HEAD\");\n\t}\n\treturn match[1];\n}\n\nexport async function getLocalGitUpdateTarget(\n\tcontext: PackageManagerContext,\n\tinstalledPath: string,\n): Promise<GitUpdateTargetInfo> {\n\ttry {\n\t\tconst upstream = await captureGitProcess(context, \"git\", [\"rev-parse\", \"--abbrev-ref\", \"@{upstream}\"], {\n\t\t\tcwd: installedPath,\n\t\t\ttimeoutMs: NETWORK_TIMEOUT_MS,\n\t\t});\n\t\tconst trimmedUpstream = upstream.trim();\n\t\tif (!trimmedUpstream.startsWith(\"origin/\")) throw new Error(`Unsupported upstream remote: ${trimmedUpstream}`);\n\t\tconst branch = trimmedUpstream.slice(\"origin/\".length);\n\t\tif (!branch) throw new Error(\"Missing upstream branch name\");\n\t\tconst head = await captureGitProcess(context, \"git\", [\"rev-parse\", \"@{upstream}\"], {\n\t\t\tcwd: installedPath,\n\t\t\ttimeoutMs: NETWORK_TIMEOUT_MS,\n\t\t});\n\t\treturn {\n\t\t\tref: \"@{upstream}\",\n\t\t\thead,\n\t\t\tfetchArgs: [\"fetch\", \"--prune\", \"--no-tags\", \"origin\", `+refs/heads/${branch}:refs/remotes/origin/${branch}`],\n\t\t};\n\t} catch {\n\t\tawait runGitProcess(context, \"git\", [\"remote\", \"set-head\", \"origin\", \"-a\"], { cwd: installedPath }).catch(\n\t\t\t() => {},\n\t\t);\n\t\tconst head = await captureGitProcess(context, \"git\", [\"rev-parse\", \"origin/HEAD\"], {\n\t\t\tcwd: installedPath,\n\t\t\ttimeoutMs: NETWORK_TIMEOUT_MS,\n\t\t});\n\t\tconst originHeadRef = await captureGitProcess(context, \"git\", [\"symbolic-ref\", \"refs/remotes/origin/HEAD\"], {\n\t\t\tcwd: installedPath,\n\t\t\ttimeoutMs: NETWORK_TIMEOUT_MS,\n\t\t}).catch(() => \"\");\n\t\tconst branch = originHeadRef.trim().replace(/^refs\\/remotes\\/origin\\//, \"\");\n\t\tif (branch) {\n\t\t\treturn {\n\t\t\t\tref: \"origin/HEAD\",\n\t\t\t\thead,\n\t\t\t\tfetchArgs: [\n\t\t\t\t\t\"fetch\",\n\t\t\t\t\t\"--prune\",\n\t\t\t\t\t\"--no-tags\",\n\t\t\t\t\t\"origin\",\n\t\t\t\t\t`+refs/heads/${branch}:refs/remotes/origin/${branch}`,\n\t\t\t\t],\n\t\t\t};\n\t\t}\n\t\treturn {\n\t\t\tref: \"origin/HEAD\",\n\t\t\thead,\n\t\t\tfetchArgs: [\"fetch\", \"--prune\", \"--no-tags\", \"origin\", \"+HEAD:refs/remotes/origin/HEAD\"],\n\t\t};\n\t}\n}\n\nasync function getGitUpstreamRef(context: PackageManagerContext, installedPath: string): Promise<string | undefined> {\n\ttry {\n\t\tconst upstream = await captureGitProcess(context, \"git\", [\"rev-parse\", \"--abbrev-ref\", \"@{upstream}\"], {\n\t\t\tcwd: installedPath,\n\t\t\ttimeoutMs: NETWORK_TIMEOUT_MS,\n\t\t});\n\t\tconst trimmed = upstream.trim();\n\t\tif (!trimmed.startsWith(\"origin/\")) return undefined;\n\t\tconst branch = trimmed.slice(\"origin/\".length);\n\t\treturn branch ? `refs/heads/${branch}` : undefined;\n\t} catch {\n\t\treturn undefined;\n\t}\n}\n\nfunction runGitRemoteCommand(context: PackageManagerContext, installedPath: string, args: string[]): Promise<string> {\n\treturn captureGitProcess(context, \"git\", args, {\n\t\tcwd: installedPath,\n\t\ttimeoutMs: NETWORK_TIMEOUT_MS,\n\t\tenv: { GIT_TERMINAL_PROMPT: \"0\" },\n\t});\n}\n"]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { PiManifest, ResourceType } from "./package-manager-types.ts";
|
|
2
|
-
export declare function getManifestFromPackageJson(pkg:
|
|
2
|
+
export declare function getManifestFromPackageJson(pkg: unknown): PiManifest | null;
|
|
3
3
|
export declare function readPiManifestFile(packageJsonPath: string): PiManifest | null;
|
|
4
4
|
export declare function readPiManifest(packageRoot: string): PiManifest | null;
|
|
5
5
|
export declare function conventionDirsForResource(packageRoot: string, resourceType: ResourceType): string[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"package-manager-manifest.d.ts","sourceRoot":"","sources":["../../src/core/package-manager-manifest.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;
|
|
1
|
+
{"version":3,"file":"package-manager-manifest.d.ts","sourceRoot":"","sources":["../../src/core/package-manager-manifest.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAoB3E,wBAAgB,0BAA0B,CAAC,GAAG,EAAE,OAAO,GAAG,UAAU,GAAG,IAAI,CAG1E;AAED,wBAAgB,kBAAkB,CAAC,eAAe,EAAE,MAAM,GAAG,UAAU,GAAG,IAAI,CAQ7E;AAED,wBAAgB,cAAc,CAAC,WAAW,EAAE,MAAM,GAAG,UAAU,GAAG,IAAI,CAMrE;AAED,wBAAgB,yBAAyB,CAAC,WAAW,EAAE,MAAM,EAAE,YAAY,EAAE,YAAY,GAAG,MAAM,EAAE,CAKnG;AAED,wBAAgB,0BAA0B,CACzC,QAAQ,EAAE,UAAU,GAAG,IAAI,EAC3B,YAAY,EAAE,YAAY,GACxB,MAAM,EAAE,GAAG,SAAS,CAItB"}
|
|
@@ -1,16 +1,26 @@
|
|
|
1
1
|
import { existsSync, readFileSync } from "node:fs";
|
|
2
2
|
import { join } from "node:path";
|
|
3
3
|
import { APP_NAME } from "../config.js";
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
4
|
+
const MANIFEST_ENTRY_FIELDS = ["extensions", "skills", "prompts", "themes", "workflows", "workflow"];
|
|
5
|
+
function isRecord(value) {
|
|
6
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
7
|
+
}
|
|
8
|
+
function sanitizeManifest(value) {
|
|
9
|
+
if (!isRecord(value))
|
|
10
|
+
return null;
|
|
11
|
+
const manifest = {};
|
|
12
|
+
for (const field of MANIFEST_ENTRY_FIELDS) {
|
|
13
|
+
const entries = value[field];
|
|
14
|
+
if (Array.isArray(entries) && entries.every((entry) => typeof entry === "string")) {
|
|
15
|
+
manifest[field] = entries;
|
|
16
|
+
}
|
|
12
17
|
}
|
|
13
|
-
return
|
|
18
|
+
return manifest;
|
|
19
|
+
}
|
|
20
|
+
export function getManifestFromPackageJson(pkg) {
|
|
21
|
+
if (!isRecord(pkg))
|
|
22
|
+
return null;
|
|
23
|
+
return sanitizeManifest(pkg[APP_NAME]) ?? sanitizeManifest(pkg.pi);
|
|
14
24
|
}
|
|
15
25
|
export function readPiManifestFile(packageJsonPath) {
|
|
16
26
|
try {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"package-manager-manifest.js","sourceRoot":"","sources":["../../src/core/package-manager-manifest.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACnD,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AAGxC,MAAM,
|
|
1
|
+
{"version":3,"file":"package-manager-manifest.js","sourceRoot":"","sources":["../../src/core/package-manager-manifest.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACnD,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AAGxC,MAAM,qBAAqB,GAAG,CAAC,YAAY,EAAE,QAAQ,EAAE,SAAS,EAAE,QAAQ,EAAE,WAAW,EAAE,UAAU,CAAU,CAAC;AAE9G,SAAS,QAAQ,CAAC,KAAc;IAC/B,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;AAC7E,CAAC;AAED,SAAS,gBAAgB,CAAC,KAAc;IACvC,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC;QAAE,OAAO,IAAI,CAAC;IAClC,MAAM,QAAQ,GAAe,EAAE,CAAC;IAChC,KAAK,MAAM,KAAK,IAAI,qBAAqB,EAAE,CAAC;QAC3C,MAAM,OAAO,GAAG,KAAK,CAAC,KAAK,CAAC,CAAC;QAC7B,IAAI,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,IAAI,OAAO,CAAC,KAAK,CAAC,CAAC,KAAK,EAAmB,EAAE,CAAC,OAAO,KAAK,KAAK,QAAQ,CAAC,EAAE,CAAC;YACpG,QAAQ,CAAC,KAAK,CAAC,GAAG,OAAO,CAAC;QAC3B,CAAC;IAC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AAI,YAAY,KAAK,WAAW;QAAE,OAAO,QAAQ,CAAC,SAAS,IAAI,QAAQ,CAAC,QAAQ,CAAC;IACjF,OAAO,QAAQ,CAAC,YAAY,CAAC,CAAC;AAC/B,CAAC","sourcesContent":["import { existsSync, readFileSync } from \"node:fs\";\nimport { join } from \"node:path\";\nimport { APP_NAME } from \"../config.ts\";\nimport type { PiManifest, ResourceType } from \"./package-manager-types.ts\";\n\nconst MANIFEST_ENTRY_FIELDS = [\"extensions\", \"skills\", \"prompts\", \"themes\", \"workflows\", \"workflow\"] as const;\n\nfunction isRecord(value: unknown): value is Record<string, unknown> {\n\treturn typeof value === \"object\" && value !== null && !Array.isArray(value);\n}\n\nfunction sanitizeManifest(value: unknown): PiManifest | null {\n\tif (!isRecord(value)) return null;\n\tconst manifest: PiManifest = {};\n\tfor (const field of MANIFEST_ENTRY_FIELDS) {\n\t\tconst entries = value[field];\n\t\tif (Array.isArray(entries) && entries.every((entry): entry is string => typeof entry === \"string\")) {\n\t\t\tmanifest[field] = entries;\n\t\t}\n\t}\n\treturn manifest;\n}\n\nexport function getManifestFromPackageJson(pkg: unknown): PiManifest | null {\n\tif (!isRecord(pkg)) return null;\n\treturn sanitizeManifest(pkg[APP_NAME]) ?? sanitizeManifest(pkg.pi);\n}\n\nexport function readPiManifestFile(packageJsonPath: string): PiManifest | null {\n\ttry {\n\t\tconst content = readFileSync(packageJsonPath, \"utf-8\");\n\t\tconst pkg = JSON.parse(content) as Record<string, unknown>;\n\t\treturn getManifestFromPackageJson(pkg);\n\t} catch {\n\t\treturn null;\n\t}\n}\n\nexport function readPiManifest(packageRoot: string): PiManifest | null {\n\tconst packageJsonPath = join(packageRoot, \"package.json\");\n\tif (!existsSync(packageJsonPath)) {\n\t\treturn null;\n\t}\n\treturn readPiManifestFile(packageJsonPath);\n}\n\nexport function conventionDirsForResource(packageRoot: string, resourceType: ResourceType): string[] {\n\tif (resourceType === \"workflows\") {\n\t\treturn [join(packageRoot, \"workflows\"), join(packageRoot, \"workflow\")];\n\t}\n\treturn [join(packageRoot, resourceType)];\n}\n\nexport function manifestEntriesForResource(\n\tmanifest: PiManifest | null,\n\tresourceType: ResourceType,\n): string[] | undefined {\n\tif (!manifest) return undefined;\n\tif (resourceType === \"workflows\") return manifest.workflows ?? manifest.workflow;\n\treturn manifest[resourceType];\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"package-manager-resource-collector.js","sourceRoot":"","sources":["../../src/core/package-manager-resource-collector.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAC1D,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAC5B,OAAO,EACN,yBAAyB,EACzB,0BAA0B,EAC1B,0BAA0B,GAC1B,MAAM,+BAA+B,CAAC;AACvC,OAAO,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AACjE,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,2CAA2C,CAAC;AACtF,OAAO,EAAE,oBAAoB,EAAE,MAAM,qCAAqC,CAAC;AAC3E,OAAO,EACN,6BAA6B,EAC7B,aAAa,EACb,cAAc,EACd,iBAAiB,EACjB,aAAa,GACb,MAAM,wCAAwC,CAAC;AAShD,KAAK,UAAU,MAAM,CAAC,IAAY;IACjC,IAAI,CAAC;QACJ,MAAM,MAAM,CAAC,IAAI,CAAC,CAAC;QACnB,OAAO,IAAI,CAAC;IACb,CAAC;IAAC,MAAM,CAAC;QACR,OAAO,KAAK,CAAC;IACd,CAAC;AACF,CAAC;AAED,KAAK,UAAU,cAAc,CAAC,WAAmB;IAChD,IAAI,CAAC;QACJ,MAAM,OAAO,GAAG,MAAM,QAAQ,CAAC,OAAO,CAAC,WAAW,EAAE,cAAc,CAAC,EAAE,OAAO,CAAC,CAAC;QAC9E,OAAO,0BAA0B,CA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;IACjC,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,GAAG,aAAa,CAAC,OAAO,CAAC,CAAC;IACnD,MAAM,aAAa,GAAG,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,mBAAmB,CAAC,CAAC,EAAE,OAAO,CAAC,CAAC,CAAC;IACxE,MAAM,QAAQ,GAAG,MAAM,qBAAqB,CAAC,aAAa,EAAE,YAAY,CAAC,CAAC;IAC1E,MAAM,YAAY,GAAG,aAAa,CAAC,QAAQ,EAAE,QAAQ,EAAE,OAAO,CAAC,CAAC;IAChE,KAAK,MAAM,CAAC,IAAI,QAAQ;QAAE,WAAW,CAAC,MAAM,EAAE,CAAC,EAAE,QAAQ,EAAE,YAAY,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;AACjF,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,qBAAqB,CAAC,KAAe,EAAE,YAA0B;IACtF,MAAM,KAAK,GAAa,EAAE,CAAC;IAC3B,KAAK,MAAM,CAAC,IAAI,KAAK,EAAE,CAAC;QACvB,IAAI,CAAC,CAAC,MAAM,MAAM,CAAC,CAAC,CAAC,CAAC;YAAE,SAAS;QACjC,IAAI,CAAC;YACJ,MAAM,KAAK,GAAG,MAAM,IAAI,CAAC,CAAC,CAAC,CAAC;YAC5B,IAAI,KAAK,CAAC,MAAM,EAAE;gBAAE,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;iBAC7B,IAAI,KAAK,CAAC,WAAW,EAAE;gBAAE,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,MAAM,oBAAoB,CAAC,CAAC,EAAE,YAAY,CAAC,CAAC,CAAC,CAAC;QAC5F,CAAC;QAAC,MAAM,CAAC,CAAA,CAAC;IACX,CAAC;IACD,OAAO,KAAK,CAAC;AACd,CAAC","sourcesContent":["import { access, readFile, stat } from \"node:fs/promises\";\nimport { resolve } from \"node:path\";\nimport { glob } from \"glob\";\nimport {\n\tconventionDirsForResource,\n\tgetManifestFromPackageJson,\n\tmanifestEntriesForResource,\n} from \"./package-manager-manifest.ts\";\nimport { resolvePathFromBase } from \"./package-manager-paths.ts\";\nimport { addResource, getTargetMap } from \"./package-manager-resource-accumulator.ts\";\nimport { collectResourceFiles } from \"./package-manager-resource-files.ts\";\nimport {\n\tapplyAutoloadDisabledPatterns,\n\tapplyPatterns,\n\thasGlobPattern,\n\tisOverridePattern,\n\tsplitPatterns,\n} from \"./package-manager-resource-patterns.ts\";\nimport type {\n\tPackageFilter,\n\tPathMetadata,\n\tResourceAccumulator,\n\tResourceMap,\n\tResourceType,\n} from \"./package-manager-types.ts\";\n\nasync function exists(path: string): Promise<boolean> {\n\ttry {\n\t\tawait access(path);\n\t\treturn true;\n\t} catch {\n\t\treturn false;\n\t}\n}\n\nasync function readPiManifest(packageRoot: string): Promise<ReturnType<typeof getManifestFromPackageJson> | null> {\n\ttry {\n\t\tconst content = await readFile(resolve(packageRoot, \"package.json\"), \"utf-8\");\n\t\treturn getManifestFromPackageJson(JSON.parse(content) as Record<string, unknown>);\n\t} catch {\n\t\treturn null;\n\t}\n}\n\nexport async function collectPackageResources(\n\tpackageRoot: string,\n\taccumulator: ResourceAccumulator,\n\tfilter: PackageFilter | undefined,\n\tmetadata: PathMetadata,\n): Promise<boolean> {\n\tif (filter) {\n\t\tfor (const resourceType of [\"extensions\", \"skills\", \"prompts\", \"themes\", \"workflows\"] as const) {\n\t\t\tconst patterns = filter[resourceType];\n\t\t\tconst target = getTargetMap(accumulator, resourceType);\n\t\t\tif (filter.autoload === false) {\n\t\t\t\tconst { allFiles } = await collectManifestFiles(packageRoot, resourceType);\n\t\t\t\tconst selected = applyAutoloadDisabledPatterns(allFiles, patterns ?? [], packageRoot);\n\t\t\t\tfor (const [filePath, enabled] of selected) addResource(target, filePath, metadata, enabled);\n\t\t\t} else if (patterns !== undefined)\n\t\t\t\tawait applyPackageFilter(packageRoot, patterns, resourceType, target, metadata);\n\t\t\telse await collectDefaultResources(packageRoot, resourceType, target, metadata);\n\t\t}\n\t\treturn true;\n\t}\n\tconst manifest = await readPiManifest(packageRoot);\n\tif (manifest) {\n\t\tfor (const resourceType of [\"extensions\", \"skills\", \"prompts\", \"themes\", \"workflows\"] as const) {\n\t\t\tconst entries = manifestEntriesForResource(manifest, resourceType);\n\t\t\tif (entries !== undefined) {\n\t\t\t\tawait addManifestEntries(\n\t\t\t\t\tentries,\n\t\t\t\t\tpackageRoot,\n\t\t\t\t\tresourceType,\n\t\t\t\t\tgetTargetMap(accumulator, resourceType),\n\t\t\t\t\tmetadata,\n\t\t\t\t);\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tif (resourceType === \"workflows\")\n\t\t\t\tawait collectDefaultResources(packageRoot, resourceType, getTargetMap(accumulator, resourceType), metadata);\n\t\t}\n\t\treturn true;\n\t}\n\tlet hasAnyDir = false;\n\tfor (const resourceType of [\"extensions\", \"skills\", \"prompts\", \"themes\", \"workflows\"] as const) {\n\t\tfor (const dir of conventionDirsForResource(packageRoot, resourceType)) {\n\t\t\tif (!(await exists(dir))) continue;\n\t\t\tfor (const f of await collectResourceFiles(dir, resourceType))\n\t\t\t\taddResource(getTargetMap(accumulator, resourceType), f, metadata, true);\n\t\t\thasAnyDir = true;\n\t\t}\n\t}\n\treturn hasAnyDir;\n}\n\nasync function collectDefaultResources(\n\tpackageRoot: string,\n\tresourceType: ResourceType,\n\ttarget: ResourceMap,\n\tmetadata: PathMetadata,\n): Promise<void> {\n\tconst manifest = await readPiManifest(packageRoot);\n\tconst entries = manifestEntriesForResource(manifest, resourceType);\n\tif (entries !== undefined) {\n\t\tawait addManifestEntries(entries, packageRoot, resourceType, target, metadata);\n\t\treturn;\n\t}\n\tfor (const dir of conventionDirsForResource(packageRoot, resourceType)) {\n\t\tif (!(await exists(dir))) continue;\n\t\tfor (const f of await collectResourceFiles(dir, resourceType)) addResource(target, f, metadata, true);\n\t}\n}\n\nasync function applyPackageFilter(\n\tpackageRoot: string,\n\tuserPatterns: string[],\n\tresourceType: ResourceType,\n\ttarget: ResourceMap,\n\tmetadata: PathMetadata,\n): Promise<void> {\n\tconst { allFiles } = await collectManifestFiles(packageRoot, resourceType);\n\tif (userPatterns.length === 0) {\n\t\tfor (const f of allFiles) addResource(target, f, metadata, false);\n\t\treturn;\n\t}\n\tconst enabledByUser = applyPatterns(allFiles, userPatterns, packageRoot);\n\tfor (const f of allFiles) addResource(target, f, metadata, enabledByUser.has(f));\n}\n\nasync function collectManifestFiles(\n\tpackageRoot: string,\n\tresourceType: ResourceType,\n): Promise<{ allFiles: string[]; enabledByManifest: Set<string> }> {\n\tconst manifest = await readPiManifest(packageRoot);\n\tconst entries = manifestEntriesForResource(manifest, resourceType);\n\tif (entries && entries.length > 0) {\n\t\tconst allFiles = await collectFilesFromManifestEntries(entries, packageRoot, resourceType);\n\t\tconst manifestPatterns = entries.filter(isOverridePattern);\n\t\tconst enabledByManifest =\n\t\t\tmanifestPatterns.length > 0 ? applyPatterns(allFiles, manifestPatterns, packageRoot) : new Set(allFiles);\n\t\treturn { allFiles: Array.from(enabledByManifest), enabledByManifest };\n\t}\n\tconst allFiles: string[] = [];\n\tfor (const dir of conventionDirsForResource(packageRoot, resourceType)) {\n\t\tif (await exists(dir)) allFiles.push(...(await collectResourceFiles(dir, resourceType)));\n\t}\n\treturn { allFiles, enabledByManifest: new Set(allFiles) };\n}\n\nasync function addManifestEntries(\n\tentries: string[] | undefined,\n\troot: string,\n\tresourceType: ResourceType,\n\ttarget: ResourceMap,\n\tmetadata: PathMetadata,\n): Promise<void> {\n\tif (!entries) return;\n\tconst allFiles = await collectFilesFromManifestEntries(entries, root, resourceType);\n\tconst patterns = entries.filter(isOverridePattern);\n\tconst enabledPaths = applyPatterns(allFiles, patterns, root);\n\tfor (const f of allFiles) if (enabledPaths.has(f)) addResource(target, f, metadata, true);\n}\n\nasync function collectFilesFromManifestEntries(\n\tentries: string[],\n\troot: string,\n\tresourceType: ResourceType,\n): Promise<string[]> {\n\tconst resolved: string[] = [];\n\tfor (const entry of entries.filter((entry) => !isOverridePattern(entry))) {\n\t\tif (!hasGlobPattern(entry)) resolved.push(resolve(root, entry));\n\t\telse\n\t\t\tresolved.push(\n\t\t\t\t...(await glob(entry, { cwd: root, absolute: true, dot: false, nodir: false })).map((match) =>\n\t\t\t\t\tresolve(match),\n\t\t\t\t),\n\t\t\t);\n\t}\n\treturn collectFilesFromPaths(resolved, resourceType);\n}\n\nexport async function resolveLocalEntries(\n\tentries: string[],\n\tresourceType: ResourceType,\n\ttarget: ResourceMap,\n\tmetadata: PathMetadata,\n\tbaseDir: string,\n): Promise<void> {\n\tif (entries.length === 0) return;\n\tconst { plain, patterns } = splitPatterns(entries);\n\tconst resolvedPlain = plain.map((p) => resolvePathFromBase(p, baseDir));\n\tconst allFiles = await collectFilesFromPaths(resolvedPlain, resourceType);\n\tconst enabledPaths = applyPatterns(allFiles, patterns, baseDir);\n\tfor (const f of allFiles) addResource(target, f, metadata, enabledPaths.has(f));\n}\n\nexport async function collectFilesFromPaths(paths: string[], resourceType: ResourceType): Promise<string[]> {\n\tconst files: string[] = [];\n\tfor (const p of paths) {\n\t\tif (!(await exists(p))) continue;\n\t\ttry {\n\t\t\tconst stats = await stat(p);\n\t\t\tif (stats.isFile()) files.push(p);\n\t\t\telse if (stats.isDirectory()) files.push(...(await collectResourceFiles(p, resourceType)));\n\t\t} catch {}\n\t}\n\treturn files;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"package-manager-resource-collector.js","sourceRoot":"","sources":["../../src/core/package-manager-resource-collector.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAC1D,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAC5B,OAAO,EACN,yBAAyB,EACzB,0BAA0B,EAC1B,0BAA0B,GAC1B,MAAM,+BAA+B,CAAC;AACvC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,KAAK,GAAa,EAAE,CAAC;IAC3B,KAAK,MAAM,CAAC,IAAI,KAAK,EAAE,CAAC;QACvB,IAAI,CAAC,CAAC,MAAM,MAAM,CAAC,CAAC,CAAC,CAAC;YAAE,SAAS;QACjC,IAAI,CAAC;YACJ,MAAM,KAAK,GAAG,MAAM,IAAI,CAAC,CAAC,CAAC,CAAC;YAC5B,IAAI,KAAK,CAAC,MAAM,EAAE;gBAAE,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;iBAC7B,IAAI,KAAK,CAAC,WAAW,EAAE;gBAAE,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,MAAM,oBAAoB,CAAC,CAAC,EAAE,YAAY,CAAC,CAAC,CAAC,CAAC;QAC5F,CAAC;QAAC,MAAM,CAAC,CAAA,CAAC;IACX,CAAC;IACD,OAAO,KAAK,CAAC;AACd,CAAC","sourcesContent":["import { access, readFile, stat } from \"node:fs/promises\";\nimport { resolve } from \"node:path\";\nimport { glob } from \"glob\";\nimport {\n\tconventionDirsForResource,\n\tgetManifestFromPackageJson,\n\tmanifestEntriesForResource,\n} from \"./package-manager-manifest.ts\";\nimport { resolvePathFromBase } from \"./package-manager-paths.ts\";\nimport { addResource, getTargetMap } from \"./package-manager-resource-accumulator.ts\";\nimport { collectResourceFiles } from \"./package-manager-resource-files.ts\";\nimport {\n\tapplyAutoloadDisabledPatterns,\n\tapplyPatterns,\n\thasGlobPattern,\n\tisOverridePattern,\n\tsplitPatterns,\n} from \"./package-manager-resource-patterns.ts\";\nimport type {\n\tPackageFilter,\n\tPathMetadata,\n\tResourceAccumulator,\n\tResourceMap,\n\tResourceType,\n} from \"./package-manager-types.ts\";\n\nasync function exists(path: string): Promise<boolean> {\n\ttry {\n\t\tawait access(path);\n\t\treturn true;\n\t} catch {\n\t\treturn false;\n\t}\n}\n\nasync function readPiManifest(packageRoot: string): Promise<ReturnType<typeof getManifestFromPackageJson> | null> {\n\ttry {\n\t\tconst content = await readFile(resolve(packageRoot, \"package.json\"), \"utf-8\");\n\t\treturn getManifestFromPackageJson(JSON.parse(content));\n\t} catch {\n\t\treturn null;\n\t}\n}\n\nexport async function collectPackageResources(\n\tpackageRoot: string,\n\taccumulator: ResourceAccumulator,\n\tfilter: PackageFilter | undefined,\n\tmetadata: PathMetadata,\n): Promise<boolean> {\n\tif (filter) {\n\t\tfor (const resourceType of [\"extensions\", \"skills\", \"prompts\", \"themes\", \"workflows\"] as const) {\n\t\t\tconst patterns = filter[resourceType];\n\t\t\tconst target = getTargetMap(accumulator, resourceType);\n\t\t\tif (filter.autoload === false) {\n\t\t\t\tconst { allFiles } = await collectManifestFiles(packageRoot, resourceType);\n\t\t\t\tconst selected = applyAutoloadDisabledPatterns(allFiles, patterns ?? [], packageRoot);\n\t\t\t\tfor (const [filePath, enabled] of selected) addResource(target, filePath, metadata, enabled);\n\t\t\t} else if (patterns !== undefined)\n\t\t\t\tawait applyPackageFilter(packageRoot, patterns, resourceType, target, metadata);\n\t\t\telse await collectDefaultResources(packageRoot, resourceType, target, metadata);\n\t\t}\n\t\treturn true;\n\t}\n\tconst manifest = await readPiManifest(packageRoot);\n\tif (manifest) {\n\t\tfor (const resourceType of [\"extensions\", \"skills\", \"prompts\", \"themes\", \"workflows\"] as const) {\n\t\t\tconst entries = manifestEntriesForResource(manifest, resourceType);\n\t\t\tif (entries !== undefined) {\n\t\t\t\tawait addManifestEntries(\n\t\t\t\t\tentries,\n\t\t\t\t\tpackageRoot,\n\t\t\t\t\tresourceType,\n\t\t\t\t\tgetTargetMap(accumulator, resourceType),\n\t\t\t\t\tmetadata,\n\t\t\t\t);\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tif (resourceType === \"workflows\")\n\t\t\t\tawait collectDefaultResources(packageRoot, resourceType, getTargetMap(accumulator, resourceType), metadata);\n\t\t}\n\t\treturn true;\n\t}\n\tlet hasAnyDir = false;\n\tfor (const resourceType of [\"extensions\", \"skills\", \"prompts\", \"themes\", \"workflows\"] as const) {\n\t\tfor (const dir of conventionDirsForResource(packageRoot, resourceType)) {\n\t\t\tif (!(await exists(dir))) continue;\n\t\t\tfor (const f of await collectResourceFiles(dir, resourceType))\n\t\t\t\taddResource(getTargetMap(accumulator, resourceType), f, metadata, true);\n\t\t\thasAnyDir = true;\n\t\t}\n\t}\n\treturn hasAnyDir;\n}\n\nasync function collectDefaultResources(\n\tpackageRoot: string,\n\tresourceType: ResourceType,\n\ttarget: ResourceMap,\n\tmetadata: PathMetadata,\n): Promise<void> {\n\tconst manifest = await readPiManifest(packageRoot);\n\tconst entries = manifestEntriesForResource(manifest, resourceType);\n\tif (entries !== undefined) {\n\t\tawait addManifestEntries(entries, packageRoot, resourceType, target, metadata);\n\t\treturn;\n\t}\n\tfor (const dir of conventionDirsForResource(packageRoot, resourceType)) {\n\t\tif (!(await exists(dir))) continue;\n\t\tfor (const f of await collectResourceFiles(dir, resourceType)) addResource(target, f, metadata, true);\n\t}\n}\n\nasync function applyPackageFilter(\n\tpackageRoot: string,\n\tuserPatterns: string[],\n\tresourceType: ResourceType,\n\ttarget: ResourceMap,\n\tmetadata: PathMetadata,\n): Promise<void> {\n\tconst { allFiles } = await collectManifestFiles(packageRoot, resourceType);\n\tif (userPatterns.length === 0) {\n\t\tfor (const f of allFiles) addResource(target, f, metadata, false);\n\t\treturn;\n\t}\n\tconst enabledByUser = applyPatterns(allFiles, userPatterns, packageRoot);\n\tfor (const f of allFiles) addResource(target, f, metadata, enabledByUser.has(f));\n}\n\nasync function collectManifestFiles(\n\tpackageRoot: string,\n\tresourceType: ResourceType,\n): Promise<{ allFiles: string[]; enabledByManifest: Set<string> }> {\n\tconst manifest = await readPiManifest(packageRoot);\n\tconst entries = manifestEntriesForResource(manifest, resourceType);\n\tif (entries && entries.length > 0) {\n\t\tconst allFiles = await collectFilesFromManifestEntries(entries, packageRoot, resourceType);\n\t\tconst manifestPatterns = entries.filter(isOverridePattern);\n\t\tconst enabledByManifest =\n\t\t\tmanifestPatterns.length > 0 ? applyPatterns(allFiles, manifestPatterns, packageRoot) : new Set(allFiles);\n\t\treturn { allFiles: Array.from(enabledByManifest), enabledByManifest };\n\t}\n\tconst allFiles: string[] = [];\n\tfor (const dir of conventionDirsForResource(packageRoot, resourceType)) {\n\t\tif (await exists(dir)) allFiles.push(...(await collectResourceFiles(dir, resourceType)));\n\t}\n\treturn { allFiles, enabledByManifest: new Set(allFiles) };\n}\n\nasync function addManifestEntries(\n\tentries: string[] | undefined,\n\troot: string,\n\tresourceType: ResourceType,\n\ttarget: ResourceMap,\n\tmetadata: PathMetadata,\n): Promise<void> {\n\tif (!entries) return;\n\tconst allFiles = await collectFilesFromManifestEntries(entries, root, resourceType);\n\tconst patterns = entries.filter(isOverridePattern);\n\tconst enabledPaths = applyPatterns(allFiles, patterns, root);\n\tfor (const f of allFiles) if (enabledPaths.has(f)) addResource(target, f, metadata, true);\n}\n\nasync function collectFilesFromManifestEntries(\n\tentries: string[],\n\troot: string,\n\tresourceType: ResourceType,\n): Promise<string[]> {\n\tconst resolved: string[] = [];\n\tfor (const entry of entries.filter((entry) => !isOverridePattern(entry))) {\n\t\tif (!hasGlobPattern(entry)) resolved.push(resolve(root, entry));\n\t\telse\n\t\t\tresolved.push(\n\t\t\t\t...(await glob(entry, { cwd: root, absolute: true, dot: false, nodir: false })).map((match) =>\n\t\t\t\t\tresolve(match),\n\t\t\t\t),\n\t\t\t);\n\t}\n\treturn collectFilesFromPaths(resolved, resourceType);\n}\n\nexport async function resolveLocalEntries(\n\tentries: string[],\n\tresourceType: ResourceType,\n\ttarget: ResourceMap,\n\tmetadata: PathMetadata,\n\tbaseDir: string,\n): Promise<void> {\n\tif (entries.length === 0) return;\n\tconst { plain, patterns } = splitPatterns(entries);\n\tconst resolvedPlain = plain.map((p) => resolvePathFromBase(p, baseDir));\n\tconst allFiles = await collectFilesFromPaths(resolvedPlain, resourceType);\n\tconst enabledPaths = applyPatterns(allFiles, patterns, baseDir);\n\tfor (const f of allFiles) addResource(target, f, metadata, enabledPaths.has(f));\n}\n\nexport async function collectFilesFromPaths(paths: string[], resourceType: ResourceType): Promise<string[]> {\n\tconst files: string[] = [];\n\tfor (const p of paths) {\n\t\tif (!(await exists(p))) continue;\n\t\ttry {\n\t\t\tconst stats = await stat(p);\n\t\t\tif (stats.isFile()) files.push(p);\n\t\t\telse if (stats.isDirectory()) files.push(...(await collectResourceFiles(p, resourceType)));\n\t\t} catch {}\n\t}\n\treturn files;\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"package-manager-resource-files.d.ts","sourceRoot":"","sources":["../../src/core/package-manager-resource-files.ts"],"names":[],"mappings":"AAEA,OAAO,MAAM,MAAM,QAAQ,CAAC;AAI5B,OAAO,EAAiB,KAAK,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAI9E,KAAK,aAAa,GAAG,UAAU,CAAC,OAAO,MAAM,CAAC,CAAC;AAC/C,KAAK,kBAAkB,GAAG,IAAI,GAAG,QAAQ,CAAC;AAoE1C,wBAAsB,YAAY,CACjC,GAAG,EAAE,MAAM,EACX,WAAW,EAAE,MAAM,EACnB,eAAe,UAAO,EACtB,aAAa,CAAC,EAAE,aAAa,EAC7B,OAAO,CAAC,EAAE,MAAM,GACd,OAAO,CAAC,MAAM,EAAE,CAAC,CAsBnB;AA2CD,wBAAsB,uBAAuB,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,kBAAkB,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,CAEtG;AAYD,wBAAsB,8BAA8B,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,CAaxF;AAuBD,wBAAsB,wBAAwB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,CAE7E;AAED,wBAAsB,uBAAuB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,CAE5E;AAED,wBAAsB,uBAAuB,CAAC,GAAG,EAAE,MAAM,GAAG,O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rG;AAED,wBAAgB,WAAW,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAOjE"}
|
|
@@ -203,8 +203,7 @@ export async function resolveExtensionEntries(dir) {
|
|
|
203
203
|
const packageJsonPath = join(dir, "package.json");
|
|
204
204
|
if (await exists(packageJsonPath)) {
|
|
205
205
|
try {
|
|
206
|
-
const
|
|
207
|
-
const manifest = getManifestFromPackageJson(pkg);
|
|
206
|
+
const manifest = getManifestFromPackageJson(JSON.parse(await readFile(packageJsonPath, "utf-8")));
|
|
208
207
|
if (manifest?.extensions?.length) {
|
|
209
208
|
const entries = [];
|
|
210
209
|
for (const extPath of manifest.extensions) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"package-manager-resource-files.js","sourceRoot":"","sources":["../../src/core/package-manager-resource-files.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AACnE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,WAAW,CAAC;AAClE,OAAO,MAAM,MAAM,QAAQ,CAAC;AAC5B,OAAO,EAAE,sBAAsB,EAAE,MAAM,wBAAwB,CAAC;AAChE,OAAO,EAAE,0BAA0B,EAAE,MAAM,+BAA+B,CAAC;AAC3E,OAAO,EAAE,WAAW,EAAE,MAAM,wCAAwC,CAAC;AACrE,OAAO,EAAE,aAAa,EAAqB,MAAM,4BAA4B,CAAC;AAE9E,MAAM,iBAAiB,GAAG,CAAC,YAAY,EAAE,SAAS,EAAE,WAAW,CAAC,CAAC;AACjE,MAAM,iCAAiC,GAAG,CAAC,CAAC;AAU5C,KAAK,UAAU,MAAM,CAAC,IAAY;IACjC,IAAI,CAAC;QACJ,MAAM,MAAM,CAAC,IAAI,CAAC,CAAC;QACnB,OAAO,IAAI,CAAC;IACb,CAAC;IAAC,MAA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I,CAAC,CAAC;IACnC,MAAM,cAAc,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IACvC,OAAO,CACN,cAAc,KAAK,YAAY;QAC/B,cAAc,CAAC,UAAU,CAAC,YAAY,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,GAAG,YAAY,GAAG,GAAG,EAAE,CAAC,CAC9F,CAAC;AACH,CAAC","sourcesContent":["import { access, readdir, readFile, stat } from \"node:fs/promises\";\nimport { dirname, join, relative, resolve, sep } from \"node:path\";\nimport ignore from \"ignore\";\nimport { yieldToEventLoopIfSlow } from \"../utils/event-loop.ts\";\nimport { getManifestFromPackageJson } from \"./package-manager-manifest.ts\";\nimport { toPosixPath } from \"./package-manager-resource-patterns.ts\";\nimport { FILE_PATTERNS, type ResourceType } from \"./package-manager-types.ts\";\n\nconst IGNORE_FILE_NAMES = [\".gitignore\", \".ignore\", \".fdignore\"];\nconst RESOURCE_DISCOVERY_YIELD_AFTER_MS = 8;\ntype IgnoreMatcher = ReturnType<typeof ignore>;\ntype SkillDiscoveryMode = \"pi\" | \"agents\";\n\ntype DirEntryInfo = {\n\tfullPath: string;\n\tisDir: boolean;\n\tisFile: boolean;\n};\n\nasync function exists(path: string): Promise<boolean> {\n\ttry {\n\t\tawait access(path);\n\t\treturn true;\n\t} catch {\n\t\treturn false;\n\t}\n}\n\nfunction prefixIgnorePattern(line: string, prefix: string): string | null {\n\tconst trimmed = line.trim();\n\tif (!trimmed || (trimmed.startsWith(\"#\") && !trimmed.startsWith(\"\\\\#\"))) return null;\n\tlet pattern = line;\n\tlet negated = false;\n\tif (pattern.startsWith(\"!\")) {\n\t\tnegated = true;\n\t\tpattern = pattern.slice(1);\n\t} else if (pattern.startsWith(\"\\\\!\")) pattern = pattern.slice(1);\n\tif (pattern.startsWith(\"/\")) pattern = pattern.slice(1);\n\tconst prefixed = prefix ? `${prefix}${pattern}` : pattern;\n\treturn negated ? `!${prefixed}` : prefixed;\n}\n\nasync function addIgnoreRules(ig: IgnoreMatcher, dir: string, rootDir: string): Promise<void> {\n\tconst relativeDir = relative(rootDir, dir);\n\tconst prefix = relativeDir ? `${toPosixPath(relativeDir)}/` : \"\";\n\tfor (const filename of IGNORE_FILE_NAMES) {\n\t\ttry {\n\t\t\tconst content = await readFile(join(dir, filename), \"utf-8\");\n\t\t\tconst patterns = content\n\t\t\t\t.split(/\\r?\\n/)\n\t\t\t\t.map((line) => prefixIgnorePattern(line, prefix))\n\t\t\t\t.filter((line): line is string => Boolean(line));\n\t\t\tif (patterns.length > 0) ig.add(patterns);\n\t\t} catch {}\n\t}\n}\n\nasync function getEntryInfo(\n\tdir: string,\n\tname: string,\n\tisDirectory: boolean,\n\tisFileEntry: boolean,\n\tisSymlink: boolean,\n): Promise<DirEntryInfo | null> {\n\tconst fullPath = join(dir, name);\n\tlet isDir = isDirectory;\n\tlet isFile = isFileEntry;\n\tif (isSymlink) {\n\t\ttry {\n\t\t\tconst stats = await stat(fullPath);\n\t\t\tisDir = stats.isDirectory();\n\t\t\tisFile = stats.isFile();\n\t\t} catch {\n\t\t\treturn null;\n\t\t}\n\t}\n\treturn { fullPath, isDir, isFile };\n}\n\nexport async function collectFiles(\n\tdir: string,\n\tfilePattern: RegExp,\n\tskipNodeModules = true,\n\tignoreMatcher?: IgnoreMatcher,\n\trootDir?: string,\n): Promise<string[]> {\n\tconst files: string[] = [];\n\tif (!(await exists(dir))) return files;\n\tconst root = rootDir ?? dir;\n\tconst ig = ignoreMatcher ?? ignore();\n\tawait addIgnoreRules(ig, dir, root);\n\tconst startedAt = Date.now();\n\ttry {\n\t\tconst entries = await readdir(dir, { withFileTypes: true });\n\t\tfor (const entry of entries) {\n\t\t\tawait yieldToEventLoopIfSlow(startedAt, RESOURCE_DISCOVERY_YIELD_AFTER_MS);\n\t\t\tif (entry.name.startsWith(\".\") || (skipNodeModules && entry.name === \"node_modules\")) continue;\n\t\t\tconst info = await getEntryInfo(dir, entry.name, entry.isDirectory(), entry.isFile(), entry.isSymbolicLink());\n\t\t\tif (!info) continue;\n\t\t\tconst relPath = toPosixPath(relative(root, info.fullPath));\n\t\t\tconst ignorePath = info.isDir ? `${relPath}/` : relPath;\n\t\t\tif (ig.ignores(ignorePath)) continue;\n\t\t\tif (info.isDir) files.push(...(await collectFiles(info.fullPath, filePattern, skipNodeModules, ig, root)));\n\t\t\telse if (info.isFile && filePattern.test(entry.name)) files.push(info.fullPath);\n\t\t}\n\t} catch {}\n\treturn files;\n}\n\nasync function collectSkillEntries(\n\tdir: string,\n\tmode: SkillDiscoveryMode,\n\tignoreMatcher?: IgnoreMatcher,\n\trootDir?: string,\n): Promise<string[]> {\n\tconst entries: string[] = [];\n\tif (!(await exists(dir))) return entries;\n\tconst root = rootDir ?? dir;\n\tconst ig = ignoreMatcher ?? ignore();\n\tawait addIgnoreRules(ig, dir, root);\n\tconst startedAt = Date.now();\n\ttry {\n\t\tconst dirEntries = await readdir(dir, { withFileTypes: true });\n\t\tfor (const entry of dirEntries) {\n\t\t\tif (entry.name !== \"SKILL.md\") continue;\n\t\t\tconst info = await getEntryInfo(dir, entry.name, entry.isDirectory(), entry.isFile(), entry.isSymbolicLink());\n\t\t\tif (!info) continue;\n\t\t\tconst relPath = toPosixPath(relative(root, info.fullPath));\n\t\t\tif (info.isFile && !ig.ignores(relPath)) {\n\t\t\t\tentries.push(info.fullPath);\n\t\t\t\treturn entries;\n\t\t\t}\n\t\t}\n\t\tfor (const entry of dirEntries) {\n\t\t\tawait yieldToEventLoopIfSlow(startedAt, RESOURCE_DISCOVERY_YIELD_AFTER_MS);\n\t\t\tif (entry.name.startsWith(\".\") || entry.name === \"node_modules\") continue;\n\t\t\tconst info = await getEntryInfo(dir, entry.name, entry.isDirectory(), entry.isFile(), entry.isSymbolicLink());\n\t\t\tif (!info) continue;\n\t\t\tconst relPath = toPosixPath(relative(root, info.fullPath));\n\t\t\tif (mode === \"pi\" && dir === root && info.isFile && entry.name.endsWith(\".md\") && !ig.ignores(relPath)) {\n\t\t\t\tentries.push(info.fullPath);\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tif (!info.isDir || ig.ignores(`${relPath}/`)) continue;\n\t\t\tentries.push(...(await collectSkillEntries(info.fullPath, mode, ig, root)));\n\t\t}\n\t} catch {}\n\treturn entries;\n}\n\nexport async function collectAutoSkillEntries(dir: string, mode: SkillDiscoveryMode): Promise<string[]> {\n\treturn collectSkillEntries(dir, mode);\n}\n\nasync function findGitRepoRoot(startDir: string): Promise<string | null> {\n\tlet dir = resolve(startDir);\n\twhile (true) {\n\t\tif (await exists(join(dir, \".git\"))) return dir;\n\t\tconst parent = dirname(dir);\n\t\tif (parent === dir) return null;\n\t\tdir = parent;\n\t}\n}\n\nexport async function collectAncestorAgentsSkillDirs(startDir: string): Promise<string[]> {\n\tconst skillDirs: string[] = [];\n\tconst resolvedStartDir = resolve(startDir);\n\tconst gitRepoRoot = await findGitRepoRoot(resolvedStartDir);\n\tlet dir = resolvedStartDir;\n\twhile (true) {\n\t\tskillDirs.push(join(dir, \".agents\", \"skills\"));\n\t\tif (gitRepoRoot && dir === gitRepoRoot) break;\n\t\tconst parent = dirname(dir);\n\t\tif (parent === dir) break;\n\t\tdir = parent;\n\t}\n\treturn skillDirs;\n}\n\nasync function collectFlatEntries(dir: string, extension: string): Promise<string[]> {\n\tconst entries: string[] = [];\n\tif (!(await exists(dir))) return entries;\n\tconst ig = ignore();\n\tawait addIgnoreRules(ig, dir, dir);\n\tconst startedAt = Date.now();\n\ttry {\n\t\tconst dirEntries = await readdir(dir, { withFileTypes: true });\n\t\tfor (const entry of dirEntries) {\n\t\t\tawait yieldToEventLoopIfSlow(startedAt, RESOURCE_DISCOVERY_YIELD_AFTER_MS);\n\t\t\tif (entry.name.startsWith(\".\") || entry.name === \"node_modules\") continue;\n\t\t\tconst info = await getEntryInfo(dir, entry.name, entry.isDirectory(), entry.isFile(), entry.isSymbolicLink());\n\t\t\tif (!info) continue;\n\t\t\tconst relPath = toPosixPath(relative(dir, info.fullPath));\n\t\t\tif (ig.ignores(relPath)) continue;\n\t\t\tif (info.isFile && entry.name.endsWith(extension)) entries.push(info.fullPath);\n\t\t}\n\t} catch {}\n\treturn entries;\n}\n\nexport async function collectAutoPromptEntries(dir: string): Promise<string[]> {\n\treturn collectFlatEntries(dir, \".md\");\n}\n\nexport async function collectAutoThemeEntries(dir: string): Promise<string[]> {\n\treturn collectFlatEntries(dir, \".json\");\n}\n\nexport async function resolveExtensionEntries(dir: string): Promise<string[] | null> {\n\tconst packageJsonPath = join(dir, \"package.json\");\n\tif (await exists(packageJsonPath)) {\n\t\ttry {\n\t\t\tconst pkg = JSON.parse(await readFile(packageJsonPath, \"utf-8\")) as Record<string, unknown>;\n\t\t\tconst manifest = getManifestFromPackageJson(pkg);\n\t\t\tif (manifest?.extensions?.length) {\n\t\t\t\tconst entries: string[] = [];\n\t\t\t\tfor (const extPath of manifest.extensions) {\n\t\t\t\t\tconst resolvedExtPath = resolve(dir, extPath);\n\t\t\t\t\tif (await exists(resolvedExtPath)) entries.push(resolvedExtPath);\n\t\t\t\t}\n\t\t\t\tif (entries.length > 0) return entries;\n\t\t\t}\n\t\t} catch {}\n\t}\n\tconst indexTs = join(dir, \"index.ts\");\n\tconst indexJs = join(dir, \"index.js\");\n\tif (await exists(indexTs)) return [indexTs];\n\tif (await exists(indexJs)) return [indexJs];\n\treturn null;\n}\n\nexport async function collectAutoExtensionEntries(dir: string): Promise<string[]> {\n\tconst entries: string[] = [];\n\tif (!(await exists(dir))) return entries;\n\tconst rootEntries = await resolveExtensionEntries(dir);\n\tif (rootEntries) return rootEntries;\n\tconst ig = ignore();\n\tawait addIgnoreRules(ig, dir, dir);\n\tconst startedAt = Date.now();\n\ttry {\n\t\tconst dirEntries = await readdir(dir, { withFileTypes: true });\n\t\tfor (const entry of dirEntries) {\n\t\t\tawait yieldToEventLoopIfSlow(startedAt, RESOURCE_DISCOVERY_YIELD_AFTER_MS);\n\t\t\tif (entry.name.startsWith(\".\") || entry.name === \"node_modules\") continue;\n\t\t\tconst info = await getEntryInfo(dir, entry.name, entry.isDirectory(), entry.isFile(), entry.isSymbolicLink());\n\t\t\tif (!info) continue;\n\t\t\tconst relPath = toPosixPath(relative(dir, info.fullPath));\n\t\t\tconst ignorePath = info.isDir ? `${relPath}/` : relPath;\n\t\t\tif (ig.ignores(ignorePath)) continue;\n\t\t\tif (info.isFile && (entry.name.endsWith(\".ts\") || entry.name.endsWith(\".js\"))) entries.push(info.fullPath);\n\t\t\telse if (info.isDir) {\n\t\t\t\tconst resolvedEntries = await resolveExtensionEntries(info.fullPath);\n\t\t\t\tif (resolvedEntries) entries.push(...resolvedEntries);\n\t\t\t}\n\t\t}\n\t} catch {}\n\treturn entries;\n}\n\nexport async function collectResourceFiles(dir: string, resourceType: ResourceType): Promise<string[]> {\n\tif (resourceType === \"skills\") return collectSkillEntries(dir, \"pi\");\n\tif (resourceType === \"extensions\") return collectAutoExtensionEntries(dir);\n\treturn collectFiles(dir, FILE_PATTERNS[resourceType]);\n}\n\nexport function isPathUnder(target: string, root: string): boolean {\n\tconst resolvedRoot = resolve(root);\n\tconst resolvedTarget = resolve(target);\n\treturn (\n\t\tresolvedTarget === resolvedRoot ||\n\t\tresolvedTarget.startsWith(resolvedRoot.endsWith(sep) ? resolvedRoot : `${resolvedRoot}${sep}`)\n\t);\n}\n"]}
|
|
1
|
+
{"version":3,"file":"package-manager-resource-files.js","sourceRoot":"","sources":["../../src/core/package-manager-resource-files.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AACnE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,WAAW,CAAC;AAClE,OAAO,MAAM,MAAM,QAAQ,CAAC;AAC5B,OAAO,EAAE,sBAAsB,EAAE,MAAM,wBAAwB,CAAC;AAChE,OAAO,EAAE,0B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GAAW,EAAE,YAA0B;IACjF,IAAI,YAAY,KAAK,QAAQ;QAAE,OAAO,mBAAmB,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC;IACrE,IAAI,YAAY,KAAK,YAAY;QAAE,OAAO,2BAA2B,CAAC,GAAG,CAAC,CAAC;IAC3E,OAAO,YAAY,CAAC,GAAG,EAAE,aAAa,CAAC,YAAY,CAAC,CAAC,CAAC;AACvD,CAAC;AAED,MAAM,UAAU,WAAW,CAAC,MAAc,EAAE,IAAY;IACvD,MAAM,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACnC,MAAM,cAAc,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IACvC,OAAO,CACN,cAAc,KAAK,YAAY;QAC/B,cAAc,CAAC,UAAU,CAAC,YAAY,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,GAAG,YAAY,GAAG,GAAG,EAAE,CAAC,CAC9F,CAAC;AACH,CAAC","sourcesContent":["import { access, readdir, readFile, stat } from \"node:fs/promises\";\nimport { dirname, join, relative, resolve, sep } from \"node:path\";\nimport ignore from \"ignore\";\nimport { yieldToEventLoopIfSlow } from \"../utils/event-loop.ts\";\nimport { getManifestFromPackageJson } from \"./package-manager-manifest.ts\";\nimport { toPosixPath } from \"./package-manager-resource-patterns.ts\";\nimport { FILE_PATTERNS, type ResourceType } from \"./package-manager-types.ts\";\n\nconst IGNORE_FILE_NAMES = [\".gitignore\", \".ignore\", \".fdignore\"];\nconst RESOURCE_DISCOVERY_YIELD_AFTER_MS = 8;\ntype IgnoreMatcher = ReturnType<typeof ignore>;\ntype SkillDiscoveryMode = \"pi\" | \"agents\";\n\ntype DirEntryInfo = {\n\tfullPath: string;\n\tisDir: boolean;\n\tisFile: boolean;\n};\n\nasync function exists(path: string): Promise<boolean> {\n\ttry {\n\t\tawait access(path);\n\t\treturn true;\n\t} catch {\n\t\treturn false;\n\t}\n}\n\nfunction prefixIgnorePattern(line: string, prefix: string): string | null {\n\tconst trimmed = line.trim();\n\tif (!trimmed || (trimmed.startsWith(\"#\") && !trimmed.startsWith(\"\\\\#\"))) return null;\n\tlet pattern = line;\n\tlet negated = false;\n\tif (pattern.startsWith(\"!\")) {\n\t\tnegated = true;\n\t\tpattern = pattern.slice(1);\n\t} else if (pattern.startsWith(\"\\\\!\")) pattern = pattern.slice(1);\n\tif (pattern.startsWith(\"/\")) pattern = pattern.slice(1);\n\tconst prefixed = prefix ? `${prefix}${pattern}` : pattern;\n\treturn negated ? `!${prefixed}` : prefixed;\n}\n\nasync function addIgnoreRules(ig: IgnoreMatcher, dir: string, rootDir: string): Promise<void> {\n\tconst relativeDir = relative(rootDir, dir);\n\tconst prefix = relativeDir ? `${toPosixPath(relativeDir)}/` : \"\";\n\tfor (const filename of IGNORE_FILE_NAMES) {\n\t\ttry {\n\t\t\tconst content = await readFile(join(dir, filename), \"utf-8\");\n\t\t\tconst patterns = content\n\t\t\t\t.split(/\\r?\\n/)\n\t\t\t\t.map((line) => prefixIgnorePattern(line, prefix))\n\t\t\t\t.filter((line): line is string => Boolean(line));\n\t\t\tif (patterns.length > 0) ig.add(patterns);\n\t\t} catch {}\n\t}\n}\n\nasync function getEntryInfo(\n\tdir: string,\n\tname: string,\n\tisDirectory: boolean,\n\tisFileEntry: boolean,\n\tisSymlink: boolean,\n): Promise<DirEntryInfo | null> {\n\tconst fullPath = join(dir, name);\n\tlet isDir = isDirectory;\n\tlet isFile = isFileEntry;\n\tif (isSymlink) {\n\t\ttry {\n\t\t\tconst stats = await stat(fullPath);\n\t\t\tisDir = stats.isDirectory();\n\t\t\tisFile = stats.isFile();\n\t\t} catch {\n\t\t\treturn null;\n\t\t}\n\t}\n\treturn { fullPath, isDir, isFile };\n}\n\nexport async function collectFiles(\n\tdir: string,\n\tfilePattern: RegExp,\n\tskipNodeModules = true,\n\tignoreMatcher?: IgnoreMatcher,\n\trootDir?: string,\n): Promise<string[]> {\n\tconst files: string[] = [];\n\tif (!(await exists(dir))) return files;\n\tconst root = rootDir ?? dir;\n\tconst ig = ignoreMatcher ?? ignore();\n\tawait addIgnoreRules(ig, dir, root);\n\tconst startedAt = Date.now();\n\ttry {\n\t\tconst entries = await readdir(dir, { withFileTypes: true });\n\t\tfor (const entry of entries) {\n\t\t\tawait yieldToEventLoopIfSlow(startedAt, RESOURCE_DISCOVERY_YIELD_AFTER_MS);\n\t\t\tif (entry.name.startsWith(\".\") || (skipNodeModules && entry.name === \"node_modules\")) continue;\n\t\t\tconst info = await getEntryInfo(dir, entry.name, entry.isDirectory(), entry.isFile(), entry.isSymbolicLink());\n\t\t\tif (!info) continue;\n\t\t\tconst relPath = toPosixPath(relative(root, info.fullPath));\n\t\t\tconst ignorePath = info.isDir ? `${relPath}/` : relPath;\n\t\t\tif (ig.ignores(ignorePath)) continue;\n\t\t\tif (info.isDir) files.push(...(await collectFiles(info.fullPath, filePattern, skipNodeModules, ig, root)));\n\t\t\telse if (info.isFile && filePattern.test(entry.name)) files.push(info.fullPath);\n\t\t}\n\t} catch {}\n\treturn files;\n}\n\nasync function collectSkillEntries(\n\tdir: string,\n\tmode: SkillDiscoveryMode,\n\tignoreMatcher?: IgnoreMatcher,\n\trootDir?: string,\n): Promise<string[]> {\n\tconst entries: string[] = [];\n\tif (!(await exists(dir))) return entries;\n\tconst root = rootDir ?? dir;\n\tconst ig = ignoreMatcher ?? ignore();\n\tawait addIgnoreRules(ig, dir, root);\n\tconst startedAt = Date.now();\n\ttry {\n\t\tconst dirEntries = await readdir(dir, { withFileTypes: true });\n\t\tfor (const entry of dirEntries) {\n\t\t\tif (entry.name !== \"SKILL.md\") continue;\n\t\t\tconst info = await getEntryInfo(dir, entry.name, entry.isDirectory(), entry.isFile(), entry.isSymbolicLink());\n\t\t\tif (!info) continue;\n\t\t\tconst relPath = toPosixPath(relative(root, info.fullPath));\n\t\t\tif (info.isFile && !ig.ignores(relPath)) {\n\t\t\t\tentries.push(info.fullPath);\n\t\t\t\treturn entries;\n\t\t\t}\n\t\t}\n\t\tfor (const entry of dirEntries) {\n\t\t\tawait yieldToEventLoopIfSlow(startedAt, RESOURCE_DISCOVERY_YIELD_AFTER_MS);\n\t\t\tif (entry.name.startsWith(\".\") || entry.name === \"node_modules\") continue;\n\t\t\tconst info = await getEntryInfo(dir, entry.name, entry.isDirectory(), entry.isFile(), entry.isSymbolicLink());\n\t\t\tif (!info) continue;\n\t\t\tconst relPath = toPosixPath(relative(root, info.fullPath));\n\t\t\tif (mode === \"pi\" && dir === root && info.isFile && entry.name.endsWith(\".md\") && !ig.ignores(relPath)) {\n\t\t\t\tentries.push(info.fullPath);\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tif (!info.isDir || ig.ignores(`${relPath}/`)) continue;\n\t\t\tentries.push(...(await collectSkillEntries(info.fullPath, mode, ig, root)));\n\t\t}\n\t} catch {}\n\treturn entries;\n}\n\nexport async function collectAutoSkillEntries(dir: string, mode: SkillDiscoveryMode): Promise<string[]> {\n\treturn collectSkillEntries(dir, mode);\n}\n\nasync function findGitRepoRoot(startDir: string): Promise<string | null> {\n\tlet dir = resolve(startDir);\n\twhile (true) {\n\t\tif (await exists(join(dir, \".git\"))) return dir;\n\t\tconst parent = dirname(dir);\n\t\tif (parent === dir) return null;\n\t\tdir = parent;\n\t}\n}\n\nexport async function collectAncestorAgentsSkillDirs(startDir: string): Promise<string[]> {\n\tconst skillDirs: string[] = [];\n\tconst resolvedStartDir = resolve(startDir);\n\tconst gitRepoRoot = await findGitRepoRoot(resolvedStartDir);\n\tlet dir = resolvedStartDir;\n\twhile (true) {\n\t\tskillDirs.push(join(dir, \".agents\", \"skills\"));\n\t\tif (gitRepoRoot && dir === gitRepoRoot) break;\n\t\tconst parent = dirname(dir);\n\t\tif (parent === dir) break;\n\t\tdir = parent;\n\t}\n\treturn skillDirs;\n}\n\nasync function collectFlatEntries(dir: string, extension: string): Promise<string[]> {\n\tconst entries: string[] = [];\n\tif (!(await exists(dir))) return entries;\n\tconst ig = ignore();\n\tawait addIgnoreRules(ig, dir, dir);\n\tconst startedAt = Date.now();\n\ttry {\n\t\tconst dirEntries = await readdir(dir, { withFileTypes: true });\n\t\tfor (const entry of dirEntries) {\n\t\t\tawait yieldToEventLoopIfSlow(startedAt, RESOURCE_DISCOVERY_YIELD_AFTER_MS);\n\t\t\tif (entry.name.startsWith(\".\") || entry.name === \"node_modules\") continue;\n\t\t\tconst info = await getEntryInfo(dir, entry.name, entry.isDirectory(), entry.isFile(), entry.isSymbolicLink());\n\t\t\tif (!info) continue;\n\t\t\tconst relPath = toPosixPath(relative(dir, info.fullPath));\n\t\t\tif (ig.ignores(relPath)) continue;\n\t\t\tif (info.isFile && entry.name.endsWith(extension)) entries.push(info.fullPath);\n\t\t}\n\t} catch {}\n\treturn entries;\n}\n\nexport async function collectAutoPromptEntries(dir: string): Promise<string[]> {\n\treturn collectFlatEntries(dir, \".md\");\n}\n\nexport async function collectAutoThemeEntries(dir: string): Promise<string[]> {\n\treturn collectFlatEntries(dir, \".json\");\n}\n\nexport async function resolveExtensionEntries(dir: string): Promise<string[] | null> {\n\tconst packageJsonPath = join(dir, \"package.json\");\n\tif (await exists(packageJsonPath)) {\n\t\ttry {\n\t\t\tconst manifest = getManifestFromPackageJson(JSON.parse(await readFile(packageJsonPath, \"utf-8\")));\n\t\t\tif (manifest?.extensions?.length) {\n\t\t\t\tconst entries: string[] = [];\n\t\t\t\tfor (const extPath of manifest.extensions) {\n\t\t\t\t\tconst resolvedExtPath = resolve(dir, extPath);\n\t\t\t\t\tif (await exists(resolvedExtPath)) entries.push(resolvedExtPath);\n\t\t\t\t}\n\t\t\t\tif (entries.length > 0) return entries;\n\t\t\t}\n\t\t} catch {}\n\t}\n\tconst indexTs = join(dir, \"index.ts\");\n\tconst indexJs = join(dir, \"index.js\");\n\tif (await exists(indexTs)) return [indexTs];\n\tif (await exists(indexJs)) return [indexJs];\n\treturn null;\n}\n\nexport async function collectAutoExtensionEntries(dir: string): Promise<string[]> {\n\tconst entries: string[] = [];\n\tif (!(await exists(dir))) return entries;\n\tconst rootEntries = await resolveExtensionEntries(dir);\n\tif (rootEntries) return rootEntries;\n\tconst ig = ignore();\n\tawait addIgnoreRules(ig, dir, dir);\n\tconst startedAt = Date.now();\n\ttry {\n\t\tconst dirEntries = await readdir(dir, { withFileTypes: true });\n\t\tfor (const entry of dirEntries) {\n\t\t\tawait yieldToEventLoopIfSlow(startedAt, RESOURCE_DISCOVERY_YIELD_AFTER_MS);\n\t\t\tif (entry.name.startsWith(\".\") || entry.name === \"node_modules\") continue;\n\t\t\tconst info = await getEntryInfo(dir, entry.name, entry.isDirectory(), entry.isFile(), entry.isSymbolicLink());\n\t\t\tif (!info) continue;\n\t\t\tconst relPath = toPosixPath(relative(dir, info.fullPath));\n\t\t\tconst ignorePath = info.isDir ? `${relPath}/` : relPath;\n\t\t\tif (ig.ignores(ignorePath)) continue;\n\t\t\tif (info.isFile && (entry.name.endsWith(\".ts\") || entry.name.endsWith(\".js\"))) entries.push(info.fullPath);\n\t\t\telse if (info.isDir) {\n\t\t\t\tconst resolvedEntries = await resolveExtensionEntries(info.fullPath);\n\t\t\t\tif (resolvedEntries) entries.push(...resolvedEntries);\n\t\t\t}\n\t\t}\n\t} catch {}\n\treturn entries;\n}\n\nexport async function collectResourceFiles(dir: string, resourceType: ResourceType): Promise<string[]> {\n\tif (resourceType === \"skills\") return collectSkillEntries(dir, \"pi\");\n\tif (resourceType === \"extensions\") return collectAutoExtensionEntries(dir);\n\treturn collectFiles(dir, FILE_PATTERNS[resourceType]);\n}\n\nexport function isPathUnder(target: string, root: string): boolean {\n\tconst resolvedRoot = resolve(root);\n\tconst resolvedTarget = resolve(target);\n\treturn (\n\t\tresolvedTarget === resolvedRoot ||\n\t\tresolvedTarget.startsWith(resolvedRoot.endsWith(sep) ? resolvedRoot : `${resolvedRoot}${sep}`)\n\t);\n}\n"]}
|
|
@@ -5,8 +5,15 @@ export interface ExtensionOAuthConfig {
|
|
|
5
5
|
name: string;
|
|
6
6
|
loginLabel?: string;
|
|
7
7
|
usesCallbackServer?: boolean;
|
|
8
|
-
login(callbacks: OAuthLoginCallbacks): Promise<OAuthCredentials>;
|
|
9
|
-
|
|
8
|
+
login(callbacks: OAuthLoginCallbacks, signal: AbortSignal): Promise<OAuthCredentials>;
|
|
9
|
+
/**
|
|
10
|
+
* Refresh expired credentials. `signal` is the caller's cancellation signal,
|
|
11
|
+
* forwarded by pi through `oauth.refresh(credential, signal)`; honor it by
|
|
12
|
+
* passing it into whatever performs the network call. It is a required
|
|
13
|
+
* parameter rather than an optional one so the contract cannot be satisfied
|
|
14
|
+
* by ignoring cancellation.
|
|
15
|
+
*/
|
|
16
|
+
refreshToken(credentials: OAuthCredentials, signal: AbortSignal): Promise<OAuthCredentials>;
|
|
10
17
|
getApiKey(credentials: OAuthCredentials): string;
|
|
11
18
|
modifyModels?(models: Model<Api>[], credentials: OAuthCredentials): Model<Api>[];
|
|
12
19
|
}
|
|
@@ -31,6 +38,7 @@ export interface ProviderConfigInput {
|
|
|
31
38
|
cost: Model<Api>["cost"];
|
|
32
39
|
contextWindow: number;
|
|
33
40
|
maxTokens: number;
|
|
41
|
+
samplingParams?: Record<string, unknown>;
|
|
34
42
|
headers?: Record<string, string>;
|
|
35
43
|
compat?: Model<Api>["compat"];
|
|
36
44
|
}>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"provider-composer-internal.d.ts","sourceRoot":"","sources":["../../src/core/provider-composer-internal.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACX,GAAG,EACH,UAAU,EACV,2BAA2B,
|
|
1
|
+
{"version":3,"file":"provider-composer-internal.d.ts","sourceRoot":"","sources":["../../src/core/provider-composer-internal.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACX,GAAG,EACH,UAAU,EACV,2BAA2B,EAG3B,OAAO,EACP,KAAK,EAEL,SAAS,EACT,gBAAgB,EAChB,mBAAmB,EACnB,QAAQ,EAGR,oBAAoB,EACpB,mBAA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const overrideNested = override;
|
|
9
9
|
const mergedNested = merged;
|
|
10
|
-
for (const key of ["openRouterRouting", "vercelGatewayRouting", "chatTemplateKwargs"]) {
|
|
10
|
+
for (const key of ["openRouterRouting", "vercelGatewayRouting", "chatTemplateKwargs", "chatTemplateArgs"]) {
|
|
11
11
|
const baseValue = baseNested?.[key];
|
|
12
12
|
const overrideValue = overrideNested[key];
|
|
13
13
|
if ((typeof baseValue === "object" && baseValue !== null) ||
|
|
@@ -37,6 +37,9 @@ export function applyModelOverride(model, override) {
|
|
|
37
37
|
: model.cost,
|
|
38
38
|
contextWindow: override.contextWindow ?? model.contextWindow,
|
|
39
39
|
maxTokens: override.maxTokens ?? model.maxTokens,
|
|
40
|
+
samplingParams: override.samplingParams
|
|
41
|
+
? { ...model.samplingParams, ...override.samplingParams }
|
|
42
|
+
: model.samplingParams,
|
|
40
43
|
compat: mergeCompat(model.compat, override.compat),
|
|
41
44
|
};
|
|
42
45
|
}
|
|
@@ -66,6 +69,7 @@ function modelFromJson(providerId, definition, providerConfig, defaults) {
|
|
|
66
69
|
cost: definition.cost ?? { input: 0, output: 0, cacheRead: 0, cacheWrite: 0 },
|
|
67
70
|
contextWindow: definition.contextWindow ?? 128000,
|
|
68
71
|
maxTokens: definition.maxTokens ?? 16384,
|
|
72
|
+
samplingParams: definition.samplingParams,
|
|
69
73
|
headers: undefined,
|
|
70
74
|
compat: mergeCompat(providerConfig.compat, definition.compat),
|
|
71
75
|
};
|
|
@@ -141,10 +145,10 @@ function adaptOAuth(config) {
|
|
|
141
145
|
onSelect: (prompt) => callbacks.prompt({ type: "select", ...prompt }),
|
|
142
146
|
signal: callbacks.signal,
|
|
143
147
|
};
|
|
144
|
-
const credential = await config.login(legacyCallbacks);
|
|
148
|
+
const credential = await config.login(legacyCallbacks, callbacks.signal);
|
|
145
149
|
return { ...credential, type: "oauth" };
|
|
146
150
|
},
|
|
147
|
-
refresh: async (credential) => ({ ...(await config.refreshToken(credential)), type: "oauth" }),
|
|
151
|
+
refresh: async (credential, signal) => ({ ...(await config.refreshToken(credential, signal)), type: "oauth" }),
|
|
148
152
|
toAuth: async (credential) => ({ apiKey: config.getApiKey(credential) }),
|
|
149
153
|
};
|
|
150
154
|
}
|