@crewx/sdk 0.9.0-rc.20 → 0.9.0-rc.201
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/README.md +1 -1
- package/dist/account/auth-client.d.ts +61 -0
- package/dist/account/auth-json-v2.d.ts +1 -0
- package/dist/account/auth-json.d.ts +30 -0
- package/dist/account/config.d.ts +37 -0
- package/dist/account/env-bootstrap.d.ts +11 -0
- package/dist/account/errors.d.ts +24 -0
- package/dist/account/index.d.ts +12 -0
- package/dist/account/index.js +2 -0
- package/dist/account/session-manager.d.ts +47 -0
- package/dist/activity-log/builder.d.ts +59 -6
- package/dist/agent/agent-list-view.d.ts +19 -0
- package/dist/agent-interceptor/chain.d.ts +25 -0
- package/dist/agent-interceptor/index.d.ts +6 -0
- package/dist/agent-interceptor/model-runner.d.ts +19 -0
- package/dist/agent-interceptor/program-runner.d.ts +13 -0
- package/dist/agent-interceptor/protocol.d.ts +68 -0
- package/dist/agent-interceptor/run-stop.d.ts +3 -0
- package/dist/agent-interceptor/schema.d.ts +267 -0
- package/dist/agent-interceptor/types.d.ts +88 -0
- package/dist/app/app-files/args.d.ts +12 -0
- package/dist/app/app-files/errors.d.ts +6 -0
- package/dist/app/app-files/index.d.ts +35 -0
- package/dist/app/app-files/lock.d.ts +26 -0
- package/dist/app/app-files/root.d.ts +22 -0
- package/dist/app/app-files/store.d.ts +48 -0
- package/dist/app/app-files/write.child.d.ts +1 -0
- package/dist/app/app.d.ts +168 -0
- package/dist/app/backend-env.d.ts +3 -0
- package/dist/app/content-media-types.d.ts +2 -0
- package/dist/app/context.d.ts +2 -0
- package/dist/app/entry.d.ts +9 -0
- package/dist/app/frame.d.ts +55 -0
- package/dist/app/index.d.ts +20 -0
- package/dist/app/index.js +13 -0
- package/dist/app/job-bridge.child.d.ts +1 -0
- package/dist/app/job-bridge.d.ts +67 -0
- package/dist/app/job-bridge.drain.child.d.ts +1 -0
- package/dist/app/job-bridge.example.d.ts +11 -0
- package/dist/app/job-contract.d.ts +40 -0
- package/dist/app/job-wire.d.ts +149 -0
- package/dist/app/protocol.d.ts +9 -0
- package/dist/app/runtime.d.ts +23 -0
- package/dist/app/schedule-contract.d.ts +59 -0
- package/dist/app/tool-mode.d.ts +3 -0
- package/dist/app-artifact-policy/check.d.ts +2 -0
- package/dist/app-artifact-policy/contract.d.ts +54 -0
- package/dist/app-artifact-policy/helper.d.ts +15 -0
- package/dist/app-artifact-policy/index.d.ts +3 -0
- package/dist/app-artifact-policy/index.js +18 -0
- package/dist/app-artifact-policy/paths.d.ts +24 -0
- package/dist/app-artifact-policy/scan.d.ts +47 -0
- package/dist/app-ui/index.d.ts +95 -0
- package/dist/app-ui/index.js +1 -0
- package/dist/attachment-receive/index.d.ts +76 -0
- package/dist/attachment-receive/index.js +2 -0
- package/dist/boxing/box.types.d.ts +4 -0
- package/dist/config/canonicalize-agent-options.d.ts +2 -0
- package/dist/config/default-agent-models.d.ts +11 -0
- package/dist/config/global-settings.d.ts +33 -0
- package/dist/config/migrate-grok-mode.d.ts +6 -0
- package/dist/config/model-compat.d.ts +31 -0
- package/dist/config/models.generated.d.ts +38 -0
- package/dist/config/models.remote.d.ts +1 -0
- package/dist/config/overdrive.d.ts +7 -0
- package/dist/config/pricing.d.ts +6 -3
- package/dist/config/pricing.generated.d.ts +4 -0
- package/dist/config/pricing.types.d.ts +4 -0
- package/dist/config/timeout.config.d.ts +4 -0
- package/dist/config/wi-boards.d.ts +19 -0
- package/dist/context/GoalLoader.d.ts +6 -0
- package/dist/context-budget/continuity.d.ts +64 -0
- package/dist/context-budget/fixed-slot-shrink.d.ts +97 -0
- package/dist/context-budget/index.d.ts +168 -0
- package/dist/conversation/index.d.ts +1 -1
- package/dist/conversation/sqlite-provider.d.ts +6 -3
- package/dist/conversation/to-template-messages.d.ts +9 -0
- package/dist/conversation/types.d.ts +86 -1
- package/dist/desktop/command-runner.d.ts +4 -0
- package/dist/desktop/default-adapters.d.ts +4 -0
- package/dist/desktop/global-install.d.ts +19 -0
- package/dist/desktop/index.d.ts +3 -0
- package/dist/desktop/index.js +3 -0
- package/dist/desktop/install.d.ts +5 -0
- package/dist/desktop/lnk.d.ts +22 -0
- package/dist/desktop/manifest.d.ts +21 -0
- package/dist/desktop/types.d.ts +67 -0
- package/dist/desktop/version.d.ts +1 -0
- package/dist/desktop/windows-paths.d.ts +21 -0
- package/dist/desktop/wrapper.d.ts +18 -0
- package/dist/esm/account/index.js +2 -0
- package/dist/esm/app/index.js +13 -0
- package/dist/esm/app-artifact-policy/index.js +18 -0
- package/dist/esm/attachment-receive/index.js +2 -0
- package/dist/esm/desktop/index.js +3 -0
- package/dist/esm/history-snapshot/index.js +16 -0
- package/dist/esm/index.js +1362 -224
- package/dist/esm/node/index.js +2 -0
- package/dist/esm/plugins/index.js +532 -214
- package/dist/esm/process/index.js +1 -0
- package/dist/esm/publish/index.js +2 -0
- package/dist/esm/repository/index.js +792 -207
- package/dist/esm/skills/index.js +2 -0
- package/dist/esm/testing/index.js +1 -1
- package/dist/events/types.d.ts +44 -0
- package/dist/facade/Crewx.d.ts +78 -5
- package/dist/facade/task-ticket.d.ts +14 -0
- package/dist/highlight/thread-highlight-prompt.d.ts +2 -0
- package/dist/highlight/thread-highlighter.d.ts +326 -0
- package/dist/history-snapshot/index.d.ts +82 -0
- package/dist/history-snapshot/index.js +16 -0
- package/dist/index.browser.d.ts +26 -1
- package/dist/index.browser.js +6 -2
- package/dist/index.d.ts +165 -18
- package/dist/index.js +1362 -224
- package/dist/internal/console-decoder.d.ts +38 -0
- package/dist/internal/windows-spawn.d.ts +10 -0
- package/dist/layout/types.d.ts +18 -1
- package/dist/lifecycle/process-lease.d.ts +80 -0
- package/dist/lifecycle/process-owner.d.ts +20 -0
- package/dist/lifecycle/task-heartbeat.d.ts +41 -0
- package/dist/lifecycle/task-stop.d.ts +112 -0
- package/dist/lifecycle/update-admission.d.ts +45 -0
- package/dist/local-server/base-url.d.ts +18 -0
- package/dist/local-server/index.d.ts +8 -0
- package/dist/local-server/opencode.d.ts +8 -0
- package/dist/local-server/probe.d.ts +3 -0
- package/dist/local-server/runtime.d.ts +26 -0
- package/dist/local-server/types.d.ts +43 -0
- package/dist/mcp-app/agent-access.d.ts +33 -0
- package/dist/mcp-app/app-handoff.d.ts +109 -0
- package/dist/mcp-app/app-icon-read.d.ts +7 -0
- package/dist/mcp-app/app-job-bridge.d.ts +30 -0
- package/dist/mcp-app/app-job-bridge.example.d.ts +36 -0
- package/dist/mcp-app/app-job.d.ts +168 -0
- package/dist/mcp-app/app-schedule.d.ts +85 -0
- package/dist/mcp-app/apps-context.d.ts +32 -0
- package/dist/mcp-app/bundle-provenance.d.ts +3 -0
- package/dist/mcp-app/candidate-registration.d.ts +4 -0
- package/dist/mcp-app/card-handler.d.ts +7 -0
- package/dist/mcp-app/catalog.d.ts +7 -0
- package/dist/mcp-app/content-channel.d.ts +86 -0
- package/dist/mcp-app/content-declarations.d.ts +31 -0
- package/dist/mcp-app/dev-checks.d.ts +31 -0
- package/dist/mcp-app/diagnostic-reason.d.ts +3 -0
- package/dist/mcp-app/discovery.d.ts +164 -0
- package/dist/mcp-app/errors.d.ts +7 -0
- package/dist/mcp-app/index.d.ts +46 -0
- package/dist/mcp-app/installed-app-ref.d.ts +25 -0
- package/dist/mcp-app/model-context.d.ts +29 -0
- package/dist/mcp-app/node-app-discovery-fs.d.ts +23 -0
- package/dist/mcp-app/product-bundle-assets.d.ts +27 -0
- package/dist/mcp-app/product-bundle-loader.d.ts +53 -0
- package/dist/mcp-app/projection.d.ts +14 -0
- package/dist/mcp-app/prompt-cards.d.ts +28 -0
- package/dist/mcp-app/registry.d.ts +28 -0
- package/dist/mcp-app/skill-backend.d.ts +141 -0
- package/dist/mcp-app/state-set.d.ts +9 -0
- package/dist/mcp-app/types.d.ts +501 -0
- package/dist/mcp-app/view-call.d.ts +7 -0
- package/dist/mcp-app/workspace-app-assets.d.ts +42 -0
- package/dist/mcp-app/workspace-app-scan-cache.d.ts +27 -0
- package/dist/mcp-app/workspace-snapshot.d.ts +81 -0
- package/dist/migrations/0011_far_black_tarantula.sql +1 -0
- package/dist/migrations/0012_blue_turbo.sql +23 -0
- package/dist/migrations/0013_hesitant_adam_destine.sql +15 -0
- package/dist/migrations/0014_organic_mongu.sql +73 -0
- package/dist/migrations/0015_panoramic_gorilla_man.sql +71 -0
- package/dist/migrations/0016_fuzzy_hemingway.sql +14 -0
- package/dist/migrations/0017_project_stage_sdk_migration.sql +29 -0
- package/dist/migrations/0018_bored_jackal.sql +33 -0
- package/dist/migrations/0019_backfill_task_thread_ids.sql +74 -0
- package/dist/migrations/0020_useful_iron_lad.sql +55 -0
- package/dist/migrations/0021_dashing_peter_quill.sql +51 -0
- package/dist/migrations/0022_wandering_bucky.sql +1 -0
- package/dist/migrations/0023_red_payback.sql +1 -0
- package/dist/migrations/0024_storage_metadata.sql +262 -0
- package/dist/migrations/0025_task_heartbeat.sql +8 -0
- package/dist/migrations/0025_thread_app_instance_ledger.sql +2 -0
- package/dist/migrations/0026_mcp_action_source.sql +47 -0
- package/dist/migrations/0027_task_stop_scope_cleanup.sql +5 -0
- package/dist/migrations/0027_ui_instance_active_unique.sql +2 -0
- package/dist/migrations/0029_nice_rhino.sql +1 -0
- package/dist/migrations/0031_petite_arclight.sql +6 -0
- package/dist/migrations/0032_ui_instance_opened_by.sql +1 -0
- package/dist/migrations/0033_thread_creator_boundary_guard.sql +38 -0
- package/dist/migrations/0034_keen_fallen_one.sql +36 -0
- package/dist/migrations/0035_request_log_daily.sql +11 -0
- package/dist/migrations/0036_ui_definition_archive.sql +8 -0
- package/dist/migrations/0037_ui_instance_agent_open_request.sql +1 -0
- package/dist/migrations/0038_task_rating.sql +3 -0
- package/dist/migrations/0039_aspiring_purifiers.sql +9 -0
- package/dist/migrations/0040_task_provider_inputs.sql +53 -0
- package/dist/migrations/0041_tranquil_vivisector.sql +54 -0
- package/dist/migrations/0042_breezy_blue_shield.sql +31 -0
- package/dist/migrations/0043_nervous_darkstar.sql +1 -0
- package/dist/migrations/0044_military_galactus.sql +8 -0
- package/dist/migrations/0045_task_pid_started_at.sql +1 -0
- package/dist/migrations/0046_acoustic_karnak.sql +49 -0
- package/dist/migrations/0047_doc_sync_connect_requests.sql +18 -0
- package/dist/migrations/0048_smart_gertrude_yorkes.sql +47 -0
- package/dist/migrations/meta/0011_snapshot.json +1342 -0
- package/dist/migrations/meta/0012_snapshot.json +1494 -0
- package/dist/migrations/meta/0013_snapshot.json +1592 -0
- package/dist/migrations/meta/0014_snapshot.json +1975 -0
- package/dist/migrations/meta/0015_snapshot.json +2315 -0
- package/dist/migrations/meta/0016_snapshot.json +2419 -0
- package/dist/migrations/meta/0017_snapshot.json +2419 -0
- package/dist/migrations/meta/0018_snapshot.json +2570 -0
- package/dist/migrations/meta/0020_snapshot.json +2895 -0
- package/dist/migrations/meta/0021_snapshot.json +3031 -0
- package/dist/migrations/meta/0022_snapshot.json +3039 -0
- package/dist/migrations/meta/0023_snapshot.json +3047 -0
- package/dist/migrations/meta/0029_snapshot.json +3206 -0
- package/dist/migrations/meta/0031_snapshot.json +3251 -0
- package/dist/migrations/meta/0034_snapshot.json +3473 -0
- package/dist/migrations/meta/0035_snapshot.json +3547 -0
- package/dist/migrations/meta/0036_snapshot.json +3591 -0
- package/dist/migrations/meta/0037_snapshot.json +3598 -0
- package/dist/migrations/meta/0038_snapshot.json +3626 -0
- package/dist/migrations/meta/0039_snapshot.json +3684 -0
- package/dist/migrations/meta/0040_snapshot.json +3759 -0
- package/dist/migrations/meta/0041_snapshot.json +4156 -0
- package/dist/migrations/meta/0042_snapshot.json +4383 -0
- package/dist/migrations/meta/0043_snapshot.json +4390 -0
- package/dist/migrations/meta/0044_snapshot.json +4435 -0
- package/dist/migrations/meta/0045_snapshot.json +4442 -0
- package/dist/migrations/meta/0046_snapshot.json +4733 -0
- package/dist/migrations/meta/0047_snapshot.json +4832 -0
- package/dist/migrations/meta/0048_snapshot.json +5128 -0
- package/dist/migrations/meta/_journal.json +266 -0
- package/dist/node/index.d.ts +1 -0
- package/dist/node/index.js +2 -0
- package/dist/paths.d.ts +1 -0
- package/dist/plugin/types.d.ts +1 -0
- package/dist/plugins/index.d.ts +1 -1
- package/dist/plugins/index.js +532 -214
- package/dist/plugins/sqlite-tracing.d.ts +46 -0
- package/dist/process/index.d.ts +2 -0
- package/dist/process/index.js +1 -0
- package/dist/process/process-control.d.ts +74 -0
- package/dist/prompt/tag-names.d.ts +22 -0
- package/dist/provider/acp/adapter.d.ts +37 -2
- package/dist/provider/acp/adapters/antigravity-account.d.ts +4 -0
- package/dist/provider/acp/completion-observer.d.ts +24 -0
- package/dist/provider/acp/connection.d.ts +69 -3
- package/dist/provider/acp/index.d.ts +3 -3
- package/dist/provider/acp/meta.d.ts +11 -0
- package/dist/provider/acp/register.d.ts +1 -0
- package/dist/provider/acp/runtime.d.ts +1 -0
- package/dist/provider/acp/types.d.ts +31 -4
- package/dist/provider/bridge.browser.d.ts +3 -0
- package/dist/provider/bridge.d.ts +25 -3
- package/dist/provider/classify-task-error.d.ts +2 -0
- package/dist/provider/claude-agent-env.d.ts +1 -0
- package/dist/provider/cli/adapter.types.d.ts +26 -2
- package/dist/provider/cli/adapters/agent-call.util.d.ts +1 -1
- package/dist/provider/cli/adapters/antigravity-stream.d.ts +27 -0
- package/dist/provider/cli/adapters/antigravity.d.ts +1 -0
- package/dist/provider/cli/adapters/cli-knob.util.d.ts +7 -0
- package/dist/provider/cli/adapters/codex-item.d.ts +1 -0
- package/dist/provider/cli/adapters/event-timestamp.util.d.ts +1 -0
- package/dist/provider/cli/adapters/grok.d.ts +2 -0
- package/dist/provider/cli/adapters/index.d.ts +5 -0
- package/dist/provider/cli/index.d.ts +3 -2
- package/dist/provider/cli/meta.d.ts +5 -0
- package/dist/provider/cli/protocol-envelope.d.ts +3 -0
- package/dist/provider/errors.d.ts +5 -1
- package/dist/provider/idle-watchdog.d.ts +19 -0
- package/dist/provider/models.d.ts +17 -12
- package/dist/provider/order.d.ts +1 -1
- package/dist/provider/parse-usage.d.ts +6 -0
- package/dist/provider/provider-selection.d.ts +8 -0
- package/dist/provider/redact-technical-message.d.ts +1 -0
- package/dist/provider/task-error.types.d.ts +17 -0
- package/dist/provider-account/accounts.d.ts +15 -0
- package/dist/provider-account/antigravity-acp/auth.d.ts +29 -0
- package/dist/provider-account/antigravity-acp/browser.d.ts +4 -0
- package/dist/provider-account/antigravity-acp/install.d.ts +42 -0
- package/dist/provider-account/antigravity-acp/lease.d.ts +23 -0
- package/dist/provider-account/antigravity-acp/lifecycle.d.ts +76 -0
- package/dist/provider-account/antigravity-acp/manifest.d.ts +76 -0
- package/dist/provider-account/antigravity-acp/profile.d.ts +4 -0
- package/dist/provider-account/capabilities.d.ts +6 -0
- package/dist/provider-account/index.d.ts +13 -0
- package/dist/provider-account/registry.d.ts +30 -0
- package/dist/provider-account/types.d.ts +47 -0
- package/dist/publish/constants.d.ts +6 -0
- package/dist/publish/errors.d.ts +7 -0
- package/dist/publish/index.d.ts +55 -0
- package/dist/publish/index.js +2 -0
- package/dist/publish/manifest.d.ts +47 -0
- package/dist/publish/marketplace-api.constants.d.ts +1 -0
- package/dist/publish/pack.d.ts +6 -0
- package/dist/publish/scan.d.ts +10 -0
- package/dist/publish/secrets.d.ts +6 -0
- package/dist/publish/upload.d.ts +19 -0
- package/dist/remote/execution-profile.d.ts +9 -0
- package/dist/remote/index.d.ts +1 -0
- package/dist/remote/types.d.ts +28 -0
- package/dist/repository/agent-send-history.repository.d.ts +23 -0
- package/dist/repository/agent-suggestion.repository.d.ts +34 -0
- package/dist/repository/base-sqlite-repository.d.ts +1 -0
- package/dist/repository/common-code.repository.d.ts +45 -0
- package/dist/repository/db.d.ts +13 -1
- package/dist/repository/index.d.ts +62 -6
- package/dist/repository/index.js +792 -207
- package/dist/repository/logs-db.d.ts +12 -0
- package/dist/repository/notification.repository.d.ts +58 -0
- package/dist/repository/project.repository.d.ts +90 -0
- package/dist/repository/public-task-answer.d.ts +24 -0
- package/dist/repository/request-log-mover.d.ts +70 -0
- package/dist/repository/request-log.repository.d.ts +7 -3
- package/dist/repository/run-columns.d.ts +10 -0
- package/dist/repository/run-history.repository.d.ts +112 -0
- package/dist/repository/schedule-run.repository.d.ts +103 -0
- package/dist/repository/sidebar-tab.repository.d.ts +86 -0
- package/dist/repository/storage-metadata.repository.d.ts +64 -0
- package/dist/repository/task-log-migration.d.ts +74 -0
- package/dist/repository/task-log.repository.d.ts +47 -0
- package/dist/repository/task-status.d.ts +21 -0
- package/dist/repository/task.repository.d.ts +330 -8
- package/dist/repository/thread-history.repository.d.ts +193 -0
- package/dist/repository/thread-origin-verdict.d.ts +27 -0
- package/dist/repository/thread-title.types.d.ts +29 -0
- package/dist/repository/thread.repository.d.ts +134 -5
- package/dist/repository/usage-backfill.d.ts +62 -0
- package/dist/repository/usage-from-logs.d.ts +22 -0
- package/dist/repository/workflow-anchor-kinds.d.ts +4 -0
- package/dist/repository/workspace.repository.d.ts +3 -0
- package/dist/route/decide.d.ts +54 -0
- package/dist/route/eligibility.d.ts +11 -0
- package/dist/route/errors.d.ts +11 -0
- package/dist/route/index.d.ts +14 -0
- package/dist/route/runner.d.ts +15 -0
- package/dist/route/sqlite-store.d.ts +17 -0
- package/dist/route/store.d.ts +45 -0
- package/dist/route/strategies.d.ts +4 -0
- package/dist/route/types.d.ts +212 -0
- package/dist/schema/agent-send-history.d.ts +85 -0
- package/dist/schema/agent-suggestions.d.ts +199 -0
- package/dist/schema/common-codes.d.ts +216 -0
- package/dist/schema/doc-sync-connect-requests.d.ts +140 -0
- package/dist/schema/doc-sync-links.d.ts +481 -0
- package/dist/schema/index.d.ts +21 -0
- package/dist/schema/model-routes.d.ts +581 -0
- package/dist/schema/notifications.d.ts +303 -0
- package/dist/schema/projects.d.ts +610 -0
- package/dist/schema/request-log-daily.d.ts +151 -0
- package/dist/schema/run-column-backfill.d.ts +81 -0
- package/dist/schema/schedule-runs.d.ts +451 -0
- package/dist/schema/sidebar-tabs.d.ts +466 -0
- package/dist/schema/storage-metadata.d.ts +181 -0
- package/dist/schema/task-log-events.d.ts +119 -0
- package/dist/schema/task-provider-inputs.d.ts +100 -0
- package/dist/schema/tasks.d.ts +1172 -1
- package/dist/schema/thread-creator-unverified.d.ts +45 -0
- package/dist/schema/thread-history.d.ts +734 -0
- package/dist/schema/threads.d.ts +59 -0
- package/dist/schema/ui-action-receipts.d.ts +358 -0
- package/dist/schema/ui-definition-archive.d.ts +63 -0
- package/dist/schema/ui-instance-repins.d.ts +222 -0
- package/dist/schema/ui-instances.d.ts +324 -0
- package/dist/schema/workspaces.d.ts +17 -0
- package/dist/skills/index.d.ts +15 -0
- package/dist/skills/index.js +2 -0
- package/dist/skills/types.d.ts +18 -0
- package/dist/task-log/anchor-child-tasks.d.ts +7 -0
- package/dist/task-log/delegation-trailer.d.ts +34 -0
- package/dist/template/engine.d.ts +2 -2
- package/dist/template/helpers/exec.browser.d.ts +4 -3
- package/dist/template/helpers/exec.d.ts +4 -3
- package/dist/template/helpers/format-conversation.d.ts +1 -0
- package/dist/template/types.d.ts +20 -0
- package/dist/testing/index.js +1 -1
- package/dist/types/index.d.ts +3493 -93
- package/dist/types/task-log.types.d.ts +6 -1
- package/dist/ui-card/index.d.ts +2 -0
- package/dist/ui-card/legacy-card-parser.d.ts +11 -0
- package/dist/ui-instance/definition.d.ts +6 -0
- package/dist/ui-instance/errors.d.ts +18 -0
- package/dist/ui-instance/index.d.ts +11 -0
- package/dist/ui-instance/json.d.ts +19 -0
- package/dist/ui-instance/lineage.d.ts +24 -0
- package/dist/ui-instance/runtime.d.ts +19 -0
- package/dist/ui-instance/store.d.ts +216 -0
- package/dist/ui-instance/types.d.ts +384 -0
- package/dist/ui-plugin/app-icon.d.ts +50 -0
- package/dist/ui-plugin/app-manifest.d.ts +64 -0
- package/dist/ui-plugin/csp.d.ts +28 -0
- package/dist/ui-plugin/index.d.ts +8 -0
- package/dist/ui-plugin/limits.d.ts +27 -0
- package/dist/ui-plugin/manifest.d.ts +3 -0
- package/dist/ui-plugin/types.d.ts +220 -0
- package/dist/ui-plugin/validator.d.ts +18 -0
- package/dist/utils/crewx-executable.d.ts +76 -0
- package/dist/utils/crewx-home.d.ts +1 -0
- package/dist/utils/env-defaults.d.ts +3 -0
- package/dist/utils/id.d.ts +1 -1
- package/dist/utils/local-identity.d.ts +2 -0
- package/dist/utils/runner-env.d.ts +3 -0
- package/dist/utils/timestamp.d.ts +1 -0
- package/dist/utils/workspace.d.ts +1 -0
- package/dist/wi/create.d.ts +48 -0
- package/dist/wi/select.d.ts +20 -0
- package/package.json +83 -3
- package/templates/agents/default.yaml +311 -128
- package/templates/documents/crewx-manual.md +138 -138
- package/templates/documents/crewx-quick-guide.md +8 -7
- package/templates/workflows/wi-default-flow.yaml +65 -0
- package/templates/workflows/wi-plan-flow.yaml +140 -0
|
@@ -0,0 +1,193 @@
|
|
|
1
|
+
import { BaseSqliteRepository } from './base-sqlite-repository.js';
|
|
2
|
+
import { RepositoryError } from './errors.js';
|
|
3
|
+
import type { ThreadActorType, ThreadEvent, ThreadHighlight, ThreadHighlightKind, ThreadHighlightRun, ThreadHighlightSource } from '../schema/index.js';
|
|
4
|
+
import type { ThreadPriority, ThreadState } from './thread-title.types.js';
|
|
5
|
+
export interface ThreadActorInput {
|
|
6
|
+
actorType?: ThreadActorType;
|
|
7
|
+
actorId?: string | null;
|
|
8
|
+
actor?: {
|
|
9
|
+
actorType?: ThreadActorType;
|
|
10
|
+
actorId?: string | null;
|
|
11
|
+
};
|
|
12
|
+
}
|
|
13
|
+
export interface ThreadSnapshotMutationInput extends ThreadActorInput {
|
|
14
|
+
threadId: string;
|
|
15
|
+
workspaceId?: string | null;
|
|
16
|
+
title?: string | null;
|
|
17
|
+
priority?: ThreadPriority | null;
|
|
18
|
+
state?: ThreadState | null;
|
|
19
|
+
taskId?: string | null;
|
|
20
|
+
}
|
|
21
|
+
export interface ThreadSnapshot {
|
|
22
|
+
threadId: string;
|
|
23
|
+
workspaceId: string | null;
|
|
24
|
+
title: string | null;
|
|
25
|
+
priority: ThreadPriority | null;
|
|
26
|
+
state: ThreadState | null;
|
|
27
|
+
metadata: string | null;
|
|
28
|
+
titleLocked: boolean;
|
|
29
|
+
updatedAt: string;
|
|
30
|
+
}
|
|
31
|
+
export interface ThreadTimelineOptions {
|
|
32
|
+
beforeSeq?: number;
|
|
33
|
+
afterSeq?: number;
|
|
34
|
+
limit?: number;
|
|
35
|
+
}
|
|
36
|
+
export interface ThreadTimelineQuery extends ThreadTimelineOptions {
|
|
37
|
+
threadId: string;
|
|
38
|
+
workspaceId: string;
|
|
39
|
+
}
|
|
40
|
+
export interface ThreadTimeline {
|
|
41
|
+
items: ThreadEvent[];
|
|
42
|
+
latestSeq: number;
|
|
43
|
+
hasMoreOlder: boolean;
|
|
44
|
+
}
|
|
45
|
+
export interface CreateThreadHighlightInput extends ThreadActorInput {
|
|
46
|
+
threadId: string;
|
|
47
|
+
workspaceId: string;
|
|
48
|
+
source?: ThreadHighlightSource;
|
|
49
|
+
kind: ThreadHighlightKind;
|
|
50
|
+
text: string;
|
|
51
|
+
taskId?: string;
|
|
52
|
+
coversFromTaskId?: string;
|
|
53
|
+
coversToTaskId?: string;
|
|
54
|
+
fromTaskId?: string;
|
|
55
|
+
toTaskId?: string;
|
|
56
|
+
agentId?: string | null;
|
|
57
|
+
sourceTaskId?: string | null;
|
|
58
|
+
detectorVersion?: string | null;
|
|
59
|
+
contentFingerprint?: string | null;
|
|
60
|
+
idempotencyKey?: string;
|
|
61
|
+
id?: string;
|
|
62
|
+
}
|
|
63
|
+
export interface UpdateThreadHighlightInput extends ThreadActorInput {
|
|
64
|
+
threadId: string;
|
|
65
|
+
workspaceId: string;
|
|
66
|
+
highlightId: string;
|
|
67
|
+
expectedRevision: number;
|
|
68
|
+
text?: string;
|
|
69
|
+
kind?: ThreadHighlightKind;
|
|
70
|
+
coversFromTaskId?: string;
|
|
71
|
+
coversToTaskId?: string;
|
|
72
|
+
}
|
|
73
|
+
export interface DismissThreadHighlightInput extends ThreadActorInput {
|
|
74
|
+
threadId: string;
|
|
75
|
+
workspaceId: string;
|
|
76
|
+
highlightId: string;
|
|
77
|
+
expectedRevision: number;
|
|
78
|
+
}
|
|
79
|
+
export interface ListActiveHighlightsOptions {
|
|
80
|
+
taskId?: string;
|
|
81
|
+
coversFromTaskId?: string;
|
|
82
|
+
coversToTaskId?: string;
|
|
83
|
+
}
|
|
84
|
+
export interface ThreadHighlightEligibleTurn {
|
|
85
|
+
taskId: string;
|
|
86
|
+
prompt: string;
|
|
87
|
+
result: string;
|
|
88
|
+
status: string;
|
|
89
|
+
startedAt: string;
|
|
90
|
+
completedAt: string | null;
|
|
91
|
+
}
|
|
92
|
+
export interface CreateThreadHighlightRegenerationRunInput extends ThreadActorInput {
|
|
93
|
+
threadId: string;
|
|
94
|
+
workspaceId: string;
|
|
95
|
+
requestId: string;
|
|
96
|
+
detectorVersion: string;
|
|
97
|
+
runId?: string;
|
|
98
|
+
}
|
|
99
|
+
export interface CreateThreadHighlightRegenerationRunResult {
|
|
100
|
+
run: ThreadHighlightRun;
|
|
101
|
+
created: boolean;
|
|
102
|
+
}
|
|
103
|
+
export interface FailThreadHighlightRegenerationRunInput extends ThreadActorInput {
|
|
104
|
+
runId: string;
|
|
105
|
+
workspaceId?: string;
|
|
106
|
+
errorCode: string;
|
|
107
|
+
}
|
|
108
|
+
export interface ThreadHighlightRegenerationCandidate {
|
|
109
|
+
kind: ThreadHighlightKind;
|
|
110
|
+
text: string;
|
|
111
|
+
anchorTaskId: string;
|
|
112
|
+
coversFromTaskId: string;
|
|
113
|
+
coversToTaskId: string;
|
|
114
|
+
contentFingerprint?: string;
|
|
115
|
+
}
|
|
116
|
+
export interface CompleteThreadHighlightRegenerationInput extends ThreadActorInput {
|
|
117
|
+
runId: string;
|
|
118
|
+
threadId: string;
|
|
119
|
+
workspaceId: string;
|
|
120
|
+
detectorVersion: string;
|
|
121
|
+
agentId?: string | null;
|
|
122
|
+
candidates: readonly ThreadHighlightRegenerationCandidate[];
|
|
123
|
+
}
|
|
124
|
+
export interface CompleteThreadHighlightRegenerationResult {
|
|
125
|
+
run: ThreadHighlightRun;
|
|
126
|
+
deletedCount: number;
|
|
127
|
+
createdCount: number;
|
|
128
|
+
previousAutoCount: number;
|
|
129
|
+
newAutoCount: number;
|
|
130
|
+
}
|
|
131
|
+
export declare const THREAD_HIGHLIGHT_DELETION_REASON_REGENERATION_REPLACED: "regeneration_replaced";
|
|
132
|
+
export type ThreadHighlightDeletionReason = typeof THREAD_HIGHLIGHT_DELETION_REASON_REGENERATION_REPLACED;
|
|
133
|
+
export declare const THREAD_HIGHLIGHT_REGENERATION_NO_ELIGIBLE_TURNS: "THREAD_HIGHLIGHT_REGENERATION_NO_ELIGIBLE_TURNS";
|
|
134
|
+
export declare const THREAD_HIGHLIGHT_REGENERATION_INTERRUPTED: "THREAD_HIGHLIGHT_REGENERATION_INTERRUPTED";
|
|
135
|
+
export declare const THREAD_HIGHLIGHT_REGENERATION_DETECTION_FAILED: "THREAD_HIGHLIGHT_REGENERATION_DETECTION_FAILED";
|
|
136
|
+
export declare const THREAD_HIGHLIGHT_REGENERATION_COMMIT_FAILED: "THREAD_HIGHLIGHT_REGENERATION_COMMIT_FAILED";
|
|
137
|
+
export type ThreadHighlightRegenerationErrorCode = typeof THREAD_HIGHLIGHT_REGENERATION_NO_ELIGIBLE_TURNS | typeof THREAD_HIGHLIGHT_REGENERATION_INTERRUPTED | typeof THREAD_HIGHLIGHT_REGENERATION_DETECTION_FAILED | typeof THREAD_HIGHLIGHT_REGENERATION_COMMIT_FAILED | string;
|
|
138
|
+
export declare class ThreadHistoryConflictError extends RepositoryError {
|
|
139
|
+
readonly threadId: string;
|
|
140
|
+
readonly highlightId: string;
|
|
141
|
+
readonly expectedRevision: number;
|
|
142
|
+
readonly currentRevision: number;
|
|
143
|
+
constructor(threadId: string, highlightId: string, expectedRevision: number, currentRevision: number);
|
|
144
|
+
}
|
|
145
|
+
export declare class ThreadHighlightConflictError extends ThreadHistoryConflictError {
|
|
146
|
+
}
|
|
147
|
+
export declare class ThreadHighlightRegenerationConflictError extends RepositoryError {
|
|
148
|
+
readonly stableCode: "THREAD_HIGHLIGHT_REGENERATION_IN_PROGRESS";
|
|
149
|
+
readonly run: ThreadHighlightRun;
|
|
150
|
+
constructor(run: ThreadHighlightRun);
|
|
151
|
+
}
|
|
152
|
+
export declare class ThreadHistoryRepository extends BaseSqliteRepository {
|
|
153
|
+
private readonly dbPath?;
|
|
154
|
+
constructor(opts?: {
|
|
155
|
+
dbPath?: string;
|
|
156
|
+
dbRoot?: string;
|
|
157
|
+
});
|
|
158
|
+
resolveDbPath(): string;
|
|
159
|
+
private openHandle;
|
|
160
|
+
private findThread;
|
|
161
|
+
private findRegenerationRun;
|
|
162
|
+
resolveWorkspaceId(threadId: string): string | null;
|
|
163
|
+
getSnapshot(threadId: string, workspaceId?: string | null): ThreadSnapshot | null;
|
|
164
|
+
updateSnapshot(input: ThreadSnapshotMutationInput): ThreadSnapshot;
|
|
165
|
+
mutateSnapshot(input: ThreadSnapshotMutationInput): ThreadSnapshot;
|
|
166
|
+
updateThreadSnapshot(input: ThreadSnapshotMutationInput): ThreadSnapshot;
|
|
167
|
+
getLatestSeq(threadId: string, workspaceId?: string | null): number | null;
|
|
168
|
+
listCompletedThreadHighlightTurns(threadId: string, workspaceId: string): ThreadHighlightEligibleTurn[] | null;
|
|
169
|
+
createHighlightRegenerationRun(input: CreateThreadHighlightRegenerationRunInput): CreateThreadHighlightRegenerationRunResult;
|
|
170
|
+
beginHighlightRegenerationRun(input: CreateThreadHighlightRegenerationRunInput): CreateThreadHighlightRegenerationRunResult;
|
|
171
|
+
queueHighlightRegenerationRun(input: CreateThreadHighlightRegenerationRunInput): CreateThreadHighlightRegenerationRunResult;
|
|
172
|
+
getHighlightRegenerationRun(runId: string, workspaceId?: string): ThreadHighlightRun | null;
|
|
173
|
+
getHighlightRegenerationRunByRequest(threadId: string, workspaceId: string, requestId: string): ThreadHighlightRun | null;
|
|
174
|
+
findHighlightRegenerationRun(threadId: string, workspaceId: string, requestId: string): ThreadHighlightRun | null;
|
|
175
|
+
startHighlightRegenerationRun(runId: string, workspaceId?: string): ThreadHighlightRun;
|
|
176
|
+
startHighlightRegeneration(runId: string, workspaceId?: string): ThreadHighlightRun;
|
|
177
|
+
failHighlightRegenerationRun(input: FailThreadHighlightRegenerationRunInput): ThreadHighlightRun;
|
|
178
|
+
failHighlightRegeneration(input: FailThreadHighlightRegenerationRunInput): ThreadHighlightRun;
|
|
179
|
+
recoverInterruptedHighlightRegenerationRuns(errorCode?: string): number;
|
|
180
|
+
completeHighlightRegenerationRun(input: CompleteThreadHighlightRegenerationInput): CompleteThreadHighlightRegenerationResult;
|
|
181
|
+
completeHighlightRegeneration(input: CompleteThreadHighlightRegenerationInput): CompleteThreadHighlightRegenerationResult;
|
|
182
|
+
replaceAutoHighlightsAtomically(input: CompleteThreadHighlightRegenerationInput): CompleteThreadHighlightRegenerationResult;
|
|
183
|
+
listTimeline(query: ThreadTimelineQuery): ThreadTimeline | null;
|
|
184
|
+
listTimeline(threadId: string, workspaceId: string, options?: ThreadTimelineOptions): ThreadTimeline | null;
|
|
185
|
+
listEvents(threadId: string, workspaceId: string, options?: ThreadTimelineOptions): ThreadTimeline | null;
|
|
186
|
+
getTimeline(threadId: string, workspaceId: string, options?: ThreadTimelineOptions): ThreadTimeline | null;
|
|
187
|
+
createHighlight(input: CreateThreadHighlightInput): ThreadHighlight;
|
|
188
|
+
updateHighlight(input: UpdateThreadHighlightInput): ThreadHighlight;
|
|
189
|
+
dismissHighlight(input: DismissThreadHighlightInput): ThreadHighlight;
|
|
190
|
+
listActiveHighlights(threadId: string, workspaceId: string, options?: ListActiveHighlightsOptions): ThreadHighlight[] | null;
|
|
191
|
+
listHighlights(threadId: string, workspaceId: string, options?: ListActiveHighlightsOptions): ThreadHighlight[] | null;
|
|
192
|
+
getActiveHighlights(threadId: string, workspaceId: string, options?: ListActiveHighlightsOptions): ThreadHighlight[] | null;
|
|
193
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
export type ThreadOriginKind = 'human' | 'agent' | 'system';
|
|
2
|
+
export interface ThreadOriginRow {
|
|
3
|
+
origin: 'direct' | 'delegated';
|
|
4
|
+
delegatedByAgentId: string | null;
|
|
5
|
+
}
|
|
6
|
+
export interface RawThreadOriginRow {
|
|
7
|
+
task_id: string;
|
|
8
|
+
thread_id: string;
|
|
9
|
+
caller_agent_id: string | null;
|
|
10
|
+
parent_task_id: string | null;
|
|
11
|
+
schedule_id: unknown;
|
|
12
|
+
platform: string | null;
|
|
13
|
+
parent_thread_id: string | null;
|
|
14
|
+
parent_agent_id: string | null;
|
|
15
|
+
}
|
|
16
|
+
export interface RawThreadCreatorPointerRow {
|
|
17
|
+
thread_id: string;
|
|
18
|
+
created_by_kind: string | null;
|
|
19
|
+
created_by_id: string | null;
|
|
20
|
+
created_by_task_id: string | null;
|
|
21
|
+
creator_task_id: string | null;
|
|
22
|
+
creator_actor_kind: string | null;
|
|
23
|
+
creator_actor_id: string | null;
|
|
24
|
+
creator_pointer_unverified: number;
|
|
25
|
+
}
|
|
26
|
+
export declare function lineageThreadOrigin(row: RawThreadOriginRow): ThreadOriginRow;
|
|
27
|
+
export declare function resolveThreadOrigin(row: RawThreadCreatorPointerRow, pointerLineage?: RawThreadOriginRow, fallbackLineage?: RawThreadOriginRow): ThreadOriginRow | undefined;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
export declare const THREAD_PRIORITIES: readonly ["urgent", "high", "medium", "low"];
|
|
2
|
+
export type ThreadPriority = (typeof THREAD_PRIORITIES)[number];
|
|
3
|
+
export declare const BUILTIN_THREAD_STATES: readonly ["investigating", "in-progress", "in-review", "on-hold", "done"];
|
|
4
|
+
export type BuiltinThreadState = (typeof BUILTIN_THREAD_STATES)[number];
|
|
5
|
+
export type StableThreadState = BuiltinThreadState | `c_${string}`;
|
|
6
|
+
export type LegacyThreadState = `custom:${string}`;
|
|
7
|
+
export type ThreadState = StableThreadState | LegacyThreadState;
|
|
8
|
+
export interface ThreadTitleMeta {
|
|
9
|
+
priority?: ThreadPriority;
|
|
10
|
+
state?: ThreadState;
|
|
11
|
+
}
|
|
12
|
+
export interface ThreadTitlePatch {
|
|
13
|
+
priority?: ThreadPriority | null;
|
|
14
|
+
state?: ThreadState | null;
|
|
15
|
+
}
|
|
16
|
+
export declare function isThreadPriority(value: unknown): value is ThreadPriority;
|
|
17
|
+
export declare function isThreadState(value: unknown): value is ThreadState;
|
|
18
|
+
export declare function customStateLabel(state: ThreadState): string | undefined;
|
|
19
|
+
export declare function hasThreadTitleKey(metadataJson: string | null | undefined): boolean;
|
|
20
|
+
export declare function readThreadTitleMeta(metadataJson: string | null | undefined): ThreadTitleMeta;
|
|
21
|
+
export declare function mergeThreadTitleMeta(metadataJson: string | null | undefined, patch: ThreadTitlePatch): string | null;
|
|
22
|
+
export declare function threadTitleSearchHaystack(meta: ThreadTitleMeta, labelNames?: ReadonlyMap<string, string>): string;
|
|
23
|
+
export interface ThreadTitleFilter {
|
|
24
|
+
values: Set<string>;
|
|
25
|
+
includeNone: boolean;
|
|
26
|
+
}
|
|
27
|
+
export declare function parseThreadPriorityFilter(raw: string | undefined): ThreadTitleFilter | undefined;
|
|
28
|
+
export declare function parseThreadStateFilter(raw: string | undefined): ThreadTitleFilter | undefined;
|
|
29
|
+
export declare function matchesThreadTitleFilter(current: string | undefined, filter: ThreadTitleFilter | undefined): boolean;
|
|
@@ -1,8 +1,96 @@
|
|
|
1
1
|
import { BaseSqliteRepository } from './base-sqlite-repository.js';
|
|
2
|
+
import type { DrizzleHandle } from './db.js';
|
|
3
|
+
import { RepositoryError } from './errors.js';
|
|
2
4
|
import { threads } from '../schema/index.js';
|
|
5
|
+
import { type TaskStatus } from './task-status.js';
|
|
6
|
+
import type { UnreadReplyCandidate } from './public-task-answer.js';
|
|
7
|
+
import type { ThreadOriginRow } from './thread-origin-verdict.js';
|
|
3
8
|
import type { TaskRow, TaskListRow } from './task.repository.js';
|
|
9
|
+
export type { ThreadOriginRow } from './thread-origin-verdict.js';
|
|
4
10
|
export type ThreadRow = typeof threads.$inferSelect;
|
|
5
11
|
export type NewThread = typeof threads.$inferInsert;
|
|
12
|
+
export type ThreadActorKind = NonNullable<NewThread['created_by_kind']>;
|
|
13
|
+
export interface ThreadCreationOptions {
|
|
14
|
+
createdByKind?: ThreadActorKind | null;
|
|
15
|
+
createdById?: string | null;
|
|
16
|
+
createdByTaskId?: string | null;
|
|
17
|
+
}
|
|
18
|
+
export interface CreateAppLaunchThreadInput {
|
|
19
|
+
threadId: string;
|
|
20
|
+
workspaceId: string;
|
|
21
|
+
platform: string;
|
|
22
|
+
title: string;
|
|
23
|
+
appId: string;
|
|
24
|
+
createdById: string | null;
|
|
25
|
+
initialAgentId?: string;
|
|
26
|
+
}
|
|
27
|
+
export type CreateAppLaunchThreadResult = {
|
|
28
|
+
status: 'created';
|
|
29
|
+
thread: ThreadRow;
|
|
30
|
+
} | {
|
|
31
|
+
status: 'existing';
|
|
32
|
+
thread: ThreadRow;
|
|
33
|
+
} | {
|
|
34
|
+
status: 'conflict';
|
|
35
|
+
};
|
|
36
|
+
export interface UnreadReplyWatermark {
|
|
37
|
+
threadId: string;
|
|
38
|
+
readThroughAt: string | null;
|
|
39
|
+
}
|
|
40
|
+
export interface TaskDescendantSummary {
|
|
41
|
+
total: number;
|
|
42
|
+
running: number;
|
|
43
|
+
pending: number;
|
|
44
|
+
paused: number;
|
|
45
|
+
success: number;
|
|
46
|
+
failed: number;
|
|
47
|
+
stopped: number;
|
|
48
|
+
runnerLost: number;
|
|
49
|
+
checkedAt: string;
|
|
50
|
+
}
|
|
51
|
+
export interface RespondedAgent {
|
|
52
|
+
agentId: string;
|
|
53
|
+
lastRepliedAt: string;
|
|
54
|
+
}
|
|
55
|
+
export interface TaskDescendantRow {
|
|
56
|
+
task: TaskRow;
|
|
57
|
+
parentTaskId: string;
|
|
58
|
+
parentAgentId: string | null;
|
|
59
|
+
depth: number;
|
|
60
|
+
}
|
|
61
|
+
export interface TaskDescendantListOptions {
|
|
62
|
+
states?: readonly TaskStatus[];
|
|
63
|
+
limit?: number;
|
|
64
|
+
cursor?: string | null;
|
|
65
|
+
maxDepth?: number;
|
|
66
|
+
}
|
|
67
|
+
export interface TaskDescendantList {
|
|
68
|
+
rows: TaskDescendantRow[];
|
|
69
|
+
summary: TaskDescendantSummary;
|
|
70
|
+
nextCursor: string | null;
|
|
71
|
+
traversalTruncated: boolean;
|
|
72
|
+
}
|
|
73
|
+
export type ThreadOriginFilter = 'direct' | 'delegated' | 'all';
|
|
74
|
+
type ThreadOriginScope = Exclude<ThreadOriginFilter, 'all'>;
|
|
75
|
+
export interface ThreadTitleMetadataPatch {
|
|
76
|
+
priority?: string | null;
|
|
77
|
+
state?: string | null;
|
|
78
|
+
}
|
|
79
|
+
export interface ThreadTitleMetadataPatchResult {
|
|
80
|
+
threadId: string;
|
|
81
|
+
priority: string | null;
|
|
82
|
+
state: string | null;
|
|
83
|
+
}
|
|
84
|
+
export type ThreadTitleMetadataPatchErrorReason = 'THREAD_TITLE_PATCH_EMPTY' | 'THREAD_TITLE_PATCH_INVALID';
|
|
85
|
+
export declare class ThreadTitleMetadataPatchError extends RepositoryError {
|
|
86
|
+
readonly reason: ThreadTitleMetadataPatchErrorReason;
|
|
87
|
+
constructor(reason: ThreadTitleMetadataPatchErrorReason, message?: string);
|
|
88
|
+
}
|
|
89
|
+
export type ThreadTransaction = Parameters<Parameters<DrizzleHandle['db']['transaction']>[0]>[0];
|
|
90
|
+
export declare function toggleThreadPinInTx(tx: ThreadTransaction, threadId: string, workspaceId?: string): {
|
|
91
|
+
pinned: boolean;
|
|
92
|
+
} | null;
|
|
93
|
+
export declare function reorderPinsInTx(tx: ThreadTransaction, threadIds: string[], workspaceId?: string): void;
|
|
6
94
|
export declare class ThreadRepository extends BaseSqliteRepository {
|
|
7
95
|
private readonly dbPath?;
|
|
8
96
|
constructor(opts?: {
|
|
@@ -11,10 +99,22 @@ export declare class ThreadRepository extends BaseSqliteRepository {
|
|
|
11
99
|
});
|
|
12
100
|
resolveDbPath(): string;
|
|
13
101
|
private openHandle;
|
|
14
|
-
private validateWorkspaceId;
|
|
15
102
|
private topLevelTaskPredicateSql;
|
|
16
|
-
|
|
103
|
+
private workflowAnchorPredicateSql;
|
|
104
|
+
private descendantTraversalSql;
|
|
105
|
+
private descendantSkippedSql;
|
|
106
|
+
private findAllThreadsQuery;
|
|
107
|
+
private findThreadIdsQuery;
|
|
108
|
+
private readThreadIds;
|
|
109
|
+
private findThreadSortKeysQuery;
|
|
110
|
+
private readThreadSortKeys;
|
|
111
|
+
private readThreadRowsByIds;
|
|
112
|
+
private readThreadRows;
|
|
113
|
+
findAllThreads(workspaceId?: string, createdByKind?: ThreadActorKind): ThreadRow[];
|
|
114
|
+
explainFindAllThreadsPlan(workspaceId?: string, createdByKind?: ThreadActorKind): string[];
|
|
115
|
+
findThreadsByIdsOrTitles(ids: string[], workspaceId?: string): ThreadRow[];
|
|
17
116
|
findThreadById(threadId: string, workspaceId?: string): ThreadRow | undefined;
|
|
117
|
+
createAppLaunchThread(input: CreateAppLaunchThreadInput): CreateAppLaunchThreadResult;
|
|
18
118
|
threadExists(threadId: string, workspaceId?: string): boolean;
|
|
19
119
|
aggregateTaskStats(threadId: string, workspaceId?: string): {
|
|
20
120
|
taskCount: number;
|
|
@@ -23,24 +123,52 @@ export declare class ThreadRepository extends BaseSqliteRepository {
|
|
|
23
123
|
cachedInputTokens: number;
|
|
24
124
|
costUsd: number;
|
|
25
125
|
agentIds: string[];
|
|
126
|
+
delegated: {
|
|
127
|
+
taskCount: number;
|
|
128
|
+
inputTokens: number;
|
|
129
|
+
outputTokens: number;
|
|
130
|
+
cachedInputTokens: number;
|
|
131
|
+
costUsd: number;
|
|
132
|
+
};
|
|
26
133
|
};
|
|
27
|
-
|
|
134
|
+
getDescendantSummaryByTaskId(threadId: string, workspaceId?: string): Record<string, TaskDescendantSummary>;
|
|
135
|
+
listUnreadReplyCandidates(watermarks: readonly UnreadReplyWatermark[], workspaceId?: string): Map<string, UnreadReplyCandidate[]>;
|
|
136
|
+
private unreadReplyCandidatesQuery;
|
|
137
|
+
getThreadTaskStatusBatch(threadIds: string[], workspaceId?: string): {
|
|
138
|
+
tasksByThread: Map<string, TaskListRow[]>;
|
|
139
|
+
descendantSummaryByTaskId: Record<string, TaskDescendantSummary>;
|
|
140
|
+
};
|
|
141
|
+
listDescendantsByTaskId(taskId: string, workspaceId: string, options?: TaskDescendantListOptions): TaskDescendantList | undefined;
|
|
142
|
+
findInterceptedRequests(taskIds: readonly string[]): Map<string, string>;
|
|
143
|
+
findTopLevelTasks(threadId: string, workspaceId?: string, limit?: number, ownAgentId?: string): TaskRow[];
|
|
28
144
|
findAllTasks(threadId: string, workspaceId?: string): TaskRow[];
|
|
145
|
+
findRespondedAgents(threadId: string, workspaceId?: string): RespondedAgent[];
|
|
29
146
|
findTaskById(threadId: string, taskId: string, workspaceId?: string): {
|
|
30
147
|
task: TaskRow;
|
|
31
148
|
children: TaskRow[];
|
|
32
149
|
} | undefined;
|
|
33
150
|
private batchFetchTasksQuery;
|
|
34
151
|
batchFetchTasks(threadIds: string[], workspaceId?: string): Map<string, TaskListRow[]>;
|
|
152
|
+
private findThreadOriginsQuery;
|
|
153
|
+
private findCreatorPointersQuery;
|
|
154
|
+
private findTaskOriginLineageQuery;
|
|
155
|
+
findThreadOrigins(threadIds: string[], workspaceId?: string): Map<string, ThreadOriginRow>;
|
|
156
|
+
findThreadsByOrigin(origin: ThreadOriginScope, workspaceId?: string): ThreadRow[];
|
|
157
|
+
findRecentDirectThreads(workspaceId: string, limit?: number): {
|
|
158
|
+
threads: ThreadRow[];
|
|
159
|
+
originsByThread: Map<string, ThreadOriginRow>;
|
|
160
|
+
};
|
|
35
161
|
explainBatchFetchTasksPlan(threadIds: string[], workspaceId?: string): string[];
|
|
162
|
+
explainFindThreadOriginsPlan(threadIds: string[], workspaceId?: string): string[];
|
|
163
|
+
explainFindThreadsByOriginPlan(origin: ThreadOriginScope, workspaceId?: string): string[];
|
|
36
164
|
updateThreadTitle(threadId: string, title: string, workspaceId?: string): void;
|
|
37
165
|
upsertThread(threadId: string, opts: {
|
|
38
166
|
platform: string;
|
|
39
167
|
workspaceId?: string;
|
|
40
168
|
title?: string;
|
|
41
169
|
titleLocked?: boolean;
|
|
42
|
-
}): void;
|
|
43
|
-
ensureThread(threadId: string, platform: string, workspaceId?: string): void;
|
|
170
|
+
} & ThreadCreationOptions): void;
|
|
171
|
+
ensureThread(threadId: string, platform: string, workspaceId?: string, creator?: ThreadCreationOptions): void;
|
|
44
172
|
saveUserMessage(threadId: string, text: string, opts?: {
|
|
45
173
|
platform?: string;
|
|
46
174
|
model?: string;
|
|
@@ -58,6 +186,7 @@ export declare class ThreadRepository extends BaseSqliteRepository {
|
|
|
58
186
|
title?: string;
|
|
59
187
|
titleLocked?: boolean;
|
|
60
188
|
}): void;
|
|
189
|
+
patchThreadTitleMetadata(threadId: string, patch: ThreadTitleMetadataPatch, workspaceId?: string): ThreadTitleMetadataPatchResult | ThreadTitleMetadataPatchError | null;
|
|
61
190
|
togglePin(threadId: string, workspaceId?: string): {
|
|
62
191
|
pinned: boolean;
|
|
63
192
|
} | null;
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
export type UsageBackfillMode = 'dry-run' | 'apply' | 'verify' | 'restore';
|
|
2
|
+
export declare const USAGE_BACKFILL_TERMINAL_STATUSES: readonly ["success", "failed", "completed"];
|
|
3
|
+
export declare const USAGE_BACKFILL_MAX_LATE_USAGE_AGE_MS: number;
|
|
4
|
+
export declare const USAGE_BACKFILL_UNDO_SCHEMA_VERSION = 2;
|
|
5
|
+
export declare const USAGE_BACKFILL_SNAPSHOT_ROW_BYTES = 2048;
|
|
6
|
+
export declare const USAGE_BACKFILL_MIN_FREE_SPACE_RESERVE_BYTES: number;
|
|
7
|
+
export type UsageAccountingReason = 'pre-instrumentation' | 'provider-no-usage' | 'suppressed-by-adapter' | 'not-captured';
|
|
8
|
+
export interface UsageBackfillOptions {
|
|
9
|
+
mode: UsageBackfillMode;
|
|
10
|
+
dbPath?: string;
|
|
11
|
+
backupPath?: string;
|
|
12
|
+
restorePath?: string;
|
|
13
|
+
now?: Date | string | number;
|
|
14
|
+
}
|
|
15
|
+
export interface UsageBackfillProviderStats {
|
|
16
|
+
candidates: number;
|
|
17
|
+
recovered: number;
|
|
18
|
+
unavailable: number;
|
|
19
|
+
deferred: number;
|
|
20
|
+
}
|
|
21
|
+
export interface UsageBackfillFailure {
|
|
22
|
+
taskId: string;
|
|
23
|
+
reason: string;
|
|
24
|
+
}
|
|
25
|
+
export interface UsageBackfillReport {
|
|
26
|
+
mode: UsageBackfillMode;
|
|
27
|
+
ok: boolean;
|
|
28
|
+
dbPath: string;
|
|
29
|
+
scannedTasks: number;
|
|
30
|
+
terminalTasks: number;
|
|
31
|
+
rawTargetTasks: number;
|
|
32
|
+
candidateTasks: number;
|
|
33
|
+
recoveredTasks: number;
|
|
34
|
+
unavailableTasks: number;
|
|
35
|
+
deferredTasks: number;
|
|
36
|
+
changedTasks: number;
|
|
37
|
+
wouldChangeTasks: number;
|
|
38
|
+
accountingTasks: number;
|
|
39
|
+
remainingTargetTasks: number;
|
|
40
|
+
providerDistribution: Record<string, UsageBackfillProviderStats>;
|
|
41
|
+
reasonCounts: Record<UsageAccountingReason, number>;
|
|
42
|
+
estimatedFreeSpaceBytes: number;
|
|
43
|
+
requiredFreeSpaceBytes: number;
|
|
44
|
+
availableFreeSpaceBytes: number;
|
|
45
|
+
minimumFreeSpaceReserveBytes: number;
|
|
46
|
+
freeSpaceGatePassed: boolean;
|
|
47
|
+
backupPath?: string;
|
|
48
|
+
snapshotPath?: string;
|
|
49
|
+
backupMethod?: 'row-undo-snapshot';
|
|
50
|
+
restored: number;
|
|
51
|
+
skippedConflict: number;
|
|
52
|
+
conflictSamples: UsageBackfillConflict[];
|
|
53
|
+
blockedReason?: string;
|
|
54
|
+
failures: UsageBackfillFailure[];
|
|
55
|
+
warnings: string[];
|
|
56
|
+
}
|
|
57
|
+
export interface UsageBackfillConflict {
|
|
58
|
+
taskId: string;
|
|
59
|
+
fields: string[];
|
|
60
|
+
}
|
|
61
|
+
export declare function classifyUsageAccountingReason(provider: string | undefined, stdout?: string): UsageAccountingReason;
|
|
62
|
+
export declare function runUsageBackfill(options: UsageBackfillOptions): Promise<UsageBackfillReport>;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { CliProviderAdapter } from '../provider/cli/adapter.types.js';
|
|
2
|
+
import type { TaskLogRepositoryContract } from './task-log.repository.js';
|
|
3
|
+
export interface RecoveredTaskUsage {
|
|
4
|
+
inputTokens: number;
|
|
5
|
+
outputTokens: number;
|
|
6
|
+
cachedInputTokens: number;
|
|
7
|
+
costUsd: number;
|
|
8
|
+
model: string | null;
|
|
9
|
+
complete?: boolean;
|
|
10
|
+
}
|
|
11
|
+
export interface TaskLogUsageRecovery {
|
|
12
|
+
stdout: string;
|
|
13
|
+
adapter: CliProviderAdapter;
|
|
14
|
+
usage?: RecoveredTaskUsage;
|
|
15
|
+
}
|
|
16
|
+
export interface RecoverUsageFromTaskLogsOptions {
|
|
17
|
+
taskLogRepository: Pick<TaskLogRepositoryContract, 'readLogs'>;
|
|
18
|
+
taskId: string;
|
|
19
|
+
provider?: string | null;
|
|
20
|
+
model?: string | null;
|
|
21
|
+
}
|
|
22
|
+
export declare function recoverUsageFromTaskLogs(options: RecoverUsageFromTaskLogsOptions): TaskLogUsageRecovery | undefined;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export declare const WORKFLOW_ANCHOR_TASK_KINDS: readonly ["workflow_card", "workflow_ui_instance", "workflow_run"];
|
|
2
|
+
export type WorkflowAnchorTaskKind = (typeof WORKFLOW_ANCHOR_TASK_KINDS)[number];
|
|
3
|
+
export declare function isWorkflowAnchorTaskKind(value: unknown): value is WorkflowAnchorTaskKind;
|
|
4
|
+
export declare function readWorkflowRunIdFromMetadata(metadata: string | null | undefined): string | null;
|
|
@@ -48,6 +48,9 @@ export declare class WorkspaceRepository extends BaseSqliteRepository {
|
|
|
48
48
|
total: number;
|
|
49
49
|
};
|
|
50
50
|
findById(id: string): ProjectRow | undefined;
|
|
51
|
+
toggleStar(id: string): {
|
|
52
|
+
starred: boolean;
|
|
53
|
+
} | null;
|
|
51
54
|
findAgentsByProject(id: string): string[];
|
|
52
55
|
findThreadsByProject(id: string, params: {
|
|
53
56
|
limit: number;
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import type { RouteObservationSource } from './eligibility.js';
|
|
2
|
+
import type { RouteCandidate, RouteConfig, RouteDecision, RouteLinkError, RouteRequest, RouteRunner } from './types.js';
|
|
3
|
+
import type { RouteDecisionStore } from './store.js';
|
|
4
|
+
export interface RouteDecisionServiceOptions {
|
|
5
|
+
store: RouteDecisionStore;
|
|
6
|
+
observationSource?: RouteObservationSource;
|
|
7
|
+
workspaceRoot?: string;
|
|
8
|
+
clock?: () => number;
|
|
9
|
+
chainTimeoutMs?: number;
|
|
10
|
+
maxCasRetries?: number;
|
|
11
|
+
customRunners?: Readonly<Record<string, RouteRunner>>;
|
|
12
|
+
linkRunnerOverrides?: Readonly<Record<string, RouteRunner>>;
|
|
13
|
+
}
|
|
14
|
+
export interface RecordRouteQuotaFailureInput {
|
|
15
|
+
decision: RouteDecision;
|
|
16
|
+
accountRef?: string;
|
|
17
|
+
resetAt?: number | string;
|
|
18
|
+
now?: number;
|
|
19
|
+
}
|
|
20
|
+
export interface RoutePreviewItem {
|
|
21
|
+
candidateId: string;
|
|
22
|
+
provider: string;
|
|
23
|
+
model: string;
|
|
24
|
+
reason: string;
|
|
25
|
+
eligibleIds: string[];
|
|
26
|
+
blockedCauses: RouteDecision['blockedCauses'];
|
|
27
|
+
linkErrors: RouteLinkError[];
|
|
28
|
+
}
|
|
29
|
+
export declare function routeConfigRevision(route: RouteConfig): string;
|
|
30
|
+
export declare class RouteDecisionService {
|
|
31
|
+
private readonly store;
|
|
32
|
+
private readonly observationSource?;
|
|
33
|
+
private readonly workspaceRoot;
|
|
34
|
+
private readonly clock;
|
|
35
|
+
private readonly chainTimeoutMs;
|
|
36
|
+
private readonly maxCasRetries;
|
|
37
|
+
private readonly customRunners;
|
|
38
|
+
private readonly linkRunnerOverrides;
|
|
39
|
+
private readonly routeLocks;
|
|
40
|
+
constructor(options: RouteDecisionServiceOptions);
|
|
41
|
+
private links;
|
|
42
|
+
private withRouteLock;
|
|
43
|
+
private decideSerial;
|
|
44
|
+
decide(routeId: string, route: RouteConfig, request: RouteRequest): Promise<RouteDecision>;
|
|
45
|
+
previewRoute(routeId: string, route: RouteConfig, request: RouteRequest, count?: number): Promise<RoutePreviewItem[]>;
|
|
46
|
+
recordQuotaFailure(input: RecordRouteQuotaFailureInput): Promise<void>;
|
|
47
|
+
}
|
|
48
|
+
export declare function previewRoute(route: RouteConfig, count: number, options?: {
|
|
49
|
+
routeId?: string;
|
|
50
|
+
candidates?: RouteCandidate[];
|
|
51
|
+
now?: number;
|
|
52
|
+
agentId?: string;
|
|
53
|
+
mode?: RouteRequest['mode'];
|
|
54
|
+
}): RoutePreviewItem[];
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { RouteBlockedCause, RouteCandidate, RouteCandidateConfig, RouteQuotaObservation } from './types.js';
|
|
2
|
+
export declare const ROUTE_QUOTA_COOLDOWN_MS: number;
|
|
3
|
+
export interface RouteObservationSource {
|
|
4
|
+
getObservations(candidates: readonly RouteCandidateConfig[], now: number): Promise<RouteQuotaObservation[]> | RouteQuotaObservation[];
|
|
5
|
+
}
|
|
6
|
+
export interface RouteEligibilityResult {
|
|
7
|
+
candidates: RouteCandidate[];
|
|
8
|
+
blockedCauses: RouteBlockedCause[];
|
|
9
|
+
}
|
|
10
|
+
export declare function evaluateRouteEligibility(candidates: readonly RouteCandidateConfig[], observations: readonly RouteQuotaObservation[], now: number): RouteEligibilityResult;
|
|
11
|
+
export declare function quotaResetAt(resetAt: number | string | undefined, now: number): number;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export type RouteErrorCode = 'route_no_eligible_candidate' | 'route_state_contention' | 'sticky_unavailable' | 'route_observation_unavailable' | 'invalid_route_config';
|
|
2
|
+
export declare class RouteError extends Error {
|
|
3
|
+
readonly code: RouteErrorCode;
|
|
4
|
+
readonly details?: Record<string, unknown> | undefined;
|
|
5
|
+
constructor(code: RouteErrorCode, message: string, details?: Record<string, unknown> | undefined);
|
|
6
|
+
}
|
|
7
|
+
export type RouteRunnerErrorCode = 'invalid_json' | 'input_too_large' | 'output_too_large' | 'outside_workspace' | 'module_not_found' | 'timeout' | 'process_failed';
|
|
8
|
+
export declare class RouteRunnerError extends Error {
|
|
9
|
+
readonly code: RouteRunnerErrorCode;
|
|
10
|
+
constructor(code: RouteRunnerErrorCode, message: string);
|
|
11
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export { RouteConfigSchema, RouteCandidateConfigSchema, RouteLinkConfigSchema } from './types.js';
|
|
2
|
+
export type { JsonPrimitive, JsonValue, RouteBlockedCause, RouteCandidate, RouteCandidateConfig, RouteConfig, RouteContext, RouteDecision, RouteFunction, RouteHealth, RouteLinkConfig, RouteLinkError, RouteMode, RouteOutput, RoutePassOutput, RouteQuotaObservation, RouteRequest, RouteRunner, RouteSelectOutput, } from './types.js';
|
|
3
|
+
export { RouteError, RouteRunnerError } from './errors.js';
|
|
4
|
+
export type { RouteErrorCode, RouteRunnerErrorCode } from './errors.js';
|
|
5
|
+
export { builtInStrategy, roundRobin, smoothWeighted } from './strategies.js';
|
|
6
|
+
export { fnRunner, procRunner, resolveRouteModulePath, ROUTE_CHAIN_TIMEOUT_MS, ROUTE_JSON_MAX_BYTES, ROUTE_PROCESS_INPUT_MAX_BYTES, ROUTE_PROCESS_OUTPUT_MAX_BYTES, } from './runner.js';
|
|
7
|
+
export type { ProcRunnerOptions } from './runner.js';
|
|
8
|
+
export { evaluateRouteEligibility, quotaResetAt, ROUTE_QUOTA_COOLDOWN_MS } from './eligibility.js';
|
|
9
|
+
export type { RouteEligibilityResult, RouteObservationSource } from './eligibility.js';
|
|
10
|
+
export { MemoryRouteStore } from './store.js';
|
|
11
|
+
export type { RouteCommitResult, RouteDecisionCommit, RouteDecisionStore, RouteObservationStore, RouteStateSnapshot, } from './store.js';
|
|
12
|
+
export { RouteSqliteStore } from './sqlite-store.js';
|
|
13
|
+
export { RouteDecisionService, previewRoute, routeConfigRevision } from './decide.js';
|
|
14
|
+
export type { RecordRouteQuotaFailureInput, RouteDecisionServiceOptions, RoutePreviewItem, } from './decide.js';
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { RouteFunction, RouteRunner } from './types.js';
|
|
2
|
+
export declare const ROUTE_JSON_MAX_BYTES: number;
|
|
3
|
+
export declare const ROUTE_PROCESS_INPUT_MAX_BYTES: number;
|
|
4
|
+
export declare const ROUTE_PROCESS_OUTPUT_MAX_BYTES: number;
|
|
5
|
+
export declare const ROUTE_CHAIN_TIMEOUT_MS = 2000;
|
|
6
|
+
export interface ProcRunnerOptions {
|
|
7
|
+
workspaceRoot: string;
|
|
8
|
+
timeoutMs?: number;
|
|
9
|
+
maxInputBytes?: number;
|
|
10
|
+
maxOutputBytes?: number;
|
|
11
|
+
onSpawn?: (processGroupId: number | undefined) => void;
|
|
12
|
+
}
|
|
13
|
+
export declare function fnRunner(fn: RouteFunction): RouteRunner;
|
|
14
|
+
export declare function procRunner(file: string, options: ProcRunnerOptions): RouteRunner;
|
|
15
|
+
export declare function resolveRouteModulePath(file: string, workspaceRoot: string): string;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { BaseSqliteRepository } from '../repository/base-sqlite-repository.js';
|
|
2
|
+
import type { RouteDecision, RouteQuotaObservation, RouteCandidateConfig } from './types.js';
|
|
3
|
+
import type { RouteDecisionCommit, RouteDecisionStore, RouteObservationStore, RouteStateSnapshot, RouteCommitResult } from './store.js';
|
|
4
|
+
export declare class RouteSqliteStore extends BaseSqliteRepository implements RouteDecisionStore, RouteObservationStore {
|
|
5
|
+
private readonly configuredDbPath?;
|
|
6
|
+
constructor(options?: {
|
|
7
|
+
dbPath?: string;
|
|
8
|
+
dbRoot?: string;
|
|
9
|
+
});
|
|
10
|
+
resolveDbPath(): string;
|
|
11
|
+
private openHandle;
|
|
12
|
+
getDecision(routeId: string, taskId: string): Promise<RouteDecision | undefined>;
|
|
13
|
+
loadState(routeId: string, threadId: string | null, configRevision: string): Promise<RouteStateSnapshot>;
|
|
14
|
+
commitDecision(input: RouteDecisionCommit): Promise<RouteCommitResult>;
|
|
15
|
+
recordQuotaObservation(observation: RouteQuotaObservation, observedAt: number): Promise<void>;
|
|
16
|
+
getObservations(candidates: readonly RouteCandidateConfig[], _now: number): Promise<RouteQuotaObservation[]>;
|
|
17
|
+
}
|