@qduc/term2 0.20.0 → 0.21.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/dist/agent.d.ts.map +1 -1
- package/dist/agent.js +146 -94
- package/dist/agent.js.map +1 -1
- package/dist/app.d.ts +1 -1
- package/dist/app.d.ts.map +1 -1
- package/dist/app.js +62 -36
- package/dist/app.js.map +1 -1
- package/dist/cli.js +113 -36
- package/dist/cli.js.map +1 -1
- package/dist/commands/guarded-settings-command.d.ts.map +1 -1
- package/dist/commands/guarded-settings-command.js +33 -5
- package/dist/commands/guarded-settings-command.js.map +1 -1
- package/dist/commands/mode-commands.d.ts +17 -12
- package/dist/commands/mode-commands.d.ts.map +1 -1
- package/dist/commands/mode-commands.js +68 -44
- package/dist/commands/mode-commands.js.map +1 -1
- package/dist/components/input/ApplicationInputSurface.d.ts.map +1 -1
- package/dist/components/input/ApplicationInputSurface.js +4 -0
- package/dist/components/input/ApplicationInputSurface.js.map +1 -1
- package/dist/components/input/MenuSurface.d.ts.map +1 -1
- package/dist/components/input/MenuSurface.js +1 -0
- package/dist/components/input/MenuSurface.js.map +1 -1
- package/dist/components/input/ProfileMenuSession.d.ts +16 -0
- package/dist/components/input/ProfileMenuSession.d.ts.map +1 -0
- package/dist/components/input/ProfileMenuSession.js +64 -0
- package/dist/components/input/ProfileMenuSession.js.map +1 -0
- package/dist/components/input/determine-active-menu.d.ts +3 -0
- package/dist/components/input/determine-active-menu.d.ts.map +1 -1
- package/dist/components/input/determine-active-menu.js +6 -1
- package/dist/components/input/determine-active-menu.js.map +1 -1
- package/dist/components/input/menu-registry.d.ts.map +1 -1
- package/dist/components/input/menu-registry.js +2 -0
- package/dist/components/input/menu-registry.js.map +1 -1
- package/dist/components/input/menu-types.d.ts +4 -0
- package/dist/components/input/menu-types.d.ts.map +1 -1
- package/dist/components/input/triggers.d.ts +1 -0
- package/dist/components/input/triggers.d.ts.map +1 -1
- package/dist/components/input/triggers.js +26 -0
- package/dist/components/input/triggers.js.map +1 -1
- package/dist/components/layout/BackgroundTaskManager.d.ts.map +1 -1
- package/dist/components/layout/BackgroundTaskManager.js +6 -2
- package/dist/components/layout/BackgroundTaskManager.js.map +1 -1
- package/dist/components/layout/BackgroundTasksPanel.d.ts.map +1 -1
- package/dist/components/layout/BackgroundTasksPanel.js +16 -8
- package/dist/components/layout/BackgroundTasksPanel.js.map +1 -1
- package/dist/components/layout/Banner.d.ts.map +1 -1
- package/dist/components/layout/Banner.js +10 -5
- package/dist/components/layout/Banner.js.map +1 -1
- package/dist/components/layout/StatusBar.d.ts.map +1 -1
- package/dist/components/layout/StatusBar.js +25 -12
- package/dist/components/layout/StatusBar.js.map +1 -1
- package/dist/components/menu/ProfileSelectionMenu.d.ts +12 -0
- package/dist/components/menu/ProfileSelectionMenu.d.ts.map +1 -0
- package/dist/components/menu/ProfileSelectionMenu.js +48 -0
- package/dist/components/menu/ProfileSelectionMenu.js.map +1 -0
- package/dist/components/menu/ResumeSelectionMenu.d.ts.map +1 -1
- package/dist/components/menu/ResumeSelectionMenu.js +6 -14
- package/dist/components/menu/ResumeSelectionMenu.js.map +1 -1
- package/dist/components/message/ChatMessage.js +1 -1
- package/dist/components/message/ChatMessage.js.map +1 -1
- package/dist/components/message/MessageList.d.ts.map +1 -1
- package/dist/components/message/MessageList.js +15 -9
- package/dist/components/message/MessageList.js.map +1 -1
- package/dist/components/message/command-message-helpers.d.ts +5 -5
- package/dist/context/InputContext.d.ts +1 -1
- package/dist/context/InputContext.d.ts.map +1 -1
- package/dist/context/InputContext.js +8 -0
- package/dist/context/InputContext.js.map +1 -1
- package/dist/contracts/session-rollover.d.ts +9 -1
- package/dist/contracts/session-rollover.d.ts.map +1 -1
- package/dist/contracts/streamed-model-turn.d.ts +20 -2
- package/dist/contracts/streamed-model-turn.d.ts.map +1 -1
- package/dist/gateway/gateway.d.ts.map +1 -1
- package/dist/gateway/gateway.js +19 -23
- package/dist/gateway/gateway.js.map +1 -1
- package/dist/gateway/launcher-seam.d.ts.map +1 -1
- package/dist/gateway/launcher-seam.js +2 -19
- package/dist/gateway/launcher-seam.js.map +1 -1
- package/dist/gateway/settings-rpc.d.ts +1 -1
- package/dist/gateway/settings-rpc.d.ts.map +1 -1
- package/dist/gateway/settings-rpc.js +2 -0
- package/dist/gateway/settings-rpc.js.map +1 -1
- package/dist/hooks/settings-completion-config.d.ts.map +1 -1
- package/dist/hooks/settings-completion-config.js +25 -1
- package/dist/hooks/settings-completion-config.js.map +1 -1
- package/dist/hooks/use-app-commands.d.ts +3 -1
- package/dist/hooks/use-app-commands.d.ts.map +1 -1
- package/dist/hooks/use-app-commands.js +21 -14
- package/dist/hooks/use-app-commands.js.map +1 -1
- package/dist/hooks/use-conversation.d.ts +2 -2
- package/dist/hooks/use-conversation.d.ts.map +1 -1
- package/dist/hooks/use-conversation.js +1 -1
- package/dist/hooks/use-conversation.js.map +1 -1
- package/dist/hooks/use-handoff-flow.d.ts +1 -0
- package/dist/hooks/use-handoff-flow.d.ts.map +1 -1
- package/dist/hooks/use-handoff-flow.js +19 -12
- package/dist/hooks/use-handoff-flow.js.map +1 -1
- package/dist/hooks/use-profile-selection.d.ts +34 -0
- package/dist/hooks/use-profile-selection.d.ts.map +1 -0
- package/dist/hooks/use-profile-selection.js +103 -0
- package/dist/hooks/use-profile-selection.js.map +1 -0
- package/dist/hooks/use-resume-selection.d.ts +2 -0
- package/dist/hooks/use-resume-selection.d.ts.map +1 -1
- package/dist/hooks/use-resume-selection.js +11 -9
- package/dist/hooks/use-resume-selection.js.map +1 -1
- package/dist/hooks/use-settings-value-completion.d.ts.map +1 -1
- package/dist/hooks/use-settings-value-completion.js +16 -0
- package/dist/hooks/use-settings-value-completion.js.map +1 -1
- package/dist/hooks/use-skill-selection.d.ts +5 -3
- package/dist/hooks/use-skill-selection.d.ts.map +1 -1
- package/dist/hooks/use-skill-selection.js +8 -6
- package/dist/hooks/use-skill-selection.js.map +1 -1
- package/dist/lib/agent-client.d.ts.map +1 -1
- package/dist/lib/agent-client.js +50 -14
- package/dist/lib/agent-client.js.map +1 -1
- package/dist/lib/agent-configuration.d.ts.map +1 -1
- package/dist/lib/agent-configuration.js +1 -4
- package/dist/lib/agent-configuration.js.map +1 -1
- package/dist/lib/agent-factory.d.ts.map +1 -1
- package/dist/lib/agent-factory.js +63 -41
- package/dist/lib/agent-factory.js.map +1 -1
- package/dist/lib/harness-input-idle.d.ts +10 -0
- package/dist/lib/harness-input-idle.d.ts.map +1 -1
- package/dist/lib/harness-input-idle.js +47 -5
- package/dist/lib/harness-input-idle.js.map +1 -1
- package/dist/non-interactive.d.ts.map +1 -1
- package/dist/non-interactive.js +6 -6
- package/dist/non-interactive.js.map +1 -1
- package/dist/prompts/memory.md +1 -1
- package/dist/prompts/prefix-quality.test.ts +8 -5
- package/dist/prompts/prompt-constructor.d.ts +5 -6
- package/dist/prompts/prompt-constructor.d.ts.map +1 -1
- package/dist/prompts/prompt-constructor.js +15 -7
- package/dist/prompts/prompt-constructor.js.map +1 -1
- package/dist/prompts/prompt-constructor.test.ts +73 -48
- package/dist/prompts/prompt-constructor.ts +21 -13
- package/dist/prompts/session-browser.md +2 -0
- package/dist/prompts/shell-auto-approval.d.ts +2 -2
- package/dist/prompts/shell-auto-approval.d.ts.map +1 -1
- package/dist/prompts/shell-auto-approval.js +19 -16
- package/dist/prompts/shell-auto-approval.js.map +1 -1
- package/dist/prompts/shell-auto-approval.ts +19 -16
- package/dist/providers/aborted-stream-recorder.js +2 -1
- package/dist/providers/aborted-stream-recorder.js.map +1 -1
- package/dist/providers/ai-sdk-streamed-model.d.ts.map +1 -1
- package/dist/providers/ai-sdk-streamed-model.js +7 -0
- package/dist/providers/ai-sdk-streamed-model.js.map +1 -1
- package/dist/providers/codex-responses-model.d.ts.map +1 -1
- package/dist/providers/codex-responses-model.js +75 -14
- package/dist/providers/codex-responses-model.js.map +1 -1
- package/dist/providers/codex-turn-converter.d.ts.map +1 -1
- package/dist/providers/codex-turn-converter.js +21 -4
- package/dist/providers/codex-turn-converter.js.map +1 -1
- package/dist/providers/codex.provider.d.ts.map +1 -1
- package/dist/providers/codex.provider.js +1 -0
- package/dist/providers/codex.provider.js.map +1 -1
- package/dist/providers/fetch/logging-middleware.d.ts.map +1 -1
- package/dist/providers/fetch/logging-middleware.js +22 -2
- package/dist/providers/fetch/logging-middleware.js.map +1 -1
- package/dist/providers/openai-chat-completions-model.js +119 -50
- package/dist/providers/openai-chat-completions-model.js.map +1 -1
- package/dist/providers/openai-responses-model.d.ts.map +1 -1
- package/dist/providers/openai-responses-model.js +131 -15
- package/dist/providers/openai-responses-model.js.map +1 -1
- package/dist/providers/registry.d.ts +1 -1
- package/dist/providers/registry.d.ts.map +1 -1
- package/dist/providers/retrying-model.d.ts.map +1 -1
- package/dist/providers/retrying-model.js +11 -2
- package/dist/providers/retrying-model.js.map +1 -1
- package/dist/services/agent-runtime/application-run-loop.d.ts +3 -1
- package/dist/services/agent-runtime/application-run-loop.d.ts.map +1 -1
- package/dist/services/agent-runtime/application-run-loop.js +99 -19
- package/dist/services/agent-runtime/application-run-loop.js.map +1 -1
- package/dist/services/agent-runtime/context-compaction/context-milestone-reminder.d.ts +2 -3
- package/dist/services/agent-runtime/context-compaction/context-milestone-reminder.d.ts.map +1 -1
- package/dist/services/agent-runtime/context-compaction/context-milestone-reminder.js +18 -9
- package/dist/services/agent-runtime/context-compaction/context-milestone-reminder.js.map +1 -1
- package/dist/services/agent-runtime/generation-guard.d.ts +25 -1
- package/dist/services/agent-runtime/generation-guard.d.ts.map +1 -1
- package/dist/services/agent-runtime/generation-guard.js +105 -1
- package/dist/services/agent-runtime/generation-guard.js.map +1 -1
- package/dist/services/agent-stream.d.ts +2 -0
- package/dist/services/agent-stream.d.ts.map +1 -1
- package/dist/services/agent-stream.js.map +1 -1
- package/dist/services/approval/approval-decision-policy.js +2 -2
- package/dist/services/approval/approval-decision-policy.js.map +1 -1
- package/dist/services/approval/shell-auto-approval-evaluator.d.ts +5 -1
- package/dist/services/approval/shell-auto-approval-evaluator.d.ts.map +1 -1
- package/dist/services/approval/shell-auto-approval-evaluator.js +42 -18
- package/dist/services/approval/shell-auto-approval-evaluator.js.map +1 -1
- package/dist/services/approval/shell-auto-approval-resolver.d.ts +5 -0
- package/dist/services/approval/shell-auto-approval-resolver.d.ts.map +1 -1
- package/dist/services/approval/shell-auto-approval-resolver.js +117 -20
- package/dist/services/approval/shell-auto-approval-resolver.js.map +1 -1
- package/dist/services/approval/tool-approval-batch-coordinator.d.ts.map +1 -1
- package/dist/services/approval/tool-approval-batch-coordinator.js +20 -3
- package/dist/services/approval/tool-approval-batch-coordinator.js.map +1 -1
- package/dist/services/conversation/conversation-adapter.d.ts.map +1 -1
- package/dist/services/conversation/conversation-adapter.js +2 -9
- package/dist/services/conversation/conversation-adapter.js.map +1 -1
- package/dist/services/conversation/conversation-decoder.d.ts.map +1 -1
- package/dist/services/conversation/conversation-decoder.js +6 -2
- package/dist/services/conversation/conversation-decoder.js.map +1 -1
- package/dist/services/conversation/conversation-orchestrator.d.ts.map +1 -1
- package/dist/services/conversation/conversation-orchestrator.js +14 -1
- package/dist/services/conversation/conversation-orchestrator.js.map +1 -1
- package/dist/services/conversation/conversation-persistence.d.ts +30 -0
- package/dist/services/conversation/conversation-persistence.d.ts.map +1 -1
- package/dist/services/conversation/conversation-persistence.js +101 -7
- package/dist/services/conversation/conversation-persistence.js.map +1 -1
- package/dist/services/conversation/conversation-replay.d.ts +2 -0
- package/dist/services/conversation/conversation-replay.d.ts.map +1 -1
- package/dist/services/conversation/conversation-replay.js +71 -57
- package/dist/services/conversation/conversation-replay.js.map +1 -1
- package/dist/services/conversation/conversation-result-builder.d.ts.map +1 -1
- package/dist/services/conversation/conversation-result-builder.js +21 -4
- package/dist/services/conversation/conversation-result-builder.js.map +1 -1
- package/dist/services/conversation/conversation-service.d.ts +3 -2
- package/dist/services/conversation/conversation-service.d.ts.map +1 -1
- package/dist/services/conversation/conversation-service.js +36 -15
- package/dist/services/conversation/conversation-service.js.map +1 -1
- package/dist/services/conversation/session-browser.d.ts +6 -1
- package/dist/services/conversation/session-browser.d.ts.map +1 -1
- package/dist/services/conversation/session-browser.js +128 -18
- package/dist/services/conversation/session-browser.js.map +1 -1
- package/dist/services/handoff/handoff-session.d.ts +2 -0
- package/dist/services/handoff/handoff-session.d.ts.map +1 -1
- package/dist/services/handoff/handoff-session.js +19 -3
- package/dist/services/handoff/handoff-session.js.map +1 -1
- package/dist/services/logging/conversation-log-events.d.ts +30 -3
- package/dist/services/logging/conversation-log-events.d.ts.map +1 -1
- package/dist/services/logging/conversation-log-events.js +1 -4
- package/dist/services/logging/conversation-log-events.js.map +1 -1
- package/dist/services/logging/logging-service.d.ts +1 -0
- package/dist/services/logging/logging-service.d.ts.map +1 -1
- package/dist/services/logging/logging-service.js +5 -2
- package/dist/services/logging/logging-service.js.map +1 -1
- package/dist/services/logging/provider-traffic.d.ts +8 -1
- package/dist/services/logging/provider-traffic.d.ts.map +1 -1
- package/dist/services/logging/provider-traffic.js +105 -10
- package/dist/services/logging/provider-traffic.js.map +1 -1
- package/dist/services/memory/memory-capabilities.d.ts.map +1 -1
- package/dist/services/memory/memory-capabilities.js +17 -5
- package/dist/services/memory/memory-capabilities.js.map +1 -1
- package/dist/services/memory/memory-store.d.ts +17 -0
- package/dist/services/memory/memory-store.d.ts.map +1 -1
- package/dist/services/memory/memory-store.js +71 -26
- package/dist/services/memory/memory-store.js.map +1 -1
- package/dist/services/mode-notices.d.ts +12 -9
- package/dist/services/mode-notices.d.ts.map +1 -1
- package/dist/services/mode-notices.js +83 -54
- package/dist/services/mode-notices.js.map +1 -1
- package/dist/services/model-service.d.ts +22 -4
- package/dist/services/model-service.d.ts.map +1 -1
- package/dist/services/model-service.js +148 -1
- package/dist/services/model-service.js.map +1 -1
- package/dist/services/models/model-catalog-session.d.ts +6 -0
- package/dist/services/models/model-catalog-session.d.ts.map +1 -1
- package/dist/services/models/model-catalog-session.js +7 -3
- package/dist/services/models/model-catalog-session.js.map +1 -1
- package/dist/services/models/model-listing.d.ts +57 -0
- package/dist/services/models/model-listing.d.ts.map +1 -0
- package/dist/services/models/model-listing.js +96 -0
- package/dist/services/models/model-listing.js.map +1 -0
- package/dist/services/models/model-resolution.d.ts +88 -0
- package/dist/services/models/model-resolution.d.ts.map +1 -0
- package/dist/services/models/model-resolution.js +292 -0
- package/dist/services/models/model-resolution.js.map +1 -0
- package/dist/services/plan-mode-interceptor.d.ts.map +1 -1
- package/dist/services/plan-mode-interceptor.js +5 -6
- package/dist/services/plan-mode-interceptor.js.map +1 -1
- package/dist/services/profiles/active-profile.d.ts +5 -0
- package/dist/services/profiles/active-profile.d.ts.map +1 -0
- package/dist/services/profiles/active-profile.js +33 -0
- package/dist/services/profiles/active-profile.js.map +1 -0
- package/dist/services/profiles/index.d.ts +9 -0
- package/dist/services/profiles/index.d.ts.map +1 -0
- package/dist/services/profiles/index.js +9 -0
- package/dist/services/profiles/index.js.map +1 -0
- package/dist/services/profiles/labels.d.ts +7 -0
- package/dist/services/profiles/labels.d.ts.map +1 -0
- package/dist/services/profiles/labels.js +22 -0
- package/dist/services/profiles/labels.js.map +1 -0
- package/dist/services/profiles/legacy-adapter.d.ts +28 -0
- package/dist/services/profiles/legacy-adapter.d.ts.map +1 -0
- package/dist/services/profiles/legacy-adapter.js +69 -0
- package/dist/services/profiles/legacy-adapter.js.map +1 -0
- package/dist/services/profiles/profile-transition.d.ts +48 -0
- package/dist/services/profiles/profile-transition.d.ts.map +1 -0
- package/dist/services/profiles/profile-transition.js +109 -0
- package/dist/services/profiles/profile-transition.js.map +1 -0
- package/dist/services/profiles/registry.d.ts +17 -0
- package/dist/services/profiles/registry.d.ts.map +1 -0
- package/dist/services/profiles/registry.js +147 -0
- package/dist/services/profiles/registry.js.map +1 -0
- package/dist/services/profiles/resolver.d.ts +10 -0
- package/dist/services/profiles/resolver.d.ts.map +1 -0
- package/dist/services/profiles/resolver.js +573 -0
- package/dist/services/profiles/resolver.js.map +1 -0
- package/dist/services/profiles/schema.d.ts +960 -0
- package/dist/services/profiles/schema.d.ts.map +1 -0
- package/dist/services/profiles/schema.js +196 -0
- package/dist/services/profiles/schema.js.map +1 -0
- package/dist/services/profiles/types.d.ts +224 -0
- package/dist/services/profiles/types.d.ts.map +1 -0
- package/dist/services/profiles/types.js +9 -0
- package/dist/services/profiles/types.js.map +1 -0
- package/dist/services/retry/committed-tool-continuation.d.ts +5 -0
- package/dist/services/retry/committed-tool-continuation.d.ts.map +1 -1
- package/dist/services/retry/committed-tool-continuation.js +6 -3
- package/dist/services/retry/committed-tool-continuation.js.map +1 -1
- package/dist/services/retry/retry-classifier.d.ts.map +1 -1
- package/dist/services/retry/retry-classifier.js +13 -10
- package/dist/services/retry/retry-classifier.js.map +1 -1
- package/dist/services/retry/retry-error-classification.d.ts +7 -0
- package/dist/services/retry/retry-error-classification.d.ts.map +1 -1
- package/dist/services/retry/retry-error-classification.js +32 -9
- package/dist/services/retry/retry-error-classification.js.map +1 -1
- package/dist/services/runtime-setting-router.d.ts.map +1 -1
- package/dist/services/runtime-setting-router.js +76 -23
- package/dist/services/runtime-setting-router.js.map +1 -1
- package/dist/services/session/initial-turn-recovery-handler.js +4 -4
- package/dist/services/session/initial-turn-recovery-handler.js.map +1 -1
- package/dist/services/session/session-input-planner.d.ts.map +1 -1
- package/dist/services/session/session-input-planner.js +2 -9
- package/dist/services/session/session-input-planner.js.map +1 -1
- package/dist/services/session/session-manager.d.ts.map +1 -1
- package/dist/services/session/session-manager.js +4 -1
- package/dist/services/session/session-manager.js.map +1 -1
- package/dist/services/session-rollover/session-rollover-brief.d.ts +2 -1
- package/dist/services/session-rollover/session-rollover-brief.d.ts.map +1 -1
- package/dist/services/session-rollover/session-rollover-brief.js +5 -3
- package/dist/services/session-rollover/session-rollover-brief.js.map +1 -1
- package/dist/services/settings/settings-persistence.js +1 -1
- package/dist/services/settings/settings-persistence.js.map +1 -1
- package/dist/services/settings/settings-schema.d.ts +124 -15
- package/dist/services/settings/settings-schema.d.ts.map +1 -1
- package/dist/services/settings/settings-schema.js +110 -26
- package/dist/services/settings/settings-schema.js.map +1 -1
- package/dist/services/settings/settings-service.d.ts +3 -1
- package/dist/services/settings/settings-service.d.ts.map +1 -1
- package/dist/services/settings/settings-service.js +88 -91
- package/dist/services/settings/settings-service.js.map +1 -1
- package/dist/services/settings/settings-sources.d.ts.map +1 -1
- package/dist/services/settings/settings-sources.js +13 -0
- package/dist/services/settings/settings-sources.js.map +1 -1
- package/dist/services/settings/test-helpers/settings-consumer-inventory.d.ts +2 -2
- package/dist/services/settings/test-helpers/settings-consumer-inventory.d.ts.map +1 -1
- package/dist/services/settings/test-helpers/settings-consumer-inventory.js +15 -0
- package/dist/services/settings/test-helpers/settings-consumer-inventory.js.map +1 -1
- package/dist/services/subagents/mentor-runner.d.ts.map +1 -1
- package/dist/services/subagents/mentor-runner.js +5 -2
- package/dist/services/subagents/mentor-runner.js.map +1 -1
- package/dist/services/subagents/subagent-notification-store.d.ts +10 -2
- package/dist/services/subagents/subagent-notification-store.d.ts.map +1 -1
- package/dist/services/subagents/subagent-notification-store.js +10 -5
- package/dist/services/subagents/subagent-notification-store.js.map +1 -1
- package/dist/services/subagents/tool-policy.d.ts.map +1 -1
- package/dist/services/subagents/tool-policy.js +10 -15
- package/dist/services/subagents/tool-policy.js.map +1 -1
- package/dist/services/tool-toggles.d.ts +20 -0
- package/dist/services/tool-toggles.d.ts.map +1 -0
- package/dist/services/tool-toggles.js +115 -0
- package/dist/services/tool-toggles.js.map +1 -0
- package/dist/slash-commands.d.ts +3 -0
- package/dist/slash-commands.d.ts.map +1 -1
- package/dist/slash-commands.js.map +1 -1
- package/dist/tools/agent/configure-task-check-in.d.ts +2 -0
- package/dist/tools/agent/configure-task-check-in.d.ts.map +1 -1
- package/dist/tools/agent/configure-task-check-in.js +14 -6
- package/dist/tools/agent/configure-task-check-in.js.map +1 -1
- package/dist/tools/file/apply-patch.d.ts +2 -15
- package/dist/tools/file/apply-patch.d.ts.map +1 -1
- package/dist/tools/file/apply-patch.js +163 -98
- package/dist/tools/file/apply-patch.js.map +1 -1
- package/dist/tools/file/upstream-apply-patch.d.ts +31 -0
- package/dist/tools/file/upstream-apply-patch.d.ts.map +1 -0
- package/dist/tools/file/upstream-apply-patch.js +123 -0
- package/dist/tools/file/upstream-apply-patch.js.map +1 -0
- package/dist/tools/format-helpers.d.ts +2 -0
- package/dist/tools/format-helpers.d.ts.map +1 -1
- package/dist/tools/format-helpers.js.map +1 -1
- package/dist/tools/session-browser/session-browser-tools.d.ts.map +1 -1
- package/dist/tools/session-browser/session-browser-tools.js +11 -1
- package/dist/tools/session-browser/session-browser-tools.js.map +1 -1
- package/dist/tools/session-rollover/session-rollover-tool.d.ts.map +1 -1
- package/dist/tools/session-rollover/session-rollover-tool.js +10 -1
- package/dist/tools/session-rollover/session-rollover-tool.js.map +1 -1
- package/dist/tools/system/shell.d.ts.map +1 -1
- package/dist/tools/system/shell.js +8 -2
- package/dist/tools/system/shell.js.map +1 -1
- package/dist/tools/types.d.ts +15 -2
- package/dist/tools/types.d.ts.map +1 -1
- package/dist/tools/types.js.map +1 -1
- package/dist/utils/ai/token-usage.d.ts +7 -0
- package/dist/utils/ai/token-usage.d.ts.map +1 -1
- package/dist/utils/ai/token-usage.js +6 -2
- package/dist/utils/ai/token-usage.js.map +1 -1
- package/dist/utils/conversation/conversation-utils.d.ts.map +1 -1
- package/dist/utils/conversation/conversation-utils.js +40 -1
- package/dist/utils/conversation/conversation-utils.js.map +1 -1
- package/dist/utils/conversation/message-buffer.d.ts +16 -0
- package/dist/utils/conversation/message-buffer.d.ts.map +1 -1
- package/dist/utils/conversation/message-buffer.js +33 -0
- package/dist/utils/conversation/message-buffer.js.map +1 -1
- package/dist/utils/output/trim-tool-output.d.ts +1 -1
- package/dist/utils/output/trim-tool-output.d.ts.map +1 -1
- package/dist/utils/output/trim-tool-output.js +20 -0
- package/dist/utils/output/trim-tool-output.js.map +1 -1
- package/dist/utils/resume-list.d.ts +2 -0
- package/dist/utils/resume-list.d.ts.map +1 -1
- package/dist/utils/resume-list.js +7 -14
- package/dist/utils/resume-list.js.map +1 -1
- package/dist/utils/settings-command.d.ts.map +1 -1
- package/dist/utils/settings-command.js +95 -9
- package/dist/utils/settings-command.js.map +1 -1
- package/dist/utils/streaming/streaming-session-factory.d.ts.map +1 -1
- package/dist/utils/streaming/streaming-session-factory.js +12 -0
- package/dist/utils/streaming/streaming-session-factory.js.map +1 -1
- package/dist/utils/streaming/streaming-speed-tracker.d.ts +15 -0
- package/dist/utils/streaming/streaming-speed-tracker.d.ts.map +1 -1
- package/dist/utils/streaming/streaming-speed-tracker.js +18 -1
- package/dist/utils/streaming/streaming-speed-tracker.js.map +1 -1
- package/package.json +3 -3
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../../source/services/profiles/schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EACV,2BAA2B,EAC3B,qBAAqB,EACrB,iBAAiB,EACjB,YAAY,EACZ,eAAe,EAChB,MAAM,YAAY,CAAC;AA+FpB,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;oBAS7B,CAAC;AAEH,eAAO,MAAM,uBAAuB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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qBAAqB,CAKzE;AAED,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,YAAY,GAAG,KAAK,IAAI;IAAE,GAAG,EAAE,MAAM,CAAC;IAAC,IAAI,CAAC,EAAE,OAAO,YAAY,EAAE,SAAS,CAAA;CAAE,CAErH"}
|
|
@@ -0,0 +1,196 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
const id = z.string().regex(/^[a-z][a-z0-9_-]*:[a-z0-9][a-z0-9_./-]*$/i, 'must be a namespaced ID');
|
|
3
|
+
const localId = z
|
|
4
|
+
.string()
|
|
5
|
+
.min(1)
|
|
6
|
+
.regex(/^[a-zA-Z0-9][a-zA-Z0-9_.-]*$/);
|
|
7
|
+
const operation = z.enum(['replace', 'before', 'after', 'remove']);
|
|
8
|
+
const referenceSchema = z
|
|
9
|
+
.object({
|
|
10
|
+
use: id,
|
|
11
|
+
kind: z
|
|
12
|
+
.enum(['instructions', 'context', 'tools', 'enforcement', 'integrations', 'presentation', 'requirements'])
|
|
13
|
+
.optional(),
|
|
14
|
+
})
|
|
15
|
+
.strict();
|
|
16
|
+
const instructionEntrySchema = z
|
|
17
|
+
.object({
|
|
18
|
+
id: localId.optional(),
|
|
19
|
+
use: id.optional(),
|
|
20
|
+
content: z.string().optional(),
|
|
21
|
+
systemOwned: z.literal('model-family-base').optional(),
|
|
22
|
+
operation: operation.optional(),
|
|
23
|
+
})
|
|
24
|
+
.strict()
|
|
25
|
+
.refine((entry) => entry.operation === 'remove'
|
|
26
|
+
? Boolean(entry.id) && !entry.use && !entry.content && !entry.systemOwned
|
|
27
|
+
: Number(Boolean(entry.use)) + Number(Boolean(entry.content)) + Number(Boolean(entry.systemOwned)) === 1, 'entry requires exactly one of use, content, or systemOwned (or an id for remove)');
|
|
28
|
+
const instructionsSchema = z
|
|
29
|
+
.object({
|
|
30
|
+
kind: z.literal('instructions'),
|
|
31
|
+
identity: instructionEntrySchema.optional(),
|
|
32
|
+
workflow: instructionEntrySchema.optional(),
|
|
33
|
+
guidance: z.array(instructionEntrySchema).optional(),
|
|
34
|
+
output: instructionEntrySchema.optional(),
|
|
35
|
+
})
|
|
36
|
+
.strict();
|
|
37
|
+
const contextSourceSchema = z
|
|
38
|
+
.object({
|
|
39
|
+
id: localId,
|
|
40
|
+
source: z.string().min(1),
|
|
41
|
+
enabled: z.boolean().optional(),
|
|
42
|
+
priority: z.number().finite().optional(),
|
|
43
|
+
limit: z.number().int().positive().optional(),
|
|
44
|
+
anchor: localId.optional(),
|
|
45
|
+
remove: z.boolean().optional(),
|
|
46
|
+
})
|
|
47
|
+
.strict();
|
|
48
|
+
const contextSchema = z
|
|
49
|
+
.object({
|
|
50
|
+
kind: z.literal('context'),
|
|
51
|
+
operation: z.enum(['merge', 'replace']).optional(),
|
|
52
|
+
sources: z.array(contextSourceSchema),
|
|
53
|
+
})
|
|
54
|
+
.strict();
|
|
55
|
+
const toolsSchema = z
|
|
56
|
+
.object({
|
|
57
|
+
kind: z.literal('tools'),
|
|
58
|
+
operation: z.enum(['merge', 'replace']).optional(),
|
|
59
|
+
include: z.array(localId).optional(),
|
|
60
|
+
exclude: z.array(localId).optional(),
|
|
61
|
+
})
|
|
62
|
+
.strict();
|
|
63
|
+
const enforcementSchema = z.object({ kind: z.literal('enforcement'), policies: z.array(id) }).strict();
|
|
64
|
+
const integrationReferenceSchema = z
|
|
65
|
+
.object({ use: id, required: z.boolean(), config: z.record(z.string(), z.unknown()).optional() })
|
|
66
|
+
.strict();
|
|
67
|
+
const integrationsSchema = z
|
|
68
|
+
.object({ kind: z.literal('integrations'), integrations: z.array(integrationReferenceSchema) })
|
|
69
|
+
.strict();
|
|
70
|
+
const presentationSchema = z
|
|
71
|
+
.object({
|
|
72
|
+
kind: z.literal('presentation'),
|
|
73
|
+
displayName: z.string().optional(),
|
|
74
|
+
description: z.string().optional(),
|
|
75
|
+
label: z.string().optional(),
|
|
76
|
+
color: z.string().optional(),
|
|
77
|
+
marker: z.string().optional(),
|
|
78
|
+
})
|
|
79
|
+
.strict();
|
|
80
|
+
const requirementSchema = z
|
|
81
|
+
.object({
|
|
82
|
+
kind: z.enum(['schema-version', 'term2-version', 'capability', 'integration', 'setting']),
|
|
83
|
+
value: z.string().min(1),
|
|
84
|
+
})
|
|
85
|
+
.strict();
|
|
86
|
+
const requirementsBlockSchema = z
|
|
87
|
+
.object({ kind: z.literal('requirements'), requirements: z.array(requirementSchema) })
|
|
88
|
+
.strict();
|
|
89
|
+
export const profileBlockSchema = z.union([
|
|
90
|
+
referenceSchema,
|
|
91
|
+
instructionsSchema,
|
|
92
|
+
contextSchema,
|
|
93
|
+
toolsSchema,
|
|
94
|
+
enforcementSchema,
|
|
95
|
+
integrationsSchema,
|
|
96
|
+
presentationSchema,
|
|
97
|
+
requirementsBlockSchema,
|
|
98
|
+
]);
|
|
99
|
+
export const profileDefinitionSchema = z
|
|
100
|
+
.object({
|
|
101
|
+
schemaVersion: z.literal(1),
|
|
102
|
+
id: localId,
|
|
103
|
+
version: z.string().min(1),
|
|
104
|
+
name: z.string().min(1),
|
|
105
|
+
description: z.string().optional(),
|
|
106
|
+
extends: id.optional(),
|
|
107
|
+
blocks: z
|
|
108
|
+
.object({
|
|
109
|
+
instructions: profileBlockSchema.optional(),
|
|
110
|
+
context: profileBlockSchema.optional(),
|
|
111
|
+
tools: profileBlockSchema.optional(),
|
|
112
|
+
enforcement: profileBlockSchema.optional(),
|
|
113
|
+
integrations: profileBlockSchema.optional(),
|
|
114
|
+
presentation: profileBlockSchema.optional(),
|
|
115
|
+
requirements: profileBlockSchema.optional(),
|
|
116
|
+
})
|
|
117
|
+
.strict(),
|
|
118
|
+
requires: z.array(requirementSchema).optional(),
|
|
119
|
+
})
|
|
120
|
+
.strict();
|
|
121
|
+
export const enforcementPolicySchema = z
|
|
122
|
+
.object({
|
|
123
|
+
id,
|
|
124
|
+
kind: z.literal('enforcement'),
|
|
125
|
+
denials: z.array(localId),
|
|
126
|
+
conflicts: z.array(id).optional(),
|
|
127
|
+
handoffRestriction: z.string().optional(),
|
|
128
|
+
})
|
|
129
|
+
.strict();
|
|
130
|
+
export const integrationDefinitionSchema = z
|
|
131
|
+
.object({
|
|
132
|
+
id,
|
|
133
|
+
kind: z.literal('integrations'),
|
|
134
|
+
conflicts: z.array(id).optional(),
|
|
135
|
+
availableByDefault: z.boolean().optional(),
|
|
136
|
+
})
|
|
137
|
+
.strict();
|
|
138
|
+
export class ProfileValidationError extends Error {
|
|
139
|
+
issues;
|
|
140
|
+
constructor(message, issues = []) {
|
|
141
|
+
super(message);
|
|
142
|
+
this.name = 'ProfileValidationError';
|
|
143
|
+
this.issues = issues;
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
export function validateProfileDefinition(value) {
|
|
147
|
+
const result = profileDefinitionSchema.safeParse(value);
|
|
148
|
+
if (!result.success)
|
|
149
|
+
throw new ProfileValidationError(`Invalid Profile definition: ${result.error.message}`, result.error.issues);
|
|
150
|
+
return result.data;
|
|
151
|
+
}
|
|
152
|
+
export function validateRegisteredBlock(value) {
|
|
153
|
+
const result = z
|
|
154
|
+
.object({
|
|
155
|
+
id,
|
|
156
|
+
kind: z.enum(['instructions', 'context', 'tools', 'enforcement', 'integrations', 'presentation', 'requirements']),
|
|
157
|
+
definition: z.unknown(),
|
|
158
|
+
})
|
|
159
|
+
.strict()
|
|
160
|
+
.safeParse(value);
|
|
161
|
+
if (!result.success)
|
|
162
|
+
throw new ProfileValidationError(`Invalid registered block: ${result.error.message}`, result.error.issues);
|
|
163
|
+
const definitionSchema = z.union([
|
|
164
|
+
instructionsSchema,
|
|
165
|
+
contextSchema,
|
|
166
|
+
toolsSchema,
|
|
167
|
+
enforcementSchema,
|
|
168
|
+
integrationsSchema,
|
|
169
|
+
presentationSchema,
|
|
170
|
+
requirementsBlockSchema,
|
|
171
|
+
enforcementPolicySchema,
|
|
172
|
+
integrationDefinitionSchema,
|
|
173
|
+
]);
|
|
174
|
+
const definitionResult = definitionSchema.safeParse(result.data.definition);
|
|
175
|
+
if (!definitionResult.success)
|
|
176
|
+
throw new ProfileValidationError(`Invalid registered block definition: ${definitionResult.error.message}`, definitionResult.error.issues);
|
|
177
|
+
if (definitionResult.data.kind !== result.data.kind)
|
|
178
|
+
throw new ProfileValidationError(`Registered block kind mismatch: expected ${result.data.kind}, got ${definitionResult.data.kind}`);
|
|
179
|
+
return { ...result.data, definition: definitionResult.data };
|
|
180
|
+
}
|
|
181
|
+
export function validatePolicy(value) {
|
|
182
|
+
const result = enforcementPolicySchema.safeParse(value);
|
|
183
|
+
if (!result.success)
|
|
184
|
+
throw new ProfileValidationError(`Invalid enforcement policy: ${result.error.message}`, result.error.issues);
|
|
185
|
+
return result.data;
|
|
186
|
+
}
|
|
187
|
+
export function validateIntegration(value) {
|
|
188
|
+
const result = integrationDefinitionSchema.safeParse(value);
|
|
189
|
+
if (!result.success)
|
|
190
|
+
throw new ProfileValidationError(`Invalid integration: ${result.error.message}`, result.error.issues);
|
|
191
|
+
return result.data;
|
|
192
|
+
}
|
|
193
|
+
export function isBlockReference(value) {
|
|
194
|
+
return 'use' in value && (!('kind' in value) || !('sources' in value));
|
|
195
|
+
}
|
|
196
|
+
//# sourceMappingURL=schema.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schema.js","sourceRoot":"","sources":["../../../source/services/profiles/schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AASxB,MAAM,EAAE,GAAG,CAAC,CAAC,MAAM,EAAE,CAAC,KAAK,CAAC,2CAA2C,EAAE,yBAAyB,CAAC,CAAC;AACpG,MAAM,OAAO,GAAG,CAAC;KACd,MAAM,EAAE;KACR,GAAG,CAAC,CAAC,CAAC;KACN,KAAK,CAAC,8BAA8B,CAAC,CAAC;AACzC,MAAM,SAAS,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,SAAS,EAAE,QAAQ,EAAE,OAAO,EAAE,QAAQ,CAAC,CAAC,CAAC;AAEnE,MAAM,eAAe,G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+
import type { z } from 'zod';
|
|
2
|
+
export type ProfileId = `builtin:${string}` | `user:${string}` | `project:${string}`;
|
|
3
|
+
export type BlockId = ProfileId;
|
|
4
|
+
export type BlockKind = 'instructions' | 'context' | 'tools' | 'enforcement' | 'integrations' | 'presentation' | 'requirements';
|
|
5
|
+
export interface BlockReference {
|
|
6
|
+
use: string;
|
|
7
|
+
/** Optional assertion which is checked against the registry entry. */
|
|
8
|
+
kind?: BlockKind;
|
|
9
|
+
}
|
|
10
|
+
export type InstructionContent = {
|
|
11
|
+
kind: 'model-family-base';
|
|
12
|
+
} | {
|
|
13
|
+
kind: 'markdown';
|
|
14
|
+
content: string;
|
|
15
|
+
};
|
|
16
|
+
export interface InstructionEntry {
|
|
17
|
+
id?: string;
|
|
18
|
+
use?: string;
|
|
19
|
+
content?: string;
|
|
20
|
+
systemOwned?: 'model-family-base';
|
|
21
|
+
operation?: 'replace' | 'before' | 'after' | 'remove';
|
|
22
|
+
}
|
|
23
|
+
export interface InstructionsBlock {
|
|
24
|
+
kind: 'instructions';
|
|
25
|
+
identity?: InstructionEntry;
|
|
26
|
+
workflow?: InstructionEntry;
|
|
27
|
+
guidance?: InstructionEntry[];
|
|
28
|
+
output?: InstructionEntry;
|
|
29
|
+
}
|
|
30
|
+
export interface ContextSource {
|
|
31
|
+
id: string;
|
|
32
|
+
source: string;
|
|
33
|
+
enabled?: boolean;
|
|
34
|
+
priority?: number;
|
|
35
|
+
limit?: number;
|
|
36
|
+
anchor?: string;
|
|
37
|
+
remove?: boolean;
|
|
38
|
+
}
|
|
39
|
+
export interface ContextBlock {
|
|
40
|
+
kind: 'context';
|
|
41
|
+
operation?: 'merge' | 'replace';
|
|
42
|
+
sources: ContextSource[];
|
|
43
|
+
}
|
|
44
|
+
export interface ToolsBlock {
|
|
45
|
+
kind: 'tools';
|
|
46
|
+
operation?: 'merge' | 'replace';
|
|
47
|
+
include?: string[];
|
|
48
|
+
exclude?: string[];
|
|
49
|
+
}
|
|
50
|
+
export interface EnforcementPolicyDefinition {
|
|
51
|
+
id: string;
|
|
52
|
+
kind: 'enforcement';
|
|
53
|
+
denials: string[];
|
|
54
|
+
conflicts?: string[];
|
|
55
|
+
handoffRestriction?: string;
|
|
56
|
+
}
|
|
57
|
+
export interface EnforcementBlock {
|
|
58
|
+
kind: 'enforcement';
|
|
59
|
+
policies: string[];
|
|
60
|
+
}
|
|
61
|
+
export interface IntegrationDefinition {
|
|
62
|
+
id: string;
|
|
63
|
+
kind: 'integrations';
|
|
64
|
+
conflicts?: string[];
|
|
65
|
+
/** Trusted registry metadata; Profile data itself remains declarative. */
|
|
66
|
+
availableByDefault?: boolean;
|
|
67
|
+
}
|
|
68
|
+
export interface IntegrationReference {
|
|
69
|
+
use: string;
|
|
70
|
+
required: boolean;
|
|
71
|
+
config?: Record<string, unknown>;
|
|
72
|
+
}
|
|
73
|
+
export interface IntegrationsBlock {
|
|
74
|
+
kind: 'integrations';
|
|
75
|
+
integrations: IntegrationReference[];
|
|
76
|
+
}
|
|
77
|
+
export interface PresentationBlock {
|
|
78
|
+
kind: 'presentation';
|
|
79
|
+
displayName?: string;
|
|
80
|
+
description?: string;
|
|
81
|
+
label?: string;
|
|
82
|
+
color?: string;
|
|
83
|
+
marker?: string;
|
|
84
|
+
}
|
|
85
|
+
export type RequirementKind = 'schema-version' | 'term2-version' | 'capability' | 'integration' | 'setting';
|
|
86
|
+
export interface Requirement {
|
|
87
|
+
kind: RequirementKind;
|
|
88
|
+
value: string;
|
|
89
|
+
}
|
|
90
|
+
export interface RequirementsBlock {
|
|
91
|
+
kind: 'requirements';
|
|
92
|
+
requirements: Requirement[];
|
|
93
|
+
}
|
|
94
|
+
export type ProfileBlock = InstructionsBlock | ContextBlock | ToolsBlock | EnforcementBlock | IntegrationsBlock | PresentationBlock | RequirementsBlock | BlockReference;
|
|
95
|
+
export interface ProfileBlocks {
|
|
96
|
+
instructions?: ProfileBlock;
|
|
97
|
+
context?: ProfileBlock;
|
|
98
|
+
tools?: ProfileBlock;
|
|
99
|
+
enforcement?: ProfileBlock;
|
|
100
|
+
integrations?: ProfileBlock;
|
|
101
|
+
presentation?: ProfileBlock;
|
|
102
|
+
requirements?: ProfileBlock;
|
|
103
|
+
}
|
|
104
|
+
export interface ProfileRegistry {
|
|
105
|
+
readonly profiles: ReadonlyMap<string, ProfileDefinition>;
|
|
106
|
+
readonly blocks: ReadonlyMap<string, RegisteredBlock>;
|
|
107
|
+
readonly policies: ReadonlyMap<string, EnforcementPolicyDefinition>;
|
|
108
|
+
readonly integrations: ReadonlyMap<string, IntegrationDefinition>;
|
|
109
|
+
}
|
|
110
|
+
export interface ProfileDefinition {
|
|
111
|
+
schemaVersion: 1;
|
|
112
|
+
id: string;
|
|
113
|
+
version: string;
|
|
114
|
+
name: string;
|
|
115
|
+
description?: string;
|
|
116
|
+
extends?: string;
|
|
117
|
+
blocks: ProfileBlocks;
|
|
118
|
+
requires?: Requirement[];
|
|
119
|
+
}
|
|
120
|
+
export interface RegisteredBlock {
|
|
121
|
+
id: string;
|
|
122
|
+
kind: BlockKind;
|
|
123
|
+
definition: ProfileBlock | EnforcementPolicyDefinition | IntegrationDefinition;
|
|
124
|
+
}
|
|
125
|
+
export interface ProfileProvenance {
|
|
126
|
+
namespace: 'builtin' | 'user' | 'project';
|
|
127
|
+
source: string;
|
|
128
|
+
}
|
|
129
|
+
export interface ResolvedInstructionEntry {
|
|
130
|
+
readonly id: string;
|
|
131
|
+
readonly content: InstructionContent;
|
|
132
|
+
}
|
|
133
|
+
export interface ResolvedInstructions {
|
|
134
|
+
readonly identity: InstructionContent;
|
|
135
|
+
readonly workflow?: InstructionContent;
|
|
136
|
+
readonly guidance: readonly ResolvedInstructionEntry[];
|
|
137
|
+
readonly output?: InstructionContent;
|
|
138
|
+
}
|
|
139
|
+
export interface ResolvedContextSource {
|
|
140
|
+
readonly id: string;
|
|
141
|
+
readonly source: string;
|
|
142
|
+
readonly enabled: boolean;
|
|
143
|
+
readonly priority: number;
|
|
144
|
+
readonly limit?: number;
|
|
145
|
+
}
|
|
146
|
+
export interface ResolvedContextPolicy {
|
|
147
|
+
readonly sources: readonly ResolvedContextSource[];
|
|
148
|
+
}
|
|
149
|
+
export interface ResolvedToolSurface {
|
|
150
|
+
readonly capabilities: ReadonlySet<string>;
|
|
151
|
+
}
|
|
152
|
+
export interface ResolvedEnforcementPolicy {
|
|
153
|
+
readonly policies: ReadonlySet<string>;
|
|
154
|
+
readonly denials: ReadonlySet<string>;
|
|
155
|
+
readonly handoffRestrictions: ReadonlySet<string>;
|
|
156
|
+
}
|
|
157
|
+
export interface ResolvedIntegration {
|
|
158
|
+
readonly id: string;
|
|
159
|
+
readonly required: boolean;
|
|
160
|
+
readonly config?: Readonly<Record<string, unknown>>;
|
|
161
|
+
readonly available: boolean;
|
|
162
|
+
}
|
|
163
|
+
export interface ResolvedPresentation {
|
|
164
|
+
readonly displayName?: string;
|
|
165
|
+
readonly description?: string;
|
|
166
|
+
readonly label?: string;
|
|
167
|
+
readonly color?: string;
|
|
168
|
+
readonly marker?: string;
|
|
169
|
+
}
|
|
170
|
+
export interface ResolvedRequirements {
|
|
171
|
+
readonly requirements: readonly Requirement[];
|
|
172
|
+
}
|
|
173
|
+
export interface ProfileAvailabilityDiagnostic {
|
|
174
|
+
readonly code: 'unavailable-integration' | 'unsatisfied-requirement';
|
|
175
|
+
readonly message: string;
|
|
176
|
+
readonly reference: string;
|
|
177
|
+
}
|
|
178
|
+
export interface ProfileAvailability {
|
|
179
|
+
readonly available: boolean;
|
|
180
|
+
readonly diagnostics: readonly ProfileAvailabilityDiagnostic[];
|
|
181
|
+
}
|
|
182
|
+
export interface ResolvedProfile {
|
|
183
|
+
readonly identity: {
|
|
184
|
+
readonly id: string;
|
|
185
|
+
readonly version: string;
|
|
186
|
+
readonly digest: string;
|
|
187
|
+
readonly provenance: ProfileProvenance;
|
|
188
|
+
readonly parentIds: readonly string[];
|
|
189
|
+
};
|
|
190
|
+
readonly instructions: ResolvedInstructions;
|
|
191
|
+
readonly context: ResolvedContextPolicy;
|
|
192
|
+
readonly tools: ResolvedToolSurface;
|
|
193
|
+
readonly enforcement: ResolvedEnforcementPolicy;
|
|
194
|
+
readonly integrations: ReadonlyMap<string, ResolvedIntegration>;
|
|
195
|
+
readonly presentation: ResolvedPresentation;
|
|
196
|
+
readonly requirements: ResolvedRequirements;
|
|
197
|
+
readonly availability: ProfileAvailability;
|
|
198
|
+
}
|
|
199
|
+
export interface ResolveOptions {
|
|
200
|
+
maxParentDepth?: number;
|
|
201
|
+
maxBlocks?: number;
|
|
202
|
+
availableCapabilities?: Iterable<string>;
|
|
203
|
+
availableIntegrations?: Iterable<string> | ReadonlyMap<string, boolean>;
|
|
204
|
+
availableSettings?: Iterable<string>;
|
|
205
|
+
term2Version?: string;
|
|
206
|
+
}
|
|
207
|
+
export interface ProfileResolutionDiagnostic {
|
|
208
|
+
readonly code: string;
|
|
209
|
+
readonly message: string;
|
|
210
|
+
readonly path?: string;
|
|
211
|
+
}
|
|
212
|
+
export declare class ProfileResolutionError extends Error {
|
|
213
|
+
readonly diagnostics: readonly ProfileResolutionDiagnostic[];
|
|
214
|
+
constructor(message: string, diagnostics?: readonly ProfileResolutionDiagnostic[]);
|
|
215
|
+
}
|
|
216
|
+
/** Kept local to this module so legacy consumers can migrate without a dependency cycle. */
|
|
217
|
+
export interface SavedAppMode {
|
|
218
|
+
mentorMode: boolean;
|
|
219
|
+
liteMode: boolean;
|
|
220
|
+
planMode: boolean;
|
|
221
|
+
orchestratorMode?: boolean;
|
|
222
|
+
}
|
|
223
|
+
export type ProfileSchema = z.ZodType<ProfileDefinition>;
|
|
224
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../source/services/profiles/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAE7B,MAAM,MAAM,SAAS,GAAG,WAAW,MAAM,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/C,QAAQ,CAAC,WAAW,EAAE,SAAS,2BAA2B,EAAE,CAAC;IAE7D,YAAY,OAAO,EAAE,MAAM,EAAE,WAAW,GAAE,SAAS,2BAA2B,EAAO,EAIpF;CACF;AAED,4FAA4F;AAC5F,MAAM,WAAW,YAAY;IAC3B,UAAU,EAAE,OAAO,CAAC;IACpB,QAAQ,EAAE,OAAO,CAAC;IAClB,QAAQ,EAAE,OAAO,CAAC;IAClB,gBAAgB,CAAC,EAAE,OAAO,CAAC;CAC5B;AAED,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,OAAO,CAAC,iBAAiB,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../source/services/profiles/types.ts"],"names":[],"mappings":"AAsPA,MAAM,OAAO,sBAAuB,SAAQ,KAAK;IACtC,WAAW,CAAyC;IAE7D,YAAY,OAAe,EAAE,WAAW,GAA2C,EAAE;QACnF,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,wBAAwB,CAAC;QACrC,IAAI,CAAC,WAAW,GAAG,WAAW,CAAC;IACjC,CAAC;CACF"}
|
|
@@ -1,4 +1,9 @@
|
|
|
1
1
|
import type { ClassifiedFailure, CommittedToolContinuation } from './retry-contracts.js';
|
|
2
2
|
export declare function isSettledCommittedToolContinuation(evidence: CommittedToolContinuation | undefined): boolean;
|
|
3
|
+
/**
|
|
4
|
+
* Chain recovery rebuilds from durable history instead of replaying committed
|
|
5
|
+
* work. Once every live-turn tool pair is settled, that is true for both a
|
|
6
|
+
* connection interruption and an explicit provider-state rejection.
|
|
7
|
+
*/
|
|
3
8
|
export declare function skipsAutomaticReplayClaim(failure: ClassifiedFailure, evidence: CommittedToolContinuation | undefined): boolean;
|
|
4
9
|
//# sourceMappingURL=committed-tool-continuation.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"committed-tool-continuation.d.ts","sourceRoot":"","sources":["../../../source/services/retry/committed-tool-continuation.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,yBAAyB,EAAE,MAAM,sBAAsB,CAAC;AAEzF,wBAAgB,kCAAkC,CAAC,QAAQ,EAAE,yBAAyB,GAAG,SAAS,GAAG,OAAO,CAO3G;AAED,wBAAgB,yBAAyB,CACvC,OAAO,EAAE,iBAAiB,EAC1B,QAAQ,EAAE,yBAAyB,GAAG,SAAS,GAC9C,OAAO,
|
|
1
|
+
{"version":3,"file":"committed-tool-continuation.d.ts","sourceRoot":"","sources":["../../../source/services/retry/committed-tool-continuation.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,yBAAyB,EAAE,MAAM,sBAAsB,CAAC;AAEzF,wBAAgB,kCAAkC,CAAC,QAAQ,EAAE,yBAAyB,GAAG,SAAS,GAAG,OAAO,CAO3G;AAED;;;;GAIG;AACH,wBAAgB,yBAAyB,CACvC,OAAO,EAAE,iBAAiB,EAC1B,QAAQ,EAAE,yBAAyB,GAAG,SAAS,GAC9C,OAAO,CAET"}
|
|
@@ -4,9 +4,12 @@ export function isSettledCommittedToolContinuation(evidence) {
|
|
|
4
4
|
evidence.allToolsCompleted &&
|
|
5
5
|
evidence.completedPairsPresentInHistory);
|
|
6
6
|
}
|
|
7
|
+
/**
|
|
8
|
+
* Chain recovery rebuilds from durable history instead of replaying committed
|
|
9
|
+
* work. Once every live-turn tool pair is settled, that is true for both a
|
|
10
|
+
* connection interruption and an explicit provider-state rejection.
|
|
11
|
+
*/
|
|
7
12
|
export function skipsAutomaticReplayClaim(failure, evidence) {
|
|
8
|
-
return
|
|
9
|
-
failure.cause === 'connection_interrupted' &&
|
|
10
|
-
isSettledCommittedToolContinuation(evidence));
|
|
13
|
+
return failure.kind === 'chain_recovery' && isSettledCommittedToolContinuation(evidence);
|
|
11
14
|
}
|
|
12
15
|
//# sourceMappingURL=committed-tool-continuation.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"committed-tool-continuation.js","sourceRoot":"","sources":["../../../source/services/retry/committed-tool-continuation.ts"],"names":[],"mappings":"AAEA,MAAM,UAAU,kCAAkC,CAAC,QAA+C;IAChG,OAAO,CACL,QAAQ,KAAK,SAAS;QACtB,QAAQ,CAAC,kBAAkB,GAAG,CAAC;QAC/B,QAAQ,CAAC,iBAAiB;QAC1B,QAAQ,CAAC,8BAA8B,CACxC,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,yBAAyB,CACvC,OAA0B,EAC1B,QAA+C;IAE/C,OAAO,
|
|
1
|
+
{"version":3,"file":"committed-tool-continuation.js","sourceRoot":"","sources":["../../../source/services/retry/committed-tool-continuation.ts"],"names":[],"mappings":"AAEA,MAAM,UAAU,kCAAkC,CAAC,QAA+C;IAChG,OAAO,CACL,QAAQ,KAAK,SAAS;QACtB,QAAQ,CAAC,kBAAkB,GAAG,CAAC;QAC/B,QAAQ,CAAC,iBAAiB;QAC1B,QAAQ,CAAC,8BAA8B,CACxC,CAAC;AACJ,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,yBAAyB,CACvC,OAA0B,EAC1B,QAA+C;IAE/C,OAAO,OAAO,CAAC,IAAI,KAAK,gBAAgB,IAAI,kCAAkC,CAAC,QAAQ,CAAC,CAAC;AAC3F,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"retry-classifier.d.ts","sourceRoot":"","sources":["../../../source/services/retry/retry-classifier.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAE,qBAAqB,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAGrF,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,iCAAiC,CAAC;
|
|
1
|
+
{"version":3,"file":"retry-classifier.d.ts","sourceRoot":"","sources":["../../../source/services/retry/retry-classifier.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAE,qBAAqB,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAGrF,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,iCAAiC,CAAC;AAuB/E,qBAAa,sBAAsB;IACrB,OAAO,CAAC,WAAW;IAA2B,OAAO,CAAC,MAAM;IAAxE,YAAoB,WAAW,EAAE,uBAAuB,EAAU,MAAM,GAAE,MAAM,MAAoB,EAEnG;IAED,QAAQ,CAAC,OAAO,EAAE,qBAAqB,GAAG,iBAAiB,CAkJ1D;CACF"}
|
|
@@ -16,6 +16,10 @@ const computeTransientDelayMs = (attempt, random) => {
|
|
|
16
16
|
const jitter = 0.9 + random() * 0.2;
|
|
17
17
|
return Math.round(baseDelay * jitter);
|
|
18
18
|
};
|
|
19
|
+
const isProviderStateRejection = (error) => isPreviousResponseNotFoundError(error) ||
|
|
20
|
+
isMissingServerToolOutputError(error) ||
|
|
21
|
+
isMissingChainedToolOutputError(error) ||
|
|
22
|
+
isOrphanedChainedToolOutputError(error);
|
|
19
23
|
export class DefaultRetryClassifier {
|
|
20
24
|
agentClient;
|
|
21
25
|
random;
|
|
@@ -48,16 +52,18 @@ export class DefaultRetryClassifier {
|
|
|
48
52
|
// treated that as "committed" and forced 'unrecoverable' on an otherwise
|
|
49
53
|
// safely recoverable failure.
|
|
50
54
|
//
|
|
51
|
-
// Exception: a recoverable connection drop
|
|
52
|
-
// completed and already in reconciled history
|
|
53
|
-
// the dead chain and continues from those pairs.
|
|
54
|
-
// missing pairs, and committed text with no
|
|
55
|
+
// Exception: a recoverable connection drop or provider state rejection
|
|
56
|
+
// after every live-turn tool is completed and already in reconciled history
|
|
57
|
+
// is not a replay. It severs the dead chain and continues from those pairs.
|
|
58
|
+
// Open or unknown calls, missing pairs, and committed text with no
|
|
59
|
+
// completed tools stay closed.
|
|
55
60
|
if (context.hasCommittedOutput || (stream && streamHasCommittedOutput(stream))) {
|
|
56
61
|
if (isSettledCommittedToolContinuation(context.committedToolContinuation)) {
|
|
57
62
|
const connectionInterrupted = error instanceof UnsentWebSocketRequestError ||
|
|
58
63
|
(error instanceof AmbiguousModelOutcomeError && isRecoverableIncompleteStreamClose(error)) ||
|
|
59
64
|
isRecoverableIncompleteStreamClose(error);
|
|
60
|
-
|
|
65
|
+
const providerStateRejected = isProviderStateRejection(error);
|
|
66
|
+
if (connectionInterrupted || providerStateRejected) {
|
|
61
67
|
const nextAttempt = retryCounts.transientRetryCount + 1;
|
|
62
68
|
if (nextAttempt > maxTransientRetries) {
|
|
63
69
|
return { kind: 'unrecoverable' };
|
|
@@ -66,7 +72,7 @@ export class DefaultRetryClassifier {
|
|
|
66
72
|
kind: 'chain_recovery',
|
|
67
73
|
attempt: nextAttempt,
|
|
68
74
|
delayMs: computeTransientDelayMs(nextAttempt, this.random),
|
|
69
|
-
cause: 'connection_interrupted',
|
|
75
|
+
cause: providerStateRejected ? 'provider_state_rejected' : 'connection_interrupted',
|
|
70
76
|
};
|
|
71
77
|
}
|
|
72
78
|
}
|
|
@@ -101,10 +107,7 @@ export class DefaultRetryClassifier {
|
|
|
101
107
|
if (error instanceof ConversationStateNoProgressError) {
|
|
102
108
|
return { kind: 'unrecoverable' };
|
|
103
109
|
}
|
|
104
|
-
if (
|
|
105
|
-
isMissingServerToolOutputError(error) ||
|
|
106
|
-
isMissingChainedToolOutputError(error) ||
|
|
107
|
-
isOrphanedChainedToolOutputError(error)) {
|
|
110
|
+
if (isProviderStateRejection(error)) {
|
|
108
111
|
const nextAttempt = retryCounts.transientRetryCount + 1;
|
|
109
112
|
if (nextAttempt > maxTransientRetries) {
|
|
110
113
|
return { kind: 'unrecoverable' };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"retry-classifier.js","sourceRoot":"","sources":["../../../source/services/retry/retry-classifier.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,gCAAgC,CAAC;AAC7D,OAAO,EACL,8BAA8B,EAC9B,+BAA+B,EAC/B,kCAAkC,EAClC,yBAAyB,EACzB,yBAAyB,EACzB,sCAAsC,GACvC,M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AAE,mBAAmB,EAAE,eAAe,EAAE,GAAG,OAAO,CAAC;QAErF,sEAAsE;QACtE,2EAA2E;QAC3E,yEAAyE;QACzE,qEAAqE;QACrE,8DAA8D;QAC9D,IAAI,mCAAmC,CAAC,KAAK,CAAC,EAAE,CAAC;YAC/C,OAAO,EAAE,IAAI,EAAE,eAAe,EAAE,CAAC;QACnC,CAAC;QAED,yEAAyE;QACzE,yEAAyE;QACzE,2EAA2E;QAC3E,wCAAwC;QACxC,EAAE;QACF,yEAAyE;QACzE,oEAAoE;QACpE,4DAA4D;QAC5D,uEAAuE;QACvE,yEAAyE;QACzE,mEAAmE;QACnE,yEAAyE;QACzE,8BAA8B;QAC9B,EAAE;QACF,
|
|
1
|
+
{"version":3,"file":"retry-classifier.js","sourceRoot":"","sources":["../../../source/services/retry/retry-classifier.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,gCAAgC,CAAC;AAC7D,OAAO,EACL,8BAA8B,EAC9B,+BAA+B,EAC/B,kCAAkC,EAClC,yBAAyB,EACzB,yBAAyB,EACzB,sCAAsC,GACvC,MAAM,iCAAiC,CAAC;AACzC,OAAO,EAAE,8BAA8B,EAAE,MAAM,4BAA4B,CAAC;AAE5E,OAAO,EAAE,0BAA0B,EAAE,gCAAgC,EAAE,MAAM,mBAAmB,CAAC;AACjG,OAAO,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;AAE7D,OAAO,EAAE,+BAA+B,EAAE,gCAAgC,EAAE,MAAM,mCAAmC,CAAC;AACtH,OAAO,EAAE,mCAAmC,EAAE,MAAM,4BAA4B,CAAC;AACjF,OAAO,EAAE,wBAAwB,EAAE,MAAM,oBAAoB,CAAC;AAC9D,OAAO,EAAE,2BAA2B,EAAE,MAAM,+CAA+C,CAAC;AAC5F,OAAO,EAAE,kCAAkC,EAAE,MAAM,kCAAkC,CAAC;AAEtF,MAAM,uBAAuB,GAAG,GAAG,CAAC;AACpC,MAAM,sBAAsB,GAAG,M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,YAAY,IAAI,uBAAuB,CAAC,WAAW,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;YAC3F,OAAO,EAAE,IAAI,EAAE,WAAW,EAAE,OAAO,EAAE,WAAW,EAAE,OAAO,EAAE,CAAC;QAC9D,CAAC;QAED,OAAO,EAAE,IAAI,EAAE,eAAe,EAAE,CAAC;IACnC,CAAC;CACF"}
|
|
@@ -27,6 +27,13 @@ export declare function isWebSocketConnectionLimitReachedError(error: unknown, s
|
|
|
27
27
|
* from unrelated errors that happen to have `onSocketClose` in their stack.
|
|
28
28
|
*/
|
|
29
29
|
export declare function isUndiciSocketCloseError(error: unknown): boolean;
|
|
30
|
+
/**
|
|
31
|
+
* Detects the fetch/undici body-abort spelling used by AI SDK providers. The
|
|
32
|
+
* useful network cause can be nested under an SDK wrapper, so walk only the
|
|
33
|
+
* standard cause/errors links and keep the message match exact enough not to
|
|
34
|
+
* turn arbitrary prose containing "terminated" into a retry.
|
|
35
|
+
*/
|
|
36
|
+
export declare function isTerminatedError(error: unknown, seen?: Set<unknown>): boolean;
|
|
30
37
|
export declare function isNetworkProtocolError(error: unknown, seen?: Set<unknown>): boolean;
|
|
31
38
|
/**
|
|
32
39
|
* Provider adapters refuse to invent a completion when the stream body ends
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"retry-error-classification.d.ts","sourceRoot":"","sources":["../../../source/services/retry/retry-error-classification.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAGhE,MAAM,MAAM,0BAA0B,GAAG;IACvC,SAAS,EAAE,OAAO,CAAC;IACnB,iBAAiB,EAAE,OAAO,CAAC;CAC5B,CAAC;AAqCF,wBAAgB,+BAA+B,CAAC,KAAK,EAAE,OAAO,EAAE,IAAI,eAAqB,GAAG,OAAO,CAsBlG;AAED;;;;GAIG;AACH,wBAAgB,8BAA8B,CAAC,KAAK,EAAE,OAAO,EAAE,IAAI,eAAqB,GAAG,OAAO,CAqBjG;AAED,wBAAgB,sCAAsC,CAAC,KAAK,EAAE,OAAO,EAAE,IAAI,eAAqB,GAAG,OAAO,CAgBzG;AA6DD;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,wBAAwB,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CAchE;AAED,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,OAAO,EAAE,IAAI,eAAqB,GAAG,OAAO,CAyGzF;AAiBD;;;;;;;;;;;GAWG;AACH,wBAAgB,+BAA+B,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CAKvE;AAED;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,kCAAkC,UAAW,OAAO,WAAW,IAAI,CAAC,eAAe,EAAE,MAAM,CAAC,KAAG,OAQ3G,CAAC;AAEF,eAAO,MAAM,yBAAyB,UAC7B,OAAO,WACL,IAAI,CAAC,eAAe,EAAE,MAAM,CAAC,KACrC,0BAwBF,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,yBAAyB,UAAW,OAAO,WAAW,IAAI,CAAC,eAAe,EAAE,MAAM,CAAC,KAAG,
|
|
1
|
+
{"version":3,"file":"retry-error-classification.d.ts","sourceRoot":"","sources":["../../../source/services/retry/retry-error-classification.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAGhE,MAAM,MAAM,0BAA0B,GAAG;IACvC,SAAS,EAAE,OAAO,CAAC;IACnB,iBAAiB,EAAE,OAAO,CAAC;CAC5B,CAAC;AAqCF,wBAAgB,+BAA+B,CAAC,KAAK,EAAE,OAAO,EAAE,IAAI,eAAqB,GAAG,OAAO,CAsBlG;AAED;;;;GAIG;AACH,wBAAgB,8BAA8B,CAAC,KAAK,EAAE,OAAO,EAAE,IAAI,eAAqB,GAAG,OAAO,CAqBjG;AAED,wBAAgB,sCAAsC,CAAC,KAAK,EAAE,OAAO,EAAE,IAAI,eAAqB,GAAG,OAAO,CAgBzG;AA6DD;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,wBAAwB,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CAchE;AAED;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,OAAO,EAAE,IAAI,eAAqB,GAAG,OAAO,CAepF;AAED,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,OAAO,EAAE,IAAI,eAAqB,GAAG,OAAO,CAyGzF;AAiBD;;;;;;;;;;;GAWG;AACH,wBAAgB,+BAA+B,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CAKvE;AAED;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,kCAAkC,UAAW,OAAO,WAAW,IAAI,CAAC,eAAe,EAAE,MAAM,CAAC,KAAG,OAQ3G,CAAC;AAEF,eAAO,MAAM,yBAAyB,UAC7B,OAAO,WACL,IAAI,CAAC,eAAe,EAAE,MAAM,CAAC,KACrC,0BAwBF,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,yBAAyB,UAAW,OAAO,WAAW,IAAI,CAAC,eAAe,EAAE,MAAM,CAAC,KAAG,OA0GlG,CAAC"}
|