@caupulican/pi-adaptative 0.85.3 → 0.85.8
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 +60 -0
- package/dist/bun/cli.d.ts +1 -1
- package/dist/bun/cli.d.ts.map +1 -1
- package/dist/bun/cli.js +1 -0
- package/dist/bun/cli.js.map +1 -1
- package/dist/core/agent-session-runtime.d.ts +1 -1
- package/dist/core/agent-session-runtime.d.ts.map +1 -1
- package/dist/core/agent-session-runtime.js +1 -1
- package/dist/core/agent-session-runtime.js.map +1 -1
- package/dist/core/agent-session-services.d.ts.map +1 -1
- package/dist/core/agent-session-services.js +2 -0
- package/dist/core/agent-session-services.js.map +1 -1
- package/dist/core/agent-session.d.ts +12 -8
- package/dist/core/agent-session.d.ts.map +1 -1
- package/dist/core/agent-session.js +82 -88
- package/dist/core/agent-session.js.map +1 -1
- package/dist/core/auth-guidance.d.ts.map +1 -1
- package/dist/core/auth-guidance.js +3 -0
- package/dist/core/auth-guidance.js.map +1 -1
- package/dist/core/auth-storage.d.ts +2 -2
- package/dist/core/auth-storage.d.ts.map +1 -1
- package/dist/core/auth-storage.js +2 -2
- package/dist/core/auth-storage.js.map +1 -1
- package/dist/core/autonomy/lane-tool-surface.d.ts +2 -0
- package/dist/core/autonomy/lane-tool-surface.d.ts.map +1 -1
- package/dist/core/autonomy/lane-tool-surface.js +4 -3
- package/dist/core/autonomy/lane-tool-surface.js.map +1 -1
- package/dist/core/background-lane-controller.d.ts +4 -0
- package/dist/core/background-lane-controller.d.ts.map +1 -1
- package/dist/core/background-lane-controller.js +2 -0
- package/dist/core/background-lane-controller.js.map +1 -1
- package/dist/core/background-tool-task-controller.d.ts +12 -7
- package/dist/core/background-tool-task-controller.d.ts.map +1 -1
- package/dist/core/background-tool-task-controller.js +55 -19
- package/dist/core/background-tool-task-controller.js.map +1 -1
- package/dist/core/bash-executor.js +2 -2
- package/dist/core/bash-executor.js.map +1 -1
- package/dist/core/bedrock-scope.d.ts +26 -0
- package/dist/core/bedrock-scope.d.ts.map +1 -0
- package/dist/core/bedrock-scope.js +178 -0
- package/dist/core/bedrock-scope.js.map +1 -0
- package/dist/core/billing-failover-controller.d.ts +2 -2
- package/dist/core/billing-failover-controller.d.ts.map +1 -1
- package/dist/core/billing-failover-controller.js +1 -1
- package/dist/core/billing-failover-controller.js.map +1 -1
- package/dist/core/compaction-controller.d.ts +8 -2
- package/dist/core/compaction-controller.d.ts.map +1 -1
- package/dist/core/compaction-controller.js +73 -3
- package/dist/core/compaction-controller.js.map +1 -1
- package/dist/core/compaction-support.d.ts +2 -2
- package/dist/core/compaction-support.d.ts.map +1 -1
- package/dist/core/compaction-support.js +9 -1
- package/dist/core/compaction-support.js.map +1 -1
- package/dist/core/context/artifact-retrieval.d.ts +1 -1
- package/dist/core/context/artifact-retrieval.d.ts.map +1 -1
- package/dist/core/context/artifact-retrieval.js +1 -1
- package/dist/core/context/artifact-retrieval.js.map +1 -1
- package/dist/core/context/context-artifacts.d.ts +6 -6
- package/dist/core/context/context-artifacts.d.ts.map +1 -1
- package/dist/core/context/context-artifacts.js +151 -63
- package/dist/core/context/context-artifacts.js.map +1 -1
- package/dist/core/context/context-composition.js +1 -1
- package/dist/core/context/context-composition.js.map +1 -1
- package/dist/core/context/context-store-retention.d.ts.map +1 -1
- package/dist/core/context/context-store-retention.js +5 -2
- package/dist/core/context/context-store-retention.js.map +1 -1
- package/dist/core/context/file-store-memory-provider.js +1 -1
- package/dist/core/context/file-store-memory-provider.js.map +1 -1
- package/dist/core/context/tool-output-packer.d.ts +1 -1
- package/dist/core/context/tool-output-packer.d.ts.map +1 -1
- package/dist/core/context/tool-output-packer.js +1 -1
- package/dist/core/context/tool-output-packer.js.map +1 -1
- package/dist/core/context-gc.d.ts.map +1 -1
- package/dist/core/context-gc.js +7 -5
- package/dist/core/context-gc.js.map +1 -1
- package/dist/core/context-pipeline.d.ts +2 -2
- package/dist/core/context-pipeline.d.ts.map +1 -1
- package/dist/core/context-pipeline.js +8 -4
- package/dist/core/context-pipeline.js.map +1 -1
- package/dist/core/cost/cost-summary.d.ts +1 -1
- package/dist/core/cost/cost-summary.d.ts.map +1 -1
- package/dist/core/cost/cost-summary.js +1 -1
- package/dist/core/cost/cost-summary.js.map +1 -1
- package/dist/core/cost/daily-usage.d.ts +1 -1
- package/dist/core/cost/daily-usage.d.ts.map +1 -1
- package/dist/core/cost/daily-usage.js +2 -2
- package/dist/core/cost/daily-usage.js.map +1 -1
- package/dist/core/cost/session-usage.d.ts +1 -1
- package/dist/core/cost/session-usage.d.ts.map +1 -1
- package/dist/core/cost/session-usage.js +1 -1
- package/dist/core/cost/session-usage.js.map +1 -1
- package/dist/core/delegation/worker-actions.js +1 -1
- package/dist/core/delegation/worker-actions.js.map +1 -1
- package/dist/core/delegation/worker-attempt-executor.d.ts +1 -1
- package/dist/core/delegation/worker-attempt-executor.d.ts.map +1 -1
- package/dist/core/delegation/worker-attempt-executor.js +3 -2
- package/dist/core/delegation/worker-attempt-executor.js.map +1 -1
- package/dist/core/delegation/worker-conversation-store.d.ts +2 -1
- package/dist/core/delegation/worker-conversation-store.d.ts.map +1 -1
- package/dist/core/delegation/worker-conversation-store.js +3 -2
- package/dist/core/delegation/worker-conversation-store.js.map +1 -1
- package/dist/core/delegation/worker-delegation-controller.d.ts.map +1 -1
- package/dist/core/delegation/worker-delegation-controller.js +6 -0
- package/dist/core/delegation/worker-delegation-controller.js.map +1 -1
- package/dist/core/extensions/builtin.d.ts +2 -2
- package/dist/core/extensions/builtin.d.ts.map +1 -1
- package/dist/core/extensions/builtin.js +2 -2
- package/dist/core/extensions/builtin.js.map +1 -1
- package/dist/core/extensions/bundled-virtual-modules.d.ts +2 -0
- package/dist/core/extensions/bundled-virtual-modules.d.ts.map +1 -0
- package/dist/core/extensions/bundled-virtual-modules.js +129 -0
- package/dist/core/extensions/bundled-virtual-modules.js.map +1 -0
- package/dist/core/extensions/factory-runtime.d.ts +22 -0
- package/dist/core/extensions/factory-runtime.d.ts.map +1 -0
- package/dist/core/extensions/factory-runtime.js +334 -0
- package/dist/core/extensions/factory-runtime.js.map +1 -0
- package/dist/core/extensions/index.d.ts +1 -1
- package/dist/core/extensions/index.d.ts.map +1 -1
- package/dist/core/extensions/index.js +1 -1
- package/dist/core/extensions/index.js.map +1 -1
- package/dist/core/extensions/lifecycle.d.ts +13 -0
- package/dist/core/extensions/lifecycle.d.ts.map +1 -0
- package/dist/core/extensions/lifecycle.js +52 -0
- package/dist/core/extensions/lifecycle.js.map +1 -0
- package/dist/core/extensions/loader.d.ts +3 -24
- package/dist/core/extensions/loader.d.ts.map +1 -1
- package/dist/core/extensions/loader.js +21 -528
- package/dist/core/extensions/loader.js.map +1 -1
- package/dist/core/extensions/virtual-modules.d.ts +51 -0
- package/dist/core/extensions/virtual-modules.d.ts.map +1 -0
- package/dist/core/extensions/virtual-modules.js +59 -0
- package/dist/core/extensions/virtual-modules.js.map +1 -0
- package/dist/core/foreground-recovery-controller.d.ts +26 -2
- package/dist/core/foreground-recovery-controller.d.ts.map +1 -1
- package/dist/core/foreground-recovery-controller.js +112 -3
- package/dist/core/foreground-recovery-controller.js.map +1 -1
- package/dist/core/foreground-terminal-handoff-controller.d.ts +27 -0
- package/dist/core/foreground-terminal-handoff-controller.d.ts.map +1 -0
- package/dist/core/foreground-terminal-handoff-controller.js +56 -0
- package/dist/core/foreground-terminal-handoff-controller.js.map +1 -0
- package/dist/core/goal-loop-controller.d.ts.map +1 -1
- package/dist/core/goal-loop-controller.js +5 -0
- package/dist/core/goal-loop-controller.js.map +1 -1
- package/dist/core/goals/compact-goal-context.d.ts +1 -1
- package/dist/core/goals/compact-goal-context.d.ts.map +1 -1
- package/dist/core/goals/compact-goal-context.js +1 -1
- package/dist/core/goals/compact-goal-context.js.map +1 -1
- package/dist/core/goals/goal-auto-continue-controller.d.ts +3 -0
- package/dist/core/goals/goal-auto-continue-controller.d.ts.map +1 -1
- package/dist/core/goals/goal-auto-continue-controller.js +28 -7
- package/dist/core/goals/goal-auto-continue-controller.js.map +1 -1
- package/dist/core/goals/goal-session-controller.d.ts +1 -1
- package/dist/core/goals/goal-session-controller.d.ts.map +1 -1
- package/dist/core/goals/goal-session-controller.js +1 -1
- package/dist/core/goals/goal-session-controller.js.map +1 -1
- package/dist/core/http-dispatcher.d.ts +1 -1
- package/dist/core/http-dispatcher.d.ts.map +1 -1
- package/dist/core/http-dispatcher.js +1 -1
- package/dist/core/http-dispatcher.js.map +1 -1
- package/dist/core/human-input-controller.d.ts +9 -0
- package/dist/core/human-input-controller.d.ts.map +1 -1
- package/dist/core/human-input-controller.js +60 -5
- package/dist/core/human-input-controller.js.map +1 -1
- package/dist/core/human-input.d.ts +12 -0
- package/dist/core/human-input.d.ts.map +1 -1
- package/dist/core/human-input.js +59 -12
- package/dist/core/human-input.js.map +1 -1
- package/dist/core/index.d.ts +3 -2
- package/dist/core/index.d.ts.map +1 -1
- package/dist/core/index.js +2 -1
- package/dist/core/index.js.map +1 -1
- package/dist/core/local-runtime-controller.d.ts.map +1 -1
- package/dist/core/local-runtime-controller.js +15 -9
- package/dist/core/local-runtime-controller.js.map +1 -1
- package/dist/core/memory/providers/file-store.d.ts +1 -0
- package/dist/core/memory/providers/file-store.d.ts.map +1 -1
- package/dist/core/memory/providers/file-store.js +253 -126
- package/dist/core/memory/providers/file-store.js.map +1 -1
- package/dist/core/memory/providers/user-memory-archive.js +1 -1
- package/dist/core/memory/providers/user-memory-archive.js.map +1 -1
- package/dist/core/model-capability.d.ts +15 -1
- package/dist/core/model-capability.d.ts.map +1 -1
- package/dist/core/model-capability.js +24 -1
- package/dist/core/model-capability.js.map +1 -1
- package/dist/core/model-registry.d.ts +7 -1
- package/dist/core/model-registry.d.ts.map +1 -1
- package/dist/core/model-registry.js +22 -1
- package/dist/core/model-registry.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-router-controller.d.ts +6 -6
- package/dist/core/model-router-controller.d.ts.map +1 -1
- package/dist/core/model-router-controller.js +6 -6
- package/dist/core/model-router-controller.js.map +1 -1
- package/dist/core/model-selection-controller.js +1 -1
- package/dist/core/model-selection-controller.js.map +1 -1
- package/dist/core/model-tool-protocol.d.ts +1 -1
- package/dist/core/model-tool-protocol.d.ts.map +1 -1
- package/dist/core/model-tool-protocol.js +1 -1
- package/dist/core/model-tool-protocol.js.map +1 -1
- package/dist/core/models/context-sizing.d.ts +1 -0
- package/dist/core/models/context-sizing.d.ts.map +1 -1
- package/dist/core/models/context-sizing.js +4 -1
- package/dist/core/models/context-sizing.js.map +1 -1
- package/dist/core/models/default-model-suggestions.d.ts.map +1 -1
- package/dist/core/models/default-model-suggestions.js +20 -10
- package/dist/core/models/default-model-suggestions.js.map +1 -1
- package/dist/core/models/llamacpp-runtime.d.ts +39 -11
- package/dist/core/models/llamacpp-runtime.d.ts.map +1 -1
- package/dist/core/models/llamacpp-runtime.js +87 -31
- package/dist/core/models/llamacpp-runtime.js.map +1 -1
- package/dist/core/models/local-execution-planner.d.ts +24 -0
- package/dist/core/models/local-execution-planner.d.ts.map +1 -0
- package/dist/core/models/local-execution-planner.js +119 -0
- package/dist/core/models/local-execution-planner.js.map +1 -0
- package/dist/core/models/local-inference-profile.d.ts +34 -0
- package/dist/core/models/local-inference-profile.d.ts.map +1 -0
- package/dist/core/models/local-inference-profile.js +74 -0
- package/dist/core/models/local-inference-profile.js.map +1 -0
- package/dist/core/models/local-runtime.d.ts +23 -4
- package/dist/core/models/local-runtime.d.ts.map +1 -1
- package/dist/core/models/local-runtime.js +12 -9
- package/dist/core/models/local-runtime.js.map +1 -1
- package/dist/core/models/managed-ollama-model.d.ts +26 -0
- package/dist/core/models/managed-ollama-model.d.ts.map +1 -0
- package/dist/core/models/managed-ollama-model.js +59 -0
- package/dist/core/models/managed-ollama-model.js.map +1 -0
- package/dist/core/models/model-ref.js +11 -11
- package/dist/core/models/model-ref.js.map +1 -1
- package/dist/core/models/prism-llamacpp-lifecycle.d.ts +10 -20
- package/dist/core/models/prism-llamacpp-lifecycle.d.ts.map +1 -1
- package/dist/core/models/prism-llamacpp-lifecycle.js +11 -31
- package/dist/core/models/prism-llamacpp-lifecycle.js.map +1 -1
- package/dist/core/models/prism-llamacpp-server-probe.d.ts +10 -0
- package/dist/core/models/prism-llamacpp-server-probe.d.ts.map +1 -0
- package/dist/core/models/prism-llamacpp-server-probe.js +36 -0
- package/dist/core/models/prism-llamacpp-server-probe.js.map +1 -0
- package/dist/core/models/runtime-arbiter.d.ts +3 -0
- package/dist/core/models/runtime-arbiter.d.ts.map +1 -1
- package/dist/core/models/runtime-arbiter.js +2 -1
- package/dist/core/models/runtime-arbiter.js.map +1 -1
- package/dist/core/orchestration/model-binding.d.ts +1 -1
- package/dist/core/orchestration/model-binding.d.ts.map +1 -1
- package/dist/core/orchestration/model-binding.js +1 -1
- package/dist/core/orchestration/model-binding.js.map +1 -1
- package/dist/core/orchestration/task-profile-writer.js +1 -1
- package/dist/core/orchestration/task-profile-writer.js.map +1 -1
- package/dist/core/process-matrix/runtime.d.ts +15 -1
- package/dist/core/process-matrix/runtime.d.ts.map +1 -1
- package/dist/core/process-matrix/runtime.js +55 -34
- package/dist/core/process-matrix/runtime.js.map +1 -1
- package/dist/core/reflection-controller.d.ts +4 -3
- package/dist/core/reflection-controller.d.ts.map +1 -1
- package/dist/core/reflection-controller.js +2 -2
- package/dist/core/reflection-controller.js.map +1 -1
- package/dist/core/research/model-fitness-controller.js +1 -1
- package/dist/core/research/model-fitness-controller.js.map +1 -1
- package/dist/core/research/research-lane-controller.d.ts +2 -2
- package/dist/core/research/research-lane-controller.d.ts.map +1 -1
- package/dist/core/research/research-lane-controller.js +15 -6
- package/dist/core/research/research-lane-controller.js.map +1 -1
- package/dist/core/resource-loader.d.ts +10 -19
- package/dist/core/resource-loader.d.ts.map +1 -1
- package/dist/core/resource-loader.js +8 -70
- package/dist/core/resource-loader.js.map +1 -1
- package/dist/core/runtime-builder.d.ts +5 -1
- package/dist/core/runtime-builder.d.ts.map +1 -1
- package/dist/core/runtime-builder.js +50 -7
- package/dist/core/runtime-builder.js.map +1 -1
- package/dist/core/scout-controller.d.ts +4 -3
- package/dist/core/scout-controller.d.ts.map +1 -1
- package/dist/core/scout-controller.js +2 -1
- package/dist/core/scout-controller.js.map +1 -1
- package/dist/core/sdk.d.ts +2 -2
- package/dist/core/sdk.d.ts.map +1 -1
- package/dist/core/sdk.js +13 -11
- package/dist/core/sdk.js.map +1 -1
- package/dist/core/security/context-threat-scanner.d.ts +14 -0
- package/dist/core/security/context-threat-scanner.d.ts.map +1 -0
- package/dist/core/security/context-threat-scanner.js +71 -0
- package/dist/core/security/context-threat-scanner.js.map +1 -0
- package/dist/core/session-supervision-runtime.d.ts +4 -1
- package/dist/core/session-supervision-runtime.d.ts.map +1 -1
- package/dist/core/session-supervision-runtime.js +49 -11
- package/dist/core/session-supervision-runtime.js.map +1 -1
- package/dist/core/settings-manager.d.ts +13 -0
- package/dist/core/settings-manager.d.ts.map +1 -1
- package/dist/core/settings-manager.js +60 -1
- package/dist/core/settings-manager.js.map +1 -1
- package/dist/core/system-prompt-builder.d.ts +5 -2
- package/dist/core/system-prompt-builder.d.ts.map +1 -1
- package/dist/core/system-prompt-builder.js +22 -10
- package/dist/core/system-prompt-builder.js.map +1 -1
- package/dist/core/system-prompt.d.ts +3 -0
- package/dist/core/system-prompt.d.ts.map +1 -1
- package/dist/core/system-prompt.js +181 -55
- package/dist/core/system-prompt.js.map +1 -1
- package/dist/core/tool-protocol-controller.d.ts.map +1 -1
- package/dist/core/tool-protocol-controller.js +5 -3
- package/dist/core/tool-protocol-controller.js.map +1 -1
- package/dist/core/tool-recovery-logger.js +1 -1
- package/dist/core/tool-recovery-logger.js.map +1 -1
- package/dist/core/tools/artifact-retrieve.js +1 -1
- package/dist/core/tools/artifact-retrieve.js.map +1 -1
- package/dist/core/tools/bash.d.ts +2 -2
- package/dist/core/tools/bash.d.ts.map +1 -1
- package/dist/core/tools/bash.js +16 -4
- package/dist/core/tools/bash.js.map +1 -1
- package/dist/core/tools/edit-diff.d.ts +2 -0
- package/dist/core/tools/edit-diff.d.ts.map +1 -1
- package/dist/core/tools/edit-diff.js +9 -1
- package/dist/core/tools/edit-diff.js.map +1 -1
- package/dist/core/tools/edit.d.ts +5 -8
- package/dist/core/tools/edit.d.ts.map +1 -1
- package/dist/core/tools/edit.js +88 -55
- package/dist/core/tools/edit.js.map +1 -1
- package/dist/core/tools/extensionify-runtime.d.ts +44 -0
- package/dist/core/tools/extensionify-runtime.d.ts.map +1 -0
- package/dist/core/tools/extensionify-runtime.js +115 -0
- package/dist/core/tools/extensionify-runtime.js.map +1 -0
- package/dist/core/tools/extensionify.d.ts +9 -30
- package/dist/core/tools/extensionify.d.ts.map +1 -1
- package/dist/core/tools/extensionify.js +10 -140
- package/dist/core/tools/extensionify.js.map +1 -1
- package/dist/core/tools/file-mutation-intent.d.ts +42 -15
- package/dist/core/tools/file-mutation-intent.d.ts.map +1 -1
- package/dist/core/tools/file-mutation-intent.js +271 -77
- package/dist/core/tools/file-mutation-intent.js.map +1 -1
- package/dist/core/tools/find.d.ts +1 -1
- package/dist/core/tools/find.d.ts.map +1 -1
- package/dist/core/tools/find.js +1 -1
- package/dist/core/tools/find.js.map +1 -1
- package/dist/core/tools/index.d.ts +3 -5
- package/dist/core/tools/index.d.ts.map +1 -1
- package/dist/core/tools/index.js +8 -44
- package/dist/core/tools/index.js.map +1 -1
- package/dist/core/tools/ls.d.ts +1 -1
- package/dist/core/tools/ls.d.ts.map +1 -1
- package/dist/core/tools/ls.js +1 -1
- package/dist/core/tools/ls.js.map +1 -1
- package/dist/core/tools/output-accumulator.d.ts +1 -1
- package/dist/core/tools/output-accumulator.d.ts.map +1 -1
- package/dist/core/tools/output-accumulator.js +1 -1
- package/dist/core/tools/output-accumulator.js.map +1 -1
- package/dist/core/tools/render-utils.js +1 -1
- package/dist/core/tools/render-utils.js.map +1 -1
- package/dist/core/tools/search-command-guard.d.ts +8 -0
- package/dist/core/tools/search-command-guard.d.ts.map +1 -1
- package/dist/core/tools/search-command-guard.js +54 -0
- package/dist/core/tools/search-command-guard.js.map +1 -1
- package/dist/core/tools/shell-contract-router.d.ts.map +1 -1
- package/dist/core/tools/shell-contract-router.js +9 -4
- package/dist/core/tools/shell-contract-router.js.map +1 -1
- package/dist/core/tools/shell-session.d.ts.map +1 -1
- package/dist/core/tools/shell-session.js +6 -4
- package/dist/core/tools/shell-session.js.map +1 -1
- package/dist/core/tools/tool-definition-factory.d.ts +32 -0
- package/dist/core/tools/tool-definition-factory.d.ts.map +1 -0
- package/dist/core/tools/tool-definition-factory.js +55 -0
- package/dist/core/tools/tool-definition-factory.js.map +1 -0
- package/dist/core/tools/write.d.ts +5 -10
- package/dist/core/tools/write.d.ts.map +1 -1
- package/dist/core/tools/write.js +92 -73
- package/dist/core/tools/write.js.map +1 -1
- package/dist/core/util/atomic-file.d.ts.map +1 -1
- package/dist/core/util/atomic-file.js +79 -32
- package/dist/core/util/atomic-file.js.map +1 -1
- package/dist/index.d.ts +3 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -2
- package/dist/index.js.map +1 -1
- package/dist/main.d.ts +2 -0
- package/dist/main.d.ts.map +1 -1
- package/dist/main.js +24 -18
- package/dist/main.js.map +1 -1
- package/dist/modes/interactive/auth-dialogs-controller.d.ts +6 -0
- package/dist/modes/interactive/auth-dialogs-controller.d.ts.map +1 -1
- package/dist/modes/interactive/auth-dialogs-controller.js +59 -12
- package/dist/modes/interactive/auth-dialogs-controller.js.map +1 -1
- package/dist/modes/interactive/auto-learn-controller.js +1 -1
- package/dist/modes/interactive/auto-learn-controller.js.map +1 -1
- package/dist/modes/interactive/components/tool-execution.js +1 -1
- package/dist/modes/interactive/components/tool-execution.js.map +1 -1
- package/dist/modes/interactive/interactive-event-controller.js +1 -1
- package/dist/modes/interactive/interactive-event-controller.js.map +1 -1
- package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-mode.js +1 -1
- package/dist/modes/interactive/interactive-mode.js.map +1 -1
- package/dist/modes/interactive/local-model-commands.d.ts +1 -1
- package/dist/modes/interactive/local-model-commands.d.ts.map +1 -1
- package/dist/modes/interactive/local-model-commands.js +51 -8
- package/dist/modes/interactive/local-model-commands.js.map +1 -1
- package/dist/utils/child-process.js +1 -1
- package/dist/utils/child-process.js.map +1 -1
- package/docs/providers.md +34 -10
- package/docs/tool-boundary-performance-roadmap-2026-08-02.md +21 -18
- package/examples/extensions/built-in-tool-renderer.ts +1 -1
- package/examples/extensions/custom-provider-anthropic/package-lock.json +2 -2
- package/examples/extensions/custom-provider-anthropic/package.json +1 -1
- package/examples/extensions/custom-provider-gitlab-duo/package.json +1 -1
- package/examples/extensions/minimal-mode.ts +1 -1
- package/examples/extensions/prompt-customizer.ts +2 -2
- package/examples/extensions/sandbox/package-lock.json +2 -2
- package/examples/extensions/sandbox/package.json +1 -1
- package/examples/extensions/ssh.ts +17 -0
- package/examples/extensions/with-deps/package-lock.json +2 -2
- package/examples/extensions/with-deps/package.json +1 -1
- package/npm-shrinkwrap.json +240 -260
- package/package.json +9 -7
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"context-sizing.js","sourceRoot":"","sources":["../../../src/core/models/context-sizing.ts"],"names":[],"mappings":"AAAA,MAAM,aAAa,GAAG,CAAC,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,CAAU,CAAC;AAC9D,MAAM,yBAAyB,GAAG,GAAG,CAAC;AACtC,MAAM,SAAS,GAAG,CAAC,CAAC;AACpB,MAAM,QAAQ,GAAG,CAAC,CAAC;AAwBnB,MAAM,UAAU,wBAAwB,CAAC,IAKxC;IACA,MAAM,OAAO,GAAG,aAAa,CAAC,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC;IACpD,IAAI,CAAC,OAAO;QAAE,OAAO,SAA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CAAC;YACtC,IAAI,OAAO;gBAAE,OAAO,OAAO,CAAC;QAC7B,CAAC;IACF,CAAC;IACD,OAAO,SAAS,CAAC;AAClB,CAAC;AAED,SAAS,cAAc,CAAC,KAAc;IACrC,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAI,KAAK,GAAG,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS,CAAC;AAC7F,CAAC","sourcesContent":["const CONTEXT_RUNGS = [4_096, 8_192, 16_384, 32_768] as const;\nconst DEFAULT_HEADROOM_FRACTION = 0.8;\nconst F16_BYTES = 2;\nconst Q8_BYTES = 1;\n\nexport interface ContextSizingModelInfo {\n\tmodelInfo: Record<string, unknown>;\n\tweightsBytes: number;\n}\n\nexport interface ContextSizingHostProfile {\n\ttotalMemBytes: number;\n\theadroomFraction?: number;\n}\n\nexport interface ContextSizingRuntimeCaps {\n\tsupportsKvQuantization?: boolean;\n}\n\nexport interface ContextSizingDecision {\n\tnumCtx: number;\n\tkvCacheType?: \"q8_0\";\n\tkvBytesPerToken: number;\n\tbudgetBytes: number;\n\testimatedBytes: number;\n}\n\nexport function deriveLocalContextSizing(args: {\n\thost: ContextSizingHostProfile;\n\tmodel: ContextSizingModelInfo;\n\truntime?: ContextSizingRuntimeCaps;\n\trungs?: readonly number[];\n}): ContextSizingDecision | undefined {\n\tconst kvShape = deriveKvShape(args.model.modelInfo);\n\tif (!kvShape) return undefined;\n\tconst headroomFraction = args.host.headroomFraction ?? DEFAULT_HEADROOM_FRACTION;\n\tconst budgetBytes = Math.floor(args.host.totalMemBytes * headroomFraction);\n\tconst availableKvBytes = budgetBytes - args.model.weightsBytes;\n\tif (availableKvBytes <= 0) return undefined;\n\tconst rungs = args.rungs ?? CONTEXT_RUNGS;\n\tconst f16Decision = chooseContextRung({ availableKvBytes, bytesPerElement: F16_BYTES, budgetBytes, kvShape, rungs });\n\tif (!args.runtime?.supportsKvQuantization) return f16Decision;\n\tconst q8Decision = chooseContextRung({\n\t\tavailableKvBytes,\n\t\tbytesPerElement: Q8_BYTES,\n\t\tbudgetBytes,\n\t\tkvCacheType: \"q8_0\",\n\t\tkvShape,\n\t\trungs,\n\t});\n\tif (q8Decision && (!f16Decision || q8Decision.numCtx > f16Decision.numCtx)) return q8Decision;\n\treturn f16Decision;\n}\n\nexport function renderOllamaContextModelfile(args: { from: string; numCtx: number }): string {\n\treturn `FROM ${args.from}\\nPARAMETER num_ctx ${args.numCtx}\\n`;\n}\n\nexport function sizedLocalModelRef(sourceRef: string, numCtx: number): string {\n\treturn derivedLocalModelRef(sourceRef, `ctx${numCtx}`);\n}\n\nexport function derivedLocalModelRef(sourceRef: string, tag: string): string {\n\tconst safeSource = sourceRef.replace(/[^a-zA-Z0-9_.-]+/g, \"-\").replace(/^-+|-+$/g, \"\") || \"local-model\";\n\treturn `pi-${safeSource}:${tag}`;\n}\n\nfunction chooseContextRung(args: {\n\tavailableKvBytes: number;\n\tbytesPerElement: number;\n\tbudgetBytes: number;\n\tkvCacheType?: \"q8_0\";\n\tkvShape: { elementsPerToken: number };\n\trungs: readonly number[];\n}): ContextSizingDecision | undefined {\n\tconst kvBytesPerToken = args.kvShape.elementsPerToken * args.bytesPerElement;\n\tfor (const numCtx of [...args.rungs].sort((a, b) => b - a)) {\n\t\tconst estimatedBytes = kvBytesPerToken * numCtx;\n\t\tif (estimatedBytes <= args.availableKvBytes) {\n\t\t\treturn {\n\t\t\t\tnumCtx,\n\t\t\t\tkvCacheType: args.kvCacheType,\n\t\t\t\tkvBytesPerToken,\n\t\t\t\tbudgetBytes: args.budgetBytes,\n\t\t\t\testimatedBytes,\n\t\t\t};\n\t\t}\n\t}\n\treturn undefined;\n}\n\nfunction deriveKvShape(modelInfo: Record<string, unknown>): { elementsPerToken: number } | undefined {\n\tconst layers = modelInfoNumber(modelInfo, \"block_count\");\n\tif (!layers) return undefined;\n\tconst headCountKv = modelInfoNumber(modelInfo, \"attention.head_count_kv\");\n\tconst keyLength = modelInfoNumber(modelInfo, \"attention.key_length\");\n\tconst valueLength = modelInfoNumber(modelInfo, \"attention.value_length\");\n\tif (headCountKv && keyLength && valueLength) {\n\t\treturn { elementsPerToken: layers * headCountKv * (keyLength + valueLength) };\n\t}\n\tconst embeddingLength = modelInfoNumber(modelInfo, \"embedding_length\");\n\treturn embeddingLength ? { elementsPerToken: layers * embeddingLength * 2 } : undefined;\n}\n\nfunction modelInfoNumber(record: Record<string, unknown>, suffix: string): number | undefined {\n\tconst architecture = typeof record[\"general.architecture\"] === \"string\" ? record[\"general.architecture\"].trim() : \"\";\n\tif (architecture) return positiveNumber(record[`${architecture}.${suffix}`]);\n\tfor (const [key, value] of Object.entries(record)) {\n\t\tif (key.endsWith(`.${suffix}`)) {\n\t\t\tconst matched = positiveNumber(value);\n\t\t\tif (matched) return matched;\n\t\t}\n\t}\n\treturn undefined;\n}\n\nfunction positiveNumber(value: unknown): number | undefined {\n\treturn typeof value === \"number\" && Number.isFinite(value) && value > 0 ? value : undefined;\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"default-model-suggestions.d.ts","sourceRoot":"","sources":["../../../src/core/models/default-model-suggestions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,6DAA6D,CAAC;
|
|
1
|
+
{"version":3,"file":"default-model-suggestions.d.ts","sourceRoot":"","sources":["../../../src/core/models/default-model-suggestions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,6DAA6D,CAAC;AAG/F;;;;;;;;;;;;GAYG;AAEH,MAAM,WAAW,eAAe;IAC/B,4CAA4C;IAC5C,IAAI,EAAE,MAAM,CAAC;IACb,6DAA6D;IAC7D,OAAO,EAAE,MAAM,CAAC;IAChB,gDAAgD;IAChD,IAAI,EAAE,MAAM,CAAC;IACb,oGAAoG;IACpG,WAAW,EAAE,OAAO,CAAC;IACrB,mGAAmG;IACnG,UAAU,CAAC,EAAE,WAAW,CAAC;IACzB,qFAAqF;IACrF,SAAS,EAAE,MAAM,CAAC;IAClB,oDAAoD;IACpD,IAAI,CAAC,EAAE,MAAM,CAAC;CACd;AAED,eAAO,MAAM,yBAAyB,EAAE,SAAS,eAAe,EAqH/D,CAAC;AAEF,gFAAgF;AAChF,wBAAgB,sBAAsB,CAAC,WAAW,GAAE,SAAS,eAAe,EAA8B,GAAG,MAAM,EAAE,CAcpH"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { ORNITH_9B_OLLAMA_REF } from "./managed-ollama-model.js";
|
|
1
2
|
export const DEFAULT_MODEL_SUGGESTIONS = [
|
|
2
3
|
{
|
|
3
4
|
name: "qwen3:1.7b",
|
|
@@ -35,12 +36,21 @@ export const DEFAULT_MODEL_SUGGESTIONS = [
|
|
|
35
36
|
},
|
|
36
37
|
{
|
|
37
38
|
name: "Ornith-1.0-9B",
|
|
38
|
-
pullRef:
|
|
39
|
+
pullRef: ORNITH_9B_OLLAMA_REF,
|
|
39
40
|
role: "Agentic-coding worker / router cheap tier",
|
|
40
41
|
toolCalling: true,
|
|
41
42
|
assignRole: "router-cheap",
|
|
42
43
|
rationale: "External candidate (not from pi's own validation research): MIT, Qwen 3.5 base, RL-trained for agentic coding with native tool-calling — the strongest local worker SHAPE in the roster. /fitness on your hardware is the validator.",
|
|
43
|
-
note: "Q4_K_M ≈ 5.6 GB weights, ~7-8 GB peak with KV — on a 10 GB box run it as the ONLY local model. Qwen 3.5
|
|
44
|
+
note: "Q4_K_M ≈ 5.6 GB weights, ~7-8 GB peak with KV — on a 10 GB box run it as the ONLY local model. Pi creates a managed Qwen 3.5 renderer/parser profile with the model's recommended sampling before probing. Larger boxes: consider router-medium after a passed worker lane.",
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
name: "LFM2.5-8B-A1B",
|
|
48
|
+
pullRef: "lfm2.5:8b-a1b-q4_K_M",
|
|
49
|
+
role: "Native-tool MoE worker / router cheap tier",
|
|
50
|
+
toolCalling: true,
|
|
51
|
+
assignRole: "router-cheap",
|
|
52
|
+
rationale: "Liquid AI's sparse MoE candidate is designed for agentic workflows. Pi probes native tool-calling first and only calibrates the phone protocol after native failure; /fitness must pass the task-scale tool lane on this host before assignment.",
|
|
53
|
+
note: "Q4_K_M ≈ 5.2 GB, 8.3B total / 1.5B active parameters, with a 128K-class model context. On a 10 GB host run it as the only large local resident; Pi still applies its bounded host profile and context budget.",
|
|
44
54
|
},
|
|
45
55
|
{
|
|
46
56
|
name: "Bonsai-4B (GGUF Q1_0)",
|
|
@@ -49,7 +59,7 @@ export const DEFAULT_MODEL_SUGGESTIONS = [
|
|
|
49
59
|
toolCalling: false,
|
|
50
60
|
assignRole: "curator",
|
|
51
61
|
rationale: "Lighter Bonsai lane model for context curation and structured local analysis; the exact Q1_0 artifact keeps /models suggest one-step.",
|
|
52
|
-
note: "Recommended when Bonsai-8B is too heavy. Pi
|
|
62
|
+
note: "Recommended when Bonsai-8B is too heavy. Pi serves the exact Q1_0 GGUF through its bounded Prism llama.cpp adapter, probes /fitness on the host, then offers the curator role.",
|
|
53
63
|
},
|
|
54
64
|
{
|
|
55
65
|
name: "Bonsai-27B (1-bit + vision)",
|
|
@@ -57,34 +67,34 @@ export const DEFAULT_MODEL_SUGGESTIONS = [
|
|
|
57
67
|
role: "Context curator / reflex brain / vision-capable lane analyst",
|
|
58
68
|
toolCalling: false,
|
|
59
69
|
assignRole: "curator",
|
|
60
|
-
rationale: "External 1-bit 27B, binary weights, 262K-class context, vision via mmproj; served
|
|
70
|
+
rationale: "External 1-bit 27B, binary weights, 262K-class context, vision via mmproj; served through Pi's pinned Prism llama.cpp adapter so runtime, artifact, and projector stay one validated unit. /fitness on your hardware is the validator — never pre-claim tool-calling.",
|
|
61
71
|
note: "~3.8 GB weights + 629 MB vision projector + a one-time llama-server runtime download; CPU-served on GPU-less hosts. Pi installs the pinned prism llama.cpp runtime, downloads both files, starts llama-server, and registers the model in one step. Provider-recommended sampling is temp 0.7 / top-p 0.95 / top-k 20; models.json has no per-model default-sampling field yet, so pi cannot wire this — set it per-request/session if your workflow needs it.",
|
|
62
72
|
},
|
|
63
73
|
{
|
|
64
74
|
name: "Ternary-Bonsai-1.7B",
|
|
65
|
-
pullRef: "hf.co/prism-ml/Ternary-Bonsai-1.7B-gguf",
|
|
75
|
+
pullRef: "hf.co/prism-ml/Ternary-Bonsai-1.7B-gguf:Q2_0",
|
|
66
76
|
role: "Search scout (heavy-lifter)",
|
|
67
77
|
toolCalling: false,
|
|
68
78
|
rationale: "Ternary weights, very fast; strong at structured search plans. No tool-calling template — use it as a research/worker lane model, never an executor.",
|
|
69
|
-
note: "
|
|
79
|
+
note: "Pi pins the provider's group-128 Q2_0 artifact and its matched Prism llama.cpp runtime; no ambiguous quant selection is left to Ollama.",
|
|
70
80
|
},
|
|
71
81
|
{
|
|
72
82
|
name: "Ternary-Bonsai-4B",
|
|
73
|
-
pullRef: "hf.co/prism-ml/Ternary-Bonsai-4B-gguf",
|
|
83
|
+
pullRef: "hf.co/prism-ml/Ternary-Bonsai-4B-gguf:Q2_0",
|
|
74
84
|
role: "Context curator / reflex brain / lane analyst",
|
|
75
85
|
toolCalling: false,
|
|
76
86
|
assignRole: "curator",
|
|
77
87
|
rationale: "Validated as the 'brain': strict-JSON interpretation and faithful digests. Drives context curation and the toolkit reflex interpreter. Not a tool-caller.",
|
|
78
|
-
note: "
|
|
88
|
+
note: "Pi pins the provider's group-128 Q2_0 artifact and its matched Prism llama.cpp runtime.",
|
|
79
89
|
},
|
|
80
90
|
{
|
|
81
91
|
name: "Ternary-Bonsai-8B",
|
|
82
|
-
pullRef: "hf.co/prism-ml/Ternary-Bonsai-8B-gguf",
|
|
92
|
+
pullRef: "hf.co/prism-ml/Ternary-Bonsai-8B-gguf:Q2_0",
|
|
83
93
|
role: "Routing judge (larger machines)",
|
|
84
94
|
toolCalling: false,
|
|
85
95
|
assignRole: "judge",
|
|
86
96
|
rationale: "A judge candidate for machines with more headroom — too slow on ~16GB-class hardware in this research, kept for a bigger box.",
|
|
87
|
-
note: "Heavy: confirm tok/s with /fitness before
|
|
97
|
+
note: "Heavy: confirm tok/s with /fitness before assigning it. Pi pins the Q2_0 artifact and matched Prism llama.cpp runtime.",
|
|
88
98
|
},
|
|
89
99
|
{
|
|
90
100
|
name: "needle (function-call tester, 26M)",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"default-model-suggestions.js","sourceRoot":"","sources":["../../../src/core/models/default-model-suggestions.ts"],"names":[],"mappings":"AAiCA,MAAM,CAAC,MAAM,yBAAyB,GAA+B;IACpE;QACC,IAAI,EAAE,YAAY;QAClB,OAAO,EAAE,YAAY;QACrB,IAAI,EAAE,kCAAkC;QACxC,WAAW,EAAE,IAAI;QACjB,UAAU,EAAE,UAAU;QACtB,SAAS,EACR,0HAA0H;KAC3H;IACD;QACC,IAAI,EAAE,YAAY;QAClB,OAAO,EAAE,YAAY;QACrB,IAAI,EAAE,4BAA4B;QAClC,WAAW,EAAE,IAAI;QACjB,UAAU,EAAE,UAAU;QACtB,SAAS,EACR,4IAA4I;KAC7I;IACD;QACC,IAAI,EAAE,yBAAyB;QAC/B,OAAO,EAAE,2BAA2B;QACpC,IAAI,EAAE,qDAAqD;QAC3D,WAAW,EAAE,IAAI;QACjB,UAAU,EAAE,UAAU;QACtB,SAAS,EACR,wMAAwM;QACzM,IAAI,EAAE,oIAAoI;KAC1I;IACD;QACC,IAAI,EAAE,oBAAoB;QAC1B,OAAO,EAAE,qFAAqF;QAC9F,IAAI,EAAE,kCAAkC;QACxC,WAAW,EAAE,IAAI;QACjB,UAAU,EAAE,OAAO;QACnB,SAAS,EACR,gOAAgO;QACjO,IAAI,EAAE,2IAA2I;KACjJ;IACD;QACC,IAAI,EAAE,eAAe;QACrB,OAAO,EAAE,kDAAkD;QAC3D,IAAI,EAAE,2CAA2C;QACjD,WAAW,EAAE,IAAI;QACjB,UAAU,EAAE,cAAc;QAC1B,SAA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MAAM,KAAK,GAAG;QACb,oHAAoH;KACpH,CAAC;IACF,KAAK,MAAM,UAAU,IAAI,WAAW,EAAE,CAAC;QACtC,KAAK,CAAC,IAAI,CACT,OAAO,UAAU,CAAC,IAAI,MAAM,UAAU,CAAC,IAAI,GAAG,UAAU,CAAC,WAAW,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,oBAAoB,EAAE,EAClG,qBAAqB,UAAU,CAAC,OAAO,EAAE,EACzC,SAAS,UAAU,CAAC,SAAS,EAAE,CAC/B,CAAC;QACF,IAAI,UAAU,CAAC,IAAI;YAAE,KAAK,CAAC,IAAI,CAAC,eAAe,UAAU,CAAC,IAAI,EAAE,CAAC,CAAC;IACnE,CAAC;IACD,KAAK,CAAC,IAAI,CAAC,yFAAyF,CAAC,CAAC;IACtG,OAAO,KAAK,CAAC;AACd,CAAC","sourcesContent":["import type { FitnessRole } from \"../../modes/interactive/components/fitness-role-selector.ts\";\n\n/**\n * Curated local-model suggestions: a starting roster validated during pi-adaptative's own\n * small-model research so a user does not have to know WHICH model fits WHICH role. Each entry is\n * an install ref (accepted by /models add) plus the role it was validated for and whether it can use\n * tools. Native tool-calling remains preferred when it works; text-protocol models are listed only\n * when their runtime is pi-managed and the fitness/probe path can calibrate that fallback.\n *\n * Honesty: these are SUGGESTIONS, not guarantees. Fitness is a property of the model AND the host\n * hardware, so no per-model score is baked in here — `/models add` auto-probes on the actual\n * machine, and the roster only encodes what role each model was SHAPED for. `assignRole` is the\n * /fitness role the suggestion maps to (undefined = no single-setting slot yet; use it as a\n * research/worker lane model).\n */\n\nexport interface ModelSuggestion {\n\t/** Display name in the suggestions list. */\n\tname: string;\n\t/** Ref accepted by /models add and the source normalizer. */\n\tpullRef: string;\n\t/** Role this model was validated/shaped for. */\n\trole: string;\n\t/** True if the model can use tools after host-local probing/calibration (required for executor). */\n\ttoolCalling: boolean;\n\t/** The /fitness assignment target this suggestion maps to, when there is a single-setting slot. */\n\tassignRole?: FitnessRole;\n\t/** One-line rationale from the validation work; never a fabricated numeric score. */\n\trationale: string;\n\t/** Optional caveat (quant selection, RAM needs). */\n\tnote?: string;\n}\n\nexport const DEFAULT_MODEL_SUGGESTIONS: readonly ModelSuggestion[] = [\n\t{\n\t\tname: \"qwen3:1.7b\",\n\t\tpullRef: \"qwen3:1.7b\",\n\t\trole: \"Toolkit executor / reflex muscle\",\n\t\ttoolCalling: true,\n\t\tassignRole: \"executor\",\n\t\trationale:\n\t\t\t\"Validated as the executor: reliable native tool-calling and low latency, so direct toolkit commands run without retries.\",\n\t},\n\t{\n\t\tname: \"qwen3:0.6b\",\n\t\tpullRef: \"qwen3:0.6b\",\n\t\trole: \"Minimal executor (fastest)\",\n\t\ttoolCalling: true,\n\t\tassignRole: \"executor\",\n\t\trationale:\n\t\t\t\"Fastest local option; on harder requests it can narrate without executing, so prefer it only when speed dominates and requests are simple.\",\n\t},\n\t{\n\t\tname: \"MiniCPM5-1B (full-base)\",\n\t\tpullRef: \"hf.co/openbmb/MiniCPM5-1B\",\n\t\trole: \"Full-base Transformers executor / tiny local muscle\",\n\t\ttoolCalling: true,\n\t\tassignRole: \"executor\",\n\t\trationale:\n\t\t\t\"Full-base Hugging Face MiniCPM5-1B target: pi installs an isolated Transformers runtime and probes native tool-calling first, then calibrates the text protocol only if native tool calls do not work.\",\n\t\tnote: \"Not GGUF/quantized: weights and Python deps land under pi-owned runtime/cache directories, separate from Ollama and system Python.\",\n\t},\n\t{\n\t\tname: \"FastContext-1.0-4B\",\n\t\tpullRef: \"hf.co/KikoCis/FastContext-1.0-4B-longctx-imatrix-GGUF:fastcontext4b.Q4_K_M.imx.gguf\",\n\t\trole: \"Repository scout (context_scout)\",\n\t\ttoolCalling: true,\n\t\tassignRole: \"scout\",\n\t\trationale:\n\t\t\t\"The model the context_scout lane is built around (Plan 9): 4B Qwen3, 256K context, trained for read-only repo exploration returning file:line citations. /fitness must pass the tool-calls + research lanes before assignment.\",\n\t\tnote: \"Q4 ≈ 2.5 GB; ~5-6 GB peak with 32-64K KV. Qwen3 template caveat: if tool calls fail the probe, use the Modelfile recipe in docs/scout.md.\",\n\t},\n\t{\n\t\tname: \"Ornith-1.0-9B\",\n\t\tpullRef: \"hf.co/deepreinforce-ai/Ornith-1.0-9B-GGUF:Q4_K_M\",\n\t\trole: \"Agentic-coding worker / router cheap tier\",\n\t\ttoolCalling: true,\n\t\tassignRole: \"router-cheap\",\n\t\trationale:\n\t\t\t\"External candidate (not from pi's own validation research): MIT, Qwen 3.5 base, RL-trained for agentic coding with native tool-calling — the strongest local worker SHAPE in the roster. /fitness on your hardware is the validator.\",\n\t\tnote: \"Q4_K_M ≈ 5.6 GB weights, ~7-8 GB peak with KV — on a 10 GB box run it as the ONLY local model. Qwen 3.5 arch: confirm pi's pinned Ollama supports it and probe tool-calls with /fitness before assigning (template derives from the GGUF). Larger boxes: consider router-medium after a passed worker lane.\",\n\t},\n\t{\n\t\tname: \"Bonsai-4B (GGUF Q1_0)\",\n\t\tpullRef: \"hf.co/prism-ml/Bonsai-4B-gguf:Q1_0\",\n\t\trole: \"Context curator / reflex brain / lighter lane analyst\",\n\t\ttoolCalling: false,\n\t\tassignRole: \"curator\",\n\t\trationale:\n\t\t\t\"Lighter Bonsai lane model for context curation and structured local analysis; the exact Q1_0 artifact keeps /models suggest one-step.\",\n\t\tnote: \"Recommended when Bonsai-8B is too heavy. Pi pulls this exact GGUF through managed Ollama, probes /fitness on the host, then offers the curator role.\",\n\t},\n\t{\n\t\tname: \"Bonsai-27B (1-bit + vision)\",\n\t\tpullRef: \"hf.co/prism-ml/Bonsai-27B-gguf:Q1_0\",\n\t\trole: \"Context curator / reflex brain / vision-capable lane analyst\",\n\t\ttoolCalling: false,\n\t\tassignRole: \"curator\",\n\t\trationale:\n\t\t\t\"External 1-bit 27B, binary weights, 262K-class context, vision via mmproj; served by pi through prism-ml's llama.cpp build (stock llama.cpp/Ollama cannot serve these weights). /fitness on your hardware is the validator — never pre-claim tool-calling.\",\n\t\tnote: \"~3.8 GB weights + 629 MB vision projector + a one-time llama-server runtime download; CPU-served on GPU-less hosts. Pi installs the pinned prism llama.cpp runtime, downloads both files, starts llama-server, and registers the model in one step. Provider-recommended sampling is temp 0.7 / top-p 0.95 / top-k 20; models.json has no per-model default-sampling field yet, so pi cannot wire this — set it per-request/session if your workflow needs it.\",\n\t},\n\t{\n\t\tname: \"Ternary-Bonsai-1.7B\",\n\t\tpullRef: \"hf.co/prism-ml/Ternary-Bonsai-1.7B-gguf\",\n\t\trole: \"Search scout (heavy-lifter)\",\n\t\ttoolCalling: false,\n\t\trationale:\n\t\t\t\"Ternary weights, very fast; strong at structured search plans. No tool-calling template — use it as a research/worker lane model, never an executor.\",\n\t\tnote: \"Pick a GGUF quant the runtime accepts (e.g. :Q8_0). The ternary Q2_0 build needs prism-ml's patched llama.cpp.\",\n\t},\n\t{\n\t\tname: \"Ternary-Bonsai-4B\",\n\t\tpullRef: \"hf.co/prism-ml/Ternary-Bonsai-4B-gguf\",\n\t\trole: \"Context curator / reflex brain / lane analyst\",\n\t\ttoolCalling: false,\n\t\tassignRole: \"curator\",\n\t\trationale:\n\t\t\t\"Validated as the 'brain': strict-JSON interpretation and faithful digests. Drives context curation and the toolkit reflex interpreter. Not a tool-caller.\",\n\t\tnote: \"Pick a GGUF quant the runtime accepts (e.g. :Q8_0).\",\n\t},\n\t{\n\t\tname: \"Ternary-Bonsai-8B\",\n\t\tpullRef: \"hf.co/prism-ml/Ternary-Bonsai-8B-gguf\",\n\t\trole: \"Routing judge (larger machines)\",\n\t\ttoolCalling: false,\n\t\tassignRole: \"judge\",\n\t\trationale:\n\t\t\t\"A judge candidate for machines with more headroom — too slow on ~16GB-class hardware in this research, kept for a bigger box.\",\n\t\tnote: \"Heavy: confirm tok/s with /fitness before committing. Ternary quant may need prism-ml's patched llama.cpp.\",\n\t},\n\t{\n\t\tname: \"needle (function-call tester, 26M)\",\n\t\tpullRef: \"hf.co/Cactus-Compute/needle\",\n\t\trole: \"Standalone function-call test bench (not a chat/lane model)\",\n\t\ttoolCalling: false,\n\t\trationale:\n\t\t\t\"NOT a pi chat model, executor, or lane model — needle is a 26M-parameter single-shot function-call SPECIALIST invoked one query at a time through its own `needle run` CLI, useful only as a standalone bench for probing tool-call behavior in isolation. No OpenAI-compatible endpoint, no chat lanes, no models.json registration, and no /fitness probe: use /models needle <query> [tools-json] to test it directly instead.\",\n\t\tnote: \"Upstream weights (needle.pkl) are pickle-only — arbitrary code execution on load by construction, not something pi's pinned-sha256 verification makes safe in the abstract, only tamper-evident.\",\n\t},\n];\n\n/** Bounded plain-text roster for `/models suggest` and the empty-store hint. */\nexport function formatModelSuggestions(suggestions: readonly ModelSuggestion[] = DEFAULT_MODEL_SUGGESTIONS): string[] {\n\tconst lines = [\n\t\t\"Suggested local models (validated roles from pi's own small-model research; probe on YOUR hardware with /fitness):\",\n\t];\n\tfor (const suggestion of suggestions) {\n\t\tlines.push(\n\t\t\t` - ${suggestion.name} → ${suggestion.role}${suggestion.toolCalling ? \"\" : \" [no tool-calling]\"}`,\n\t\t\t` /models add ${suggestion.pullRef}`,\n\t\t\t` ${suggestion.rationale}`,\n\t\t);\n\t\tif (suggestion.note) lines.push(` note: ${suggestion.note}`);\n\t}\n\tlines.push(\"Add one with /models add <ref> — pi pulls it, probes it, and offers a role in one step.\");\n\treturn lines;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"default-model-suggestions.js","sourceRoot":"","sources":["../../../src/core/models/default-model-suggestions.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AAiCjE,MAAM,CAAC,MAAM,yBAAyB,GAA+B;IACpE;QACC,IAAI,EAAE,YAAY;QAClB,OAAO,EAAE,YAAY;QACrB,IAAI,EAAE,kCAAkC;QACxC,WAAW,EAAE,IAAI;QACjB,UAAU,EAAE,UAAU;QACtB,SAAS,EACR,0HAA0H;KAC3H;IACD;QACC,IAAI,EAAE,YAAY;QAClB,OAAO,EAAE,YAAY;QACrB,IAA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,EAAE,CAAC,CAAC;IACnE,CAAC;IACD,KAAK,CAAC,IAAI,CAAC,yFAAyF,CAAC,CAAC;IACtG,OAAO,KAAK,CAAC;AACd,CAAC","sourcesContent":["import type { FitnessRole } from \"../../modes/interactive/components/fitness-role-selector.ts\";\nimport { ORNITH_9B_OLLAMA_REF } from \"./managed-ollama-model.ts\";\n\n/**\n * Curated local-model suggestions: a starting roster validated during pi-adaptative's own\n * small-model research so a user does not have to know WHICH model fits WHICH role. Each entry is\n * an install ref (accepted by /models add) plus the role it was validated for and whether it can use\n * tools. Native tool-calling remains preferred when it works; text-protocol models are listed only\n * when their runtime is pi-managed and the fitness/probe path can calibrate that fallback.\n *\n * Honesty: these are SUGGESTIONS, not guarantees. Fitness is a property of the model AND the host\n * hardware, so no per-model score is baked in here — `/models add` auto-probes on the actual\n * machine, and the roster only encodes what role each model was SHAPED for. `assignRole` is the\n * /fitness role the suggestion maps to (undefined = no single-setting slot yet; use it as a\n * research/worker lane model).\n */\n\nexport interface ModelSuggestion {\n\t/** Display name in the suggestions list. */\n\tname: string;\n\t/** Ref accepted by /models add and the source normalizer. */\n\tpullRef: string;\n\t/** Role this model was validated/shaped for. */\n\trole: string;\n\t/** True if the model can use tools after host-local probing/calibration (required for executor). */\n\ttoolCalling: boolean;\n\t/** The /fitness assignment target this suggestion maps to, when there is a single-setting slot. */\n\tassignRole?: FitnessRole;\n\t/** One-line rationale from the validation work; never a fabricated numeric score. */\n\trationale: string;\n\t/** Optional caveat (quant selection, RAM needs). */\n\tnote?: string;\n}\n\nexport const DEFAULT_MODEL_SUGGESTIONS: readonly ModelSuggestion[] = [\n\t{\n\t\tname: \"qwen3:1.7b\",\n\t\tpullRef: \"qwen3:1.7b\",\n\t\trole: \"Toolkit executor / reflex muscle\",\n\t\ttoolCalling: true,\n\t\tassignRole: \"executor\",\n\t\trationale:\n\t\t\t\"Validated as the executor: reliable native tool-calling and low latency, so direct toolkit commands run without retries.\",\n\t},\n\t{\n\t\tname: \"qwen3:0.6b\",\n\t\tpullRef: \"qwen3:0.6b\",\n\t\trole: \"Minimal executor (fastest)\",\n\t\ttoolCalling: true,\n\t\tassignRole: \"executor\",\n\t\trationale:\n\t\t\t\"Fastest local option; on harder requests it can narrate without executing, so prefer it only when speed dominates and requests are simple.\",\n\t},\n\t{\n\t\tname: \"MiniCPM5-1B (full-base)\",\n\t\tpullRef: \"hf.co/openbmb/MiniCPM5-1B\",\n\t\trole: \"Full-base Transformers executor / tiny local muscle\",\n\t\ttoolCalling: true,\n\t\tassignRole: \"executor\",\n\t\trationale:\n\t\t\t\"Full-base Hugging Face MiniCPM5-1B target: pi installs an isolated Transformers runtime and probes native tool-calling first, then calibrates the text protocol only if native tool calls do not work.\",\n\t\tnote: \"Not GGUF/quantized: weights and Python deps land under pi-owned runtime/cache directories, separate from Ollama and system Python.\",\n\t},\n\t{\n\t\tname: \"FastContext-1.0-4B\",\n\t\tpullRef: \"hf.co/KikoCis/FastContext-1.0-4B-longctx-imatrix-GGUF:fastcontext4b.Q4_K_M.imx.gguf\",\n\t\trole: \"Repository scout (context_scout)\",\n\t\ttoolCalling: true,\n\t\tassignRole: \"scout\",\n\t\trationale:\n\t\t\t\"The model the context_scout lane is built around (Plan 9): 4B Qwen3, 256K context, trained for read-only repo exploration returning file:line citations. /fitness must pass the tool-calls + research lanes before assignment.\",\n\t\tnote: \"Q4 ≈ 2.5 GB; ~5-6 GB peak with 32-64K KV. Qwen3 template caveat: if tool calls fail the probe, use the Modelfile recipe in docs/scout.md.\",\n\t},\n\t{\n\t\tname: \"Ornith-1.0-9B\",\n\t\tpullRef: ORNITH_9B_OLLAMA_REF,\n\t\trole: \"Agentic-coding worker / router cheap tier\",\n\t\ttoolCalling: true,\n\t\tassignRole: \"router-cheap\",\n\t\trationale:\n\t\t\t\"External candidate (not from pi's own validation research): MIT, Qwen 3.5 base, RL-trained for agentic coding with native tool-calling — the strongest local worker SHAPE in the roster. /fitness on your hardware is the validator.\",\n\t\tnote: \"Q4_K_M ≈ 5.6 GB weights, ~7-8 GB peak with KV — on a 10 GB box run it as the ONLY local model. Pi creates a managed Qwen 3.5 renderer/parser profile with the model's recommended sampling before probing. Larger boxes: consider router-medium after a passed worker lane.\",\n\t},\n\t{\n\t\tname: \"LFM2.5-8B-A1B\",\n\t\tpullRef: \"lfm2.5:8b-a1b-q4_K_M\",\n\t\trole: \"Native-tool MoE worker / router cheap tier\",\n\t\ttoolCalling: true,\n\t\tassignRole: \"router-cheap\",\n\t\trationale:\n\t\t\t\"Liquid AI's sparse MoE candidate is designed for agentic workflows. Pi probes native tool-calling first and only calibrates the phone protocol after native failure; /fitness must pass the task-scale tool lane on this host before assignment.\",\n\t\tnote: \"Q4_K_M ≈ 5.2 GB, 8.3B total / 1.5B active parameters, with a 128K-class model context. On a 10 GB host run it as the only large local resident; Pi still applies its bounded host profile and context budget.\",\n\t},\n\t{\n\t\tname: \"Bonsai-4B (GGUF Q1_0)\",\n\t\tpullRef: \"hf.co/prism-ml/Bonsai-4B-gguf:Q1_0\",\n\t\trole: \"Context curator / reflex brain / lighter lane analyst\",\n\t\ttoolCalling: false,\n\t\tassignRole: \"curator\",\n\t\trationale:\n\t\t\t\"Lighter Bonsai lane model for context curation and structured local analysis; the exact Q1_0 artifact keeps /models suggest one-step.\",\n\t\tnote: \"Recommended when Bonsai-8B is too heavy. Pi serves the exact Q1_0 GGUF through its bounded Prism llama.cpp adapter, probes /fitness on the host, then offers the curator role.\",\n\t},\n\t{\n\t\tname: \"Bonsai-27B (1-bit + vision)\",\n\t\tpullRef: \"hf.co/prism-ml/Bonsai-27B-gguf:Q1_0\",\n\t\trole: \"Context curator / reflex brain / vision-capable lane analyst\",\n\t\ttoolCalling: false,\n\t\tassignRole: \"curator\",\n\t\trationale:\n\t\t\t\"External 1-bit 27B, binary weights, 262K-class context, vision via mmproj; served through Pi's pinned Prism llama.cpp adapter so runtime, artifact, and projector stay one validated unit. /fitness on your hardware is the validator — never pre-claim tool-calling.\",\n\t\tnote: \"~3.8 GB weights + 629 MB vision projector + a one-time llama-server runtime download; CPU-served on GPU-less hosts. Pi installs the pinned prism llama.cpp runtime, downloads both files, starts llama-server, and registers the model in one step. Provider-recommended sampling is temp 0.7 / top-p 0.95 / top-k 20; models.json has no per-model default-sampling field yet, so pi cannot wire this — set it per-request/session if your workflow needs it.\",\n\t},\n\t{\n\t\tname: \"Ternary-Bonsai-1.7B\",\n\t\tpullRef: \"hf.co/prism-ml/Ternary-Bonsai-1.7B-gguf:Q2_0\",\n\t\trole: \"Search scout (heavy-lifter)\",\n\t\ttoolCalling: false,\n\t\trationale:\n\t\t\t\"Ternary weights, very fast; strong at structured search plans. No tool-calling template — use it as a research/worker lane model, never an executor.\",\n\t\tnote: \"Pi pins the provider's group-128 Q2_0 artifact and its matched Prism llama.cpp runtime; no ambiguous quant selection is left to Ollama.\",\n\t},\n\t{\n\t\tname: \"Ternary-Bonsai-4B\",\n\t\tpullRef: \"hf.co/prism-ml/Ternary-Bonsai-4B-gguf:Q2_0\",\n\t\trole: \"Context curator / reflex brain / lane analyst\",\n\t\ttoolCalling: false,\n\t\tassignRole: \"curator\",\n\t\trationale:\n\t\t\t\"Validated as the 'brain': strict-JSON interpretation and faithful digests. Drives context curation and the toolkit reflex interpreter. Not a tool-caller.\",\n\t\tnote: \"Pi pins the provider's group-128 Q2_0 artifact and its matched Prism llama.cpp runtime.\",\n\t},\n\t{\n\t\tname: \"Ternary-Bonsai-8B\",\n\t\tpullRef: \"hf.co/prism-ml/Ternary-Bonsai-8B-gguf:Q2_0\",\n\t\trole: \"Routing judge (larger machines)\",\n\t\ttoolCalling: false,\n\t\tassignRole: \"judge\",\n\t\trationale:\n\t\t\t\"A judge candidate for machines with more headroom — too slow on ~16GB-class hardware in this research, kept for a bigger box.\",\n\t\tnote: \"Heavy: confirm tok/s with /fitness before assigning it. Pi pins the Q2_0 artifact and matched Prism llama.cpp runtime.\",\n\t},\n\t{\n\t\tname: \"needle (function-call tester, 26M)\",\n\t\tpullRef: \"hf.co/Cactus-Compute/needle\",\n\t\trole: \"Standalone function-call test bench (not a chat/lane model)\",\n\t\ttoolCalling: false,\n\t\trationale:\n\t\t\t\"NOT a pi chat model, executor, or lane model — needle is a 26M-parameter single-shot function-call SPECIALIST invoked one query at a time through its own `needle run` CLI, useful only as a standalone bench for probing tool-call behavior in isolation. No OpenAI-compatible endpoint, no chat lanes, no models.json registration, and no /fitness probe: use /models needle <query> [tools-json] to test it directly instead.\",\n\t\tnote: \"Upstream weights (needle.pkl) are pickle-only — arbitrary code execution on load by construction, not something pi's pinned-sha256 verification makes safe in the abstract, only tamper-evident.\",\n\t},\n];\n\n/** Bounded plain-text roster for `/models suggest` and the empty-store hint. */\nexport function formatModelSuggestions(suggestions: readonly ModelSuggestion[] = DEFAULT_MODEL_SUGGESTIONS): string[] {\n\tconst lines = [\n\t\t\"Suggested local models (validated roles from pi's own small-model research; probe on YOUR hardware with /fitness):\",\n\t];\n\tfor (const suggestion of suggestions) {\n\t\tlines.push(\n\t\t\t` - ${suggestion.name} → ${suggestion.role}${suggestion.toolCalling ? \"\" : \" [no tool-calling]\"}`,\n\t\t\t` /models add ${suggestion.pullRef}`,\n\t\t\t` ${suggestion.rationale}`,\n\t\t);\n\t\tif (suggestion.note) lines.push(` note: ${suggestion.note}`);\n\t}\n\tlines.push(\"Add one with /models add <ref> — pi pulls it, probes it, and offers a role in one step.\");\n\treturn lines;\n}\n"]}
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import type { Readable } from "node:stream";
|
|
2
|
+
import { type LocalInferenceProfileMode } from "./local-inference-profile.ts";
|
|
2
3
|
import { type ManagedRuntimeSpawn } from "./runtime-process.ts";
|
|
3
4
|
/**
|
|
4
|
-
* Managed runtime for
|
|
5
|
-
* llama.cpp
|
|
6
|
-
*
|
|
7
|
-
* downloads, and llama-server lifecycle. Mirrors local-runtime.ts's OllamaRuntime: injectable
|
|
5
|
+
* Managed runtime for Pi's curated Prism 1-bit and ternary GGUF models. Q1_0 is available in
|
|
6
|
+
* upstream llama.cpp, while the selected group-128 Q2_0 artifacts and paired DSpark acceleration
|
|
7
|
+
* still require Prism's validated build. This module therefore owns the pinned runtime install,
|
|
8
|
+
* GGUF downloads, and llama-server lifecycle. Mirrors local-runtime.ts's OllamaRuntime: injectable
|
|
8
9
|
* seams for fetch/spawn/exists, pi-owned directories under agentDir (runtimes/, models/),
|
|
9
10
|
* detached+tracked child processes, onProgress as best-effort UI feedback, honest error taxonomies
|
|
10
11
|
* instead of silent fallbacks.
|
|
@@ -28,23 +29,38 @@ export interface PrismModelDescriptor {
|
|
|
28
29
|
file: string;
|
|
29
30
|
mmprojFile?: string;
|
|
30
31
|
displayName: string;
|
|
32
|
+
architecture: "dense";
|
|
33
|
+
runtime: "prism-llamacpp";
|
|
34
|
+
family: "bonsai" | "ternary-bonsai";
|
|
35
|
+
parameterScale: "1.7B" | "4B" | "8B" | "27B";
|
|
36
|
+
weightFormat: "q1_0" | "q2_0";
|
|
37
|
+
matchedDrafter?: {
|
|
38
|
+
kind: "dspark";
|
|
39
|
+
file: string;
|
|
40
|
+
draftMax: 4;
|
|
41
|
+
minimumContext: 16_384;
|
|
42
|
+
validatedBackend: "cuda";
|
|
43
|
+
};
|
|
31
44
|
}
|
|
32
|
-
/** Curated
|
|
45
|
+
/** Curated 27B descriptor shared by the full local execution catalog. */
|
|
33
46
|
export declare const BONSAI_27B: PrismModelDescriptor;
|
|
34
47
|
export type PrismBackend = "cpu" | "cuda";
|
|
35
48
|
export type PrismAssetKind = "tar-gz" | "zip";
|
|
36
|
-
export interface
|
|
49
|
+
export interface PrismArchiveAsset {
|
|
37
50
|
name: string;
|
|
38
51
|
kind: PrismAssetKind;
|
|
52
|
+
}
|
|
53
|
+
export interface PrismLlamaAsset extends PrismArchiveAsset {
|
|
39
54
|
backend: PrismBackend;
|
|
55
|
+
companionAssets?: readonly PrismArchiveAsset[];
|
|
40
56
|
}
|
|
41
57
|
/**
|
|
42
58
|
* Maps a platform/arch/GPU triple to the exact Prism llama.cpp release asset for
|
|
43
59
|
* {@link PRISM_LLAMACPP_PINNED_RELEASE} — verified against the real GitHub release, not guessed.
|
|
44
|
-
* CPU asset by default;
|
|
45
|
-
*
|
|
46
|
-
*
|
|
47
|
-
*
|
|
60
|
+
* CPU asset by default; CUDA 12.4 is selected for x64 Linux or Windows with an NVIDIA GPU. The
|
|
61
|
+
* pinned Windows build is incomplete without its matching `cudart-*` archive, so the resolver
|
|
62
|
+
* returns both as one mandatory installation plan. Pure and exported so it's independently
|
|
63
|
+
* testable.
|
|
48
64
|
*/
|
|
49
65
|
export declare function resolvePrismLlamaAsset(plat: string, architecture: string, hasNvidiaGpu: boolean): PrismLlamaAsset | undefined;
|
|
50
66
|
export interface PrismDetectResult {
|
|
@@ -65,6 +81,11 @@ export type PrismServeResult = {
|
|
|
65
81
|
ok: false;
|
|
66
82
|
error: string;
|
|
67
83
|
};
|
|
84
|
+
export interface PrismProcessLifecycle {
|
|
85
|
+
track(pid: number): void;
|
|
86
|
+
untrack(pid: number): void;
|
|
87
|
+
terminate(pid: number): void;
|
|
88
|
+
}
|
|
68
89
|
type PrismExtractArchiveFn = (input: Readable, destDir: string, kind: PrismAssetKind) => Promise<{
|
|
69
90
|
ok: boolean;
|
|
70
91
|
error?: string;
|
|
@@ -81,6 +102,9 @@ export interface PrismLlamaCppDeps {
|
|
|
81
102
|
hasNvidiaGpu?: () => boolean;
|
|
82
103
|
platform?: () => string;
|
|
83
104
|
arch?: () => string;
|
|
105
|
+
/** Host capacity probes used once to derive the bounded local inference profile. */
|
|
106
|
+
totalMemoryBytes?: () => number;
|
|
107
|
+
logicalCpuCount?: () => number;
|
|
84
108
|
/** Runs the extraction step for a downloaded archive. Injectable so installManaged's
|
|
85
109
|
* download->extract->scan orchestration is testable without a real tar/unzip pipeline; defaults
|
|
86
110
|
* to the real spawn-based extractor. */
|
|
@@ -88,6 +112,7 @@ export interface PrismLlamaCppDeps {
|
|
|
88
112
|
/** Health-poll bounds for serve(); default ~120s (240 * 500ms), both overridable for tests. */
|
|
89
113
|
healthPollAttempts?: number;
|
|
90
114
|
healthPollIntervalMs?: number;
|
|
115
|
+
processLifecycle?: PrismProcessLifecycle;
|
|
91
116
|
}
|
|
92
117
|
export declare class PrismLlamaCppRuntime {
|
|
93
118
|
private readonly _agentDir;
|
|
@@ -102,9 +127,12 @@ export declare class PrismLlamaCppRuntime {
|
|
|
102
127
|
private readonly _extractArchiveFn;
|
|
103
128
|
private readonly _healthPollAttempts;
|
|
104
129
|
private readonly _healthPollIntervalMs;
|
|
130
|
+
private readonly _profile;
|
|
131
|
+
private readonly _processLifecycle;
|
|
105
132
|
private _child;
|
|
106
133
|
constructor(args: {
|
|
107
134
|
agentDir: string;
|
|
135
|
+
profileMode?: LocalInferenceProfileMode;
|
|
108
136
|
deps?: PrismLlamaCppDeps;
|
|
109
137
|
});
|
|
110
138
|
runtimeDir(): string;
|
|
@@ -144,7 +172,6 @@ export declare class PrismLlamaCppRuntime {
|
|
|
144
172
|
repo: string;
|
|
145
173
|
file: string;
|
|
146
174
|
}, onProgress?: (status: string) => void): Promise<PrismDownloadResult>;
|
|
147
|
-
private _healthUp;
|
|
148
175
|
/**
|
|
149
176
|
* Spawn `llama-server` detached+tracked (killed on parent shutdown even if pi crashes without
|
|
150
177
|
* calling stop()) and poll `/health` until ready. `-ngl 99` is only added when the installed
|
|
@@ -152,6 +179,7 @@ export declare class PrismLlamaCppRuntime {
|
|
|
152
179
|
*/
|
|
153
180
|
serve(args: {
|
|
154
181
|
modelPath: string;
|
|
182
|
+
modelAlias: string;
|
|
155
183
|
mmprojPath?: string;
|
|
156
184
|
port: number;
|
|
157
185
|
numCtx: number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"llamacpp-runtime.d.ts","sourceRoot":"","sources":["../../../src/core/models/llamacpp-runtime.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAK5C,OAAO,EAIN,KAAK,mBAAmB,E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AAE,MAAM,CAAA;KAAE,EACpC,UAAU,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,GACnC,OAAO,CAAC,mBAAmB,CAAC,CA6B9B;IAED;;;;OAIG;IACG,KAAK,CAAC,IAAI,EAAE;QACjB,SAAS,EAAE,MAAM,CAAC;QAClB,UAAU,EAAE,MAAM,CAAC;QACnB,UAAU,CAAC,EAAE,MAAM,CAAC;QACpB,IAAI,EAAE,MAAM,CAAC;QACb,MAAM,EAAE,MAAM,CAAC;KACf,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAmE5B;IAED,IAAI,IAAI;QAAE,OAAO,EAAE,OAAO,CAAA;KAAE,CAS3B;IAED,SAAS,IAAI,OAAO,CAEnB;CACD"}
|
|
@@ -5,12 +5,14 @@ import { pipeline } from "node:stream/promises";
|
|
|
5
5
|
import { spawnProcess, waitForChildProcessWithTermination } from "../../utils/child-process.js";
|
|
6
6
|
import { killProcessTree, trackDetachedChildPid, untrackDetachedChildPid } from "../../utils/shell.js";
|
|
7
7
|
import { modelsDir as agentModelsDir, runtimesDir as agentRuntimesDir } from "../agent-paths.js";
|
|
8
|
+
import { deriveHostLocalInferenceProfile, } from "./local-inference-profile.js";
|
|
9
|
+
import { probePrismLlamaCppServer } from "./prism-llamacpp-server-probe.js";
|
|
8
10
|
import { extractZipArchive, fetchRuntimeDownload, installRuntimeArchive, removePartialDownload, requireRuntimeStdin, resolveRuntimeLifecycleDependencies, runtimeCommandAvailable, tryFileSizeBytes, writeRuntimeDownload, } from "./runtime-process.js";
|
|
9
11
|
/**
|
|
10
|
-
* Managed runtime for
|
|
11
|
-
* llama.cpp
|
|
12
|
-
*
|
|
13
|
-
* downloads, and llama-server lifecycle. Mirrors local-runtime.ts's OllamaRuntime: injectable
|
|
12
|
+
* Managed runtime for Pi's curated Prism 1-bit and ternary GGUF models. Q1_0 is available in
|
|
13
|
+
* upstream llama.cpp, while the selected group-128 Q2_0 artifacts and paired DSpark acceleration
|
|
14
|
+
* still require Prism's validated build. This module therefore owns the pinned runtime install,
|
|
15
|
+
* GGUF downloads, and llama-server lifecycle. Mirrors local-runtime.ts's OllamaRuntime: injectable
|
|
14
16
|
* seams for fetch/spawn/exists, pi-owned directories under agentDir (runtimes/, models/),
|
|
15
17
|
* detached+tracked child processes, onProgress as best-effort UI feedback, honest error taxonomies
|
|
16
18
|
* instead of silent fallbacks.
|
|
@@ -29,12 +31,24 @@ import { extractZipArchive, fetchRuntimeDownload, installRuntimeArchive, removeP
|
|
|
29
31
|
*/
|
|
30
32
|
export const PRISM_LLAMACPP_PINNED_RELEASE = "prism-b9594-38c66ad";
|
|
31
33
|
export const PRISM_LLAMACPP_RELEASES_BASE_URL = "https://github.com/PrismML-Eng/llama.cpp/releases/download";
|
|
32
|
-
/** Curated
|
|
34
|
+
/** Curated 27B descriptor shared by the full local execution catalog. */
|
|
33
35
|
export const BONSAI_27B = {
|
|
34
36
|
repo: "prism-ml/Bonsai-27B-gguf",
|
|
35
37
|
file: "Bonsai-27B-Q1_0.gguf",
|
|
36
38
|
mmprojFile: "Bonsai-27B-mmproj-Q8_0.gguf",
|
|
37
39
|
displayName: "Bonsai-27B (1-bit Q1_0 + vision)",
|
|
40
|
+
architecture: "dense",
|
|
41
|
+
runtime: "prism-llamacpp",
|
|
42
|
+
family: "bonsai",
|
|
43
|
+
parameterScale: "27B",
|
|
44
|
+
weightFormat: "q1_0",
|
|
45
|
+
matchedDrafter: {
|
|
46
|
+
kind: "dspark",
|
|
47
|
+
file: "Bonsai-27B-dspark-Q4_1.gguf",
|
|
48
|
+
draftMax: 4,
|
|
49
|
+
minimumContext: 16_384,
|
|
50
|
+
validatedBackend: "cuda",
|
|
51
|
+
},
|
|
38
52
|
};
|
|
39
53
|
// Verbatim asset names from the pinned release (see PRISM_LLAMACPP_PINNED_RELEASE doc comment) —
|
|
40
54
|
// hardcoded rather than templated from the tag because the provider's naming isn't fully
|
|
@@ -47,13 +61,15 @@ const MACOS_ARM64_ASSET = "llama-prism-b9594-38c66ad-bin-macos-arm64.tar.gz";
|
|
|
47
61
|
const MACOS_X64_ASSET = "llama-prism-b9594-38c66ad-bin-macos-x64.tar.gz";
|
|
48
62
|
const WIN_X64_CPU_ASSET = "llama-bin-win-cpu-x64.zip";
|
|
49
63
|
const WIN_ARM64_CPU_ASSET = "llama-bin-win-cpu-arm64.zip";
|
|
64
|
+
const WIN_X64_CUDA_ASSET = "llama-prism-b1-38c66ad-bin-win-cuda-12.4-x64.zip";
|
|
65
|
+
const WIN_X64_CUDA_COMPANION_ASSET = "cudart-llama-bin-win-cuda-12.4-x64.zip";
|
|
50
66
|
/**
|
|
51
67
|
* Maps a platform/arch/GPU triple to the exact Prism llama.cpp release asset for
|
|
52
68
|
* {@link PRISM_LLAMACPP_PINNED_RELEASE} — verified against the real GitHub release, not guessed.
|
|
53
|
-
* CPU asset by default;
|
|
54
|
-
*
|
|
55
|
-
*
|
|
56
|
-
*
|
|
69
|
+
* CPU asset by default; CUDA 12.4 is selected for x64 Linux or Windows with an NVIDIA GPU. The
|
|
70
|
+
* pinned Windows build is incomplete without its matching `cudart-*` archive, so the resolver
|
|
71
|
+
* returns both as one mandatory installation plan. Pure and exported so it's independently
|
|
72
|
+
* testable.
|
|
57
73
|
*/
|
|
58
74
|
export function resolvePrismLlamaAsset(plat, architecture, hasNvidiaGpu) {
|
|
59
75
|
if (plat === "linux") {
|
|
@@ -74,8 +90,16 @@ export function resolvePrismLlamaAsset(plat, architecture, hasNvidiaGpu) {
|
|
|
74
90
|
return undefined;
|
|
75
91
|
}
|
|
76
92
|
if (plat === "win32") {
|
|
77
|
-
if (architecture === "x64")
|
|
78
|
-
return
|
|
93
|
+
if (architecture === "x64") {
|
|
94
|
+
return hasNvidiaGpu
|
|
95
|
+
? {
|
|
96
|
+
name: WIN_X64_CUDA_ASSET,
|
|
97
|
+
kind: "zip",
|
|
98
|
+
backend: "cuda",
|
|
99
|
+
companionAssets: [{ name: WIN_X64_CUDA_COMPANION_ASSET, kind: "zip" }],
|
|
100
|
+
}
|
|
101
|
+
: { name: WIN_X64_CPU_ASSET, kind: "zip", backend: "cpu" };
|
|
102
|
+
}
|
|
79
103
|
if (architecture === "arm64")
|
|
80
104
|
return { name: WIN_ARM64_CPU_ASSET, kind: "zip", backend: "cpu" };
|
|
81
105
|
return undefined;
|
|
@@ -94,6 +118,9 @@ function parseContentLength(header) {
|
|
|
94
118
|
const value = Number(header);
|
|
95
119
|
return Number.isFinite(value) && value >= 0 ? value : undefined;
|
|
96
120
|
}
|
|
121
|
+
function modelIdentityConflictError(servedModelIds) {
|
|
122
|
+
return `model-identity-conflict:${servedModelIds.join(",") || "unknown"}`;
|
|
123
|
+
}
|
|
97
124
|
export class PrismLlamaCppRuntime {
|
|
98
125
|
constructor(args) {
|
|
99
126
|
this._agentDir = args.agentDir;
|
|
@@ -102,10 +129,16 @@ export class PrismLlamaCppRuntime {
|
|
|
102
129
|
this._hasNvidiaGpu = args.deps?.hasNvidiaGpu ?? (() => this._hasCommand("nvidia-smi"));
|
|
103
130
|
this._platform = args.deps?.platform ?? osPlatform;
|
|
104
131
|
this._arch = args.deps?.arch ?? osArch;
|
|
132
|
+
this._profile = deriveHostLocalInferenceProfile(args.profileMode ?? "balanced", args.deps);
|
|
105
133
|
this._extractArchiveFn =
|
|
106
134
|
args.deps?.extractArchive ?? ((input, destDir, kind) => this._extractArchive(input, destDir, kind));
|
|
107
135
|
this._healthPollAttempts = args.deps?.healthPollAttempts ?? DEFAULT_HEALTH_POLL_ATTEMPTS;
|
|
108
136
|
this._healthPollIntervalMs = args.deps?.healthPollIntervalMs ?? DEFAULT_HEALTH_POLL_INTERVAL_MS;
|
|
137
|
+
this._processLifecycle = args.deps?.processLifecycle ?? {
|
|
138
|
+
track: trackDetachedChildPid,
|
|
139
|
+
untrack: untrackDetachedChildPid,
|
|
140
|
+
terminate: killProcessTree,
|
|
141
|
+
};
|
|
109
142
|
}
|
|
110
143
|
runtimeDir() {
|
|
111
144
|
return agentRuntimesDir("prism-llamacpp", this._agentDir);
|
|
@@ -186,10 +219,13 @@ export class PrismLlamaCppRuntime {
|
|
|
186
219
|
const asset = resolvePrismLlamaAsset(this._platform(), this._arch(), this._hasNvidiaGpu());
|
|
187
220
|
if (!asset)
|
|
188
221
|
return { ok: false, error: "unsupported-platform" };
|
|
189
|
-
const
|
|
190
|
-
const
|
|
191
|
-
|
|
192
|
-
|
|
222
|
+
const archives = [asset, ...(asset.companionAssets ?? [])];
|
|
223
|
+
for (const archive of archives) {
|
|
224
|
+
const downloadUrl = `${PRISM_LLAMACPP_RELEASES_BASE_URL}/${PRISM_LLAMACPP_PINNED_RELEASE}/${archive.name}`;
|
|
225
|
+
const extracted = await this._installArchive(downloadUrl, archive, onProgress);
|
|
226
|
+
if (!extracted.ok)
|
|
227
|
+
return extracted;
|
|
228
|
+
}
|
|
193
229
|
onProgress?.("Locating llama-server binary…");
|
|
194
230
|
const destDir = this.runtimeDir();
|
|
195
231
|
const binaryRelPath = this._findBinaryRelPath(destDir);
|
|
@@ -297,17 +333,6 @@ export class PrismLlamaCppRuntime {
|
|
|
297
333
|
onProgress?.(`${args.file} downloaded (${actualBytes ?? 0} bytes).`);
|
|
298
334
|
return { ok: true, path: destPath };
|
|
299
335
|
}
|
|
300
|
-
async _healthUp(baseUrl) {
|
|
301
|
-
try {
|
|
302
|
-
const response = await this._fetch(`${baseUrl}/health`, {
|
|
303
|
-
signal: AbortSignal.timeout(HEALTH_CHECK_TIMEOUT_MS),
|
|
304
|
-
});
|
|
305
|
-
return response.ok;
|
|
306
|
-
}
|
|
307
|
-
catch {
|
|
308
|
-
return false;
|
|
309
|
-
}
|
|
310
|
-
}
|
|
311
336
|
/**
|
|
312
337
|
* Spawn `llama-server` detached+tracked (killed on parent shutdown even if pi crashes without
|
|
313
338
|
* calling stop()) and poll `/health` until ready. `-ngl 99` is only added when the installed
|
|
@@ -321,9 +346,19 @@ export class PrismLlamaCppRuntime {
|
|
|
321
346
|
if (!this._exists(binaryPath))
|
|
322
347
|
return { ok: false, error: "binary-missing" };
|
|
323
348
|
const baseUrl = `http://127.0.0.1:${args.port}`;
|
|
349
|
+
const existing = await probePrismLlamaCppServer(baseUrl, args.modelAlias, this._fetch, HEALTH_CHECK_TIMEOUT_MS);
|
|
350
|
+
if (existing.status === "matching")
|
|
351
|
+
return { ok: true, baseUrl };
|
|
352
|
+
if (existing.status === "conflict" && !this._child) {
|
|
353
|
+
return { ok: false, error: modelIdentityConflictError(existing.servedModelIds) };
|
|
354
|
+
}
|
|
355
|
+
if (this._child)
|
|
356
|
+
this.stop();
|
|
324
357
|
const argv = [
|
|
325
358
|
"-m",
|
|
326
359
|
args.modelPath,
|
|
360
|
+
"--alias",
|
|
361
|
+
args.modelAlias,
|
|
327
362
|
...(args.mmprojPath ? ["--mmproj", args.mmprojPath] : []),
|
|
328
363
|
"--host",
|
|
329
364
|
"127.0.0.1",
|
|
@@ -331,6 +366,20 @@ export class PrismLlamaCppRuntime {
|
|
|
331
366
|
String(args.port),
|
|
332
367
|
"-c",
|
|
333
368
|
String(args.numCtx),
|
|
369
|
+
"--cache-ram",
|
|
370
|
+
String(this._profile.promptCacheMiB),
|
|
371
|
+
"-np",
|
|
372
|
+
String(this._profile.parallelRequests),
|
|
373
|
+
"-fa",
|
|
374
|
+
this._profile.flashAttention ? "on" : "off",
|
|
375
|
+
"-ctk",
|
|
376
|
+
this._profile.kvCacheType,
|
|
377
|
+
"-ctv",
|
|
378
|
+
this._profile.kvCacheType,
|
|
379
|
+
"-t",
|
|
380
|
+
String(this._profile.generationThreads),
|
|
381
|
+
"-tb",
|
|
382
|
+
String(this._profile.batchThreads),
|
|
334
383
|
...(manifest.backend === "cuda" ? ["-ngl", "99"] : []),
|
|
335
384
|
];
|
|
336
385
|
const child = this._spawn(binaryPath, argv, {
|
|
@@ -339,15 +388,22 @@ export class PrismLlamaCppRuntime {
|
|
|
339
388
|
env: process.env,
|
|
340
389
|
});
|
|
341
390
|
if (child.pid)
|
|
342
|
-
|
|
391
|
+
this._processLifecycle.track(child.pid);
|
|
343
392
|
child.unref?.();
|
|
344
393
|
child.on("exit", () => {
|
|
345
|
-
this._child
|
|
394
|
+
if (this._child === child) {
|
|
395
|
+
this._child = undefined;
|
|
396
|
+
}
|
|
346
397
|
});
|
|
347
398
|
this._child = child;
|
|
348
399
|
for (let attempt = 0; attempt < this._healthPollAttempts; attempt++) {
|
|
349
|
-
|
|
400
|
+
const probe = await probePrismLlamaCppServer(baseUrl, args.modelAlias, this._fetch, HEALTH_CHECK_TIMEOUT_MS);
|
|
401
|
+
if (probe.status === "matching")
|
|
350
402
|
return { ok: true, baseUrl };
|
|
403
|
+
if (probe.status === "conflict") {
|
|
404
|
+
this.stop();
|
|
405
|
+
return { ok: false, error: modelIdentityConflictError(probe.servedModelIds) };
|
|
406
|
+
}
|
|
351
407
|
await this._sleep(this._healthPollIntervalMs);
|
|
352
408
|
}
|
|
353
409
|
this.stop();
|
|
@@ -359,8 +415,8 @@ export class PrismLlamaCppRuntime {
|
|
|
359
415
|
return { stopped: false };
|
|
360
416
|
this._child = undefined;
|
|
361
417
|
if (child.pid) {
|
|
362
|
-
|
|
363
|
-
|
|
418
|
+
this._processLifecycle.untrack(child.pid);
|
|
419
|
+
this._processLifecycle.terminate(child.pid);
|
|
364
420
|
}
|
|
365
421
|
return { stopped: true };
|
|
366
422
|
}
|