@cerebriline/core 4.100.240
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +201 -0
- package/README.md +16 -0
- package/assets/office-oxide/LICENSE-APACHE +176 -0
- package/assets/office-oxide/LICENSE-MIT +25 -0
- package/assets/office-oxide/office_oxide_bg.wasm +0 -0
- package/assets/prompt-templates/claude.md +516 -0
- package/assets/prompt-templates/deepseek.md +331 -0
- package/assets/prompt-templates/default.md +386 -0
- package/assets/prompt-templates/gemma.md +352 -0
- package/assets/prompt-templates/glm.md +334 -0
- package/assets/prompt-templates/kimi-k3.md +408 -0
- package/assets/prompt-templates/kimi.md +402 -0
- package/assets/prompt-templates/minimax.md +473 -0
- package/assets/prompt-templates/nemotron.md +358 -0
- package/assets/prompt-templates/qwen.md +612 -0
- package/dist/ClineCore.d.ts +365 -0
- package/dist/account/cline-account-service.d.ts +41 -0
- package/dist/account/index.d.ts +3 -0
- package/dist/account/rpc.d.ts +40 -0
- package/dist/account/types.d.ts +122 -0
- package/dist/auth/bounded-ttl-cache.d.ts +13 -0
- package/dist/auth/client.d.ts +30 -0
- package/dist/auth/cline.d.ts +71 -0
- package/dist/auth/codex.d.ts +40 -0
- package/dist/auth/oca.d.ts +21 -0
- package/dist/auth/provider-auth-registry.d.ts +52 -0
- package/dist/auth/server.d.ts +54 -0
- package/dist/auth/types.d.ts +103 -0
- package/dist/auth/utils.d.ts +31 -0
- package/dist/cline-core/automation.d.ts +34 -0
- package/dist/cline-core/runtime-services.d.ts +5 -0
- package/dist/cline-core/start-input.d.ts +10 -0
- package/dist/cline-core/telemetry.d.ts +10 -0
- package/dist/cline-core/types.d.ts +236 -0
- package/dist/cron/events/cron-event-ingress.d.ts +37 -0
- package/dist/cron/reports/cron-report-writer.d.ts +42 -0
- package/dist/cron/runner/cron-materializer.d.ts +35 -0
- package/dist/cron/runner/cron-runner.d.ts +60 -0
- package/dist/cron/runner/resource-limiter.d.ts +8 -0
- package/dist/cron/schedule/scheduler.d.ts +12 -0
- package/dist/cron/service/cron-service.d.ts +56 -0
- package/dist/cron/service/schedule-command-service.d.ts +14 -0
- package/dist/cron/service/schedule-service.d.ts +116 -0
- package/dist/cron/service/schedule-tool.d.ts +81 -0
- package/dist/cron/specs/cron-reconciler.d.ts +61 -0
- package/dist/cron/specs/cron-spec-parser.d.ts +26 -0
- package/dist/cron/specs/cron-watcher.d.ts +22 -0
- package/dist/cron/store/cron-schema.d.ts +2 -0
- package/dist/cron/store/sqlite-cron-store.d.ts +261 -0
- package/dist/extensions/agent-plugin/agent-skill.d.ts +21 -0
- package/dist/extensions/agent-plugin/index.d.ts +4 -0
- package/dist/extensions/agent-plugin/loader.d.ts +10 -0
- package/dist/extensions/agent-plugin/types.d.ts +67 -0
- package/dist/extensions/complexity/grammars.d.ts +92 -0
- package/dist/extensions/complexity/walker.d.ts +115 -0
- package/dist/extensions/config/builtin-templates.d.ts +10 -0
- package/dist/extensions/config/builtin-templates.generated.d.ts +5 -0
- package/dist/extensions/config/index.d.ts +15 -0
- package/dist/extensions/config/prompt-template-compaction.d.ts +92 -0
- package/dist/extensions/config/prompt-template-delta.d.ts +107 -0
- package/dist/extensions/config/prompt-template-hooks.d.ts +47 -0
- package/dist/extensions/config/prompt-template-loader.d.ts +79 -0
- package/dist/extensions/config/prompt-template-parser.d.ts +56 -0
- package/dist/extensions/config/prompt-template-review.d.ts +327 -0
- package/dist/extensions/config/prompt-template-session.d.ts +46 -0
- package/dist/extensions/config/runtime-commands.d.ts +23 -0
- package/dist/extensions/config/shipped-tool-signatures.d.ts +36 -0
- package/dist/extensions/config/skill-frontmatter-toggle.d.ts +11 -0
- package/dist/extensions/config/unified-config-file-watcher.d.ts +77 -0
- package/dist/extensions/config/user-instruction-config-loader.d.ts +77 -0
- package/dist/extensions/config/user-instruction-plugin.d.ts +26 -0
- package/dist/extensions/config/user-instruction-service.d.ts +31 -0
- package/dist/extensions/context/agentic-compaction.d.ts +129 -0
- package/dist/extensions/context/basic-compaction.d.ts +19 -0
- package/dist/extensions/context/budget-projection/index.d.ts +2 -0
- package/dist/extensions/context/budget-projection/project.d.ts +4 -0
- package/dist/extensions/context/budget-projection/types.d.ts +58 -0
- package/dist/extensions/context/capped-thinking.d.ts +195 -0
- package/dist/extensions/context/compaction-cause.d.ts +27 -0
- package/dist/extensions/context/compaction-journal.d.ts +65 -0
- package/dist/extensions/context/compaction-revisions.d.ts +72 -0
- package/dist/extensions/context/compaction-shared.d.ts +608 -0
- package/dist/extensions/context/compaction.d.ts +161 -0
- package/dist/extensions/context/context-minimum-warning.d.ts +27 -0
- package/dist/extensions/context/continuation-compaction.d.ts +260 -0
- package/dist/extensions/context/council-compaction.d.ts +262 -0
- package/dist/extensions/context/full-compaction.d.ts +44 -0
- package/dist/extensions/context/kv-pressure.d.ts +258 -0
- package/dist/extensions/context/polykv-session.d.ts +372 -0
- package/dist/extensions/context/replay-compaction.d.ts +90 -0
- package/dist/extensions/context/tool-ledger.d.ts +198 -0
- package/dist/extensions/context/work-digest.d.ts +92 -0
- package/dist/extensions/index.d.ts +7 -0
- package/dist/extensions/mcp/client.d.ts +28 -0
- package/dist/extensions/mcp/config-loader.d.ts +102 -0
- package/dist/extensions/mcp/index.d.ts +15 -0
- package/dist/extensions/mcp/manager.d.ts +23 -0
- package/dist/extensions/mcp/name-transform.d.ts +2 -0
- package/dist/extensions/mcp/oauth.d.ts +68 -0
- package/dist/extensions/mcp/plugin-server-registration.d.ts +18 -0
- package/dist/extensions/mcp/policies.d.ts +14 -0
- package/dist/extensions/mcp/remote-proxy.d.ts +9 -0
- package/dist/extensions/mcp/timeout.d.ts +2 -0
- package/dist/extensions/mcp/tools.d.ts +3 -0
- package/dist/extensions/mcp/types.d.ts +133 -0
- package/dist/extensions/plugin/plugin-config-loader.d.ts +44 -0
- package/dist/extensions/plugin/plugin-load-report.d.ts +18 -0
- package/dist/extensions/plugin/plugin-loader.d.ts +23 -0
- package/dist/extensions/plugin/plugin-module-import.d.ts +4 -0
- package/dist/extensions/plugin/plugin-sandbox.d.ts +82 -0
- package/dist/extensions/plugin/plugin-targeting.d.ts +6 -0
- package/dist/extensions/plugin-sandbox-bootstrap.js +1 -0
- package/dist/extensions/tools/ask-lsp.d.ts +150 -0
- package/dist/extensions/tools/audio-tools.d.ts +156 -0
- package/dist/extensions/tools/browser.d.ts +137 -0
- package/dist/extensions/tools/check-file.d.ts +218 -0
- package/dist/extensions/tools/check-on-failure.d.ts +49 -0
- package/dist/extensions/tools/code-intel.d.ts +131 -0
- package/dist/extensions/tools/command-guard-extension.d.ts +22 -0
- package/dist/extensions/tools/command-guard.d.ts +29 -0
- package/dist/extensions/tools/constants.d.ts +28 -0
- package/dist/extensions/tools/definitions.d.ts +178 -0
- package/dist/extensions/tools/delimiter-balance.d.ts +121 -0
- package/dist/extensions/tools/edit-verification.d.ts +86 -0
- package/dist/extensions/tools/error-locations.d.ts +53 -0
- package/dist/extensions/tools/executors/apply-patch-parser.d.ts +68 -0
- package/dist/extensions/tools/executors/apply-patch.d.ts +48 -0
- package/dist/extensions/tools/executors/awk-parser.d.ts +163 -0
- package/dist/extensions/tools/executors/awk.d.ts +41 -0
- package/dist/extensions/tools/executors/bash.d.ts +119 -0
- package/dist/extensions/tools/executors/document/assets.d.ts +22 -0
- package/dist/extensions/tools/executors/document/ebook.d.ts +11 -0
- package/dist/extensions/tools/executors/document/formats.d.ts +83 -0
- package/dist/extensions/tools/executors/document/images.d.ts +73 -0
- package/dist/extensions/tools/executors/document/legacy.d.ts +20 -0
- package/dist/extensions/tools/executors/document/ocr.d.ts +67 -0
- package/dist/extensions/tools/executors/document/office-oxide.d.ts +19 -0
- package/dist/extensions/tools/executors/document/office-oxide.generated.d.ts +82 -0
- package/dist/extensions/tools/executors/document/office.d.ts +10 -0
- package/dist/extensions/tools/executors/document/pdf.d.ts +6 -0
- package/dist/extensions/tools/executors/document/pdfjs.d.ts +30 -0
- package/dist/extensions/tools/executors/document/range.d.ts +18 -0
- package/dist/extensions/tools/executors/document/recognition.d.ts +67 -0
- package/dist/extensions/tools/executors/document-extract.d.ts +55 -0
- package/dist/extensions/tools/executors/editor.d.ts +68 -0
- package/dist/extensions/tools/executors/file-locks.d.ts +41 -0
- package/dist/extensions/tools/executors/file-read.d.ts +136 -0
- package/dist/extensions/tools/executors/grep.d.ts +35 -0
- package/dist/extensions/tools/executors/index.d.ts +97 -0
- package/dist/extensions/tools/executors/line-endings.d.ts +23 -0
- package/dist/extensions/tools/executors/output-limits.d.ts +58 -0
- package/dist/extensions/tools/executors/overlay-receipts.d.ts +25 -0
- package/dist/extensions/tools/executors/posix-regex.d.ts +52 -0
- package/dist/extensions/tools/executors/read-receipts.d.ts +93 -0
- package/dist/extensions/tools/executors/run-command-execution-controller.d.ts +16 -0
- package/dist/extensions/tools/executors/search.d.ts +50 -0
- package/dist/extensions/tools/executors/sed.d.ts +92 -0
- package/dist/extensions/tools/executors/unchanged-reads.d.ts +55 -0
- package/dist/extensions/tools/executors/web-fetch.d.ts +58 -0
- package/dist/extensions/tools/helpers.d.ts +59 -0
- package/dist/extensions/tools/image-edit.d.ts +76 -0
- package/dist/extensions/tools/image-generation.d.ts +183 -0
- package/dist/extensions/tools/index.d.ts +68 -0
- package/dist/extensions/tools/jev.d.ts +336 -0
- package/dist/extensions/tools/list-files.d.ts +128 -0
- package/dist/extensions/tools/media-endpoint.d.ts +160 -0
- package/dist/extensions/tools/media-tools.d.ts +140 -0
- package/dist/extensions/tools/model-tool-routing.d.ts +33 -0
- package/dist/extensions/tools/presets.d.ts +154 -0
- package/dist/extensions/tools/qa-credentials.d.ts +133 -0
- package/dist/extensions/tools/runtime.d.ts +39 -0
- package/dist/extensions/tools/schemas.d.ts +845 -0
- package/dist/extensions/tools/task-progress.d.ts +217 -0
- package/dist/extensions/tools/team/agent-admission.d.ts +127 -0
- package/dist/extensions/tools/team/agent-check.d.ts +152 -0
- package/dist/extensions/tools/team/agent-controls.d.ts +55 -0
- package/dist/extensions/tools/team/agent-file.d.ts +28 -0
- package/dist/extensions/tools/team/agent-iteration-cap.d.ts +328 -0
- package/dist/extensions/tools/team/agent-names.d.ts +29 -0
- package/dist/extensions/tools/team/agent-node-placement.d.ts +160 -0
- package/dist/extensions/tools/team/agent-placement-queue.d.ts +199 -0
- package/dist/extensions/tools/team/agent-placement.d.ts +118 -0
- package/dist/extensions/tools/team/agent-reports.d.ts +53 -0
- package/dist/extensions/tools/team/agent-rounds.d.ts +666 -0
- package/dist/extensions/tools/team/agent-sandbox-executors.d.ts +79 -0
- package/dist/extensions/tools/team/agent-slot-gate.d.ts +186 -0
- package/dist/extensions/tools/team/agent-status.d.ts +84 -0
- package/dist/extensions/tools/team/agent-trouble.d.ts +91 -0
- package/dist/extensions/tools/team/background-delegations.d.ts +106 -0
- package/dist/extensions/tools/team/batch-report.d.ts +151 -0
- package/dist/extensions/tools/team/configured-agent-config.d.ts +37 -0
- package/dist/extensions/tools/team/configured-agent-tool.d.ts +135 -0
- package/dist/extensions/tools/team/create-agent-tool.d.ts +45 -0
- package/dist/extensions/tools/team/delegate-to-agent.d.ts +105 -0
- package/dist/extensions/tools/team/delegated-agent.d.ts +272 -0
- package/dist/extensions/tools/team/delegated-sandboxes.d.ts +125 -0
- package/dist/extensions/tools/team/delegated-tools.d.ts +40 -0
- package/dist/extensions/tools/team/delegation-call-hooks.d.ts +30 -0
- package/dist/extensions/tools/team/engine-evictions.d.ts +38 -0
- package/dist/extensions/tools/team/index.d.ts +20 -0
- package/dist/extensions/tools/team/lead-agent-tools.d.ts +92 -0
- package/dist/extensions/tools/team/multi-agent.d.ts +364 -0
- package/dist/extensions/tools/team/node-reachability.d.ts +53 -0
- package/dist/extensions/tools/team/node-throughput.d.ts +40 -0
- package/dist/extensions/tools/team/placed-run.d.ts +114 -0
- package/dist/extensions/tools/team/projections.d.ts +8 -0
- package/dist/extensions/tools/team/runtime.d.ts +6 -0
- package/dist/extensions/tools/team/session-window-retry.d.ts +28 -0
- package/dist/extensions/tools/team/spawn-agent-tool.d.ts +450 -0
- package/dist/extensions/tools/team/spawn-sampling.d.ts +188 -0
- package/dist/extensions/tools/team/spawn-swarm-tool.d.ts +330 -0
- package/dist/extensions/tools/team/subagent-cancellation.d.ts +188 -0
- package/dist/extensions/tools/team/subagent-layout.d.ts +90 -0
- package/dist/extensions/tools/team/subagent-output.d.ts +73 -0
- package/dist/extensions/tools/team/subagent-progress.d.ts +211 -0
- package/dist/extensions/tools/team/subagent-prompts.d.ts +3 -0
- package/dist/extensions/tools/team/team-state-dates.d.ts +10 -0
- package/dist/extensions/tools/team/team-tools.d.ts +56 -0
- package/dist/extensions/tools/team/teammates-off.d.ts +14 -0
- package/dist/extensions/tools/team/token-split.d.ts +28 -0
- package/dist/extensions/tools/team/turn-fault-recovery.d.ts +71 -0
- package/dist/extensions/tools/types.d.ts +410 -0
- package/dist/extensions/tools/video-generation.d.ts +94 -0
- package/dist/hooks/checkpoint-hooks.d.ts +39 -0
- package/dist/hooks/hook-extension.d.ts +2 -0
- package/dist/hooks/hook-file-config.d.ts +24 -0
- package/dist/hooks/hook-file-hooks.d.ts +22 -0
- package/dist/hooks/index.d.ts +5 -0
- package/dist/hooks/subprocess-runner.d.ts +21 -0
- package/dist/hooks/subprocess.d.ts +74 -0
- package/dist/hub/client/connect.d.ts +14 -0
- package/dist/hub/client/index.d.ts +146 -0
- package/dist/hub/client/managed-hub-build-watcher.d.ts +62 -0
- package/dist/hub/client/session-client.d.ts +138 -0
- package/dist/hub/client/ui-client.d.ts +52 -0
- package/dist/hub/daemon/entry.d.ts +15 -0
- package/dist/hub/daemon/entry.js +2033 -0
- package/dist/hub/daemon/index.d.ts +125 -0
- package/dist/hub/daemon/runtime-handlers.d.ts +12 -0
- package/dist/hub/daemon/shutdown-coordinator.d.ts +31 -0
- package/dist/hub/daemon/start-shared-server.d.ts +18 -0
- package/dist/hub/daemon/telemetry.d.ts +19 -0
- package/dist/hub/discovery/defaults.d.ts +16 -0
- package/dist/hub/discovery/index.d.ts +139 -0
- package/dist/hub/discovery/instance-lock.d.ts +51 -0
- package/dist/hub/discovery/workspace.d.ts +13 -0
- package/dist/hub/index.d.ts +38 -0
- package/dist/hub/index.js +2023 -0
- package/dist/hub/runtime-host/hub-runtime-host.d.ts +83 -0
- package/dist/hub/runtime-host/remote-runtime-host.d.ts +9 -0
- package/dist/hub/server/browser-websocket.d.ts +22 -0
- package/dist/hub/server/command-transport.d.ts +29 -0
- package/dist/hub/server/handlers/approval-handlers.d.ts +24 -0
- package/dist/hub/server/handlers/capability-handlers.d.ts +12 -0
- package/dist/hub/server/handlers/client-handlers.d.ts +6 -0
- package/dist/hub/server/handlers/connector-handlers.d.ts +20 -0
- package/dist/hub/server/handlers/context.d.ts +98 -0
- package/dist/hub/server/handlers/run-handlers.d.ts +6 -0
- package/dist/hub/server/handlers/run-queue-handlers.d.ts +33 -0
- package/dist/hub/server/handlers/session-event-projector.d.ts +7 -0
- package/dist/hub/server/handlers/session-handlers.d.ts +30 -0
- package/dist/hub/server/hub-client-contributions.d.ts +19 -0
- package/dist/hub/server/hub-event-log.d.ts +57 -0
- package/dist/hub/server/hub-notifications.d.ts +7 -0
- package/dist/hub/server/hub-run-queue.d.ts +82 -0
- package/dist/hub/server/hub-schedule-events.d.ts +2 -0
- package/dist/hub/server/hub-server-logging.d.ts +2 -0
- package/dist/hub/server/hub-server-options.d.ts +94 -0
- package/dist/hub/server/hub-server-transport.d.ts +71 -0
- package/dist/hub/server/hub-session-records.d.ts +9 -0
- package/dist/hub/server/hub-websocket-server.d.ts +12 -0
- package/dist/hub/server/index.d.ts +4 -0
- package/dist/hub/server/native-transport.d.ts +25 -0
- package/dist/hub/server/task-command-service.d.ts +11 -0
- package/dist/index.d.ts +172 -0
- package/dist/index.js +5435 -0
- package/dist/logging/early-logger.d.ts +37 -0
- package/dist/remote-config/integration.d.ts +17 -0
- package/dist/runtime/atomic/base-revision-reads.d.ts +106 -0
- package/dist/runtime/atomic/base-revision.d.ts +77 -0
- package/dist/runtime/atomic/check-first-edits.d.ts +79 -0
- package/dist/runtime/atomic/file-revisions.d.ts +268 -0
- package/dist/runtime/atomic/oracle.d.ts +178 -0
- package/dist/runtime/atomic/page-check.d.ts +39 -0
- package/dist/runtime/atomic/plan-capture.d.ts +40 -0
- package/dist/runtime/atomic/plan-text.d.ts +33 -0
- package/dist/runtime/atomic/plan-tool.d.ts +159 -0
- package/dist/runtime/atomic/proposal.d.ts +112 -0
- package/dist/runtime/atomic/propose-check-tool.d.ts +76 -0
- package/dist/runtime/atomic/protocol.d.ts +233 -0
- package/dist/runtime/atomic/restore-file-tool.d.ts +196 -0
- package/dist/runtime/atomic/revision-capture.d.ts +75 -0
- package/dist/runtime/atomic/run-check-tool.d.ts +64 -0
- package/dist/runtime/atomic/session-protocol.d.ts +304 -0
- package/dist/runtime/atomic/session-revisions.d.ts +77 -0
- package/dist/runtime/atomic/snapshot.d.ts +77 -0
- package/dist/runtime/atomic/stalled-checks.d.ts +106 -0
- package/dist/runtime/atomic/submit-transaction-tool.d.ts +50 -0
- package/dist/runtime/atomic/tool-activity.d.ts +15 -0
- package/dist/runtime/atomic/transaction-controller.d.ts +364 -0
- package/dist/runtime/atomic/unparseable-change.d.ts +35 -0
- package/dist/runtime/capabilities/index.d.ts +2 -0
- package/dist/runtime/capabilities/normalize-runtime-capabilities.d.ts +2 -0
- package/dist/runtime/capabilities/runtime-capabilities.d.ts +18 -0
- package/dist/runtime/config/agent-message-codec.d.ts +6 -0
- package/dist/runtime/config/agent-runtime-config-builder.d.ts +93 -0
- package/dist/runtime/config/connection-update.d.ts +40 -0
- package/dist/runtime/escalation/a2a.d.ts +109 -0
- package/dist/runtime/escalation/assessment.d.ts +54 -0
- package/dist/runtime/escalation/brief.d.ts +70 -0
- package/dist/runtime/escalation/escalate-tool.d.ts +93 -0
- package/dist/runtime/escalation/escalation-controller.d.ts +62 -0
- package/dist/runtime/escalation/escalation-session.d.ts +241 -0
- package/dist/runtime/escalation/expert-failure.d.ts +20 -0
- package/dist/runtime/escalation/expert-guards.d.ts +46 -0
- package/dist/runtime/escalation/expert-mailbox.d.ts +34 -0
- package/dist/runtime/escalation/expert-notes.d.ts +115 -0
- package/dist/runtime/escalation/expert-prompt.d.ts +29 -0
- package/dist/runtime/escalation/expert-revisions.d.ts +62 -0
- package/dist/runtime/escalation/expert-session.d.ts +164 -0
- package/dist/runtime/escalation/expert-transcript.d.ts +32 -0
- package/dist/runtime/escalation/forced-escalation.d.ts +58 -0
- package/dist/runtime/escalation/stand-down.d.ts +66 -0
- package/dist/runtime/escalation/struggle-offer.d.ts +100 -0
- package/dist/runtime/escalation/watch-tool.d.ts +34 -0
- package/dist/runtime/host/history.d.ts +19 -0
- package/dist/runtime/host/host.d.ts +7 -0
- package/dist/runtime/host/local/agent-event-bridge.d.ts +50 -0
- package/dist/runtime/host/local/session-record.d.ts +6 -0
- package/dist/runtime/host/local/session-service-invoker.d.ts +4 -0
- package/dist/runtime/host/local/spawn-tool.d.ts +57 -0
- package/dist/runtime/host/local/user-files.d.ts +1 -0
- package/dist/runtime/host/local-runtime-host.d.ts +298 -0
- package/dist/runtime/host/runtime-host-support.d.ts +39 -0
- package/dist/runtime/host/runtime-host.d.ts +280 -0
- package/dist/runtime/host/steer-side-turn.d.ts +119 -0
- package/dist/runtime/orchestration/runtime-builder.d.ts +14 -0
- package/dist/runtime/orchestration/runtime-event-adapter.d.ts +104 -0
- package/dist/runtime/orchestration/runtime-oauth-token-manager.d.ts +28 -0
- package/dist/runtime/orchestration/session-runtime-orchestrator.d.ts +339 -0
- package/dist/runtime/orchestration/session-runtime.d.ts +118 -0
- package/dist/runtime/orchestration/user-input-builder.d.ts +15 -0
- package/dist/runtime/process-start-token.d.ts +23 -0
- package/dist/runtime/safety/loop-detection.d.ts +160 -0
- package/dist/runtime/safety/mistake-tracker.d.ts +84 -0
- package/dist/runtime/safety/rules.d.ts +6 -0
- package/dist/runtime/safety/struggle-detector.d.ts +414 -0
- package/dist/runtime/safety/worker-struggle-stop.d.ts +20 -0
- package/dist/runtime/safety/worker-struggle.d.ts +166 -0
- package/dist/runtime/sandbox/agent-sandbox.d.ts +111 -0
- package/dist/runtime/sandbox/overlay-fs.d.ts +71 -0
- package/dist/runtime/sandbox/sandbox-binaries.d.ts +10 -0
- package/dist/runtime/tools/subprocess-sandbox-lifecycle.d.ts +9 -0
- package/dist/runtime/tools/subprocess-sandbox.d.ts +62 -0
- package/dist/runtime/tools/tool-approval.d.ts +9 -0
- package/dist/runtime/turn-queue/harness-notes.d.ts +18 -0
- package/dist/runtime/turn-queue/pending-prompt-service.d.ts +117 -0
- package/dist/services/agent-events.d.ts +59 -0
- package/dist/services/config.d.ts +2 -0
- package/dist/services/connectors/active-connectors.d.ts +2 -0
- package/dist/services/connectors/connector-autostart.d.ts +33 -0
- package/dist/services/connectors/connector-child-env.d.ts +14 -0
- package/dist/services/connectors/connector-cleanup.d.ts +20 -0
- package/dist/services/connectors/connector-supervisor.d.ts +134 -0
- package/dist/services/connectors/daemon-connector-reconnect.d.ts +15 -0
- package/dist/services/feature-flags/FeatureFlagsService.d.ts +49 -0
- package/dist/services/feature-flags/index.d.ts +2 -0
- package/dist/services/feature-flags/posthog.d.ts +24 -0
- package/dist/services/feature-flags/posthog.js +1 -0
- package/dist/services/feature-flags/providers.d.ts +7 -0
- package/dist/services/global-settings.d.ts +113 -0
- package/dist/services/llms/apihandler-agent-model-adapter.d.ts +26 -0
- package/dist/services/llms/cline-recommended-models.d.ts +62 -0
- package/dist/services/llms/configured-provider-registry.d.ts +27 -0
- package/dist/services/llms/handler-factory.d.ts +23 -0
- package/dist/services/llms/provider-defaults.d.ts +36 -0
- package/dist/services/llms/provider-settings.d.ts +420 -0
- package/dist/services/llms/runtime-config.d.ts +3 -0
- package/dist/services/llms/runtime-registry.d.ts +19 -0
- package/dist/services/llms/runtime-types.d.ts +84 -0
- package/dist/services/llms/session-budget.d.ts +88 -0
- package/dist/services/local-runtime-bootstrap.d.ts +62 -0
- package/dist/services/marketplace.d.ts +41 -0
- package/dist/services/mcp-install.d.ts +35 -0
- package/dist/services/plugin-install.d.ts +52 -0
- package/dist/services/plugin-mcp-settings.d.ts +31 -0
- package/dist/services/plugin-tools.d.ts +40 -0
- package/dist/services/plugin-uninstall.d.ts +13 -0
- package/dist/services/providers/local-provider-registry.d.ts +354 -0
- package/dist/services/providers/local-provider-service.d.ts +101 -0
- package/dist/services/providers/model-source.d.ts +3 -0
- package/dist/services/providers/provider-config-fields.d.ts +37 -0
- package/dist/services/providers/provider-readiness.d.ts +10 -0
- package/dist/services/session-artifacts.d.ts +18 -0
- package/dist/services/session-data.d.ts +61 -0
- package/dist/services/session-import/claude-code.d.ts +16 -0
- package/dist/services/session-import/codex.d.ts +34 -0
- package/dist/services/session-import/index.d.ts +6 -0
- package/dist/services/session-import/opencode.d.ts +25 -0
- package/dist/services/session-import/sanitize.d.ts +16 -0
- package/dist/services/session-import/service.d.ts +31 -0
- package/dist/services/session-import/types.d.ts +87 -0
- package/dist/services/session-telemetry.d.ts +15 -0
- package/dist/services/storage/file-team-store.d.ts +32 -0
- package/dist/services/storage/provider-settings-legacy-migration.d.ts +38 -0
- package/dist/services/storage/provider-settings-manager.d.ts +31 -0
- package/dist/services/storage/sqlite-session-store.d.ts +35 -0
- package/dist/services/storage/sqlite-team-store.d.ts +42 -0
- package/dist/services/storage/team-events-retention.d.ts +25 -0
- package/dist/services/storage/team-store.d.ts +16 -0
- package/dist/services/telemetry/ITelemetryAdapter.d.ts +54 -0
- package/dist/services/telemetry/OpenTelemetryAdapter.d.ts +43 -0
- package/dist/services/telemetry/OpenTelemetryProvider.d.ts +99 -0
- package/dist/services/telemetry/TelemetryLoggerSink.d.ts +27 -0
- package/dist/services/telemetry/TelemetryService.d.ts +40 -0
- package/dist/services/telemetry/core-events.d.ts +396 -0
- package/dist/services/telemetry/distinct-id.d.ts +2 -0
- package/dist/services/telemetry/index.d.ts +4 -0
- package/dist/services/telemetry/index.js +1 -0
- package/dist/services/usage.d.ts +19 -0
- package/dist/services/workspace/agent-schedules-workspace.d.ts +8 -0
- package/dist/services/workspace/chat-workspace.d.ts +9 -0
- package/dist/services/workspace/file-indexer.d.ts +5 -0
- package/dist/services/workspace/index.d.ts +6 -0
- package/dist/services/workspace/mention-enricher.d.ts +13 -0
- package/dist/services/workspace/workspace-manager.d.ts +27 -0
- package/dist/services/workspace/workspace-manifest.d.ts +42 -0
- package/dist/services/workspace/workspace-telemetry.d.ts +18 -0
- package/dist/session/checkpoint-diff.d.ts +25 -0
- package/dist/session/checkpoint-restore.d.ts +34 -0
- package/dist/session/display-messages.d.ts +28 -0
- package/dist/session/history-origin.d.ts +19 -0
- package/dist/session/models/session-compaction.d.ts +22 -0
- package/dist/session/models/session-graph.d.ts +15 -0
- package/dist/session/models/session-manifest.d.ts +32 -0
- package/dist/session/models/session-row.d.ts +107 -0
- package/dist/session/persisted-tool-result-content.d.ts +8 -0
- package/dist/session/search/index.d.ts +1 -0
- package/dist/session/search/session-history-search.d.ts +51 -0
- package/dist/session/services/file-session-service.d.ts +10 -0
- package/dist/session/services/message-builder.d.ts +208 -0
- package/dist/session/services/persistence-service.d.ts +92 -0
- package/dist/session/services/read-overlap.d.ts +40 -0
- package/dist/session/services/session-service.d.ts +15 -0
- package/dist/session/session-snapshot.d.ts +59 -0
- package/dist/session/session-versioning-service.d.ts +50 -0
- package/dist/session/stores/atomic-file.d.ts +1 -0
- package/dist/session/stores/conversation-store.d.ts +29 -0
- package/dist/session/stores/session-manifest-store.d.ts +49 -0
- package/dist/session/stores/team-persistence-store.d.ts +23 -0
- package/dist/session/team/index.d.ts +2 -0
- package/dist/session/team/team-child-session-manager.d.ts +35 -0
- package/dist/session/team/team-session-coordinator.d.ts +13 -0
- package/dist/session/user-run-messages.d.ts +20 -0
- package/dist/settings/index.d.ts +2 -0
- package/dist/settings/settings-service.d.ts +8 -0
- package/dist/settings/types.d.ts +83 -0
- package/dist/tasks/agenda-task-api.d.ts +20 -0
- package/dist/tasks/agenda-task-manager.d.ts +109 -0
- package/dist/tasks/agenda-task-tool.d.ts +94 -0
- package/dist/tasks/index.d.ts +9 -0
- package/dist/tasks/specs/task-spec-file-store.d.ts +38 -0
- package/dist/tasks/specs/task-spec-parser.d.ts +65 -0
- package/dist/tasks/store/sqlite-task-store.d.ts +73 -0
- package/dist/tasks/store/task-schema.d.ts +2 -0
- package/dist/tasks/task-location.d.ts +14 -0
- package/dist/tasks/task-tool.d.ts +143 -0
- package/dist/types/chat-schema.d.ts +194 -0
- package/dist/types/common.d.ts +35 -0
- package/dist/types/config.d.ts +994 -0
- package/dist/types/events.d.ts +102 -0
- package/dist/types/provider-settings.d.ts +29 -0
- package/dist/types/session.d.ts +187 -0
- package/dist/types/sessions.d.ts +42 -0
- package/dist/types/storage.d.ts +36 -0
- package/dist/types.d.ts +34 -0
- package/dist/version.d.ts +1 -0
- package/package.json +98 -0
- package/scripts/document-reader-assets.mjs +161 -0
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Bash Executor
|
|
3
|
+
*
|
|
4
|
+
* Built-in implementation for running shell commands using Node.js spawn.
|
|
5
|
+
*/
|
|
6
|
+
import { type ProcessStartTokenProbeResult } from "../../../runtime/process-start-token";
|
|
7
|
+
import type { ShellExecutor } from "../types";
|
|
8
|
+
import { type ReadReceipts } from "./read-receipts";
|
|
9
|
+
import type { RunCommandExecutionController } from "./run-command-execution-controller";
|
|
10
|
+
export type ProcessStartTokenProbe = (pid: number) => ProcessStartTokenProbeResult | Promise<ProcessStartTokenProbeResult>;
|
|
11
|
+
export interface DetachedCommandLogCleanupOptions {
|
|
12
|
+
tempDirectory?: string;
|
|
13
|
+
retentionMs?: number;
|
|
14
|
+
nowMs?: number;
|
|
15
|
+
processStartTokenProbe?: ProcessStartTokenProbe;
|
|
16
|
+
activeCommandPollIntervalMs?: number;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Reaps completed detached command logs outside the retention window,
|
|
20
|
+
* schedules retained logs for their remaining lifetime, and follows active
|
|
21
|
+
* command identities until they exit. Local runtime hosts call this at startup
|
|
22
|
+
* so cleanup survives host exits and restarts instead of depending only on the
|
|
23
|
+
* process that launched the command.
|
|
24
|
+
*/
|
|
25
|
+
export declare function cleanupStaleDetachedCommandLogs(options?: DetachedCommandLogCleanupOptions): Promise<number>;
|
|
26
|
+
export declare class CommandExitError extends Error {
|
|
27
|
+
readonly exitCode: number;
|
|
28
|
+
readonly output: string;
|
|
29
|
+
constructor(exitCode: number, output: string);
|
|
30
|
+
}
|
|
31
|
+
export interface ShellExecutorOptions {
|
|
32
|
+
/**
|
|
33
|
+
* Shell to use for execution
|
|
34
|
+
* @default "/bin/bash" on Unix, "powershell" on Windows
|
|
35
|
+
*/
|
|
36
|
+
shell?: string;
|
|
37
|
+
/**
|
|
38
|
+
* Timeout for command execution in milliseconds
|
|
39
|
+
* @default 30000 (30 seconds)
|
|
40
|
+
*/
|
|
41
|
+
timeoutMs?: number;
|
|
42
|
+
/**
|
|
43
|
+
* Maximum output kept, in characters. Output beyond this is
|
|
44
|
+
* middle-truncated: the head and tail are preserved and the middle is
|
|
45
|
+
* elided, since build and test failures usually live at the end of the
|
|
46
|
+
* output.
|
|
47
|
+
* @default 48_000 — see MAX_COMMAND_OUTPUT_CHARS in output-limits.ts
|
|
48
|
+
*/
|
|
49
|
+
maxOutputChars?: number;
|
|
50
|
+
/**
|
|
51
|
+
* @deprecated Misnamed — the limit was always enforced in characters,
|
|
52
|
+
* not bytes. Use {@link maxOutputChars}; this alias is honored when
|
|
53
|
+
* maxOutputChars is not set.
|
|
54
|
+
*/
|
|
55
|
+
maxOutputBytes?: number;
|
|
56
|
+
/**
|
|
57
|
+
* Environment variables to add/override
|
|
58
|
+
*/
|
|
59
|
+
env?: Record<string, string>;
|
|
60
|
+
/**
|
|
61
|
+
* Whether to combine stdout and stderr
|
|
62
|
+
* @default true
|
|
63
|
+
*/
|
|
64
|
+
combineOutput?: boolean;
|
|
65
|
+
/**
|
|
66
|
+
* The session's read receipts, so a command's effect on files the model has
|
|
67
|
+
* read can be reported back — see {@link sweepTrackedFiles}.
|
|
68
|
+
*
|
|
69
|
+
* Omit it and the executor behaves exactly as it did: no sweep, no stat, no
|
|
70
|
+
* note. The shell does not need receipts to run a command; it needs them to
|
|
71
|
+
* say what the command did to what the model believes.
|
|
72
|
+
*/
|
|
73
|
+
receipts?: ReadReceipts;
|
|
74
|
+
/**
|
|
75
|
+
* Optional host-scoped controller that can release an in-flight command
|
|
76
|
+
* from its tool call while continuing to drain output to a bounded log.
|
|
77
|
+
*/
|
|
78
|
+
executionController?: RunCommandExecutionController;
|
|
79
|
+
/**
|
|
80
|
+
* Transform the resolved spawn just before it runs. A delegated agent uses
|
|
81
|
+
* this to root the command tree at its sandbox launcher, so the command and
|
|
82
|
+
* every process it spawns read and write the agent's overlay rather than the
|
|
83
|
+
* workspace. Absent for the lead, whose commands run directly.
|
|
84
|
+
*/
|
|
85
|
+
wrapSpawn?: (spec: {
|
|
86
|
+
executable: string;
|
|
87
|
+
args: string[];
|
|
88
|
+
cwd: string;
|
|
89
|
+
env: Record<string, string>;
|
|
90
|
+
}) => {
|
|
91
|
+
executable: string;
|
|
92
|
+
args: string[];
|
|
93
|
+
cwd: string;
|
|
94
|
+
env: Record<string, string>;
|
|
95
|
+
};
|
|
96
|
+
/**
|
|
97
|
+
* How long a completed detached command log remains available before its
|
|
98
|
+
* temporary directory is removed.
|
|
99
|
+
*
|
|
100
|
+
* @default 24 hours
|
|
101
|
+
*/
|
|
102
|
+
detachedLogRetentionMs?: number;
|
|
103
|
+
/** Process identity provider used to enable safe command detachment. */
|
|
104
|
+
processStartTokenProbe?: ProcessStartTokenProbe;
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* Create a shell executor using Node.js spawn
|
|
108
|
+
*
|
|
109
|
+
* @example
|
|
110
|
+
* ```typescript
|
|
111
|
+
* const shell = createShellExecutor({
|
|
112
|
+
* timeoutMs: 60000, // 1 minute timeout
|
|
113
|
+
* shell: "/bin/zsh",
|
|
114
|
+
* })
|
|
115
|
+
*
|
|
116
|
+
* const output = await shell("ls -la", "/path/to/project", context)
|
|
117
|
+
* ```
|
|
118
|
+
*/
|
|
119
|
+
export declare function createShellExecutor(options?: ShellExecutorOptions): ShellExecutor;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Where the document readers' data files are: pdf.js's decoders and
|
|
3
|
+
* character maps, tesseract's worker and core, and the bundled English model.
|
|
4
|
+
*
|
|
5
|
+
* Each is looked for beside the bundle first, which is where the extension's
|
|
6
|
+
* and the CLI's builds copy them, and then in the npm package it ships in,
|
|
7
|
+
* which is the case for tests and for an embedder using core from
|
|
8
|
+
* `node_modules`.
|
|
9
|
+
*/
|
|
10
|
+
export declare function moduleDirectory(): string;
|
|
11
|
+
/** pdf.js's CCITT, JBIG2 and JPEG 2000 decoders, and its colour management. */
|
|
12
|
+
export declare function resolvePdfjsWasmDirectory(): string | undefined;
|
|
13
|
+
/** pdf.js's character maps, which CJK text needs to decode. */
|
|
14
|
+
export declare function resolvePdfjsCmapDirectory(): string | undefined;
|
|
15
|
+
/**
|
|
16
|
+
* tesseract's worker, bundled on its own because it runs in a worker thread.
|
|
17
|
+
* Undefined means the package's own, which is right when core runs from
|
|
18
|
+
* `node_modules`.
|
|
19
|
+
*/
|
|
20
|
+
export declare function resolveTesseractWorker(): string | undefined;
|
|
21
|
+
/** The English model that ships with the tool (tessdata best_int). */
|
|
22
|
+
export declare function resolveBundledTessdata(): string | undefined;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* EPUB, MOBI, AZW3 (KF8) and FB2 through lingo-reader.
|
|
3
|
+
*
|
|
4
|
+
* lingo-reader returns each chapter as HTML and writes the book's resources
|
|
5
|
+
* into a directory it is given, pointing every `<img src>` at the file it
|
|
6
|
+
* wrote. The chapter HTML becomes markdown here, and each picture is taken
|
|
7
|
+
* from that directory into the image collector before lingo-reader's own
|
|
8
|
+
* `destroy()` deletes the directory.
|
|
9
|
+
*/
|
|
10
|
+
import type { DocumentFormat, DocumentReadResult, ReadOptions } from "./formats";
|
|
11
|
+
export declare function readEbook(filePath: string, data: Uint8Array, format: Extract<DocumentFormat, "epub" | "mobi" | "azw3" | "fb2">, options: ReadOptions): Promise<DocumentReadResult>;
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What a document is, and which reader takes it.
|
|
3
|
+
*/
|
|
4
|
+
import type { ImageCollector } from "./images";
|
|
5
|
+
export type DocumentFormat = "pdf" | "docx" | "pptx" | "xlsx" | "odt" | "odp" | "ods" | "odg" | "rtf" | "csv" | "html" | "epub" | "mobi" | "azw3" | "fb2" | "doc" | "xls" | "ppt";
|
|
6
|
+
/** The names a format is known by, and the reader it goes to. */
|
|
7
|
+
export declare const FORMAT_LABELS: Record<DocumentFormat, string>;
|
|
8
|
+
/** Every extension this tool reads, for the tool description and read_files. */
|
|
9
|
+
export declare const DOCUMENT_EXTENSIONS: readonly string[];
|
|
10
|
+
export type FormatVerdict = {
|
|
11
|
+
format: DocumentFormat;
|
|
12
|
+
} | {
|
|
13
|
+
unsupported: string;
|
|
14
|
+
};
|
|
15
|
+
/**
|
|
16
|
+
* The format of a file, from its extension and checked against its bytes.
|
|
17
|
+
*
|
|
18
|
+
* The bytes decide when the two disagree. A `.doc` that is really an RTF or a
|
|
19
|
+
* DOCX is common (Word saves under whatever name it was opened as), and so is
|
|
20
|
+
* a `.mobi` that is a KF8 file.
|
|
21
|
+
*/
|
|
22
|
+
export declare function detectFormat(filePath: string, head: Uint8Array): FormatVerdict;
|
|
23
|
+
/** A unit a range can select: pages, slides, sheets or chapters. */
|
|
24
|
+
export type UnitName = "page" | "slide" | "sheet" | "chapter";
|
|
25
|
+
export interface ReadOptions {
|
|
26
|
+
images: ImageCollector;
|
|
27
|
+
/** Whether pictures are wanted at all (`images: "none"` skips the work). */
|
|
28
|
+
wantImages: boolean;
|
|
29
|
+
password?: string;
|
|
30
|
+
/** Which units to read; undefined reads everything. */
|
|
31
|
+
selects?: (unit: number) => boolean;
|
|
32
|
+
/** A scratch directory inside the extraction directory, removed afterwards. */
|
|
33
|
+
scratchDir: string;
|
|
34
|
+
/**
|
|
35
|
+
* Reads the text of a scanned page from its pictures (OCR). Undefined when
|
|
36
|
+
* recognition is off; resolves undefined for a page it did not read.
|
|
37
|
+
*/
|
|
38
|
+
recognize?: (page: number, images: readonly PageImage[]) => Promise<RecognizedText | undefined>;
|
|
39
|
+
}
|
|
40
|
+
/** A picture a scanned page is drawn from, as a PNG. */
|
|
41
|
+
export interface PageImage {
|
|
42
|
+
png: Uint8Array;
|
|
43
|
+
width: number;
|
|
44
|
+
height: number;
|
|
45
|
+
/** Share of the page it covers, 0-1. */
|
|
46
|
+
coverage: number;
|
|
47
|
+
}
|
|
48
|
+
export interface RecognizedText {
|
|
49
|
+
text: string;
|
|
50
|
+
/** Who read it, for the page's note: `tesseract (eng, 91%)`, `the vision model`. */
|
|
51
|
+
by: string;
|
|
52
|
+
}
|
|
53
|
+
export interface DocumentReadResult {
|
|
54
|
+
markdown: string;
|
|
55
|
+
reader: string;
|
|
56
|
+
title?: string;
|
|
57
|
+
author?: string;
|
|
58
|
+
/** How many units the document has, and what they are called. */
|
|
59
|
+
units?: {
|
|
60
|
+
name: UnitName;
|
|
61
|
+
total: number;
|
|
62
|
+
read: number[];
|
|
63
|
+
};
|
|
64
|
+
/** Chapter titles for an ebook, in reading order. */
|
|
65
|
+
contents?: string[];
|
|
66
|
+
/** Pages whose text is an image of text, for OCR. */
|
|
67
|
+
scannedPages?: number[];
|
|
68
|
+
/** Scanned pages whose text was recognized here, by `ReadOptions.recognize`. */
|
|
69
|
+
recognizedPages?: number[];
|
|
70
|
+
/** Pages scanned with a hidden text layer already on them. */
|
|
71
|
+
ocrLayerPages?: number[];
|
|
72
|
+
/** Pages drawn as shapes: no text and no pictures to read. */
|
|
73
|
+
vectorPages?: number[];
|
|
74
|
+
notes?: string[];
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* What `read_files` says instead of returning a binary document as text.
|
|
78
|
+
*
|
|
79
|
+
* Decided by the bytes, so a PDF saved as `.txt` is caught and an RTF, CSV,
|
|
80
|
+
* HTML or FB2 file, which are text, is still read as text. Undefined for
|
|
81
|
+
* everything else.
|
|
82
|
+
*/
|
|
83
|
+
export declare function unreadableDocumentMessage(filePath: string, head: Uint8Array, documentReader: boolean): string | undefined;
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Where a document's pictures go.
|
|
3
|
+
*
|
|
4
|
+
* Every reader hands its pictures here as bytes, whatever form it found them
|
|
5
|
+
* in (base64 in officeparser's tree and office_oxide's markdown, raw pixels
|
|
6
|
+
* from pdf.js, files lingo-reader wrote), so the naming, deduplication and the
|
|
7
|
+
* index are the same for every format.
|
|
8
|
+
*/
|
|
9
|
+
export interface ExtractedImage {
|
|
10
|
+
/** File name inside the images directory. */
|
|
11
|
+
file: string;
|
|
12
|
+
/** Path relative to the extraction directory, for markdown links. */
|
|
13
|
+
link: string;
|
|
14
|
+
mediaType: string;
|
|
15
|
+
bytes: number;
|
|
16
|
+
width?: number;
|
|
17
|
+
height?: number;
|
|
18
|
+
/** Where in the document it came from: `page 7`, `slide 3`, `chapter 2`. */
|
|
19
|
+
source?: string;
|
|
20
|
+
/** The document's own alt text or caption, when it carries one. */
|
|
21
|
+
alt?: string;
|
|
22
|
+
/** What the vision model saw in it, when descriptions were asked for. */
|
|
23
|
+
description?: string;
|
|
24
|
+
/**
|
|
25
|
+
* Set for a format no model can view (EMF, WMF, PICT, TIFF, BMP): the file is
|
|
26
|
+
* kept, but it is not a picture anyone downstream can look at as it is.
|
|
27
|
+
*/
|
|
28
|
+
notViewable?: boolean;
|
|
29
|
+
sha1: string;
|
|
30
|
+
}
|
|
31
|
+
/** The formats a vision model is sent, which is what `inline` can attach. */
|
|
32
|
+
export declare const VIEWABLE_MEDIA_TYPES: Set<string>;
|
|
33
|
+
/**
|
|
34
|
+
* The media type of an image, from its first bytes.
|
|
35
|
+
*
|
|
36
|
+
* The containers are not trusted for this: officeparser labels by extension,
|
|
37
|
+
* office_oxide by record type, and an EMF inside a `.png`-named part is
|
|
38
|
+
* common enough in real decks.
|
|
39
|
+
*/
|
|
40
|
+
export declare function sniffImageType(data: Uint8Array): string | undefined;
|
|
41
|
+
export interface AddImageInput {
|
|
42
|
+
data: Uint8Array;
|
|
43
|
+
/** A name to build the file name from, such as `p7` or the part's own name. */
|
|
44
|
+
stem: string;
|
|
45
|
+
mediaType?: string;
|
|
46
|
+
width?: number;
|
|
47
|
+
height?: number;
|
|
48
|
+
source?: string;
|
|
49
|
+
alt?: string;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Collects a document's images, named and deduplicated, for writing.
|
|
53
|
+
*
|
|
54
|
+
* Deduplicated by content: a logo on every slide of a deck is one file, and
|
|
55
|
+
* every place it appears links to that one file.
|
|
56
|
+
*/
|
|
57
|
+
export declare class ImageCollector {
|
|
58
|
+
private readonly linkDir;
|
|
59
|
+
private readonly byHash;
|
|
60
|
+
private readonly names;
|
|
61
|
+
private readonly pending;
|
|
62
|
+
constructor(linkDir?: string);
|
|
63
|
+
add(input: AddImageInput): ExtractedImage | undefined;
|
|
64
|
+
get images(): readonly ExtractedImage[];
|
|
65
|
+
/** Every image with its bytes, in the order they were found. */
|
|
66
|
+
entries(): readonly {
|
|
67
|
+
image: ExtractedImage;
|
|
68
|
+
data: Uint8Array;
|
|
69
|
+
}[];
|
|
70
|
+
private uniqueName;
|
|
71
|
+
}
|
|
72
|
+
/** Markdown for an image: its alt text when the document gave one. */
|
|
73
|
+
export declare function imageMarkdown(image: ExtractedImage): string;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Word, Excel and PowerPoint 97-2003 through office_oxide.
|
|
3
|
+
*
|
|
4
|
+
* office_oxide renders markdown with each picture inline as
|
|
5
|
+
* `[image-base64:<data>]` at its place in the text; each becomes a file and a
|
|
6
|
+
* link. Its Word reader misses some pictures (measured: POI's PngPicture.doc,
|
|
7
|
+
* one PNG), so a Word file's streams are also scanned for complete PNG and
|
|
8
|
+
* JPEG images, and any not already found are listed after the text.
|
|
9
|
+
*
|
|
10
|
+
* Word only. Excel splits a record longer than 8,224 bytes with a 4-byte
|
|
11
|
+
* CONTINUE header, so a picture in a workbook stream is not contiguous there:
|
|
12
|
+
* a byte scan of POI's SimpleWithImages.xls "found" a JPEG 4 bytes longer than
|
|
13
|
+
* the real one, damaged from byte 8,108 on, beside the one office_oxide read
|
|
14
|
+
* correctly. PowerPoint keeps its pictures in one flat stream, which
|
|
15
|
+
* office_oxide reads whole.
|
|
16
|
+
*/
|
|
17
|
+
import type { DocumentReadResult, ReadOptions } from "./formats";
|
|
18
|
+
/** Complete PNG and JPEG images inside a compound file's streams. */
|
|
19
|
+
export declare function scanCompoundImages(data: Uint8Array): Promise<Uint8Array[]>;
|
|
20
|
+
export declare function readLegacyOffice(data: Uint8Array, format: "doc" | "xls" | "ppt", options: ReadOptions): Promise<DocumentReadResult>;
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Text recognition with tesseract (tesseract.js, WebAssembly, in a worker
|
|
3
|
+
* thread), and the language models it reads with.
|
|
4
|
+
*
|
|
5
|
+
* English ships with the tool (tessdata best_int, 3 MB). Every other language
|
|
6
|
+
* is installed on request into one folder under the data directory, from the
|
|
7
|
+
* same CDN tesseract.js itself defaults to, so a session never downloads
|
|
8
|
+
* anything the user did not ask for.
|
|
9
|
+
*/
|
|
10
|
+
/** How scanned pages are read. `vision` is the Vision tab's model. */
|
|
11
|
+
export type OcrEngine = "tesseract" | "vision" | "off";
|
|
12
|
+
/** The user's Document Reader settings, as the host hands them over. */
|
|
13
|
+
export interface DocumentReaderSettings {
|
|
14
|
+
/** @default "tesseract" */
|
|
15
|
+
ocr?: OcrEngine;
|
|
16
|
+
/** tesseract language codes. @default ["eng"] */
|
|
17
|
+
ocrLanguages?: readonly string[];
|
|
18
|
+
/** Where installed languages live. @default <data dir>/tessdata */
|
|
19
|
+
ocrDataDir?: string;
|
|
20
|
+
/** Describe extracted pictures with the vision model. @default false */
|
|
21
|
+
describePictures?: boolean;
|
|
22
|
+
}
|
|
23
|
+
export declare const BUNDLED_OCR_LANGUAGE = "eng";
|
|
24
|
+
export declare function resolveOcrDataDir(): string;
|
|
25
|
+
/** Codes from a setting or a tool call: "eng+deu", "eng, deu", or a list. */
|
|
26
|
+
export declare function parseOcrLanguages(input: string | readonly string[] | undefined | null): string[];
|
|
27
|
+
export declare function isOcrLanguageCode(code: string): boolean;
|
|
28
|
+
/** Where a language is downloaded from: tessdata best_int, as tesseract.js's own default. */
|
|
29
|
+
export declare function ocrLanguageSource(code: string): string;
|
|
30
|
+
/** The languages that can be read with now: installed ones, and English. */
|
|
31
|
+
export declare function installedOcrLanguages(dataDir?: string): Promise<string[]>;
|
|
32
|
+
export interface OcrInstallResult {
|
|
33
|
+
installed: string[];
|
|
34
|
+
failed: {
|
|
35
|
+
language: string;
|
|
36
|
+
reason: string;
|
|
37
|
+
}[];
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Download the languages not installed yet. English is never downloaded: it
|
|
41
|
+
* ships with the tool.
|
|
42
|
+
*
|
|
43
|
+
* Written to a partial file and renamed, so an interrupted download is never
|
|
44
|
+
* taken for a model, and checked for gzip's magic bytes, so an error page
|
|
45
|
+
* served with status 200 is not either.
|
|
46
|
+
*/
|
|
47
|
+
export declare function installOcrLanguages(languages: readonly string[], options?: {
|
|
48
|
+
dataDir?: string;
|
|
49
|
+
fetch?: typeof fetch;
|
|
50
|
+
signal?: AbortSignal;
|
|
51
|
+
}): Promise<OcrInstallResult>;
|
|
52
|
+
export declare class OcrLanguageMissingError extends Error {
|
|
53
|
+
readonly languages: readonly string[];
|
|
54
|
+
constructor(languages: readonly string[]);
|
|
55
|
+
}
|
|
56
|
+
/** One tesseract worker, for every page of one call. */
|
|
57
|
+
export declare class TesseractReader {
|
|
58
|
+
private readonly worker;
|
|
59
|
+
readonly languages: readonly string[];
|
|
60
|
+
private constructor();
|
|
61
|
+
static open(languages: readonly string[], dataDir?: string): Promise<TesseractReader>;
|
|
62
|
+
recognize(png: Uint8Array): Promise<{
|
|
63
|
+
text: string;
|
|
64
|
+
confidence: number;
|
|
65
|
+
}>;
|
|
66
|
+
close(): Promise<void>;
|
|
67
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The vendored office_oxide module (`scripts/build-office-oxide.sh`).
|
|
3
|
+
*/
|
|
4
|
+
export interface OfficeOxideDocument {
|
|
5
|
+
toMarkdownWithImages(): string;
|
|
6
|
+
plainText(): string;
|
|
7
|
+
free(): void;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Where the module is. Two places, in the order a host would want.
|
|
11
|
+
*
|
|
12
|
+
* Beside the bundle is the shipped case: the extension's build copies it to
|
|
13
|
+
* `dist/office-oxide/`, as it does the tree-sitter grammars. Otherwise it is
|
|
14
|
+
* core's own `assets/`, found by walking up from this module: one level from
|
|
15
|
+
* `dist/`, five from this file in `src/`.
|
|
16
|
+
*/
|
|
17
|
+
export declare function resolveOfficeOxideWasm(besideDir?: string): string | undefined;
|
|
18
|
+
/** Open a legacy Office file. Throws with a sentence when the module is missing. */
|
|
19
|
+
export declare function openOfficeOxide(data: Uint8Array, format: "doc" | "xls" | "ppt" | "docx" | "xlsx" | "pptx"): OfficeOxideDocument;
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A parsed Office document for use in JavaScript/WASM.
|
|
3
|
+
*/
|
|
4
|
+
export declare class WasmDocument {
|
|
5
|
+
__destroy_into_raw(): any;
|
|
6
|
+
free(): void;
|
|
7
|
+
/**
|
|
8
|
+
* Return the format name: "docx", "xlsx", or "pptx".
|
|
9
|
+
* @returns {string}
|
|
10
|
+
*/
|
|
11
|
+
formatName(): string;
|
|
12
|
+
/**
|
|
13
|
+
* Create a new document from raw bytes and a format string ("docx", "xlsx", "pptx").
|
|
14
|
+
* @param {Uint8Array} data
|
|
15
|
+
* @param {string} format
|
|
16
|
+
*/
|
|
17
|
+
constructor(data: any, format: any);
|
|
18
|
+
/**
|
|
19
|
+
* Extract plain text from the document.
|
|
20
|
+
* @returns {string}
|
|
21
|
+
*/
|
|
22
|
+
plainText(): string;
|
|
23
|
+
/**
|
|
24
|
+
* Convert the document to an HTML fragment.
|
|
25
|
+
* @returns {string}
|
|
26
|
+
*/
|
|
27
|
+
toHtml(): string;
|
|
28
|
+
/**
|
|
29
|
+
* Convert the document to a JSON IR representation.
|
|
30
|
+
* @returns {any}
|
|
31
|
+
*/
|
|
32
|
+
toIr(): any;
|
|
33
|
+
/**
|
|
34
|
+
* Convert to markdown, embedding each image inline as
|
|
35
|
+
* `[image-base64:<data>]` at its position in the document flow.
|
|
36
|
+
*
|
|
37
|
+
* Images are otherwise dropped from markdown entirely, which loses
|
|
38
|
+
* both their content and their position.
|
|
39
|
+
* @returns {string}
|
|
40
|
+
*/
|
|
41
|
+
toMarkdownWithImages(): string;
|
|
42
|
+
/**
|
|
43
|
+
* Convert the document to markdown.
|
|
44
|
+
* @returns {string}
|
|
45
|
+
*/
|
|
46
|
+
toMarkdown(): string;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* An Office document opened for editing from JavaScript/WASM.
|
|
50
|
+
*
|
|
51
|
+
* WASM had no file-editing API at all, so an agent could read a document
|
|
52
|
+
* but never change one. The document is held in memory with every OPC part
|
|
53
|
+
* preserved, so parts this crate does not model (images, charts, custom
|
|
54
|
+
* XML) survive the round-trip untouched.
|
|
55
|
+
*/
|
|
56
|
+
export declare class WasmEditableDocument {
|
|
57
|
+
__destroy_into_raw(): any;
|
|
58
|
+
free(): void;
|
|
59
|
+
/**
|
|
60
|
+
* Open a document for editing from raw bytes and a format string
|
|
61
|
+
* ("docx", "xlsx", "pptx").
|
|
62
|
+
* @param {Uint8Array} data
|
|
63
|
+
* @param {string} format
|
|
64
|
+
*/
|
|
65
|
+
constructor(data: any, format: any);
|
|
66
|
+
/**
|
|
67
|
+
* Replace every occurrence of `find` with `replace` in the document's
|
|
68
|
+
* text, returning how many replacements were made.
|
|
69
|
+
* @param {string} find
|
|
70
|
+
* @param {string} replace
|
|
71
|
+
* @returns {number}
|
|
72
|
+
*/
|
|
73
|
+
replaceText(find: any, replace: any): number;
|
|
74
|
+
/**
|
|
75
|
+
* Serialise the edited document back to bytes.
|
|
76
|
+
* @returns {Uint8Array}
|
|
77
|
+
*/
|
|
78
|
+
toBytes(): any;
|
|
79
|
+
}
|
|
80
|
+
declare function initSync(module: any): any;
|
|
81
|
+
declare function __wbg_init(module_or_path: any): Promise<any>;
|
|
82
|
+
export { initSync, __wbg_init as default };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* OOXML, OpenDocument, RTF, CSV and HTML through officeparser.
|
|
3
|
+
*
|
|
4
|
+
* officeparser parses to a tree and renders the tree to markdown. Its
|
|
5
|
+
* markdown carries every picture as a base64 data URI, which in a tool result
|
|
6
|
+
* is the picture's bytes spelled out as text, so the renderer's `onNode` hook
|
|
7
|
+
* replaces each one with a link to the file it was written to.
|
|
8
|
+
*/
|
|
9
|
+
import type { DocumentFormat, DocumentReadResult, ReadOptions } from "./formats";
|
|
10
|
+
export declare function readOffice(data: Uint8Array, format: DocumentFormat, options: ReadOptions): Promise<DocumentReadResult>;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* PDF through pdf.js (`pdfjs-dist`, legacy build, in this thread: no canvas,
|
|
3
|
+
* no worker file). See `pdfjs.ts` for why not unpdf.
|
|
4
|
+
*/
|
|
5
|
+
import type { DocumentReadResult, ReadOptions } from "./formats";
|
|
6
|
+
export declare function readPdf(data: Uint8Array, options: ReadOptions): Promise<DocumentReadResult>;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* pdf.js, from `pdfjs-dist`'s legacy build, run in this thread.
|
|
3
|
+
*
|
|
4
|
+
* Not unpdf's "serverless" build, which this reader used first: to be
|
|
5
|
+
* dependency-free, that build replaces pdf.js's WebAssembly decoders with
|
|
6
|
+
* stubs, so every CCITT, JBIG2 and JPEG 2000 image fails to decode ("JBig2
|
|
7
|
+
* failed to initialize"). Those are how most scanners and archives store a
|
|
8
|
+
* page, which made it useless for the one job OCR needs it for: getting the
|
|
9
|
+
* page image out.
|
|
10
|
+
*/
|
|
11
|
+
export type Pdfjs = typeof import("pdfjs-dist/legacy/build/pdf.mjs");
|
|
12
|
+
/**
|
|
13
|
+
* Loaded on first use: pdf.js is megabytes of code that a session which never
|
|
14
|
+
* reads a PDF should not pay for at startup.
|
|
15
|
+
*
|
|
16
|
+
* The worker's code is put on `globalThis.pdfjsWorker`, which pdf.js checks
|
|
17
|
+
* before starting a worker: it then runs in this thread, with no worker file
|
|
18
|
+
* to find, which is what lets it be bundled.
|
|
19
|
+
*/
|
|
20
|
+
export declare function loadPdfjs(): Promise<Pdfjs>;
|
|
21
|
+
/**
|
|
22
|
+
* A directory in the form pdf.js takes: ending in a forward slash.
|
|
23
|
+
*
|
|
24
|
+
* pdf.js appends a file name to it and refuses anything else ("must include
|
|
25
|
+
* trailing slash"), so the platform separator is wrong on Windows, where it
|
|
26
|
+
* failed every PDF. Node reads `C:\\dir/file` there without complaint.
|
|
27
|
+
*/
|
|
28
|
+
export declare function asDirectoryUrl(directory: string | undefined): string | undefined;
|
|
29
|
+
/** What every document is opened with: decoders and character maps found. */
|
|
30
|
+
export declare function pdfjsDocumentOptions(): Record<string, unknown>;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `range`: which pages, slides, sheets or chapters to read.
|
|
3
|
+
*/
|
|
4
|
+
export interface UnitRange {
|
|
5
|
+
/** Whether a one-based unit is selected. */
|
|
6
|
+
selects: (unit: number) => boolean;
|
|
7
|
+
/** The spec as given, for file names and messages. */
|
|
8
|
+
spec: string;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Parse `"1-5,9,12-"`: single units, closed spans, and an open end.
|
|
12
|
+
*
|
|
13
|
+
* Throws with a sentence the model can act on; the executor turns a throw
|
|
14
|
+
* into `success: false`.
|
|
15
|
+
*/
|
|
16
|
+
export declare function parseUnitRange(spec: string | undefined): UnitRange | undefined;
|
|
17
|
+
/** `[1,2,3,5,7,8]` as `1-3, 5, 7-8`. */
|
|
18
|
+
export declare function formatUnits(units: readonly number[]): string;
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Reading scanned pages and describing pictures: which engine a call uses,
|
|
3
|
+
* and the work itself.
|
|
4
|
+
*
|
|
5
|
+
* Three ways to read a scanned page, in the user's order of preference:
|
|
6
|
+
* tesseract on this machine; the vision model the user configured for the
|
|
7
|
+
* session (the Vision tab, or the CLI's --vision-model); or, with neither, the
|
|
8
|
+
* session's own model, which is handed the page images when it can see them.
|
|
9
|
+
*/
|
|
10
|
+
import type { AgentImageToDescribe } from "@cerebriline/shared";
|
|
11
|
+
import type { PageImage, RecognizedText } from "./formats";
|
|
12
|
+
import { type DocumentReaderSettings } from "./ocr";
|
|
13
|
+
export type DescribeImages = (images: readonly AgentImageToDescribe[]) => Promise<readonly (string | undefined)[]>;
|
|
14
|
+
/** What the call asked for: `auto` is the user's setting. */
|
|
15
|
+
export type OcrRequest = "auto" | "tesseract" | "vision" | "none";
|
|
16
|
+
/**
|
|
17
|
+
* Pages recognized per call. Past it the rest are named, and a range reads
|
|
18
|
+
* them: a 400-page scanned book is minutes of recognition, and the call would
|
|
19
|
+
* outlast its timeout long before it finished.
|
|
20
|
+
*/
|
|
21
|
+
export declare const TESSERACT_PAGE_LIMIT = 40;
|
|
22
|
+
/** A vision model reads a page in seconds, and each page is a request. */
|
|
23
|
+
export declare const VISION_PAGE_LIMIT = 12;
|
|
24
|
+
/** Pages handed to the session's own model: each is an image in its context. */
|
|
25
|
+
export declare const SELF_PAGE_LIMIT = 4;
|
|
26
|
+
/** Pictures described per call. */
|
|
27
|
+
export declare const DESCRIBE_LIMIT = 16;
|
|
28
|
+
export interface RecognitionPlan {
|
|
29
|
+
/** Passed to the reader; undefined when no recognition happens. */
|
|
30
|
+
recognize?: (page: number, images: readonly PageImage[]) => Promise<RecognizedText | undefined>;
|
|
31
|
+
/** Page images for the session's model to read, in `self` mode. */
|
|
32
|
+
readonly attachments: {
|
|
33
|
+
page: number;
|
|
34
|
+
png: Uint8Array;
|
|
35
|
+
}[];
|
|
36
|
+
/** Sentences for the result header. */
|
|
37
|
+
notes(scannedPages: readonly number[], recognizedPages: readonly number[]): string[];
|
|
38
|
+
close(): Promise<void>;
|
|
39
|
+
}
|
|
40
|
+
interface PlanInput {
|
|
41
|
+
request: OcrRequest | undefined;
|
|
42
|
+
languages: string | undefined;
|
|
43
|
+
settings: DocumentReaderSettings;
|
|
44
|
+
describeImages?: DescribeImages;
|
|
45
|
+
modelSupportsImages: boolean;
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* The recognition a call will do, ready to hand to the reader.
|
|
49
|
+
*
|
|
50
|
+
* tesseract's worker is started on the first scanned page, not before: most
|
|
51
|
+
* documents have none, and starting it costs a fifth of a second and a thread.
|
|
52
|
+
*/
|
|
53
|
+
export declare function planRecognition(input: PlanInput): RecognitionPlan;
|
|
54
|
+
export interface PictureToDescribe {
|
|
55
|
+
link: string;
|
|
56
|
+
mediaType: string;
|
|
57
|
+
data: Uint8Array;
|
|
58
|
+
source?: string;
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Descriptions of a document's pictures, one request each, in order.
|
|
62
|
+
* `undefined` for any the vision model could not describe.
|
|
63
|
+
*/
|
|
64
|
+
export declare function describePictures(describeImages: DescribeImages, pictures: readonly PictureToDescribe[], documentName: string): Promise<(string | undefined)[]>;
|
|
65
|
+
/** A description short enough for alt text: its first sentences, up to 300 characters. */
|
|
66
|
+
export declare function altTextOf(description: string): string;
|
|
67
|
+
export {};
|