@theokit/sdk 1.6.2 → 1.8.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/CHANGELOG.md +193 -0
- package/bin/init-claude.mjs +34 -0
- package/claude-template/AGENTS.md +139 -0
- package/claude-template/CLAUDE.md +51 -0
- package/claude-template/dot-claude/rules/theokit-conventions.md +33 -0
- package/claude-template/dot-claude/settings.json +16 -0
- package/claude-template/dot-claude/skills/theokit-agent-core/SKILL.md +209 -0
- package/claude-template/dot-claude/skills/theokit-budget/SKILL.md +176 -0
- package/claude-template/dot-claude/skills/theokit-config/SKILL.md +139 -0
- package/claude-template/dot-claude/skills/theokit-cron/SKILL.md +148 -0
- package/claude-template/dot-claude/skills/theokit-di/SKILL.md +233 -0
- package/claude-template/dot-claude/skills/theokit-di-agent/SKILL.md +294 -0
- package/claude-template/dot-claude/skills/theokit-errors/SKILL.md +172 -0
- package/claude-template/dot-claude/skills/theokit-eval/SKILL.md +144 -0
- package/claude-template/dot-claude/skills/theokit-gateways/SKILL.md +209 -0
- package/claude-template/dot-claude/skills/theokit-memory/SKILL.md +176 -0
- package/claude-template/dot-claude/skills/theokit-rag/SKILL.md +226 -0
- package/claude-template/dot-claude/skills/theokit-streaming/SKILL.md +156 -0
- package/claude-template/dot-claude/skills/theokit-subscriptions/SKILL.md +148 -0
- package/claude-template/dot-claude/skills/theokit-tools/SKILL.md +170 -0
- package/claude-template/dot-claude/skills/theokit-workflows/SKILL.md +218 -0
- package/dist/a2a/agent-mailbox.d.cts +27 -0
- package/dist/a2a/agent-mailbox.d.ts +27 -0
- package/dist/a2a/index.cjs +16850 -0
- package/dist/a2a/index.cjs.map +1 -0
- package/dist/a2a/index.d.cts +9 -0
- package/dist/a2a/index.d.ts +9 -0
- package/dist/a2a/index.js +16844 -0
- package/dist/a2a/index.js.map +1 -0
- package/dist/a2a/message-bus.d.cts +27 -0
- package/dist/a2a/message-bus.d.ts +27 -0
- package/dist/a2a/subagent.d.cts +25 -0
- package/dist/a2a/subagent.d.ts +25 -0
- package/dist/a2a/types.d.cts +12 -0
- package/dist/a2a/types.d.ts +12 -0
- package/dist/agent.d.ts +1 -1
- package/dist/client/index.cjs +73 -0
- package/dist/client/index.cjs.map +1 -0
- package/dist/client/index.d.cts +7 -0
- package/dist/client/index.d.ts +7 -0
- package/dist/client/index.js +71 -0
- package/dist/client/index.js.map +1 -0
- package/dist/client/theokit-client.d.cts +18 -0
- package/dist/client/theokit-client.d.ts +18 -0
- package/dist/client/types.d.cts +19 -0
- package/dist/client/types.d.ts +19 -0
- package/dist/{run-DkCD5DeO.d.cts → cron-BnywDYLq.d.cts} +496 -910
- package/dist/{run-DkCD5DeO.d.ts → cron-CtZvJD9J.d.ts} +496 -910
- package/dist/cron.cjs +4285 -2893
- package/dist/cron.cjs.map +1 -1
- package/dist/cron.d.cts +2 -3
- package/dist/cron.d.ts +2 -71
- package/dist/cron.js +4289 -2897
- package/dist/cron.js.map +1 -1
- package/dist/{errors-CvAeEWgE.d.ts → errors-ChqOmFH1.d.cts} +52 -6
- package/dist/{errors-CK8brCJ1.d.cts → errors-DV9e0rcp.d.ts} +52 -6
- package/dist/errors.cjs +218 -3
- package/dist/errors.cjs.map +1 -1
- package/dist/errors.d.cts +2 -3
- package/dist/errors.d.ts +50 -4
- package/dist/errors.js +217 -4
- package/dist/errors.js.map +1 -1
- package/dist/eval.cjs +4285 -2893
- package/dist/eval.cjs.map +1 -1
- package/dist/eval.d.cts +35 -0
- package/dist/eval.js +4289 -2897
- package/dist/eval.js.map +1 -1
- package/dist/event-bus.d.ts +23 -0
- package/dist/index.cjs +5132 -4200
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +298 -278
- package/dist/index.d.ts +1898 -24
- package/dist/index.js +6441 -5509
- package/dist/index.js.map +1 -1
- package/dist/internal/agent-loop/loop-context-init.d.ts +2 -0
- package/dist/internal/agent-loop/tool-dispatch.d.ts +22 -1
- package/dist/internal/auth/api-key-validator.d.ts +46 -0
- package/dist/internal/llm/anthropic-shared.d.ts +8 -1
- package/dist/internal/llm/retry.d.ts +22 -0
- package/dist/internal/llm/types.d.ts +47 -1
- package/dist/internal/memory/active-memory-cache.d.ts +3 -3
- package/dist/internal/memory/active-memory-types.d.ts +8 -0
- package/dist/internal/memory/active-memory.d.ts +24 -20
- package/dist/internal/memory/adapters/azure-openai-embedding.d.ts +2 -0
- package/dist/internal/memory/adapters/cohere-embedding.d.ts +2 -0
- package/dist/internal/memory/adapters/gemini-embedding.d.ts +2 -0
- package/dist/internal/memory/adapters/jina-embedding.d.ts +2 -0
- package/dist/internal/memory/index-manager-contract.d.ts +26 -0
- package/dist/internal/memory/index-manager-dispatch.d.ts +1 -1
- package/dist/internal/memory/index-manager.d.ts +8 -26
- package/dist/internal/memory/{chunk-markdown.d.ts → storage/chunk-markdown.d.ts} +1 -1
- package/dist/internal/memory/{markdown-store.d.ts → storage/markdown-store.d.ts} +1 -1
- package/dist/internal/memory/{reader.d.ts → storage/reader.d.ts} +1 -1
- package/dist/internal/observability/context.d.cts +23 -0
- package/dist/internal/observability/context.d.ts +23 -0
- package/dist/internal/observability/index.cjs +38 -0
- package/dist/internal/observability/index.cjs.map +1 -0
- package/dist/internal/observability/index.d.cts +8 -0
- package/dist/internal/observability/index.d.ts +8 -0
- package/dist/internal/observability/index.js +33 -0
- package/dist/internal/observability/index.js.map +1 -0
- package/dist/internal/observability/tracer-loader.d.cts +20 -0
- package/dist/internal/persistence/conversation-storage-fs.d.cts +37 -0
- package/dist/internal/persistence/conversation-storage-memory.d.cts +24 -0
- package/dist/internal/persistence/credential-pool-store.d.cts +32 -0
- package/dist/internal/persistence/credential-pool-store.d.ts +32 -0
- package/dist/internal/persistence/cwd-mutex.d.cts +1 -0
- package/dist/internal/persistence/exclusive-create.d.cts +22 -0
- package/dist/internal/persistence/exclusive-create.d.ts +22 -0
- package/dist/internal/persistence/file-lock.d.cts +14 -0
- package/dist/internal/persistence/fts5-sanitize.d.cts +16 -0
- package/dist/internal/persistence/index.cjs +359 -0
- package/dist/internal/persistence/index.cjs.map +1 -0
- package/dist/internal/persistence/index.d.cts +20 -0
- package/dist/internal/persistence/index.d.ts +20 -0
- package/dist/internal/persistence/index.js +341 -0
- package/dist/internal/persistence/index.js.map +1 -0
- package/dist/internal/persistence/markdown-config-loader.d.cts +35 -0
- package/dist/internal/persistence/paths.d.cts +19 -0
- package/dist/internal/persistence/persistence-schema.d.cts +21 -0
- package/dist/internal/persistence/persistence-schema.d.ts +4 -0
- package/dist/internal/persistence/schema-version.d.cts +13 -0
- package/dist/internal/persistence/sqlite-cas.d.cts +25 -0
- package/dist/internal/persistence/sqlite-cas.d.ts +25 -0
- package/dist/internal/persistence/sqlite-wal.d.cts +10 -0
- package/dist/internal/plugins/context.d.cts +31 -0
- package/dist/internal/plugins/index.cjs +228 -0
- package/dist/internal/plugins/index.cjs.map +1 -0
- package/dist/internal/plugins/index.d.cts +8 -0
- package/dist/internal/plugins/index.d.ts +8 -0
- package/dist/internal/plugins/index.js +222 -0
- package/dist/internal/plugins/index.js.map +1 -0
- package/dist/internal/plugins/lifecycle.d.cts +14 -0
- package/dist/internal/plugins/lifecycle.d.ts +14 -0
- package/dist/internal/plugins/manager.d.cts +37 -0
- package/dist/internal/plugins/types.d.cts +102 -0
- package/dist/internal/providers/catalog-loader.d.ts +39 -0
- package/dist/internal/runtime/agent-session-store.d.ts +1 -1
- package/dist/internal/runtime/agent-session.d.ts +1 -0
- package/dist/internal/runtime/budget-tracker.d.ts +73 -0
- package/dist/internal/runtime/{context-manager.d.ts → context/context-manager.d.ts} +1 -1
- package/dist/internal/runtime/{fixture-events.d.ts → fixtures/fixture-events.d.ts} +1 -1
- package/dist/internal/runtime/{fixture-run-base.d.ts → fixtures/fixture-run-base.d.ts} +4 -4
- package/dist/internal/runtime/{fixture-scripts.d.ts → fixtures/fixture-scripts.d.ts} +1 -1
- package/dist/internal/runtime/local-agent-bootstrap.d.ts +2 -2
- package/dist/internal/runtime/local-agent-memory-provider.d.ts +57 -0
- package/dist/internal/runtime/memory-path-selector.d.ts +73 -0
- package/dist/internal/runtime/memory-provider.d.ts +165 -0
- package/dist/internal/runtime/{agent-registry.d.ts → registry/agent-registry-contract.d.ts} +15 -9
- package/dist/internal/runtime/registry/agent-registry.d.ts +7 -0
- package/dist/internal/runtime/{live-agent-registry.d.ts → registry/live-agent-registry.d.ts} +1 -1
- package/dist/internal/runtime/{run-registry.d.ts → registry/run-registry.d.ts} +1 -1
- package/dist/internal/runtime/session-types.d.ts +35 -0
- package/dist/internal/runtime/system-prompt/sources/skills-provider.d.ts +1 -0
- package/dist/internal/runtime/validate-response.d.ts +18 -0
- package/dist/internal/security/index.cjs +361 -0
- package/dist/internal/security/index.cjs.map +1 -0
- package/dist/internal/security/index.d.cts +11 -0
- package/dist/internal/security/index.js +350 -0
- package/dist/internal/security/index.js.map +1 -0
- package/dist/internal/security/path-guard.d.cts +59 -0
- package/dist/internal/security/path-guard.d.ts +3 -0
- package/dist/internal/security/redact.d.cts +21 -0
- package/dist/internal/security/secret-redactor.d.cts +1 -0
- package/dist/internal/security/secret-redactor.d.ts +1 -0
- package/dist/internal/security/test-reset.d.cts +10 -0
- package/dist/internal/security/test-reset.d.ts +10 -0
- package/dist/internal/telemetry/adapters/arize.d.ts +2 -0
- package/dist/internal/telemetry/adapters/braintrust.d.ts +2 -0
- package/dist/internal/telemetry/adapters/datadog.d.ts +2 -0
- package/dist/internal/telemetry/adapters/langsmith.d.ts +2 -0
- package/dist/internal/telemetry/span-names.d.ts +6 -0
- package/dist/internal/telemetry/tracer.d.ts +1 -0
- package/dist/internal/workflow/evented-executor.d.ts +42 -0
- package/dist/internal/workflow/scheduler.d.ts +23 -0
- package/dist/internal/zod/to-json-schema.d.ts +5 -15
- package/dist/job-queue.d.ts +28 -0
- package/dist/path-safety.cjs +67 -6
- package/dist/path-safety.cjs.map +1 -1
- package/dist/path-safety.d.cts +15 -0
- package/dist/path-safety.d.ts +1 -1
- package/dist/path-safety.js +67 -7
- package/dist/path-safety.js.map +1 -1
- package/dist/permission-engine.d.ts +21 -0
- package/dist/provider-catalog.json +702 -0
- package/dist/rag/index.cjs +136 -0
- package/dist/rag/index.cjs.map +1 -0
- package/dist/rag/index.d.cts +11 -0
- package/dist/rag/index.d.ts +11 -0
- package/dist/rag/index.js +129 -0
- package/dist/rag/index.js.map +1 -0
- package/dist/rag/reranker.d.cts +26 -0
- package/dist/rag/reranker.d.ts +26 -0
- package/dist/rag/retriever.d.cts +25 -0
- package/dist/rag/retriever.d.ts +25 -0
- package/dist/rag/text-splitter.d.cts +12 -0
- package/dist/rag/text-splitter.d.ts +12 -0
- package/dist/rag/types.d.cts +37 -0
- package/dist/rag/types.d.ts +37 -0
- package/dist/run-DrwUpFxZ.d.cts +823 -0
- package/dist/run-DrwUpFxZ.d.ts +823 -0
- package/dist/sandbox/index.cjs +133 -0
- package/dist/sandbox/index.cjs.map +1 -0
- package/dist/sandbox/index.d.cts +2 -0
- package/dist/sandbox/index.d.ts +2 -0
- package/dist/sandbox/index.js +128 -0
- package/dist/sandbox/index.js.map +1 -0
- package/dist/sandbox/local-sandbox.d.cts +17 -0
- package/dist/sandbox/local-sandbox.d.ts +17 -0
- package/dist/sandbox/types.d.cts +44 -0
- package/dist/sandbox/types.d.ts +44 -0
- package/dist/server/adapter/express.d.cts +9 -0
- package/dist/server/adapter/express.d.ts +9 -0
- package/dist/server/adapter/fastify.d.cts +9 -0
- package/dist/server/adapter/fastify.d.ts +9 -0
- package/dist/server/adapter/hono.d.cts +9 -0
- package/dist/server/adapter/hono.d.ts +9 -0
- package/dist/server/adapter/index.d.cts +8 -0
- package/dist/server/adapter/index.d.ts +8 -0
- package/dist/server/adapter/shared-handler.d.cts +9 -0
- package/dist/server/adapter/shared-handler.d.ts +9 -0
- package/dist/server/adapter/types.d.cts +33 -0
- package/dist/server/adapter/types.d.ts +33 -0
- package/dist/server/auth/errors.d.cts +53 -0
- package/dist/server/auth/errors.d.ts +53 -0
- package/dist/server/auth/index.cjs +38 -41
- package/dist/server/auth/index.cjs.map +1 -1
- package/dist/server/auth/index.d.cts +11 -172
- package/dist/server/auth/index.d.ts +11 -172
- package/dist/server/auth/index.js +39 -42
- package/dist/server/auth/index.js.map +1 -1
- package/dist/server/auth/oauth-transaction-store.d.cts +39 -0
- package/dist/server/auth/oauth-transaction-store.d.ts +39 -0
- package/dist/server/auth/orchestrator.d.cts +8 -0
- package/dist/server/auth/orchestrator.d.ts +8 -0
- package/dist/server/auth/types.d.cts +91 -0
- package/dist/server/auth/types.d.ts +91 -0
- package/dist/server/auth/validate-return-to.d.cts +17 -0
- package/dist/server/auth/validate-return-to.d.ts +17 -0
- package/dist/server/errors-envelope.cjs +409 -0
- package/dist/server/errors-envelope.cjs.map +1 -0
- package/dist/server/errors-envelope.d.cts +61 -0
- package/dist/server/errors-envelope.d.ts +61 -0
- package/dist/server/errors-envelope.js +405 -0
- package/dist/server/errors-envelope.js.map +1 -0
- package/dist/subscription/define-subscription.d.cts +63 -0
- package/dist/subscription/define-subscription.d.ts +63 -0
- package/dist/subscription/index.cjs +402 -0
- package/dist/subscription/index.cjs.map +1 -0
- package/dist/subscription/index.d.cts +18 -0
- package/dist/subscription/index.d.ts +18 -0
- package/dist/subscription/index.js +394 -0
- package/dist/subscription/index.js.map +1 -0
- package/dist/subscription/internal/adapter-types.d.cts +11 -0
- package/dist/subscription/internal/adapter-types.d.ts +11 -0
- package/dist/subscription/internal/backpressure.d.cts +24 -0
- package/dist/subscription/internal/backpressure.d.ts +24 -0
- package/dist/subscription/internal/server-integration.d.cts +17 -0
- package/dist/subscription/internal/server-integration.d.ts +17 -0
- package/dist/subscription/internal/sse-encoder.d.cts +13 -0
- package/dist/subscription/internal/sse-encoder.d.ts +13 -0
- package/dist/subscription/internal/sse-parser.d.cts +15 -0
- package/dist/subscription/internal/sse-parser.d.ts +15 -0
- package/dist/subscription/internal/subscription-runtime.d.cts +9 -0
- package/dist/subscription/internal/subscription-runtime.d.ts +9 -0
- package/dist/subscription/internal/ws-adapter-node.d.cts +10 -0
- package/dist/subscription/internal/ws-adapter-node.d.ts +10 -0
- package/dist/subscription/theokit-subscribe.d.cts +41 -0
- package/dist/subscription/theokit-subscribe.d.ts +41 -0
- package/dist/subscription/types.d.cts +140 -0
- package/dist/subscription/types.d.ts +140 -0
- package/dist/task-store.cjs +30 -2
- package/dist/task-store.cjs.map +1 -1
- package/dist/task-store.d.cts +8 -0
- package/dist/task-store.js +31 -3
- package/dist/task-store.js.map +1 -1
- package/dist/types/agent-prims.d.ts +61 -0
- package/dist/types/agent.d.ts +48 -53
- package/dist/types/conversation.d.ts +20 -8
- package/dist/types/index.d.ts +0 -2
- package/dist/types/messages-base.d.ts +20 -0
- package/dist/types/messages.d.ts +1 -1
- package/dist/types/run.d.ts +1 -1
- package/dist/types/updates.d.ts +1 -1
- package/dist/voice/index.d.ts +7 -0
- package/dist/voice/openai-realtime.d.ts +21 -0
- package/dist/voice/types.d.ts +35 -0
- package/dist/workflow.cjs +179 -88
- package/dist/workflow.cjs.map +1 -1
- package/dist/workflow.d.cts +97 -0
- package/dist/workflow.js +180 -89
- package/dist/workflow.js.map +1 -1
- package/package.json +128 -25
- package/dist/budget.d.ts +0 -48
- package/dist/cache.d.ts +0 -74
- package/dist/cron-1yxL3K2S.d.cts +0 -221
- package/dist/cron-BYVdYzob.d.ts +0 -221
- package/dist/handoff.d.ts +0 -55
- package/dist/internal/budget/calendar-window.d.ts +0 -19
- package/dist/internal/budget/enforcement.d.ts +0 -32
- package/dist/internal/budget/ledger.d.ts +0 -25
- package/dist/internal/budget/normalize-usage.d.ts +0 -27
- package/dist/internal/budget/registry.d.ts +0 -16
- package/dist/internal/cache/cosine.d.ts +0 -14
- package/dist/internal/cache/embed-helper.d.ts +0 -15
- package/dist/internal/cache/key.d.ts +0 -15
- package/dist/internal/cache/lookup.d.ts +0 -28
- package/dist/internal/cache/store-handler.d.ts +0 -24
- package/dist/internal/cache/store-json.d.ts +0 -48
- package/dist/internal/cache/store.d.ts +0 -54
- package/dist/internal/cache/telemetry.d.ts +0 -20
- package/dist/internal/cache/ttl.d.ts +0 -11
- package/dist/internal/catalog/fixtures.d.ts +0 -16
- package/dist/internal/catalog/local-models.d.ts +0 -24
- package/dist/internal/handoff/dispatcher.d.ts +0 -29
- package/dist/internal/handoff/registry.d.ts +0 -23
- package/dist/internal/handoff/telemetry.d.ts +0 -18
- package/dist/internal/handoff/tool-injector.d.ts +0 -34
- package/dist/internal/memory/atomic-write.d.ts +0 -7
- package/dist/internal/memory/dreaming/diary.d.ts +0 -4
- package/dist/internal/memory/dreaming/phases.d.ts +0 -15
- package/dist/internal/memory/dreaming/run.d.ts +0 -10
- package/dist/internal/memory/migrate-sqlite-to-lance.d.ts +0 -15
- package/dist/memory-adapter-helpers.d.ts +0 -28
- package/dist/memory.d.ts +0 -123
- package/dist/migrate.d.ts +0 -33
- package/dist/security.d.ts +0 -67
- package/dist/task.d.ts +0 -87
- package/dist/theokit.d.ts +0 -84
- package/dist/tools/_path-scope.d.ts +0 -8
- package/dist/tools/_subprocess.d.ts +0 -28
- package/dist/tools/git-diff.d.ts +0 -22
- package/dist/tools/index.d.ts +0 -29
- package/dist/tools/list-dir.d.ts +0 -26
- package/dist/tools/read-file.d.ts +0 -31
- package/dist/tools/run-vitest.d.ts +0 -46
- package/dist/tools/search-text.d.ts +0 -32
- package/dist/tools.cjs +0 -690
- package/dist/tools.cjs.map +0 -1
- package/dist/tools.js +0 -683
- package/dist/tools.js.map +0 -1
- package/dist/trajectory-helpers.d.ts +0 -31
- package/dist/types/cache.d.ts +0 -76
- package/dist/types/handoff.d.ts +0 -135
- /package/dist/{internal/cron/run-job.d.ts → agent-helpers.d.ts} +0 -0
- /package/dist/internal/{cron/scheduler.d.ts → agent-loop/loop-llm-stream.d.ts} +0 -0
- /package/dist/internal/{cron/store.d.ts → agent-loop/tool-executors.d.ts} +0 -0
- /package/dist/internal/{cron/validate.d.ts → memory/index-manager-helpers.d.ts} +0 -0
- /package/dist/internal/memory/{session-loader.d.ts → storage/session-loader.d.ts} +0 -0
- /package/dist/internal/memory/{session-summary-writer.d.ts → storage/session-summary-writer.d.ts} +0 -0
- /package/dist/internal/memory/{transcript-store.d.ts → storage/transcript-store.d.ts} +0 -0
- /package/dist/internal/memory/{wiki-loader.d.ts → storage/wiki-loader.d.ts} +0 -0
- /package/dist/internal/{memory/cwd-mutex.d.ts → persistence/atomic-write.d.cts} +0 -0
- /package/dist/internal/runtime/{context-aggregator.d.ts → context/context-aggregator.d.ts} +0 -0
- /package/dist/internal/runtime/{context-discovery-runner.d.ts → context/context-discovery-runner.d.ts} +0 -0
- /package/dist/internal/runtime/{context-discovery.d.ts → context/context-discovery.d.ts} +0 -0
- /package/dist/internal/runtime/{context-frontmatter.d.ts → context/context-frontmatter.d.ts} +0 -0
- /package/dist/internal/runtime/{context-import-resolver.d.ts → context/context-import-resolver.d.ts} +0 -0
- /package/dist/internal/runtime/{context-loaders.d.ts → context/context-loaders.d.ts} +0 -0
- /package/dist/internal/runtime/{context-mdc-parser.d.ts → context/context-mdc-parser.d.ts} +0 -0
- /package/dist/internal/runtime/{fixture-responder.d.ts → fixtures/fixture-responder.d.ts} +0 -0
- /package/dist/internal/runtime/{fixture-types.d.ts → fixtures/fixture-types.d.ts} +0 -0
- /package/dist/internal/runtime/{plugins-manager.d.ts → local-agent-send.d.ts} +0 -0
- /package/dist/internal/runtime/{plugin-frontmatter.d.ts → plugins/plugin-frontmatter.d.ts} +0 -0
- /package/dist/internal/runtime/{system-prompt/providers/active-memory-provider.d.ts → plugins/plugins-manager.d.ts} +0 -0
- /package/dist/internal/runtime/{agent-factory-registry.d.ts → registry/agent-factory-registry.d.ts} +0 -0
- /package/dist/internal/runtime/{agent-registry-store.d.ts → registry/agent-registry-store.d.ts} +0 -0
- /package/dist/internal/runtime/system-prompt/{providers/base-provider.d.ts → sources/active-memory-provider.d.ts} +0 -0
- /package/dist/internal/runtime/system-prompt/{providers/context-provider.d.ts → sources/base-provider.d.ts} +0 -0
- /package/dist/internal/runtime/system-prompt/{providers/memory-provider.d.ts → sources/context-provider.d.ts} +0 -0
- /package/dist/internal/runtime/system-prompt/{providers/skills-provider.d.ts → sources/memory-provider.d.ts} +0 -0
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Local model discovery via OpenAI-compatible `/v1/models` endpoint
|
|
3
|
-
* (T2.1, ADR D184).
|
|
4
|
-
*
|
|
5
|
-
* Used by `Theokit.models.list({ provider: "ollama" })` (and any other
|
|
6
|
-
* future provider with `authType: "none"` exposing the OpenAI-shape
|
|
7
|
-
* models endpoint — LM Studio, llama.cpp `./server`, vLLM, etc.) to
|
|
8
|
-
* enumerate locally-installed models without a cloud round-trip.
|
|
9
|
-
*
|
|
10
|
-
* Aligned with OpenClaw `extensions/ollama/src/provider-models.ts` which
|
|
11
|
-
* targets the same endpoint shape. Mirrors the relevant Hermes
|
|
12
|
-
* `models.dev` catalog behavior for local providers.
|
|
13
|
-
*
|
|
14
|
-
* @internal
|
|
15
|
-
*/
|
|
16
|
-
import type { SDKModel } from "../../types/theokit.js";
|
|
17
|
-
/**
|
|
18
|
-
* Fetch and map `<baseUrl>/v1/models` → `SDKModel[]`. Throws a typed
|
|
19
|
-
* `ConfigurationError` on connection failures (ECONNREFUSED → "Run
|
|
20
|
-
* `ollama serve`"). Returns `[]` when the body is unparseable —
|
|
21
|
-
* defensive choice over crashing on malformed responses from
|
|
22
|
-
* non-standard local runtimes.
|
|
23
|
-
*/
|
|
24
|
-
export declare function listLocalModelsViaOpenAiCompat(baseUrl: string): Promise<SDKModel[]>;
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Handoff dispatch orchestration.
|
|
3
|
-
*
|
|
4
|
-
* Pragmatic v1: when a handoff fires, the sender calls `receiver.send()`
|
|
5
|
-
* with the (optionally filtered) history. The receiver's reply is returned
|
|
6
|
-
* to the sender, which captures it as the answer to the user's question.
|
|
7
|
-
*
|
|
8
|
-
* NOTE: this is NOT pure peer-to-peer (the sender stays on the call stack
|
|
9
|
-
* until the receiver returns). Pure intercept-and-swap requires deeper
|
|
10
|
-
* agent-loop refactor; deferred to v2. v1 still validates the user-facing
|
|
11
|
-
* value: "agent A reasoned about routing, agent B answered."
|
|
12
|
-
*
|
|
13
|
-
* @internal
|
|
14
|
-
*/
|
|
15
|
-
import type { HandoffDescriptor, HandoffHistory, HandoffResult } from "../../types/handoff.js";
|
|
16
|
-
import { type HandoffChainState } from "./registry.js";
|
|
17
|
-
export declare function dispatchHandoff(args: {
|
|
18
|
-
descriptor: HandoffDescriptor;
|
|
19
|
-
senderAgentId: string;
|
|
20
|
-
chainState: HandoffChainState;
|
|
21
|
-
rawInputJson: unknown;
|
|
22
|
-
/** The conversation so far (history wrapper). v1: just the LAST user message. */
|
|
23
|
-
history: HandoffHistory;
|
|
24
|
-
/** Override the message text sent to the receiver. Used by `Agent.handoffTo` imperative. */
|
|
25
|
-
messageOverride?: string;
|
|
26
|
-
}): Promise<{
|
|
27
|
-
reply: string;
|
|
28
|
-
result: HandoffResult;
|
|
29
|
-
}>;
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Handoff registry — pure state container per `Agent` instance.
|
|
3
|
-
*
|
|
4
|
-
* Holds the active dispatch chain (for depth + pair tracking) across the
|
|
5
|
-
* lifetime of a single `agent.send()` call. Cleared between calls.
|
|
6
|
-
*
|
|
7
|
-
* @internal
|
|
8
|
-
*/
|
|
9
|
-
export interface HandoffChainState {
|
|
10
|
-
/** Ordered chain of agentIds traversed so far (oldest first). */
|
|
11
|
-
readonly chain: string[];
|
|
12
|
-
/** Set of "<sender>-><receiver>" keys for pair-level loop detection (D221). */
|
|
13
|
-
readonly seenPairs: Set<string>;
|
|
14
|
-
/** Caller-supplied max depth (D218). */
|
|
15
|
-
readonly maxDepth: number;
|
|
16
|
-
}
|
|
17
|
-
export declare function createChainState(rootAgentId: string, maxDepth: number): HandoffChainState;
|
|
18
|
-
/**
|
|
19
|
-
* Record a handoff hop. Throws on depth-exceed (D218) or pair-loop (D221).
|
|
20
|
-
* Mutates the state in place.
|
|
21
|
-
*/
|
|
22
|
-
export declare function recordHop(state: HandoffChainState, senderAgentId: string, receiverAgentId: string): void;
|
|
23
|
-
export declare function currentDepth(state: HandoffChainState): number;
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* D220 — Lazy-loaded OTel `handoff.transfer` span emitter.
|
|
3
|
-
*
|
|
4
|
-
* @internal
|
|
5
|
-
*/
|
|
6
|
-
export interface HandoffSpanHandle {
|
|
7
|
-
setAttribute(key: string, value: string | number | boolean): void;
|
|
8
|
-
end(): void;
|
|
9
|
-
}
|
|
10
|
-
export declare function startHandoffSpan(attrs: {
|
|
11
|
-
from: string;
|
|
12
|
-
to: string;
|
|
13
|
-
reason: string;
|
|
14
|
-
depth: number;
|
|
15
|
-
toolName: string;
|
|
16
|
-
}): HandoffSpanHandle;
|
|
17
|
-
/** Test-only — reset cached OTel handle. */
|
|
18
|
-
export declare function __resetHandoffOtelCacheForTests(): void;
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Convert `handoffs[]` entries into synthetic `transfer_to_<receiver>` tools
|
|
3
|
-
* for injection into the agent's tool registry at construction time.
|
|
4
|
-
*
|
|
5
|
-
* The synthesized tool's handler calls `dispatchHandoff` internally and
|
|
6
|
-
* returns the receiver's reply as `tool_result`. v1 trade-off documented
|
|
7
|
-
* in dispatcher.ts.
|
|
8
|
-
*
|
|
9
|
-
* @internal
|
|
10
|
-
*/
|
|
11
|
-
import type { CustomTool, SDKAgent } from "../../types/agent.js";
|
|
12
|
-
import { type HandoffDescriptor } from "../../types/handoff.js";
|
|
13
|
-
interface NormalizedHandoff {
|
|
14
|
-
descriptor: HandoffDescriptor;
|
|
15
|
-
}
|
|
16
|
-
/**
|
|
17
|
-
* Normalize each `handoffs[]` entry to a `HandoffDescriptor`. Raw `SDKAgent`
|
|
18
|
-
* instances are auto-wrapped with default options. Validates:
|
|
19
|
-
* - EC-6: no self-reference (would cause infinite recursion).
|
|
20
|
-
* - D215: resolved tool names must be unique.
|
|
21
|
-
*/
|
|
22
|
-
export declare function normalizeHandoffs(parentAgentId: string, entries: ReadonlyArray<SDKAgent | HandoffDescriptor>): NormalizedHandoff[];
|
|
23
|
-
/**
|
|
24
|
-
* Build a `CustomTool` for one handoff descriptor. The handler dispatches
|
|
25
|
-
* the handoff using a fresh chain state per `send()`-level invocation.
|
|
26
|
-
*
|
|
27
|
-
* NOTE: this v1 builds a NEW chain state per tool invocation. Pure
|
|
28
|
-
* cross-tool depth tracking within one send() requires per-Agent context
|
|
29
|
-
* — deferred. The single-flight pair guard catches direct ping-pong even
|
|
30
|
-
* without cross-invocation chain (since each call wraps the same depth
|
|
31
|
-
* counter from 1).
|
|
32
|
-
*/
|
|
33
|
-
export declare function buildHandoffTool(parentAgentId: string, descriptor: HandoffDescriptor, maxHandoffDepth: number): CustomTool;
|
|
34
|
-
export {};
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
export declare function diaryPath(cwd: string): string;
|
|
2
|
-
export declare function renderDiaryEntry(entry: DiaryEntry): string;
|
|
3
|
-
export declare function appendDiaryEntry(cwd: string, entry: DiaryEntry): Promise<void>;
|
|
4
|
-
export declare function entryHash(entry: DiaryEntry): string;
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import type { EmbeddingRuntime } from "../embedding-adapter.js";
|
|
2
|
-
import type { MemoryFact } from "../types.js";
|
|
3
|
-
export interface Cluster {
|
|
4
|
-
representativeText: string;
|
|
5
|
-
members: ReadonlyArray<MemoryFact>;
|
|
6
|
-
}
|
|
7
|
-
export interface ClusterResult {
|
|
8
|
-
clusters: Cluster[];
|
|
9
|
-
}
|
|
10
|
-
/** Light phase — drop facts whose embedding is too similar to one already kept. */
|
|
11
|
-
export declare function lightPhase(facts: ReadonlyArray<MemoryFact>, embedding: EmbeddingRuntime, threshold?: number): Promise<DedupResult>;
|
|
12
|
-
/** REM phase — single-link agglomerative clustering by cosine similarity. */
|
|
13
|
-
export declare function remPhase(facts: ReadonlyArray<MemoryFact>, embedding: EmbeddingRuntime, threshold?: number): Promise<ClusterResult>;
|
|
14
|
-
/** Deep phase — render consolidated markdown for the dreamed note. */
|
|
15
|
-
export declare function deepPhase(clusters: ReadonlyArray<Cluster>, timestampMs: number): string;
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
export interface DreamingResult {
|
|
2
|
-
status: "ok" | "skipped" | "error";
|
|
3
|
-
factsBefore: number;
|
|
4
|
-
factsAfter: number;
|
|
5
|
-
duplicatesRemoved: number;
|
|
6
|
-
clustersCreated: number;
|
|
7
|
-
notesWritten: number;
|
|
8
|
-
diaryEntryHash: string | undefined;
|
|
9
|
-
}
|
|
10
|
-
export declare function runDreamingSweep(options: DreamingOptions): Promise<DreamingResult>;
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
export interface MigrateResult {
|
|
2
|
-
countSqlite: number;
|
|
3
|
-
countLance: number;
|
|
4
|
-
/** Set when validation succeeded (or dryRun); false on validation failure. */
|
|
5
|
-
validated: boolean;
|
|
6
|
-
/** Per-fact compare results (size = sample count, up to 10). */
|
|
7
|
-
sampleComparisons: ReadonlyArray<{
|
|
8
|
-
id: string;
|
|
9
|
-
match: boolean;
|
|
10
|
-
}>;
|
|
11
|
-
/** Lance storage location (final, after migration). */
|
|
12
|
-
lancePath: string;
|
|
13
|
-
/** Was the migration committed (false for dry-run). */
|
|
14
|
-
committed: boolean;
|
|
15
|
-
}
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Runtime helpers for `MemoryAdapter` (T1.1, ADR D141).
|
|
3
|
-
*
|
|
4
|
-
* Kept separate from `types/memory-adapter.ts` so the types module
|
|
5
|
-
* stays import-free of runtime code (dep-cruise rule
|
|
6
|
-
* `types-dont-import-runtime`). Adapter authors call `mkMemoryId` to
|
|
7
|
-
* construct a branded id and `extractRawId` to unwrap with cross-adapter
|
|
8
|
-
* safety (EC-B).
|
|
9
|
-
*
|
|
10
|
-
* @public
|
|
11
|
-
*/
|
|
12
|
-
import type { MemoryId } from "./types/memory-adapter.js";
|
|
13
|
-
/**
|
|
14
|
-
* Construct a branded `MemoryId` for an adapter. Embeds the adapter
|
|
15
|
-
* identifier so `extractRawId` can reject ids minted by other adapters.
|
|
16
|
-
*
|
|
17
|
-
* @public
|
|
18
|
-
*/
|
|
19
|
-
export declare function mkMemoryId(adapterId: string, rawId: string): MemoryId;
|
|
20
|
-
/**
|
|
21
|
-
* Extract the raw provider id from a `MemoryId`, enforcing that the
|
|
22
|
-
* prefix matches `expectedAdapterId`. Throws `MemoryAdapterError(code:
|
|
23
|
-
* "invalid_input")` on mismatch — prevents `mem0.delete(supermemoryId)`
|
|
24
|
-
* from accidentally deleting unrelated data (EC-B).
|
|
25
|
-
*
|
|
26
|
-
* @public
|
|
27
|
-
*/
|
|
28
|
-
export declare function extractRawId(id: MemoryId, expectedAdapterId: string): string;
|
package/dist/memory.d.ts
DELETED
|
@@ -1,123 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Public handle to an open memory index. Mirrors the internal `MemoryIndex`
|
|
3
|
-
* contract structurally; defined here (NOT re-exported from internal/) so
|
|
4
|
-
* the public DTS surface does not pull the internal/runtime cycle that
|
|
5
|
-
* trips rollup-plugin-dts.
|
|
6
|
-
*
|
|
7
|
-
* @public
|
|
8
|
-
*/
|
|
9
|
-
export interface MemoryIndexHandle {
|
|
10
|
-
sync(): Promise<{
|
|
11
|
-
filesScanned: number;
|
|
12
|
-
filesUpdated: number;
|
|
13
|
-
chunksWritten: number;
|
|
14
|
-
chunksEmbedded: number;
|
|
15
|
-
}>;
|
|
16
|
-
search(query: string, options?: {
|
|
17
|
-
maxResults?: number;
|
|
18
|
-
minScore?: number;
|
|
19
|
-
sources?: ReadonlyArray<"memory" | "sessions" | "wiki">;
|
|
20
|
-
}): Promise<ReadonlyArray<{
|
|
21
|
-
path: string;
|
|
22
|
-
startLine: number;
|
|
23
|
-
endLine: number;
|
|
24
|
-
score: number;
|
|
25
|
-
textScore: number;
|
|
26
|
-
vectorScore?: number;
|
|
27
|
-
snippet: string;
|
|
28
|
-
source: "memory" | "sessions" | "wiki";
|
|
29
|
-
citation: string;
|
|
30
|
-
}>>;
|
|
31
|
-
status(): {
|
|
32
|
-
backend: "fts-only" | "hybrid";
|
|
33
|
-
filesIndexed: number;
|
|
34
|
-
chunksIndexed: number;
|
|
35
|
-
lastSyncMs?: number;
|
|
36
|
-
};
|
|
37
|
-
close(): Promise<void> | void;
|
|
38
|
-
}
|
|
39
|
-
/**
|
|
40
|
-
* Public `Memory` namespace.
|
|
41
|
-
*
|
|
42
|
-
* Exposes operations users can run outside of `agent.send()` — most notably
|
|
43
|
-
* the dreaming sweep (consolidation of facts via dedup + clustering).
|
|
44
|
-
*
|
|
45
|
-
* @public
|
|
46
|
-
*/
|
|
47
|
-
export interface DreamingSweepOptions {
|
|
48
|
-
/** Workspace cwd holding `.theokit/memory/`. */
|
|
49
|
-
cwd: string;
|
|
50
|
-
/**
|
|
51
|
-
* Embedding provider for semantic dedup + clustering. Required — dreaming
|
|
52
|
-
* relies on real embeddings to score cosine similarity. Supported providers:
|
|
53
|
-
* `"openai"`, `"mistral"`, `"openrouter"`, `"voyage"`, `"deepinfra"`,
|
|
54
|
-
* `"ollama"` (local, ADR D183).
|
|
55
|
-
*/
|
|
56
|
-
embedding: {
|
|
57
|
-
provider: "openai" | "mistral" | "openrouter" | "voyage" | "deepinfra" | "ollama";
|
|
58
|
-
model?: string;
|
|
59
|
-
};
|
|
60
|
-
/** Cosine-similarity threshold for the dedup phase. Default `0.95`. */
|
|
61
|
-
dedupThreshold?: number;
|
|
62
|
-
/** Cosine-similarity threshold for the clustering phase. Default `0.75`. */
|
|
63
|
-
clusterThreshold?: number;
|
|
64
|
-
}
|
|
65
|
-
export interface DreamingSweepResult {
|
|
66
|
-
status: "ok" | "skipped" | "error";
|
|
67
|
-
factsBefore: number;
|
|
68
|
-
factsAfter: number;
|
|
69
|
-
duplicatesRemoved: number;
|
|
70
|
-
clustersCreated: number;
|
|
71
|
-
notesWritten: number;
|
|
72
|
-
}
|
|
73
|
-
/**
|
|
74
|
-
* Options for `Memory.openIndex`. Mirrors the internal `OpenIndexOptions`
|
|
75
|
-
* but using only public types from the SDK surface.
|
|
76
|
-
*
|
|
77
|
-
* @public
|
|
78
|
-
*/
|
|
79
|
-
export interface OpenMemoryIndexOptions {
|
|
80
|
-
/** Workspace cwd holding `.theokit/memory/`. */
|
|
81
|
-
cwd: string;
|
|
82
|
-
/** Override storage file path (SQLite) OR storage directory (Lance). */
|
|
83
|
-
filePath?: string;
|
|
84
|
-
/**
|
|
85
|
-
* Embedding runtime — REQUIRED for `backend: "lance"`, optional for
|
|
86
|
-
* `"sqlite-vec"` (when omitted, SQLite runs FTS-only without vector
|
|
87
|
-
* recall).
|
|
88
|
-
*/
|
|
89
|
-
embedding?: {
|
|
90
|
-
provider: "openai" | "mistral" | "openrouter" | "voyage" | "deepinfra" | "ollama";
|
|
91
|
-
model?: string;
|
|
92
|
-
};
|
|
93
|
-
/** Default `"sqlite-vec"`. Set to `"lance"` to opt into LanceDB (peer dep). */
|
|
94
|
-
backend?: "sqlite-vec" | "lance";
|
|
95
|
-
}
|
|
96
|
-
export declare const Memory: {
|
|
97
|
-
/**
|
|
98
|
-
* Open a memory index. Dispatches to SQLite-vec (default, zero deps) or
|
|
99
|
-
* LanceDB (opt-in via `backend: "lance"`, requires `@lancedb/lancedb`
|
|
100
|
-
* peer dep + an embedding runtime).
|
|
101
|
-
*
|
|
102
|
-
* Returns a `MemoryIndex` with `sync()`, `search(query, opts?)`,
|
|
103
|
-
* `status()`, and `close()`. Use this when you want a direct index
|
|
104
|
-
* handle outside of `Agent.create({ memory: ... })`.
|
|
105
|
-
*
|
|
106
|
-
* @throws ConfigurationError({code:"invalid_memory_backend"}) for typos
|
|
107
|
-
* like `"lancedb"`.
|
|
108
|
-
* @throws ConfigurationError({code:"lance_requires_embedding"}) when
|
|
109
|
-
* `backend: "lance"` is requested without `embedding`.
|
|
110
|
-
* @throws ConfigurationError({code:"lance_backend_unavailable"}) when
|
|
111
|
-
* `backend: "lance"` is requested but the peer dep is absent.
|
|
112
|
-
*
|
|
113
|
-
* @public
|
|
114
|
-
*/
|
|
115
|
-
openIndex(opts: OpenMemoryIndexOptions): Promise<MemoryIndexHandle>;
|
|
116
|
-
/**
|
|
117
|
-
* Run a dreaming sweep: dedup near-duplicate facts, cluster thematically
|
|
118
|
-
* related ones, and write a consolidated note + diary entry.
|
|
119
|
-
*
|
|
120
|
-
* @public
|
|
121
|
-
*/
|
|
122
|
-
runDreamingSweep(opts: DreamingSweepOptions): Promise<DreamingSweepResult>;
|
|
123
|
-
};
|
package/dist/migrate.d.ts
DELETED
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Options for {@link migrateSqliteToLance}.
|
|
3
|
-
*
|
|
4
|
-
* @public
|
|
5
|
-
*/
|
|
6
|
-
export interface MigrateOptions {
|
|
7
|
-
cwd: string;
|
|
8
|
-
dryRun?: boolean;
|
|
9
|
-
batchSize?: number;
|
|
10
|
-
logger?: (msg: string) => void;
|
|
11
|
-
}
|
|
12
|
-
/**
|
|
13
|
-
* Outcome of {@link migrateSqliteToLance}.
|
|
14
|
-
*
|
|
15
|
-
* @public
|
|
16
|
-
*/
|
|
17
|
-
export interface MigrateResult {
|
|
18
|
-
countSqlite: number;
|
|
19
|
-
countLance: number;
|
|
20
|
-
validated: boolean;
|
|
21
|
-
sampleComparisons: ReadonlyArray<{
|
|
22
|
-
id: string;
|
|
23
|
-
match: boolean;
|
|
24
|
-
}>;
|
|
25
|
-
lancePath: string;
|
|
26
|
-
committed: boolean;
|
|
27
|
-
}
|
|
28
|
-
/**
|
|
29
|
-
* Migrate the Memory index from SQLite to LanceDB. ADR D44.
|
|
30
|
-
*
|
|
31
|
-
* @public
|
|
32
|
-
*/
|
|
33
|
-
export declare function migrateSqliteToLance(options: MigrateOptions): Promise<MigrateResult>;
|
package/dist/security.d.ts
DELETED
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Public security namespace (T2.1, ADR D68).
|
|
3
|
-
*
|
|
4
|
-
* Two entry points:
|
|
5
|
-
*
|
|
6
|
-
* - `Security.redact(text, opts?)` — apply the canonical redactor to
|
|
7
|
-
* arbitrary text. Useful when a consumer app (or example) writes its
|
|
8
|
-
* own logs / metrics / paste-share artifacts that the SDK's wired
|
|
9
|
-
* sinks (error metadata, telemetry, transcript, migration) don't
|
|
10
|
-
* cover.
|
|
11
|
-
* - `Security.addPattern(re)` — register a custom credential pattern
|
|
12
|
-
* on top of the 12 builtins (OpenAI, Anthropic, GitHub PAT classic +
|
|
13
|
-
* fine, GitLab, AWS, Google, Slack, Sentry, Stripe live + restricted)
|
|
14
|
-
* plus the parametric `key=value` + `Bearer <token>` matchers.
|
|
15
|
-
*
|
|
16
|
-
* Redaction is ON by default. Disable with `THEOKIT_REDACT_SECRETS=false`
|
|
17
|
-
* (a warning is emitted on stderr so the operator knows the SDK process
|
|
18
|
-
* is vulnerable). The env var is snapshotted at module init — runtime
|
|
19
|
-
* mutation cannot disable it, defending against prompt injection that
|
|
20
|
-
* tries to flip the flag mid-run.
|
|
21
|
-
*/
|
|
22
|
-
export declare class Security {
|
|
23
|
-
private constructor();
|
|
24
|
-
/**
|
|
25
|
-
* Redact known credential patterns from `text` and return the masked
|
|
26
|
-
* string. Use this at any consumer output boundary the SDK does not
|
|
27
|
-
* directly own (custom stdout loggers, app-level metrics, debug-share
|
|
28
|
-
* artifacts, etc.).
|
|
29
|
-
*
|
|
30
|
-
* Coerces non-strings (objects via JSON.stringify, null/undefined → "").
|
|
31
|
-
* Two-bucket masking: tokens shorter than 18 chars → `***`; longer
|
|
32
|
-
* tokens preserve `prefix...suffix` for debuggability without revealing
|
|
33
|
-
* the secret middle.
|
|
34
|
-
*
|
|
35
|
-
* @param text - The value to redact. Strings, objects, primitives all OK.
|
|
36
|
-
* @param opts.codeFile - When `true`, skips the parametric `key=value`
|
|
37
|
-
* matcher so file content like `.env.example` placeholders is left
|
|
38
|
-
* intact. Built-in pattern matches still apply.
|
|
39
|
-
*
|
|
40
|
-
* @example
|
|
41
|
-
* console.log(`[bot] received: ${Security.redact(userText)}`);
|
|
42
|
-
* // → "[bot] received: please remember sk-abc...xyz1"
|
|
43
|
-
*/
|
|
44
|
-
static redact(text: unknown, opts?: {
|
|
45
|
-
codeFile?: boolean;
|
|
46
|
-
}): string;
|
|
47
|
-
/**
|
|
48
|
-
* Register a custom redaction pattern. Additive — built-in patterns
|
|
49
|
-
* (OpenAI, Anthropic, GitHub PAT, AWS, etc.) cannot be removed.
|
|
50
|
-
*
|
|
51
|
-
* @param re - RegExp with `/g` flag. Throws if `/g` is missing
|
|
52
|
-
* (without /g, only first match is replaced and the rest
|
|
53
|
-
* leaks).
|
|
54
|
-
*
|
|
55
|
-
* Process-global mutable state. The SDK is designed for single-tenant
|
|
56
|
-
* processes (Theo PaaS user runtime, local CLI). Multi-tenant
|
|
57
|
-
* deployments running multiple SDK consumers in the same Node process
|
|
58
|
-
* share this list — patterns added by tenant A apply to tenant B's
|
|
59
|
-
* redactions. Acceptable for v1; future isolate-aware refactor would
|
|
60
|
-
* thread patterns through a context if needed.
|
|
61
|
-
*
|
|
62
|
-
* @example
|
|
63
|
-
* Security.addPattern(/MYORG-[A-Z0-9]{32}/g);
|
|
64
|
-
* // → text containing "MYORG-AAAA...AAAA" now masks like a builtin.
|
|
65
|
-
*/
|
|
66
|
-
static addPattern(re: RegExp): void;
|
|
67
|
-
}
|
package/dist/task.d.ts
DELETED
|
@@ -1,87 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* `Task` — observable async work registry (Adoption Roadmap gap #2,
|
|
3
|
-
* ADRs D361-D374).
|
|
4
|
-
*
|
|
5
|
-
* Static facade delegating to the in-process `TaskRegistry` singleton.
|
|
6
|
-
* The lifecycle of any task is the 5-state machine `queued | running |
|
|
7
|
-
* finished | error | cancelled` (D362). Wrapping `Agent.send` /
|
|
8
|
-
* `Agent.batch` / `Workflow.run` / `Cron` fires is opt-in via the
|
|
9
|
-
* `{ task: true }` option on each (D363).
|
|
10
|
-
*
|
|
11
|
-
* @public
|
|
12
|
-
*/
|
|
13
|
-
import type { TaskCancelResult, TaskEvent, TaskFilter, TaskHandle, TaskKind, TaskStoreOptions, TaskSubmitOptions } from "./types/task.js";
|
|
14
|
-
export interface TaskWorkContext {
|
|
15
|
-
readonly signal: AbortSignal;
|
|
16
|
-
emit(payload: unknown): void;
|
|
17
|
-
}
|
|
18
|
-
export type TaskWorkFn<T> = (ctx: TaskWorkContext) => Promise<T> | T;
|
|
19
|
-
/**
|
|
20
|
-
* Registry-level configuration. May only be applied BEFORE the first
|
|
21
|
-
* `Task.submit` of the process — see EC-13. Subsequent calls emit a
|
|
22
|
-
* single stderr line and become no-ops.
|
|
23
|
-
*/
|
|
24
|
-
export interface TaskConfigureOptions {
|
|
25
|
-
readonly store?: TaskStoreOptions;
|
|
26
|
-
readonly maxConcurrent?: number;
|
|
27
|
-
readonly retentionMs?: number;
|
|
28
|
-
}
|
|
29
|
-
export declare class Task {
|
|
30
|
-
private constructor();
|
|
31
|
-
/**
|
|
32
|
-
* Configure the registry. **Must be called before the first `submit`**
|
|
33
|
-
* (EC-13). Available knobs: pluggable store (D364), concurrency cap
|
|
34
|
-
* (D369), and retention (D373).
|
|
35
|
-
*/
|
|
36
|
-
static configure(opts: TaskConfigureOptions): void;
|
|
37
|
-
/**
|
|
38
|
-
* Submit a unit of asynchronous work to the registry.
|
|
39
|
-
*
|
|
40
|
-
* The `work` function receives `{ signal, emit }` — `signal` is the
|
|
41
|
-
* AbortSignal honored on cancel; `emit(payload)` produces a
|
|
42
|
-
* `progress` event observable via `Task.subscribe`.
|
|
43
|
-
*
|
|
44
|
-
* Returns a `TaskHandle` in `state: "queued"`. Subsequent state
|
|
45
|
-
* transitions are observable via `Task.subscribe(handle.id)` OR
|
|
46
|
-
* polled via `Task.get(handle.id)`.
|
|
47
|
-
*
|
|
48
|
-
* **Idempotency (D367):** submitting twice with the same `id` returns
|
|
49
|
-
* the existing handle without re-invoking work.
|
|
50
|
-
*
|
|
51
|
-
* **Grammar (D368):** user-supplied ids must match
|
|
52
|
-
* `^[a-z0-9][a-z0-9_-]*$` and must not start with reserved prefixes
|
|
53
|
-
* `wf-` / `b-` / `cron-`. Otherwise `InvalidTaskIdError` is thrown.
|
|
54
|
-
*
|
|
55
|
-
* **Pre-aborted signal (EC-4):** if `options.signal` is already
|
|
56
|
-
* aborted, the task short-circuits to `cancelled` without acquiring
|
|
57
|
-
* a semaphore slot and without invoking `work`.
|
|
58
|
-
*/
|
|
59
|
-
static submit<T>(kind: TaskKind, work: TaskWorkFn<T>, options?: TaskSubmitOptions): Promise<TaskHandle>;
|
|
60
|
-
/** Returns matching handles, capped at `filter.limit ?? 100`. */
|
|
61
|
-
static list(filter?: TaskFilter): Promise<TaskHandle[]>;
|
|
62
|
-
/** Returns a single handle by id, or `undefined` if unknown / evicted. */
|
|
63
|
-
static get(id: string): Promise<TaskHandle | undefined>;
|
|
64
|
-
/**
|
|
65
|
-
* Idempotent cancel (D365). Returns:
|
|
66
|
-
* - `{ cancelled: true, alreadyTerminal: false }` — transitioned
|
|
67
|
-
* queued/running task to `cancelled`.
|
|
68
|
-
* - `{ cancelled: false, alreadyTerminal: true }` — task already
|
|
69
|
-
* terminal.
|
|
70
|
-
* - `{ cancelled: false, alreadyTerminal: false }` — task unknown.
|
|
71
|
-
*
|
|
72
|
-
* Never throws.
|
|
73
|
-
*/
|
|
74
|
-
static cancel(id: string, reason?: string): Promise<TaskCancelResult>;
|
|
75
|
-
/**
|
|
76
|
-
* Subscribe to a task's event stream. The returned `AsyncIterable<TaskEvent>`
|
|
77
|
-
* starts by replaying buffered events (ring buffer cap 64, D372) and
|
|
78
|
-
* then yields live events until a terminal event (finished / errored
|
|
79
|
-
* / cancelled) is emitted, at which point it closes automatically.
|
|
80
|
-
*
|
|
81
|
-
* Calling `.return()` on the iterator (or `break` in a `for await`)
|
|
82
|
-
* cleans up the subscriber callback (EC-10).
|
|
83
|
-
*
|
|
84
|
-
* Throws `TaskNotFoundError` if the id is unknown or has been evicted.
|
|
85
|
-
*/
|
|
86
|
-
static subscribe(id: string): AsyncIterable<TaskEvent>;
|
|
87
|
-
}
|
package/dist/theokit.d.ts
DELETED
|
@@ -1,84 +0,0 @@
|
|
|
1
|
-
import type { SDKProvider } from "./types/providers.js";
|
|
2
|
-
import type { SDKModel, SDKRepository, SDKUser } from "./types/theokit.js";
|
|
3
|
-
/**
|
|
4
|
-
* Options shared by every `Theokit.*` request.
|
|
5
|
-
*
|
|
6
|
-
* @public
|
|
7
|
-
*/
|
|
8
|
-
export interface TheokitRequestOptions {
|
|
9
|
-
/** Override the `THEOKIT_API_KEY` env var for this call. */
|
|
10
|
-
apiKey?: string;
|
|
11
|
-
/**
|
|
12
|
-
* Target a specific provider for catalog reads. When set to a provider
|
|
13
|
-
* with `authType: "none"` (e.g. `"ollama"`, `"lmstudio"`, `"llamacpp"`),
|
|
14
|
-
* `Theokit.models.list({ provider })` reads from the provider's local
|
|
15
|
-
* `/v1/models` endpoint instead of the TheoCloud catalog. ADR D184.
|
|
16
|
-
*
|
|
17
|
-
* @public
|
|
18
|
-
*/
|
|
19
|
-
provider?: string;
|
|
20
|
-
}
|
|
21
|
-
/**
|
|
22
|
-
* Account-level and catalog reads. All methods accept an optional `apiKey`
|
|
23
|
-
* and otherwise fall back to the `THEOKIT_API_KEY` environment variable.
|
|
24
|
-
*
|
|
25
|
-
* @public
|
|
26
|
-
*/
|
|
27
|
-
export declare class Theokit {
|
|
28
|
-
private constructor();
|
|
29
|
-
/**
|
|
30
|
-
* Return the user behind the current API key.
|
|
31
|
-
*
|
|
32
|
-
* @public
|
|
33
|
-
*/
|
|
34
|
-
static me(options?: TheokitRequestOptions): Promise<SDKUser>;
|
|
35
|
-
/**
|
|
36
|
-
* Model catalog reads.
|
|
37
|
-
*
|
|
38
|
-
* @public
|
|
39
|
-
*/
|
|
40
|
-
static readonly models: {
|
|
41
|
-
list: (options?: TheokitRequestOptions) => Promise<SDKModel[]>;
|
|
42
|
-
};
|
|
43
|
-
/**
|
|
44
|
-
* Connected GitHub repositories for the calling user's team. Cloud only.
|
|
45
|
-
*
|
|
46
|
-
* @public
|
|
47
|
-
*/
|
|
48
|
-
static readonly repositories: {
|
|
49
|
-
list: (options?: TheokitRequestOptions) => Promise<SDKRepository[]>;
|
|
50
|
-
};
|
|
51
|
-
/**
|
|
52
|
-
* Provider catalog. Lists every provider known to the platform, including
|
|
53
|
-
* plugin-registered ones, with capability and availability metadata.
|
|
54
|
-
*
|
|
55
|
-
* @public
|
|
56
|
-
*/
|
|
57
|
-
static readonly providers: {
|
|
58
|
-
list: (options?: TheokitRequestOptions) => Promise<SDKProvider[]>;
|
|
59
|
-
};
|
|
60
|
-
/**
|
|
61
|
-
* Local introspection of bundled SDK assets (ADR D201). Unlike the
|
|
62
|
-
* cloud-catalog `providers.list()` (which hits the TheoCloud HTTP API),
|
|
63
|
-
* `inspect.*` reads the SDK's own bundled registries — useful for
|
|
64
|
-
* tooling (e.g. `@theokit/cli`'s `theokit inspect`) that needs to know
|
|
65
|
-
* what's available WITHOUT a network round-trip.
|
|
66
|
-
*
|
|
67
|
-
* @public
|
|
68
|
-
*/
|
|
69
|
-
static readonly inspect: {
|
|
70
|
-
builtinProviders: () => Array<{
|
|
71
|
-
readonly name: string;
|
|
72
|
-
readonly apiMode: string;
|
|
73
|
-
readonly authType: string;
|
|
74
|
-
readonly baseUrl: string;
|
|
75
|
-
readonly aliases?: ReadonlyArray<string>;
|
|
76
|
-
readonly envVars: ReadonlyArray<string>;
|
|
77
|
-
}>;
|
|
78
|
-
embeddingAdapters: () => Array<{
|
|
79
|
-
readonly id: string;
|
|
80
|
-
readonly transport: string;
|
|
81
|
-
readonly defaultModel: string;
|
|
82
|
-
}>;
|
|
83
|
-
};
|
|
84
|
-
}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Shared `safePathJoin + assertNoSymlinkEscape` helper for built-in coding
|
|
3
|
-
* tools (git-diff, run-vitest, list-dir, read-file, search-text). Returns a
|
|
4
|
-
* pre-formatted `path_traversal` JSON string on failure or `null` on pass.
|
|
5
|
-
*
|
|
6
|
-
* @internal
|
|
7
|
-
*/
|
|
8
|
-
export declare function checkPathScope(path: string | undefined, projectRoot: string): string | null;
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Shared subprocess-watch helpers for built-in coding tools (git-diff,
|
|
3
|
-
* run-vitest). Wires the on(close)/on(error) settle pattern in a single
|
|
4
|
-
* place to eliminate the cross-file clone flagged by jscpd.
|
|
5
|
-
*
|
|
6
|
-
* @internal
|
|
7
|
-
*/
|
|
8
|
-
/**
|
|
9
|
-
* Settle gate — guarantees the supplied callback fires exactly once across
|
|
10
|
-
* the close/error/timeout race. Clears the timer on settle.
|
|
11
|
-
*/
|
|
12
|
-
interface SettleGate {
|
|
13
|
-
/** True after first settle; subsequent calls are no-ops. */
|
|
14
|
-
settled: () => boolean;
|
|
15
|
-
/** Settle the gate, clear the timer, and call `onSettle()`. */
|
|
16
|
-
fire: (onSettle: () => void) => void;
|
|
17
|
-
}
|
|
18
|
-
/**
|
|
19
|
-
* Wire SIGKILL-on-timeout for a detached process group. Returns the settle
|
|
20
|
-
* gate so caller listeners can short-circuit when the timeout already fired.
|
|
21
|
-
*/
|
|
22
|
-
export declare function armTimeoutKill<T>(child: ChildProcess, timeoutMs: number, onTimeout: () => T, resolve: (value: T) => void): SettleGate;
|
|
23
|
-
/**
|
|
24
|
-
* Attach a close+error pair of listeners that resolve via the supplied
|
|
25
|
-
* callbacks. Honors the gate so timeout-vs-close races settle exactly once.
|
|
26
|
-
*/
|
|
27
|
-
export declare function attachChildSettlers<T>(child: ChildProcess, gate: SettleGate, onClose: (code: number | null) => T, onError: (err: Error) => T, resolve: (value: T) => void): void;
|
|
28
|
-
export {};
|