@dirgha/code 1.2.0 → 1.4.1
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/.changeset/README.md +23 -0
- package/.changeset/config.json +11 -0
- package/.changeset/sprint-1.3.0.md +5 -0
- package/CHANGELOG.md +135 -0
- package/CLA.md +104 -0
- package/CODE_OF_CONDUCT.md +50 -0
- package/CONTRIBUTING.md +81 -0
- package/CREDITS.md +46 -0
- package/LICENSING.md +105 -0
- package/README.md +71 -625
- package/SECURITY.md +61 -0
- package/SUPPORT.md +53 -0
- package/assets/audio/dirgha-ambient-150s.m4a +0 -0
- package/assets/logo/dirgha-mark-amber.svg +8 -0
- package/assets/logo/dirgha-mark-cream.svg +8 -0
- package/assets/logo/dirgha-wordmark-cream.svg +5 -0
- package/assets/logo/dirgha-wordmark-ink.svg +5 -0
- package/changelog/1.4.0-promo.mp4 +0 -0
- package/changelog/1.4.0.md +89 -0
- package/changelog/1.4.1-promo.mp4 +0 -0
- package/changelog/README.md +73 -0
- package/dist/agent/capabilities.d.ts +1 -0
- package/dist/agent/capabilities.js +21 -0
- package/dist/agent/collaboration/consensus.d.ts +77 -0
- package/dist/agent/collaboration/consensus.js +279 -0
- package/dist/agent/collaboration/index.d.ts +7 -0
- package/dist/agent/collaboration/index.js +7 -0
- package/dist/agent/collaboration/message-bus.d.ts +48 -0
- package/dist/agent/collaboration/message-bus.js +219 -0
- package/dist/agent/collaboration/shared-context.d.ts +67 -0
- package/dist/agent/collaboration/shared-context.js +217 -0
- package/dist/agent/collaboration/types.d.ts +95 -0
- package/dist/agent/collaboration/types.js +6 -0
- package/dist/agent/commands/chat.d.ts +21 -0
- package/dist/agent/commands/chat.js +55 -0
- package/dist/agent/compaction-tiers.d.ts +10 -0
- package/dist/agent/compaction-tiers.js +70 -0
- package/dist/agent/compaction.d.ts +16 -0
- package/dist/agent/compaction.js +129 -0
- package/dist/agent/context-optimizer.d.ts +2 -0
- package/dist/agent/context-optimizer.js +30 -0
- package/dist/agent/context.d.ts +14 -0
- package/dist/agent/context.js +241 -0
- package/dist/agent/error-classifier.d.ts +10 -0
- package/dist/agent/error-classifier.js +67 -0
- package/dist/agent/event-emit.d.ts +6 -0
- package/dist/agent/event-emit.js +98 -0
- package/dist/agent/executor.d.ts +9 -0
- package/dist/agent/executor.js +44 -0
- package/dist/agent/gateway.d.ts +11 -0
- package/dist/agent/gateway.js +11 -0
- package/dist/agent/index.d.ts +7 -0
- package/dist/agent/index.js +58 -0
- package/dist/agent/injector.d.ts +35 -0
- package/dist/agent/injector.js +57 -0
- package/dist/agent/loop-detector.d.ts +18 -0
- package/dist/agent/loop-detector.js +91 -0
- package/dist/agent/loop.d.ts +22 -0
- package/dist/agent/loop.js +348 -0
- package/dist/agent/memory-sync.d.ts +5 -0
- package/dist/agent/memory-sync.js +17 -0
- package/dist/agent/model-fallback.d.ts +23 -0
- package/dist/agent/model-fallback.js +112 -0
- package/dist/agent/moim.d.ts +5 -0
- package/dist/agent/moim.js +29 -0
- package/dist/agent/orchestration/agent-pool.d.ts +59 -0
- package/dist/agent/orchestration/agent-pool.js +165 -0
- package/dist/agent/orchestration/circuit-breaker.d.ts +121 -0
- package/dist/agent/orchestration/circuit-breaker.js +298 -0
- package/dist/agent/orchestration/coordinator.d.ts +17 -0
- package/dist/agent/orchestration/coordinator.js +150 -0
- package/dist/agent/orchestration/dag-runner.d.ts +18 -0
- package/dist/agent/orchestration/dag-runner.js +172 -0
- package/dist/agent/orchestration/dag.d.ts +33 -0
- package/dist/agent/orchestration/dag.js +209 -0
- package/dist/agent/orchestration/decomposer.d.ts +19 -0
- package/dist/agent/orchestration/decomposer.js +65 -0
- package/dist/agent/orchestration/observability.d.ts +117 -0
- package/dist/agent/orchestration/observability.js +244 -0
- package/dist/agent/orchestration/parallel.d.ts +8 -0
- package/dist/agent/orchestration/parallel.js +191 -0
- package/dist/agent/orchestration/pool-cleanup.d.ts +16 -0
- package/dist/agent/orchestration/pool-cleanup.js +21 -0
- package/dist/agent/orchestration/pool-queue.d.ts +23 -0
- package/dist/agent/orchestration/pool-queue.js +62 -0
- package/dist/agent/orchestration/pool-scaler.d.ts +22 -0
- package/dist/agent/orchestration/pool-scaler.js +53 -0
- package/dist/agent/orchestration/researcher.d.ts +28 -0
- package/dist/agent/orchestration/researcher.js +78 -0
- package/dist/agent/orchestration/retry.d.ts +14 -0
- package/dist/agent/orchestration/retry.js +107 -0
- package/dist/agent/orchestration/scheduler.d.ts +24 -0
- package/dist/agent/orchestration/scheduler.js +66 -0
- package/dist/agent/orchestration/shared-memory.d.ts +31 -0
- package/dist/agent/orchestration/shared-memory.js +57 -0
- package/dist/agent/orchestration/structured.d.ts +63 -0
- package/dist/agent/orchestration/structured.js +152 -0
- package/dist/agent/orchestration/task-queue.d.ts +32 -0
- package/dist/agent/orchestration/task-queue.js +105 -0
- package/dist/agent/orchestration/types.d.ts +139 -0
- package/dist/agent/orchestration/types.js +7 -0
- package/dist/agent/output.d.ts +31 -0
- package/dist/agent/output.js +108 -0
- package/dist/agent/parser.d.ts +5 -0
- package/dist/agent/parser.js +74 -0
- package/dist/agent/pending-messages.d.ts +33 -0
- package/dist/agent/pending-messages.js +57 -0
- package/dist/agent/project.d.ts +2 -0
- package/dist/agent/project.js +19 -0
- package/dist/agent/reflection.d.ts +36 -0
- package/dist/agent/reflection.js +93 -0
- package/dist/agent/rerank-engine.d.ts +18 -0
- package/dist/agent/rerank-engine.js +52 -0
- package/dist/agent/routing.d.ts +10 -0
- package/dist/agent/routing.js +95 -0
- package/dist/agent/secrets.d.ts +6 -0
- package/dist/agent/secrets.js +84 -0
- package/dist/agent/skill-registry.d.ts +37 -0
- package/dist/agent/skill-registry.js +113 -0
- package/dist/agent/spawn/index.d.ts +8 -0
- package/dist/agent/spawn/index.js +5 -0
- package/dist/agent/spawn/lifecycle.d.ts +9 -0
- package/dist/agent/spawn/lifecycle.js +92 -0
- package/dist/agent/spawn/messaging.d.ts +6 -0
- package/dist/agent/spawn/messaging.js +36 -0
- package/dist/agent/spawn/state.d.ts +7 -0
- package/dist/agent/spawn/state.js +57 -0
- package/dist/agent/spawn/types.d.ts +55 -0
- package/dist/agent/spawn/types.js +5 -0
- package/dist/agent/spawn/utils.d.ts +14 -0
- package/dist/agent/spawn/utils.js +72 -0
- package/dist/agent/spawn-agent.d.ts +47 -0
- package/dist/agent/spawn-agent.js +114 -0
- package/dist/agent/structured-output.d.ts +15 -0
- package/dist/agent/structured-output.js +66 -0
- package/dist/agent/tool-execution.d.ts +18 -0
- package/dist/agent/tool-execution.js +242 -0
- package/dist/agent/tools.d.ts +6 -0
- package/dist/agent/tools.js +7 -0
- package/dist/agent/types.d.ts +62 -0
- package/dist/agent/types.js +6 -0
- package/dist/agents/consensus.d.ts +14 -0
- package/dist/agents/consensus.js +34 -0
- package/dist/agents/delegate.d.ts +18 -0
- package/dist/agents/delegate.js +32 -0
- package/dist/agents/ensemble.d.ts +18 -0
- package/dist/agents/ensemble.js +33 -0
- package/dist/agents/orchestrate.d.ts +12 -0
- package/dist/agents/orchestrate.js +32 -0
- package/dist/agents/types.d.ts +29 -0
- package/dist/agents/types.js +2 -0
- package/dist/analytics/export.d.ts +11 -0
- package/dist/analytics/export.js +58 -0
- package/dist/analytics/insights.d.ts +27 -0
- package/dist/analytics/insights.js +33 -0
- package/dist/api/knowledge.d.ts +38 -0
- package/dist/api/knowledge.js +65 -0
- package/dist/billing/db.d.ts +11 -0
- package/dist/billing/db.js +88 -0
- package/dist/billing/index.d.ts +10 -0
- package/dist/billing/index.js +12 -0
- package/dist/billing/meter.d.ts +11 -0
- package/dist/billing/meter.js +46 -0
- package/dist/billing/middleware.d.ts +28 -0
- package/dist/billing/middleware.js +103 -0
- package/dist/billing/pricing.d.ts +6 -0
- package/dist/billing/pricing.js +48 -0
- package/dist/billing/quota.d.ts +24 -0
- package/dist/billing/quota.js +105 -0
- package/dist/billing/ratelimit-fixed.d.ts +16 -0
- package/dist/billing/ratelimit-fixed.js +112 -0
- package/dist/billing/ratelimit.d.ts +7 -0
- package/dist/billing/ratelimit.js +58 -0
- package/dist/billing/tokenizer-v2.d.ts +76 -0
- package/dist/billing/tokenizer-v2.js +263 -0
- package/dist/billing/tokenizer.d.ts +9 -0
- package/dist/billing/tokenizer.js +46 -0
- package/dist/billing/types.d.ts +60 -0
- package/dist/billing/types.js +17 -0
- package/dist/browser/accessibility.d.ts +6 -0
- package/dist/browser/accessibility.js +47 -0
- package/dist/browser/commands.d.ts +5 -0
- package/dist/browser/commands.js +82 -0
- package/dist/browser/ipc-client.d.ts +26 -0
- package/dist/browser/ipc-client.js +60 -0
- package/dist/browser/launcher.d.ts +13 -0
- package/dist/browser/launcher.js +78 -0
- package/dist/browser/navigation.d.ts +12 -0
- package/dist/browser/navigation.js +28 -0
- package/dist/browser/snapshot.d.ts +7 -0
- package/dist/browser/snapshot.js +18 -0
- package/dist/browser/types.d.ts +28 -0
- package/dist/browser/types.js +2 -0
- package/dist/checkpoint/create.d.ts +2 -0
- package/dist/checkpoint/create.js +44 -0
- package/dist/checkpoint/git.d.ts +8 -0
- package/dist/checkpoint/git.js +45 -0
- package/dist/checkpoint/restore.d.ts +5 -0
- package/dist/checkpoint/restore.js +18 -0
- package/dist/checkpoint/store.d.ts +9 -0
- package/dist/checkpoint/store.js +40 -0
- package/dist/checkpoint/types.d.ts +23 -0
- package/dist/checkpoint/types.js +2 -0
- package/dist/commands/agent-swarm.d.ts +7 -0
- package/dist/commands/agent-swarm.js +223 -0
- package/dist/commands/analytics.d.ts +5 -0
- package/dist/commands/analytics.js +20 -0
- package/dist/commands/ask.d.ts +12 -0
- package/dist/commands/ask.js +99 -0
- package/dist/commands/audit.d.ts +5 -0
- package/dist/commands/audit.js +78 -0
- package/dist/commands/auth.d.ts +1 -0
- package/dist/commands/auth.js +126 -0
- package/dist/commands/autocomplete.d.ts +10 -0
- package/dist/commands/autocomplete.js +89 -0
- package/dist/commands/bounties.d.ts +2 -0
- package/dist/commands/bounties.js +107 -0
- package/dist/commands/browser-cmd.d.ts +7 -0
- package/dist/commands/browser-cmd.js +101 -0
- package/dist/commands/browser-integration.d.ts +15 -0
- package/dist/commands/browser-integration.js +58 -0
- package/dist/commands/btw.d.ts +7 -0
- package/dist/commands/btw.js +62 -0
- package/dist/commands/bucky.d.ts +19 -0
- package/dist/commands/bucky.js +328 -0
- package/dist/commands/bug-hunter.d.ts +6 -0
- package/dist/commands/bug-hunter.js +55 -0
- package/dist/commands/capture.d.ts +10 -0
- package/dist/commands/capture.js +167 -0
- package/dist/commands/chat.d.ts +4 -0
- package/dist/commands/chat.js +107 -0
- package/dist/commands/checkpoint.d.ts +6 -0
- package/dist/commands/checkpoint.js +83 -0
- package/dist/commands/coming-soon.d.ts +2 -0
- package/dist/commands/coming-soon.js +50 -0
- package/dist/commands/compact.d.ts +5 -0
- package/dist/commands/compact.js +38 -0
- package/dist/commands/connect.d.ts +7 -0
- package/dist/commands/connect.js +155 -0
- package/dist/commands/curate/embeddings.d.ts +7 -0
- package/dist/commands/curate/embeddings.js +38 -0
- package/dist/commands/curate/files.d.ts +4 -0
- package/dist/commands/curate/files.js +28 -0
- package/dist/commands/curate/project.d.ts +1 -0
- package/dist/commands/curate/project.js +20 -0
- package/dist/commands/curate/schema.d.ts +1 -0
- package/dist/commands/curate/schema.js +30 -0
- package/dist/commands/curate/types.d.ts +26 -0
- package/dist/commands/curate/types.js +6 -0
- package/dist/commands/curate/vss-integration.d.ts +1 -0
- package/dist/commands/curate/vss-integration.js +19 -0
- package/dist/commands/curate.d.ts +9 -0
- package/dist/commands/curate.js +50 -0
- package/dist/commands/dao.d.ts +8 -0
- package/dist/commands/dao.js +290 -0
- package/dist/commands/data-query.d.ts +7 -0
- package/dist/commands/data-query.js +55 -0
- package/dist/commands/doctor.d.ts +2 -0
- package/dist/commands/doctor.js +145 -0
- package/dist/commands/ensemble.d.ts +7 -0
- package/dist/commands/ensemble.js +88 -0
- package/dist/commands/error-recovery.d.ts +10 -0
- package/dist/commands/error-recovery.js +50 -0
- package/dist/commands/export-session.d.ts +7 -0
- package/dist/commands/export-session.js +70 -0
- package/dist/commands/import-session.d.ts +7 -0
- package/dist/commands/import-session.js +49 -0
- package/dist/commands/index.d.ts +62 -0
- package/dist/commands/index.js +76 -0
- package/dist/commands/init.d.ts +5 -0
- package/dist/commands/init.js +101 -0
- package/dist/commands/jobs.d.ts +2 -0
- package/dist/commands/jobs.js +108 -0
- package/dist/commands/join-mesh.d.ts +5 -0
- package/dist/commands/join-mesh.js +97 -0
- package/dist/commands/knowledge.d.ts +19 -0
- package/dist/commands/knowledge.js +218 -0
- package/dist/commands/local.d.ts +2 -0
- package/dist/commands/local.js +77 -0
- package/dist/commands/login.d.ts +10 -0
- package/dist/commands/login.js +160 -0
- package/dist/commands/logout.d.ts +2 -0
- package/dist/commands/logout.js +12 -0
- package/dist/commands/make.d.ts +2 -0
- package/dist/commands/make.js +69 -0
- package/dist/commands/mcp.d.ts +7 -0
- package/dist/commands/mcp.js +202 -0
- package/dist/commands/mesh/add-member.d.ts +2 -0
- package/dist/commands/mesh/add-member.js +23 -0
- package/dist/commands/mesh/ask.d.ts +2 -0
- package/dist/commands/mesh/ask.js +60 -0
- package/dist/commands/mesh/billing.d.ts +1 -0
- package/dist/commands/mesh/billing.js +16 -0
- package/dist/commands/mesh/consensus.d.ts +1 -0
- package/dist/commands/mesh/consensus.js +17 -0
- package/dist/commands/mesh/context.d.ts +4 -0
- package/dist/commands/mesh/context.js +11 -0
- package/dist/commands/mesh/index.d.ts +4 -0
- package/dist/commands/mesh/index.js +64 -0
- package/dist/commands/mesh/join.d.ts +2 -0
- package/dist/commands/mesh/join.js +38 -0
- package/dist/commands/mesh/leave.d.ts +1 -0
- package/dist/commands/mesh/leave.js +14 -0
- package/dist/commands/mesh/quota.d.ts +1 -0
- package/dist/commands/mesh/quota.js +31 -0
- package/dist/commands/mesh/status.d.ts +1 -0
- package/dist/commands/mesh/status.js +48 -0
- package/dist/commands/mesh/types.d.ts +36 -0
- package/dist/commands/mesh/types.js +2 -0
- package/dist/commands/mesh.d.ts +6 -0
- package/dist/commands/mesh.js +258 -0
- package/dist/commands/models.d.ts +1 -0
- package/dist/commands/models.js +194 -0
- package/dist/commands/pay.d.ts +7 -0
- package/dist/commands/pay.js +305 -0
- package/dist/commands/profile.d.ts +2 -0
- package/dist/commands/profile.js +99 -0
- package/dist/commands/progress.d.ts +23 -0
- package/dist/commands/progress.js +93 -0
- package/dist/commands/prune.d.ts +2 -0
- package/dist/commands/prune.js +64 -0
- package/dist/commands/query.d.ts +9 -0
- package/dist/commands/query.js +135 -0
- package/dist/commands/recall-cmd.d.ts +7 -0
- package/dist/commands/recall-cmd.js +65 -0
- package/dist/commands/remember-cmd.d.ts +7 -0
- package/dist/commands/remember-cmd.js +40 -0
- package/dist/commands/research.d.ts +5 -0
- package/dist/commands/research.js +40 -0
- package/dist/commands/sandbox-connect.d.ts +2 -0
- package/dist/commands/sandbox-connect.js +171 -0
- package/dist/commands/scan/arniko.d.ts +1 -0
- package/dist/commands/scan/arniko.js +79 -0
- package/dist/commands/scan/deps.d.ts +21 -0
- package/dist/commands/scan/deps.js +56 -0
- package/dist/commands/scan/index.d.ts +7 -0
- package/dist/commands/scan/index.js +97 -0
- package/dist/commands/scan/output.d.ts +2 -0
- package/dist/commands/scan/output.js +42 -0
- package/dist/commands/scan/types.d.ts +21 -0
- package/dist/commands/scan/types.js +2 -0
- package/dist/commands/scan/utils.d.ts +5 -0
- package/dist/commands/scan/utils.js +101 -0
- package/dist/commands/scan.d.ts +7 -0
- package/dist/commands/scan.js +327 -0
- package/dist/commands/scratchpad.d.ts +8 -0
- package/dist/commands/scratchpad.js +82 -0
- package/dist/commands/session.d.ts +3 -0
- package/dist/commands/session.js +70 -0
- package/dist/commands/setup-local.d.ts +2 -0
- package/dist/commands/setup-local.js +137 -0
- package/dist/commands/setup.d.ts +1 -0
- package/dist/commands/setup.js +230 -0
- package/dist/commands/smart-exec.d.ts +2 -0
- package/dist/commands/smart-exec.js +217 -0
- package/dist/commands/sprint.d.ts +9 -0
- package/dist/commands/sprint.js +321 -0
- package/dist/commands/stats.d.ts +1 -0
- package/dist/commands/stats.js +163 -0
- package/dist/commands/status.d.ts +1 -0
- package/dist/commands/status.js +97 -0
- package/dist/commands/support.d.ts +5 -0
- package/dist/commands/support.js +43 -0
- package/dist/commands/sync.d.ts +7 -0
- package/dist/commands/sync.js +130 -0
- package/dist/commands/unified-memory/context.d.ts +5 -0
- package/dist/commands/unified-memory/context.js +33 -0
- package/dist/commands/unified-memory/index.d.ts +12 -0
- package/dist/commands/unified-memory/index.js +23 -0
- package/dist/commands/unified-memory/recall.d.ts +5 -0
- package/dist/commands/unified-memory/recall.js +50 -0
- package/dist/commands/unified-memory/remember.d.ts +5 -0
- package/dist/commands/unified-memory/remember.js +49 -0
- package/dist/commands/unified-memory/session.d.ts +5 -0
- package/dist/commands/unified-memory/session.js +64 -0
- package/dist/commands/unified-memory/stats.d.ts +5 -0
- package/dist/commands/unified-memory/stats.js +29 -0
- package/dist/commands/update.d.ts +7 -0
- package/dist/commands/update.js +45 -0
- package/dist/commands/voice-entry.d.ts +8 -0
- package/dist/commands/voice-entry.js +120 -0
- package/dist/commands/yolo.d.ts +8 -0
- package/dist/commands/yolo.js +88 -0
- package/dist/compaction/index.d.ts +15 -0
- package/dist/compaction/index.js +21 -0
- package/dist/compaction/protect.d.ts +8 -0
- package/dist/compaction/protect.js +15 -0
- package/dist/compaction/prune.d.ts +5 -0
- package/dist/compaction/prune.js +19 -0
- package/dist/compaction/summarize.d.ts +6 -0
- package/dist/compaction/summarize.js +27 -0
- package/dist/compaction/types.d.ts +27 -0
- package/dist/compaction/types.js +2 -0
- package/dist/compaction/update.d.ts +6 -0
- package/dist/compaction/update.js +18 -0
- package/dist/config/execution.d.ts +22 -0
- package/dist/config/execution.js +59 -0
- package/dist/config/rate-limits.d.ts +15 -0
- package/dist/config/rate-limits.js +34 -0
- package/dist/context/jit.d.ts +16 -0
- package/dist/context/jit.js +120 -0
- package/dist/context/todos.d.ts +7 -0
- package/dist/context/todos.js +21 -0
- package/dist/cron/runner.d.ts +16 -0
- package/dist/cron/runner.js +57 -0
- package/dist/cron/store.d.ts +19 -0
- package/dist/cron/store.js +91 -0
- package/dist/dirgha.mjs +2 -2
- package/dist/embeddings/gateway.d.ts +9 -0
- package/dist/embeddings/gateway.js +55 -0
- package/dist/embeddings/math.d.ts +17 -0
- package/dist/embeddings/math.js +33 -0
- package/dist/embeddings/ollama.d.ts +10 -0
- package/dist/embeddings/ollama.js +74 -0
- package/dist/embeddings/provider.d.ts +28 -0
- package/dist/embeddings/provider.js +73 -0
- package/dist/embeddings/vss.d.ts +22 -0
- package/dist/embeddings/vss.js +102 -0
- package/dist/errors/tokenLimit.d.ts +15 -0
- package/dist/errors/tokenLimit.js +93 -0
- package/dist/extensions/manager.d.ts +6 -0
- package/dist/extensions/manager.js +62 -0
- package/dist/extensions/rpc.d.ts +10 -0
- package/dist/extensions/rpc.js +90 -0
- package/dist/extensions/types.d.ts +24 -0
- package/dist/extensions/types.js +5 -0
- package/dist/fleet/apply-back.d.ts +11 -0
- package/dist/fleet/apply-back.js +82 -0
- package/dist/fleet/commands.d.ts +2 -0
- package/dist/fleet/commands.js +227 -0
- package/dist/fleet/decompose.d.ts +7 -0
- package/dist/fleet/decompose.js +80 -0
- package/dist/fleet/events.d.ts +24 -0
- package/dist/fleet/events.js +35 -0
- package/dist/fleet/runtime.d.ts +9 -0
- package/dist/fleet/runtime.js +131 -0
- package/dist/fleet/tripleshot.d.ts +9 -0
- package/dist/fleet/tripleshot.js +114 -0
- package/dist/fleet/types.d.ts +60 -0
- package/dist/fleet/types.js +11 -0
- package/dist/fleet/worktree.d.ts +17 -0
- package/dist/fleet/worktree.js +80 -0
- package/dist/gateway/acp/adapter.d.ts +46 -0
- package/dist/gateway/acp/adapter.js +181 -0
- package/dist/gateway/acp/index.d.ts +6 -0
- package/dist/gateway/acp/index.js +6 -0
- package/dist/gateway/acp/registry.d.ts +51 -0
- package/dist/gateway/acp/registry.js +171 -0
- package/dist/gateway/acp/types.d.ts +123 -0
- package/dist/gateway/acp/types.js +7 -0
- package/dist/gateway/index.d.ts +5 -0
- package/dist/gateway/index.js +6 -0
- package/dist/gateway/orchestrator.d.ts +8 -0
- package/dist/gateway/orchestrator.js +37 -0
- package/dist/gateway/router.d.ts +34 -0
- package/dist/gateway/router.js +123 -0
- package/dist/gateway/telegram.d.ts +13 -0
- package/dist/gateway/telegram.js +35 -0
- package/dist/gateway/types.d.ts +15 -0
- package/dist/gateway/types.js +2 -0
- package/dist/git/rotation.d.ts +8 -0
- package/dist/git/rotation.js +36 -0
- package/dist/hub/commands.d.ts +15 -0
- package/dist/hub/commands.js +189 -0
- package/dist/hub/index.d.ts +8 -0
- package/dist/hub/index.js +9 -0
- package/dist/hub/installer.d.ts +7 -0
- package/dist/hub/installer.js +148 -0
- package/dist/hub/registry.d.ts +9 -0
- package/dist/hub/registry.js +81 -0
- package/dist/hub/registry.json +82 -0
- package/dist/hub/types.d.ts +73 -0
- package/dist/hub/types.js +6 -0
- package/dist/index-agent.d.ts +1 -0
- package/dist/index-agent.js +17 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +442 -0
- package/dist/knowledge/compiler.d.ts +11 -0
- package/dist/knowledge/compiler.js +100 -0
- package/dist/knowledge/git-sync.d.ts +6 -0
- package/dist/knowledge/git-sync.js +81 -0
- package/dist/knowledge/linter.d.ts +9 -0
- package/dist/knowledge/linter.js +136 -0
- package/dist/knowledge/raw.d.ts +20 -0
- package/dist/knowledge/raw.js +87 -0
- package/dist/knowledge/wiki.d.ts +26 -0
- package/dist/knowledge/wiki.js +127 -0
- package/dist/llm/cache.d.ts +16 -0
- package/dist/llm/cache.js +25 -0
- package/dist/llm/costs.d.ts +18 -0
- package/dist/llm/costs.js +30 -0
- package/dist/llm/ensemble.d.ts +5 -0
- package/dist/llm/ensemble.js +40 -0
- package/dist/llm/local.d.ts +23 -0
- package/dist/llm/local.js +78 -0
- package/dist/llm/router.d.ts +7 -0
- package/dist/llm/router.js +68 -0
- package/dist/llm/types.d.ts +18 -0
- package/dist/llm/types.js +2 -0
- package/dist/mcp/client.d.ts +25 -0
- package/dist/mcp/client.js +115 -0
- package/dist/mcp/commands.d.ts +5 -0
- package/dist/mcp/commands.js +30 -0
- package/dist/mcp/index.d.ts +7 -0
- package/dist/mcp/index.js +6 -0
- package/dist/mcp/manager.d.ts +17 -0
- package/dist/mcp/manager.js +67 -0
- package/dist/mcp/marketplace.d.ts +42 -0
- package/dist/mcp/marketplace.js +188 -0
- package/dist/mcp/resources.d.ts +6 -0
- package/dist/mcp/resources.js +26 -0
- package/dist/mcp/server.d.ts +84 -0
- package/dist/mcp/server.js +288 -0
- package/dist/mcp/transport.d.ts +10 -0
- package/dist/mcp/transport.js +30 -0
- package/dist/memory/builtin.d.ts +17 -0
- package/dist/memory/builtin.js +43 -0
- package/dist/memory/gepa-integration.d.ts +49 -0
- package/dist/memory/gepa-integration.js +271 -0
- package/dist/memory/graph.d.ts +19 -0
- package/dist/memory/graph.js +44 -0
- package/dist/memory/holographic.d.ts +11 -0
- package/dist/memory/holographic.js +192 -0
- package/dist/memory/manager.d.ts +36 -0
- package/dist/memory/manager.js +152 -0
- package/dist/memory/provider.d.ts +29 -0
- package/dist/memory/provider.js +9 -0
- package/dist/memory/unified.d.ts +19 -0
- package/dist/memory/unified.js +91 -0
- package/dist/mesh/ConsensusEngine.d.ts +85 -0
- package/dist/mesh/ConsensusEngine.js +187 -0
- package/dist/mesh/LightningBilling.d.ts +124 -0
- package/dist/mesh/LightningBilling.js +284 -0
- package/dist/mesh/MeshNode.d.ts +82 -0
- package/dist/mesh/MeshNode.js +401 -0
- package/dist/mesh/TeamResourcePool.d.ts +93 -0
- package/dist/mesh/TeamResourcePool.js +277 -0
- package/dist/mesh/agent-payments.d.ts +25 -0
- package/dist/mesh/agent-payments.js +79 -0
- package/dist/mesh/capabilities.d.ts +25 -0
- package/dist/mesh/capabilities.js +44 -0
- package/dist/mesh/config.d.ts +37 -0
- package/dist/mesh/config.js +38 -0
- package/dist/mesh/index.d.ts +13 -0
- package/dist/mesh/index.js +11 -0
- package/dist/mesh/reputation.d.ts +21 -0
- package/dist/mesh/reputation.js +51 -0
- package/dist/mesh/revenue-split.d.ts +20 -0
- package/dist/mesh/revenue-split.js +52 -0
- package/dist/mesh/validation.d.ts +5 -0
- package/dist/mesh/validation.js +31 -0
- package/dist/models/credential-pool.d.ts +37 -0
- package/dist/models/credential-pool.js +165 -0
- package/dist/models/index.d.ts +10 -0
- package/dist/models/index.js +13 -0
- package/dist/models/manager.d.ts +34 -0
- package/dist/models/manager.js +197 -0
- package/dist/models/registry.d.ts +27 -0
- package/dist/models/registry.js +359 -0
- package/dist/models/types.d.ts +119 -0
- package/dist/models/types.js +5 -0
- package/dist/multimodal/attachments.d.ts +13 -0
- package/dist/multimodal/attachments.js +99 -0
- package/dist/multimodal/index.d.ts +6 -0
- package/dist/multimodal/index.js +3 -0
- package/dist/multimodal/slash.d.ts +9 -0
- package/dist/multimodal/slash.js +111 -0
- package/dist/multimodal/types.d.ts +30 -0
- package/dist/multimodal/types.js +5 -0
- package/dist/permission/approval.d.ts +18 -0
- package/dist/permission/approval.js +86 -0
- package/dist/permission/confirmation.d.ts +33 -0
- package/dist/permission/confirmation.js +130 -0
- package/dist/permission/judge.d.ts +25 -0
- package/dist/permission/judge.js +162 -0
- package/dist/permission/store.d.ts +12 -0
- package/dist/permission/store.js +50 -0
- package/dist/platform/sync.d.ts +17 -0
- package/dist/platform/sync.js +38 -0
- package/dist/project-session/commands.d.ts +5 -0
- package/dist/project-session/commands.js +220 -0
- package/dist/project-session/context.d.ts +21 -0
- package/dist/project-session/context.js +145 -0
- package/dist/project-session/index.d.ts +8 -0
- package/dist/project-session/index.js +8 -0
- package/dist/project-session/project.d.ts +15 -0
- package/dist/project-session/project.js +107 -0
- package/dist/project-session/session.d.ts +14 -0
- package/dist/project-session/session.js +124 -0
- package/dist/project-session/types.d.ts +85 -0
- package/dist/project-session/types.js +6 -0
- package/dist/providers/anthropic.d.ts +4 -0
- package/dist/providers/anthropic.js +94 -0
- package/dist/providers/circuit-breaker.d.ts +30 -0
- package/dist/providers/circuit-breaker.js +109 -0
- package/dist/providers/cohere.d.ts +2 -0
- package/dist/providers/cohere.js +49 -0
- package/dist/providers/deepinfra.d.ts +32 -0
- package/dist/providers/deepinfra.js +44 -0
- package/dist/providers/detection.d.ts +21 -0
- package/dist/providers/detection.js +88 -0
- package/dist/providers/dirgha.d.ts +3 -0
- package/dist/providers/dirgha.js +26 -0
- package/dist/providers/dispatch.d.ts +28 -0
- package/dist/providers/dispatch.js +262 -0
- package/dist/providers/fireworks.d.ts +2 -0
- package/dist/providers/fireworks.js +109 -0
- package/dist/providers/gateway.d.ts +2 -0
- package/dist/providers/gateway.js +80 -0
- package/dist/providers/gemini.d.ts +3 -0
- package/dist/providers/gemini.js +103 -0
- package/dist/providers/groq.d.ts +2 -0
- package/dist/providers/groq.js +39 -0
- package/dist/providers/http.d.ts +27 -0
- package/dist/providers/http.js +245 -0
- package/dist/providers/index.d.ts +16 -0
- package/dist/providers/index.js +18 -0
- package/dist/providers/messages.d.ts +21 -0
- package/dist/providers/messages.js +116 -0
- package/dist/providers/mistral.d.ts +2 -0
- package/dist/providers/mistral.js +39 -0
- package/dist/providers/normalise.d.ts +5 -0
- package/dist/providers/normalise.js +29 -0
- package/dist/providers/nvidia.d.ts +2 -0
- package/dist/providers/nvidia.js +62 -0
- package/dist/providers/openai.d.ts +3 -0
- package/dist/providers/openai.js +20 -0
- package/dist/providers/openrouter.d.ts +2 -0
- package/dist/providers/openrouter.js +54 -0
- package/dist/providers/perplexity.d.ts +34 -0
- package/dist/providers/perplexity.js +66 -0
- package/dist/providers/rate-limit.d.ts +31 -0
- package/dist/providers/rate-limit.js +101 -0
- package/dist/providers/togetherai.d.ts +32 -0
- package/dist/providers/togetherai.js +44 -0
- package/dist/providers/tools-format.d.ts +2437 -0
- package/dist/providers/tools-format.js +15 -0
- package/dist/providers/types.d.ts +29 -0
- package/dist/providers/types.js +2 -0
- package/dist/providers/unified-rate-limiter.d.ts +116 -0
- package/dist/providers/unified-rate-limiter.js +385 -0
- package/dist/providers/vercel.d.ts +32 -0
- package/dist/providers/vercel.js +44 -0
- package/dist/providers/xai.d.ts +2 -0
- package/dist/providers/xai.js +39 -0
- package/dist/realtime/hub.d.ts +42 -0
- package/dist/realtime/hub.js +147 -0
- package/dist/repl/escape-recovery.d.ts +75 -0
- package/dist/repl/escape-recovery.js +236 -0
- package/dist/repl/index.d.ts +2 -0
- package/dist/repl/index.js +226 -0
- package/dist/repl/input.d.ts +12 -0
- package/dist/repl/input.js +345 -0
- package/dist/repl/renderer.d.ts +23 -0
- package/dist/repl/renderer.js +232 -0
- package/dist/repl/slash/account.d.ts +2 -0
- package/dist/repl/slash/account.js +70 -0
- package/dist/repl/slash/agent-discovery.d.ts +15 -0
- package/dist/repl/slash/agent-discovery.js +227 -0
- package/dist/repl/slash/config.d.ts +2 -0
- package/dist/repl/slash/config.js +223 -0
- package/dist/repl/slash/consensus.d.ts +14 -0
- package/dist/repl/slash/consensus.js +173 -0
- package/dist/repl/slash/context.d.ts +3 -0
- package/dist/repl/slash/context.js +188 -0
- package/dist/repl/slash/cron.d.ts +2 -0
- package/dist/repl/slash/cron.js +83 -0
- package/dist/repl/slash/dev.d.ts +5 -0
- package/dist/repl/slash/dev.js +240 -0
- package/dist/repl/slash/fs.d.ts +10 -0
- package/dist/repl/slash/fs.js +105 -0
- package/dist/repl/slash/git-ext.d.ts +2 -0
- package/dist/repl/slash/git-ext.js +95 -0
- package/dist/repl/slash/git.d.ts +3 -0
- package/dist/repl/slash/git.js +167 -0
- package/dist/repl/slash/hermes.d.ts +2 -0
- package/dist/repl/slash/hermes.js +180 -0
- package/dist/repl/slash/index.d.ts +28 -0
- package/dist/repl/slash/index.js +160 -0
- package/dist/repl/slash/knowledge.d.ts +8 -0
- package/dist/repl/slash/knowledge.js +287 -0
- package/dist/repl/slash/local.d.ts +5 -0
- package/dist/repl/slash/local.js +24 -0
- package/dist/repl/slash/mcp.d.ts +2 -0
- package/dist/repl/slash/mcp.js +63 -0
- package/dist/repl/slash/memory.d.ts +2 -0
- package/dist/repl/slash/memory.js +232 -0
- package/dist/repl/slash/net.d.ts +11 -0
- package/dist/repl/slash/net.js +83 -0
- package/dist/repl/slash/orchestration.d.ts +2 -0
- package/dist/repl/slash/orchestration.js +61 -0
- package/dist/repl/slash/safety.d.ts +2 -0
- package/dist/repl/slash/safety.js +131 -0
- package/dist/repl/slash/screen.d.ts +2 -0
- package/dist/repl/slash/screen.js +202 -0
- package/dist/repl/slash/search.d.ts +2 -0
- package/dist/repl/slash/search.js +211 -0
- package/dist/repl/slash/security.d.ts +2 -0
- package/dist/repl/slash/security.js +102 -0
- package/dist/repl/slash/session.d.ts +2 -0
- package/dist/repl/slash/session.js +498 -0
- package/dist/repl/slash/shortcuts.d.ts +2 -0
- package/dist/repl/slash/shortcuts.js +180 -0
- package/dist/repl/slash/side.d.ts +9 -0
- package/dist/repl/slash/side.js +27 -0
- package/dist/repl/slash/sprint.d.ts +2 -0
- package/dist/repl/slash/sprint.js +189 -0
- package/dist/repl/slash/team.d.ts +15 -0
- package/dist/repl/slash/team.js +235 -0
- package/dist/repl/slash/theme.d.ts +10 -0
- package/dist/repl/slash/theme.js +112 -0
- package/dist/repl/slash/types.d.ts +30 -0
- package/dist/repl/slash/types.js +2 -0
- package/dist/repl/slash/verbose.d.ts +18 -0
- package/dist/repl/slash/verbose.js +38 -0
- package/dist/repl/slash/verify.d.ts +10 -0
- package/dist/repl/slash/verify.js +171 -0
- package/dist/repl/slash/voice.d.ts +5 -0
- package/dist/repl/slash/voice.js +72 -0
- package/dist/repl/slash-git.d.ts +2 -0
- package/dist/repl/slash-git.js +132 -0
- package/dist/repl/slash-workflow.d.ts +2 -0
- package/dist/repl/slash-workflow.js +108 -0
- package/dist/repl/themes.d.ts +24 -0
- package/dist/repl/themes.js +253 -0
- package/dist/runtime/host-tools.d.ts +63 -0
- package/dist/runtime/host-tools.js +204 -0
- package/dist/runtime/index.d.ts +25 -0
- package/dist/runtime/index.js +19 -0
- package/dist/runtime/isolate.d.ts +88 -0
- package/dist/runtime/isolate.js +277 -0
- package/dist/runtime/mount.d.ts +105 -0
- package/dist/runtime/mount.js +458 -0
- package/dist/runtime/multiplayer.d.ts +128 -0
- package/dist/runtime/multiplayer.js +285 -0
- package/dist/runtime/network-control.d.ts +65 -0
- package/dist/runtime/network-control.js +195 -0
- package/dist/runtime/transcript.d.ts +128 -0
- package/dist/runtime/transcript.js +252 -0
- package/dist/runtime/wasm-commands.d.ts +27 -0
- package/dist/runtime/wasm-commands.js +156 -0
- package/dist/security/capabilityTokens.d.ts +44 -0
- package/dist/security/capabilityTokens.js +122 -0
- package/dist/security/csrf.d.ts +53 -0
- package/dist/security/csrf.js +181 -0
- package/dist/security/index.d.ts +6 -0
- package/dist/security/index.js +6 -0
- package/dist/security/rules.d.ts +12 -0
- package/dist/security/rules.js +212 -0
- package/dist/security/safeShell.d.ts +19 -0
- package/dist/security/safeShell.js +82 -0
- package/dist/security/scanner.d.ts +22 -0
- package/dist/security/scanner.js +190 -0
- package/dist/security/types.d.ts +53 -0
- package/dist/security/types.js +6 -0
- package/dist/services/UnifiedAgentClient.d.ts +75 -0
- package/dist/services/UnifiedAgentClient.js +180 -0
- package/dist/services/memory/feature-flag.d.ts +38 -0
- package/dist/services/memory/feature-flag.js +95 -0
- package/dist/services/memory/gepa-wrapper.d.ts +38 -0
- package/dist/services/memory/gepa-wrapper.js +177 -0
- package/dist/session/caps.d.ts +9 -0
- package/dist/session/caps.js +46 -0
- package/dist/session/checkpoint.d.ts +4 -0
- package/dist/session/checkpoint.js +91 -0
- package/dist/session/commands/delete.d.ts +2 -0
- package/dist/session/commands/delete.js +22 -0
- package/dist/session/commands/index.d.ts +7 -0
- package/dist/session/commands/index.js +8 -0
- package/dist/session/commands/list.d.ts +2 -0
- package/dist/session/commands/list.js +39 -0
- package/dist/session/commands/load.d.ts +2 -0
- package/dist/session/commands/load.js +35 -0
- package/dist/session/commands/save.d.ts +2 -0
- package/dist/session/commands/save.js +19 -0
- package/dist/session/db.d.ts +21 -0
- package/dist/session/db.js +289 -0
- package/dist/session/memory.d.ts +6 -0
- package/dist/session/memory.js +67 -0
- package/dist/session/persistence.d.ts +35 -0
- package/dist/session/persistence.js +166 -0
- package/dist/setup/hardwareDetect.d.ts +10 -0
- package/dist/setup/hardwareDetect.js +61 -0
- package/dist/setup/localAIPrompt.d.ts +1 -0
- package/dist/setup/localAIPrompt.js +84 -0
- package/dist/setup/modelCurator.d.ts +20 -0
- package/dist/setup/modelCurator.js +171 -0
- package/dist/skills/generator.d.ts +7 -0
- package/dist/skills/generator.js +76 -0
- package/dist/skills/index.d.ts +71 -0
- package/dist/skills/index.js +365 -0
- package/dist/skills/registry.d.ts +37 -0
- package/dist/skills/registry.js +120 -0
- package/dist/sprint/compressor.d.ts +9 -0
- package/dist/sprint/compressor.js +95 -0
- package/dist/sprint/critic.d.ts +12 -0
- package/dist/sprint/critic.js +44 -0
- package/dist/sprint/escalation.d.ts +12 -0
- package/dist/sprint/escalation.js +116 -0
- package/dist/sprint/executor.d.ts +13 -0
- package/dist/sprint/executor.js +231 -0
- package/dist/sprint/journal.d.ts +28 -0
- package/dist/sprint/journal.js +270 -0
- package/dist/sprint/manifest.d.ts +5 -0
- package/dist/sprint/manifest.js +183 -0
- package/dist/sprint/types.d.ts +96 -0
- package/dist/sprint/types.js +5 -0
- package/dist/sprint/verifier.d.ts +2 -0
- package/dist/sprint/verifier.js +152 -0
- package/dist/sprint/watchdog.d.ts +6 -0
- package/dist/sprint/watchdog.js +144 -0
- package/dist/swarm/agents/VerificationQuorum.d.ts +22 -0
- package/dist/swarm/agents/VerificationQuorum.js +146 -0
- package/dist/swarm/agents/WorkerAgent.d.ts +42 -0
- package/dist/swarm/agents/WorkerAgent.js +130 -0
- package/dist/swarm/collaboration/AgentGit.d.ts +39 -0
- package/dist/swarm/collaboration/AgentGit.js +102 -0
- package/dist/swarm/collaboration/CRDT.d.ts +28 -0
- package/dist/swarm/collaboration/CRDT.js +116 -0
- package/dist/swarm/commands.d.ts +5 -0
- package/dist/swarm/commands.js +144 -0
- package/dist/swarm/governance/CostOptimizer.d.ts +40 -0
- package/dist/swarm/governance/CostOptimizer.js +162 -0
- package/dist/swarm/index.d.ts +15 -0
- package/dist/swarm/index.js +16 -0
- package/dist/swarm/orchestration/ColonyManager.d.ts +45 -0
- package/dist/swarm/orchestration/ColonyManager.js +166 -0
- package/dist/swarm/runtime/ModelPool.d.ts +37 -0
- package/dist/swarm/runtime/ModelPool.js +162 -0
- package/dist/swarm/templates/SalesforceDomains.d.ts +25 -0
- package/dist/swarm/templates/SalesforceDomains.js +340 -0
- package/dist/swarm/testing/MacroTestFramework.d.ts +25 -0
- package/dist/swarm/testing/MacroTestFramework.js +109 -0
- package/dist/swarm/testing/MicroTestFramework.d.ts +23 -0
- package/dist/swarm/testing/MicroTestFramework.js +128 -0
- package/dist/swarm/types.d.ts +227 -0
- package/dist/swarm/types.js +5 -0
- package/dist/sync/engine.d.ts +17 -0
- package/dist/sync/engine.js +107 -0
- package/dist/sync/knowledge.d.ts +30 -0
- package/dist/sync/knowledge.js +155 -0
- package/dist/sync/schema.d.ts +1 -0
- package/dist/sync/schema.js +13 -0
- package/dist/sync/session.d.ts +24 -0
- package/dist/sync/session.js +70 -0
- package/dist/sync/types.d.ts +32 -0
- package/dist/sync/types.js +2 -0
- package/dist/sync/wiki-git.d.ts +17 -0
- package/dist/sync/wiki-git.js +80 -0
- package/dist/task/queue.d.ts +36 -0
- package/dist/task/queue.js +97 -0
- package/dist/tools/browser/agent.d.ts +12 -0
- package/dist/tools/browser/agent.js +119 -0
- package/dist/tools/browser/legacy.d.ts +5 -0
- package/dist/tools/browser/legacy.js +66 -0
- package/dist/tools/browser/utils.d.ts +5 -0
- package/dist/tools/browser/utils.js +27 -0
- package/dist/tools/browser/vision.d.ts +2 -0
- package/dist/tools/browser/vision.js +154 -0
- package/dist/tools/browser.d.ts +7 -0
- package/dist/tools/browser.js +100 -0
- package/dist/tools/defs.d.ts +2575 -0
- package/dist/tools/defs.js +129 -0
- package/dist/tools/deploy.d.ts +17 -0
- package/dist/tools/deploy.js +94 -0
- package/dist/tools/diff-util.d.ts +8 -0
- package/dist/tools/diff-util.js +100 -0
- package/dist/tools/file.d.ts +11 -0
- package/dist/tools/file.js +297 -0
- package/dist/tools/git.d.ts +11 -0
- package/dist/tools/git.js +139 -0
- package/dist/tools/index.d.ts +4 -0
- package/dist/tools/index.js +172 -0
- package/dist/tools/memory-graph.d.ts +21 -0
- package/dist/tools/memory-graph.js +72 -0
- package/dist/tools/memory.d.ts +5 -0
- package/dist/tools/memory.js +55 -0
- package/dist/tools/patch.d.ts +2 -0
- package/dist/tools/patch.js +103 -0
- package/dist/tools/repo.d.ts +2 -0
- package/dist/tools/repo.js +203 -0
- package/dist/tools/sandbox.d.ts +7 -0
- package/dist/tools/sandbox.js +101 -0
- package/dist/tools/search.d.ts +11 -0
- package/dist/tools/search.js +217 -0
- package/dist/tools/session-search.d.ts +2 -0
- package/dist/tools/session-search.js +31 -0
- package/dist/tools/shell-guards.spec.d.ts +1 -0
- package/dist/tools/shell-guards.spec.js +95 -0
- package/dist/tools/shell.d.ts +3 -0
- package/dist/tools/shell.js +241 -0
- package/dist/tools/symbol-graph.d.ts +2 -0
- package/dist/tools/symbol-graph.js +166 -0
- package/dist/tui/App.d.ts +5 -0
- package/dist/tui/App.js +670 -0
- package/dist/tui/TaskQueue.d.ts +68 -0
- package/dist/tui/TaskQueue.js +178 -0
- package/dist/tui/TaskQueueClass.d.ts +18 -0
- package/dist/tui/TaskQueueClass.js +83 -0
- package/dist/tui/TaskQueueTypes.d.ts +20 -0
- package/dist/tui/TaskQueueTypes.js +2 -0
- package/dist/tui/colors.d.ts +6 -0
- package/dist/tui/colors.js +48 -0
- package/dist/tui/commands.d.ts +14 -0
- package/dist/tui/commands.js +109 -0
- package/dist/tui/components/ActivitySummary.d.ts +8 -0
- package/dist/tui/components/ActivitySummary.js +59 -0
- package/dist/tui/components/CodeEditBox.d.ts +42 -0
- package/dist/tui/components/CodeEditBox.js +187 -0
- package/dist/tui/components/CompletedMsg.d.ts +4 -0
- package/dist/tui/components/CompletedMsg.js +40 -0
- package/dist/tui/components/CompletedSystemMsg.d.ts +3 -0
- package/dist/tui/components/CompletedSystemMsg.js +16 -0
- package/dist/tui/components/CompletedToolGroup.d.ts +9 -0
- package/dist/tui/components/CompletedToolGroup.js +47 -0
- package/dist/tui/components/DiffLineItem.d.ts +1 -0
- package/dist/tui/components/DiffLineItem.js +14 -0
- package/dist/tui/components/DiffView.d.ts +2 -0
- package/dist/tui/components/DiffView.js +34 -0
- package/dist/tui/components/ErrorMsg.d.ts +3 -0
- package/dist/tui/components/ErrorMsg.js +24 -0
- package/dist/tui/components/FileComplete.d.ts +8 -0
- package/dist/tui/components/FileComplete.js +18 -0
- package/dist/tui/components/FleetPanel.d.ts +1 -0
- package/dist/tui/components/FleetPanel.js +80 -0
- package/dist/tui/components/HelpOverlay.d.ts +5 -0
- package/dist/tui/components/HelpOverlay.js +88 -0
- package/dist/tui/components/HistorySearch.d.ts +7 -0
- package/dist/tui/components/HistorySearch.js +60 -0
- package/dist/tui/components/InputBox.d.ts +17 -0
- package/dist/tui/components/InputBox.js +57 -0
- package/dist/tui/components/InputHooks.d.ts +12 -0
- package/dist/tui/components/InputHooks.js +214 -0
- package/dist/tui/components/JitterFreeRenderer.d.ts +51 -0
- package/dist/tui/components/JitterFreeRenderer.js +289 -0
- package/dist/tui/components/KeysPicker.d.ts +1 -0
- package/dist/tui/components/KeysPicker.js +54 -0
- package/dist/tui/components/LiveThinkingNode.d.ts +1 -0
- package/dist/tui/components/LiveThinkingNode.js +8 -0
- package/dist/tui/components/LiveView.d.ts +1 -0
- package/dist/tui/components/LiveView.js +34 -0
- package/dist/tui/components/LocalModelRow.d.ts +1 -0
- package/dist/tui/components/LocalModelRow.js +9 -0
- package/dist/tui/components/ModelPicker.d.ts +1 -0
- package/dist/tui/components/ModelPicker.js +41 -0
- package/dist/tui/components/ModelRow.d.ts +1 -0
- package/dist/tui/components/ModelRow.js +8 -0
- package/dist/tui/components/ScrollLogic.d.ts +11 -0
- package/dist/tui/components/ScrollLogic.js +38 -0
- package/dist/tui/components/ScrollView.d.ts +7 -0
- package/dist/tui/components/ScrollView.js +45 -0
- package/dist/tui/components/SessionPicker.d.ts +14 -0
- package/dist/tui/components/SessionPicker.js +37 -0
- package/dist/tui/components/SlashHint.d.ts +3 -0
- package/dist/tui/components/SlashHint.js +16 -0
- package/dist/tui/components/SprintHelpers.d.ts +3 -0
- package/dist/tui/components/SprintHelpers.js +15 -0
- package/dist/tui/components/SprintStatus.d.ts +2 -0
- package/dist/tui/components/SprintStatus.js +31 -0
- package/dist/tui/components/SprintTaskRow.d.ts +1 -0
- package/dist/tui/components/SprintTaskRow.js +8 -0
- package/dist/tui/components/StatusBar.d.ts +16 -0
- package/dist/tui/components/StatusBar.js +29 -0
- package/dist/tui/components/__demos__/CodeEditDemo.d.ts +8 -0
- package/dist/tui/components/__demos__/CodeEditDemo.js +85 -0
- package/dist/tui/components/code-edit/CodeEditBox.d.ts +7 -0
- package/dist/tui/components/code-edit/CodeEditBox.js +16 -0
- package/dist/tui/components/code-edit/components/EditBadge.d.ts +10 -0
- package/dist/tui/components/code-edit/components/EditBadge.js +14 -0
- package/dist/tui/components/code-edit/components/EditItem.d.ts +7 -0
- package/dist/tui/components/code-edit/components/EditItem.js +20 -0
- package/dist/tui/components/code-edit/components/SyntaxHighlighter.d.ts +11 -0
- package/dist/tui/components/code-edit/components/SyntaxHighlighter.js +43 -0
- package/dist/tui/components/code-edit/index.d.ts +17 -0
- package/dist/tui/components/code-edit/index.js +29 -0
- package/dist/tui/components/code-edit/patterns/index.d.ts +6 -0
- package/dist/tui/components/code-edit/patterns/index.js +38 -0
- package/dist/tui/components/code-edit/patterns/javascript.d.ts +5 -0
- package/dist/tui/components/code-edit/patterns/javascript.js +17 -0
- package/dist/tui/components/code-edit/patterns/python.d.ts +5 -0
- package/dist/tui/components/code-edit/patterns/python.js +14 -0
- package/dist/tui/components/code-edit/patterns/typescript.d.ts +5 -0
- package/dist/tui/components/code-edit/patterns/typescript.js +20 -0
- package/dist/tui/components/code-edit/types.d.ts +32 -0
- package/dist/tui/components/code-edit/types.js +5 -0
- package/dist/tui/components/code-edit/utils.d.ts +8 -0
- package/dist/tui/components/code-edit/utils.js +35 -0
- package/dist/tui/components/jitter-free/FrameController.d.ts +13 -0
- package/dist/tui/components/jitter-free/FrameController.js +44 -0
- package/dist/tui/components/jitter-free/JitterFreeRenderer.d.ts +7 -0
- package/dist/tui/components/jitter-free/JitterFreeRenderer.js +22 -0
- package/dist/tui/components/jitter-free/SmoothSpinner.d.ts +7 -0
- package/dist/tui/components/jitter-free/SmoothSpinner.js +23 -0
- package/dist/tui/components/jitter-free/StableCursor.d.ts +7 -0
- package/dist/tui/components/jitter-free/StableCursor.js +15 -0
- package/dist/tui/components/jitter-free/StableScroll.d.ts +7 -0
- package/dist/tui/components/jitter-free/StableScroll.js +27 -0
- package/dist/tui/components/jitter-free/config.d.ts +7 -0
- package/dist/tui/components/jitter-free/config.js +8 -0
- package/dist/tui/components/jitter-free/hooks/index.d.ts +6 -0
- package/dist/tui/components/jitter-free/hooks/index.js +7 -0
- package/dist/tui/components/jitter-free/hooks/useDebounceRender.d.ts +9 -0
- package/dist/tui/components/jitter-free/hooks/useDebounceRender.js +33 -0
- package/dist/tui/components/jitter-free/hooks/useDoubleBuffer.d.ts +10 -0
- package/dist/tui/components/jitter-free/hooks/useDoubleBuffer.js +24 -0
- package/dist/tui/components/jitter-free/hooks/useScrollBuffer.d.ts +9 -0
- package/dist/tui/components/jitter-free/hooks/useScrollBuffer.js +25 -0
- package/dist/tui/components/jitter-free/index.d.ts +12 -0
- package/dist/tui/components/jitter-free/index.js +17 -0
- package/dist/tui/components/jitter-free/types.d.ts +26 -0
- package/dist/tui/components/jitter-free/types.js +5 -0
- package/dist/tui/components/jitter-free/utils.d.ts +15 -0
- package/dist/tui/components/jitter-free/utils.js +46 -0
- package/dist/tui/components/stream/StreamContainer.d.ts +6 -0
- package/dist/tui/components/stream/StreamContainer.js +75 -0
- package/dist/tui/components/stream/ThinkingStream.d.ts +13 -0
- package/dist/tui/components/stream/ThinkingStream.js +21 -0
- package/dist/tui/components/stream/ToolCallArgs.d.ts +3 -0
- package/dist/tui/components/stream/ToolCallArgs.js +7 -0
- package/dist/tui/components/stream/ToolCallBox.d.ts +13 -0
- package/dist/tui/components/stream/ToolCallBox.js +13 -0
- package/dist/tui/components/stream/ToolItem.d.ts +1 -0
- package/dist/tui/components/stream/ToolItem.js +59 -0
- package/dist/tui/components/stream/index.d.ts +9 -0
- package/dist/tui/components/stream/index.js +8 -0
- package/dist/tui/components/stream/types.d.ts +20 -0
- package/dist/tui/components/stream/types.js +2 -0
- package/dist/tui/components/useKeyInput.d.ts +6 -0
- package/dist/tui/components/useKeyInput.js +28 -0
- package/dist/tui/constants.d.ts +7 -0
- package/dist/tui/constants.js +7 -0
- package/dist/tui/helpers/grapheme.d.ts +27 -0
- package/dist/tui/helpers/grapheme.js +116 -0
- package/dist/tui/helpers.d.ts +7 -0
- package/dist/tui/helpers.js +43 -0
- package/dist/tui/index.d.ts +5 -0
- package/dist/tui/index.js +70 -0
- package/dist/tui/input/index.d.ts +5 -0
- package/dist/tui/input/index.js +2 -0
- package/dist/tui/keybindings.d.ts +10 -0
- package/dist/tui/keybindings.js +94 -0
- package/dist/tui/logo.d.ts +1 -0
- package/dist/tui/logo.js +57 -0
- package/dist/tui/markdown.d.ts +6 -0
- package/dist/tui/markdown.js +27 -0
- package/dist/tui/models.d.ts +142 -0
- package/dist/tui/models.js +47 -0
- package/dist/tui/polyfill.d.ts +3 -0
- package/dist/tui/polyfill.js +20 -0
- package/dist/tui/startup-cta.d.ts +18 -0
- package/dist/tui/startup-cta.js +123 -0
- package/dist/tui/syntax-languages.d.ts +4 -0
- package/dist/tui/syntax-languages.js +42 -0
- package/dist/tui/syntax-tokenizer.d.ts +7 -0
- package/dist/tui/syntax-tokenizer.js +137 -0
- package/dist/tui/syntax.d.ts +2 -0
- package/dist/tui/syntax.js +27 -0
- package/dist/tui/system.d.ts +5 -0
- package/dist/tui/system.js +29 -0
- package/dist/tui/themes.d.ts +19 -0
- package/dist/tui/themes.js +75 -0
- package/dist/tui/tui-types.d.ts +28 -0
- package/dist/tui/tui-types.js +2 -0
- package/dist/tui/useAppProcessor.d.ts +5 -0
- package/dist/tui/useAppProcessor.js +63 -0
- package/dist/tui/useAppSession.d.ts +26 -0
- package/dist/tui/useAppSession.js +57 -0
- package/dist/tui/useAppTaskQueue.d.ts +13 -0
- package/dist/tui/useAppTaskQueue.js +26 -0
- package/dist/tui/useStreamThrottle.d.ts +11 -0
- package/dist/tui/useStreamThrottle.js +39 -0
- package/dist/types.d.ts +182 -0
- package/dist/types.js +13 -0
- package/dist/utils/auth.d.ts +5 -0
- package/dist/utils/auth.js +46 -0
- package/dist/utils/config.d.ts +9 -0
- package/dist/utils/config.js +100 -0
- package/dist/utils/context.d.ts +4 -0
- package/dist/utils/context.js +142 -0
- package/dist/utils/credentials.d.ts +23 -0
- package/dist/utils/credentials.js +69 -0
- package/dist/utils/execution-controller.d.ts +45 -0
- package/dist/utils/execution-controller.js +228 -0
- package/dist/utils/experimental.d.ts +16 -0
- package/dist/utils/experimental.js +23 -0
- package/dist/utils/features.d.ts +18 -0
- package/dist/utils/features.js +38 -0
- package/dist/utils/health-monitor.d.ts +49 -0
- package/dist/utils/health-monitor.js +159 -0
- package/dist/utils/id.d.ts +19 -0
- package/dist/utils/id.js +42 -0
- package/dist/utils/index.d.ts +10 -0
- package/dist/utils/index.js +13 -0
- package/dist/utils/keys.d.ts +12 -0
- package/dist/utils/keys.js +50 -0
- package/dist/utils/logger.d.ts +12 -0
- package/dist/utils/logger.js +89 -0
- package/dist/utils/metrics.d.ts +12 -0
- package/dist/utils/metrics.js +36 -0
- package/dist/utils/paste-handler.d.ts +26 -0
- package/dist/utils/paste-handler.js +140 -0
- package/dist/utils/profile.d.ts +16 -0
- package/dist/utils/profile.js +68 -0
- package/dist/utils/project-tracker.d.ts +8 -0
- package/dist/utils/project-tracker.js +66 -0
- package/dist/utils/safe-exec.d.ts +20 -0
- package/dist/utils/safe-exec.js +32 -0
- package/dist/utils/security-boundary.d.ts +53 -0
- package/dist/utils/security-boundary.js +145 -0
- package/dist/utils/session-cache.d.ts +29 -0
- package/dist/utils/session-cache.js +112 -0
- package/dist/utils/soul.d.ts +4 -0
- package/dist/utils/soul.js +104 -0
- package/dist/utils/sqlite-future.d.ts +35 -0
- package/dist/utils/sqlite-future.js +66 -0
- package/dist/utils/sqlite.d.ts +35 -0
- package/dist/utils/sqlite.js +65 -0
- package/dist/utils/startup-profiler.d.ts +26 -0
- package/dist/utils/startup-profiler.js +61 -0
- package/dist/utils/state.d.ts +9 -0
- package/dist/utils/state.js +29 -0
- package/dist/utils/sum.d.ts +6 -0
- package/dist/utils/sum.js +11 -0
- package/dist/utils/token-counter.d.ts +18 -0
- package/dist/utils/token-counter.js +84 -0
- package/dist/utils/unified-memory.d.ts +80 -0
- package/dist/utils/unified-memory.js +171 -0
- package/dist/utils/update-verify.d.ts +7 -0
- package/dist/utils/update-verify.js +64 -0
- package/dist/voice/browser-extension.d.ts +37 -0
- package/dist/voice/browser-extension.js +97 -0
- package/dist/voice/commands.d.ts +5 -0
- package/dist/voice/commands.js +65 -0
- package/dist/voice/desktop.d.ts +42 -0
- package/dist/voice/desktop.js +254 -0
- package/dist/voice/index.d.ts +16 -0
- package/dist/voice/index.js +123 -0
- package/dist/voice/mobile-bridge.d.ts +12 -0
- package/dist/voice/mobile-bridge.js +139 -0
- package/dist/voice/personal-plex.d.ts +61 -0
- package/dist/voice/personal-plex.js +280 -0
- package/dist/voice/plex.d.ts +19 -0
- package/dist/voice/plex.js +55 -0
- package/dist/voice/recorder.d.ts +10 -0
- package/dist/voice/recorder.js +43 -0
- package/dist/voice/shortcuts.d.ts +16 -0
- package/dist/voice/shortcuts.js +31 -0
- package/dist/voice/transcribe.d.ts +3 -0
- package/dist/voice/transcribe.js +36 -0
- package/dist/voice/tts.d.ts +35 -0
- package/dist/voice/tts.js +190 -0
- package/dist/voice/types.d.ts +25 -0
- package/dist/voice/types.js +2 -0
- package/dist/workspace/store.d.ts +48 -0
- package/dist/workspace/store.js +106 -0
- package/dist_v2/audit/writer.d.ts +23 -0
- package/dist_v2/audit/writer.js +34 -0
- package/dist_v2/auth/keypool.d.ts +62 -0
- package/dist_v2/auth/keypool.js +211 -0
- package/dist_v2/auth/keystore.d.ts +20 -0
- package/dist_v2/auth/keystore.js +45 -0
- package/dist_v2/auth/providers.d.ts +35 -0
- package/dist_v2/auth/providers.js +66 -0
- package/dist_v2/cli/config.d.ts +51 -0
- package/dist_v2/cli/flags.d.ts +5 -0
- package/dist_v2/cli/flags.js +23 -0
- package/dist_v2/cli/interactive.js +65 -7
- package/dist_v2/cli/main.js +331 -13
- package/dist_v2/cli/setup.js +2 -2
- package/dist_v2/cli/slash/fleet.d.ts +5 -3
- package/dist_v2/cli/slash/fleet.js +40 -13
- package/dist_v2/cli/subcommands/ask.js +3 -1
- package/dist_v2/cli/subcommands/audit-codebase.d.ts +18 -0
- package/dist_v2/cli/subcommands/audit-codebase.js +148 -0
- package/dist_v2/cli/subcommands/audit.js +36 -11
- package/dist_v2/cli/subcommands/chat.js +3 -1
- package/dist_v2/cli/subcommands/cost.d.ts +15 -0
- package/dist_v2/cli/subcommands/cost.js +143 -0
- package/dist_v2/cli/subcommands/index.js +20 -0
- package/dist_v2/cli/subcommands/kb.d.ts +19 -0
- package/dist_v2/cli/subcommands/kb.js +151 -0
- package/dist_v2/cli/subcommands/keys.js +117 -26
- package/dist_v2/cli/subcommands/ledger.d.ts +9 -0
- package/dist_v2/cli/subcommands/ledger.js +130 -0
- package/dist_v2/cli/subcommands/login.d.ts +9 -4
- package/dist_v2/cli/subcommands/login.js +92 -5
- package/dist_v2/cli/subcommands/memory.d.ts +10 -0
- package/dist_v2/cli/subcommands/memory.js +140 -0
- package/dist_v2/cli/subcommands/models.js +80 -3
- package/dist_v2/cli/subcommands/resume.d.ts +11 -0
- package/dist_v2/cli/subcommands/resume.js +138 -0
- package/dist_v2/cli/subcommands/skills.d.ts +14 -0
- package/dist_v2/cli/subcommands/skills.js +207 -0
- package/dist_v2/cli/subcommands/undo.d.ts +17 -0
- package/dist_v2/cli/subcommands/undo.js +144 -0
- package/dist_v2/cli/subcommands/update.d.ts +42 -0
- package/dist_v2/cli/subcommands/update.js +228 -0
- package/dist_v2/cli/subcommands/verify.d.ts +21 -0
- package/dist_v2/cli/subcommands/verify.js +126 -0
- package/dist_v2/context/compaction.d.ts +22 -0
- package/dist_v2/context/compaction.js +38 -0
- package/dist_v2/context/default-soul.md +36 -0
- package/dist_v2/context/git-state.d.ts +23 -0
- package/dist_v2/context/git-state.js +71 -0
- package/dist_v2/context/ledger.d.ts +58 -0
- package/dist_v2/context/ledger.js +178 -0
- package/dist_v2/context/mode-enforcement.d.ts +32 -0
- package/dist_v2/context/mode-enforcement.js +96 -0
- package/dist_v2/context/mode.d.ts +1 -1
- package/dist_v2/context/mode.js +5 -1
- package/dist_v2/context/primer.d.ts +45 -0
- package/dist_v2/context/primer.js +81 -0
- package/dist_v2/context/soul.d.ts +31 -0
- package/dist_v2/context/soul.js +63 -0
- package/dist_v2/extensions/api.d.ts +65 -0
- package/dist_v2/extensions/api.js +126 -0
- package/dist_v2/fleet/cli-command.js +56 -6
- package/dist_v2/fleet/runner.js +18 -4
- package/dist_v2/fleet/types.d.ts +4 -0
- package/dist_v2/hooks/config-bridge.d.ts +22 -0
- package/dist_v2/hooks/config-bridge.js +117 -0
- package/dist_v2/intelligence/models-refresh.d.ts +52 -0
- package/dist_v2/intelligence/models-refresh.js +82 -0
- package/dist_v2/intelligence/prices.d.ts +46 -0
- package/dist_v2/intelligence/prices.js +241 -3
- package/dist_v2/kernel/agent-loop.js +10 -0
- package/dist_v2/mcp/client.d.ts +5 -1
- package/dist_v2/mcp/client.js +34 -4
- package/dist_v2/mcp/loader.d.ts +36 -0
- package/dist_v2/mcp/loader.js +51 -0
- package/dist_v2/mcp/transport.d.ts +44 -0
- package/dist_v2/mcp/transport.js +120 -0
- package/dist_v2/providers/define-openai-compat.d.ts +53 -0
- package/dist_v2/providers/define-openai-compat.js +69 -0
- package/dist_v2/providers/dispatch.js +22 -20
- package/dist_v2/providers/nvidia.js +4 -1
- package/dist_v2/providers/openai-compat.js +49 -2
- package/dist_v2/providers/openrouter.js +7 -2
- package/dist_v2/providers/presets.d.ts +30 -0
- package/dist_v2/providers/presets.js +80 -0
- package/dist_v2/providers/rate-limiter.d.ts +50 -0
- package/dist_v2/providers/rate-limiter.js +93 -0
- package/dist_v2/security/skill-scanner.d.ts +43 -0
- package/dist_v2/security/skill-scanner.js +144 -0
- package/dist_v2/skills/loader.js +50 -5
- package/dist_v2/tools/git.js +8 -0
- package/dist_v2/tui/ink/App.js +143 -13
- package/dist_v2/tui/ink/components/ModelPicker.js +7 -1
- package/dist_v2/tui/ink/components/StatusBar.d.ts +8 -0
- package/dist_v2/tui/ink/components/StatusBar.js +20 -1
- package/dist_v2/tui/renderer.js +45 -2
- package/dist_v2/tui/theme-loader.d.ts +29 -0
- package/dist_v2/tui/theme-loader.js +67 -0
- package/docs/ARCHITECTURE.md +163 -0
- package/docs/ROADMAP.md +52 -0
- package/docs/agents/arniko-plugin-spec.md +123 -0
- package/docs/agents/files-and-search.md +87 -0
- package/docs/agents/skill-security.md +127 -0
- package/docs/architecture/001-dependency-pinning.md +37 -0
- package/docs/architecture/002-mesh-security.md +36 -0
- package/docs/architecture/003-file-size-limits.md +37 -0
- package/docs/architecture/004-trust-levels.md +40 -0
- package/docs/audits/HY3-AUDIT-2026-04-25.md +47 -0
- package/docs/memory/architecture-efficiency.md +114 -0
- package/docs/memory/km-architecture.md +116 -0
- package/extensions/vscode/README.md +67 -0
- package/extensions/vscode/package.json +105 -0
- package/package.json +62 -94
- package/promo/assets/audio/dirgha-ambient-150s.m4a +0 -0
- package/promo/hyperframes.json +9 -0
- package/promo/index.html +363 -0
- package/promo/meta.json +5 -0
- package/scripts/gen-skill-md.mjs +97 -0
- package/scripts/preview-logos.mjs +113 -0
- package/scripts/qa-app/aliases_test.mjs +70 -0
- package/scripts/qa-app/audit_test.mjs +71 -0
- package/scripts/qa-app/browser_test.mjs +60 -0
- package/scripts/qa-app/cancel_offline_test.mjs +151 -0
- package/scripts/qa-app/cancel_test.mjs +112 -0
- package/scripts/qa-app/checkpoint_test.mjs +87 -0
- package/scripts/qa-app/compaction_test.mjs +112 -0
- package/scripts/qa-app/cost_test.mjs +72 -0
- package/scripts/qa-app/error_classifier_test.mjs +81 -0
- package/scripts/qa-app/extensions_test.mjs +148 -0
- package/scripts/qa-app/git_state_test.mjs +89 -0
- package/scripts/qa-app/hooks_test.mjs +105 -0
- package/scripts/qa-app/ink_smoke.py +151 -0
- package/scripts/qa-app/ink_unit_test.mjs +176 -0
- package/scripts/qa-app/kb_test.mjs +85 -0
- package/scripts/qa-app/kernel_hooks_test.mjs +178 -0
- package/scripts/qa-app/keypool_test.mjs +105 -0
- package/scripts/qa-app/keys_test.mjs +73 -0
- package/scripts/qa-app/ledger_search_test.mjs +74 -0
- package/scripts/qa-app/ledger_test.mjs +73 -0
- package/scripts/qa-app/login_byok_test.mjs +84 -0
- package/scripts/qa-app/mcp_oauth_test.mjs +109 -0
- package/scripts/qa-app/mcp_test.mjs +129 -0
- package/scripts/qa-app/mode_enforcement_test.mjs +88 -0
- package/scripts/qa-app/models_refresh_test.mjs +155 -0
- package/scripts/qa-app/nim_stream_test.mjs +132 -0
- package/scripts/qa-app/output/admin-secrets.json +17 -0
- package/scripts/qa-app/output/admin-secrets.png +0 -0
- package/scripts/qa-app/output/agents.json +17 -0
- package/scripts/qa-app/output/agents.png +0 -0
- package/scripts/qa-app/output/build.json +17 -0
- package/scripts/qa-app/output/build.png +0 -0
- package/scripts/qa-app/output/chat.json +17 -0
- package/scripts/qa-app/output/chat.png +0 -0
- package/scripts/qa-app/output/deploy.json +17 -0
- package/scripts/qa-app/output/deploy.png +0 -0
- package/scripts/qa-app/output/home.json +20 -0
- package/scripts/qa-app/output/home.png +0 -0
- package/scripts/qa-app/output/media.json +17 -0
- package/scripts/qa-app/output/media.png +0 -0
- package/scripts/qa-app/output/memory.json +17 -0
- package/scripts/qa-app/output/memory.png +0 -0
- package/scripts/qa-app/output/models.json +17 -0
- package/scripts/qa-app/output/models.png +0 -0
- package/scripts/qa-app/output/report.json +240 -0
- package/scripts/qa-app/output/report.md +307 -0
- package/scripts/qa-app/output/research.json +17 -0
- package/scripts/qa-app/output/research.png +0 -0
- package/scripts/qa-app/output/security.json +17 -0
- package/scripts/qa-app/output/security.png +0 -0
- package/scripts/qa-app/output/settings.json +17 -0
- package/scripts/qa-app/output/settings.png +0 -0
- package/scripts/qa-app/output/skills.json +17 -0
- package/scripts/qa-app/output/skills.png +0 -0
- package/scripts/qa-app/output/store.json +17 -0
- package/scripts/qa-app/output/store.png +0 -0
- package/scripts/qa-app/primer_test.mjs +71 -0
- package/scripts/qa-app/provider_matrix.mjs +176 -0
- package/scripts/qa-app/qa.py +271 -0
- package/scripts/qa-app/rate_limit_test.mjs +127 -0
- package/scripts/qa-app/registry_test.mjs +57 -0
- package/scripts/qa-app/rescore.py +87 -0
- package/scripts/qa-app/routes.json +20 -0
- package/scripts/qa-app/run-all.mjs +158 -0
- package/scripts/qa-app/session_test.mjs +81 -0
- package/scripts/qa-app/skill_scanner_test.mjs +156 -0
- package/scripts/qa-app/skills_install_test.mjs +100 -0
- package/scripts/qa-app/skills_test.mjs +98 -0
- package/scripts/qa-app/slash_audit.mjs +97 -0
- package/scripts/qa-app/soul_test.mjs +79 -0
- package/scripts/qa-app/task_tool_test.mjs +148 -0
- package/scripts/qa-app/themes_test.mjs +56 -0
- package/scripts/qa-app/tmux_debug.sh +37 -0
- package/scripts/qa-app/tmux_minimal.sh +66 -0
- package/scripts/qa-app/tmux_smoke.sh +119 -0
- package/scripts/qa-app/tokrate_test.mjs +108 -0
- package/scripts/qa-app/tool_registry_test.mjs +118 -0
- package/scripts/qa-app/tools_smoke.mjs +90 -0
- package/scripts/qa-app/transport_test.mjs +88 -0
- package/scripts/qa-app/undo_test.mjs +136 -0
- package/scripts/qa-app/update_test.mjs +94 -0
- package/scripts/test-browser-integration.sh +162 -0
- package/scripts/verify-deps.sh +19 -0
- package/src_v2/README.md +43 -0
- package/src_v2/acp/index.ts +1 -0
- package/src_v2/acp/server.ts +162 -0
- package/src_v2/audit/writer.ts +43 -0
- package/src_v2/auth/keypool.ts +216 -0
- package/src_v2/auth/keystore.ts +43 -0
- package/src_v2/auth/providers.ts +83 -0
- package/src_v2/cli/auth-cmd.ts +78 -0
- package/src_v2/cli/config.ts +130 -0
- package/src_v2/cli/flags.ts +75 -0
- package/src_v2/cli/flows/full-cycle.ts +72 -0
- package/src_v2/cli/flows/index.ts +2 -0
- package/src_v2/cli/flows/tarball.ts +55 -0
- package/src_v2/cli/index.ts +4 -0
- package/src_v2/cli/interactive.ts +307 -0
- package/src_v2/cli/main.ts +486 -0
- package/src_v2/cli/models-cmd.ts +62 -0
- package/src_v2/cli/setup.ts +143 -0
- package/src_v2/cli/slash/account.ts +62 -0
- package/src_v2/cli/slash/clear.ts +17 -0
- package/src_v2/cli/slash/compact.ts +15 -0
- package/src_v2/cli/slash/config.ts +53 -0
- package/src_v2/cli/slash/exit.ts +18 -0
- package/src_v2/cli/slash/fleet.ts +52 -0
- package/src_v2/cli/slash/help.ts +35 -0
- package/src_v2/cli/slash/history.ts +41 -0
- package/src_v2/cli/slash/index.ts +79 -0
- package/src_v2/cli/slash/init.ts +62 -0
- package/src_v2/cli/slash/keys.ts +102 -0
- package/src_v2/cli/slash/login.ts +55 -0
- package/src_v2/cli/slash/memory.ts +102 -0
- package/src_v2/cli/slash/mode.ts +32 -0
- package/src_v2/cli/slash/models.ts +79 -0
- package/src_v2/cli/slash/resume.ts +26 -0
- package/src_v2/cli/slash/session.ts +73 -0
- package/src_v2/cli/slash/setup.ts +48 -0
- package/src_v2/cli/slash/status.ts +38 -0
- package/src_v2/cli/slash/theme.ts +54 -0
- package/src_v2/cli/slash/types.ts +16 -0
- package/src_v2/cli/slash/upgrade.ts +73 -0
- package/src_v2/cli/slash.ts +128 -0
- package/src_v2/cli/subcommands/ask.ts +83 -0
- package/src_v2/cli/subcommands/audit-codebase.ts +161 -0
- package/src_v2/cli/subcommands/audit.ts +152 -0
- package/src_v2/cli/subcommands/chat.ts +72 -0
- package/src_v2/cli/subcommands/compact.ts +110 -0
- package/src_v2/cli/subcommands/cost.ts +157 -0
- package/src_v2/cli/subcommands/doctor.ts +121 -0
- package/src_v2/cli/subcommands/export-session.ts +63 -0
- package/src_v2/cli/subcommands/import-session.ts +87 -0
- package/src_v2/cli/subcommands/index.ts +99 -0
- package/src_v2/cli/subcommands/init.ts +78 -0
- package/src_v2/cli/subcommands/kb.ts +151 -0
- package/src_v2/cli/subcommands/keys.ts +197 -0
- package/src_v2/cli/subcommands/ledger.ts +118 -0
- package/src_v2/cli/subcommands/login.ts +149 -0
- package/src_v2/cli/subcommands/logout.ts +24 -0
- package/src_v2/cli/subcommands/memory.ts +124 -0
- package/src_v2/cli/subcommands/models.ts +210 -0
- package/src_v2/cli/subcommands/resume.ts +142 -0
- package/src_v2/cli/subcommands/setup.ts +111 -0
- package/src_v2/cli/subcommands/skills.ts +190 -0
- package/src_v2/cli/subcommands/stats.ts +151 -0
- package/src_v2/cli/subcommands/status.ts +101 -0
- package/src_v2/cli/subcommands/undo.ts +139 -0
- package/src_v2/cli/subcommands/update.ts +219 -0
- package/src_v2/cli/subcommands/verify.ts +147 -0
- package/src_v2/cli/submit-paper.ts +94 -0
- package/src_v2/context/_fts.ts +251 -0
- package/src_v2/context/branch.ts +86 -0
- package/src_v2/context/compaction.ts +199 -0
- package/src_v2/context/default-soul.md +36 -0
- package/src_v2/context/git-state.ts +78 -0
- package/src_v2/context/index.ts +5 -0
- package/src_v2/context/knowledge.ts +181 -0
- package/src_v2/context/ledger.ts +197 -0
- package/src_v2/context/memory.ts +337 -0
- package/src_v2/context/mode-enforcement.ts +87 -0
- package/src_v2/context/mode.ts +97 -0
- package/src_v2/context/primer.ts +88 -0
- package/src_v2/context/session.ts +115 -0
- package/src_v2/context/soul.ts +72 -0
- package/src_v2/daemon/index.ts +2 -0
- package/src_v2/daemon/protocol.ts +62 -0
- package/src_v2/daemon/server.ts +228 -0
- package/src_v2/eval/index.ts +5 -0
- package/src_v2/eval/regression.ts +116 -0
- package/src_v2/eval/reporter.ts +35 -0
- package/src_v2/eval/swe-bench.ts +32 -0
- package/src_v2/eval/terminal-bench.ts +27 -0
- package/src_v2/eval/types.ts +31 -0
- package/src_v2/extensions/api.ts +144 -0
- package/src_v2/fleet/apply-back.ts +210 -0
- package/src_v2/fleet/cli-command.ts +423 -0
- package/src_v2/fleet/index.ts +37 -0
- package/src_v2/fleet/runner.ts +412 -0
- package/src_v2/fleet/tripleshot.ts +282 -0
- package/src_v2/fleet/types.ts +210 -0
- package/src_v2/fleet/worktree.ts +189 -0
- package/src_v2/hooks/config-bridge.ts +116 -0
- package/src_v2/hooks/index.ts +1 -0
- package/src_v2/hooks/registry.ts +57 -0
- package/src_v2/index.ts +51 -0
- package/src_v2/integrations/arniko-client.ts +108 -0
- package/src_v2/integrations/auth.ts +90 -0
- package/src_v2/integrations/billing.ts +184 -0
- package/src_v2/integrations/bucky-client.ts +93 -0
- package/src_v2/integrations/deploy-client.ts +113 -0
- package/src_v2/integrations/device-auth.ts +224 -0
- package/src_v2/integrations/entitlements.ts +80 -0
- package/src_v2/integrations/http.ts +111 -0
- package/src_v2/integrations/index.ts +17 -0
- package/src_v2/intelligence/cost.ts +80 -0
- package/src_v2/intelligence/error-classifier.ts +76 -0
- package/src_v2/intelligence/index.ts +5 -0
- package/src_v2/intelligence/models-refresh.ts +105 -0
- package/src_v2/intelligence/prices.ts +292 -0
- package/src_v2/intelligence/smart-router.ts +75 -0
- package/src_v2/intelligence/telemetry.ts +50 -0
- package/src_v2/kernel/agent-loop.ts +207 -0
- package/src_v2/kernel/event-stream.ts +122 -0
- package/src_v2/kernel/index.ts +4 -0
- package/src_v2/kernel/message.ts +130 -0
- package/src_v2/kernel/types.ts +175 -0
- package/src_v2/mcp/client.ts +132 -0
- package/src_v2/mcp/index.ts +3 -0
- package/src_v2/mcp/loader.ts +76 -0
- package/src_v2/mcp/tool-bridge.ts +42 -0
- package/src_v2/mcp/transport.ts +217 -0
- package/src_v2/parity/index.ts +3 -0
- package/src_v2/parity/mock-openai-compat.ts +49 -0
- package/src_v2/parity/runner.ts +95 -0
- package/src_v2/parity/scenarios.ts +85 -0
- package/src_v2/providers/anthropic.ts +196 -0
- package/src_v2/providers/define-openai-compat.ts +107 -0
- package/src_v2/providers/dispatch.ts +65 -0
- package/src_v2/providers/fireworks.ts +51 -0
- package/src_v2/providers/gemini.ts +184 -0
- package/src_v2/providers/http.ts +201 -0
- package/src_v2/providers/iface.ts +31 -0
- package/src_v2/providers/index.ts +63 -0
- package/src_v2/providers/nvidia.ts +170 -0
- package/src_v2/providers/ollama.ts +45 -0
- package/src_v2/providers/openai-compat.ts +313 -0
- package/src_v2/providers/openai.ts +124 -0
- package/src_v2/providers/openrouter.ts +83 -0
- package/src_v2/providers/presets.ts +90 -0
- package/src_v2/providers/rate-limiter.ts +103 -0
- package/src_v2/safety/approval-bus.ts +65 -0
- package/src_v2/safety/audit-log.ts +100 -0
- package/src_v2/safety/index.ts +4 -0
- package/src_v2/safety/policy.ts +150 -0
- package/src_v2/safety/sandbox/bwrap.ts +51 -0
- package/src_v2/safety/sandbox/iface.ts +33 -0
- package/src_v2/safety/sandbox/index.ts +7 -0
- package/src_v2/safety/sandbox/landlock.ts +29 -0
- package/src_v2/safety/sandbox/noop.ts +60 -0
- package/src_v2/safety/sandbox/seatbelt.ts +53 -0
- package/src_v2/safety/sandbox/select.ts +37 -0
- package/src_v2/safety/sandbox/windows.ts +26 -0
- package/src_v2/security/skill-scanner.ts +167 -0
- package/src_v2/skills/index.ts +3 -0
- package/src_v2/skills/loader.ts +150 -0
- package/src_v2/skills/matcher.ts +66 -0
- package/src_v2/skills/runtime.ts +47 -0
- package/src_v2/subagents/delegator.ts +116 -0
- package/src_v2/subagents/index.ts +2 -0
- package/src_v2/subagents/pool.ts +41 -0
- package/src_v2/tools/browser.ts +249 -0
- package/src_v2/tools/checkpoint.ts +278 -0
- package/src_v2/tools/cron.ts +191 -0
- package/src_v2/tools/diff.ts +109 -0
- package/src_v2/tools/exec.ts +62 -0
- package/src_v2/tools/fs-edit.ts +96 -0
- package/src_v2/tools/fs-ls.ts +64 -0
- package/src_v2/tools/fs-read.ts +70 -0
- package/src_v2/tools/fs-write.ts +57 -0
- package/src_v2/tools/git.ts +78 -0
- package/src_v2/tools/index.ts +56 -0
- package/src_v2/tools/multimodal.ts +492 -0
- package/src_v2/tools/permission.ts +56 -0
- package/src_v2/tools/registry.ts +97 -0
- package/src_v2/tools/search-glob.ts +97 -0
- package/src_v2/tools/search-grep.ts +116 -0
- package/src_v2/tools/shell.ts +97 -0
- package/src_v2/tools/task.ts +49 -0
- package/src_v2/tui/approval.ts +57 -0
- package/src_v2/tui/index.ts +4 -0
- package/src_v2/tui/ink/App.tsx +439 -0
- package/src_v2/tui/ink/components/AtFileComplete.tsx +183 -0
- package/src_v2/tui/ink/components/HelpOverlay.tsx +181 -0
- package/src_v2/tui/ink/components/InputBox.tsx +199 -0
- package/src_v2/tui/ink/components/Logo.tsx +77 -0
- package/src_v2/tui/ink/components/ModelPicker.tsx +148 -0
- package/src_v2/tui/ink/components/PasteCollapse.tsx +98 -0
- package/src_v2/tui/ink/components/StatusBar.tsx +98 -0
- package/src_v2/tui/ink/components/StreamingText.tsx +30 -0
- package/src_v2/tui/ink/components/ThinkingBlock.tsx +39 -0
- package/src_v2/tui/ink/components/ToolBox.tsx +95 -0
- package/src_v2/tui/ink/components/vim-bindings.ts +150 -0
- package/src_v2/tui/ink/index.ts +69 -0
- package/src_v2/tui/ink/use-event-projection.ts +161 -0
- package/src_v2/tui/ink/use-overlays.ts +69 -0
- package/src_v2/tui/renderer.ts +112 -0
- package/src_v2/tui/status-bar.ts +25 -0
- package/src_v2/tui/theme-loader.ts +68 -0
- package/src_v2/tui/theme.ts +81 -0
- package/src_v2/utils/json-repair.ts +47 -0
- package/tsconfig.tsbuildinfo +1 -0
- package/tsconfig.v2.json +27 -0
|
@@ -14,7 +14,9 @@ import { mkdir, readFile, writeFile } from 'node:fs/promises';
|
|
|
14
14
|
import { homedir } from 'node:os';
|
|
15
15
|
import { join } from 'node:path';
|
|
16
16
|
import { stdout, stderr } from 'node:process';
|
|
17
|
-
import { PRICES } from '../../intelligence/prices.js';
|
|
17
|
+
import { PRICES, contextWindowFor } from '../../intelligence/prices.js';
|
|
18
|
+
import { refreshAllModels, readCache, writeCache, isCacheFresh } from '../../intelligence/models-refresh.js';
|
|
19
|
+
import { listProviders } from '../../auth/providers.js';
|
|
18
20
|
import { style, defaultTheme } from '../../tui/theme.js';
|
|
19
21
|
const PROVIDER_ENV = {
|
|
20
22
|
anthropic: 'ANTHROPIC_API_KEY',
|
|
@@ -99,10 +101,26 @@ function runInfo(id) {
|
|
|
99
101
|
for (const row of all) {
|
|
100
102
|
stdout.write(`\n${style(defaultTheme.accent, row.model)}\n`);
|
|
101
103
|
stdout.write(` provider ${row.provider}\n`);
|
|
104
|
+
if (row.family)
|
|
105
|
+
stdout.write(` family ${row.family}\n`);
|
|
106
|
+
// Context window comes from the per-row override OR the canonical
|
|
107
|
+
// CONTEXT_WINDOWS map (in prices.ts) — `contextWindowFor` handles
|
|
108
|
+
// both, falls back to DEFAULT_CONTEXT_WINDOW only when neither has
|
|
109
|
+
// an entry. Surfacing it always so the user always knows the cap.
|
|
110
|
+
stdout.write(` context ${contextWindowFor(row.model).toLocaleString()} tokens\n`);
|
|
111
|
+
if (row.maxOutput !== undefined) {
|
|
112
|
+
stdout.write(` max output ${row.maxOutput.toLocaleString()} tokens\n`);
|
|
113
|
+
}
|
|
102
114
|
stdout.write(` input / M ${priceText(row.inputPerM)}\n`);
|
|
103
115
|
stdout.write(` output / M ${priceText(row.outputPerM)}\n`);
|
|
104
116
|
if (row.cachedInputPerM !== undefined)
|
|
105
117
|
stdout.write(` cached in / M $${row.cachedInputPerM.toFixed(2)}\n`);
|
|
118
|
+
if (row.supportsTools !== undefined) {
|
|
119
|
+
stdout.write(` tools ${row.supportsTools ? 'yes' : 'no'}\n`);
|
|
120
|
+
}
|
|
121
|
+
if (row.supportsThinking !== undefined) {
|
|
122
|
+
stdout.write(` thinking ${row.supportsThinking ? 'yes' : 'no'}\n`);
|
|
123
|
+
}
|
|
106
124
|
const env = PROVIDER_ENV[row.provider] ?? '';
|
|
107
125
|
const marker = configured(row.provider) ? 'configured' : env ? `set ${env} to enable` : 'no key required';
|
|
108
126
|
stdout.write(` configured? ${marker}\n`);
|
|
@@ -118,11 +136,64 @@ function usage() {
|
|
|
118
136
|
' dirgha models info <modelId>',
|
|
119
137
|
].join('\n');
|
|
120
138
|
}
|
|
139
|
+
const CACHE_PATH = join(homedir(), '.dirgha', 'models-cache.json');
|
|
140
|
+
const CACHE_TTL_MS = 24 * 60 * 60 * 1000;
|
|
141
|
+
async function runRefresh(jsonOut) {
|
|
142
|
+
const targets = listProviders().map(p => ({
|
|
143
|
+
name: p.id,
|
|
144
|
+
baseUrl: p.baseUrl ?? '',
|
|
145
|
+
apiKey: process.env[p.envVars[0]],
|
|
146
|
+
})).filter(t => t.baseUrl && t.apiKey);
|
|
147
|
+
if (targets.length === 0) {
|
|
148
|
+
stderr.write(style(defaultTheme.muted, '(no provider keys present in env / pool — set at least one with `dirgha login --provider=...`)\n'));
|
|
149
|
+
return 1;
|
|
150
|
+
}
|
|
151
|
+
stdout.write(style(defaultTheme.muted, `fetching ${targets.length} provider${targets.length === 1 ? '' : 's'} in parallel…\n`));
|
|
152
|
+
const cache = await refreshAllModels({ providers: targets });
|
|
153
|
+
await mkdir(join(homedir(), '.dirgha'), { recursive: true });
|
|
154
|
+
await writeCache(CACHE_PATH, cache);
|
|
155
|
+
if (jsonOut) {
|
|
156
|
+
stdout.write(`${JSON.stringify(cache)}\n`);
|
|
157
|
+
return 0;
|
|
158
|
+
}
|
|
159
|
+
stdout.write(style(defaultTheme.accent, `\n${cache.totalModels} models across ${cache.providers.length} providers\n`));
|
|
160
|
+
for (const p of cache.providers) {
|
|
161
|
+
const tag = p.error ? style(defaultTheme.danger, `error: ${p.error}`) : style(defaultTheme.success, `${p.models.length} models`);
|
|
162
|
+
stdout.write(` ${p.name.padEnd(14)} ${tag}\n`);
|
|
163
|
+
}
|
|
164
|
+
stdout.write(style(defaultTheme.muted, `\ncached at ${CACHE_PATH}\n`));
|
|
165
|
+
return 0;
|
|
166
|
+
}
|
|
167
|
+
async function runCacheShow(jsonOut) {
|
|
168
|
+
const cache = await readCache(CACHE_PATH);
|
|
169
|
+
if (!cache) {
|
|
170
|
+
stderr.write(style(defaultTheme.muted, '(no cache yet — run `dirgha models refresh`)\n'));
|
|
171
|
+
return 1;
|
|
172
|
+
}
|
|
173
|
+
const fresh = isCacheFresh(cache, CACHE_TTL_MS);
|
|
174
|
+
if (jsonOut) {
|
|
175
|
+
stdout.write(`${JSON.stringify({ ...cache, fresh })}\n`);
|
|
176
|
+
return 0;
|
|
177
|
+
}
|
|
178
|
+
stdout.write(style(defaultTheme.accent, `Models cache (${fresh ? 'fresh' : 'stale, refresh recommended'})\n`));
|
|
179
|
+
stdout.write(style(defaultTheme.muted, `fetched: ${cache.fetchedAt}\n`));
|
|
180
|
+
for (const p of cache.providers) {
|
|
181
|
+
const head = ` ${p.name.padEnd(14)}`;
|
|
182
|
+
if (p.error) {
|
|
183
|
+
stdout.write(`${head} ${style(defaultTheme.danger, p.error)}\n`);
|
|
184
|
+
continue;
|
|
185
|
+
}
|
|
186
|
+
stdout.write(`${head} ${p.models.length} models\n`);
|
|
187
|
+
}
|
|
188
|
+
return 0;
|
|
189
|
+
}
|
|
121
190
|
export const modelsSubcommand = {
|
|
122
191
|
name: 'models',
|
|
123
|
-
description: 'List, inspect, and
|
|
192
|
+
description: 'List, inspect, and refresh the live model catalogue',
|
|
124
193
|
async run(argv) {
|
|
125
|
-
const
|
|
194
|
+
const json = argv.includes('--json');
|
|
195
|
+
const args = argv.filter(a => a !== '--json');
|
|
196
|
+
const [op, arg] = args;
|
|
126
197
|
if (!op || op === 'list')
|
|
127
198
|
return runList();
|
|
128
199
|
if (op === 'default')
|
|
@@ -134,6 +205,10 @@ export const modelsSubcommand = {
|
|
|
134
205
|
}
|
|
135
206
|
return runInfo(arg);
|
|
136
207
|
}
|
|
208
|
+
if (op === 'refresh')
|
|
209
|
+
return runRefresh(json);
|
|
210
|
+
if (op === 'cache')
|
|
211
|
+
return runCacheShow(json);
|
|
137
212
|
// Single bare model id? treat it as a shorthand for `info <id>`.
|
|
138
213
|
if (!arg && PRICES.some(p => p.model === op))
|
|
139
214
|
return runInfo(op);
|
|
@@ -141,4 +216,6 @@ export const modelsSubcommand = {
|
|
|
141
216
|
return 1;
|
|
142
217
|
},
|
|
143
218
|
};
|
|
219
|
+
// Type assertion to silence ModelsCache import (kept for external consumers).
|
|
220
|
+
void {};
|
|
144
221
|
//# sourceMappingURL=models.js.map
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `dirgha resume <session-id> [prompt...]` — reopen a previously saved
|
|
3
|
+
* session and run a new turn against its history. Without a prompt
|
|
4
|
+
* argument it prints the session's message count + last assistant turn
|
|
5
|
+
* so users can decide whether to continue.
|
|
6
|
+
*
|
|
7
|
+
* Pairs with `dirgha export-session` / `import-session`. Persistence
|
|
8
|
+
* lives in `~/.dirgha/sessions/<id>.jsonl`.
|
|
9
|
+
*/
|
|
10
|
+
import type { Subcommand } from './index.js';
|
|
11
|
+
export declare const resumeSubcommand: Subcommand;
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `dirgha resume <session-id> [prompt...]` — reopen a previously saved
|
|
3
|
+
* session and run a new turn against its history. Without a prompt
|
|
4
|
+
* argument it prints the session's message count + last assistant turn
|
|
5
|
+
* so users can decide whether to continue.
|
|
6
|
+
*
|
|
7
|
+
* Pairs with `dirgha export-session` / `import-session`. Persistence
|
|
8
|
+
* lives in `~/.dirgha/sessions/<id>.jsonl`.
|
|
9
|
+
*/
|
|
10
|
+
import { stdout, stderr } from 'node:process';
|
|
11
|
+
import { runAgentLoop } from '../../kernel/agent-loop.js';
|
|
12
|
+
import { createEventStream } from '../../kernel/event-stream.js';
|
|
13
|
+
import { ProviderRegistry } from '../../providers/index.js';
|
|
14
|
+
import { builtInTools, createToolExecutor, createToolRegistry } from '../../tools/index.js';
|
|
15
|
+
import { renderStreamingEvents } from '../../tui/renderer.js';
|
|
16
|
+
import { createSessionStore } from '../../context/session.js';
|
|
17
|
+
import { contextWindowFor, findPrice, resolveModelAlias } from '../../intelligence/prices.js';
|
|
18
|
+
import { routeModel } from '../../providers/dispatch.js';
|
|
19
|
+
import { maybeCompact } from '../../context/compaction.js';
|
|
20
|
+
import { appendAudit } from '../../audit/writer.js';
|
|
21
|
+
import { loadConfig } from '../config.js';
|
|
22
|
+
import { parseFlags } from '../flags.js';
|
|
23
|
+
import { style, defaultTheme } from '../../tui/theme.js';
|
|
24
|
+
export const resumeSubcommand = {
|
|
25
|
+
name: 'resume',
|
|
26
|
+
description: 'Reopen a saved session and continue (dirgha resume <id> [prompt])',
|
|
27
|
+
async run(argv) {
|
|
28
|
+
const { flags, positionals } = parseFlags(argv);
|
|
29
|
+
const sessionId = positionals[0];
|
|
30
|
+
if (!sessionId) {
|
|
31
|
+
stderr.write('usage: dirgha resume <session-id> [new prompt]\n');
|
|
32
|
+
stderr.write(' Find ids via `dirgha stats` (counts) or `ls ~/.dirgha/sessions/`.\n');
|
|
33
|
+
return 2;
|
|
34
|
+
}
|
|
35
|
+
const newPrompt = positionals.slice(1).join(' ').trim();
|
|
36
|
+
const json = flags.json === true;
|
|
37
|
+
const sessions = createSessionStore();
|
|
38
|
+
const session = await sessions.open(sessionId);
|
|
39
|
+
if (!session) {
|
|
40
|
+
stderr.write(`Session ${sessionId} not found in ~/.dirgha/sessions/\n`);
|
|
41
|
+
return 1;
|
|
42
|
+
}
|
|
43
|
+
const history = await session.messages();
|
|
44
|
+
if (history.length === 0) {
|
|
45
|
+
stderr.write(`Session ${sessionId} is empty.\n`);
|
|
46
|
+
return 1;
|
|
47
|
+
}
|
|
48
|
+
if (!newPrompt) {
|
|
49
|
+
// Inspect-only mode: summarise what the session has.
|
|
50
|
+
const lastAssistant = [...history].reverse().find(m => m.role === 'assistant');
|
|
51
|
+
stdout.write(style(defaultTheme.accent, `\nResume session ${sessionId}\n`));
|
|
52
|
+
stdout.write(` ${history.length} message${history.length === 1 ? '' : 's'} on disk\n`);
|
|
53
|
+
if (lastAssistant) {
|
|
54
|
+
const text = typeof lastAssistant.content === 'string'
|
|
55
|
+
? lastAssistant.content
|
|
56
|
+
: lastAssistant.content.map(p => p.type === 'text' ? p.text : '').join('').trim();
|
|
57
|
+
stdout.write(style(defaultTheme.muted, ` last assistant: ${text.slice(0, 200)}${text.length > 200 ? '…' : ''}\n`));
|
|
58
|
+
}
|
|
59
|
+
stdout.write(`\nPass a prompt as the next argument to continue:\n dirgha resume ${sessionId} "<your next prompt>"\n`);
|
|
60
|
+
return 0;
|
|
61
|
+
}
|
|
62
|
+
// Run a new turn on top of the existing history.
|
|
63
|
+
const config = await loadConfig();
|
|
64
|
+
const rawModel = typeof flags.model === 'string' ? flags.model : (typeof flags.m === 'string' ? flags.m : config.model);
|
|
65
|
+
const model = resolveModelAlias(rawModel);
|
|
66
|
+
const maxTurns = typeof flags['max-turns'] === 'string' ? Number.parseInt(flags['max-turns'], 10) : config.maxTurns;
|
|
67
|
+
const events = createEventStream();
|
|
68
|
+
if (json)
|
|
69
|
+
events.subscribe(ev => { stdout.write(`${JSON.stringify(ev)}\n`); });
|
|
70
|
+
else
|
|
71
|
+
events.subscribe(renderStreamingEvents({ showThinking: config.showThinking }));
|
|
72
|
+
const providers = new ProviderRegistry();
|
|
73
|
+
const provider = providers.forModel(model);
|
|
74
|
+
const registry = createToolRegistry(builtInTools);
|
|
75
|
+
const sanitized = registry.sanitize({ descriptionLimit: 200 });
|
|
76
|
+
const executor = createToolExecutor({ registry, cwd: process.cwd(), sessionId });
|
|
77
|
+
// Cost + audit subscribers — same shape as one-shot in main.ts.
|
|
78
|
+
const providerId = routeModel(model);
|
|
79
|
+
const price = findPrice(providerId, model);
|
|
80
|
+
const computeCost = (i, o, c) => price
|
|
81
|
+
? (i / 1_000_000) * price.inputPerM + (o / 1_000_000) * price.outputPerM + (c / 1_000_000) * (price.cachedInputPerM ?? 0)
|
|
82
|
+
: 0;
|
|
83
|
+
events.subscribe(async (ev) => {
|
|
84
|
+
try {
|
|
85
|
+
if (ev.type === 'usage') {
|
|
86
|
+
const cached = ev.cachedTokens ?? 0;
|
|
87
|
+
await session.append({ type: 'usage', ts: new Date().toISOString(), usage: {
|
|
88
|
+
inputTokens: ev.inputTokens, outputTokens: ev.outputTokens, cachedTokens: cached, costUsd: computeCost(ev.inputTokens, ev.outputTokens, cached),
|
|
89
|
+
} });
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
catch { /* swallow */ }
|
|
93
|
+
});
|
|
94
|
+
events.subscribe(ev => {
|
|
95
|
+
if (ev.type === 'tool_exec_end') {
|
|
96
|
+
void appendAudit({ kind: 'tool', actor: sessionId, summary: `${ev.id} ${ev.isError ? 'error' : 'done'} ${ev.durationMs}ms` });
|
|
97
|
+
}
|
|
98
|
+
else if (ev.type === 'agent_end') {
|
|
99
|
+
void appendAudit({ kind: 'turn-end', actor: sessionId, summary: `model=${model} stop=${ev.stopReason} in=${ev.usage.inputTokens} out=${ev.usage.outputTokens}` });
|
|
100
|
+
}
|
|
101
|
+
else if (ev.type === 'error') {
|
|
102
|
+
void appendAudit({ kind: 'error', actor: sessionId, summary: ev.message });
|
|
103
|
+
}
|
|
104
|
+
});
|
|
105
|
+
// Append the new user message to disk first so a crash mid-turn
|
|
106
|
+
// still leaves a recoverable transcript.
|
|
107
|
+
await session.append({ type: 'message', ts: new Date().toISOString(), message: { role: 'user', content: newPrompt } });
|
|
108
|
+
history.push({ role: 'user', content: newPrompt });
|
|
109
|
+
const messages = [...history];
|
|
110
|
+
const result = await runAgentLoop({
|
|
111
|
+
sessionId,
|
|
112
|
+
model,
|
|
113
|
+
messages,
|
|
114
|
+
tools: sanitized.definitions,
|
|
115
|
+
maxTurns,
|
|
116
|
+
provider,
|
|
117
|
+
toolExecutor: executor,
|
|
118
|
+
events,
|
|
119
|
+
contextTransform: async (msgs) => (await maybeCompact(msgs, {
|
|
120
|
+
triggerTokens: Math.floor(contextWindowFor(model) * 0.75),
|
|
121
|
+
preserveLastTurns: config.compaction.preserveLastTurns,
|
|
122
|
+
summarizer: provider,
|
|
123
|
+
summaryModel: config.summaryModel,
|
|
124
|
+
}, session)).messages,
|
|
125
|
+
});
|
|
126
|
+
// Persist the new turn's outputs (everything past the prior history).
|
|
127
|
+
for (const msg of result.messages.slice(history.length)) {
|
|
128
|
+
try {
|
|
129
|
+
await session.append({ type: 'message', ts: new Date().toISOString(), message: msg });
|
|
130
|
+
}
|
|
131
|
+
catch { /* swallow */ }
|
|
132
|
+
}
|
|
133
|
+
if (!json)
|
|
134
|
+
stdout.write('\n');
|
|
135
|
+
return result.stopReason === 'error' ? 2 : 0;
|
|
136
|
+
},
|
|
137
|
+
};
|
|
138
|
+
//# sourceMappingURL=resume.js.map
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `dirgha skills <list|show|where>` — inspect loadable behaviour packs.
|
|
3
|
+
*
|
|
4
|
+
* Skills are markdown files with YAML frontmatter at:
|
|
5
|
+
* 1. <cwd>/.dirgha/skills/<name>/SKILL.md (project-local)
|
|
6
|
+
* 2. ~/.dirgha/skills/<name>/SKILL.md (user-global)
|
|
7
|
+
* 3. node_modules/dirgha-skill-* package roots (npm-distributed, opt-in)
|
|
8
|
+
*
|
|
9
|
+
* Project skills override user skills with the same name.
|
|
10
|
+
*
|
|
11
|
+
* Frontmatter keys: name, description, version?, platforms?, triggers?, related?
|
|
12
|
+
*/
|
|
13
|
+
import type { Subcommand } from './index.js';
|
|
14
|
+
export declare const skillsSubcommand: Subcommand;
|
|
@@ -0,0 +1,207 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `dirgha skills <list|show|where>` — inspect loadable behaviour packs.
|
|
3
|
+
*
|
|
4
|
+
* Skills are markdown files with YAML frontmatter at:
|
|
5
|
+
* 1. <cwd>/.dirgha/skills/<name>/SKILL.md (project-local)
|
|
6
|
+
* 2. ~/.dirgha/skills/<name>/SKILL.md (user-global)
|
|
7
|
+
* 3. node_modules/dirgha-skill-* package roots (npm-distributed, opt-in)
|
|
8
|
+
*
|
|
9
|
+
* Project skills override user skills with the same name.
|
|
10
|
+
*
|
|
11
|
+
* Frontmatter keys: name, description, version?, platforms?, triggers?, related?
|
|
12
|
+
*/
|
|
13
|
+
import { stdout, stderr } from 'node:process';
|
|
14
|
+
import { execFileSync } from 'node:child_process';
|
|
15
|
+
import { mkdir, rm, stat } from 'node:fs/promises';
|
|
16
|
+
import { homedir } from 'node:os';
|
|
17
|
+
import { join, basename } from 'node:path';
|
|
18
|
+
import { loadSkills } from '../../skills/loader.js';
|
|
19
|
+
import { scanSkillBody, summariseScan } from '../../security/skill-scanner.js';
|
|
20
|
+
import { appendAudit } from '../../audit/writer.js';
|
|
21
|
+
import { style, defaultTheme } from '../../tui/theme.js';
|
|
22
|
+
const HELP = [
|
|
23
|
+
'Usage:',
|
|
24
|
+
' dirgha skills List loaded skills',
|
|
25
|
+
' dirgha skills list Same as above',
|
|
26
|
+
' dirgha skills show <name> Print one skill\'s body',
|
|
27
|
+
' dirgha skills where Show search roots',
|
|
28
|
+
' dirgha skills install <git-url> [name] Clone a remote skill pack (scanned before install)',
|
|
29
|
+
' dirgha skills uninstall <name> Remove a user-global skill directory',
|
|
30
|
+
' dirgha skills audit [name] Re-scan installed skills for prompt-injection / supply-chain risk',
|
|
31
|
+
].join('\n');
|
|
32
|
+
function userSkillsDir() {
|
|
33
|
+
return join(homedir(), '.dirgha', 'skills');
|
|
34
|
+
}
|
|
35
|
+
function deriveName(url) {
|
|
36
|
+
const last = url.split('/').filter(Boolean).pop() ?? 'skill';
|
|
37
|
+
return last.replace(/\.git$/, '').replace(/[^a-zA-Z0-9_-]/g, '-');
|
|
38
|
+
}
|
|
39
|
+
async function dirExists(p) {
|
|
40
|
+
return stat(p).then(s => s.isDirectory()).catch(() => false);
|
|
41
|
+
}
|
|
42
|
+
export const skillsSubcommand = {
|
|
43
|
+
name: 'skills',
|
|
44
|
+
description: 'List or inspect loadable skills',
|
|
45
|
+
async run(argv) {
|
|
46
|
+
const op = argv[0] ?? 'list';
|
|
47
|
+
if (op === 'help' || op === '-h' || op === '--help') {
|
|
48
|
+
stdout.write(HELP + '\n');
|
|
49
|
+
return 0;
|
|
50
|
+
}
|
|
51
|
+
if (op === 'where') {
|
|
52
|
+
stdout.write(style(defaultTheme.accent, '\nSkill search roots\n\n'));
|
|
53
|
+
stdout.write(` project ${process.cwd()}/.dirgha/skills\n`);
|
|
54
|
+
stdout.write(` user ~/.dirgha/skills\n`);
|
|
55
|
+
stdout.write(` package node_modules/dirgha-skill-* (opt-in)\n`);
|
|
56
|
+
return 0;
|
|
57
|
+
}
|
|
58
|
+
const skills = await loadSkills({ cwd: process.cwd() });
|
|
59
|
+
if (op === 'list') {
|
|
60
|
+
if (skills.length === 0) {
|
|
61
|
+
stdout.write(style(defaultTheme.muted, '(no skills loaded — drop a SKILL.md into ~/.dirgha/skills/<name>/)\n'));
|
|
62
|
+
return 0;
|
|
63
|
+
}
|
|
64
|
+
stdout.write(style(defaultTheme.accent, '\nDirgha skills\n\n'));
|
|
65
|
+
const padN = Math.max(...skills.map(s => s.meta.name.length));
|
|
66
|
+
for (const s of skills) {
|
|
67
|
+
const triggers = s.meta.triggers
|
|
68
|
+
? `[${(s.meta.triggers.keywords ?? []).join(',') || (s.meta.triggers.filePatterns ?? []).join(',') || 'ambient'}]`
|
|
69
|
+
: '[ambient]';
|
|
70
|
+
stdout.write(` ${s.meta.name.padEnd(padN)} ${style(defaultTheme.muted, s.source.padEnd(8))} ${style(defaultTheme.muted, triggers)}\n`);
|
|
71
|
+
stdout.write(` ${' '.repeat(padN)} ${style(defaultTheme.muted, s.meta.description)}\n`);
|
|
72
|
+
}
|
|
73
|
+
stdout.write('\n');
|
|
74
|
+
stdout.write(style(defaultTheme.muted, ` ${skills.length} skill${skills.length === 1 ? '' : 's'} loaded\n`));
|
|
75
|
+
return 0;
|
|
76
|
+
}
|
|
77
|
+
if (op === 'show') {
|
|
78
|
+
const name = argv[1];
|
|
79
|
+
if (!name) {
|
|
80
|
+
stderr.write(`Missing name.\n${HELP}\n`);
|
|
81
|
+
return 2;
|
|
82
|
+
}
|
|
83
|
+
const hit = skills.find(s => s.meta.name === name);
|
|
84
|
+
if (!hit) {
|
|
85
|
+
stderr.write(`Skill "${name}" not found. List with: dirgha skills\n`);
|
|
86
|
+
return 1;
|
|
87
|
+
}
|
|
88
|
+
stdout.write(`# ${hit.meta.name}\n`);
|
|
89
|
+
stdout.write(`description: ${hit.meta.description}\n`);
|
|
90
|
+
if (hit.meta.version)
|
|
91
|
+
stdout.write(`version: ${hit.meta.version}\n`);
|
|
92
|
+
if (hit.meta.platforms)
|
|
93
|
+
stdout.write(`platforms: ${hit.meta.platforms.join(', ')}\n`);
|
|
94
|
+
if (hit.meta.triggers)
|
|
95
|
+
stdout.write(`triggers: ${JSON.stringify(hit.meta.triggers)}\n`);
|
|
96
|
+
stdout.write(`source: ${hit.source}\n`);
|
|
97
|
+
stdout.write(`path: ${hit.path}\n\n`);
|
|
98
|
+
stdout.write(hit.body);
|
|
99
|
+
stdout.write('\n');
|
|
100
|
+
return 0;
|
|
101
|
+
}
|
|
102
|
+
if (op === 'install') {
|
|
103
|
+
const url = argv[1];
|
|
104
|
+
if (!url) {
|
|
105
|
+
stderr.write(`Missing git URL.\n${HELP}\n`);
|
|
106
|
+
return 2;
|
|
107
|
+
}
|
|
108
|
+
// Defense in depth: even though we use the array form of execFile,
|
|
109
|
+
// reject URLs that begin with `-` so a misconfigured caller (or
|
|
110
|
+
// shell-substituted argument) can't smuggle a flag like
|
|
111
|
+
// `--upload-pack=...` past the validator.
|
|
112
|
+
if (url.startsWith('-')) {
|
|
113
|
+
stderr.write(`Refusing URL that starts with "-": ${url}\n`);
|
|
114
|
+
return 2;
|
|
115
|
+
}
|
|
116
|
+
const name = argv[2] ?? deriveName(url);
|
|
117
|
+
if (!/^[a-zA-Z0-9_-]+$/.test(name)) {
|
|
118
|
+
stderr.write(`Invalid skill name "${name}". Use [a-zA-Z0-9_-]+.\n`);
|
|
119
|
+
return 2;
|
|
120
|
+
}
|
|
121
|
+
const root = userSkillsDir();
|
|
122
|
+
const target = join(root, name);
|
|
123
|
+
await mkdir(root, { recursive: true });
|
|
124
|
+
if (await dirExists(target)) {
|
|
125
|
+
stderr.write(`Skill "${name}" already installed at ${target}. Uninstall first.\n`);
|
|
126
|
+
return 1;
|
|
127
|
+
}
|
|
128
|
+
try {
|
|
129
|
+
execFileSync('git', ['clone', '--depth=1', url, target], { stdio: ['ignore', 'pipe', 'pipe'] });
|
|
130
|
+
}
|
|
131
|
+
catch (err) {
|
|
132
|
+
stderr.write(`git clone failed: ${err instanceof Error ? err.message : String(err)}\n`);
|
|
133
|
+
return 1;
|
|
134
|
+
}
|
|
135
|
+
const reloaded = await loadSkills({ cwd: process.cwd() });
|
|
136
|
+
const found = reloaded.find(s => s.path.startsWith(target));
|
|
137
|
+
if (!found) {
|
|
138
|
+
stderr.write(`Cloned ${url} but no SKILL.md was found inside ${target}. The directory was kept.\n`);
|
|
139
|
+
return 1;
|
|
140
|
+
}
|
|
141
|
+
// Layer-1 prompt-injection / supply-chain scan. Critical findings
|
|
142
|
+
// block the install (we delete the freshly-cloned tree); medium
|
|
143
|
+
// findings install but log a warning to audit.
|
|
144
|
+
const scan = scanSkillBody(found.body, found.meta);
|
|
145
|
+
void appendAudit({ kind: 'skill-scan', actor: name, summary: summariseScan(scan), verdict: scan.verdict, score: scan.score, findings: scan.findings, source: url });
|
|
146
|
+
if (scan.verdict === 'block') {
|
|
147
|
+
stderr.write(style(defaultTheme.danger, `✗ install blocked by skill-scanner: ${summariseScan(scan)}\n`));
|
|
148
|
+
for (const f of scan.findings.slice(0, 5)) {
|
|
149
|
+
stderr.write(` ${f.severity.padEnd(8)} ${f.rule}${f.line ? ` (line ${f.line})` : ''}\n`);
|
|
150
|
+
if (f.snippet)
|
|
151
|
+
stderr.write(style(defaultTheme.muted, ` > ${f.snippet}\n`));
|
|
152
|
+
}
|
|
153
|
+
await rm(target, { recursive: true, force: true });
|
|
154
|
+
stderr.write(style(defaultTheme.muted, `\nThe cloned tree was removed. Re-run with --force-unsafe-install to override (NOT recommended).\n`));
|
|
155
|
+
return 1;
|
|
156
|
+
}
|
|
157
|
+
stdout.write(`${style(defaultTheme.success, '✓')} installed ${found.meta.name} (from ${url}) at ${target}\n`);
|
|
158
|
+
stdout.write(style(defaultTheme.muted, ` description: ${found.meta.description}\n`));
|
|
159
|
+
stdout.write(style(scan.verdict === 'warn' ? defaultTheme.danger : defaultTheme.muted, ` scan: ${summariseScan(scan)}\n`));
|
|
160
|
+
return 0;
|
|
161
|
+
}
|
|
162
|
+
if (op === 'audit') {
|
|
163
|
+
const target = argv[1];
|
|
164
|
+
const skills = await loadSkills({ cwd: process.cwd() });
|
|
165
|
+
const matches = target ? skills.filter(s => s.meta.name === target) : skills;
|
|
166
|
+
if (matches.length === 0) {
|
|
167
|
+
stderr.write(target ? `Skill "${target}" not found.\n` : '(no skills installed)\n');
|
|
168
|
+
return target ? 1 : 0;
|
|
169
|
+
}
|
|
170
|
+
let blocked = 0, warned = 0, allowed = 0;
|
|
171
|
+
for (const s of matches) {
|
|
172
|
+
const scan = scanSkillBody(s.body, s.meta);
|
|
173
|
+
const colour = scan.verdict === 'block' ? defaultTheme.danger : scan.verdict === 'warn' ? defaultTheme.accent : defaultTheme.success;
|
|
174
|
+
stdout.write(`${style(colour, scan.verdict.padEnd(6))} ${s.meta.name.padEnd(24)} ${style(defaultTheme.muted, summariseScan(scan))}\n`);
|
|
175
|
+
if (scan.verdict === 'block')
|
|
176
|
+
blocked++;
|
|
177
|
+
else if (scan.verdict === 'warn')
|
|
178
|
+
warned++;
|
|
179
|
+
else
|
|
180
|
+
allowed++;
|
|
181
|
+
for (const f of scan.findings.slice(0, 3)) {
|
|
182
|
+
stdout.write(` ${style(defaultTheme.muted, `${f.severity.padEnd(8)} ${f.rule}${f.line ? ` (line ${f.line})` : ''}`)}\n`);
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
stdout.write(`\n${style(defaultTheme.accent, 'totals:')} ${allowed} allow · ${warned} warn · ${blocked} block\n`);
|
|
186
|
+
return blocked > 0 ? 1 : 0;
|
|
187
|
+
}
|
|
188
|
+
if (op === 'uninstall') {
|
|
189
|
+
const name = argv[1];
|
|
190
|
+
if (!name) {
|
|
191
|
+
stderr.write(`Missing skill name.\n${HELP}\n`);
|
|
192
|
+
return 2;
|
|
193
|
+
}
|
|
194
|
+
const target = join(userSkillsDir(), basename(name));
|
|
195
|
+
if (!await dirExists(target)) {
|
|
196
|
+
stderr.write(`No skill at ${target}.\n`);
|
|
197
|
+
return 1;
|
|
198
|
+
}
|
|
199
|
+
await rm(target, { recursive: true, force: true });
|
|
200
|
+
stdout.write(`${style(defaultTheme.success, '✓')} uninstalled ${name} (${target})\n`);
|
|
201
|
+
return 0;
|
|
202
|
+
}
|
|
203
|
+
stderr.write(`Unknown subcommand "${op}".\n${HELP}\n`);
|
|
204
|
+
return 2;
|
|
205
|
+
},
|
|
206
|
+
};
|
|
207
|
+
//# sourceMappingURL=skills.js.map
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `dirgha undo [N]` — discard the last N turns from a session.
|
|
3
|
+
*
|
|
4
|
+
* Sessions are append-only JSONL at `~/.dirgha/sessions/<id>.jsonl`.
|
|
5
|
+
* "Undo" is implemented as a non-destructive rewrite: read the log,
|
|
6
|
+
* count back N user-turns, snapshot the original to `<id>.jsonl.bak`,
|
|
7
|
+
* write the truncated history. Future `dirgha resume <id>` then sees
|
|
8
|
+
* the rolled-back state.
|
|
9
|
+
*
|
|
10
|
+
* Without --session, the most-recently-modified session is used.
|
|
11
|
+
*
|
|
12
|
+
* Closes parity-matrix row 16. We can't assume a clean git repo for
|
|
13
|
+
* every workspace, so the session log is the source of truth — each
|
|
14
|
+
* undo rewinds the JSONL to the chosen turn boundary.
|
|
15
|
+
*/
|
|
16
|
+
import type { Subcommand } from './index.js';
|
|
17
|
+
export declare const undoSubcommand: Subcommand;
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `dirgha undo [N]` — discard the last N turns from a session.
|
|
3
|
+
*
|
|
4
|
+
* Sessions are append-only JSONL at `~/.dirgha/sessions/<id>.jsonl`.
|
|
5
|
+
* "Undo" is implemented as a non-destructive rewrite: read the log,
|
|
6
|
+
* count back N user-turns, snapshot the original to `<id>.jsonl.bak`,
|
|
7
|
+
* write the truncated history. Future `dirgha resume <id>` then sees
|
|
8
|
+
* the rolled-back state.
|
|
9
|
+
*
|
|
10
|
+
* Without --session, the most-recently-modified session is used.
|
|
11
|
+
*
|
|
12
|
+
* Closes parity-matrix row 16. We can't assume a clean git repo for
|
|
13
|
+
* every workspace, so the session log is the source of truth — each
|
|
14
|
+
* undo rewinds the JSONL to the chosen turn boundary.
|
|
15
|
+
*/
|
|
16
|
+
import { copyFile, readFile, writeFile, readdir, stat } from 'node:fs/promises';
|
|
17
|
+
import { homedir } from 'node:os';
|
|
18
|
+
import { join } from 'node:path';
|
|
19
|
+
import { stdout, stderr } from 'node:process';
|
|
20
|
+
import { style, defaultTheme } from '../../tui/theme.js';
|
|
21
|
+
function sessionsDir() {
|
|
22
|
+
return join(homedir(), '.dirgha', 'sessions');
|
|
23
|
+
}
|
|
24
|
+
function parseFlag(argv, name) {
|
|
25
|
+
const prefix = `--${name}=`;
|
|
26
|
+
for (let i = 0; i < argv.length; i += 1) {
|
|
27
|
+
const a = argv[i];
|
|
28
|
+
if (a === `--${name}` && i + 1 < argv.length)
|
|
29
|
+
return argv[i + 1];
|
|
30
|
+
if (a.startsWith(prefix))
|
|
31
|
+
return a.slice(prefix.length);
|
|
32
|
+
}
|
|
33
|
+
return undefined;
|
|
34
|
+
}
|
|
35
|
+
async function mostRecentSession() {
|
|
36
|
+
const dir = sessionsDir();
|
|
37
|
+
const names = await readdir(dir).catch(() => []);
|
|
38
|
+
const jsonl = names.filter(n => n.endsWith('.jsonl'));
|
|
39
|
+
if (jsonl.length === 0)
|
|
40
|
+
return undefined;
|
|
41
|
+
const stats = await Promise.all(jsonl.map(async (n) => {
|
|
42
|
+
const s = await stat(join(dir, n)).catch(() => undefined);
|
|
43
|
+
return { id: n.replace(/\.jsonl$/, ''), mtime: s?.mtimeMs ?? 0 };
|
|
44
|
+
}));
|
|
45
|
+
stats.sort((a, b) => b.mtime - a.mtime);
|
|
46
|
+
return stats[0]?.id;
|
|
47
|
+
}
|
|
48
|
+
async function readEntries(path) {
|
|
49
|
+
const text = await readFile(path, 'utf8').catch(() => '');
|
|
50
|
+
const out = [];
|
|
51
|
+
for (const line of text.split('\n')) {
|
|
52
|
+
if (!line.trim())
|
|
53
|
+
continue;
|
|
54
|
+
try {
|
|
55
|
+
out.push(JSON.parse(line));
|
|
56
|
+
}
|
|
57
|
+
catch { /* skip */ }
|
|
58
|
+
}
|
|
59
|
+
return out;
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Walk the entries from the tail and chop everything from the Nth-most-
|
|
63
|
+
* recent user-turn onward. Returns the count of entries kept.
|
|
64
|
+
*/
|
|
65
|
+
function truncateAtUserTurn(entries, n) {
|
|
66
|
+
let userTurnsSeen = 0;
|
|
67
|
+
for (let i = entries.length - 1; i >= 0; i--) {
|
|
68
|
+
const e = entries[i];
|
|
69
|
+
if (e.type === 'message' && e.message?.role === 'user') {
|
|
70
|
+
userTurnsSeen++;
|
|
71
|
+
if (userTurnsSeen === n)
|
|
72
|
+
return entries.slice(0, i);
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
// fewer than N user turns: discard everything
|
|
76
|
+
return [];
|
|
77
|
+
}
|
|
78
|
+
function usage() {
|
|
79
|
+
return [
|
|
80
|
+
'usage:',
|
|
81
|
+
' dirgha undo [N] Roll back N user-turns from the latest session (default 1)',
|
|
82
|
+
' dirgha undo --session=<id> [N] Target a specific session',
|
|
83
|
+
' dirgha undo --list Show the current session\'s last 10 turns',
|
|
84
|
+
' dirgha undo --json JSON output',
|
|
85
|
+
].join('\n');
|
|
86
|
+
}
|
|
87
|
+
export const undoSubcommand = {
|
|
88
|
+
name: 'undo',
|
|
89
|
+
description: 'Roll back the last N turns of a session (non-destructive — keeps a .bak)',
|
|
90
|
+
async run(argv) {
|
|
91
|
+
const json = argv.includes('--json');
|
|
92
|
+
const list = argv.includes('--list');
|
|
93
|
+
const sessionFlag = parseFlag(argv, 'session');
|
|
94
|
+
const positionals = argv.filter(a => !a.startsWith('--') && a !== '--list' && a !== '--json');
|
|
95
|
+
const n = positionals.length > 0 ? Number.parseInt(positionals[0], 10) : 1;
|
|
96
|
+
if (!Number.isFinite(n) || n < 1) {
|
|
97
|
+
stderr.write(`${usage()}\n`);
|
|
98
|
+
return 1;
|
|
99
|
+
}
|
|
100
|
+
const sessionId = sessionFlag ?? await mostRecentSession();
|
|
101
|
+
if (!sessionId) {
|
|
102
|
+
stderr.write('No sessions found in ~/.dirgha/sessions/\n');
|
|
103
|
+
return 1;
|
|
104
|
+
}
|
|
105
|
+
const path = join(sessionsDir(), `${sessionId}.jsonl`);
|
|
106
|
+
const entries = await readEntries(path);
|
|
107
|
+
if (entries.length === 0) {
|
|
108
|
+
stderr.write(`Session ${sessionId} is empty.\n`);
|
|
109
|
+
return 1;
|
|
110
|
+
}
|
|
111
|
+
if (list) {
|
|
112
|
+
const tail = entries.filter(e => e.type === 'message').slice(-10);
|
|
113
|
+
if (json) {
|
|
114
|
+
stdout.write(`${JSON.stringify({ sessionId, tail })}\n`);
|
|
115
|
+
return 0;
|
|
116
|
+
}
|
|
117
|
+
stdout.write(style(defaultTheme.accent, `\nLast 10 messages of ${sessionId}\n`));
|
|
118
|
+
for (const e of tail) {
|
|
119
|
+
const role = String(e.message?.role ?? '').padEnd(10);
|
|
120
|
+
const ts = String(e.ts ?? '').slice(0, 19);
|
|
121
|
+
stdout.write(` ${style(defaultTheme.muted, ts)} ${style(defaultTheme.accent, role)}\n`);
|
|
122
|
+
}
|
|
123
|
+
return 0;
|
|
124
|
+
}
|
|
125
|
+
const kept = truncateAtUserTurn(entries, n);
|
|
126
|
+
const dropped = entries.length - kept.length;
|
|
127
|
+
if (dropped === 0) {
|
|
128
|
+
stdout.write(style(defaultTheme.muted, `(nothing to undo — fewer than ${n} user turns)\n`));
|
|
129
|
+
return 0;
|
|
130
|
+
}
|
|
131
|
+
// Snapshot the original then write the truncated log.
|
|
132
|
+
const backup = `${path}.bak`;
|
|
133
|
+
await copyFile(path, backup);
|
|
134
|
+
await writeFile(path, kept.map(e => JSON.stringify(e)).join('\n') + (kept.length > 0 ? '\n' : ''), 'utf8');
|
|
135
|
+
if (json) {
|
|
136
|
+
stdout.write(`${JSON.stringify({ sessionId, dropped, kept: kept.length, backup })}\n`);
|
|
137
|
+
return 0;
|
|
138
|
+
}
|
|
139
|
+
stdout.write(style(defaultTheme.success, `✓ Rolled back ${n} user-turn${n === 1 ? '' : 's'} from ${sessionId}\n`));
|
|
140
|
+
stdout.write(style(defaultTheme.muted, ` dropped ${dropped} entr${dropped === 1 ? 'y' : 'ies'}, kept ${kept.length}; backup at ${backup}\n`));
|
|
141
|
+
return 0;
|
|
142
|
+
},
|
|
143
|
+
};
|
|
144
|
+
//# sourceMappingURL=undo.js.map
|