operon-agents-core 0.1.0-alpha.0
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/LICENSE +55 -0
- package/README.md +7 -0
- package/dist/agent/agent.d.ts +65 -0
- package/dist/agent/agent.js +39 -0
- package/dist/agent/compose-hooks.d.ts +13 -0
- package/dist/agent/compose-hooks.js +197 -0
- package/dist/agent/concurrency.d.ts +22 -0
- package/dist/agent/concurrency.js +70 -0
- package/dist/agent/context-report.d.ts +60 -0
- package/dist/agent/context-report.js +45 -0
- package/dist/agent/graph.d.ts +48 -0
- package/dist/agent/graph.js +129 -0
- package/dist/agent/guardrail.d.ts +105 -0
- package/dist/agent/guardrail.js +314 -0
- package/dist/agent/handoff-executor.d.ts +21 -0
- package/dist/agent/handoff-executor.js +95 -0
- package/dist/agent/handoff.d.ts +42 -0
- package/dist/agent/handoff.js +70 -0
- package/dist/agent/index.d.ts +25 -0
- package/dist/agent/index.js +19 -0
- package/dist/agent/instruction-context.d.ts +33 -0
- package/dist/agent/instruction-context.js +100 -0
- package/dist/agent/pause.d.ts +12 -0
- package/dist/agent/pause.js +82 -0
- package/dist/agent/profile-builtins.d.ts +8 -0
- package/dist/agent/profile-builtins.js +130 -0
- package/dist/agent/profiles.d.ts +94 -0
- package/dist/agent/profiles.js +264 -0
- package/dist/agent/recovery.d.ts +10 -0
- package/dist/agent/recovery.js +151 -0
- package/dist/agent/run-support.d.ts +79 -0
- package/dist/agent/run-support.js +211 -0
- package/dist/agent/runner.d.ts +246 -0
- package/dist/agent/runner.js +786 -0
- package/dist/agent/session.d.ts +363 -0
- package/dist/agent/session.js +937 -0
- package/dist/agent/subagent-tools.d.ts +18 -0
- package/dist/agent/subagent-tools.js +650 -0
- package/dist/agent/subagent.d.ts +56 -0
- package/dist/agent/subagent.js +50 -0
- package/dist/agent/toolset.d.ts +24 -0
- package/dist/agent/toolset.js +112 -0
- package/dist/agent/workflow/index.d.ts +9 -0
- package/dist/agent/workflow/index.js +8 -0
- package/dist/agent/workflow/journal.d.ts +180 -0
- package/dist/agent/workflow/journal.js +224 -0
- package/dist/agent/workflow/manager.d.ts +27 -0
- package/dist/agent/workflow/manager.js +33 -0
- package/dist/agent/workflow/parse.d.ts +17 -0
- package/dist/agent/workflow/parse.js +174 -0
- package/dist/agent/workflow/prompt.d.ts +8 -0
- package/dist/agent/workflow/prompt.js +84 -0
- package/dist/agent/workflow/runtime.d.ts +64 -0
- package/dist/agent/workflow/runtime.js +380 -0
- package/dist/agent/workflow/sandbox.d.ts +35 -0
- package/dist/agent/workflow/sandbox.js +90 -0
- package/dist/agent/workflow/snapshot.d.ts +36 -0
- package/dist/agent/workflow/snapshot.js +9 -0
- package/dist/agent/workflow/structured.d.ts +35 -0
- package/dist/agent/workflow/structured.js +79 -0
- package/dist/agent/workflow/tool.d.ts +14 -0
- package/dist/agent/workflow/tool.js +569 -0
- package/dist/agent/workflow/types.d.ts +100 -0
- package/dist/agent/workflow/types.js +17 -0
- package/dist/agent/worktree.d.ts +38 -0
- package/dist/agent/worktree.js +56 -0
- package/dist/capabilities/assembler.d.ts +39 -0
- package/dist/capabilities/assembler.js +171 -0
- package/dist/capabilities/background/agent-task.d.ts +51 -0
- package/dist/capabilities/background/agent-task.js +101 -0
- package/dist/capabilities/background/command-task.d.ts +43 -0
- package/dist/capabilities/background/command-task.js +86 -0
- package/dist/capabilities/background/index.d.ts +20 -0
- package/dist/capabilities/background/index.js +57 -0
- package/dist/capabilities/background/manager.d.ts +194 -0
- package/dist/capabilities/background/manager.js +1131 -0
- package/dist/capabilities/background/persist-disk.d.ts +17 -0
- package/dist/capabilities/background/persist-disk.js +66 -0
- package/dist/capabilities/background/persist.d.ts +61 -0
- package/dist/capabilities/background/persist.js +117 -0
- package/dist/capabilities/background/question-task.d.ts +32 -0
- package/dist/capabilities/background/question-task.js +56 -0
- package/dist/capabilities/background/registrar.d.ts +12 -0
- package/dist/capabilities/background/registrar.js +9 -0
- package/dist/capabilities/background/swappable-sink.d.ts +20 -0
- package/dist/capabilities/background/swappable-sink.js +20 -0
- package/dist/capabilities/background/task.d.ts +114 -0
- package/dist/capabilities/background/task.js +20 -0
- package/dist/capabilities/background/tools.d.ts +6 -0
- package/dist/capabilities/background/tools.js +190 -0
- package/dist/capabilities/background/workflow-task.d.ts +48 -0
- package/dist/capabilities/background/workflow-task.js +91 -0
- package/dist/capabilities/capability-state.d.ts +13 -0
- package/dist/capabilities/capability-state.js +37 -0
- package/dist/capabilities/capability.d.ts +145 -0
- package/dist/capabilities/capability.js +2 -0
- package/dist/capabilities/compaction/full.d.ts +27 -0
- package/dist/capabilities/compaction/full.js +155 -0
- package/dist/capabilities/compaction/index.d.ts +17 -0
- package/dist/capabilities/compaction/index.js +145 -0
- package/dist/capabilities/compaction/instruction.d.ts +2 -0
- package/dist/capabilities/compaction/instruction.js +31 -0
- package/dist/capabilities/compaction/micro.d.ts +17 -0
- package/dist/capabilities/compaction/micro.js +57 -0
- package/dist/capabilities/compaction/service.d.ts +28 -0
- package/dist/capabilities/compaction/service.js +52 -0
- package/dist/capabilities/compaction/strategy.d.ts +43 -0
- package/dist/capabilities/compaction/strategy.js +116 -0
- package/dist/capabilities/compaction/tokens.d.ts +5 -0
- package/dist/capabilities/compaction/tokens.js +28 -0
- package/dist/capabilities/goal/goal-store.d.ts +69 -0
- package/dist/capabilities/goal/goal-store.js +172 -0
- package/dist/capabilities/goal/index.d.ts +6 -0
- package/dist/capabilities/goal/index.js +31 -0
- package/dist/capabilities/goal/injector.d.ts +9 -0
- package/dist/capabilities/goal/injector.js +79 -0
- package/dist/capabilities/goal/tools.d.ts +6 -0
- package/dist/capabilities/goal/tools.js +86 -0
- package/dist/capabilities/index.d.ts +25 -0
- package/dist/capabilities/index.js +22 -0
- package/dist/capabilities/injection.d.ts +44 -0
- package/dist/capabilities/injection.js +112 -0
- package/dist/capabilities/plan/index.d.ts +6 -0
- package/dist/capabilities/plan/index.js +25 -0
- package/dist/capabilities/plan/injector.d.ts +13 -0
- package/dist/capabilities/plan/injector.js +83 -0
- package/dist/capabilities/plan/plan-mode.d.ts +38 -0
- package/dist/capabilities/plan/plan-mode.js +113 -0
- package/dist/capabilities/plan/policies.d.ts +6 -0
- package/dist/capabilities/plan/policies.js +89 -0
- package/dist/capabilities/plan/tools.d.ts +15 -0
- package/dist/capabilities/plan/tools.js +87 -0
- package/dist/capabilities/skills/flow-provider.d.ts +6 -0
- package/dist/capabilities/skills/flow-provider.js +50 -0
- package/dist/capabilities/skills/index.d.ts +43 -0
- package/dist/capabilities/skills/index.js +48 -0
- package/dist/capabilities/skills/injector.d.ts +11 -0
- package/dist/capabilities/skills/injector.js +27 -0
- package/dist/capabilities/skills/parser.d.ts +36 -0
- package/dist/capabilities/skills/parser.js +334 -0
- package/dist/capabilities/skills/registry.d.ts +33 -0
- package/dist/capabilities/skills/registry.js +118 -0
- package/dist/capabilities/skills/scanner.d.ts +26 -0
- package/dist/capabilities/skills/scanner.js +154 -0
- package/dist/capabilities/skills/service.d.ts +39 -0
- package/dist/capabilities/skills/service.js +68 -0
- package/dist/capabilities/skills/skill-tool.d.ts +13 -0
- package/dist/capabilities/skills/skill-tool.js +72 -0
- package/dist/capabilities/skills/types.d.ts +62 -0
- package/dist/capabilities/skills/types.js +26 -0
- package/dist/capabilities/task/index.d.ts +23 -0
- package/dist/capabilities/task/index.js +38 -0
- package/dist/capabilities/task/injector.d.ts +9 -0
- package/dist/capabilities/task/injector.js +62 -0
- package/dist/capabilities/task/persist-disk.d.ts +19 -0
- package/dist/capabilities/task/persist-disk.js +84 -0
- package/dist/capabilities/task/persist.d.ts +52 -0
- package/dist/capabilities/task/persist.js +84 -0
- package/dist/capabilities/task/task-store.d.ts +44 -0
- package/dist/capabilities/task/task-store.js +106 -0
- package/dist/capabilities/task/tools.d.ts +12 -0
- package/dist/capabilities/task/tools.js +164 -0
- package/dist/capabilities/todo/index.d.ts +8 -0
- package/dist/capabilities/todo/index.js +21 -0
- package/dist/capabilities/todo/injector.d.ts +9 -0
- package/dist/capabilities/todo/injector.js +68 -0
- package/dist/capabilities/todo/todo-store.d.ts +19 -0
- package/dist/capabilities/todo/todo-store.js +36 -0
- package/dist/capabilities/todo/tools.d.ts +6 -0
- package/dist/capabilities/todo/tools.js +70 -0
- package/dist/capabilities/tool-provider.d.ts +12 -0
- package/dist/capabilities/tool-provider.js +20 -0
- package/dist/capabilities/user-hooks/engine.d.ts +22 -0
- package/dist/capabilities/user-hooks/engine.js +105 -0
- package/dist/capabilities/user-hooks/index.d.ts +13 -0
- package/dist/capabilities/user-hooks/index.js +126 -0
- package/dist/capabilities/user-hooks/types.d.ts +26 -0
- package/dist/capabilities/user-hooks/types.js +19 -0
- package/dist/capabilities/workflow/index.d.ts +16 -0
- package/dist/capabilities/workflow/index.js +15 -0
- package/dist/commands/index.d.ts +31 -0
- package/dist/commands/index.js +318 -0
- package/dist/config/config-store.d.ts +29 -0
- package/dist/config/config-store.js +103 -0
- package/dist/config/file-source.d.ts +40 -0
- package/dist/config/file-source.js +78 -0
- package/dist/config/flags.d.ts +13 -0
- package/dist/config/flags.js +25 -0
- package/dist/config/index.d.ts +17 -0
- package/dist/config/index.js +10 -0
- package/dist/config/merge.d.ts +5 -0
- package/dist/config/merge.js +57 -0
- package/dist/config/model-catalog.d.ts +17 -0
- package/dist/config/model-catalog.js +37 -0
- package/dist/config/paths.d.ts +31 -0
- package/dist/config/paths.js +28 -0
- package/dist/config/provider-manager.d.ts +57 -0
- package/dist/config/provider-manager.js +344 -0
- package/dist/config/resolver.d.ts +40 -0
- package/dist/config/resolver.js +52 -0
- package/dist/config/schema.d.ts +389 -0
- package/dist/config/schema.js +132 -0
- package/dist/events/events.d.ts +348 -0
- package/dist/events/events.js +146 -0
- package/dist/events/index.d.ts +10 -0
- package/dist/events/index.js +5 -0
- package/dist/events/projection.d.ts +207 -0
- package/dist/events/projection.js +438 -0
- package/dist/events/publisher.d.ts +48 -0
- package/dist/events/publisher.js +404 -0
- package/dist/events/redacting-sink.d.ts +11 -0
- package/dist/events/redacting-sink.js +31 -0
- package/dist/home.d.ts +16 -0
- package/dist/home.js +20 -0
- package/dist/index.d.ts +22 -0
- package/dist/index.js +22 -0
- package/dist/internal.d.ts +33 -0
- package/dist/internal.js +29 -0
- package/dist/llm/auth.d.ts +22 -0
- package/dist/llm/auth.js +112 -0
- package/dist/llm/capability.d.ts +13 -0
- package/dist/llm/capability.js +45 -0
- package/dist/llm/define-model.d.ts +110 -0
- package/dist/llm/define-model.js +252 -0
- package/dist/llm/errors.d.ts +33 -0
- package/dist/llm/errors.js +154 -0
- package/dist/llm/index.d.ts +14 -0
- package/dist/llm/index.js +8 -0
- package/dist/llm/model.d.ts +43 -0
- package/dist/llm/model.js +9 -0
- package/dist/llm/retry.d.ts +35 -0
- package/dist/llm/retry.js +160 -0
- package/dist/llm/runtime.d.ts +25 -0
- package/dist/llm/runtime.js +38 -0
- package/dist/logging/diagnostics.d.ts +21 -0
- package/dist/logging/diagnostics.js +46 -0
- package/dist/logging/index.d.ts +11 -0
- package/dist/logging/index.js +7 -0
- package/dist/logging/logger.d.ts +25 -0
- package/dist/logging/logger.js +54 -0
- package/dist/logging/paths.d.ts +11 -0
- package/dist/logging/paths.js +20 -0
- package/dist/logging/policy.d.ts +5 -0
- package/dist/logging/policy.js +19 -0
- package/dist/logging/redact.d.ts +10 -0
- package/dist/logging/redact.js +95 -0
- package/dist/logging/sinks.d.ts +67 -0
- package/dist/logging/sinks.js +117 -0
- package/dist/loop/context.d.ts +69 -0
- package/dist/loop/context.js +129 -0
- package/dist/loop/errors.d.ts +8 -0
- package/dist/loop/errors.js +27 -0
- package/dist/loop/events.d.ts +14 -0
- package/dist/loop/events.js +2 -0
- package/dist/loop/index.d.ts +10 -0
- package/dist/loop/index.js +7 -0
- package/dist/loop/interruption.d.ts +118 -0
- package/dist/loop/interruption.js +191 -0
- package/dist/loop/run-turn.d.ts +54 -0
- package/dist/loop/run-turn.js +203 -0
- package/dist/loop/scheduler.d.ts +18 -0
- package/dist/loop/scheduler.js +71 -0
- package/dist/loop/steer.d.ts +122 -0
- package/dist/loop/steer.js +209 -0
- package/dist/loop/tool-call.d.ts +41 -0
- package/dist/loop/tool-call.js +326 -0
- package/dist/loop/turn-step.d.ts +57 -0
- package/dist/loop/turn-step.js +298 -0
- package/dist/loop/types.d.ts +217 -0
- package/dist/loop/types.js +2 -0
- package/dist/loop/usage.d.ts +6 -0
- package/dist/loop/usage.js +44 -0
- package/dist/mcp/auth-tool.d.ts +12 -0
- package/dist/mcp/auth-tool.js +92 -0
- package/dist/mcp/capability.d.ts +7 -0
- package/dist/mcp/capability.js +91 -0
- package/dist/mcp/config-loader.d.ts +28 -0
- package/dist/mcp/config-loader.js +115 -0
- package/dist/mcp/filter.d.ts +18 -0
- package/dist/mcp/filter.js +35 -0
- package/dist/mcp/index.d.ts +23 -0
- package/dist/mcp/index.js +13 -0
- package/dist/mcp/manager.d.ts +51 -0
- package/dist/mcp/manager.js +412 -0
- package/dist/mcp/mock-transport.d.ts +40 -0
- package/dist/mcp/mock-transport.js +68 -0
- package/dist/mcp/oauth/callback-server.d.ts +14 -0
- package/dist/mcp/oauth/callback-server.js +122 -0
- package/dist/mcp/oauth/index.d.ts +9 -0
- package/dist/mcp/oauth/index.js +5 -0
- package/dist/mcp/oauth/provider.d.ts +39 -0
- package/dist/mcp/oauth/provider.js +121 -0
- package/dist/mcp/oauth/service.d.ts +34 -0
- package/dist/mcp/oauth/service.js +130 -0
- package/dist/mcp/oauth/store.d.ts +40 -0
- package/dist/mcp/oauth/store.js +134 -0
- package/dist/mcp/output.d.ts +12 -0
- package/dist/mcp/output.js +110 -0
- package/dist/mcp/provider.d.ts +7 -0
- package/dist/mcp/provider.js +56 -0
- package/dist/mcp/sdk-transport.d.ts +25 -0
- package/dist/mcp/sdk-transport.js +228 -0
- package/dist/mcp/server.d.ts +77 -0
- package/dist/mcp/server.js +120 -0
- package/dist/mcp/tool-naming.d.ts +4 -0
- package/dist/mcp/tool-naming.js +26 -0
- package/dist/mcp/types.d.ts +75 -0
- package/dist/mcp/types.js +2 -0
- package/dist/net/index.d.ts +3 -0
- package/dist/net/index.js +2 -0
- package/dist/net/proxy.d.ts +16 -0
- package/dist/net/proxy.js +42 -0
- package/dist/permission/auto-approver/index.d.ts +3 -0
- package/dist/permission/auto-approver/index.js +3 -0
- package/dist/permission/auto-approver/llm-auto-approver.d.ts +53 -0
- package/dist/permission/auto-approver/llm-auto-approver.js +122 -0
- package/dist/permission/auto-approver/prompts-data.d.ts +9 -0
- package/dist/permission/auto-approver/prompts-data.js +155 -0
- package/dist/permission/auto-approver/prompts.d.ts +18 -0
- package/dist/permission/auto-approver/prompts.js +40 -0
- package/dist/permission/auto-approver/transcript.d.ts +22 -0
- package/dist/permission/auto-approver/transcript.js +75 -0
- package/dist/permission/auto-approver/xml.d.ts +5 -0
- package/dist/permission/auto-approver/xml.js +25 -0
- package/dist/permission/index.d.ts +7 -0
- package/dist/permission/index.js +5 -0
- package/dist/permission/manager.d.ts +74 -0
- package/dist/permission/manager.js +162 -0
- package/dist/permission/matches-rule.d.ts +27 -0
- package/dist/permission/matches-rule.js +54 -0
- package/dist/permission/policies.d.ts +14 -0
- package/dist/permission/policies.js +233 -0
- package/dist/permission/types.d.ts +84 -0
- package/dist/permission/types.js +2 -0
- package/dist/plugins/archive.d.ts +3 -0
- package/dist/plugins/archive.js +58 -0
- package/dist/plugins/github-resolver.d.ts +13 -0
- package/dist/plugins/github-resolver.js +20 -0
- package/dist/plugins/hooks.d.ts +28 -0
- package/dist/plugins/hooks.js +296 -0
- package/dist/plugins/index.d.ts +23 -0
- package/dist/plugins/index.js +23 -0
- package/dist/plugins/injector.d.ts +11 -0
- package/dist/plugins/injector.js +32 -0
- package/dist/plugins/manager.d.ts +37 -0
- package/dist/plugins/manager.js +330 -0
- package/dist/plugins/manifest.d.ts +9 -0
- package/dist/plugins/manifest.js +234 -0
- package/dist/plugins/marketplace.d.ts +85 -0
- package/dist/plugins/marketplace.js +205 -0
- package/dist/plugins/source.d.ts +23 -0
- package/dist/plugins/source.js +87 -0
- package/dist/plugins/store.d.ts +20 -0
- package/dist/plugins/store.js +30 -0
- package/dist/plugins/types.d.ts +118 -0
- package/dist/plugins/types.js +5 -0
- package/dist/protocol/index.d.ts +4 -0
- package/dist/protocol/index.js +2 -0
- package/dist/protocol/tool-schema.d.ts +6 -0
- package/dist/protocol/tool-schema.js +2 -0
- package/dist/store/blob-store.d.ts +45 -0
- package/dist/store/blob-store.js +120 -0
- package/dist/store/catalog-store.d.ts +32 -0
- package/dist/store/catalog-store.js +73 -0
- package/dist/store/disk-store.d.ts +58 -0
- package/dist/store/disk-store.js +369 -0
- package/dist/store/index.d.ts +23 -0
- package/dist/store/index.js +15 -0
- package/dist/store/lock.d.ts +86 -0
- package/dist/store/lock.js +104 -0
- package/dist/store/log-store.d.ts +89 -0
- package/dist/store/log-store.js +296 -0
- package/dist/store/migrate.d.ts +26 -0
- package/dist/store/migrate.js +32 -0
- package/dist/store/origin.d.ts +89 -0
- package/dist/store/origin.js +16 -0
- package/dist/store/pg.d.ts +90 -0
- package/dist/store/pg.js +344 -0
- package/dist/store/redacting-store.d.ts +21 -0
- package/dist/store/redacting-store.js +46 -0
- package/dist/store/redis.d.ts +89 -0
- package/dist/store/redis.js +370 -0
- package/dist/store/repository.d.ts +150 -0
- package/dist/store/repository.js +508 -0
- package/dist/store/session-catalog.d.ts +32 -0
- package/dist/store/session-catalog.js +117 -0
- package/dist/store/storage.d.ts +27 -0
- package/dist/store/storage.js +54 -0
- package/dist/store/store.d.ts +262 -0
- package/dist/store/store.js +129 -0
- package/dist/store/workdir-key.d.ts +4 -0
- package/dist/store/workdir-key.js +28 -0
- package/dist/tool/access.d.ts +37 -0
- package/dist/tool/access.js +79 -0
- package/dist/tool/ask.d.ts +22 -0
- package/dist/tool/ask.js +38 -0
- package/dist/tool/background.d.ts +109 -0
- package/dist/tool/background.js +39 -0
- package/dist/tool/builtin/ask-user-question.d.ts +2 -0
- package/dist/tool/builtin/ask-user-question.js +175 -0
- package/dist/tool/builtin/bash.d.ts +2 -0
- package/dist/tool/builtin/bash.js +407 -0
- package/dist/tool/builtin/edit.d.ts +2 -0
- package/dist/tool/builtin/edit.js +202 -0
- package/dist/tool/builtin/glob.d.ts +3 -0
- package/dist/tool/builtin/glob.js +260 -0
- package/dist/tool/builtin/grep.d.ts +2 -0
- package/dist/tool/builtin/grep.js +574 -0
- package/dist/tool/builtin/line-endings.d.ts +10 -0
- package/dist/tool/builtin/line-endings.js +41 -0
- package/dist/tool/builtin/read.d.ts +28 -0
- package/dist/tool/builtin/read.js +498 -0
- package/dist/tool/builtin/write.d.ts +2 -0
- package/dist/tool/builtin/write.js +179 -0
- package/dist/tool/define.d.ts +46 -0
- package/dist/tool/define.js +45 -0
- package/dist/tool/file-freshness.d.ts +81 -0
- package/dist/tool/file-freshness.js +67 -0
- package/dist/tool/filesystem-tools.d.ts +16 -0
- package/dist/tool/filesystem-tools.js +19 -0
- package/dist/tool/git-context.d.ts +20 -0
- package/dist/tool/git-context.js +114 -0
- package/dist/tool/index.d.ts +37 -0
- package/dist/tool/index.js +34 -0
- package/dist/tool/machine-base.d.ts +138 -0
- package/dist/tool/machine-base.js +388 -0
- package/dist/tool/machine-local.d.ts +35 -0
- package/dist/tool/machine-local.js +316 -0
- package/dist/tool/machine-null.d.ts +36 -0
- package/dist/tool/machine-null.js +64 -0
- package/dist/tool/machine-ssh.d.ts +86 -0
- package/dist/tool/machine-ssh.js +576 -0
- package/dist/tool/machine.d.ts +333 -0
- package/dist/tool/machine.js +15 -0
- package/dist/tool/policies/path-access.d.ts +48 -0
- package/dist/tool/policies/path-access.js +186 -0
- package/dist/tool/policies/sensitive.d.ts +3 -0
- package/dist/tool/policies/sensitive.js +60 -0
- package/dist/tool/questions.d.ts +40 -0
- package/dist/tool/questions.js +8 -0
- package/dist/tool/search/activation.d.ts +13 -0
- package/dist/tool/search/activation.js +31 -0
- package/dist/tool/search/deferral.d.ts +37 -0
- package/dist/tool/search/deferral.js +128 -0
- package/dist/tool/search/search-tool.d.ts +9 -0
- package/dist/tool/search/search-tool.js +62 -0
- package/dist/tool/shell-env.d.ts +9 -0
- package/dist/tool/shell-env.js +34 -0
- package/dist/tool/support/bash-destructive.d.ts +24 -0
- package/dist/tool/support/bash-destructive.js +63 -0
- package/dist/tool/support/bash-paths.d.ts +7 -0
- package/dist/tool/support/bash-paths.js +247 -0
- package/dist/tool/support/bash-read-only.d.ts +8 -0
- package/dist/tool/support/bash-read-only.js +165 -0
- package/dist/tool/support/bash-rule-match.d.ts +20 -0
- package/dist/tool/support/bash-rule-match.js +191 -0
- package/dist/tool/support/file-type.d.ts +10 -0
- package/dist/tool/support/file-type.js +149 -0
- package/dist/tool/support/git-worktree.d.ts +10 -0
- package/dist/tool/support/git-worktree.js +63 -0
- package/dist/tool/support/image-compress.d.ts +69 -0
- package/dist/tool/support/image-compress.js +265 -0
- package/dist/tool/support/machine-ops.d.ts +34 -0
- package/dist/tool/support/machine-ops.js +34 -0
- package/dist/tool/support/path-glob-match.d.ts +12 -0
- package/dist/tool/support/path-glob-match.js +84 -0
- package/dist/tool/support/result-builder.d.ts +27 -0
- package/dist/tool/support/result-builder.js +108 -0
- package/dist/tool/support/rg-locator.d.ts +20 -0
- package/dist/tool/support/rg-locator.js +42 -0
- package/dist/tool/support/ripgrep-run.d.ts +65 -0
- package/dist/tool/support/ripgrep-run.js +40 -0
- package/dist/tool/support/rule-match.d.ts +6 -0
- package/dist/tool/support/rule-match.js +23 -0
- package/dist/tool/support/tool-path.d.ts +8 -0
- package/dist/tool/support/tool-path.js +28 -0
- package/dist/tool/support/workspace.d.ts +5 -0
- package/dist/tool/support/workspace.js +2 -0
- package/dist/tool/types.d.ts +131 -0
- package/dist/tool/types.js +2 -0
- package/dist/tool/web/fetch-url.d.ts +4 -0
- package/dist/tool/web/fetch-url.js +61 -0
- package/dist/tool/web/index.d.ts +11 -0
- package/dist/tool/web/index.js +7 -0
- package/dist/tool/web/providers/direct-fetch.d.ts +33 -0
- package/dist/tool/web/providers/direct-fetch.js +198 -0
- package/dist/tool/web/providers/firecrawl.d.ts +16 -0
- package/dist/tool/web/providers/firecrawl.js +59 -0
- package/dist/tool/web/providers/tavily.d.ts +14 -0
- package/dist/tool/web/providers/tavily.js +43 -0
- package/dist/tool/web/types.d.ts +41 -0
- package/dist/tool/web/types.js +7 -0
- package/dist/tool/web/web-search.d.ts +4 -0
- package/dist/tool/web/web-search.js +68 -0
- package/dist/tool/workspace-spec.d.ts +74 -0
- package/dist/tool/workspace-spec.js +177 -0
- package/dist/tracing/bridge.d.ts +7 -0
- package/dist/tracing/bridge.js +171 -0
- package/dist/tracing/index.d.ts +9 -0
- package/dist/tracing/index.js +5 -0
- package/dist/tracing/otel.d.ts +38 -0
- package/dist/tracing/otel.js +221 -0
- package/dist/tracing/processor.d.ts +47 -0
- package/dist/tracing/processor.js +94 -0
- package/dist/tracing/spans.d.ts +94 -0
- package/dist/tracing/spans.js +56 -0
- package/dist/ui/ai-sdk.d.ts +114 -0
- package/dist/ui/ai-sdk.js +175 -0
- package/dist/ui/index.d.ts +2 -0
- package/dist/ui/index.js +2 -0
- package/package.json +101 -0
|
@@ -0,0 +1,205 @@
|
|
|
1
|
+
import { readFile } from "node:fs/promises";
|
|
2
|
+
import { join } from "node:path";
|
|
3
|
+
import { downloadZip, extractZip } from "./archive.js";
|
|
4
|
+
import { codeloadZipUrl } from "./github-resolver.js";
|
|
5
|
+
import { resolveInstallSource, sanitizeSubdir } from "./source.js";
|
|
6
|
+
// Codex's marketplace index path inside a repo.
|
|
7
|
+
const CODEX_MARKETPLACE_PATH = ".agents/plugins/marketplace.json";
|
|
8
|
+
/** Read + validate a marketplace registry from a cached github repo. */
|
|
9
|
+
export async function loadMarketplace(options) {
|
|
10
|
+
const location = resolveLocation(options.source, options.repoDir);
|
|
11
|
+
const raw = await readFile(join(location.repoRoot, CODEX_MARKETPLACE_PATH), "utf8");
|
|
12
|
+
return parseMarketplace(raw, location);
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Download a github repo's ZIP archive (one request) and extract it into `destDir`, returning the
|
|
16
|
+
* extracted repo root. For a monorepo marketplace this is fetched ONCE and then both browsing and
|
|
17
|
+
* installing read from the local copy — instead of re-downloading the whole repo per plugin. The
|
|
18
|
+
* caller owns `destDir` (and any caching/refresh policy); pass a fresh/empty dir.
|
|
19
|
+
*/
|
|
20
|
+
export async function materializeGithubRepo(options) {
|
|
21
|
+
const ref = { kind: "branch", value: options.ref ?? "HEAD" };
|
|
22
|
+
const buffer = await downloadZip(codeloadZipUrl(options.owner, options.repo, ref));
|
|
23
|
+
return extractZip(buffer, options.destDir);
|
|
24
|
+
}
|
|
25
|
+
/** Parse + validate a marketplace registry string against a cached repo location. */
|
|
26
|
+
export function parseMarketplace(raw, location) {
|
|
27
|
+
let parsed;
|
|
28
|
+
try {
|
|
29
|
+
parsed = JSON.parse(raw);
|
|
30
|
+
}
|
|
31
|
+
catch (error) {
|
|
32
|
+
throw new Error(`Plugin marketplace is not valid JSON: ${error instanceof Error ? error.message : String(error)}`);
|
|
33
|
+
}
|
|
34
|
+
if (!isRecord(parsed))
|
|
35
|
+
throw new TypeError("Plugin marketplace must be an object.");
|
|
36
|
+
const rawPlugins = parsed["plugins"];
|
|
37
|
+
if (!Array.isArray(rawPlugins))
|
|
38
|
+
throw new TypeError('Plugin marketplace must contain a "plugins" array.');
|
|
39
|
+
return {
|
|
40
|
+
source: location.source,
|
|
41
|
+
version: stringField(parsed, "version"),
|
|
42
|
+
plugins: rawPlugins.map((entry, index) => parseEntry(entry, index, location)),
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
function resolveLocation(source, repoDir) {
|
|
46
|
+
const trimmed = source.trim();
|
|
47
|
+
if (trimmed.length === 0)
|
|
48
|
+
throw new Error("Plugin marketplace source cannot be empty.");
|
|
49
|
+
if (parseGithubMarketplaceSource(trimmed) === undefined) {
|
|
50
|
+
throw new Error(`Plugin marketplace must be a github repo (got "${trimmed}").`);
|
|
51
|
+
}
|
|
52
|
+
return { repoRoot: repoDir, source: trimmed };
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Recognise a github repo marketplace reference: `owner/repo[@ref]` shorthand or a github.com repo
|
|
56
|
+
* URL. Returns the repo coordinates (so a caller can cache the repo) or undefined for non-repo
|
|
57
|
+
* sources. Exported so embedders can validate config + cache the repo.
|
|
58
|
+
*/
|
|
59
|
+
export function parseGithubMarketplaceSource(source) {
|
|
60
|
+
if (source.startsWith("https://github.com/") || source.startsWith("http://github.com/")) {
|
|
61
|
+
const url = new URL(source);
|
|
62
|
+
const seg = url.pathname.split("/").filter((s) => s.length > 0);
|
|
63
|
+
if (seg.length < 2)
|
|
64
|
+
return undefined;
|
|
65
|
+
const owner = seg[0];
|
|
66
|
+
const repo = (seg[1] ?? "").replace(/\.git$/, "");
|
|
67
|
+
// A repo root, or `/tree/<ref>` — anything pointing at a deeper file isn't a repo registry ref.
|
|
68
|
+
if (seg.length === 2)
|
|
69
|
+
return { owner, repo };
|
|
70
|
+
if (seg[2] === "tree" && seg.length >= 4)
|
|
71
|
+
return { owner, repo, ref: seg.slice(3).join("/") };
|
|
72
|
+
return undefined;
|
|
73
|
+
}
|
|
74
|
+
// Shorthand `owner/repo` / `owner/repo@ref`. Exclude local paths and direct .json files.
|
|
75
|
+
if (source.includes("://") || source.startsWith(".") || source.startsWith("/") || source.startsWith("~") || source.endsWith(".json")) {
|
|
76
|
+
return undefined;
|
|
77
|
+
}
|
|
78
|
+
const m = /^([A-Za-z0-9][A-Za-z0-9_.-]*)\/([A-Za-z0-9][A-Za-z0-9_.-]*?)(?:@(.+))?$/.exec(source);
|
|
79
|
+
if (m === null)
|
|
80
|
+
return undefined;
|
|
81
|
+
return { owner: m[1], repo: m[2].replace(/\.git$/, ""), ...(m[3] ? { ref: m[3] } : {}) };
|
|
82
|
+
}
|
|
83
|
+
function parseEntry(value, index, location) {
|
|
84
|
+
if (!isRecord(value))
|
|
85
|
+
throw new TypeError(`Plugin marketplace entry ${index + 1} must be an object.`);
|
|
86
|
+
const id = stringField(value, "id") ?? stringField(value, "name");
|
|
87
|
+
if (id === undefined)
|
|
88
|
+
throw new Error(`Plugin marketplace entry ${index + 1} must define "id" or "name".`);
|
|
89
|
+
return {
|
|
90
|
+
id,
|
|
91
|
+
displayName: stringField(value, "displayName") ?? stringField(value, "name") ?? id,
|
|
92
|
+
source: resolveSource(value, location, id),
|
|
93
|
+
tier: stringField(value, "tier"),
|
|
94
|
+
version: stringField(value, "version"),
|
|
95
|
+
description: stringField(value, "description") ?? stringField(value, "shortDescription"),
|
|
96
|
+
homepage: stringField(value, "homepage") ?? stringField(value, "websiteURL"),
|
|
97
|
+
keywords: stringArrayField(value, "keywords"),
|
|
98
|
+
};
|
|
99
|
+
}
|
|
100
|
+
function resolveSource(value, location, id) {
|
|
101
|
+
const raw = value["source"];
|
|
102
|
+
if (!isRecord(raw))
|
|
103
|
+
throw new Error(`Plugin marketplace entry ${id} must define an object "source" (Codex format).`);
|
|
104
|
+
return resolveCodexSource(raw, location, id);
|
|
105
|
+
}
|
|
106
|
+
/** Codex source object: { source: "local"|"git-subdir"|"url", path|url, ref|sha }. */
|
|
107
|
+
function resolveCodexSource(obj, location, id) {
|
|
108
|
+
const kind = stringField(obj, "source");
|
|
109
|
+
const path = stringField(obj, "path");
|
|
110
|
+
if (kind === "local" || (kind === undefined && path !== undefined)) {
|
|
111
|
+
if (path === undefined)
|
|
112
|
+
throw new Error(`Plugin marketplace entry ${id}: local source requires "path".`);
|
|
113
|
+
// `local` is relative to the repo ROOT → absolute path in the cached repo (install = local copy).
|
|
114
|
+
return join(location.repoRoot, cleanSubdir(path));
|
|
115
|
+
}
|
|
116
|
+
if (kind === "git-subdir") {
|
|
117
|
+
const url = stringField(obj, "url");
|
|
118
|
+
if (url === undefined)
|
|
119
|
+
throw new Error(`Plugin marketplace entry ${id}: git-subdir source requires "url".`);
|
|
120
|
+
const ref = stringField(obj, "ref") ?? stringField(obj, "sha") ?? "HEAD";
|
|
121
|
+
const sub = path !== undefined ? cleanSubdir(path) : undefined;
|
|
122
|
+
const base = `${stripTrailingSlash(url)}/tree/${ref}`;
|
|
123
|
+
return sub !== undefined ? `${base}#path=${sub}` : base;
|
|
124
|
+
}
|
|
125
|
+
if (kind === "url") {
|
|
126
|
+
const url = stringField(obj, "url") ?? path;
|
|
127
|
+
if (url === undefined)
|
|
128
|
+
throw new Error(`Plugin marketplace entry ${id}: url source requires "url".`);
|
|
129
|
+
return url;
|
|
130
|
+
}
|
|
131
|
+
throw new Error(`Plugin marketplace entry ${id}: unsupported source kind "${kind ?? "(none)"}".`);
|
|
132
|
+
}
|
|
133
|
+
function cleanSubdir(p) {
|
|
134
|
+
// Drops `..`/`.`/empty segments too — a marketplace `local.path: "../../home/user/.ssh"`
|
|
135
|
+
// must not resolve outside the cached repo root (see sanitizeSubdir).
|
|
136
|
+
return sanitizeSubdir(p.trim());
|
|
137
|
+
}
|
|
138
|
+
function stripTrailingSlash(s) {
|
|
139
|
+
return s.replace(/\/$/, "");
|
|
140
|
+
}
|
|
141
|
+
function stringField(value, field) {
|
|
142
|
+
const raw = value[field];
|
|
143
|
+
if (typeof raw !== "string")
|
|
144
|
+
return undefined;
|
|
145
|
+
const trimmed = raw.trim();
|
|
146
|
+
return trimmed.length > 0 ? trimmed : undefined;
|
|
147
|
+
}
|
|
148
|
+
function stringArrayField(value, field) {
|
|
149
|
+
const raw = value[field];
|
|
150
|
+
if (!Array.isArray(raw))
|
|
151
|
+
return undefined;
|
|
152
|
+
const out = raw.filter((item) => typeof item === "string").map((item) => item.trim()).filter((item) => item.length > 0);
|
|
153
|
+
return out.length > 0 ? out : undefined;
|
|
154
|
+
}
|
|
155
|
+
function isRecord(value) {
|
|
156
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
157
|
+
}
|
|
158
|
+
// Manifest filenames to try, in order (Codex first, then operon). Mirrors plugins/manifest.ts.
|
|
159
|
+
const ENTRY_MANIFEST_CANDIDATES = [".codex-plugin/plugin.json", "agents.plugin.json", ".agents-plugin/plugin.json"];
|
|
160
|
+
/**
|
|
161
|
+
* Read displayable details (logo/description) for one marketplace entry from its plugin manifest in
|
|
162
|
+
* the cached repo. `source` is the entry's install source; only a local plugin dir is enrichable.
|
|
163
|
+
* Returns null when the source isn't local or no manifest/fields are found ("no extras").
|
|
164
|
+
*/
|
|
165
|
+
export async function loadMarketplaceEntryDetails(source) {
|
|
166
|
+
const resolved = resolveInstallSource(source);
|
|
167
|
+
if (resolved.kind !== "local-path")
|
|
168
|
+
return null;
|
|
169
|
+
for (const candidate of ENTRY_MANIFEST_CANDIDATES) {
|
|
170
|
+
try {
|
|
171
|
+
const manifest = JSON.parse(await readFile(join(resolved.path, candidate), "utf8"));
|
|
172
|
+
if (!isRecord(manifest))
|
|
173
|
+
continue;
|
|
174
|
+
return extractEntryDetails(manifest, resolved.path);
|
|
175
|
+
}
|
|
176
|
+
catch {
|
|
177
|
+
// Missing/parse error for this candidate — try the next, then give up (null).
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
return null;
|
|
181
|
+
}
|
|
182
|
+
function extractEntryDetails(manifest, dir) {
|
|
183
|
+
// Codex puts the user-facing fields under `interface`; operon uses top-level fields.
|
|
184
|
+
const iface = isRecord(manifest["interface"]) ? manifest["interface"] : {};
|
|
185
|
+
const displayName = stringField(iface, "displayName") ?? stringField(manifest, "displayName") ?? stringField(manifest, "name");
|
|
186
|
+
const description = stringField(iface, "shortDescription") ?? stringField(iface, "longDescription") ?? stringField(manifest, "description");
|
|
187
|
+
const logoRel = stringField(iface, "logo") ?? stringField(iface, "composerIcon") ?? stringField(manifest, "logo") ?? stringField(manifest, "icon");
|
|
188
|
+
const brandColor = stringField(iface, "brandColor");
|
|
189
|
+
let logoUrl;
|
|
190
|
+
let logoPath;
|
|
191
|
+
if (logoRel !== undefined) {
|
|
192
|
+
if (/^https?:\/\//.test(logoRel))
|
|
193
|
+
logoUrl = logoRel;
|
|
194
|
+
else
|
|
195
|
+
logoPath = join(dir, logoRel.replace(/^\.?\/+/, ""));
|
|
196
|
+
}
|
|
197
|
+
return {
|
|
198
|
+
...(displayName !== undefined ? { displayName } : {}),
|
|
199
|
+
...(description !== undefined ? { description } : {}),
|
|
200
|
+
...(logoUrl !== undefined ? { logoUrl } : {}),
|
|
201
|
+
...(logoPath !== undefined ? { logoPath } : {}),
|
|
202
|
+
...(brandColor !== undefined ? { brandColor } : {}),
|
|
203
|
+
};
|
|
204
|
+
}
|
|
205
|
+
//# sourceMappingURL=marketplace.js.map
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { PluginGithubRef } from "./types.ts";
|
|
2
|
+
export type ResolvedSource = {
|
|
3
|
+
readonly kind: "local-path";
|
|
4
|
+
readonly path: string;
|
|
5
|
+
} | {
|
|
6
|
+
readonly kind: "zip-url";
|
|
7
|
+
readonly path: string;
|
|
8
|
+
} | {
|
|
9
|
+
readonly kind: "github";
|
|
10
|
+
readonly owner: string;
|
|
11
|
+
readonly repo: string;
|
|
12
|
+
readonly ref?: PluginGithubRef;
|
|
13
|
+
readonly subdir?: string;
|
|
14
|
+
};
|
|
15
|
+
export declare function resolveInstallSource(source: string): ResolvedSource;
|
|
16
|
+
/**
|
|
17
|
+
* A repo-relative plugin subdir must stay inside the cached repo. Dropping `.`/`..`/empty
|
|
18
|
+
* segments makes escape arithmetically impossible — a crafted `#path=../../../etc` (or a
|
|
19
|
+
* marketplace `path`) collapses to an in-repo path instead of resolving to an outside dir
|
|
20
|
+
* that then gets read as a plugin. Same containment intent as archive.ts's zip-slip guard.
|
|
21
|
+
*/
|
|
22
|
+
export declare function sanitizeSubdir(raw: string): string;
|
|
23
|
+
//# sourceMappingURL=source.d.ts.map
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import path from "node:path";
|
|
2
|
+
const SHA_RE = /^[0-9a-f]{7,40}$/;
|
|
3
|
+
export function resolveInstallSource(source) {
|
|
4
|
+
const trimmed = source.trim();
|
|
5
|
+
const github = parseGithubUrl(trimmed);
|
|
6
|
+
if (github !== undefined)
|
|
7
|
+
return github;
|
|
8
|
+
if (trimmed.startsWith("http://") || trimmed.startsWith("https://"))
|
|
9
|
+
return { kind: "zip-url", path: trimmed };
|
|
10
|
+
if (!path.isAbsolute(trimmed))
|
|
11
|
+
throw new Error(`Plugin root must be an absolute path (got "${source}")`);
|
|
12
|
+
return { kind: "local-path", path: trimmed };
|
|
13
|
+
}
|
|
14
|
+
function parseGithubUrl(raw) {
|
|
15
|
+
let url;
|
|
16
|
+
try {
|
|
17
|
+
url = new URL(raw);
|
|
18
|
+
}
|
|
19
|
+
catch {
|
|
20
|
+
return undefined;
|
|
21
|
+
}
|
|
22
|
+
if (url.protocol !== "https:")
|
|
23
|
+
return undefined;
|
|
24
|
+
if (url.hostname !== "github.com" && url.hostname !== "www.github.com")
|
|
25
|
+
return undefined;
|
|
26
|
+
const segments = url.pathname.split("/").filter((s) => s.length > 0);
|
|
27
|
+
const owner = segments[0];
|
|
28
|
+
const repoRaw = segments[1];
|
|
29
|
+
if (owner === undefined || repoRaw === undefined)
|
|
30
|
+
return undefined;
|
|
31
|
+
const repo = repoRaw.endsWith(".git") ? repoRaw.slice(0, -4) : repoRaw;
|
|
32
|
+
// `#path=<subdir>` selects a plugin inside a monorepo (separate from the ref in the path).
|
|
33
|
+
const subdir = parseSubdir(url.hash);
|
|
34
|
+
const withSubdir = (base) => subdir !== undefined ? { ...base, subdir } : base;
|
|
35
|
+
const rest = segments.slice(2);
|
|
36
|
+
if (rest.length === 0)
|
|
37
|
+
return withSubdir({ kind: "github", owner, repo });
|
|
38
|
+
const head = rest[0];
|
|
39
|
+
const second = rest[1];
|
|
40
|
+
if (head === "tree" && rest.length >= 2) {
|
|
41
|
+
const refValue = decodeRefSegments(rest.slice(1));
|
|
42
|
+
const kind = SHA_RE.test(refValue) ? "sha" : "branch";
|
|
43
|
+
return withSubdir({ kind: "github", owner, repo, ref: { kind, value: refValue } });
|
|
44
|
+
}
|
|
45
|
+
if (head === "releases" && second === "tag" && rest.length >= 3) {
|
|
46
|
+
return withSubdir({ kind: "github", owner, repo, ref: { kind: "tag", value: decodeRefSegments(rest.slice(2)) } });
|
|
47
|
+
}
|
|
48
|
+
if (head === "commit" && rest.length >= 2) {
|
|
49
|
+
return withSubdir({ kind: "github", owner, repo, ref: { kind: "sha", value: decodeRefSegments(rest.slice(1)) } });
|
|
50
|
+
}
|
|
51
|
+
return undefined; // /archive/... and other paths → fall through to zip-url
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* A repo-relative plugin subdir must stay inside the cached repo. Dropping `.`/`..`/empty
|
|
55
|
+
* segments makes escape arithmetically impossible — a crafted `#path=../../../etc` (or a
|
|
56
|
+
* marketplace `path`) collapses to an in-repo path instead of resolving to an outside dir
|
|
57
|
+
* that then gets read as a plugin. Same containment intent as archive.ts's zip-slip guard.
|
|
58
|
+
*/
|
|
59
|
+
export function sanitizeSubdir(raw) {
|
|
60
|
+
return raw
|
|
61
|
+
.split("/")
|
|
62
|
+
.filter((segment) => segment.length > 0 && segment !== "." && segment !== "..")
|
|
63
|
+
.join("/");
|
|
64
|
+
}
|
|
65
|
+
function parseSubdir(hash) {
|
|
66
|
+
if (hash.length === 0)
|
|
67
|
+
return undefined;
|
|
68
|
+
const params = new URLSearchParams(hash.startsWith("#") ? hash.slice(1) : hash);
|
|
69
|
+
const value = params.get("path")?.trim();
|
|
70
|
+
if (value === undefined || value.length === 0)
|
|
71
|
+
return undefined;
|
|
72
|
+
const safe = sanitizeSubdir(value);
|
|
73
|
+
return safe.length > 0 ? safe : undefined;
|
|
74
|
+
}
|
|
75
|
+
function decodeRefSegments(segments) {
|
|
76
|
+
return segments
|
|
77
|
+
.map((segment) => {
|
|
78
|
+
try {
|
|
79
|
+
return decodeURIComponent(segment);
|
|
80
|
+
}
|
|
81
|
+
catch {
|
|
82
|
+
return segment;
|
|
83
|
+
}
|
|
84
|
+
})
|
|
85
|
+
.join("/");
|
|
86
|
+
}
|
|
87
|
+
//# sourceMappingURL=source.js.map
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { Machine } from "../index.ts";
|
|
2
|
+
import type { PluginCapabilityState, PluginGithubMetadata, PluginSource } from "./types.ts";
|
|
3
|
+
export interface InstalledRecord {
|
|
4
|
+
readonly id: string;
|
|
5
|
+
readonly root: string;
|
|
6
|
+
readonly source: PluginSource;
|
|
7
|
+
readonly enabled: boolean;
|
|
8
|
+
readonly installedAt: string;
|
|
9
|
+
readonly updatedAt?: string;
|
|
10
|
+
readonly originalSource?: string;
|
|
11
|
+
readonly capabilities?: PluginCapabilityState;
|
|
12
|
+
readonly github?: PluginGithubMetadata;
|
|
13
|
+
}
|
|
14
|
+
export interface InstalledFile {
|
|
15
|
+
readonly version: 1;
|
|
16
|
+
readonly plugins: readonly InstalledRecord[];
|
|
17
|
+
}
|
|
18
|
+
export declare function readInstalled(machine: Machine, homeDir: string): Promise<InstalledFile>;
|
|
19
|
+
export declare function writeInstalled(machine: Machine, homeDir: string, data: InstalledFile): Promise<void>;
|
|
20
|
+
//# sourceMappingURL=store.d.ts.map
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import path from "node:path";
|
|
2
|
+
import { readTextFile, writeTextFile } from "../tool/support/machine-ops.js";
|
|
3
|
+
const EMPTY = { version: 1, plugins: [] };
|
|
4
|
+
function installedPath(homeDir) {
|
|
5
|
+
return path.join(homeDir, "plugins", "installed.json");
|
|
6
|
+
}
|
|
7
|
+
export async function readInstalled(machine, homeDir) {
|
|
8
|
+
let text;
|
|
9
|
+
try {
|
|
10
|
+
text = await readTextFile(machine, installedPath(homeDir));
|
|
11
|
+
}
|
|
12
|
+
catch {
|
|
13
|
+
return EMPTY; // missing file → empty registry
|
|
14
|
+
}
|
|
15
|
+
try {
|
|
16
|
+
const parsed = JSON.parse(text);
|
|
17
|
+
if (typeof parsed !== "object" || parsed === null || !Array.isArray(parsed.plugins)) {
|
|
18
|
+
throw new Error("installed.json is not a valid InstalledFile object");
|
|
19
|
+
}
|
|
20
|
+
return parsed;
|
|
21
|
+
}
|
|
22
|
+
catch (error) {
|
|
23
|
+
throw new Error(`Failed to parse ${installedPath(homeDir)}: ${error.message}`, { cause: error });
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
export async function writeInstalled(machine, homeDir, data) {
|
|
27
|
+
await machine.mkdir(path.join(homeDir, "plugins"), { parents: true, existOk: true });
|
|
28
|
+
await writeTextFile(machine, installedPath(homeDir), JSON.stringify(data, null, 2));
|
|
29
|
+
}
|
|
30
|
+
//# sourceMappingURL=store.js.map
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
import type { HookDef } from "../capabilities/user-hooks/types.ts";
|
|
2
|
+
import type { McpServerConfig } from "../index.ts";
|
|
3
|
+
export type PluginDiagnosticSeverity = "error" | "warn" | "info";
|
|
4
|
+
export interface PluginDiagnostic {
|
|
5
|
+
readonly severity: PluginDiagnosticSeverity;
|
|
6
|
+
readonly message: string;
|
|
7
|
+
}
|
|
8
|
+
export interface PluginAuthor {
|
|
9
|
+
readonly name?: string;
|
|
10
|
+
readonly email?: string;
|
|
11
|
+
}
|
|
12
|
+
export interface PluginSessionStart {
|
|
13
|
+
readonly skill: string;
|
|
14
|
+
}
|
|
15
|
+
export interface PluginInterface {
|
|
16
|
+
readonly displayName?: string;
|
|
17
|
+
readonly shortDescription?: string;
|
|
18
|
+
readonly longDescription?: string;
|
|
19
|
+
}
|
|
20
|
+
export interface PluginManifest {
|
|
21
|
+
readonly name: string;
|
|
22
|
+
readonly version?: string;
|
|
23
|
+
readonly description?: string;
|
|
24
|
+
readonly keywords?: readonly string[];
|
|
25
|
+
readonly author?: PluginAuthor;
|
|
26
|
+
readonly homepage?: string;
|
|
27
|
+
readonly license?: string;
|
|
28
|
+
readonly skills?: readonly string[];
|
|
29
|
+
readonly sessionStart?: PluginSessionStart;
|
|
30
|
+
readonly mcpServers?: Readonly<Record<string, McpServerConfig>>;
|
|
31
|
+
/** Resolved shell hooks (PLUGIN_ROOT already expanded). Empty/omitted when none. */
|
|
32
|
+
readonly hooks?: readonly HookDef[];
|
|
33
|
+
readonly interface?: PluginInterface;
|
|
34
|
+
readonly skillInstructions?: string;
|
|
35
|
+
}
|
|
36
|
+
export interface PluginMcpServerState {
|
|
37
|
+
readonly enabled: boolean;
|
|
38
|
+
}
|
|
39
|
+
export interface PluginCapabilityState {
|
|
40
|
+
readonly mcpServers?: Readonly<Record<string, PluginMcpServerState>>;
|
|
41
|
+
}
|
|
42
|
+
export interface PluginMcpServerInfo {
|
|
43
|
+
readonly name: string;
|
|
44
|
+
readonly runtimeName: string;
|
|
45
|
+
readonly enabled: boolean;
|
|
46
|
+
readonly transport: "stdio" | "http";
|
|
47
|
+
readonly command?: string;
|
|
48
|
+
readonly args?: readonly string[];
|
|
49
|
+
readonly cwd?: string;
|
|
50
|
+
readonly url?: string;
|
|
51
|
+
readonly envKeys?: readonly string[];
|
|
52
|
+
readonly headerKeys?: readonly string[];
|
|
53
|
+
}
|
|
54
|
+
export type PluginSource = "local-path" | "zip-url" | "github";
|
|
55
|
+
export type PluginState = "ok" | "error";
|
|
56
|
+
export interface PluginGithubRef {
|
|
57
|
+
readonly kind: "branch" | "tag" | "sha";
|
|
58
|
+
readonly value: string;
|
|
59
|
+
}
|
|
60
|
+
export interface PluginGithubMetadata {
|
|
61
|
+
readonly owner: string;
|
|
62
|
+
readonly repo: string;
|
|
63
|
+
readonly ref?: PluginGithubRef;
|
|
64
|
+
}
|
|
65
|
+
export interface PluginRecord {
|
|
66
|
+
readonly id: string;
|
|
67
|
+
readonly root: string;
|
|
68
|
+
readonly source: PluginSource;
|
|
69
|
+
readonly enabled: boolean;
|
|
70
|
+
readonly state: PluginState;
|
|
71
|
+
readonly installedAt: string;
|
|
72
|
+
readonly updatedAt?: string;
|
|
73
|
+
readonly originalSource?: string;
|
|
74
|
+
readonly github?: PluginGithubMetadata;
|
|
75
|
+
readonly capabilities?: PluginCapabilityState;
|
|
76
|
+
readonly skillInstructions?: string;
|
|
77
|
+
readonly manifest?: PluginManifest;
|
|
78
|
+
readonly manifestPath?: string;
|
|
79
|
+
readonly diagnostics: readonly PluginDiagnostic[];
|
|
80
|
+
}
|
|
81
|
+
export interface PluginSummary {
|
|
82
|
+
readonly id: string;
|
|
83
|
+
readonly displayName: string;
|
|
84
|
+
readonly version?: string;
|
|
85
|
+
readonly enabled: boolean;
|
|
86
|
+
readonly state: PluginState;
|
|
87
|
+
readonly skillCount: number;
|
|
88
|
+
readonly mcpServerCount: number;
|
|
89
|
+
readonly enabledMcpServerCount: number;
|
|
90
|
+
readonly hasErrors: boolean;
|
|
91
|
+
readonly source: PluginSource;
|
|
92
|
+
readonly originalSource?: string;
|
|
93
|
+
readonly github?: PluginGithubMetadata;
|
|
94
|
+
}
|
|
95
|
+
export interface PluginInfo extends PluginSummary {
|
|
96
|
+
readonly root: string;
|
|
97
|
+
readonly installedAt: string;
|
|
98
|
+
readonly updatedAt?: string;
|
|
99
|
+
readonly manifestPath?: string;
|
|
100
|
+
readonly manifest?: PluginManifest;
|
|
101
|
+
readonly mcpServers: readonly PluginMcpServerInfo[];
|
|
102
|
+
readonly diagnostics: readonly PluginDiagnostic[];
|
|
103
|
+
}
|
|
104
|
+
export interface EnabledPluginSessionStart {
|
|
105
|
+
readonly pluginId: string;
|
|
106
|
+
readonly skillName: string;
|
|
107
|
+
}
|
|
108
|
+
export interface ReloadSummary {
|
|
109
|
+
readonly added: readonly string[];
|
|
110
|
+
readonly removed: readonly string[];
|
|
111
|
+
readonly errors: ReadonlyArray<{
|
|
112
|
+
readonly id: string;
|
|
113
|
+
readonly message: string;
|
|
114
|
+
}>;
|
|
115
|
+
}
|
|
116
|
+
export declare const PLUGIN_NAME_REGEX: RegExp;
|
|
117
|
+
export declare function normalizePluginId(name: string): string;
|
|
118
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export type { Message, UserMessage, AssistantMessage, ToolResultMessage, ToolCall, TextContent, ThinkingContent, ImageContent, Usage, Context, Model, Api, KnownApi, KnownProvider, ThinkingLevel, ThinkingBudgets, ProviderHeaders, Transport, Tool as PiTool, AssistantMessageEvent, AssistantMessageEventStream, } from "@earendil-works/pi-ai";
|
|
2
|
+
export type { ProviderId as Provider } from "@earendil-works/pi-ai";
|
|
3
|
+
export type { ToolSchema } from "./tool-schema.ts";
|
|
4
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import type { AgentRecord } from "./store.ts";
|
|
2
|
+
export declare function isBlobRef(value: string): boolean;
|
|
3
|
+
/** Raw byte I/O a {@link BlobStore} runs on. `diskBlobIO` is the filesystem implementation;
|
|
4
|
+
* pg/redis backends inject their own (a blob table / key namespace). */
|
|
5
|
+
export interface BlobIO {
|
|
6
|
+
read(sha: string): Promise<Buffer | undefined>;
|
|
7
|
+
write(sha: string, bytes: Buffer): Promise<void>;
|
|
8
|
+
}
|
|
9
|
+
export type BlobStoreOptions = ({
|
|
10
|
+
readonly blobsDir: string;
|
|
11
|
+
readonly io?: undefined;
|
|
12
|
+
} | {
|
|
13
|
+
readonly io: BlobIO;
|
|
14
|
+
readonly blobsDir?: undefined;
|
|
15
|
+
}) & {
|
|
16
|
+
/** Inline image `data` (base64) longer than this gets offloaded. Default 4096. */
|
|
17
|
+
readonly threshold?: number;
|
|
18
|
+
readonly maxCacheBytes?: number;
|
|
19
|
+
};
|
|
20
|
+
/** Filesystem {@link BlobIO}: content-addressed `<blobsDir>/<sha>.bin`, crash-safe via tmp+rename. */
|
|
21
|
+
export declare function diskBlobIO(blobsDir: string): BlobIO;
|
|
22
|
+
/**
|
|
23
|
+
* Content-addressed sidecar store for large inline content (images). Oversized base64 `data` is
|
|
24
|
+
* written to a {@link BlobIO} (filesystem, Postgres, Redis…) under its sha256 and the inline value
|
|
25
|
+
* is replaced with a `blobref:<sha256>` marker. Same bytes → same key (dedup). A bounded LRU keeps
|
|
26
|
+
* hot blobs in memory.
|
|
27
|
+
*/
|
|
28
|
+
export declare class BlobStore {
|
|
29
|
+
private readonly io;
|
|
30
|
+
private readonly threshold;
|
|
31
|
+
private readonly maxCacheBytes;
|
|
32
|
+
private readonly cache;
|
|
33
|
+
private cacheBytes;
|
|
34
|
+
constructor(options: BlobStoreOptions);
|
|
35
|
+
/** base64 `data` → `blobref:<sha>` if oversized; pass-through otherwise (incl. already-ref). */
|
|
36
|
+
offload(data: string): Promise<string>;
|
|
37
|
+
/** `blobref:<sha>` → base64 `data`; pass-through for inline values. */
|
|
38
|
+
load(data: string): Promise<string>;
|
|
39
|
+
private cachePut;
|
|
40
|
+
}
|
|
41
|
+
/** Replace oversized inline image data with blob refs (write side). */
|
|
42
|
+
export declare function offloadRecord(record: AgentRecord, blobs: BlobStore): Promise<AgentRecord>;
|
|
43
|
+
/** Replace blob refs with inline image data (read side). */
|
|
44
|
+
export declare function rehydrateRecord(record: AgentRecord, blobs: BlobStore): Promise<AgentRecord>;
|
|
45
|
+
//# sourceMappingURL=blob-store.d.ts.map
|