@abot-ai/runtime 1.2.0 → 1.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +14 -0
- package/dist/src/bridge/request-steering.d.ts +2 -1
- package/dist/src/bridge/request-steering.js +4 -2
- package/dist/src/bridge/runtime-replay.js +2 -19
- package/dist/src/bridge/start-agent-bridge.js +1 -1
- package/dist/src/capabilities/normal-invocation/validator.js +1 -1
- package/dist/src/capabilities/tool-definition-validator/event-presentation.js +3 -0
- package/dist/src/capabilities/tool-definition-validator/event-result-metadata.d.ts +2 -0
- package/dist/src/capabilities/tool-definition-validator/event-result-metadata.js +74 -0
- package/dist/src/capabilities/tool-event-metadata.js +3 -0
- package/dist/src/capabilities/tool-result-event-projection.d.ts +3 -0
- package/dist/src/capabilities/tool-result-event-projection.js +82 -0
- package/dist/src/capabilities/tool-types.d.ts +5 -0
- package/dist/src/cli/abot.js +2 -11
- package/dist/src/runtime/adapters/in-memory-session-store.js +1 -0
- package/dist/src/runtime/adapters/long-term-memory/file-lock/acquisition.js +11 -2
- package/dist/src/runtime/adapters/long-term-memory/file-lock/contracts.d.ts +2 -0
- package/dist/src/runtime/adapters/long-term-memory/file-lock/synchronous-release.d.ts +2 -0
- package/dist/src/runtime/adapters/long-term-memory/file-lock/synchronous-release.js +40 -0
- package/dist/src/runtime/adapters/registered-tool-normal-invocations/execution/approval.d.ts +3 -0
- package/dist/src/runtime/adapters/registered-tool-normal-invocations/execution/approval.js +9 -0
- package/dist/src/runtime/adapters/registered-tool-normal-invocations/execution/rejection-event.d.ts +13 -0
- package/dist/src/runtime/adapters/registered-tool-normal-invocations/execution/rejection-event.js +25 -0
- package/dist/src/runtime/adapters/registered-tool-normal-invocations/execution/run.js +18 -2
- package/dist/src/runtime/adapters/registered-tool-normal-invocations/executor.js +8 -0
- package/dist/src/runtime/adapters/registered-tool-normal-invocations/payload/lifecycle.js +7 -3
- package/dist/src/runtime/adapters/registered-tool-normal-invocations/shared/contracts.d.ts +17 -2
- package/dist/src/runtime/adapters/registered-tool-normal-invocations/shared/event-metadata.d.ts +9 -0
- package/dist/src/runtime/adapters/registered-tool-normal-invocations/shared/event-metadata.js +8 -0
- package/dist/src/runtime/adapters/registered-tool-worker-capabilities/execution.js +16 -1
- package/dist/src/runtime/adapters/registered-tool-worker-capabilities/payload-observability.js +2 -2
- package/dist/src/runtime/adapters/scheduled-request-outcome.d.ts +11 -0
- package/dist/src/runtime/adapters/scheduled-request-outcome.js +41 -0
- package/dist/src/runtime/adapters/scheduler-runtime.d.ts +19 -0
- package/dist/src/runtime/adapters/scheduler-runtime.js +138 -0
- package/dist/src/runtime/capabilities/scheduling/create-operations.d.ts +55 -0
- package/dist/src/runtime/capabilities/scheduling/create-operations.js +30 -0
- package/dist/src/runtime/capabilities/scheduling/create-time-zone.d.ts +1 -0
- package/dist/src/runtime/capabilities/scheduling/create-time-zone.js +11 -0
- package/dist/src/runtime/capabilities/scheduling/job-list-page.d.ts +25 -0
- package/dist/src/runtime/capabilities/scheduling/job-list-page.js +40 -0
- package/dist/src/runtime/capabilities/scheduling/model-validation.d.ts +2 -0
- package/dist/src/runtime/capabilities/scheduling/model-validation.js +15 -0
- package/dist/src/runtime/capabilities/scheduling/tool-contract.d.ts +2 -0
- package/dist/src/runtime/capabilities/scheduling/tool-contract.js +35 -0
- package/dist/src/runtime/capabilities/scheduling/tool-input-properties.d.ts +43 -0
- package/dist/src/runtime/capabilities/scheduling/tool-input-properties.js +27 -0
- package/dist/src/runtime/capabilities/scheduling/tool-module.d.ts +4 -0
- package/dist/src/runtime/capabilities/scheduling/tool-module.js +158 -0
- package/dist/src/runtime/capabilities/scheduling/update-operations.d.ts +2 -0
- package/dist/src/runtime/capabilities/scheduling/update-operations.js +49 -0
- package/dist/src/runtime/composition.d.ts +23 -3
- package/dist/src/runtime/composition.js +12 -17
- package/dist/src/runtime/config/environment-paths.d.ts +10 -0
- package/dist/src/runtime/config/environment-paths.js +31 -0
- package/dist/src/runtime/config/environment-storage.d.ts +9 -0
- package/dist/src/runtime/config/environment-storage.js +65 -0
- package/dist/src/runtime/config/fields.js +7 -0
- package/dist/src/runtime/config/long-term-memory.js +15 -0
- package/dist/src/runtime/config/schema.js +8 -0
- package/dist/src/runtime/config.js +9 -5
- package/dist/src/runtime/context/scheduled-execution-context.d.ts +10 -0
- package/dist/src/runtime/context/scheduled-execution-context.js +52 -0
- package/dist/src/runtime/default-adapters.d.ts +3 -32
- package/dist/src/runtime/default-adapters.js +3 -270
- package/dist/src/runtime/default-environment-adapters.d.ts +19 -0
- package/dist/src/runtime/default-environment-adapters.js +144 -0
- package/dist/src/runtime/index.d.ts +5 -0
- package/dist/src/runtime/index.js +4 -0
- package/dist/src/runtime/local-application.d.ts +22 -0
- package/dist/src/runtime/local-application.js +81 -0
- package/dist/src/runtime/local-host/app-memory-dispatch.d.ts +11 -0
- package/dist/src/runtime/local-host/app-memory-dispatch.js +103 -0
- package/dist/src/runtime/local-host/app-owner.d.ts +4 -0
- package/dist/src/runtime/local-host/app-owner.js +119 -0
- package/dist/src/runtime/local-host/app-request-control.d.ts +24 -0
- package/dist/src/runtime/local-host/app-request-control.js +135 -0
- package/dist/src/runtime/local-host/app-service-dispatch.d.ts +5 -0
- package/dist/src/runtime/local-host/app-service-dispatch.js +64 -0
- package/dist/src/runtime/local-host/client-identity.d.ts +3 -0
- package/dist/src/runtime/local-host/client-identity.js +17 -0
- package/dist/src/runtime/local-host/client-memory.d.ts +7 -0
- package/dist/src/runtime/local-host/client-memory.js +54 -0
- package/dist/src/runtime/local-host/client-requests.d.ts +19 -0
- package/dist/src/runtime/local-host/client-requests.js +145 -0
- package/dist/src/runtime/local-host/client-services.d.ts +10 -0
- package/dist/src/runtime/local-host/client-services.js +14 -0
- package/dist/src/runtime/local-host/contracts.d.ts +36 -0
- package/dist/src/runtime/local-host/contracts.js +1 -0
- package/dist/src/runtime/local-host/endpoint.d.ts +7 -0
- package/dist/src/runtime/local-host/endpoint.js +79 -0
- package/dist/src/runtime/local-host/owner-activity.d.ts +10 -0
- package/dist/src/runtime/local-host/owner-activity.js +30 -0
- package/dist/src/runtime/local-host/owner-retirement.d.ts +3 -0
- package/dist/src/runtime/local-host/owner-retirement.js +15 -0
- package/dist/src/runtime/local-host/owner-server.d.ts +6 -0
- package/dist/src/runtime/local-host/owner-server.js +88 -0
- package/dist/src/runtime/local-host/private-access.d.ts +2 -0
- package/dist/src/runtime/local-host/private-access.js +16 -0
- package/dist/src/runtime/local-host/private-directory.d.ts +1 -0
- package/dist/src/runtime/local-host/private-directory.js +57 -0
- package/dist/src/runtime/local-host/rpc-peer.d.ts +22 -0
- package/dist/src/runtime/local-host/rpc-peer.js +168 -0
- package/dist/src/runtime/local-host/rpc-protocol.d.ts +21 -0
- package/dist/src/runtime/local-host/rpc-protocol.js +46 -0
- package/dist/src/runtime/local-host/startup-connection.d.ts +5 -0
- package/dist/src/runtime/local-host/startup-connection.js +72 -0
- package/dist/src/runtime/local-host/transport.d.ts +3 -0
- package/dist/src/runtime/local-host/transport.js +88 -0
- package/dist/src/runtime/local-host/windows-private-access.d.ts +1 -0
- package/dist/src/runtime/local-host/windows-private-access.js +51 -0
- package/dist/src/runtime/long-term-memory/onboarding/configuration.js +6 -0
- package/dist/src/runtime/long-term-memory/recall-binding.d.ts +3 -0
- package/dist/src/runtime/long-term-memory/recall-binding.js +27 -0
- package/dist/src/runtime/long-term-memory/recall-context.d.ts +20 -0
- package/dist/src/runtime/long-term-memory/recall-context.js +101 -0
- package/dist/src/runtime/long-term-memory/recall-continuation.d.ts +8 -0
- package/dist/src/runtime/long-term-memory/recall-continuation.js +36 -0
- package/dist/src/runtime/long-term-memory/recall-policy.d.ts +7 -0
- package/dist/src/runtime/long-term-memory/recall-policy.js +14 -0
- package/dist/src/runtime/long-term-memory/recall-result.d.ts +5 -0
- package/dist/src/runtime/long-term-memory/recall-result.js +54 -0
- package/dist/src/runtime/long-term-memory/repository-state.d.ts +2 -1
- package/dist/src/runtime/long-term-memory/repository-state.js +2 -2
- package/dist/src/runtime/model/invoke-raw-step.d.ts +1 -0
- package/dist/src/runtime/model/invoke-raw-step.js +1 -0
- package/dist/src/runtime/model/invoke-step.js +6 -0
- package/dist/src/runtime/model/invoke-structured-step.d.ts +1 -0
- package/dist/src/runtime/model/invoke-structured-step.js +1 -0
- package/dist/src/runtime/model/model-step-port.d.ts +2 -0
- package/dist/src/runtime/model/model-step-steering.d.ts +8 -0
- package/dist/src/runtime/model/model-step-steering.js +19 -0
- package/dist/src/runtime/orchestration/final-response/authoring-contract.js +1 -1
- package/dist/src/runtime/orchestration/final-response/invoke.d.ts +1 -0
- package/dist/src/runtime/orchestration/final-response/invoke.js +1 -0
- package/dist/src/runtime/orchestration/role-calls/activation-budget.js +1 -0
- package/dist/src/runtime/orchestration/role-calls/candidate-validation.js +9 -49
- package/dist/src/runtime/orchestration/role-calls/capability-selection-reconsideration.d.ts +9 -0
- package/dist/src/runtime/orchestration/role-calls/capability-selection-reconsideration.js +17 -8
- package/dist/src/runtime/orchestration/role-calls/capability-selection-supervision-validation.d.ts +2 -0
- package/dist/src/runtime/orchestration/role-calls/capability-selection-supervision-validation.js +62 -0
- package/dist/src/runtime/orchestration/role-calls/command-decoder.js +4 -0
- package/dist/src/runtime/orchestration/role-calls/command-dispatch/memory-recall-transitions.d.ts +4 -0
- package/dist/src/runtime/orchestration/role-calls/command-dispatch/memory-recall-transitions.js +89 -0
- package/dist/src/runtime/orchestration/role-calls/command-dispatch.js +5 -0
- package/dist/src/runtime/orchestration/role-calls/contracts.d.ts +9 -7
- package/dist/src/runtime/orchestration/role-calls/contracts.js +2 -2
- package/dist/src/runtime/orchestration/role-calls/diagnostics.js +3 -0
- package/dist/src/runtime/orchestration/role-calls/index.d.ts +1 -0
- package/dist/src/runtime/orchestration/role-calls/index.js +1 -0
- package/dist/src/runtime/orchestration/role-calls/memory-recall-contract.d.ts +51 -0
- package/dist/src/runtime/orchestration/role-calls/memory-recall-contract.js +4 -0
- package/dist/src/runtime/orchestration/role-calls/memory-recall-decoder.d.ts +6 -0
- package/dist/src/runtime/orchestration/role-calls/memory-recall-decoder.js +147 -0
- package/dist/src/runtime/orchestration/role-calls/memory-recall-diagnostics.d.ts +5 -0
- package/dist/src/runtime/orchestration/role-calls/memory-recall-diagnostics.js +27 -0
- package/dist/src/runtime/orchestration/role-calls/memory-recall-state-validation.d.ts +3 -0
- package/dist/src/runtime/orchestration/role-calls/memory-recall-state-validation.js +121 -0
- package/dist/src/runtime/orchestration/role-calls/memory-recall-transactions.d.ts +3 -0
- package/dist/src/runtime/orchestration/role-calls/memory-recall-transactions.js +44 -0
- package/dist/src/runtime/orchestration/role-calls/reducer.js +1 -0
- package/dist/src/runtime/orchestration/role-calls/transaction-effect.d.ts +5 -0
- package/dist/src/runtime/orchestration/role-calls/transaction-effect.js +14 -0
- package/dist/src/runtime/orchestration/role-calls/transactions.js +3 -24
- package/dist/src/runtime/plugins/manifest-validator.js +4 -1
- package/dist/src/runtime/ports.d.ts +4 -0
- package/dist/src/runtime/request/bound-runtime-handler.d.ts +2 -0
- package/dist/src/runtime/request/bound-runtime-handler.js +25 -0
- package/dist/src/runtime/request/contracts.d.ts +6 -0
- package/dist/src/runtime/request/execution-agent-root-execution.js +12 -0
- package/dist/src/runtime/request/execution-facets.js +6 -0
- package/dist/src/runtime/request/execution-scope-surfaces.js +10 -0
- package/dist/src/runtime/request/execution-scope.d.ts +1 -1
- package/dist/src/runtime/request/handler.js +6 -0
- package/dist/src/runtime/request/root-contract.d.ts +7 -1
- package/dist/src/runtime/request/root-execution-kernel.js +33 -37
- package/dist/src/runtime/request/root-memory-recall.d.ts +11 -0
- package/dist/src/runtime/request/root-memory-recall.js +71 -0
- package/dist/src/runtime/request/root-observation-handoff.d.ts +17 -0
- package/dist/src/runtime/request/root-observation-handoff.js +44 -0
- package/dist/src/runtime/request/scheduled-execution.d.ts +9 -0
- package/dist/src/runtime/request/scheduled-execution.js +32 -0
- package/dist/src/runtime/request/session-admission.d.ts +17 -0
- package/dist/src/runtime/request/session-admission.js +88 -0
- package/dist/src/runtime/request/supervisor-root-execution-diagnostics.d.ts +1 -1
- package/dist/src/runtime/request/supervisor-root-execution.js +8 -0
- package/dist/src/runtime/runtime-environment.d.ts +31 -0
- package/dist/src/runtime/runtime-environment.js +102 -0
- package/dist/src/runtime/runtime-host-environment.d.ts +8 -0
- package/dist/src/runtime/runtime-host-environment.js +57 -0
- package/dist/src/runtime/runtime-host-lifecycle.d.ts +4 -0
- package/dist/src/runtime/runtime-host-lifecycle.js +64 -0
- package/dist/src/runtime/runtime-host-scheduler-ownership.d.ts +5 -0
- package/dist/src/runtime/runtime-host-scheduler-ownership.js +67 -0
- package/dist/src/runtime/runtime-host.d.ts +19 -0
- package/dist/src/runtime/runtime-host.js +63 -0
- package/dist/src/runtime/scheduler/calendar-time.d.ts +10 -0
- package/dist/src/runtime/scheduler/calendar-time.js +58 -0
- package/dist/src/runtime/scheduler/contracts.d.ts +143 -0
- package/dist/src/runtime/scheduler/contracts.js +1 -0
- package/dist/src/runtime/scheduler/file-store.d.ts +2 -0
- package/dist/src/runtime/scheduler/file-store.js +76 -0
- package/dist/src/runtime/scheduler/instant-validation.d.ts +4 -0
- package/dist/src/runtime/scheduler/instant-validation.js +69 -0
- package/dist/src/runtime/scheduler/interval-range.d.ts +8 -0
- package/dist/src/runtime/scheduler/interval-range.js +24 -0
- package/dist/src/runtime/scheduler/job-management.d.ts +8 -0
- package/dist/src/runtime/scheduler/job-management.js +212 -0
- package/dist/src/runtime/scheduler/journal-checkpoint.d.ts +9 -0
- package/dist/src/runtime/scheduler/journal-checkpoint.js +45 -0
- package/dist/src/runtime/scheduler/journal-durability.d.ts +8 -0
- package/dist/src/runtime/scheduler/journal-durability.js +59 -0
- package/dist/src/runtime/scheduler/journal-files.d.ts +14 -0
- package/dist/src/runtime/scheduler/journal-files.js +59 -0
- package/dist/src/runtime/scheduler/journal-head.d.ts +21 -0
- package/dist/src/runtime/scheduler/journal-head.js +81 -0
- package/dist/src/runtime/scheduler/journal-index-state.d.ts +31 -0
- package/dist/src/runtime/scheduler/journal-index-state.js +137 -0
- package/dist/src/runtime/scheduler/journal-index.d.ts +22 -0
- package/dist/src/runtime/scheduler/journal-index.js +195 -0
- package/dist/src/runtime/scheduler/journal-store.d.ts +21 -0
- package/dist/src/runtime/scheduler/journal-store.js +184 -0
- package/dist/src/runtime/scheduler/journal-transaction.d.ts +14 -0
- package/dist/src/runtime/scheduler/journal-transaction.js +104 -0
- package/dist/src/runtime/scheduler/next-occurrence.d.ts +3 -0
- package/dist/src/runtime/scheduler/next-occurrence.js +39 -0
- package/dist/src/runtime/scheduler/run-completion.d.ts +12 -0
- package/dist/src/runtime/scheduler/run-completion.js +77 -0
- package/dist/src/runtime/scheduler/run-list-query.d.ts +5 -0
- package/dist/src/runtime/scheduler/run-list-query.js +38 -0
- package/dist/src/runtime/scheduler/run-records.d.ts +6 -0
- package/dist/src/runtime/scheduler/run-records.js +41 -0
- package/dist/src/runtime/scheduler/schedule-update.d.ts +3 -0
- package/dist/src/runtime/scheduler/schedule-update.js +22 -0
- package/dist/src/runtime/scheduler/schedule-validation.d.ts +10 -0
- package/dist/src/runtime/scheduler/schedule-validation.js +132 -0
- package/dist/src/runtime/scheduler/scheduler-engine.d.ts +2 -0
- package/dist/src/runtime/scheduler/scheduler-engine.js +174 -0
- package/dist/src/runtime/scheduler/scheduler-service.d.ts +10 -0
- package/dist/src/runtime/scheduler/scheduler-service.js +115 -0
- package/dist/src/runtime/scheduler/service-context.d.ts +21 -0
- package/dist/src/runtime/scheduler/service-context.js +26 -0
- package/dist/src/runtime/scheduler/session-deletion-state.d.ts +9 -0
- package/dist/src/runtime/scheduler/session-deletion-state.js +30 -0
- package/dist/src/runtime/scheduler/snapshot-validation.d.ts +4 -0
- package/dist/src/runtime/scheduler/snapshot-validation.js +112 -0
- package/dist/src/runtime/scheduler/startup-recovery.d.ts +2 -0
- package/dist/src/runtime/scheduler/startup-recovery.js +38 -0
- package/dist/src/runtime/scheduler/validation-error.d.ts +4 -0
- package/dist/src/runtime/scheduler/validation-error.js +8 -0
- package/dist/src/runtime/scheduler/working-store.d.ts +3 -0
- package/dist/src/runtime/scheduler/working-store.js +8 -0
- package/dist/src/runtime/session/request-session.d.ts +1 -0
- package/dist/src/runtime/session/request-session.js +14 -1
- package/dist/src/runtime/session/session-attachment-deletion.d.ts +8 -0
- package/dist/src/runtime/session/session-attachment-deletion.js +87 -0
- package/dist/src/runtime/session/session-deletion-boundary.d.ts +10 -0
- package/dist/src/runtime/session/session-deletion-boundary.js +39 -0
- package/dist/src/runtime/session/session-deletion-cleanup.d.ts +7 -0
- package/dist/src/runtime/session/session-deletion-cleanup.js +62 -0
- package/dist/src/runtime/session/session-deletion-finalization.d.ts +7 -0
- package/dist/src/runtime/session/session-deletion-finalization.js +34 -0
- package/dist/src/runtime/session/session-deletion-receipts.d.ts +7 -0
- package/dist/src/runtime/session/session-deletion-receipts.js +18 -0
- package/dist/src/runtime/session/session-lifecycle-store.d.ts +21 -0
- package/dist/src/runtime/session/session-lifecycle-store.js +72 -0
- package/dist/src/runtime/session/session-mutation-queue.d.ts +3 -0
- package/dist/src/runtime/session/session-mutation-queue.js +15 -0
- package/dist/src/runtime/steps/execution-agent/capability-decision-parsing.d.ts +16 -0
- package/dist/src/runtime/steps/execution-agent/capability-decision-parsing.js +165 -0
- package/dist/src/runtime/steps/execution-agent/contracts.d.ts +3 -1
- package/dist/src/runtime/steps/execution-agent/decision-parsing.d.ts +2 -0
- package/dist/src/runtime/steps/execution-agent/decision-parsing.js +195 -0
- package/dist/src/runtime/steps/execution-agent/decision-validation.d.ts +30 -0
- package/dist/src/runtime/steps/execution-agent/decision-validation.js +127 -0
- package/dist/src/runtime/steps/execution-agent/format.d.ts +1 -0
- package/dist/src/runtime/steps/execution-agent/format.js +12 -0
- package/dist/src/runtime/steps/execution-agent/input.d.ts +2 -1
- package/dist/src/runtime/steps/execution-agent/input.js +17 -2
- package/dist/src/runtime/steps/execution-agent/parser.d.ts +1 -2
- package/dist/src/runtime/steps/execution-agent/parser.js +1 -472
- package/dist/src/runtime/steps/execution-agent/prompt.d.ts +2 -0
- package/dist/src/runtime/steps/execution-agent/prompt.js +2 -0
- package/dist/src/runtime/steps/execution-agent/reconsideration-context.js +4 -3
- package/dist/src/runtime/steps/execution-agent/response-input.js +5 -4
- package/dist/src/runtime/steps/execution-agent/response-run.d.ts +3 -0
- package/dist/src/runtime/steps/execution-agent/response-run.js +7 -3
- package/dist/src/runtime/steps/execution-agent/run.d.ts +2 -0
- package/dist/src/runtime/steps/execution-agent/run.js +2 -0
- package/dist/src/runtime/steps/execution-agent/state-context.d.ts +2 -1
- package/dist/src/runtime/steps/execution-agent/state-context.js +13 -5
- package/dist/src/runtime/steps/memory-recall-decision.d.ts +30 -0
- package/dist/src/runtime/steps/memory-recall-decision.js +101 -0
- package/dist/src/runtime/steps/memory-recall-prompt.d.ts +1 -0
- package/dist/src/runtime/steps/memory-recall-prompt.js +15 -0
- package/dist/src/runtime/steps/supervisor-decision/contracts.d.ts +4 -2
- package/dist/src/runtime/steps/supervisor-decision/diagnostics.d.ts +2 -0
- package/dist/src/runtime/steps/supervisor-decision/diagnostics.js +13 -6
- package/dist/src/runtime/steps/supervisor-decision/format.d.ts +2 -0
- package/dist/src/runtime/steps/supervisor-decision/format.js +41 -2
- package/dist/src/runtime/steps/supervisor-decision/input.d.ts +5 -1
- package/dist/src/runtime/steps/supervisor-decision/input.js +25 -5
- package/dist/src/runtime/steps/supervisor-decision/memory-recall-continuation.d.ts +10 -0
- package/dist/src/runtime/steps/supervisor-decision/memory-recall-continuation.js +32 -0
- package/dist/src/runtime/steps/supervisor-decision/parser.d.ts +2 -0
- package/dist/src/runtime/steps/supervisor-decision/parser.js +36 -1
- package/dist/src/runtime/steps/supervisor-decision/prompt.d.ts +3 -0
- package/dist/src/runtime/steps/supervisor-decision/prompt.js +16 -8
- package/dist/src/runtime/steps/supervisor-decision/response-recommendation.d.ts +13 -0
- package/dist/src/runtime/steps/supervisor-decision/response-recommendation.js +32 -0
- package/dist/src/runtime/steps/supervisor-decision/resume.d.ts +2 -0
- package/dist/src/runtime/steps/supervisor-decision/resume.js +13 -0
- package/dist/src/runtime/steps/supervisor-decision/run.d.ts +3 -0
- package/dist/src/runtime/steps/supervisor-decision/run.js +19 -0
- package/dist/src/runtime/steps/supervisor-decision/working-directory.js +7 -1
- package/dist/src/runtime/steps/supervisor-response/diagnostics.d.ts +1 -0
- package/dist/src/runtime/steps/supervisor-response/diagnostics.js +1 -0
- package/dist/src/runtime/steps/supervisor-response/input.d.ts +2 -1
- package/dist/src/runtime/steps/supervisor-response/input.js +17 -4
- package/dist/src/runtime/steps/supervisor-response/memory-authoring.d.ts +1 -0
- package/dist/src/runtime/steps/supervisor-response/memory-authoring.js +4 -0
- package/dist/src/runtime/steps/supervisor-response/prompt.d.ts +1 -0
- package/dist/src/runtime/steps/supervisor-response/prompt.js +8 -2
- package/dist/src/runtime/steps/supervisor-response/response-recommendation.d.ts +10 -0
- package/dist/src/runtime/steps/supervisor-response/response-recommendation.js +25 -0
- package/dist/src/runtime/steps/supervisor-response/run.d.ts +6 -1
- package/dist/src/runtime/steps/supervisor-response/run.js +26 -7
- package/dist/src/sessions/record/projection.js +1 -0
- package/dist/src/sessions/schedule-metadata.d.ts +8 -0
- package/dist/src/sessions/schedule-metadata.js +1 -0
- package/dist/src/sessions/session-service.d.ts +1 -0
- package/dist/src/sessions/session-service.js +1 -0
- package/dist/src/sessions/types.d.ts +2 -0
- package/dist/src/shared/http-server-shutdown.d.ts +4 -0
- package/dist/src/shared/http-server-shutdown.js +17 -0
- package/dist/src/shared/public-http/aggregate-gate.d.ts +3 -0
- package/dist/src/shared/public-http/aggregate-gate.js +87 -0
- package/dist/src/shared/public-http/deadline.d.ts +2 -0
- package/dist/src/shared/public-http/deadline.js +29 -0
- package/dist/src/shared/public-http/errors.d.ts +6 -0
- package/dist/src/shared/public-http/errors.js +11 -0
- package/dist/src/shared/public-http/limits.d.ts +8 -0
- package/dist/src/shared/public-http/limits.js +8 -0
- package/dist/src/shared/public-http/network-policy.d.ts +11 -0
- package/dist/src/shared/public-http/network-policy.js +178 -0
- package/dist/src/shared/public-http/public-http.d.ts +24 -0
- package/dist/src/shared/public-http/public-http.js +85 -0
- package/dist/src/shared/public-http/request-hop.d.ts +18 -0
- package/dist/src/shared/public-http/request-hop.js +140 -0
- package/dist/src/web-ui/app/ARCHITECTURE.md +66 -4
- package/dist/src/web-ui/app/app-bootstrap.js +53 -0
- package/dist/src/web-ui/app/app-dom.js +80 -0
- package/dist/src/web-ui/app/app.js +195 -212
- package/dist/src/web-ui/app/components/conversation-activity.d.ts +2 -0
- package/dist/src/web-ui/app/components/conversation-activity.js +34 -7
- package/dist/src/web-ui/app/components/conversation-role-cards.d.ts +1 -0
- package/dist/src/web-ui/app/components/conversation-role-cards.js +61 -5
- package/dist/src/web-ui/app/components/conversation-schedule.js +71 -0
- package/dist/src/web-ui/app/components/conversation-status.js +65 -0
- package/dist/src/web-ui/app/components/conversation-tools.d.ts +13 -0
- package/dist/src/web-ui/app/components/conversation-tools.js +284 -0
- package/dist/src/web-ui/app/components/conversation-view.js +39 -11
- package/dist/src/web-ui/app/components/dashboard/activity.js +61 -0
- package/dist/src/web-ui/app/components/dashboard/icons.js +23 -0
- package/dist/src/web-ui/app/components/dashboard/recent-conversations.js +64 -0
- package/dist/src/web-ui/app/components/dashboard/workspace.js +107 -0
- package/dist/src/web-ui/app/components/message-link-previews.d.ts +16 -0
- package/dist/src/web-ui/app/components/message-link-previews.js +179 -0
- package/dist/src/web-ui/app/components/schedules/details.js +101 -0
- package/dist/src/web-ui/app/components/schedules/form.d.ts +13 -0
- package/dist/src/web-ui/app/components/schedules/form.js +246 -0
- package/dist/src/web-ui/app/components/schedules/workspace-state.js +59 -0
- package/dist/src/web-ui/app/components/schedules/workspace.js +165 -0
- package/dist/src/web-ui/app/components/workspace-shell.js +48 -2
- package/dist/src/web-ui/app/configuration-feature.js +72 -0
- package/dist/src/web-ui/app/controllers/composer-attachments-controller.d.ts +1 -0
- package/dist/src/web-ui/app/controllers/composer-attachments-controller.js +17 -6
- package/dist/src/web-ui/app/controllers/composer-submit-controller.d.ts +2 -0
- package/dist/src/web-ui/app/controllers/composer-submit-controller.js +15 -1
- package/dist/src/web-ui/app/controllers/composer-surface-controller.js +58 -0
- package/dist/src/web-ui/app/controllers/composer-workspace-controller.d.ts +53 -0
- package/dist/src/web-ui/app/controllers/composer-workspace-controller.js +180 -0
- package/dist/src/web-ui/app/controllers/conversation-read-state-controller.d.ts +23 -0
- package/dist/src/web-ui/app/controllers/conversation-read-state-controller.js +82 -0
- package/dist/src/web-ui/app/controllers/conversation-session-controller.d.ts +8 -0
- package/dist/src/web-ui/app/controllers/conversation-session-controller.js +28 -39
- package/dist/src/web-ui/app/controllers/dashboard-controller.js +127 -0
- package/dist/src/web-ui/app/controllers/home-composer-feature.d.ts +40 -0
- package/dist/src/web-ui/app/controllers/home-composer-feature.js +119 -0
- package/dist/src/web-ui/app/controllers/home-conversation-activation.js +37 -0
- package/dist/src/web-ui/app/controllers/realtime-event-controller.d.ts +1 -0
- package/dist/src/web-ui/app/controllers/realtime-event-controller.js +74 -3
- package/dist/src/web-ui/app/controllers/runtime-selection-controller.d.ts +2 -1
- package/dist/src/web-ui/app/controllers/runtime-selection-controller.js +15 -14
- package/dist/src/web-ui/app/controllers/schedule-realtime.js +118 -0
- package/dist/src/web-ui/app/controllers/schedules-controller.js +421 -0
- package/dist/src/web-ui/app/controllers/session-controller.js +30 -3
- package/dist/src/web-ui/app/dashboard-feature.js +44 -0
- package/dist/src/web-ui/app/index.html +53 -1
- package/dist/src/web-ui/app/lib/composer-submission-scope.d.ts +21 -0
- package/dist/src/web-ui/app/lib/composer-submission-scope.js +13 -0
- package/dist/src/web-ui/app/lib/context-window-snapshot-order.d.ts +15 -0
- package/dist/src/web-ui/app/lib/context-window-snapshot-order.js +31 -0
- package/dist/src/web-ui/app/lib/conversation-role-model.d.ts +10 -1
- package/dist/src/web-ui/app/lib/conversation-role-model.js +97 -15
- package/dist/src/web-ui/app/lib/conversation-status-model.d.ts +12 -0
- package/dist/src/web-ui/app/lib/conversation-status-model.js +116 -0
- package/dist/src/web-ui/app/lib/dashboard-job-templates.js +41 -0
- package/dist/src/web-ui/app/lib/dashboard-presentation.js +126 -0
- package/dist/src/web-ui/app/lib/message-markdown.d.ts +5 -0
- package/dist/src/web-ui/app/lib/message-markdown.js +99 -0
- package/dist/src/web-ui/app/lib/message-url-policy.d.ts +1 -0
- package/dist/src/web-ui/app/lib/message-url-policy.js +13 -0
- package/dist/src/web-ui/app/lib/schedule-errors.js +29 -0
- package/dist/src/web-ui/app/lib/schedule-message.js +30 -0
- package/dist/src/web-ui/app/lib/schedule-presentation.js +81 -0
- package/dist/src/web-ui/app/lib/session-read-state.d.ts +22 -0
- package/dist/src/web-ui/app/lib/session-read-state.js +63 -0
- package/dist/src/web-ui/app/lib/text-format.js +2 -143
- package/dist/src/web-ui/app/lib/tool-activity-event.d.ts +26 -0
- package/dist/src/web-ui/app/lib/tool-activity-event.js +228 -0
- package/dist/src/web-ui/app/lib/tool-activity-model.d.ts +41 -0
- package/dist/src/web-ui/app/lib/tool-activity-model.js +255 -0
- package/dist/src/web-ui/app/lib/tool-timeline.d.ts +3 -0
- package/dist/src/web-ui/app/lib/tool-timeline.js +18 -0
- package/dist/src/web-ui/app/schedules-feature.js +87 -0
- package/dist/src/web-ui/app/services/message-link-preview-client.d.ts +14 -0
- package/dist/src/web-ui/app/services/message-link-preview-client.js +96 -0
- package/dist/src/web-ui/app/services/runtime-web-client/schedules.js +51 -0
- package/dist/src/web-ui/app/services/runtime-web-client.d.ts +37 -0
- package/dist/src/web-ui/app/services/runtime-web-client.js +13 -8
- package/dist/src/web-ui/app/styles/00-tokens-base.css +11 -11
- package/dist/src/web-ui/app/styles/18-dashboard.css +384 -0
- package/dist/src/web-ui/app/styles/20-chat-composer.css +1 -130
- package/dist/src/web-ui/app/styles/26-message-content.css +295 -0
- package/dist/src/web-ui/app/styles/27-conversation-tools.css +266 -0
- package/dist/src/web-ui/app/styles/28-conversation-status.css +52 -0
- package/dist/src/web-ui/app/styles/38-schedule-workspace.css +263 -0
- package/dist/src/web-ui/app/styles/38-schedules.css +352 -0
- package/dist/src/web-ui/app/styles/90-responsive.css +14 -0
- package/dist/src/web-ui/app/styles/91-schedules-responsive.css +72 -0
- package/dist/src/web-ui/app/styles/92-dashboard-responsive.css +88 -0
- package/dist/src/web-ui/app/styles.css +8 -0
- package/dist/src/web-ui/app/ui-behavior.d.ts +1 -1
- package/dist/src/web-ui/app/ui-behavior.js +3 -1
- package/dist/src/web-ui/app/vendor/README.md +15 -0
- package/dist/src/web-ui/app/vendor/markdown-it.LICENSE +22 -0
- package/dist/src/web-ui/app/vendor/markdown-it.js +3003 -0
- package/dist/src/web-ui/link-preview/metadata.d.ts +9 -0
- package/dist/src/web-ui/link-preview/metadata.js +97 -0
- package/dist/src/web-ui/link-preview/preview-cache.d.ts +4 -0
- package/dist/src/web-ui/link-preview/preview-cache.js +23 -0
- package/dist/src/web-ui/link-preview/raster-response.d.ts +9 -0
- package/dist/src/web-ui/link-preview/raster-response.js +49 -0
- package/dist/src/web-ui/link-preview/routes.d.ts +3 -0
- package/dist/src/web-ui/link-preview/routes.js +97 -0
- package/dist/src/web-ui/link-preview/service.d.ts +11 -0
- package/dist/src/web-ui/link-preview/service.js +117 -0
- package/dist/src/web-ui/local-runtime/api-router.d.ts +4 -1
- package/dist/src/web-ui/local-runtime/api-router.js +42 -73
- package/dist/src/web-ui/local-runtime/contracts.d.ts +2 -2
- package/dist/src/web-ui/local-runtime/environment-registry.d.ts +12 -1
- package/dist/src/web-ui/local-runtime/environment-registry.js +38 -3
- package/dist/src/web-ui/local-runtime/realtime-controller.js +3 -1
- package/dist/src/web-ui/local-runtime/request-execution.d.ts +5 -1
- package/dist/src/web-ui/local-runtime/request-execution.js +38 -2
- package/dist/src/web-ui/local-runtime/schedule-job-creation.d.ts +7 -0
- package/dist/src/web-ui/local-runtime/schedule-job-creation.js +62 -0
- package/dist/src/web-ui/local-runtime/schedule-management-routes.d.ts +30 -0
- package/dist/src/web-ui/local-runtime/schedule-management-routes.js +134 -0
- package/dist/src/web-ui/local-runtime/schedule-run-page.d.ts +5 -0
- package/dist/src/web-ui/local-runtime/schedule-run-page.js +23 -0
- package/dist/src/web-ui/local-runtime/session-routes.d.ts +17 -0
- package/dist/src/web-ui/local-runtime/session-routes.js +74 -0
- package/dist/src/web-ui/local-runtime-backend.d.ts +2 -0
- package/dist/src/web-ui/local-runtime-backend.js +11 -1
- package/dist/src/web-ui/schedule-creation-contract.d.ts +7 -0
- package/dist/src/web-ui/schedule-creation-contract.js +1 -0
- package/dist/src/web-ui/server-shutdown.d.ts +4 -0
- package/dist/src/web-ui/server-shutdown.js +32 -0
- package/dist/src/web-ui/server.js +13 -10
- package/dist/src/web-ui/session-read-state/availability.d.ts +16 -0
- package/dist/src/web-ui/session-read-state/availability.js +20 -0
- package/dist/src/web-ui/session-read-state/projection.d.ts +17 -0
- package/dist/src/web-ui/session-read-state/projection.js +71 -0
- package/dist/src/web-ui/session-read-state/service.d.ts +86 -0
- package/dist/src/web-ui/session-read-state/service.js +89 -0
- package/dist/src/web-ui/session-read-state/store.d.ts +22 -0
- package/dist/src/web-ui/session-read-state/store.js +110 -0
- package/docs/configuration.md +41 -1
- package/docs/long-term-memory.md +46 -5
- package/docs/runtime-invariant-coverage.md +1 -1
- package/docs/runtime-library.md +23 -0
- package/docs/runtime-public-contracts.md +32 -1
- package/package.json +3 -1
- package/plugins/code-outline/plugin.json +15 -0
- package/plugins/document-reader/plugin.json +17 -0
- package/plugins/filesystem/plugin.json +17 -2
- package/plugins/json-inspector/plugin.json +12 -0
- package/plugins/local-search/plugin.json +12 -0
- package/plugins/memory/plugin.json +26 -1
- package/plugins/memory/source/index.ts +10 -6
- package/plugins/memory/src/index.cjs +11 -7
- package/plugins/project-orientation/plugin.json +14 -0
- package/plugins/web/source/aggregate-gate.ts +8 -130
- package/plugins/web/source/deadline.ts +14 -50
- package/plugins/web/source/errors.ts +17 -11
- package/plugins/web/source/limits.ts +3 -6
- package/plugins/web/source/network-policy.ts +28 -226
- package/plugins/web/source/public-http.ts +17 -142
- package/plugins/web/source/request-hop.ts +11 -191
- package/plugins/web/src/index.cjs +119 -59
- package/runtime.config.schema.json +7 -0
- package/src/runtime/README.md +105 -1
- package/src/runtime/local-host/README.md +86 -0
- package/src/runtime/scheduler/README.md +166 -0
|
@@ -15,6 +15,8 @@ export function createWorkspaceShell({
|
|
|
15
15
|
viewport = window,
|
|
16
16
|
documentRoot = document,
|
|
17
17
|
beforeWorkspaceChange = () => true,
|
|
18
|
+
isWorkspaceAvailable = () => true,
|
|
19
|
+
onWorkspaceChange = () => {},
|
|
18
20
|
}) {
|
|
19
21
|
const shellState = {
|
|
20
22
|
...createInitialWorkspaceShellState(),
|
|
@@ -38,6 +40,7 @@ export function createWorkspaceShell({
|
|
|
38
40
|
}
|
|
39
41
|
|
|
40
42
|
function setCurrentPage(button, active) {
|
|
43
|
+
if (!button) return;
|
|
41
44
|
if (active) {
|
|
42
45
|
button.setAttribute("aria-current", "page");
|
|
43
46
|
return;
|
|
@@ -46,12 +49,21 @@ export function createWorkspaceShell({
|
|
|
46
49
|
}
|
|
47
50
|
|
|
48
51
|
function syncShell() {
|
|
52
|
+
const homeWorkspace = shellState.workspace === "home";
|
|
49
53
|
const chatWorkspace = shellState.workspace === "chat";
|
|
50
54
|
const configWorkspace = shellState.workspace === "config";
|
|
55
|
+
const schedulesWorkspace = shellState.workspace === "schedules";
|
|
51
56
|
const sessions = sidebarLayout();
|
|
52
57
|
const showSessionsToggle = chatWorkspace && !sessions.docked;
|
|
53
58
|
|
|
54
59
|
dom.app.classList.toggle("config-workspace", configWorkspace);
|
|
60
|
+
dom.app.classList.toggle("home-workspace", homeWorkspace);
|
|
61
|
+
if (dom.homeWorkspacePanel) {
|
|
62
|
+
dom.homeWorkspacePanel.hidden = !homeWorkspace;
|
|
63
|
+
dom.homeWorkspacePanel.inert = !homeWorkspace;
|
|
64
|
+
dom.homeWorkspacePanel.setAttribute("aria-hidden", String(!homeWorkspace));
|
|
65
|
+
}
|
|
66
|
+
dom.app.classList.toggle("schedules-workspace", schedulesWorkspace);
|
|
55
67
|
dom.app.classList.toggle("sessions-open", sessions.drawerOpen);
|
|
56
68
|
dom.app.classList.toggle("sessions-docked", sessions.docked);
|
|
57
69
|
|
|
@@ -64,6 +76,14 @@ export function createWorkspaceShell({
|
|
|
64
76
|
configWorkspace ? "false" : "true",
|
|
65
77
|
);
|
|
66
78
|
|
|
79
|
+
if (dom.schedulesWorkspacePanel) {
|
|
80
|
+
dom.schedulesWorkspacePanel.hidden = !schedulesWorkspace;
|
|
81
|
+
dom.schedulesWorkspacePanel.inert = !schedulesWorkspace;
|
|
82
|
+
dom.schedulesWorkspacePanel.setAttribute(
|
|
83
|
+
"aria-hidden",
|
|
84
|
+
String(!schedulesWorkspace),
|
|
85
|
+
);
|
|
86
|
+
}
|
|
67
87
|
dom.sessionsPanel.hidden = !sessions.visible;
|
|
68
88
|
dom.sessionsPanel.inert = !sessions.visible;
|
|
69
89
|
dom.sessionsPanel.setAttribute(
|
|
@@ -82,7 +102,9 @@ export function createWorkspaceShell({
|
|
|
82
102
|
dom.closeSessionsButton.hidden = sessions.docked;
|
|
83
103
|
|
|
84
104
|
setCurrentPage(dom.chatWorkspaceButton, chatWorkspace);
|
|
105
|
+
setCurrentPage(dom.homeWorkspaceButton, homeWorkspace);
|
|
85
106
|
setCurrentPage(dom.configWorkspaceButton, configWorkspace);
|
|
107
|
+
setCurrentPage(dom.schedulesWorkspaceButton, schedulesWorkspace);
|
|
86
108
|
|
|
87
109
|
dom.panelBackdrop.classList.toggle("visible", sessions.drawerOpen);
|
|
88
110
|
dom.panelBackdrop.tabIndex = sessions.drawerOpen ? 0 : -1;
|
|
@@ -118,8 +140,10 @@ export function createWorkspaceShell({
|
|
|
118
140
|
|
|
119
141
|
function syncSidebarViewport() {
|
|
120
142
|
const activeElement = documentRoot.activeElement;
|
|
143
|
+
const wasSessionsDrawerOpen = shellState.activeSheet === "sessions";
|
|
121
144
|
shellState.activeSheet = "";
|
|
122
145
|
syncShell();
|
|
146
|
+
if (wasSessionsDrawerOpen) onWorkspaceChange(shellState.workspace);
|
|
123
147
|
const sessions = sidebarLayout();
|
|
124
148
|
if (!sidebarFocusNeedsRestoration(activeElement, sessions)) return;
|
|
125
149
|
if (sessions.docked) {
|
|
@@ -134,6 +158,7 @@ export function createWorkspaceShell({
|
|
|
134
158
|
|
|
135
159
|
function prepareWorkspaceTransition(destination) {
|
|
136
160
|
const nextWorkspace = normalizeWorkspaceDestination(destination);
|
|
161
|
+
if (!isWorkspaceAvailable(nextWorkspace)) return null;
|
|
137
162
|
if (nextWorkspace === shellState.workspace) {
|
|
138
163
|
return { nextWorkspace, commitBeforeChange: () => {} };
|
|
139
164
|
}
|
|
@@ -150,6 +175,7 @@ export function createWorkspaceShell({
|
|
|
150
175
|
}
|
|
151
176
|
|
|
152
177
|
function commitWorkspaceActivation(preparedTransition, options = {}) {
|
|
178
|
+
if (!isWorkspaceAvailable(preparedTransition.nextWorkspace)) return false;
|
|
153
179
|
preparedTransition.commitBeforeChange();
|
|
154
180
|
const nextWorkspace = preparedTransition.nextWorkspace;
|
|
155
181
|
const previousWorkspace = shellState.workspace;
|
|
@@ -157,12 +183,21 @@ export function createWorkspaceShell({
|
|
|
157
183
|
shellState.workspace = nextWorkspace;
|
|
158
184
|
shellState.activeSheet = "";
|
|
159
185
|
syncShell();
|
|
186
|
+
onWorkspaceChange(nextWorkspace);
|
|
160
187
|
|
|
161
188
|
if (options.focus === false) return true;
|
|
189
|
+
if (nextWorkspace === "home") {
|
|
190
|
+
dom.composerInput?.focus();
|
|
191
|
+
return true;
|
|
192
|
+
}
|
|
162
193
|
if (nextWorkspace !== "chat") {
|
|
163
194
|
viewport.requestAnimationFrame(() => {
|
|
164
195
|
if (shellState.workspace !== nextWorkspace) return;
|
|
165
|
-
|
|
196
|
+
const closeButton =
|
|
197
|
+
nextWorkspace === "schedules"
|
|
198
|
+
? dom.closeSchedulesWorkspaceButton
|
|
199
|
+
: dom.closeConfigWorkspaceButton;
|
|
200
|
+
closeButton?.focus();
|
|
166
201
|
});
|
|
167
202
|
return true;
|
|
168
203
|
}
|
|
@@ -198,6 +233,7 @@ export function createWorkspaceShell({
|
|
|
198
233
|
const useDrawer = open && sidebarViewport?.matches !== true;
|
|
199
234
|
shellState.activeSheet = useDrawer ? "sessions" : "";
|
|
200
235
|
syncShell();
|
|
236
|
+
onWorkspaceChange("chat");
|
|
201
237
|
|
|
202
238
|
if (options.focus === false) return true;
|
|
203
239
|
if (open) {
|
|
@@ -235,7 +271,7 @@ export function createWorkspaceShell({
|
|
|
235
271
|
setSessionsDrawerOpen(false, { restoreFocus: true });
|
|
236
272
|
return true;
|
|
237
273
|
}
|
|
238
|
-
if (shellState.workspace
|
|
274
|
+
if (["config", "schedules"].includes(shellState.workspace)) {
|
|
239
275
|
return activateWorkspace("chat");
|
|
240
276
|
}
|
|
241
277
|
return false;
|
|
@@ -244,12 +280,21 @@ export function createWorkspaceShell({
|
|
|
244
280
|
function bind() {
|
|
245
281
|
if (shellState.bound) return;
|
|
246
282
|
shellState.bound = true;
|
|
283
|
+
dom.homeWorkspaceButton?.addEventListener("click", () => {
|
|
284
|
+
activateWorkspace("home");
|
|
285
|
+
});
|
|
247
286
|
dom.chatWorkspaceButton.addEventListener("click", () => {
|
|
248
287
|
activateWorkspace("chat");
|
|
249
288
|
});
|
|
250
289
|
dom.configWorkspaceButton.addEventListener("click", () => {
|
|
251
290
|
activateWorkspace("config");
|
|
252
291
|
});
|
|
292
|
+
dom.schedulesWorkspaceButton?.addEventListener("click", () =>
|
|
293
|
+
activateWorkspace("schedules"),
|
|
294
|
+
);
|
|
295
|
+
dom.closeSchedulesWorkspaceButton?.addEventListener("click", () =>
|
|
296
|
+
activateWorkspace("chat"),
|
|
297
|
+
);
|
|
253
298
|
dom.closeConfigWorkspaceButton.addEventListener("click", () => {
|
|
254
299
|
activateWorkspace("chat");
|
|
255
300
|
});
|
|
@@ -273,6 +318,7 @@ export function createWorkspaceShell({
|
|
|
273
318
|
}
|
|
274
319
|
|
|
275
320
|
return {
|
|
321
|
+
activeWorkspace: () => shellState.workspace,
|
|
276
322
|
activateOperationsTab: operationsSection.activateTab,
|
|
277
323
|
activateWorkspace,
|
|
278
324
|
bind,
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { createConfigWorkspace } from "./components/config-workspace.js";
|
|
2
|
+
import { createLongTermMemorySetup } from "./components/long-term-memory-setup.js";
|
|
3
|
+
import { createLongTermMemoryManager } from "./components/long-term-memory/manager.js";
|
|
4
|
+
import { createLongTermMemoryController } from "./controllers/long-term-memory/controller.js";
|
|
5
|
+
|
|
6
|
+
export function createConfigurationFeature({
|
|
7
|
+
dom,
|
|
8
|
+
runtimeClient,
|
|
9
|
+
selectedEnvironmentId,
|
|
10
|
+
recordControlEvent,
|
|
11
|
+
}) {
|
|
12
|
+
let configWorkspace;
|
|
13
|
+
const longTermMemorySetup = createLongTermMemorySetup({
|
|
14
|
+
getEnvironmentId: selectedEnvironmentId,
|
|
15
|
+
loadStatus: (environmentId) =>
|
|
16
|
+
runtimeClient.loadLongTermMemoryStatus(environmentId),
|
|
17
|
+
discoverModels: (providerId, environmentId) =>
|
|
18
|
+
runtimeClient.discoverLongTermMemoryModels({
|
|
19
|
+
environmentId,
|
|
20
|
+
providerId,
|
|
21
|
+
}),
|
|
22
|
+
enableMemory: (input, environmentId) =>
|
|
23
|
+
runtimeClient.enableLongTermMemory({
|
|
24
|
+
environmentId,
|
|
25
|
+
...input,
|
|
26
|
+
}),
|
|
27
|
+
disableMemory: (environmentId) =>
|
|
28
|
+
runtimeClient.disableLongTermMemory(environmentId),
|
|
29
|
+
recordControlEvent,
|
|
30
|
+
beginRuntimeMutation: () =>
|
|
31
|
+
configWorkspace?.beginExternalRuntimeMutation() ?? false,
|
|
32
|
+
refreshRuntimeConfig: () =>
|
|
33
|
+
configWorkspace?.refreshAfterExternalRuntimeMutation() ??
|
|
34
|
+
Promise.resolve(false),
|
|
35
|
+
endRuntimeMutation: () => configWorkspace?.endExternalRuntimeMutation(),
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
let longTermMemoryManager;
|
|
39
|
+
const longTermMemoryController = createLongTermMemoryController({
|
|
40
|
+
client: runtimeClient,
|
|
41
|
+
getEnvironmentId: selectedEnvironmentId,
|
|
42
|
+
render: (snapshot) => longTermMemoryManager?.render(snapshot),
|
|
43
|
+
});
|
|
44
|
+
longTermMemoryManager = createLongTermMemoryManager({
|
|
45
|
+
actions: longTermMemoryController,
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
configWorkspace = createConfigWorkspace({
|
|
49
|
+
dom: {
|
|
50
|
+
refreshConfigButton: dom.refreshConfigButton,
|
|
51
|
+
configStatus: dom.configStatus,
|
|
52
|
+
configDashboard: dom.configDashboard,
|
|
53
|
+
},
|
|
54
|
+
loadDashboard: () =>
|
|
55
|
+
runtimeClient.loadConfigDashboard(selectedEnvironmentId()),
|
|
56
|
+
saveFile: ({ kind, id, config }) =>
|
|
57
|
+
runtimeClient.saveConfigFile({
|
|
58
|
+
environmentId: selectedEnvironmentId(),
|
|
59
|
+
kind,
|
|
60
|
+
id,
|
|
61
|
+
config,
|
|
62
|
+
}),
|
|
63
|
+
memorySetup: longTermMemorySetup,
|
|
64
|
+
memoryManagement: {
|
|
65
|
+
load: () => longTermMemoryController.load(),
|
|
66
|
+
mount: (root) => longTermMemoryManager.mount(root),
|
|
67
|
+
},
|
|
68
|
+
recordControlEvent,
|
|
69
|
+
});
|
|
70
|
+
|
|
71
|
+
return configWorkspace;
|
|
72
|
+
}
|
|
@@ -72,6 +72,7 @@ export interface ComposerAttachmentsControllerOptions {
|
|
|
72
72
|
onSendStateChange: () => void;
|
|
73
73
|
onControlEvent: (event: ComposerAttachmentControlEvent) => void;
|
|
74
74
|
isComposerAvailable?: () => boolean;
|
|
75
|
+
isComposerVisible?: () => boolean;
|
|
75
76
|
}
|
|
76
77
|
|
|
77
78
|
export interface ComposerAttachmentsController {
|
|
@@ -15,6 +15,7 @@ export function createComposerAttachmentsController({
|
|
|
15
15
|
onSendStateChange,
|
|
16
16
|
onControlEvent,
|
|
17
17
|
isComposerAvailable = () => true,
|
|
18
|
+
isComposerVisible = () => true,
|
|
18
19
|
}) {
|
|
19
20
|
function attachmentSessionId(attachment) {
|
|
20
21
|
const explicitSessionId = textOf(attachment.sessionId).trim();
|
|
@@ -108,6 +109,7 @@ export function createComposerAttachmentsController({
|
|
|
108
109
|
}
|
|
109
110
|
|
|
110
111
|
function render() {
|
|
112
|
+
if (!isComposerVisible()) return;
|
|
111
113
|
const available = isComposerAvailable();
|
|
112
114
|
dom.attachmentButton.disabled = !available;
|
|
113
115
|
dom.attachmentButton.title = !available
|
|
@@ -164,6 +166,14 @@ export function createComposerAttachmentsController({
|
|
|
164
166
|
if (options.cleanup !== false) cleanup(attachments);
|
|
165
167
|
}
|
|
166
168
|
|
|
169
|
+
function canRetainUploadedAttachment(scope) {
|
|
170
|
+
if (state.currentSessionId !== scope.sessionId) return false;
|
|
171
|
+
if (selectedEnvironmentId() !== scope.environmentId) return false;
|
|
172
|
+
if (state.composerAttachmentGeneration !== scope.generation) return false;
|
|
173
|
+
if (!scope.imageAttachment) return true;
|
|
174
|
+
return selectedModelSupportsImageInput();
|
|
175
|
+
}
|
|
176
|
+
|
|
167
177
|
async function upload(file) {
|
|
168
178
|
if (!isComposerAvailable()) {
|
|
169
179
|
throw new Error("Configure a provider and model before attaching files.");
|
|
@@ -196,12 +206,13 @@ export function createComposerAttachmentsController({
|
|
|
196
206
|
sessionId: uploadSessionId,
|
|
197
207
|
environment: uploadEnvironmentId,
|
|
198
208
|
};
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
209
|
+
const uploadScope = {
|
|
210
|
+
sessionId: uploadSessionId,
|
|
211
|
+
environmentId: uploadEnvironmentId,
|
|
212
|
+
generation: uploadGeneration,
|
|
213
|
+
imageAttachment,
|
|
214
|
+
};
|
|
215
|
+
if (!canRetainUploadedAttachment(uploadScope)) {
|
|
205
216
|
void deletePending(attachment);
|
|
206
217
|
return;
|
|
207
218
|
}
|
|
@@ -10,6 +10,7 @@ export interface ComposerSubmitState {
|
|
|
10
10
|
pendingAttachments: readonly unknown[];
|
|
11
11
|
composerSending: boolean;
|
|
12
12
|
currentSessionId: string;
|
|
13
|
+
sessionViewVersion?: number;
|
|
13
14
|
}
|
|
14
15
|
|
|
15
16
|
export interface ComposerSubmitDom {
|
|
@@ -64,6 +65,7 @@ export interface ComposerSubmitControllerOptions {
|
|
|
64
65
|
setMessageStatus: (message: string, busy?: boolean) => void;
|
|
65
66
|
getSubmissionBlock?: () => ComposerSubmissionBlock | null;
|
|
66
67
|
onSubmissionBlocked?: (block: ComposerSubmissionBlock) => void;
|
|
68
|
+
isComposerVisible?: () => boolean;
|
|
67
69
|
}
|
|
68
70
|
|
|
69
71
|
export interface ComposerSubmitController {
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { captureComposerSubmissionScope, isCurrentComposerSubmissionScope } from "../lib/composer-submission-scope.js";
|
|
1
2
|
import { resolveComposerPrimaryAction } from "../ui-behavior.js";
|
|
2
3
|
|
|
3
4
|
export function createComposerSubmitController({
|
|
@@ -13,8 +14,10 @@ export function createComposerSubmitController({
|
|
|
13
14
|
setMessageStatus,
|
|
14
15
|
getSubmissionBlock = () => null,
|
|
15
16
|
onSubmissionBlocked = () => {},
|
|
17
|
+
isComposerVisible = () => true,
|
|
16
18
|
}) {
|
|
17
19
|
function resize() {
|
|
20
|
+
if (!isComposerVisible()) return;
|
|
18
21
|
dom.composerInput.style.height = "auto";
|
|
19
22
|
dom.composerInput.style.height = `${Math.min(
|
|
20
23
|
dom.composerInput.scrollHeight,
|
|
@@ -23,6 +26,7 @@ export function createComposerSubmitController({
|
|
|
23
26
|
}
|
|
24
27
|
|
|
25
28
|
function updateSendState() {
|
|
29
|
+
if (!isComposerVisible()) return;
|
|
26
30
|
const queueDraining = queue.isCurrentDraining();
|
|
27
31
|
const submissionBlock = getSubmissionBlock();
|
|
28
32
|
composerActions.render({
|
|
@@ -40,6 +44,7 @@ export function createComposerSubmitController({
|
|
|
40
44
|
}
|
|
41
45
|
|
|
42
46
|
function dispatch(requestedAction = "") {
|
|
47
|
+
if (!isComposerVisible()) return;
|
|
43
48
|
const text = dom.composerInput.value.trim();
|
|
44
49
|
const submissionBlock = getSubmissionBlock();
|
|
45
50
|
if (text && submissionBlock) {
|
|
@@ -84,8 +89,15 @@ export function createComposerSubmitController({
|
|
|
84
89
|
: action === "send_next"
|
|
85
90
|
? queue.enqueue(text)
|
|
86
91
|
: chatRequests.sendMessage(text);
|
|
92
|
+
const completionScope = captureComposerSubmissionScope(
|
|
93
|
+
state, selectedEnvironmentId(),
|
|
94
|
+
);
|
|
95
|
+
const isSubmissionForCurrentComposerView = () => isCurrentComposerSubmissionScope(
|
|
96
|
+
completionScope, state, selectedEnvironmentId(),
|
|
97
|
+
);
|
|
87
98
|
void operation
|
|
88
99
|
.then(() => {
|
|
100
|
+
if (!isSubmissionForCurrentComposerView()) return;
|
|
89
101
|
if (action === "steer") {
|
|
90
102
|
setMessageStatus("Update accepted. ABot is working.", true);
|
|
91
103
|
} else if (action === "send_next") {
|
|
@@ -93,14 +105,16 @@ export function createComposerSubmitController({
|
|
|
93
105
|
}
|
|
94
106
|
})
|
|
95
107
|
.catch((error) => {
|
|
108
|
+
if (!isSubmissionForCurrentComposerView()) return;
|
|
96
109
|
if (action !== "send") queue.restoreText(text, submissionScope);
|
|
97
110
|
conversationSession.appendRequestError(error);
|
|
98
111
|
setMessageStatus("ABot request failed.");
|
|
99
112
|
})
|
|
100
113
|
.finally(() => {
|
|
114
|
+
if (!isSubmissionForCurrentComposerView()) return;
|
|
101
115
|
state.composerSending = false;
|
|
102
116
|
updateSendState();
|
|
103
|
-
dom.composerInput.focus();
|
|
117
|
+
if (isComposerVisible()) dom.composerInput.focus();
|
|
104
118
|
});
|
|
105
119
|
}
|
|
106
120
|
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
export function createComposerSurfaceController({
|
|
2
|
+
workspace,
|
|
3
|
+
getHomeComposer,
|
|
4
|
+
getChatAttachments,
|
|
5
|
+
getChatSubmit,
|
|
6
|
+
rememberModelSelection,
|
|
7
|
+
showToast,
|
|
8
|
+
}) {
|
|
9
|
+
function activeSubmit() {
|
|
10
|
+
return workspace.isHome() ? getHomeComposer()?.submit : getChatSubmit();
|
|
11
|
+
}
|
|
12
|
+
function activeAttachments() {
|
|
13
|
+
return workspace.isHome()
|
|
14
|
+
? getHomeComposer()?.attachments
|
|
15
|
+
: getChatAttachments();
|
|
16
|
+
}
|
|
17
|
+
return {
|
|
18
|
+
renderAttachmentComposer() {
|
|
19
|
+
if (workspace.isHome()) {
|
|
20
|
+
getHomeComposer()?.render();
|
|
21
|
+
return;
|
|
22
|
+
}
|
|
23
|
+
getChatAttachments().render();
|
|
24
|
+
},
|
|
25
|
+
removeUnsupportedPendingImages() {
|
|
26
|
+
activeAttachments()?.removeUnsupportedImages();
|
|
27
|
+
},
|
|
28
|
+
updateComposerSendState() {
|
|
29
|
+
workspace.syncChatDraft();
|
|
30
|
+
activeSubmit()?.updateSendState();
|
|
31
|
+
},
|
|
32
|
+
resizeComposerInput() {
|
|
33
|
+
activeSubmit()?.resize();
|
|
34
|
+
},
|
|
35
|
+
async uploadComposerAttachment(file) {
|
|
36
|
+
if (!workspace.isHome()) {
|
|
37
|
+
await getChatAttachments().upload(file);
|
|
38
|
+
return;
|
|
39
|
+
}
|
|
40
|
+
try {
|
|
41
|
+
await getHomeComposer().upload(file);
|
|
42
|
+
} catch (error) {
|
|
43
|
+
showToast(
|
|
44
|
+
error instanceof Error ? error.message : String(error),
|
|
45
|
+
"failed",
|
|
46
|
+
);
|
|
47
|
+
}
|
|
48
|
+
},
|
|
49
|
+
dispatchComposerMessage(requestedAction = "") {
|
|
50
|
+
if (!workspace.isHome()) {
|
|
51
|
+
getChatSubmit().dispatch(requestedAction);
|
|
52
|
+
return;
|
|
53
|
+
}
|
|
54
|
+
rememberModelSelection();
|
|
55
|
+
getHomeComposer().dispatch();
|
|
56
|
+
},
|
|
57
|
+
};
|
|
58
|
+
}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
ComposerAttachment,
|
|
3
|
+
ComposerAttachmentsState,
|
|
4
|
+
} from "./composer-attachments-controller.js";
|
|
5
|
+
import type {
|
|
6
|
+
ComposerSubmitDom,
|
|
7
|
+
ComposerSubmitState,
|
|
8
|
+
} from "./composer-submit-controller.js";
|
|
9
|
+
|
|
10
|
+
export interface ComposerWorkspaceDom extends ComposerSubmitDom {
|
|
11
|
+
composerForm: HTMLElement;
|
|
12
|
+
runtimeSetupGuide?: HTMLElement;
|
|
13
|
+
[name: string]: unknown;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export type HomeComposerState = ComposerAttachmentsState &
|
|
17
|
+
ComposerSubmitState & {
|
|
18
|
+
environmentId: string;
|
|
19
|
+
text: string;
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
export interface HomeComposerDraft {
|
|
23
|
+
sessionId: string;
|
|
24
|
+
environmentId: string;
|
|
25
|
+
text: string;
|
|
26
|
+
attachments: ComposerAttachment[];
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export interface ComposerWorkspaceController<T extends ComposerWorkspaceDom = ComposerWorkspaceDom> {
|
|
30
|
+
chatDom: Omit<T, "composerInput"> & ComposerSubmitDom;
|
|
31
|
+
homeDom: Omit<T, "composerInput"> & ComposerSubmitDom;
|
|
32
|
+
homeState: HomeComposerState;
|
|
33
|
+
setWorkspace(workspace: string): void;
|
|
34
|
+
isHome(): boolean;
|
|
35
|
+
isChatVisible(): boolean;
|
|
36
|
+
composerSessionId(): string;
|
|
37
|
+
ensureHomeSession(): string;
|
|
38
|
+
resetHomeDraft(): void;
|
|
39
|
+
takeHomeDraft(text: string): HomeComposerDraft;
|
|
40
|
+
restoreHomeDraft(draft: HomeComposerDraft): void;
|
|
41
|
+
syncChatDraft(): void;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export declare function createComposerWorkspaceController<T extends ComposerWorkspaceDom>(
|
|
45
|
+
options: {
|
|
46
|
+
state: Pick<ComposerSubmitState, "currentSessionId">;
|
|
47
|
+
dom: T;
|
|
48
|
+
homeComposerHost: HTMLElement;
|
|
49
|
+
homeSetupHost?: HTMLElement;
|
|
50
|
+
selectedEnvironmentId(): string;
|
|
51
|
+
createSessionId?(): string;
|
|
52
|
+
},
|
|
53
|
+
): ComposerWorkspaceController<T>;
|
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
import { createWebSessionId } from "../lib/text-format.js";
|
|
2
|
+
|
|
3
|
+
export function createComposerWorkspaceController({
|
|
4
|
+
state,
|
|
5
|
+
dom,
|
|
6
|
+
homeComposerHost,
|
|
7
|
+
homeSetupHost,
|
|
8
|
+
selectedEnvironmentId,
|
|
9
|
+
createSessionId = createWebSessionId,
|
|
10
|
+
}) {
|
|
11
|
+
const surfaces = [{
|
|
12
|
+
element: dom.composerForm,
|
|
13
|
+
homeHost: homeComposerHost,
|
|
14
|
+
chatHost: dom.composerForm.parentElement,
|
|
15
|
+
nextSibling: dom.composerForm.nextSibling,
|
|
16
|
+
}];
|
|
17
|
+
if (homeSetupHost && dom.runtimeSetupGuide) {
|
|
18
|
+
surfaces.push({
|
|
19
|
+
element: dom.runtimeSetupGuide,
|
|
20
|
+
homeHost: homeSetupHost,
|
|
21
|
+
chatHost: dom.runtimeSetupGuide.parentElement,
|
|
22
|
+
nextSibling: dom.runtimeSetupGuide.nextSibling,
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
const chatDrafts = new Map();
|
|
26
|
+
const homeState = {
|
|
27
|
+
currentSessionId: "",
|
|
28
|
+
activeRequestId: "",
|
|
29
|
+
pendingAttachments: [],
|
|
30
|
+
pendingAttachmentUploadCounts: new Map(),
|
|
31
|
+
composerAttachmentGeneration: 0,
|
|
32
|
+
composerSending: false,
|
|
33
|
+
environmentId: selectedEnvironmentId(),
|
|
34
|
+
text: "",
|
|
35
|
+
};
|
|
36
|
+
let workspace = "chat";
|
|
37
|
+
let displayedSource = "chat";
|
|
38
|
+
let displayedChatKey = currentChatKey();
|
|
39
|
+
|
|
40
|
+
function currentChatKey() {
|
|
41
|
+
return JSON.stringify([selectedEnvironmentId(), state.currentSessionId]);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
function saveDisplayedText() {
|
|
45
|
+
if (displayedSource === "home") {
|
|
46
|
+
homeState.text = dom.composerInput.value;
|
|
47
|
+
return;
|
|
48
|
+
}
|
|
49
|
+
chatDrafts.set(displayedChatKey, dom.composerInput.value);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
function isHome() {
|
|
53
|
+
return workspace === "home";
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
function isChatVisible() {
|
|
57
|
+
return workspace === "chat";
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
function isCurrentChatInputDisplayed() {
|
|
61
|
+
if (displayedSource !== "chat") return false;
|
|
62
|
+
return displayedChatKey === currentChatKey();
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
function createInputSurface(source) {
|
|
66
|
+
const parkedStyle = { height: "" };
|
|
67
|
+
const isDisplayed = () =>
|
|
68
|
+
source === "home"
|
|
69
|
+
? displayedSource === "home"
|
|
70
|
+
: isCurrentChatInputDisplayed();
|
|
71
|
+
const isVisible = () => source === "home" ? isHome() : isChatVisible();
|
|
72
|
+
return {
|
|
73
|
+
get value() {
|
|
74
|
+
if (isDisplayed()) return dom.composerInput.value;
|
|
75
|
+
if (source === "home") return homeState.text;
|
|
76
|
+
return chatDrafts.get(currentChatKey()) || "";
|
|
77
|
+
},
|
|
78
|
+
set value(value) {
|
|
79
|
+
if (source === "home") homeState.text = value;
|
|
80
|
+
else chatDrafts.set(currentChatKey(), value);
|
|
81
|
+
if (isDisplayed()) dom.composerInput.value = value;
|
|
82
|
+
},
|
|
83
|
+
get style() {
|
|
84
|
+
return isDisplayed() ? dom.composerInput.style : parkedStyle;
|
|
85
|
+
},
|
|
86
|
+
get scrollHeight() {
|
|
87
|
+
return isDisplayed() ? dom.composerInput.scrollHeight : 0;
|
|
88
|
+
},
|
|
89
|
+
focus() {
|
|
90
|
+
if (!isVisible()) return;
|
|
91
|
+
if (isDisplayed()) dom.composerInput.focus();
|
|
92
|
+
},
|
|
93
|
+
};
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
function ensureHomeSession() {
|
|
97
|
+
if (!homeState.currentSessionId) {
|
|
98
|
+
homeState.currentSessionId = createSessionId();
|
|
99
|
+
}
|
|
100
|
+
return homeState.currentSessionId;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
function moveWorkspaceSurface(surface) {
|
|
104
|
+
if (isHome()) {
|
|
105
|
+
surface.homeHost.appendChild(surface.element);
|
|
106
|
+
return;
|
|
107
|
+
}
|
|
108
|
+
const nextSibling = surface.nextSibling?.parentElement === surface.chatHost
|
|
109
|
+
? surface.nextSibling
|
|
110
|
+
: null;
|
|
111
|
+
surface.chatHost.insertBefore(surface.element, nextSibling);
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
function setWorkspace(nextWorkspace) {
|
|
115
|
+
saveDisplayedText();
|
|
116
|
+
workspace = nextWorkspace;
|
|
117
|
+
displayedSource = isHome() ? "home" : "chat";
|
|
118
|
+
displayedChatKey = currentChatKey();
|
|
119
|
+
dom.composerInput.value = isHome()
|
|
120
|
+
? homeState.text
|
|
121
|
+
: chatDrafts.get(displayedChatKey) || "";
|
|
122
|
+
if (isHome()) ensureHomeSession();
|
|
123
|
+
for (const surface of surfaces) moveWorkspaceSurface(surface);
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
function syncChatDraft() {
|
|
127
|
+
if (displayedSource !== "chat") return;
|
|
128
|
+
if (isCurrentChatInputDisplayed()) return;
|
|
129
|
+
setWorkspace(workspace);
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
function resetHomeDraft() {
|
|
133
|
+
homeState.currentSessionId = "";
|
|
134
|
+
homeState.composerSending = false;
|
|
135
|
+
homeState.pendingAttachments = [];
|
|
136
|
+
homeState.composerAttachmentGeneration += 1;
|
|
137
|
+
homeState.pendingAttachmentUploadCounts.clear();
|
|
138
|
+
homeState.environmentId = selectedEnvironmentId();
|
|
139
|
+
homeState.text = "";
|
|
140
|
+
if (displayedSource === "home") dom.composerInput.value = "";
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
function takeHomeDraft(text) {
|
|
144
|
+
const draft = {
|
|
145
|
+
sessionId: ensureHomeSession(),
|
|
146
|
+
environmentId: homeState.environmentId,
|
|
147
|
+
text,
|
|
148
|
+
attachments: [...homeState.pendingAttachments],
|
|
149
|
+
};
|
|
150
|
+
resetHomeDraft();
|
|
151
|
+
return draft;
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
function restoreHomeDraft(draft) {
|
|
155
|
+
homeState.currentSessionId = draft.sessionId;
|
|
156
|
+
homeState.environmentId = draft.environmentId;
|
|
157
|
+
homeState.pendingAttachments = draft.attachments;
|
|
158
|
+
homeState.text = draft.text;
|
|
159
|
+
if (displayedSource === "home") dom.composerInput.value = draft.text;
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
function composerSessionId() {
|
|
163
|
+
return isHome() ? ensureHomeSession() : state.currentSessionId;
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
return {
|
|
167
|
+
chatDom: { ...dom, composerInput: createInputSurface("chat") },
|
|
168
|
+
homeDom: { ...dom, composerInput: createInputSurface("home") },
|
|
169
|
+
homeState,
|
|
170
|
+
setWorkspace,
|
|
171
|
+
isHome,
|
|
172
|
+
isChatVisible,
|
|
173
|
+
composerSessionId,
|
|
174
|
+
ensureHomeSession,
|
|
175
|
+
resetHomeDraft,
|
|
176
|
+
takeHomeDraft,
|
|
177
|
+
restoreHomeDraft,
|
|
178
|
+
syncChatDraft,
|
|
179
|
+
};
|
|
180
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
ConversationSessionClient,
|
|
3
|
+
ConversationSessionState,
|
|
4
|
+
} from "./conversation-session-controller.js";
|
|
5
|
+
|
|
6
|
+
export interface ConversationReadStateControllerOptions {
|
|
7
|
+
state: Pick<
|
|
8
|
+
ConversationSessionState,
|
|
9
|
+
"currentSessionId" | "sessionViewVersion" | "messages"
|
|
10
|
+
>;
|
|
11
|
+
client: Pick<ConversationSessionClient, "markSessionRead">;
|
|
12
|
+
selectedEnvironmentId(): string;
|
|
13
|
+
applyReadState(sessionId: string, readState: unknown): void;
|
|
14
|
+
recordControlEvent(event: Record<string, unknown>): void;
|
|
15
|
+
isConversationVisible?(): boolean;
|
|
16
|
+
scheduleTask?(callback: () => void): unknown;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export declare function createConversationReadStateController(
|
|
20
|
+
options: ConversationReadStateControllerOptions,
|
|
21
|
+
): {
|
|
22
|
+
markCurrentSessionReadSoon(): void;
|
|
23
|
+
};
|