@vercel/factory 0.0.14 → 0.0.16
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +356 -0
- package/README.md +96 -2
- package/dist/agent-routes.d.mts +113 -0
- package/dist/agent-routes.mjs +91 -0
- package/dist/agent-routes.mjs.map +1 -0
- package/dist/api-contracts.d.mts +1768 -0
- package/dist/api-contracts.mjs +119 -0
- package/dist/api-contracts.mjs.map +1 -0
- package/dist/api-images.d.mts +30 -0
- package/dist/api-images.mjs +28 -0
- package/dist/api-images.mjs.map +1 -0
- package/dist/api-task-graph.mjs +57 -0
- package/dist/api-task-graph.mjs.map +1 -0
- package/dist/api.d.mts +111 -216
- package/dist/api.mjs +1063 -99
- package/dist/api.mjs.map +1 -1
- package/dist/approval-access.d.mts +39 -0
- package/dist/approval-access.mjs +62 -0
- package/dist/approval-access.mjs.map +1 -0
- package/dist/approval-contracts.d.mts +698 -0
- package/dist/approval-contracts.mjs +27 -0
- package/dist/approval-contracts.mjs.map +1 -0
- package/dist/approval.d.mts +49 -0
- package/dist/approval.mjs +39 -0
- package/dist/approval.mjs.map +1 -0
- package/dist/blob/artifacts.d.mts +37 -0
- package/dist/blob/artifacts.mjs +45 -0
- package/dist/blob/artifacts.mjs.map +1 -0
- package/dist/blob/index.d.mts +84 -12
- package/dist/blob/index.mjs +179 -45
- package/dist/blob/index.mjs.map +1 -1
- package/dist/budget.d.mts +115 -0
- package/dist/budget.mjs +147 -0
- package/dist/budget.mjs.map +1 -0
- package/dist/budgets.d.mts +4 -0
- package/dist/budgets.mjs +4 -0
- package/dist/build-factory.d.mts +7 -4
- package/dist/build-factory.mjs +2 -1
- package/dist/build-factory.mjs.map +1 -1
- package/dist/change-verification/brief.d.mts +9 -0
- package/dist/change-verification/brief.mjs +13 -0
- package/dist/change-verification/brief.mjs.map +1 -0
- package/dist/change-verification/dispatch.d.mts +37 -0
- package/dist/change-verification/dispatch.mjs +83 -0
- package/dist/change-verification/dispatch.mjs.map +1 -0
- package/dist/change-verification/eve-tool.d.mts +61 -0
- package/dist/change-verification/eve-tool.mjs +89 -0
- package/dist/change-verification/eve-tool.mjs.map +1 -0
- package/dist/change-verification/result.mjs +130 -0
- package/dist/change-verification/result.mjs.map +1 -0
- package/dist/changes/eve-record-change.d.mts +56 -0
- package/dist/changes/eve-record-change.mjs +131 -0
- package/dist/changes/eve-record-change.mjs.map +1 -0
- package/dist/changes/presentation.d.mts +14 -0
- package/dist/changes.d.mts +24 -0
- package/dist/changes.mjs +29 -0
- package/dist/changes.mjs.map +1 -0
- package/dist/client-events.d.mts +25 -0
- package/dist/client-events.mjs +45 -0
- package/dist/client-events.mjs.map +1 -0
- package/dist/client-stream.d.mts +28 -0
- package/dist/client-stream.mjs +210 -0
- package/dist/client-stream.mjs.map +1 -0
- package/dist/client-transcript.d.mts +41 -0
- package/dist/client-transcript.mjs +233 -0
- package/dist/client-transcript.mjs.map +1 -0
- package/dist/client.d.mts +343 -0
- package/dist/client.mjs +366 -0
- package/dist/client.mjs.map +1 -0
- package/dist/code-review/contracts.d.mts +27 -0
- package/dist/code-review/eve-post-review.d.mts +70 -0
- package/dist/code-review/eve-post-review.mjs +195 -0
- package/dist/code-review/eve-post-review.mjs.map +1 -0
- package/dist/code-review/eve-review-comments.d.mts +75 -0
- package/dist/code-review/eve-review-comments.mjs +193 -0
- package/dist/code-review/eve-review-comments.mjs.map +1 -0
- package/dist/code-review/github-contracts.d.mts +10 -0
- package/dist/code-review/github-reporter.d.mts +46 -0
- package/dist/code-review/github-reporter.mjs +262 -0
- package/dist/code-review/github-reporter.mjs.map +1 -0
- package/dist/code-review/preparation.d.mts +34 -0
- package/dist/code-review/preparation.mjs +23 -0
- package/dist/code-review/preparation.mjs.map +1 -0
- package/dist/code-review/stall.d.mts +17 -0
- package/dist/code-review/stall.mjs +30 -0
- package/dist/code-review/stall.mjs.map +1 -0
- package/dist/code-review.d.mts +7 -0
- package/dist/code-review.mjs +5 -0
- package/dist/communication.d.mts +9 -0
- package/dist/communication.mjs +9 -0
- package/dist/connectors/github.d.mts +26 -0
- package/dist/connectors/github.mjs +55 -0
- package/dist/connectors/github.mjs.map +1 -0
- package/dist/connectors/index.d.mts +35 -3
- package/dist/connectors/index.mjs +3 -52
- package/dist/connectors/index.mjs.map +1 -1
- package/dist/connectors/outbox.d.mts +34 -0
- package/dist/connectors/outbox.mjs +50 -0
- package/dist/connectors/outbox.mjs.map +1 -0
- package/dist/connectors/slack-approval-blocks.mjs +136 -0
- package/dist/connectors/slack-approval-blocks.mjs.map +1 -0
- package/dist/connectors/slack-approvals.d.mts +29 -0
- package/dist/connectors/slack-approvals.mjs +346 -0
- package/dist/connectors/slack-approvals.mjs.map +1 -0
- package/dist/connectors/slack.d.mts +35 -52
- package/dist/connectors/slack.mjs +13 -85
- package/dist/connectors/slack.mjs.map +1 -1
- package/dist/deepsec/eve-tool.d.mts +110 -0
- package/dist/deepsec/eve-tool.mjs +166 -0
- package/dist/deepsec/eve-tool.mjs.map +1 -0
- package/dist/deepsec/finding.d.mts +84 -0
- package/dist/deepsec/finding.mjs +56 -0
- package/dist/deepsec/finding.mjs.map +1 -0
- package/dist/deepsec.d.mts +3 -0
- package/dist/delivery-metrics/metrics.d.mts +93 -0
- package/dist/delivery-metrics/metrics.mjs +200 -0
- package/dist/delivery-metrics/metrics.mjs.map +1 -0
- package/dist/delivery-metrics.d.mts +2 -0
- package/dist/delivery-metrics.mjs +2 -0
- package/dist/dispatch.d.mts +152 -0
- package/dist/dispatch.mjs +199 -0
- package/dist/dispatch.mjs.map +1 -0
- package/dist/errors.d.mts +15 -0
- package/dist/errors.mjs +38 -0
- package/dist/errors.mjs.map +1 -0
- package/dist/eve/index.d.mts +209 -1277
- package/dist/eve/index.mjs +312 -1073
- package/dist/eve/index.mjs.map +1 -1
- package/dist/eve/invoke.d.mts +144 -0
- package/dist/eve/invoke.mjs +254 -0
- package/dist/eve/invoke.mjs.map +1 -0
- package/dist/eve/session-client.d.mts +186 -0
- package/dist/eve/session-client.mjs +245 -0
- package/dist/eve/session-client.mjs.map +1 -0
- package/dist/eve/task-execution.d.mts +380 -0
- package/dist/eve/task-execution.mjs +73 -0
- package/dist/eve/task-execution.mjs.map +1 -0
- package/dist/eve/task-session.d.mts +129 -0
- package/dist/eve/task-session.mjs +245 -0
- package/dist/eve/task-session.mjs.map +1 -0
- package/dist/eve/transcript.d.mts +37 -0
- package/dist/eve/transcript.mjs +69 -0
- package/dist/eve/transcript.mjs.map +1 -0
- package/dist/execution-public.d.mts +8 -0
- package/dist/execution-public.mjs +7 -0
- package/dist/execution.d.mts +183 -0
- package/dist/execution.mjs +223 -0
- package/dist/execution.mjs.map +1 -0
- package/dist/finding-remediation/admission.d.mts +53 -0
- package/dist/finding-remediation/admission.mjs +90 -0
- package/dist/finding-remediation/admission.mjs.map +1 -0
- package/dist/finding-remediation/brief.d.mts +14 -0
- package/dist/finding-remediation/brief.mjs +25 -0
- package/dist/finding-remediation/brief.mjs.map +1 -0
- package/dist/finding-remediation/eve-tool.d.mts +29 -0
- package/dist/finding-remediation/eve-tool.mjs +34 -0
- package/dist/finding-remediation/eve-tool.mjs.map +1 -0
- package/dist/findings/fingerprint.d.mts +14 -0
- package/dist/findings/fingerprint.mjs +28 -0
- package/dist/findings/fingerprint.mjs.map +1 -0
- package/dist/findings.d.mts +7 -0
- package/dist/findings.mjs +6 -0
- package/dist/github-app.d.mts +54 -0
- package/dist/github-app.mjs +121 -0
- package/dist/github-app.mjs.map +1 -0
- package/dist/github-publication.d.mts +199 -0
- package/dist/github-publication.mjs +442 -0
- package/dist/github-publication.mjs.map +1 -0
- package/dist/github-transfer.d.mts +81 -0
- package/dist/github-transfer.mjs +273 -0
- package/dist/github-transfer.mjs.map +1 -0
- package/dist/github.d.mts +446 -2
- package/dist/github.mjs +357 -56
- package/dist/github.mjs.map +1 -1
- package/dist/image-input.d.mts +51 -0
- package/dist/image-input.mjs +63 -0
- package/dist/image-input.mjs.map +1 -0
- package/dist/inbox-activity.d.mts +53 -0
- package/dist/inbox-activity.mjs +41 -0
- package/dist/inbox-activity.mjs.map +1 -0
- package/dist/index.d.mts +16 -484
- package/dist/index.mjs +15 -522
- package/dist/intake-contracts.d.mts +55 -0
- package/dist/intake-contracts.mjs +33 -0
- package/dist/intake-contracts.mjs.map +1 -0
- package/dist/integrations/deepsec.d.mts +5 -0
- package/dist/integrations/deepsec.mjs +3 -0
- package/dist/integrations/github.d.mts +11 -0
- package/dist/integrations/github.mjs +9 -0
- package/dist/integrations/slack.d.mts +5 -0
- package/dist/integrations/slack.mjs +5 -0
- package/dist/integrations/vercel.d.mts +5 -0
- package/dist/integrations/vercel.mjs +4 -0
- package/dist/merge-resolution/contracts.d.mts +17 -0
- package/dist/merge-resolution/contracts.mjs +19 -0
- package/dist/merge-resolution/contracts.mjs.map +1 -0
- package/dist/merge-resolution/eve-tools.d.mts +47 -0
- package/dist/merge-resolution/eve-tools.mjs +122 -0
- package/dist/merge-resolution/eve-tools.mjs.map +1 -0
- package/dist/model-settings.d.mts +41 -0
- package/dist/model-settings.mjs +35 -0
- package/dist/model-settings.mjs.map +1 -0
- package/dist/multi-repository-changes/coordination.d.mts +49 -0
- package/dist/multi-repository-changes/coordination.mjs +115 -0
- package/dist/multi-repository-changes/coordination.mjs.map +1 -0
- package/dist/planning/cancellation.mjs +82 -0
- package/dist/planning/cancellation.mjs.map +1 -0
- package/dist/planning/configuration.d.mts +23 -0
- package/dist/planning/configuration.mjs +56 -0
- package/dist/planning/configuration.mjs.map +1 -0
- package/dist/planning/contracts.d.mts +136 -0
- package/dist/planning/contracts.mjs +42 -0
- package/dist/planning/contracts.mjs.map +1 -0
- package/dist/planning/dependencies.mjs +44 -0
- package/dist/planning/dependencies.mjs.map +1 -0
- package/dist/planning/effects.mjs +122 -0
- package/dist/planning/effects.mjs.map +1 -0
- package/dist/planning/reconcile.mjs +279 -0
- package/dist/planning/reconcile.mjs.map +1 -0
- package/dist/planning/runtime.d.mts +27 -0
- package/dist/planning/runtime.mjs +25 -0
- package/dist/planning/runtime.mjs.map +1 -0
- package/dist/planning/state.mjs +92 -0
- package/dist/planning/state.mjs.map +1 -0
- package/dist/planning/turns.mjs +262 -0
- package/dist/planning/turns.mjs.map +1 -0
- package/dist/planning/validation.mjs +106 -0
- package/dist/planning/validation.mjs.map +1 -0
- package/dist/postgres/index.d.mts +48 -1
- package/dist/postgres/index.mjs +45 -3
- package/dist/postgres/index.mjs.map +1 -1
- package/dist/presets/software-development/approval.d.mts +14 -0
- package/dist/presets/software-development/approval.mjs +21 -0
- package/dist/presets/software-development/approval.mjs.map +1 -0
- package/dist/presets/software-development/deepsec-brief.d.mts +8 -0
- package/dist/presets/software-development/deepsec-brief.mjs +14 -0
- package/dist/presets/software-development/deepsec-brief.mjs.map +1 -0
- package/dist/presets/software-development/dispatch.d.mts +56 -0
- package/dist/presets/software-development/dispatch.mjs +67 -0
- package/dist/presets/software-development/dispatch.mjs.map +1 -0
- package/dist/presets/software-development/eve-delegation-policy.d.mts +7 -0
- package/dist/presets/software-development/eve-delegation-policy.mjs +34 -0
- package/dist/presets/software-development/eve-delegation-policy.mjs.map +1 -0
- package/dist/presets/software-development/eve.d.mts +18 -0
- package/dist/presets/software-development/eve.mjs +19 -0
- package/dist/presets/software-development/eve.mjs.map +1 -0
- package/dist/presets/software-development/finish-task-policy.d.mts +7 -0
- package/dist/presets/software-development/finish-task-policy.mjs +9 -0
- package/dist/presets/software-development/finish-task-policy.mjs.map +1 -0
- package/dist/presets/software-development/recovery.d.mts +32 -0
- package/dist/presets/software-development/recovery.mjs +120 -0
- package/dist/presets/software-development/recovery.mjs.map +1 -0
- package/dist/presets/software-development/task-communication.d.mts +24 -0
- package/dist/presets/software-development/task-communication.mjs +157 -0
- package/dist/presets/software-development/task-communication.mjs.map +1 -0
- package/dist/presets/software-development.d.mts +10 -0
- package/dist/presets/software-development.mjs +9 -0
- package/dist/pull-requests/contracts.d.mts +72 -0
- package/dist/pull-requests/eve-fetch.d.mts +57 -0
- package/dist/pull-requests/eve-fetch.mjs +151 -0
- package/dist/pull-requests/eve-fetch.mjs.map +1 -0
- package/dist/pull-requests/github-label-manager.d.mts +27 -0
- package/dist/pull-requests/github-label-manager.mjs +40 -0
- package/dist/pull-requests/github-label-manager.mjs.map +1 -0
- package/dist/pull-requests/github-publisher.d.mts +67 -0
- package/dist/pull-requests/github-publisher.mjs +405 -0
- package/dist/pull-requests/github-publisher.mjs.map +1 -0
- package/dist/pull-requests.d.mts +6 -0
- package/dist/pull-requests.mjs +4 -0
- package/dist/receipts.d.mts +4 -0
- package/dist/receipts.mjs +3 -0
- package/dist/repositories.d.mts +18 -0
- package/dist/repositories.mjs +33 -0
- package/dist/repositories.mjs.map +1 -0
- package/dist/sandbox/command.d.mts +18 -0
- package/dist/sandbox/execution-abort.d.mts +16 -0
- package/dist/sandbox/execution-abort.mjs +49 -0
- package/dist/sandbox/execution-abort.mjs.map +1 -0
- package/dist/sandbox/execution-environment.d.mts +25 -0
- package/dist/sandbox/execution-run-ledger.d.mts +115 -0
- package/dist/sandbox/execution-run-ledger.mjs +209 -0
- package/dist/sandbox/execution-run-ledger.mjs.map +1 -0
- package/dist/sandbox/execution.d.mts +54 -0
- package/dist/sandbox/execution.mjs +228 -0
- package/dist/sandbox/execution.mjs.map +1 -0
- package/dist/sandbox/harness-runner.d.mts +79 -0
- package/dist/sandbox/harness-runner.mjs +162 -0
- package/dist/sandbox/harness-runner.mjs.map +1 -0
- package/dist/sandbox/index.d.mts +10 -0
- package/dist/sandbox/index.mjs +7 -0
- package/dist/sandbox/task-environment.d.mts +50 -0
- package/dist/sandbox/task-environment.mjs +140 -0
- package/dist/sandbox/task-environment.mjs.map +1 -0
- package/dist/sandbox/workspace.d.mts +29 -0
- package/dist/sandbox/workspace.mjs +28 -0
- package/dist/sandbox/workspace.mjs.map +1 -0
- package/dist/schema/agent-route.d.mts +40 -0
- package/dist/schema/agent-route.mjs +33 -0
- package/dist/schema/agent-route.mjs.map +1 -0
- package/dist/schema/answer.d.mts +23 -0
- package/dist/schema/answer.mjs +21 -0
- package/dist/schema/answer.mjs.map +1 -0
- package/dist/schema/budget.d.mts +38 -0
- package/dist/schema/budget.mjs +30 -0
- package/dist/schema/budget.mjs.map +1 -0
- package/dist/schema/catalog.mjs +72 -0
- package/dist/schema/catalog.mjs.map +1 -0
- package/dist/schema/change.d.mts +117 -0
- package/dist/schema/change.mjs +68 -0
- package/dist/schema/change.mjs.map +1 -0
- package/dist/schema/common.d.mts +33 -0
- package/dist/{id-BLIkCVue.mjs → schema/common.mjs} +7 -16
- package/dist/schema/common.mjs.map +1 -0
- package/dist/schema/communication.d.mts +52 -0
- package/dist/{communication-Kd9nU5RP.mjs → schema/communication.mjs} +8 -3
- package/dist/schema/communication.mjs.map +1 -0
- package/dist/schema/execution.d.mts +101 -0
- package/dist/schema/execution.mjs +86 -0
- package/dist/schema/execution.mjs.map +1 -0
- package/dist/schema/factory-config.d.mts +122 -0
- package/dist/schema/factory-config.mjs +90 -0
- package/dist/schema/factory-config.mjs.map +1 -0
- package/dist/schema/finding.d.mts +125 -0
- package/dist/schema/finding.mjs +67 -0
- package/dist/schema/finding.mjs.map +1 -0
- package/dist/schema/id.d.mts +43 -0
- package/dist/schema/id.mjs +32 -0
- package/dist/schema/id.mjs.map +1 -0
- package/dist/schema/outbox.d.mts +240 -0
- package/dist/schema/outbox.mjs +53 -0
- package/dist/schema/outbox.mjs.map +1 -0
- package/dist/schema/question-route.mjs +16 -0
- package/dist/schema/question-route.mjs.map +1 -0
- package/dist/schema/receipt.d.mts +81 -0
- package/dist/schema/receipt.mjs +94 -0
- package/dist/schema/receipt.mjs.map +1 -0
- package/dist/schema/repository.d.mts +30 -0
- package/dist/schema/repository.mjs +29 -0
- package/dist/schema/repository.mjs.map +1 -0
- package/dist/schema/session.d.mts +136 -0
- package/dist/schema/session.mjs +54 -0
- package/dist/schema/session.mjs.map +1 -0
- package/dist/schema/signal.d.mts +105 -0
- package/dist/schema/signal.mjs +81 -0
- package/dist/schema/signal.mjs.map +1 -0
- package/dist/schema/slack-pr-notifications.d.mts +12 -0
- package/dist/schema/slack-pr-notifications.mjs +11 -0
- package/dist/schema/slack-pr-notifications.mjs.map +1 -0
- package/dist/schema/stored-session.mjs +10 -0
- package/dist/schema/stored-session.mjs.map +1 -0
- package/dist/schema/stored-task.mjs +20 -0
- package/dist/schema/stored-task.mjs.map +1 -0
- package/dist/schema/task-effect.d.mts +39 -0
- package/dist/schema/task-effect.mjs +29 -0
- package/dist/schema/task-effect.mjs.map +1 -0
- package/dist/schema/task-graph.d.mts +3173 -0
- package/dist/schema/task-graph.mjs +97 -0
- package/dist/schema/task-graph.mjs.map +1 -0
- package/dist/schema/task-message.d.mts +254 -0
- package/dist/schema/task-message.mjs +189 -0
- package/dist/schema/task-message.mjs.map +1 -0
- package/dist/schema/task.d.mts +273 -0
- package/dist/schema/task.mjs +200 -0
- package/dist/schema/task.mjs.map +1 -0
- package/dist/schema/transcript.d.mts +176 -0
- package/dist/schema/transcript.mjs +87 -0
- package/dist/schema/transcript.mjs.map +1 -0
- package/dist/schema/transitions.d.mts +50 -0
- package/dist/schema/transitions.mjs +303 -0
- package/dist/schema/transitions.mjs.map +1 -0
- package/dist/schema/work.d.mts +150 -0
- package/dist/schema/work.mjs +102 -0
- package/dist/schema/work.mjs.map +1 -0
- package/dist/session-previews.d.mts +76 -0
- package/dist/session-previews.mjs +55 -0
- package/dist/session-previews.mjs.map +1 -0
- package/dist/session-review.d.mts +120 -0
- package/dist/session-review.mjs +79 -0
- package/dist/session-review.mjs.map +1 -0
- package/dist/signal-triage.d.mts +20 -0
- package/dist/signal-triage.mjs +85 -0
- package/dist/signal-triage.mjs.map +1 -0
- package/dist/signals.d.mts +20 -0
- package/dist/signals.mjs +19 -0
- package/dist/signals.mjs.map +1 -0
- package/dist/stall.d.mts +41 -0
- package/dist/stall.mjs +83 -0
- package/dist/stall.mjs.map +1 -0
- package/dist/storage.d.mts +4 -0
- package/dist/storage.mjs +4 -0
- package/dist/store/driver.d.mts +65 -0
- package/dist/store/driver.mjs +42 -0
- package/dist/store/driver.mjs.map +1 -0
- package/dist/store/engine.d.mts +683 -0
- package/dist/store/engine.mjs +2309 -0
- package/dist/store/engine.mjs.map +1 -0
- package/dist/store/memory.d.mts +24 -0
- package/dist/store/memory.mjs +69 -0
- package/dist/store/memory.mjs.map +1 -0
- package/dist/store/slack-pr-notifications.d.mts +44 -0
- package/dist/store/slack-pr-notifications.mjs +121 -0
- package/dist/store/slack-pr-notifications.mjs.map +1 -0
- package/dist/store/task-effects.d.mts +38 -0
- package/dist/store/task-effects.mjs +118 -0
- package/dist/store/task-effects.mjs.map +1 -0
- package/dist/store/task-graphs.d.mts +60 -0
- package/dist/store/task-graphs.mjs +212 -0
- package/dist/store/task-graphs.mjs.map +1 -0
- package/dist/store/task-messages.d.mts +136 -0
- package/dist/store/task-messages.mjs +475 -0
- package/dist/store/task-messages.mjs.map +1 -0
- package/dist/store/task-work.d.mts +180 -0
- package/dist/store/task-work.mjs +137 -0
- package/dist/store/task-work.mjs.map +1 -0
- package/dist/store/work-notifications.d.mts +19 -0
- package/dist/store/work-notifications.mjs +48 -0
- package/dist/store/work-notifications.mjs.map +1 -0
- package/dist/sweep.d.mts +79 -0
- package/dist/sweep.mjs +171 -0
- package/dist/sweep.mjs.map +1 -0
- package/dist/task-communication.d.mts +35 -0
- package/dist/task-communication.mjs +47 -0
- package/dist/task-communication.mjs.map +1 -0
- package/dist/task-graph-view.d.mts +267 -0
- package/dist/task-graph-view.mjs +17 -0
- package/dist/task-graph-view.mjs.map +1 -0
- package/dist/task-message-processing.d.mts +60 -0
- package/dist/task-message-processing.mjs +200 -0
- package/dist/task-message-processing.mjs.map +1 -0
- package/dist/task-protocols.d.mts +80 -0
- package/dist/task-protocols.mjs +47 -0
- package/dist/task-protocols.mjs.map +1 -0
- package/dist/tasks.d.mts +17 -0
- package/dist/tasks.mjs +17 -0
- package/dist/vercel-git.d.mts +53 -0
- package/dist/vercel-git.mjs +344 -0
- package/dist/vercel-git.mjs.map +1 -0
- package/dist/vercel-github-api.d.mts +103 -0
- package/dist/vercel-github-api.mjs +363 -0
- package/dist/vercel-github-api.mjs.map +1 -0
- package/dist/vercel.d.mts +34 -2
- package/dist/vercel.mjs +49 -3
- package/dist/vercel.mjs.map +1 -1
- package/dist/work-triage/eve-tool.d.mts +29 -0
- package/dist/work-triage/eve-tool.mjs +32 -0
- package/dist/work-triage/eve-tool.mjs.map +1 -0
- package/dist/work-triage/find-existing-work.d.mts +32 -0
- package/dist/work-triage/find-existing-work.mjs +31 -0
- package/dist/work-triage/find-existing-work.mjs.map +1 -0
- package/dist/work-triage/github.d.mts +15 -0
- package/dist/work-triage/github.mjs +14 -0
- package/dist/work-triage/github.mjs.map +1 -0
- package/dist/work-triage.d.mts +4 -0
- package/dist/work-triage.mjs +3 -0
- package/dist/workflows.d.mts +146 -0
- package/dist/workflows.mjs +139 -0
- package/dist/workflows.mjs.map +1 -0
- package/dist/workspace-diff-assembly.d.mts +33 -0
- package/dist/workspace-diff-assembly.mjs +95 -0
- package/dist/workspace-diff-assembly.mjs.map +1 -0
- package/dist/workspace-diff.d.mts +90 -0
- package/dist/workspace-diff.mjs +61 -0
- package/dist/workspace-diff.mjs.map +1 -0
- package/dist/workspace-files-git.d.mts +15 -0
- package/dist/workspace-files-git.mjs +61 -0
- package/dist/workspace-files-git.mjs.map +1 -0
- package/dist/workspace-files.d.mts +107 -0
- package/dist/workspace-files.mjs +74 -0
- package/dist/workspace-files.mjs.map +1 -0
- package/dist/workspace-snapshot.d.mts +26 -0
- package/dist/workspace-snapshot.mjs +80 -0
- package/dist/workspace-snapshot.mjs.map +1 -0
- package/docs/getting-started.md +104 -0
- package/docs/index.md +100 -0
- package/docs/recipes/cancellation.md +215 -0
- package/docs/recipes/custom-workflow.md +153 -0
- package/docs/recipes/dependent-tasks.md +207 -0
- package/docs/recipes/eve-agent.md +277 -0
- package/docs/recipes/human-input.md +204 -0
- package/docs/recipes/persistence-recovery.md +268 -0
- package/docs/recipes/retry-recovery.md +241 -0
- package/docs/recipes/task-messaging.md +215 -0
- package/docs/recipes/typed-eve-result.md +161 -0
- package/docs/runtime-integration.md +137 -0
- package/package.json +142 -46
- package/dist/approval-JX2Px9IC.mjs +0 -132
- package/dist/approval-JX2Px9IC.mjs.map +0 -1
- package/dist/budget-DzSiIA4t.mjs +0 -42
- package/dist/budget-DzSiIA4t.mjs.map +0 -1
- package/dist/change-D2U6v7Ek.mjs +0 -554
- package/dist/change-D2U6v7Ek.mjs.map +0 -1
- package/dist/communication-Kd9nU5RP.mjs.map +0 -1
- package/dist/coordination-Cq08hb1l.mjs +0 -76
- package/dist/coordination-Cq08hb1l.mjs.map +0 -1
- package/dist/dispatch-BaZS3PT8.d.mts +0 -76
- package/dist/driver-BC0Mt5KG.d.mts +0 -34
- package/dist/driver-Bbd25rNM.mjs +0 -23
- package/dist/driver-Bbd25rNM.mjs.map +0 -1
- package/dist/engine-DFHU2Pe-.d.mts +0 -781
- package/dist/engine-WaUM2cGA.mjs +0 -1068
- package/dist/engine-WaUM2cGA.mjs.map +0 -1
- package/dist/factory-config-BoRXOw43.mjs +0 -50
- package/dist/factory-config-BoRXOw43.mjs.map +0 -1
- package/dist/factory-config-D2yU3G0c.d.mts +0 -58
- package/dist/github-C5HNBN6p.d.mts +0 -279
- package/dist/id-BLIkCVue.mjs.map +0 -1
- package/dist/index-Bw6hggoH.d.mts +0 -40
- package/dist/index.mjs.map +0 -1
- package/dist/task-CcOyOJ3k.mjs +0 -154
- package/dist/task-CcOyOJ3k.mjs.map +0 -1
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { ImageAttachment } from "./image-input.mjs";
|
|
2
|
+
import { InputRequest, ToolCall, TranscriptBlock, TranscriptSnapshot } from "./schema/transcript.mjs";
|
|
3
|
+
import { StreamEvent } from "./client-events.mjs";
|
|
4
|
+
//#region src/client-transcript.d.ts
|
|
5
|
+
/** Mutable client-side projection of snapshot and live Factory transcript events. */
|
|
6
|
+
declare class Transcript {
|
|
7
|
+
private initialMessage?;
|
|
8
|
+
private initialAttachments?;
|
|
9
|
+
blocks: TranscriptBlock[];
|
|
10
|
+
inputs: Map<string, Readonly<{
|
|
11
|
+
requestId: string;
|
|
12
|
+
prompt: string;
|
|
13
|
+
kind: string;
|
|
14
|
+
allowFreeform?: boolean | undefined;
|
|
15
|
+
options?: readonly Readonly<{
|
|
16
|
+
id: string;
|
|
17
|
+
label: string;
|
|
18
|
+
description?: string | undefined;
|
|
19
|
+
}>[] | undefined;
|
|
20
|
+
}>>;
|
|
21
|
+
cursor: number;
|
|
22
|
+
state: string;
|
|
23
|
+
turnId?: string;
|
|
24
|
+
tokens: number;
|
|
25
|
+
private seen;
|
|
26
|
+
private tools;
|
|
27
|
+
constructor(initialMessage?: string | undefined, initialAttachments?: readonly ImageAttachment[] | undefined);
|
|
28
|
+
snapshot(): TranscriptSnapshot;
|
|
29
|
+
hydrate(value: TranscriptSnapshot): void;
|
|
30
|
+
put(block: TranscriptBlock): void;
|
|
31
|
+
appendHistory(id: string, transcript: Transcript): void;
|
|
32
|
+
prependHistory(entries: readonly {
|
|
33
|
+
id: string;
|
|
34
|
+
transcript: Transcript;
|
|
35
|
+
}[]): void;
|
|
36
|
+
accept(event: StreamEvent): void;
|
|
37
|
+
private tool;
|
|
38
|
+
}
|
|
39
|
+
//#endregion
|
|
40
|
+
export { type InputRequest, type ToolCall, Transcript, type TranscriptBlock, type TranscriptSnapshot };
|
|
41
|
+
//# sourceMappingURL=client-transcript.d.mts.map
|
|
@@ -0,0 +1,233 @@
|
|
|
1
|
+
import { receivedImages } from "./image-input.mjs";
|
|
2
|
+
import { inputRequestSchema, transcriptSnapshotSchema } from "./schema/transcript.mjs";
|
|
3
|
+
//#region src/client-transcript.ts
|
|
4
|
+
function record(value) {
|
|
5
|
+
return typeof value === "object" && value !== null && !Array.isArray(value) ? value : {};
|
|
6
|
+
}
|
|
7
|
+
function string(value) {
|
|
8
|
+
return typeof value === "string" ? value : JSON.stringify(value, null, 2) ?? "";
|
|
9
|
+
}
|
|
10
|
+
function parseInput(text) {
|
|
11
|
+
try {
|
|
12
|
+
return JSON.parse(text);
|
|
13
|
+
} catch {
|
|
14
|
+
return;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
function settled(tool) {
|
|
18
|
+
return [
|
|
19
|
+
"completed",
|
|
20
|
+
"failed",
|
|
21
|
+
"cancelled",
|
|
22
|
+
"rejected"
|
|
23
|
+
].includes(tool.state);
|
|
24
|
+
}
|
|
25
|
+
/** Mutable client-side projection of snapshot and live Factory transcript events. */
|
|
26
|
+
var Transcript = class {
|
|
27
|
+
initialMessage;
|
|
28
|
+
initialAttachments;
|
|
29
|
+
blocks = [];
|
|
30
|
+
inputs = /* @__PURE__ */ new Map();
|
|
31
|
+
cursor = 0;
|
|
32
|
+
state = "connecting";
|
|
33
|
+
turnId;
|
|
34
|
+
tokens = 0;
|
|
35
|
+
seen = /* @__PURE__ */ new Set();
|
|
36
|
+
tools = /* @__PURE__ */ new Map();
|
|
37
|
+
constructor(initialMessage, initialAttachments) {
|
|
38
|
+
this.initialMessage = initialMessage;
|
|
39
|
+
this.initialAttachments = initialAttachments;
|
|
40
|
+
}
|
|
41
|
+
snapshot() {
|
|
42
|
+
return transcriptSnapshotSchema.parse({
|
|
43
|
+
blocks: this.blocks,
|
|
44
|
+
inputs: [...this.inputs.values()],
|
|
45
|
+
cursor: this.cursor,
|
|
46
|
+
state: this.state,
|
|
47
|
+
turnId: this.turnId,
|
|
48
|
+
tokens: this.tokens
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
hydrate(value) {
|
|
52
|
+
const snapshot = transcriptSnapshotSchema.parse(value);
|
|
53
|
+
this.blocks = snapshot.blocks.map((block) => ({ ...block }));
|
|
54
|
+
const firstUser = this.blocks.find((block) => block.kind === "user");
|
|
55
|
+
if (firstUser !== void 0 && (this.initialMessage !== void 0 || this.initialAttachments !== void 0)) {
|
|
56
|
+
const text = this.initialMessage ?? firstUser.text;
|
|
57
|
+
const attachments = this.initialAttachments ?? firstUser.attachments;
|
|
58
|
+
const firstUserIndex = this.blocks.indexOf(firstUser);
|
|
59
|
+
if (attachments?.length) this.blocks[firstUserIndex] = {
|
|
60
|
+
...firstUser,
|
|
61
|
+
text,
|
|
62
|
+
attachments: [...attachments]
|
|
63
|
+
};
|
|
64
|
+
else {
|
|
65
|
+
const { attachments: _attachments, ...withoutAttachments } = firstUser;
|
|
66
|
+
this.blocks[firstUserIndex] = {
|
|
67
|
+
...withoutAttachments,
|
|
68
|
+
text
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
this.inputs = new Map(snapshot.inputs.map((request) => [request.requestId, request]));
|
|
73
|
+
this.cursor = snapshot.cursor;
|
|
74
|
+
this.state = snapshot.state;
|
|
75
|
+
this.turnId = snapshot.turnId;
|
|
76
|
+
this.tokens = snapshot.tokens;
|
|
77
|
+
this.seen.clear();
|
|
78
|
+
this.tools = new Map(this.blocks.flatMap((block) => block.tool ? [[block.tool.callId, block.tool]] : []));
|
|
79
|
+
this.initialMessage = void 0;
|
|
80
|
+
this.initialAttachments = void 0;
|
|
81
|
+
}
|
|
82
|
+
put(block) {
|
|
83
|
+
const index = this.blocks.findIndex((item) => item.id === block.id);
|
|
84
|
+
if (index < 0) this.blocks.push(block);
|
|
85
|
+
else this.blocks[index] = block;
|
|
86
|
+
}
|
|
87
|
+
appendHistory(id, transcript) {
|
|
88
|
+
for (const block of transcript.blocks) this.put({
|
|
89
|
+
...block,
|
|
90
|
+
id: `history:${id}:${block.id}`
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
prependHistory(entries) {
|
|
94
|
+
const history = entries.flatMap(({ id, transcript }) => transcript.blocks.map((block) => ({
|
|
95
|
+
...block,
|
|
96
|
+
id: `history:${id}:${block.id}`
|
|
97
|
+
})));
|
|
98
|
+
const ids = new Set(history.map((block) => block.id));
|
|
99
|
+
this.blocks = [...history, ...this.blocks.filter((block) => !ids.has(block.id))];
|
|
100
|
+
}
|
|
101
|
+
accept(event) {
|
|
102
|
+
this.cursor++;
|
|
103
|
+
if (event.meta?.id !== void 0) {
|
|
104
|
+
if (this.seen.has(event.meta.id)) return;
|
|
105
|
+
this.seen.add(event.meta.id);
|
|
106
|
+
}
|
|
107
|
+
const { type, data } = event;
|
|
108
|
+
const coordinate = `${data.turnId}:${data.stepIndex}:${data.sequence}`;
|
|
109
|
+
if (type === "turn.started") {
|
|
110
|
+
this.turnId = string(data.turnId);
|
|
111
|
+
this.state = "running";
|
|
112
|
+
}
|
|
113
|
+
if (type === "message.received") {
|
|
114
|
+
const attachments = this.initialAttachments ?? receivedImages(data.parts);
|
|
115
|
+
const partsText = Array.isArray(data.parts) ? data.parts.filter((part) => record(part).type === "text").map((part) => string(record(part).text)).join("\n") : void 0;
|
|
116
|
+
this.put({
|
|
117
|
+
id: `user:${event.meta?.id ?? this.cursor}`,
|
|
118
|
+
kind: "user",
|
|
119
|
+
title: "You",
|
|
120
|
+
text: this.initialMessage ?? (attachments.length ? partsText ?? "" : string(data.message)),
|
|
121
|
+
...attachments.length ? { attachments: [...attachments] } : {}
|
|
122
|
+
});
|
|
123
|
+
this.initialMessage = void 0;
|
|
124
|
+
this.initialAttachments = void 0;
|
|
125
|
+
}
|
|
126
|
+
if (type === "message.appended" || type === "message.completed") this.put({
|
|
127
|
+
id: `message:${coordinate}`,
|
|
128
|
+
kind: "assistant",
|
|
129
|
+
title: "Assistant",
|
|
130
|
+
text: string(data.message)
|
|
131
|
+
});
|
|
132
|
+
if (type === "result.completed") this.put({
|
|
133
|
+
id: `result:${coordinate}`,
|
|
134
|
+
kind: "assistant",
|
|
135
|
+
title: "Result",
|
|
136
|
+
text: `\`\`\`json\n${string(data.result)}\n\`\`\``
|
|
137
|
+
});
|
|
138
|
+
if (type === "reasoning.appended" || type === "reasoning.completed") this.put({
|
|
139
|
+
id: `reasoning:${coordinate}`,
|
|
140
|
+
kind: "reasoning",
|
|
141
|
+
title: "Reasoning",
|
|
142
|
+
text: string(data.reasoning)
|
|
143
|
+
});
|
|
144
|
+
if (type === "actions.requested" && Array.isArray(data.actions)) for (const item of data.actions) {
|
|
145
|
+
const action = record(item);
|
|
146
|
+
const callId = string(action.callId);
|
|
147
|
+
const previous = this.tools.get(callId);
|
|
148
|
+
this.tool({
|
|
149
|
+
...previous,
|
|
150
|
+
callId,
|
|
151
|
+
input: action.input,
|
|
152
|
+
inputText: string(action.input),
|
|
153
|
+
name: string(action.toolName ?? action.name ?? action.kind),
|
|
154
|
+
state: previous?.state === "input-streaming" ? "running" : previous?.state ?? "running"
|
|
155
|
+
});
|
|
156
|
+
}
|
|
157
|
+
if (type === "action.input.appended") {
|
|
158
|
+
const id = string(data.callId);
|
|
159
|
+
const previous = this.tools.get(id);
|
|
160
|
+
const offset = data.inputTextOffset;
|
|
161
|
+
const delta = string(data.inputTextDelta);
|
|
162
|
+
if ((!previous || previous.state === "input-streaming") && (offset === 0 || offset === previous?.inputText.length)) {
|
|
163
|
+
const inputText = (offset === 0 ? "" : previous?.inputText ?? "") + delta;
|
|
164
|
+
this.tool({
|
|
165
|
+
callId: id,
|
|
166
|
+
input: parseInput(inputText),
|
|
167
|
+
inputText,
|
|
168
|
+
name: string(data.toolName),
|
|
169
|
+
state: "input-streaming"
|
|
170
|
+
});
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
if (type === "action.result" || type === "action.partial") {
|
|
174
|
+
const result = record(data.result);
|
|
175
|
+
const id = string(result.callId);
|
|
176
|
+
const previous = this.tools.get(id);
|
|
177
|
+
if (type !== "action.partial" || !previous || !settled(previous)) this.tool({
|
|
178
|
+
...previous,
|
|
179
|
+
callId: id,
|
|
180
|
+
input: previous?.input,
|
|
181
|
+
inputText: previous?.inputText ?? "",
|
|
182
|
+
name: previous?.name ?? string(result.toolName ?? result.kind),
|
|
183
|
+
output: "output" in result ? result.output : result,
|
|
184
|
+
error: data.error,
|
|
185
|
+
state: type === "action.partial" ? "running" : data.status === "rejected" ? "rejected" : data.status === "failed" || data.error != null ? "failed" : "completed"
|
|
186
|
+
});
|
|
187
|
+
}
|
|
188
|
+
if (type === "turn.cancelled" || type === "turn.failed" || type === "session.failed") {
|
|
189
|
+
for (const tool of this.tools.values()) if (!settled(tool)) this.tool({
|
|
190
|
+
...tool,
|
|
191
|
+
state: type === "turn.cancelled" ? "cancelled" : "failed",
|
|
192
|
+
error: data.message
|
|
193
|
+
});
|
|
194
|
+
}
|
|
195
|
+
if (type === "input.requested") {
|
|
196
|
+
for (const request of inputRequestSchema.array().parse(data.requests)) this.inputs.set(request.requestId, request);
|
|
197
|
+
this.state = "needs input";
|
|
198
|
+
}
|
|
199
|
+
if (type === "input.resolved" && Array.isArray(data.resolutions)) for (const resolution of data.resolutions) this.inputs.delete(string(record(resolution).requestId));
|
|
200
|
+
if (type === "step.completed") {
|
|
201
|
+
const usage = record(data.usage);
|
|
202
|
+
const total = (value) => typeof value === "number" ? value : Number(record(value).total ?? 0);
|
|
203
|
+
this.tokens += total(usage.inputTokens) + total(usage.outputTokens);
|
|
204
|
+
}
|
|
205
|
+
if (type === "session.waiting" || [
|
|
206
|
+
"turn.completed",
|
|
207
|
+
"turn.failed",
|
|
208
|
+
"turn.cancelled"
|
|
209
|
+
].includes(type) && (this.turnId === void 0 || data.turnId === this.turnId)) this.state = this.inputs.size > 0 ? "needs input" : "waiting";
|
|
210
|
+
if (["session.completed", "session.failed"].includes(type)) this.state = type.slice(8);
|
|
211
|
+
if (type.endsWith(".failed") || type === "turn.cancelled" || type.startsWith("compaction.") || type.startsWith("authorization.") || type.startsWith("subagent.")) this.put({
|
|
212
|
+
id: `event:${event.meta?.id ?? this.cursor}`,
|
|
213
|
+
kind: type.endsWith(".failed") ? "error" : "status",
|
|
214
|
+
title: type,
|
|
215
|
+
text: string(data.message ?? data.output ?? data.authorization ?? data.subagentName ?? data.name ?? "")
|
|
216
|
+
});
|
|
217
|
+
}
|
|
218
|
+
tool(tool) {
|
|
219
|
+
this.tools.set(tool.callId, tool);
|
|
220
|
+
const output = tool.error ?? tool.output;
|
|
221
|
+
this.put({
|
|
222
|
+
id: `tool:${tool.callId}`,
|
|
223
|
+
kind: "tool",
|
|
224
|
+
title: tool.name,
|
|
225
|
+
tool,
|
|
226
|
+
text: `Input\n\`\`\`json\n${tool.inputText}\n\`\`\`${output === void 0 ? "" : `\n\nOutput\n\`\`\`\n${string(output)}\n\`\`\``}`
|
|
227
|
+
});
|
|
228
|
+
}
|
|
229
|
+
};
|
|
230
|
+
//#endregion
|
|
231
|
+
export { Transcript };
|
|
232
|
+
|
|
233
|
+
//# sourceMappingURL=client-transcript.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client-transcript.mjs","names":[],"sources":["../src/client-transcript.ts"],"sourcesContent":["import { receivedImages, type ImageAttachment } from \"./image-input\";\nimport type { StreamEvent } from \"./client-events\";\nimport {\n inputRequestSchema,\n transcriptSnapshotSchema,\n type InputRequest,\n type ToolCall,\n type TranscriptBlock,\n type TranscriptSnapshot,\n} from \"./schema/transcript\";\n\nexport type {\n InputRequest,\n ToolCall,\n TranscriptBlock,\n TranscriptSnapshot,\n} from \"./schema/transcript\";\n\nfunction record(value: unknown): Record<string, unknown> {\n return typeof value === \"object\" && value !== null && !Array.isArray(value)\n ? (value as Record<string, unknown>)\n : {};\n}\nfunction string(value: unknown): string {\n return typeof value === \"string\" ? value : (JSON.stringify(value, null, 2) ?? \"\");\n}\nfunction parseInput(text: string): unknown {\n try {\n return JSON.parse(text);\n } catch {\n return undefined;\n }\n}\nfunction settled(tool: ToolCall) {\n return [\"completed\", \"failed\", \"cancelled\", \"rejected\"].includes(tool.state);\n}\n\n/** Mutable client-side projection of snapshot and live Factory transcript events. */\nexport class Transcript {\n blocks: TranscriptBlock[] = [];\n inputs = new Map<string, InputRequest>();\n cursor = 0;\n state = \"connecting\";\n turnId?: string;\n tokens = 0;\n private seen = new Set<string>();\n private tools = new Map<string, ToolCall>();\n constructor(\n private initialMessage?: string,\n private initialAttachments?: readonly ImageAttachment[],\n ) {}\n\n snapshot(): TranscriptSnapshot {\n return transcriptSnapshotSchema.parse({\n blocks: this.blocks,\n inputs: [...this.inputs.values()],\n cursor: this.cursor,\n state: this.state,\n turnId: this.turnId,\n tokens: this.tokens,\n });\n }\n\n hydrate(value: TranscriptSnapshot): void {\n const snapshot = transcriptSnapshotSchema.parse(value);\n this.blocks = snapshot.blocks.map((block) => ({ ...block }));\n const firstUser = this.blocks.find(\n (block): block is Extract<TranscriptBlock, { kind: \"user\" }> => block.kind === \"user\",\n );\n if (\n firstUser !== undefined &&\n (this.initialMessage !== undefined || this.initialAttachments !== undefined)\n ) {\n const text = this.initialMessage ?? firstUser.text;\n const attachments = this.initialAttachments ?? firstUser.attachments;\n const firstUserIndex = this.blocks.indexOf(firstUser);\n if (attachments?.length) {\n this.blocks[firstUserIndex] = { ...firstUser, text, attachments: [...attachments] };\n } else {\n const { attachments: _attachments, ...withoutAttachments } = firstUser;\n this.blocks[firstUserIndex] = { ...withoutAttachments, text };\n }\n }\n this.inputs = new Map(snapshot.inputs.map((request) => [request.requestId, request]));\n this.cursor = snapshot.cursor;\n this.state = snapshot.state;\n this.turnId = snapshot.turnId;\n this.tokens = snapshot.tokens;\n this.seen.clear();\n this.tools = new Map(\n this.blocks.flatMap((block) =>\n block.tool ? [[block.tool.callId, block.tool] as const] : [],\n ),\n );\n this.initialMessage = undefined;\n this.initialAttachments = undefined;\n }\n\n put(block: TranscriptBlock) {\n const index = this.blocks.findIndex((item) => item.id === block.id);\n if (index < 0) this.blocks.push(block);\n else this.blocks[index] = block;\n }\n\n appendHistory(id: string, transcript: Transcript) {\n for (const block of transcript.blocks) this.put({ ...block, id: `history:${id}:${block.id}` });\n }\n\n prependHistory(entries: readonly { id: string; transcript: Transcript }[]) {\n const history = entries.flatMap(({ id, transcript }) =>\n transcript.blocks.map((block) => ({ ...block, id: `history:${id}:${block.id}` })),\n );\n const ids = new Set(history.map((block) => block.id));\n this.blocks = [...history, ...this.blocks.filter((block) => !ids.has(block.id))];\n }\n\n accept(event: StreamEvent) {\n this.cursor++;\n if (event.meta?.id !== undefined) {\n if (this.seen.has(event.meta.id)) return;\n this.seen.add(event.meta.id);\n }\n const { type, data } = event;\n const coordinate = `${data.turnId}:${data.stepIndex}:${data.sequence}`;\n if (type === \"turn.started\") {\n this.turnId = string(data.turnId);\n this.state = \"running\";\n }\n if (type === \"message.received\") {\n const attachments = this.initialAttachments ?? receivedImages(data.parts);\n const partsText = Array.isArray(data.parts)\n ? data.parts\n .filter((part) => record(part).type === \"text\")\n .map((part) => string(record(part).text))\n .join(\"\\n\")\n : undefined;\n this.put({\n id: `user:${event.meta?.id ?? this.cursor}`,\n kind: \"user\",\n title: \"You\",\n text:\n this.initialMessage ?? (attachments.length ? (partsText ?? \"\") : string(data.message)),\n ...(attachments.length ? { attachments: [...attachments] } : {}),\n });\n this.initialMessage = undefined;\n this.initialAttachments = undefined;\n }\n if (type === \"message.appended\" || type === \"message.completed\")\n this.put({\n id: `message:${coordinate}`,\n kind: \"assistant\",\n title: \"Assistant\",\n text: string(data.message),\n });\n if (type === \"result.completed\")\n this.put({\n id: `result:${coordinate}`,\n kind: \"assistant\",\n title: \"Result\",\n text: `\\`\\`\\`json\\n${string(data.result)}\\n\\`\\`\\``,\n });\n if (type === \"reasoning.appended\" || type === \"reasoning.completed\")\n this.put({\n id: `reasoning:${coordinate}`,\n kind: \"reasoning\",\n title: \"Reasoning\",\n text: string(data.reasoning),\n });\n if (type === \"actions.requested\" && Array.isArray(data.actions))\n for (const item of data.actions) {\n const action = record(item);\n const callId = string(action.callId);\n const previous = this.tools.get(callId);\n this.tool({\n ...previous,\n callId,\n input: action.input,\n inputText: string(action.input),\n name: string(action.toolName ?? action.name ?? action.kind),\n state: previous?.state === \"input-streaming\" ? \"running\" : (previous?.state ?? \"running\"),\n });\n }\n if (type === \"action.input.appended\") {\n const id = string(data.callId);\n const previous = this.tools.get(id);\n const offset = data.inputTextOffset;\n const delta = string(data.inputTextDelta);\n if (\n (!previous || previous.state === \"input-streaming\") &&\n (offset === 0 || offset === previous?.inputText.length)\n ) {\n const inputText = (offset === 0 ? \"\" : (previous?.inputText ?? \"\")) + delta;\n this.tool({\n callId: id,\n input: parseInput(inputText),\n inputText,\n name: string(data.toolName),\n state: \"input-streaming\",\n });\n }\n }\n if (type === \"action.result\" || type === \"action.partial\") {\n const result = record(data.result);\n const id = string(result.callId);\n const previous = this.tools.get(id);\n if (type !== \"action.partial\" || !previous || !settled(previous))\n this.tool({\n ...previous,\n callId: id,\n input: previous?.input,\n inputText: previous?.inputText ?? \"\",\n name: previous?.name ?? string(result.toolName ?? result.kind),\n output: \"output\" in result ? result.output : result,\n error: data.error,\n state:\n type === \"action.partial\"\n ? \"running\"\n : data.status === \"rejected\"\n ? \"rejected\"\n : data.status === \"failed\" || data.error != null\n ? \"failed\"\n : \"completed\",\n });\n }\n if (type === \"turn.cancelled\" || type === \"turn.failed\" || type === \"session.failed\")\n for (const tool of this.tools.values()) {\n if (!settled(tool))\n this.tool({\n ...tool,\n state: type === \"turn.cancelled\" ? \"cancelled\" : \"failed\",\n error: data.message,\n });\n }\n if (type === \"input.requested\") {\n for (const request of inputRequestSchema.array().parse(data.requests))\n this.inputs.set(request.requestId, request);\n this.state = \"needs input\";\n }\n if (type === \"input.resolved\" && Array.isArray(data.resolutions))\n for (const resolution of data.resolutions)\n this.inputs.delete(string(record(resolution).requestId));\n if (type === \"step.completed\") {\n const usage = record(data.usage);\n const total = (value: unknown) =>\n typeof value === \"number\" ? value : Number(record(value).total ?? 0);\n this.tokens += total(usage.inputTokens) + total(usage.outputTokens);\n }\n if (\n type === \"session.waiting\" ||\n ([\"turn.completed\", \"turn.failed\", \"turn.cancelled\"].includes(type) &&\n (this.turnId === undefined || data.turnId === this.turnId))\n )\n this.state = this.inputs.size > 0 ? \"needs input\" : \"waiting\";\n if ([\"session.completed\", \"session.failed\"].includes(type)) this.state = type.slice(8);\n if (\n type.endsWith(\".failed\") ||\n type === \"turn.cancelled\" ||\n type.startsWith(\"compaction.\") ||\n type.startsWith(\"authorization.\") ||\n type.startsWith(\"subagent.\")\n ) {\n this.put({\n id: `event:${event.meta?.id ?? this.cursor}`,\n kind: type.endsWith(\".failed\") ? \"error\" : \"status\",\n title: type,\n text: string(\n data.message ?? data.output ?? data.authorization ?? data.subagentName ?? data.name ?? \"\",\n ),\n });\n }\n }\n\n private tool(tool: ToolCall) {\n this.tools.set(tool.callId, tool);\n const output = tool.error ?? tool.output;\n this.put({\n id: `tool:${tool.callId}`,\n kind: \"tool\",\n title: tool.name,\n tool,\n text: `Input\\n\\`\\`\\`json\\n${tool.inputText}\\n\\`\\`\\`${output === undefined ? \"\" : `\\n\\nOutput\\n\\`\\`\\`\\n${string(output)}\\n\\`\\`\\``}`,\n });\n }\n}\n"],"mappings":";;;AAkBA,SAAS,OAAO,OAAyC;CACvD,OAAO,OAAO,UAAU,YAAY,UAAU,QAAQ,CAAC,MAAM,QAAQ,KAAK,IACrE,QACD,CAAC;AACP;AACA,SAAS,OAAO,OAAwB;CACtC,OAAO,OAAO,UAAU,WAAW,QAAS,KAAK,UAAU,OAAO,MAAM,CAAC,KAAK;AAChF;AACA,SAAS,WAAW,MAAuB;CACzC,IAAI;EACF,OAAO,KAAK,MAAM,IAAI;CACxB,QAAQ;EACN;CACF;AACF;AACA,SAAS,QAAQ,MAAgB;CAC/B,OAAO;EAAC;EAAa;EAAU;EAAa;CAAU,CAAC,CAAC,SAAS,KAAK,KAAK;AAC7E;;AAGA,IAAa,aAAb,MAAwB;CAUZ;CACA;CAVV,SAA4B,CAAC;CAC7B,yBAAS,IAAI,IAA0B;CACvC,SAAS;CACT,QAAQ;CACR;CACA,SAAS;CACT,uBAAe,IAAI,IAAY;CAC/B,wBAAgB,IAAI,IAAsB;CAC1C,YACE,gBACA,oBACA;EAFQ,KAAA,iBAAA;EACA,KAAA,qBAAA;CACP;CAEH,WAA+B;EAC7B,OAAO,yBAAyB,M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|
@@ -0,0 +1,343 @@
|
|
|
1
|
+
import { InboxActivity, InboxActivityItem, inboxActivityItemSchema, inboxActivitySchema } from "./inbox-activity.mjs";
|
|
2
|
+
import { AgentModelConfig, ModelSettings, UpdateModelDefaults, agentModelConfigSchema, modelSettingsSchema, updateModelDefaultsSchema } from "./model-settings.mjs";
|
|
3
|
+
import { SessionPreview, SessionPreviews, sessionPreviewSchema, sessionPreviewsSchema } from "./session-previews.mjs";
|
|
4
|
+
import { SessionReview, SessionReviewCheck, SessionReviewIssue, SessionReviewScreenshot, sessionReviewCheckSchema, sessionReviewIssueSchema, sessionReviewSchema, sessionReviewScreenshotSchema } from "./session-review.mjs";
|
|
5
|
+
import { WorkspaceFileEntry, WorkspaceFiles, WorkspaceFilesRequest, workspaceFileContentSchema, workspaceFileEntrySchema, workspaceFilesRequestSchema, workspaceFilesSchema, workspacePathSchema } from "./workspace-files.mjs";
|
|
6
|
+
import { SignalSource } from "./schema/signal.mjs";
|
|
7
|
+
import { RepositoryId, TaskId } from "./schema/id.mjs";
|
|
8
|
+
import { RepositorySlug } from "./schema/repository.mjs";
|
|
9
|
+
import { Task } from "./schema/task.mjs";
|
|
10
|
+
import { MaybePromise } from "./schema/common.mjs";
|
|
11
|
+
import { ImageAttachment, ImageId, ImageUploadInput, MAX_IMAGES, MAX_IMAGE_BYTES, imageAttachmentSchema, imageAttachmentsSchema, imageIdSchema } from "./image-input.mjs";
|
|
12
|
+
import { AgentSession, AgentSessionId, DirectAgentSession, ExternalAgentSession, TaskAgentSession, agentSessionIdSchema, agentSessionSchema } from "./schema/session.mjs";
|
|
13
|
+
import { Change } from "./schema/change.mjs";
|
|
14
|
+
import { InputRequest, ToolCall, TranscriptBlock, TranscriptSnapshot, inputRequestSchema, toolCallSchema, transcriptBlockSchema, transcriptSnapshotSchema } from "./schema/transcript.mjs";
|
|
15
|
+
import { ApprovalListOptions, ApprovalPage, ApprovalView } from "./approval-contracts.mjs";
|
|
16
|
+
import { WorkspaceDiff, WorkspaceDiffFile, workspaceDiffFileSchema, workspaceDiffSchema } from "./workspace-diff.mjs";
|
|
17
|
+
import { IntakeView, describeIntake } from "./intake-contracts.mjs";
|
|
18
|
+
import { TaskGraphView } from "./task-graph-view.mjs";
|
|
19
|
+
import { StreamEvent, readEvents, streamEventSchema } from "./client-events.mjs";
|
|
20
|
+
import { Transcript } from "./client-transcript.mjs";
|
|
21
|
+
import { FollowSessionStreamOptions, SessionStreamClient, followSessionStream } from "./client-stream.mjs";
|
|
22
|
+
import { AnswerSessionQuestionRequest, ApiAgent, ControlSessionRequest, CreateSessionRequest, PendingFollowUp, RepositoryDetails, RepositorySummary, SendSessionMessageRequest, SessionInputResponse, SessionPage, SessionView, SubmitSessionInputRequest, answerSessionQuestionRequestSchema, apiAgentSchema, controlSessionRequestSchema, createSessionRequestSchema, pendingFollowUpSchema, repositoryDetailsSchema, repositorySummarySchema, sendSessionMessageRequestSchema, sessionInputResponseSchema, sessionPageSchema, sessionViewSchema, submitSessionInputRequestSchema } from "./api-contracts.mjs";
|
|
23
|
+
//#region src/client.d.ts
|
|
24
|
+
/** All durable Task states in their schema-defined order. */
|
|
25
|
+
declare const taskStates: readonly ("queued" | "running" | "stalled" | "verifying" | "succeeded" | "failed" | "needs_human" | "cancelled")[];
|
|
26
|
+
/** Filters and pagination accepted by the session-list API. */
|
|
27
|
+
interface SessionListOptions {
|
|
28
|
+
readonly scope?: "all" | "interactive";
|
|
29
|
+
readonly detail?: "full" | "summary";
|
|
30
|
+
readonly limit?: number;
|
|
31
|
+
readonly cursor?: string;
|
|
32
|
+
readonly query?: string;
|
|
33
|
+
readonly repository?: RepositorySlug;
|
|
34
|
+
readonly agent?: string;
|
|
35
|
+
readonly source?: "automatic";
|
|
36
|
+
readonly state?: Task["state"] | "conversation";
|
|
37
|
+
readonly attention?: boolean;
|
|
38
|
+
readonly topLevel?: boolean;
|
|
39
|
+
readonly includeTotal?: boolean;
|
|
40
|
+
}
|
|
41
|
+
/** An unsuccessful Factory API response surfaced by the browser-safe client. */
|
|
42
|
+
declare class ApiError extends Error {
|
|
43
|
+
readonly status: number;
|
|
44
|
+
readonly actor?: string | undefined;
|
|
45
|
+
constructor(status: number, message: string, actor?: string | undefined);
|
|
46
|
+
}
|
|
47
|
+
/** Connection and request customization for {@link FactoryClient}. */
|
|
48
|
+
interface FactoryClientOptions {
|
|
49
|
+
/**
|
|
50
|
+
* Canonical Factory origin. It must be HTTPS, except for HTTP loopback development, and cannot
|
|
51
|
+
* contain credentials, a path, query parameters, or a fragment.
|
|
52
|
+
*/
|
|
53
|
+
readonly url: string;
|
|
54
|
+
/**
|
|
55
|
+
* Headers resolved immediately before every request, allowing short-lived authentication to be
|
|
56
|
+
* refreshed. Factory always sets `content-type` to `application/json` afterward.
|
|
57
|
+
*/
|
|
58
|
+
readonly headers?: () => MaybePromise<HeadersInit>;
|
|
59
|
+
/** Fetch implementation used for every request; defaults to `globalThis.fetch`. */
|
|
60
|
+
readonly fetch?: typeof globalThis.fetch;
|
|
61
|
+
}
|
|
62
|
+
/** Identifies an uploaded image and optionally controls cancellation of its download. */
|
|
63
|
+
interface GetImageOptions {
|
|
64
|
+
readonly id: ImageId;
|
|
65
|
+
readonly signal?: AbortSignal;
|
|
66
|
+
}
|
|
67
|
+
/** Identifies an operator session and the amount of detail to return. */
|
|
68
|
+
interface GetSessionOptions {
|
|
69
|
+
readonly id: AgentSessionId;
|
|
70
|
+
readonly detail?: "full" | "summary";
|
|
71
|
+
}
|
|
72
|
+
/** Selects the observed execution whose review evidence should be read. */
|
|
73
|
+
interface SessionReviewOptions {
|
|
74
|
+
readonly sessionId: AgentSessionId;
|
|
75
|
+
readonly executionId: string | null;
|
|
76
|
+
readonly signal?: AbortSignal;
|
|
77
|
+
}
|
|
78
|
+
/** Selects the observed execution whose preview links and instructions should be read. */
|
|
79
|
+
interface SessionPreviewsOptions {
|
|
80
|
+
readonly sessionId: AgentSessionId;
|
|
81
|
+
readonly executionId: string | null;
|
|
82
|
+
readonly signal?: AbortSignal;
|
|
83
|
+
}
|
|
84
|
+
/** Identifies the operator session whose canonical task graph should be read. */
|
|
85
|
+
interface GetSessionGraphOptions {
|
|
86
|
+
readonly id: AgentSessionId;
|
|
87
|
+
readonly signal?: AbortSignal;
|
|
88
|
+
}
|
|
89
|
+
/** Identifies an exact task execution transcript within an operator session. */
|
|
90
|
+
interface GraphTranscriptOptions {
|
|
91
|
+
readonly sessionId: AgentSessionId;
|
|
92
|
+
readonly taskId: TaskId;
|
|
93
|
+
readonly executionId: string;
|
|
94
|
+
readonly signal?: AbortSignal;
|
|
95
|
+
}
|
|
96
|
+
/** Identifies a file or directory at an observed execution and optional immutable revision. */
|
|
97
|
+
interface WorkspaceFilesOptions extends WorkspaceFilesRequest {
|
|
98
|
+
readonly sessionId: AgentSessionId;
|
|
99
|
+
readonly executionId: string | null;
|
|
100
|
+
readonly signal?: AbortSignal;
|
|
101
|
+
}
|
|
102
|
+
/** Identifies the execution whose committed workspace should be compared. */
|
|
103
|
+
interface WorkspaceDiffOptions {
|
|
104
|
+
readonly sessionId: AgentSessionId;
|
|
105
|
+
readonly executionId: string | null;
|
|
106
|
+
readonly signal?: AbortSignal;
|
|
107
|
+
}
|
|
108
|
+
/** Identifies a materialized transcript response used by the stream follower. */
|
|
109
|
+
interface SessionTranscriptRequest {
|
|
110
|
+
readonly sessionId: AgentSessionId;
|
|
111
|
+
readonly executionId: string;
|
|
112
|
+
readonly taskId?: TaskId;
|
|
113
|
+
readonly history?: boolean;
|
|
114
|
+
readonly signal: AbortSignal;
|
|
115
|
+
}
|
|
116
|
+
/** Identifies a cursor-addressed event stream used by the stream follower. */
|
|
117
|
+
interface SessionEventStreamRequest {
|
|
118
|
+
readonly sessionId: AgentSessionId;
|
|
119
|
+
readonly executionId: string;
|
|
120
|
+
readonly cursor: number;
|
|
121
|
+
readonly taskId?: TaskId;
|
|
122
|
+
readonly signal: AbortSignal;
|
|
123
|
+
}
|
|
124
|
+
/**
|
|
125
|
+
* Browser-safe typed client for the public Factory HTTP API.
|
|
126
|
+
*
|
|
127
|
+
* @remarks
|
|
128
|
+
* Requests use same-origin credentials, bypass HTTP caches, and refuse redirects so authentication
|
|
129
|
+
* redirects cannot be mistaken for API responses. When no caller signal is available, requests
|
|
130
|
+
* time out after 30 seconds. Non-success responses throw {@link ApiError}; successful JSON bodies
|
|
131
|
+
* are still validated against their public schemas before being returned.
|
|
132
|
+
*/
|
|
133
|
+
declare class FactoryClient {
|
|
134
|
+
private readonly options;
|
|
135
|
+
private readonly origin;
|
|
136
|
+
/**
|
|
137
|
+
* Creates a client for one canonical Factory origin without performing a request.
|
|
138
|
+
*
|
|
139
|
+
* @param options - Factory origin plus optional per-request headers and fetch implementation.
|
|
140
|
+
* @throws When `options.url` is not an HTTPS origin or an HTTP loopback origin.
|
|
141
|
+
*/
|
|
142
|
+
constructor(options: FactoryClientOptions);
|
|
143
|
+
private response;
|
|
144
|
+
/** Read authorized intake and pre-task triage failures. */
|
|
145
|
+
intake(options?: {
|
|
146
|
+
repository?: string;
|
|
147
|
+
cursor?: string;
|
|
148
|
+
limit?: number;
|
|
149
|
+
}): Promise<{
|
|
150
|
+
items: {
|
|
151
|
+
id: `sig_${string}`;
|
|
152
|
+
schemaVersion: 1;
|
|
153
|
+
repositoryId: `repo_${string}`;
|
|
154
|
+
source: SignalSource;
|
|
155
|
+
deliveryId: string;
|
|
156
|
+
replyTo: {
|
|
157
|
+
channel: string;
|
|
158
|
+
address: string;
|
|
159
|
+
};
|
|
160
|
+
receivedAt: string;
|
|
161
|
+
outcome: "pending" | "accepted" | "duplicate" | "unactionable" | "low_confidence" | "ignored";
|
|
162
|
+
repository: string;
|
|
163
|
+
taskIds: `task_${string}`[];
|
|
164
|
+
triage?: {
|
|
165
|
+
attempt: number;
|
|
166
|
+
state: "running" | "blocked" | "uncertain";
|
|
167
|
+
by: string;
|
|
168
|
+
startedAt: string;
|
|
169
|
+
updatedAt: string;
|
|
170
|
+
sessionId?: string | undefined;
|
|
171
|
+
failure?: "cancelled" | "billing_verification_required" | "provider_failed" | "no_decision" | "launch_unconfirmed" | undefined;
|
|
172
|
+
} | undefined;
|
|
173
|
+
detail?: string | undefined;
|
|
174
|
+
reason?: string | undefined;
|
|
175
|
+
decidedAt?: string | undefined;
|
|
176
|
+
}[];
|
|
177
|
+
nextCursor: string | null;
|
|
178
|
+
}>;
|
|
179
|
+
/** Retry only the observed stopped attempt; concurrent or stale retries conflict. */
|
|
180
|
+
retryIntake(id: string, expectedAttempt: number): Promise<{
|
|
181
|
+
id: `sig_${string}`;
|
|
182
|
+
schemaVersion: 1;
|
|
183
|
+
repositoryId: `repo_${string}`;
|
|
184
|
+
source: SignalSource;
|
|
185
|
+
deliveryId: string;
|
|
186
|
+
replyTo: {
|
|
187
|
+
channel: string;
|
|
188
|
+
address: string;
|
|
189
|
+
};
|
|
190
|
+
receivedAt: string;
|
|
191
|
+
outcome: "pending" | "accepted" | "duplicate" | "unactionable" | "low_confidence" | "ignored";
|
|
192
|
+
repository: string;
|
|
193
|
+
taskIds: `task_${string}`[];
|
|
194
|
+
triage?: {
|
|
195
|
+
attempt: number;
|
|
196
|
+
state: "running" | "blocked" | "uncertain";
|
|
197
|
+
by: string;
|
|
198
|
+
startedAt: string;
|
|
199
|
+
updatedAt: string;
|
|
200
|
+
sessionId?: string | undefined;
|
|
201
|
+
failure?: "cancelled" | "billing_verification_required" | "provider_failed" | "no_decision" | "launch_unconfirmed" | undefined;
|
|
202
|
+
} | undefined;
|
|
203
|
+
detail?: string | undefined;
|
|
204
|
+
reason?: string | undefined;
|
|
205
|
+
decidedAt?: string | undefined;
|
|
206
|
+
}>;
|
|
207
|
+
/** Lists approval proposals visible to the authenticated operator. */
|
|
208
|
+
listApprovals(options?: ApprovalListOptions): Promise<ApprovalPage>;
|
|
209
|
+
/** Reads one approval proposal by Task ID. */
|
|
210
|
+
getApproval(id: TaskId): Promise<ApprovalView>;
|
|
211
|
+
/** Approves one proposal, optionally recording an operator reason. */
|
|
212
|
+
approveTask(id: TaskId, reason?: string): Promise<ApprovalView>;
|
|
213
|
+
/** Rejects one proposal with the required operator reason. */
|
|
214
|
+
rejectTask(id: TaskId, reason: string): Promise<ApprovalView>;
|
|
215
|
+
/** Uploads one bounded image for use in a later message. */
|
|
216
|
+
uploadImage(input: ImageUploadInput): Promise<ImageAttachment>;
|
|
217
|
+
/** Downloads a previously uploaded image. */
|
|
218
|
+
getImage(options: GetImageOptions): Promise<Blob>;
|
|
219
|
+
/** Lists agents exposed for operator session creation. */
|
|
220
|
+
listAgents(): Promise<readonly ApiAgent[]>;
|
|
221
|
+
/** Reports whether the configured origin is the isolated local fixture runtime. */
|
|
222
|
+
isLocalTestRuntime(): Promise<boolean>;
|
|
223
|
+
/** Lists configured repository slugs. */
|
|
224
|
+
listRepositories(): Promise<readonly RepositorySlug[]>;
|
|
225
|
+
/** Reads repository slugs together with their stable configured identifiers. */
|
|
226
|
+
getRepositoryDetails(): Promise<RepositoryDetails>;
|
|
227
|
+
/** Lists open Changes, optionally scoped to one repository slug. */
|
|
228
|
+
listChanges(repository?: RepositorySlug): Promise<readonly Change[]>;
|
|
229
|
+
/** Lists canonical Tasks exposed by the operator API. */
|
|
230
|
+
listTasks(): Promise<readonly Task[]>;
|
|
231
|
+
/**
|
|
232
|
+
* Lists sessions matching the requested operator scope without pagination metadata.
|
|
233
|
+
*
|
|
234
|
+
* @param options - Optional scope and detail projection; both use their server defaults when omitted.
|
|
235
|
+
* @returns The first matching page's sessions. Use {@link getSessionPage} to follow cursors.
|
|
236
|
+
*/
|
|
237
|
+
listSessions(options?: Pick<SessionListOptions, "scope" | "detail">): Promise<readonly SessionView[]>;
|
|
238
|
+
/**
|
|
239
|
+
* Reads a filtered, cursor-paginated page of sessions.
|
|
240
|
+
*
|
|
241
|
+
* @param options - Filters, cursor, projection detail, and page limit sent to the API.
|
|
242
|
+
* @returns The validated page, including its continuation cursor and optional total count.
|
|
243
|
+
*/
|
|
244
|
+
getSessionPage(options?: SessionListOptions): Promise<SessionPage>;
|
|
245
|
+
/** Reads application-owned external work requiring operator attention. */
|
|
246
|
+
getInboxActivity(): Promise<InboxActivity>;
|
|
247
|
+
/** Reads application model choices and optional repository defaults. */
|
|
248
|
+
getModelSettings(repository?: RepositorySlug): Promise<ModelSettings>;
|
|
249
|
+
/** Saves repository defaults only when their observed revision still matches. */
|
|
250
|
+
updateModelDefaults(input: UpdateModelDefaults): Promise<ModelSettings>;
|
|
251
|
+
/** Counts sessions that currently require operator attention. */
|
|
252
|
+
getInboxCount(): Promise<number>;
|
|
253
|
+
/** Reads a summary batch for the provided session IDs. */
|
|
254
|
+
getSessionBatch(ids: readonly AgentSessionId[]): Promise<readonly SessionView[]>;
|
|
255
|
+
/**
|
|
256
|
+
* Reads one operator session.
|
|
257
|
+
*
|
|
258
|
+
* @param options - Stable session ID and optional summary or full projection.
|
|
259
|
+
* @returns The current validated session view; it is a snapshot and does not follow live events.
|
|
260
|
+
*/
|
|
261
|
+
getSession(options: GetSessionOptions): Promise<SessionView>;
|
|
262
|
+
/** Reads the canonical task graph projected for one session. */
|
|
263
|
+
getSessionGraph(options: GetSessionGraphOptions): Promise<TaskGraphView>;
|
|
264
|
+
/** Reads the materialized transcript for one exact graph task execution. */
|
|
265
|
+
getGraphTranscript(options: GraphTranscriptOptions): Promise<TranscriptSnapshot>;
|
|
266
|
+
/** Refreshes a session summary and reloads its history when the active execution changes. */
|
|
267
|
+
refreshSession(previous: SessionView): Promise<SessionView>;
|
|
268
|
+
/** Reads application-owned previews without starting an agent, deployment, or server. */
|
|
269
|
+
getSessionPreviews(options: SessionPreviewsOptions): Promise<SessionPreviews>;
|
|
270
|
+
/** Reads recorded checks, screenshots, and issues through the application's review reader. */
|
|
271
|
+
getSessionReview(options: SessionReviewOptions): Promise<SessionReview>;
|
|
272
|
+
/** Reads a directory or complete file through the factory's configured workspace adapter. */
|
|
273
|
+
getWorkspaceFiles(options: WorkspaceFilesOptions): Promise<WorkspaceFiles>;
|
|
274
|
+
/** Reads the committed workspace comparison for one observed execution. */
|
|
275
|
+
getWorkspaceDiff(options: WorkspaceDiffOptions): Promise<WorkspaceDiff>;
|
|
276
|
+
/**
|
|
277
|
+
* Creates or recovers an idempotent conversational session.
|
|
278
|
+
*
|
|
279
|
+
* @remarks
|
|
280
|
+
* Retain `input.operationId` unchanged across ambiguous failures. Reusing it with identical input
|
|
281
|
+
* returns the original session; reusing it with different input is a conflict. The returned view
|
|
282
|
+
* means admission and any initial dispatch attempt finished, not that the agent's work completed.
|
|
283
|
+
*
|
|
284
|
+
* @param input - Agent, initial content, optional repository/change, and client idempotency key.
|
|
285
|
+
* @returns The admitted or recovered session snapshot.
|
|
286
|
+
*/
|
|
287
|
+
createSession(input: CreateSessionRequest): Promise<SessionView>;
|
|
288
|
+
/** Creates or recovers idempotent workflow work through a specialist signal. */
|
|
289
|
+
createSignal(input: CreateSessionRequest): Promise<SessionView>;
|
|
290
|
+
/** Starts a deepsec security scan of a repository, or returns its already-active scan. */
|
|
291
|
+
runSecurityScan(repositoryId: RepositoryId): Promise<{
|
|
292
|
+
taskId: TaskId;
|
|
293
|
+
reused: boolean;
|
|
294
|
+
}>;
|
|
295
|
+
/**
|
|
296
|
+
* Sends a message to an existing session using optimistic execution matching.
|
|
297
|
+
*
|
|
298
|
+
* @remarks
|
|
299
|
+
* `input.executionId` must be the execution the caller observed, or `null` when none was active.
|
|
300
|
+
* A completed Task follow-up also requires an `operationId`, which must be retained for retries.
|
|
301
|
+
* Resolving means the API accepted the message; provider or follow-up work may still be running.
|
|
302
|
+
*
|
|
303
|
+
* @param id - Stable Factory session receiving the message.
|
|
304
|
+
* @param input - Message, observed execution, steering policy, attachments, and optional retry key.
|
|
305
|
+
* @returns Nothing after the API accepts the request.
|
|
306
|
+
*/
|
|
307
|
+
sendSessionMessage(id: AgentSessionId, input: SendSessionMessageRequest): Promise<void>;
|
|
308
|
+
/**
|
|
309
|
+
* Submits responses to pending provider input requests.
|
|
310
|
+
*
|
|
311
|
+
* @param id - Stable Factory session whose provider requested input.
|
|
312
|
+
* @param input - Observed execution ID and one or more request-correlated responses.
|
|
313
|
+
* @returns Nothing after the API accepts the responses; stale execution IDs are rejected.
|
|
314
|
+
*/
|
|
315
|
+
submitSessionInput(id: AgentSessionId, input: SubmitSessionInputRequest): Promise<void>;
|
|
316
|
+
/**
|
|
317
|
+
* Attempts to dispatch queued workflow work associated with a session.
|
|
318
|
+
*
|
|
319
|
+
* @param id - Stable Factory session whose current work should be dispatched.
|
|
320
|
+
* @returns The refreshed session after the bounded dispatch attempt, which may still be queued.
|
|
321
|
+
*/
|
|
322
|
+
dispatchSession(id: AgentSessionId): Promise<SessionView>;
|
|
323
|
+
/** Answers a workflow question associated with a session. */
|
|
324
|
+
answerSessionQuestion(id: AgentSessionId, input: AnswerSessionQuestionRequest): Promise<SessionView>;
|
|
325
|
+
/** Cooperatively interrupts the currently observed turn. */
|
|
326
|
+
interruptSession(id: AgentSessionId, input?: ControlSessionRequest): Promise<void>;
|
|
327
|
+
/** Cancels active workflow and provider work in a session. */
|
|
328
|
+
cancelSession(id: AgentSessionId, input?: ControlSessionRequest): Promise<void>;
|
|
329
|
+
/** Compacts the provider context for a session. */
|
|
330
|
+
compactSession(id: AgentSessionId, input?: ControlSessionRequest): Promise<void>;
|
|
331
|
+
/** Clears the provider context for a session. */
|
|
332
|
+
clearSession(id: AgentSessionId, input?: ControlSessionRequest): Promise<void>;
|
|
333
|
+
/** Resets a session after cancelling its active work. */
|
|
334
|
+
resetSession(id: AgentSessionId, input?: ControlSessionRequest): Promise<void>;
|
|
335
|
+
/** Reads a materialized transcript as a raw HTTP response for incremental following. */
|
|
336
|
+
getSessionTranscriptResponse(input: SessionTranscriptRequest): Promise<Response>;
|
|
337
|
+
/** Opens a cursor-addressed session event stream as a raw HTTP response. */
|
|
338
|
+
getSessionEventStreamResponse(input: SessionEventStreamRequest): Promise<Response>;
|
|
339
|
+
private controlSession;
|
|
340
|
+
}
|
|
341
|
+
//#endregion
|
|
342
|
+
export { type AgentModelConfig, type AgentSession, type AgentSessionId, type AnswerSessionQuestionRequest, type ApiAgent, ApiError, type ApprovalListOptions, type ApprovalPage, type ApprovalView, type ControlSessionRequest, type CreateSessionRequest, type DirectAgentSession, type ExternalAgentSession, FactoryClient, FactoryClientOptions, type FollowSessionStreamOptions, GetImageOptions, GetSessionGraphOptions, GetSessionOptions, GraphTranscriptOptions, type ImageAttachment, type ImageId, type ImageUploadInput, type InboxActivity, type InboxActivityItem, type InputRequest, type IntakeView, MAX_IMAGES, MAX_IMAGE_BYTES, type ModelSettings, type PendingFollowUp, type RepositoryDetails, type RepositorySummary, type SendSessionMessageRequest, SessionEventStreamRequest, type SessionInputResponse, SessionListOptions, type SessionPage, type SessionPreview, type SessionPreviews, SessionPreviewsOptions, type SessionReview, type SessionReviewCheck, type SessionReviewIssue, SessionReviewOptions, type SessionReviewScreenshot, type SessionStreamClient, SessionTranscriptRequest, type SessionView, type StreamEvent, type SubmitSessionInputRequest, type TaskAgentSession, type TaskGraphView, type ToolCall, Transcript, type TranscriptBlock, type TranscriptSnapshot, type UpdateModelDefaults, type WorkspaceDiff, type WorkspaceDiffFile, WorkspaceDiffOptions, type WorkspaceFileEntry, type WorkspaceFiles, WorkspaceFilesOptions, type WorkspaceFilesRequest, agentModelConfigSchema, agentSessionIdSchema, agentSessionSchema, answerSessionQuestionRequestSchema, apiAgentSchema, controlSessionRequestSchema, createSessionRequestSchema, describeIntake, followSessionStream, imageAttachmentSchema, imageAttachmentsSchema, imageIdSchema, inboxActivityItemSchema, inboxActivitySchema, inputRequestSchema, modelSettingsSchema, pendingFollowUpSchema, readEvents, repositoryDetailsSchema, repositorySummarySchema, sendSessionMessageRequestSchema, sessionInputResponseSchema, sessionPageSchema, sessionPreviewSchema, sessionPreviewsSchema, sessionReviewCheckSchema, sessionReviewIssueSchema, sessionReviewSchema, sessionReviewScreenshotSchema, sessionViewSchema, streamEventSchema, submitSessionInputRequestSchema, taskStates, toolCallSchema, transcriptBlockSchema, transcriptSnapshotSchema, updateModelDefaultsSchema, workspaceDiffFileSchema, workspaceDiffSchema, workspaceFileContentSchema, workspaceFileEntrySchema, workspaceFilesRequestSchema, workspaceFilesSchema, workspacePathSchema };
|
|
343
|
+
//# sourceMappingURL=client.d.mts.map
|