@bastani/atomic 0.9.61-alpha.1 → 0.9.61-alpha.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +68 -4
- package/dist/builtin/intercom/index.bundle.mjs +3 -3
- package/dist/builtin/intercom/package.json +1 -1
- package/dist/builtin/mcp/package.json +1 -1
- package/dist/builtin/subagents/CHANGELOG.md +12 -0
- package/dist/builtin/subagents/package.json +1 -1
- package/dist/builtin/web-access/package.json +1 -1
- package/dist/builtin/workflows/CHANGELOG.md +14 -0
- package/dist/builtin/workflows/README.md +9 -7
- package/dist/builtin/workflows/builtin/{chunk-h6bt0r0g.js → chunk-a2j0x1a6.js} +1 -1
- package/dist/builtin/workflows/builtin/{chunk-g3b2zf8r.js → chunk-vzbec50q.js} +1 -1
- package/dist/builtin/workflows/builtin/goal.js +1 -1
- package/dist/builtin/workflows/builtin/index.js +2 -2
- package/dist/builtin/workflows/builtin/ralph.js +1 -1
- package/dist/builtin/workflows/package.json +1 -1
- package/dist/builtin/workflows/src/extension/index.bundle.mjs +828 -418
- package/dist/builtin/workflows/src/extension/local-worker-entry.mjs +905 -429
- package/dist/builtin/workflows/src/index.js +798 -393
- package/dist/builtin/workflows/src/local-worker-entry.mjs +905 -429
- package/dist/core/agent-session-retry.d.ts.map +1 -1
- package/dist/core/agent-session-retry.js +12 -3
- package/dist/core/agent-session-retry.js.map +1 -1
- package/dist/core/model-fallback-failures.d.ts +14 -4
- package/dist/core/model-fallback-failures.d.ts.map +1 -1
- package/dist/core/model-fallback-failures.js +43 -15
- package/dist/core/model-fallback-failures.js.map +1 -1
- package/dist/core/settings-defaults.d.ts +1 -0
- package/dist/core/settings-defaults.d.ts.map +1 -1
- package/dist/core/settings-defaults.js +1 -0
- package/dist/core/settings-defaults.js.map +1 -1
- package/dist/core/settings-manager-basic-accessors.d.ts +1 -0
- package/dist/core/settings-manager-basic-accessors.d.ts.map +1 -1
- package/dist/core/settings-manager-basic-accessors.js +2 -0
- package/dist/core/settings-manager-basic-accessors.js.map +1 -1
- package/dist/core/settings-schema.d.ts +2 -0
- package/dist/core/settings-schema.d.ts.map +1 -1
- package/dist/core/settings-schema.js +4 -0
- package/dist/core/settings-schema.js.map +1 -1
- package/dist/core/slash-commands.js +2 -2
- package/dist/core/slash-commands.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/modes/interactive/interactive-startup-chat-container.d.ts +2 -0
- package/dist/modes/interactive/interactive-startup-chat-container.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-startup-chat-container.js +6 -0
- package/dist/modes/interactive/interactive-startup-chat-container.js.map +1 -1
- package/dist/modes/interactive-engine/engine-render-service.d.ts +8 -0
- package/dist/modes/interactive-engine/engine-render-service.d.ts.map +1 -1
- package/dist/modes/interactive-engine/engine-render-service.js +28 -6
- package/dist/modes/interactive-engine/engine-render-service.js.map +1 -1
- package/dist/modes/interactive-engine/remote-renderer.d.ts +33 -5
- package/dist/modes/interactive-engine/remote-renderer.d.ts.map +1 -1
- package/dist/modes/interactive-engine/remote-renderer.js +91 -17
- package/dist/modes/interactive-engine/remote-renderer.js.map +1 -1
- package/dist/modes/rpc/queued-writer.d.ts +2 -0
- package/dist/modes/rpc/queued-writer.d.ts.map +1 -1
- package/dist/modes/rpc/queued-writer.js +8 -0
- package/dist/modes/rpc/queued-writer.js.map +1 -1
- package/dist/modes/rpc/rpc-client.d.ts.map +1 -1
- package/dist/modes/rpc/rpc-client.js +4 -0
- package/dist/modes/rpc/rpc-client.js.map +1 -1
- package/docs/intercom/reference.md +1 -1
- package/docs/models/evals.md +30 -2
- package/docs/settings.md +3 -0
- package/docs/subagents/reference.md +3 -1
- package/docs/workflows/api-reference.md +9 -6
- package/docs/workflows/builtins.md +1 -1
- package/docs/workflows/operations.md +4 -4
- package/npm-shrinkwrap.json +32 -32
- package/package.json +3 -3
- package/schemas/settings.schema.json +5 -0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AAsB,GAEtB,MAAM,yCAAyC,CAAC;AACjD,OAAO,EACN,mBAAmB,EACnB,sCAAsC,EACtC,wBAAwB,EACxB,uBAAuB,GAGvB,MAAM,mDAAmD,CAAC;AAC3D,kDAAkD;AAClD,OAAO,EACN,mBAAmB,EACnB,gBAAgB,EAChB,kBAAkB,EAClB,oBAAoB,EACpB,aAAa,EACb,SAAS,EACT,KAAK,GAEL,MAAM,oCAAoC,CAAC;AAC5C,OAAO,EAAE,2BAA2B,EAAE,MAAM,2CAA2C,CAAC;AACxF,OAAO,EAAE,6BAA6B,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AACvF,sBAAsB;AACtB,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAC5E,OAAO,EACN,sBAAsB,EACtB,wBAAwB,EACxB,sBAAsB,EACtB,qCAAqC,EACrC,uCAAuC,EAGvC,qBAAqB,GACrB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,oBAAoB,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AAC9E,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AACxD,OAAO,EAAE,mBAAmB,EAAqB,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAC9F,OAAO,EAAE,2BAA2B,EAAE,yBAAyB,EAAE,MAAM,mCAAmC,CAAC;AAC3G,OAAO,EAAE,oCAAoC,EAAE,MAAM,iBAAiB,CAAC;AACvE,kBAAkB;AAClB,OAAO,EAAE,mBAAmB,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC","sourcesContent":["export type { ExtensionBindings } from \"./core/agent-session-types.js\";\nexport {\n\tCacheWarmer,\n\ttype CacheWarmingDecisionEvent,\n\ttype CacheWarmingDecisionEventResult,\n\ttype CacheWarmingStatus,\n} from \"./core/cache-warmer.ts\";\nexport type { ExecuteToolOptions, ExtensionToolContext } from \"./core/extensions/context-types.ts\";\nexport type {\n\tHostDiagnostic,\n\tHostInput,\n\tHostInputOptions,\n\tQuestionAnswer,\n\tQuestionnaireError,\n\tQuestionnaireResult,\n\tQuestionParams,\n} from \"./core/extensions/host-input.js\";\nexport {\n\ttype ExtensionContextEffectPhase,\n\tpublishExtensionContextEffect,\n\tregisterExtensionContextRetirementEffect,\n} from \"./core/extensions/runner-context.ts\";\nexport type {\n\tToolAnnotations,\n\tToolExposure,\n\tToolLoadout,\n\tToolLoadoutChanges,\n\tToolNamespace,\n\tToolRendererResolver,\n\tToolRenderers,\n} from \"./core/extensions/tool-types.ts\";\nexport { resolveRestoredModelReference } from \"./core/model-resolver-initial.ts\";\nexport type { UsageEntry } from \"./core/session-manager.ts\";\nexport { resolveSessionStore } from \"./core/session-storage.js\";\nexport { CACHE_WARMING_MODES, type CacheWarmingMode } from \"./core/settings-manager.ts\";\nexport * from \"./core/storage/index.js\";\n// Outside the storage barrel: workflow durability setup imports that barrel in every test worker.\nexport {\n\ttype ProcessStorageChoice,\n\tprocessSharedStorageSelection,\n\ttype StorageDomain,\n\tselectProcessStorage,\n} from \"./core/storage/process-selection.js\";\nexport { JsonlSessionStore } from \"./core/storage/session/jsonl-session-store.js\";\n// Internal trusted-host task integration (not model authority).\nexport { AgentTaskHost, type AgentTaskHostBinding, type AgentTaskRunnerFactory } from \"./core/tasks/agent-adapter.js\";\nexport type { AgentIntent, OperationId, TaskId, TaskRecord, TaskResult, WaitPolicy } from \"./core/tasks/contracts.js\";\nexport { type AdmittedAgentTask, collectAgentTasks } from \"./core/tasks/execution-scope.js\";\nexport {\n\tDEFAULT_TASK_HEARTBEAT_MS,\n\tMIN_TASK_HEARTBEAT_MS,\n\tTASK_HEARTBEAT_MESSAGE_TYPE,\n\ttype TaskHeartbeatDetails,\n\tvalidateTaskHeartbeatMs,\n} from \"./core/tasks/heartbeat-notice.js\";\nexport {\n\tbindOwnerTaskStore,\n\tgetOwnerTaskStore,\n\tOwnerTaskStore,\n\ttype TaskActivity,\n\twatchOwnerTaskStoreBinding,\n} from \"./core/tasks/owner-store.js\";\nexport {\n\townerTaskViewSource,\n\ttype TaskDetailText,\n\ttype TaskOutputView,\n\ttype TaskTranscriptFollow,\n\ttype TaskTranscriptView,\n\ttype TaskViewResult,\n\ttype TaskViewSource,\n} from \"./core/tasks/task-view-source.js\";\nexport { formatReadLineRange, formatToolCallWithArgs } from \"./core/tools/render-utils.ts\";\nexport {\n\tcreateTranscript,\n\ttype Transcript,\n\ttype TranscriptOptions,\n\ttype TranscriptPart,\n\ttype TranscriptTextPart,\n\ttype TranscriptThinkingPart,\n\ttype TranscriptToolCallPart,\n\ttype TranscriptToolResult,\n\ttype TranscriptToolResultFormat,\n} from \"./core/transcript.js\";\nexport { type CodemodeExtensionOptions, createCodemodeExtension } from \"./extensions/codemode/index.js\";\nexport {\n\ttype CodemodeToolDetails,\n\ttype CodemodeToolOptions,\n\tcreateCodemodeDescription,\n\tcreateCodemodeTool,\n\tcreateCodemodeToolDefinition,\n} from \"./extensions/codemode/tool.js\";\nexport { createToolSearchExtension } from \"./extensions/tool-search/index.js\";\nexport { createToolSearchToolDefinition, type ToolSearchToolOptions } from \"./extensions/tool-search/tool.js\";\nexport { renderTaskFooter, TaskList, taskListSections } from \"./modes/interactive/components/task-list.js\";\nexport { TaskRow } from \"./modes/interactive/components/task-row.js\";\nexport {\n\tapplyAssistantMessageDelta,\n\tbeginStreamingAssistantMessage,\n} from \"./modes/interactive/streaming-assistant-message.ts\";\n// Core session management\n\nexport { type Args, parseArgs } from \"./cli/args.ts\";\n// Config paths\nexport {\n\tAPP_NAME,\n\tAPP_TITLE,\n\tCONFIG_DIR_NAME,\n\tCONFIG_DIR_NAMES,\n\tgetAgentConfigPaths,\n\tgetAgentDir,\n\tgetAgentDirs,\n\tgetBundledInteractiveAssetPath,\n\tgetChangelogPath,\n\tgetDocsPath,\n\tgetEnvNames,\n\tgetEnvValue,\n\tgetExamplesPath,\n\tgetExportTemplateDir,\n\tgetInteractiveAssetsDir,\n\tgetLegacyAgentDir,\n\tgetPackageDir,\n\tgetPackageJsonPath,\n\tgetProjectConfigDirs,\n\tgetProjectConfigPaths,\n\tgetReadmePath,\n\tgetThemesDir,\n\tgetUserConfigDirs,\n\tgetUserConfigPaths,\n\thasEnvValue,\n\tisBunBinary,\n\tLEGACY_CONFIG_DIR_NAME,\n\tLEGACY_ENV_PREFIX,\n\tPACKAGE_NAME,\n\tsetEnvValue,\n\tVERSION,\n\tWORKFLOW_STAGE_SUBAGENT_GUARD_ENV,\n} from \"./config.js\";\nexport {\n\tAgentSession,\n\ttype AgentSessionConfig,\n\ttype AgentSessionEvent,\n\ttype AgentSessionEventListener,\n\ttype CompactionReason,\n\ttype ModelCycleResult,\n\ttype ParsedSkillBlock,\n\ttype PromptOptions,\n\tparseSkillBlock,\n\ttype SessionCompactOptions,\n\ttype SessionRecoveryReport,\n\ttype SessionStats,\n} from \"./core/agent-session.js\";\n// Auth and model runtime\nexport { AuthStorage, readStoredCredential } from \"./core/auth-storage.ts\";\nexport {\n\ttype AuthStorageBackend,\n\tFileAuthStorageBackend,\n\tInMemoryAuthStorageBackend,\n} from \"./core/auth-storage-backends.ts\";\nexport { type BashResult, executeBashWithOperations } from \"./core/bash-executor.ts\";\nexport { getBuiltinPackagePaths } from \"./core/builtin-packages.ts\";\nexport {\n\ttype CallbackActivityDescriptor,\n\ttype CallbackActivityKind,\n\trunCallback,\n\trunSynchronousCallback,\n} from \"./core/callback-activity.ts\";\n// Cloudflare AI Gateway over the Workers AI binding (no API token; see docs/providers.md)\nexport {\n\ttype AiGatewayBinding,\n\ttype AiGatewayBindingGateway,\n\ttype AiGatewayUniversalRequestLike,\n\tCLOUDFLARE_GATEWAY_BINDING_AUTH_SENTINEL,\n\tcreateGatewayBindingFetch,\n\ttype GatewayBindingFetchOptions,\n} from \"./core/cloudflare-gateway-binding.ts\";\n// Compaction\nexport {\n\ttype BranchPreparation,\n\ttype BranchSummaryResult,\n\ttype CollectEntriesResult,\n\ttype CompactedTranscript,\n\ttype CompactionPlannerModel,\n\ttype CompactionPlanOptions,\n\ttype CompactionRung,\n\ttype CompactionRungResult,\n\ttype CompactionRunRequest,\n\ttype CompactionUrgency,\n\tcalculateContextTokens,\n\tcollectEntriesForBranchSummary,\n\tDEFAULT_COMPACTION_SETTINGS,\n\testimateTokens,\n\ttype FileOperations,\n\ttype GenerateBranchSummaryOptions,\n\tgenerateBranchSummary,\n\tgetLastAssistantUsage,\n\ttype LineRange,\n\ttype PlannerAuth,\n\ttype PlannerBudget,\n\ttype PlannerLimitClass,\n\ttype PlannerOutcome,\n\tprepareBranchEntries,\n\tprepareCompactionBoundary,\n\trunVerbatimCompaction,\n\tserializeConversation,\n\tserializeConversationForCompaction,\n\tshouldCompact,\n\tstartNewContextWindow,\n\ttype VerbatimCompactionDetails,\n\ttype VerbatimCompactionParameters,\n\ttype VerbatimCompactionPreparation,\n\ttype VerbatimCompactionResult,\n} from \"./core/compaction/index.ts\";\nexport { createEventBus, type EventBus, type EventBusController } from \"./core/event-bus.js\";\nexport {\n\tAutoRoutingInferenceError,\n\ttype ModelRoute,\n\ttype ModelRoutingContext,\n\ttype RoutingInferenceBounds,\n\trouteExecutionModel,\n} from \"./core/execution-model-router.js\";\nexport { areExperimentalFeaturesEnabled } from \"./core/experimental.ts\";\nexport { sessionScopedExtensionState } from \"./core/extension-session-state.ts\";\nexport {\n\tExtensionStartupError,\n\ttype ExtensionStartupFailure,\n\tisExtensionStartupFailure,\n\tisTransientExtensionStartupFailure,\n} from \"./core/extension-startup-failure.ts\";\n// Run modes for programmatic SDK usage\nexport { noOpUIContext } from \"./core/extensions/runner-ui.ts\";\nexport {\n\tgetModelFastRoute,\n\tresolveUpstreamModelId,\n\tusesChatGptCodexTransport,\n\tusesFirstPartyCodexRouting,\n\twithCodexFastRouteHeaders,\n\twithFastRouteStreamOptions,\n} from \"./core/fast-model-routing.ts\";\nexport {\n\tCODEX_FAST_ROUTE_HEADER,\n\tCODEX_FAST_ROUTE_ORIGINATOR,\n} from \"./core/fast-model-routing-transport.ts\";\nexport {\n\tANTHROPIC_FAST_MODE_MODEL_IDS,\n\tcopilotAdvertisedFastModelIds,\n\tderiveFastModelVariants,\n\tFAST_MODEL_ID_SUFFIX,\n\tFAST_MODEL_SERVICE_TIER,\n\tFAST_MODEL_SPEED,\n\ttype FastModelVariantDerivation,\n\ttype FastModelVariantDiagnostic,\n\ttype FastModelVariantsOptions,\n\tfastModelId,\n\tisNativeFastRouteApi,\n\tusesAnthropicFastMode,\n\tusesOpenAIFastServiceTier,\n\tusesXaiFastServiceTier,\n\twithFastModelVariants,\n} from \"./core/fast-model-variants.ts\";\nexport {\n\tparseFlattenedKeyPath,\n\treconstructFlattenedKeys,\n\tunflattenArgumentsWithSchema,\n} from \"./core/flattened-tool-arguments.ts\";\n// Footer data provider (git branch + extension statuses - data not otherwise available to extensions)\nexport type { ReadonlyFooterDataProvider } from \"./core/footer-data-provider.ts\";\nexport {\n\tRUNTIME_INTERCOM_GROUP_ENV,\n\treadRuntimeIntercomGroup,\n\truntimeIntercomGroupEnvKey,\n} from \"./core/intercom-runtime-group.ts\";\nexport { keybindingIdentity } from \"./core/keybinding-identity.js\";\nexport { matchesMcpDirectToolSelection } from \"./core/mcp-child-policy.ts\";\nexport {\n\ttype McpExposure,\n\ttype McpOAuthConfig,\n\ttype McpServerConfig,\n\ttype McpServerContribution,\n\tmcpNamespace,\n\tvalidateMcpServerConfig,\n} from \"./core/mcp-servers.ts\";\nexport { convertToLlm } from \"./core/messages.ts\";\nexport type {\n\tModelFallbackFailureKind,\n\tModelFallbackFailureSignal,\n\tModelFallbackFailureSource,\n} from \"./core/model-fallback-failures.ts\";\nexport {\n\terrorMessage,\n\tisRetryableModelFailure,\n\tisRetryableSameModelFailure,\n\tmodelFailureMessage,\n\tnormalizeModelFailureSignal,\n} from \"./core/model-fallback-failures.ts\";\nexport { ModelRegistry } from \"./core/model-registry.ts\";\nexport {\n\teligiblePair,\n\ttype ModelConstraints,\n\tModelConstraintsSchema,\n\ttype ModelRouterOutput,\n\tparseModelConstraints,\n\tsetsProviders,\n} from \"./core/model-routing-constraints.js\";\nexport {\n\tisModelRoutingDebugEnabled,\n\tMODEL_ROUTING_DEBUG_ENV,\n\treportModelRoutingDebug,\n} from \"./core/model-routing-debug.js\";\nexport {\n\tDIFFICULTY_LEVELS,\n\ttype Difficulty,\n\tMISTAKE_COST_LEVELS,\n\ttype MistakeCost,\n\tmergeTaskNeeds,\n\tparseTaskNeeds,\n\ttype TaskNeeds,\n\tTaskNeedsSchema,\n\tWORK_KINDS,\n\ttype WorkKind,\n} from \"./core/model-routing-needs.js\";\nexport {\n\ttype CreateModelRuntimeOptions,\n\tCredentialSynchronizationError,\n\ttype CredentialSynchronizationOperation,\n\tModelRuntime,\n\ttype ModelRuntimeAuthOverrides,\n} from \"./core/model-runtime.js\";\nexport type {\n\tPackageInstallFailure,\n\tPackageManager,\n\tPathMetadata,\n\tProgressCallback,\n\tProgressEvent,\n\tResolvedMcpServer,\n\tResolvedPaths,\n\tResolvedResource,\n} from \"./core/package-manager.ts\";\nexport { DefaultPackageManager } from \"./core/package-manager.ts\";\nexport {\n\tapplyProviderRateLimitObservation,\n\tconfigureProviderRequestBudget,\n\tisProviderRateLimit,\n\tmodelIdForModel,\n\tobserveProviderRateLimits,\n\ttype ProviderRateLimitObservation,\n\ttype ProviderRateLimitSnapshot,\n\ttype ProviderRequestBudget,\n\tproviderCooldownMs,\n\tproviderIdForModel,\n\tproviderRateLimitObservations,\n\tproviderRateLimitSnapshot,\n\tproviderRetryHint,\n\tproviderUnavailableMs,\n\trecordProviderRateLimit,\n} from \"./core/provider-rate-limits.js\";\nexport type {\n\tDefaultResourceLoaderInheritanceSnapshot,\n\tResourceCollision,\n\tResourceDiagnostic,\n\tResourceLoader,\n\tSkillCandidate,\n\tSkillCatalog,\n\tSkillCatalogCommand,\n\tSkillResolution,\n} from \"./core/resource-loader.ts\";\nexport {\n\tbuildSkillCatalog,\n\tDefaultResourceLoader,\n\tgetSkillCatalog,\n\tloadProjectContextFiles,\n} from \"./core/resource-loader.ts\";\nexport { nextRetryDecision, type RetryDecision, type RetryPolicySettings } from \"./core/retry-policy.ts\";\n// SDK for programmatic usage\nexport {\n\tAgentSessionRuntime,\n\ttype AgentSessionRuntimeDiagnostic,\n\ttype AgentSessionServices,\n\ttype AtomicBuiltin,\n\ttype CreateAgentSessionFromServicesOptions,\n\ttype CreateAgentSessionOptions,\n\ttype CreateAgentSessionResult,\n\ttype CreateAgentSessionRuntimeFactory,\n\ttype CreateAgentSessionRuntimeResult,\n\ttype CreateAgentSessionServicesOptions,\n\t// Factory\n\tcreateAgentSession,\n\tcreateAgentSessionFromServices,\n\tcreateAgentSessionRuntime,\n\tcreateAgentSessionServices,\n\tcreateBashTool,\n\t// Tool factories (for custom cwd)\n\tcreateCodingTools,\n\tcreateEditTool,\n\tcreateFindTool,\n\tcreateLsTool,\n\tcreatePowerShellTool,\n\tcreateReadOnlyTools,\n\tcreateReadTool,\n\tcreateSearchTool,\n\tcreateStructuredOutputCapture,\n\tcreateStructuredOutputTool,\n\tcreateWriteTool,\n\ttype JsonObject,\n\ttype JsonPrimitive,\n\ttype JsonValue,\n\ttype MessageEndEvent,\n\ttype MessageStartEvent,\n\ttype MessageUpdateEvent,\n\ttype PromptTemplate,\n\ttype ResourceAdmission,\n\ttype ResourceAdmissionRequest,\n\ttype ResourcePermit,\n\ttype ResourceProcessIdentity,\n\tSTRUCTURED_OUTPUT_TOOL_NAME,\n\ttype StructuredOutputCapture,\n\ttype StructuredOutputFileCapture,\n\ttype StructuredOutputToolOptions,\n\ttype ToolExecutionEndEvent,\n\ttype ToolExecutionStartEvent,\n\ttype ToolExecutionUpdateEvent,\n\twithResourceAdmission,\n} from \"./core/sdk.ts\";\nexport {\n\ttype BranchSummaryEntry,\n\tbuildContextEntries,\n\tbuildSessionContext,\n\tbuildSessionProjection,\n\ttype CompactionEntry,\n\ttype ContextEditableContent,\n\ttype ContextEditEntry,\n\tCURRENT_SESSION_VERSION,\n\ttype CustomEntry,\n\ttype CustomMessageEntry,\n\ttype FileEntry,\n\tgetDefaultSessionDirPath,\n\tgetLatestCompactionBoundaryEntry,\n\ttype ModelChangeEntry,\n\ttype NewSessionOptions,\n\ttype ProjectedSessionEntry,\n\tparseSessionEntries,\n\ttype SessionContext,\n\ttype SessionEntry,\n\ttype SessionEntryBase,\n\tSessionEntryError,\n\ttype SessionHeader,\n\tSessionIdError,\n\ttype SessionInfo,\n\ttype SessionInfoEntry,\n\tSessionManager,\n\ttype SessionMessageEntry,\n\ttype SessionNameState,\n\ttype SessionProjection,\n\ttype SessionSummaryEntry,\n\ttype SessionTreeNode,\n\ttype SessionWorkflowMetadata,\n\tsessionEntryToContextMessages,\n\ttype ThinkingLevelChangeEntry,\n} from \"./core/session-manager.ts\";\nexport {\n\tWORKFLOW_SESSION_METADATA_ENV,\n\tworkflowSessionMetadataFromEnv,\n} from \"./core/session-manager-classification.ts\";\nexport type { DefaultProjectTrust, QuietStartup } from \"./core/settings-manager.ts\";\nexport {\n\ttype CompactionModelOverride,\n\ttype CompactionSettings,\n\ttype ImageSettings,\n\ttype ModelRoutingSettings,\n\ttype PackageSource,\n\ttype RetrySettings,\n\ttype Settings,\n\tSettingsManager,\n\ttype SettingsManagerCreateOptions,\n} from \"./core/settings-manager.ts\";\n// Skills\nexport {\n\tformatSkillsForPrompt,\n\ttype LoadSkillsFromDirOptions,\n\ttype LoadSkillsResult,\n\tloadSkills,\n\tloadSkillsFromDir,\n\ttype Skill,\n\ttype SkillFrontmatter,\n} from \"./core/skills.ts\";\nexport { createSyntheticSourceInfo } from \"./core/source-info.ts\";\nexport {\n\tgenerateStructuredOutput,\n\ttype StructuredOutputRequest,\n\ttype StructuredOutputResult,\n} from \"./core/structured-output/index.js\";\nexport type { NormalizedBuildSystemPromptOptions } from \"./core/system-prompt.ts\";\nexport {\n\tformatToolStatus,\n\ttype ToolSelectionSource,\n\ttype ToolSelectionStatus,\n\ttype ToolStatus,\n\ttype ToolStatusFormatStyle,\n\ttype ToolStatusReport,\n\ttype UnavailableToolStatus,\n} from \"./core/tool-status.js\";\nexport { type EditDiffResult, generateDiffString, generateUnifiedPatch } from \"./core/tools/edit-diff.ts\";\n// Builtin tool definitions reusable by first-party extensions (e.g. workflows\n// invoking the structured ask_user_question UI deterministically).\n// Tools\nexport {\n\tBASH_SHELL_PRESENTATION,\n\ttype BashOperations,\n\ttype BashSpawnContext,\n\ttype BashSpawnHook,\n\ttype BashToolDetails,\n\ttype BashToolInput,\n\ttype BashToolOptions,\n\tbashToolSystemPromptContribution,\n\tcreateAskUserQuestionToolDefinition,\n\tcreateBashToolDefinition,\n\tcreateEditToolDefinition,\n\tcreateFindToolDefinition,\n\tcreateKillTool,\n\tcreateKillToolDefinition,\n\tcreateLocalBashOperations,\n\tcreateLocalPowerShellOperations,\n\tcreateLsToolDefinition,\n\tcreatePowerShellToolDefinition,\n\tcreateReadToolDefinition,\n\tcreateSearchToolDefinition,\n\tcreateWriteToolDefinition,\n\tDEFAULT_MAX_BYTES,\n\tDEFAULT_MAX_LINES,\n\ttype EditOperations,\n\ttype EditToolDetails,\n\ttype EditToolInput,\n\ttype EditToolOptions,\n\teditToolSystemPromptContribution,\n\ttype FindOperations,\n\ttype FindToolDetails,\n\ttype FindToolInput,\n\ttype FindToolOptions,\n\tfindToolSystemPromptContribution,\n\tformatSize,\n\ttype KillToolOptions,\n\ttype LsOperations,\n\ttype LsToolDetails,\n\ttype LsToolInput,\n\ttype LsToolOptions,\n\tlsToolSystemPromptContribution,\n\ttype PowerShellOperations,\n\ttype PowerShellSpawnContext,\n\ttype PowerShellSpawnHook,\n\ttype PowerShellToolDetails,\n\ttype PowerShellToolInput,\n\ttype PowerShellToolOptions,\n\ttype ReadOperations,\n\ttype ReadToolDetails,\n\ttype ReadToolInput,\n\ttype ReadToolOptions,\n\treadToolSystemPromptContribution,\n\ttype SearchToolDetails,\n\ttype SearchToolInput,\n\ttype SearchToolOptions,\n\ttype ShellToolPresentation,\n\tsearchToolSystemPromptContribution,\n\ttype ToolsOptions,\n\ttype TruncationOptions,\n\ttype TruncationResult,\n\ttruncateHead,\n\ttruncateLine,\n\ttruncateTail,\n\ttype WriteFileOptions,\n\ttype WriteOperations,\n\ttype WriteToolInput,\n\ttype WriteToolOptions,\n\twithFileMutationQueue,\n\twriteToolSystemPromptContribution,\n} from \"./core/tools/index.js\";\nexport {\n\thasProjectTrustInputs,\n\thasTrustRequiringProjectResources,\n\ttype ProjectTrustDecision,\n\tProjectTrustStore,\n\ttype ProjectTrustStoreEntry,\n\ttype ProjectTrustUpdate,\n\tTRUST_REQUIRING_PROJECT_CONFIG_RESOURCES,\n} from \"./core/trust-manager.ts\";\nexport { StringEnum, type StringEnumOptions } from \"./core/typebox-compat.ts\";\nexport {\n\ttype LoadedMcpConfig,\n\ttype McpServerConfigPatch,\n\ttype McpServerEntry,\n\tupdateMcpServerConfig,\n} from \"./extensions/mcp/config.ts\";\nexport { createMcpExtension, type McpExtensionOptions } from \"./extensions/mcp/index.js\";\nexport { McpOAuthCredentialStore } from \"./extensions/mcp/oauth.ts\";\nexport * from \"./index-extensions.js\";\n// Main entry point\nexport { type MainOptions, main } from \"./main.ts\";\nexport {\n\tInteractiveMode,\n\ttype InteractiveModeOptions,\n\ttype ModelInfo,\n\ttype PrintModeOptions,\n\tRpcClient,\n\ttype RpcClientOptions,\n\ttype RpcCommand,\n\ttype RpcEvent,\n\ttype RpcEventListener,\n\ttype RpcExtensionUIRequest,\n\ttype RpcExtensionUIResponse,\n\ttype RpcResponse,\n\ttype RpcSessionState,\n\trunPrintMode,\n\trunRpcMode,\n} from \"./modes/index.ts\";\n// UI components for extensions\nexport {\n\tArminComponent,\n\tAssistantMessageComponent,\n\tBashExecutionComponent,\n\tBorderedLoader,\n\tBranchSummaryMessageComponent,\n\ttype ChatMessageEntry,\n\ttype ChatMessageRenderOptions,\n\t// Internal host seam for bundled workflow stage chat; not yet a stable extension API.\n\tChatSessionHost,\n\ttype ChatSessionHostBashRequest,\n\ttype ChatSessionHostCommands,\n\ttype ChatSessionHostEntry,\n\ttype ChatSessionHostOpts,\n\ttype ChatSessionHostStyle,\n\ttype ChatSessionSubmitMode,\n\tChatTranscriptComponent,\n\ttype ChatTranscriptEntryLike,\n\ttype ChatTranscriptRenderer,\n\ttype ChatTranscriptRole,\n\tCustomEditor,\n\ttype CustomEditorOptions,\n\tCustomEntryComponent,\n\tCustomMessageComponent,\n\tchatEntriesFromAgentMessages,\n\tDynamicBorder,\n\tExtensionEditorComponent,\n\tExtensionInputComponent,\n\tExtensionSelectorComponent,\n\tFooterComponent,\n\tkeyHint,\n\tkeyHintIfBound,\n\tkeyText,\n\tLiveChatEntriesController,\n\tLoginDialogComponent,\n\tModelSelectorComponent,\n\tOAuthSelectorComponent,\n\ttype RenderDiffOptions,\n\trawKeyHint,\n\trenderChatMessageEntry,\n\trenderDiff,\n\tScrollableChatTranscriptComponent,\n\tScrollableComponentViewport,\n\tSessionSelectorComponent,\n\ttype SettingsCallbacks,\n\ttype SettingsConfig,\n\tSettingsSelectorComponent,\n\tShowImagesSelectorComponent,\n\tSkillInvocationMessageComponent,\n\tThemeSelectorComponent,\n\tThinkingSelectorComponent,\n\tToolExecutionComponent,\n\ttype ToolExecutionOptions,\n\tTRANSCRIPT_JUMP_TO_END_URL,\n\tTranscriptFollowIndicator,\n\tTreeSelectorComponent,\n\ttruncateToVisualLines,\n\tUsageMeterComponent,\n\tUserMessageComponent,\n\tUserMessageSelectorComponent,\n\ttype VisualTruncateResult,\n\tWorkingStatusComponent,\n\ttype WorkingStatusComponentOptions,\n} from \"./modes/interactive/components/index.ts\";\nexport {\n\tclassifyChatCommand,\n\tcreateSessionSkillAutocompleteProvider,\n\tgetSessionCommandCatalog,\n\tgetSessionSkillCommands,\n\ttype PendingSessionCommandCatalog,\n\ttype SessionCommandCatalog,\n} from \"./modes/interactive/skill-command-autocomplete.ts\";\n// Theme utilities for custom tools and extensions\nexport {\n\tgetLanguageFromPath,\n\tgetMarkdownTheme,\n\tgetSelectListTheme,\n\tgetSettingsListTheme,\n\thighlightCode,\n\tinitTheme,\n\tTheme,\n\ttype ThemeColor,\n} from \"./modes/interactive/theme/theme.js\";\nexport { pickWhimsicalWorkingMessage } from \"./modes/interactive/whimsical-messages.ts\";\nexport { createChildProcessEnvironment, spawnProcess } from \"./utils/child-process.ts\";\n// Clipboard utilities\nexport { copyToClipboard } from \"./utils/clipboard.js\";\nexport { parseFrontmatter, stripFrontmatter } from \"./utils/frontmatter.ts\";\nexport {\n\tisSafeFsWatchPathError,\n\tisUnsafeWindowsShortPath,\n\tresolveNativeWatchPath,\n\tSAFE_FS_WATCH_CANONICALIZATION_FAILED,\n\tSAFE_FS_WATCH_UNSAFE_WINDOWS_SHORT_PATH,\n\ttype SafeFsWatchErrorCode,\n\ttype SafeFsWatchPathError,\n\twatchWithErrorHandler,\n} from \"./utils/fs-watch.ts\";\nexport { createGitEnvironment, GIT_LOCAL_ENV_VARS } from \"./utils/git-env.ts\";\nexport { convertToPng } from \"./utils/image-convert.ts\";\nexport { formatDimensionNote, type ResizedImage, resizeImage } from \"./utils/image-resize.ts\";\nexport { INTERACTIVE_ENGINE_ENV_VARS, scrubInteractiveEngineEnv } from \"./utils/interactive-engine-env.ts\";\nexport { detectSupportedImageMimeTypeFromFile } from \"./utils/mime.ts\";\n// Shell utilities\nexport { getPowerShellConfig, getShellConfig } from \"./utils/shell.ts\";\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EACN,WAAW,GAIX,MAAM,wBAAwB,CAAC;AAWhC,OAAO,EAEN,6BAA6B,EAC7B,wCAAwC,GACxC,MAAM,qCAAqC,CAAC;AAU7C,OAAO,EAAE,6BAA6B,EAAE,MAAM,kCAAkC,CAAC;AAEjF,OAAO,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAC;AAChE,OAAO,EAAE,mBAAmB,EAAyB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AAE,MAAM,0BAA0B,CAAC;AACvF,sBAAsB;AACtB,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAC5E,OAAO,EACN,sBAAsB,EACtB,wBAAwB,EACxB,sBAAsB,EACtB,qCAAqC,EACrC,uCAAuC,EAGvC,qBAAqB,GACrB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,oBAAoB,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AAC9E,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AACxD,OAAO,EAAE,mBAAmB,EAAqB,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAC9F,OAAO,EAAE,2BAA2B,EAAE,yBAAyB,EAAE,MAAM,mCAAmC,CAAC;AAC3G,OAAO,EAAE,oCAAoC,EAAE,MAAM,iBAAiB,CAAC;AACvE,kBAAkB;AAClB,OAAO,EAAE,mBAAmB,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC","sourcesContent":["export type { ExtensionBindings } from \"./core/agent-session-types.js\";\nexport {\n\tCacheWarmer,\n\ttype CacheWarmingDecisionEvent,\n\ttype CacheWarmingDecisionEventResult,\n\ttype CacheWarmingStatus,\n} from \"./core/cache-warmer.ts\";\nexport type { ExecuteToolOptions, ExtensionToolContext } from \"./core/extensions/context-types.ts\";\nexport type {\n\tHostDiagnostic,\n\tHostInput,\n\tHostInputOptions,\n\tQuestionAnswer,\n\tQuestionnaireError,\n\tQuestionnaireResult,\n\tQuestionParams,\n} from \"./core/extensions/host-input.js\";\nexport {\n\ttype ExtensionContextEffectPhase,\n\tpublishExtensionContextEffect,\n\tregisterExtensionContextRetirementEffect,\n} from \"./core/extensions/runner-context.ts\";\nexport type {\n\tToolAnnotations,\n\tToolExposure,\n\tToolLoadout,\n\tToolLoadoutChanges,\n\tToolNamespace,\n\tToolRendererResolver,\n\tToolRenderers,\n} from \"./core/extensions/tool-types.ts\";\nexport { resolveRestoredModelReference } from \"./core/model-resolver-initial.ts\";\nexport type { UsageEntry } from \"./core/session-manager.ts\";\nexport { resolveSessionStore } from \"./core/session-storage.js\";\nexport { CACHE_WARMING_MODES, type CacheWarmingMode } from \"./core/settings-manager.ts\";\nexport * from \"./core/storage/index.js\";\n// Outside the storage barrel: workflow durability setup imports that barrel in every test worker.\nexport {\n\ttype ProcessStorageChoice,\n\tprocessSharedStorageSelection,\n\ttype StorageDomain,\n\tselectProcessStorage,\n} from \"./core/storage/process-selection.js\";\nexport { JsonlSessionStore } from \"./core/storage/session/jsonl-session-store.js\";\n// Internal trusted-host task integration (not model authority).\nexport { AgentTaskHost, type AgentTaskHostBinding, type AgentTaskRunnerFactory } from \"./core/tasks/agent-adapter.js\";\nexport type { AgentIntent, OperationId, TaskId, TaskRecord, TaskResult, WaitPolicy } from \"./core/tasks/contracts.js\";\nexport { type AdmittedAgentTask, collectAgentTasks } from \"./core/tasks/execution-scope.js\";\nexport {\n\tDEFAULT_TASK_HEARTBEAT_MS,\n\tMIN_TASK_HEARTBEAT_MS,\n\tTASK_HEARTBEAT_MESSAGE_TYPE,\n\ttype TaskHeartbeatDetails,\n\tvalidateTaskHeartbeatMs,\n} from \"./core/tasks/heartbeat-notice.js\";\nexport {\n\tbindOwnerTaskStore,\n\tgetOwnerTaskStore,\n\tOwnerTaskStore,\n\ttype TaskActivity,\n\twatchOwnerTaskStoreBinding,\n} from \"./core/tasks/owner-store.js\";\nexport {\n\townerTaskViewSource,\n\ttype TaskDetailText,\n\ttype TaskOutputView,\n\ttype TaskTranscriptFollow,\n\ttype TaskTranscriptView,\n\ttype TaskViewResult,\n\ttype TaskViewSource,\n} from \"./core/tasks/task-view-source.js\";\nexport { formatReadLineRange, formatToolCallWithArgs } from \"./core/tools/render-utils.ts\";\nexport {\n\tcreateTranscript,\n\ttype Transcript,\n\ttype TranscriptOptions,\n\ttype TranscriptPart,\n\ttype TranscriptTextPart,\n\ttype TranscriptThinkingPart,\n\ttype TranscriptToolCallPart,\n\ttype TranscriptToolResult,\n\ttype TranscriptToolResultFormat,\n} from \"./core/transcript.js\";\nexport { type CodemodeExtensionOptions, createCodemodeExtension } from \"./extensions/codemode/index.js\";\nexport {\n\ttype CodemodeToolDetails,\n\ttype CodemodeToolOptions,\n\tcreateCodemodeDescription,\n\tcreateCodemodeTool,\n\tcreateCodemodeToolDefinition,\n} from \"./extensions/codemode/tool.js\";\nexport { createToolSearchExtension } from \"./extensions/tool-search/index.js\";\nexport { createToolSearchToolDefinition, type ToolSearchToolOptions } from \"./extensions/tool-search/tool.js\";\nexport { renderTaskFooter, TaskList, taskListSections } from \"./modes/interactive/components/task-list.js\";\nexport { TaskRow } from \"./modes/interactive/components/task-row.js\";\nexport {\n\tapplyAssistantMessageDelta,\n\tbeginStreamingAssistantMessage,\n} from \"./modes/interactive/streaming-assistant-message.ts\";\n// Core session management\n\nexport { type Args, parseArgs } from \"./cli/args.ts\";\n// Config paths\nexport {\n\tAPP_NAME,\n\tAPP_TITLE,\n\tCONFIG_DIR_NAME,\n\tCONFIG_DIR_NAMES,\n\tgetAgentConfigPaths,\n\tgetAgentDir,\n\tgetAgentDirs,\n\tgetBundledInteractiveAssetPath,\n\tgetChangelogPath,\n\tgetDocsPath,\n\tgetEnvNames,\n\tgetEnvValue,\n\tgetExamplesPath,\n\tgetExportTemplateDir,\n\tgetInteractiveAssetsDir,\n\tgetLegacyAgentDir,\n\tgetPackageDir,\n\tgetPackageJsonPath,\n\tgetProjectConfigDirs,\n\tgetProjectConfigPaths,\n\tgetReadmePath,\n\tgetThemesDir,\n\tgetUserConfigDirs,\n\tgetUserConfigPaths,\n\thasEnvValue,\n\tisBunBinary,\n\tLEGACY_CONFIG_DIR_NAME,\n\tLEGACY_ENV_PREFIX,\n\tPACKAGE_NAME,\n\tsetEnvValue,\n\tVERSION,\n\tWORKFLOW_STAGE_SUBAGENT_GUARD_ENV,\n} from \"./config.js\";\nexport {\n\tAgentSession,\n\ttype AgentSessionConfig,\n\ttype AgentSessionEvent,\n\ttype AgentSessionEventListener,\n\ttype CompactionReason,\n\ttype ModelCycleResult,\n\ttype ParsedSkillBlock,\n\ttype PromptOptions,\n\tparseSkillBlock,\n\ttype SessionCompactOptions,\n\ttype SessionRecoveryReport,\n\ttype SessionStats,\n} from \"./core/agent-session.js\";\n// Auth and model runtime\nexport { AuthStorage, readStoredCredential } from \"./core/auth-storage.ts\";\nexport {\n\ttype AuthStorageBackend,\n\tFileAuthStorageBackend,\n\tInMemoryAuthStorageBackend,\n} from \"./core/auth-storage-backends.ts\";\nexport { type BashResult, executeBashWithOperations } from \"./core/bash-executor.ts\";\nexport { getBuiltinPackagePaths } from \"./core/builtin-packages.ts\";\nexport {\n\ttype CallbackActivityDescriptor,\n\ttype CallbackActivityKind,\n\trunCallback,\n\trunSynchronousCallback,\n} from \"./core/callback-activity.ts\";\n// Cloudflare AI Gateway over the Workers AI binding (no API token; see docs/providers.md)\nexport {\n\ttype AiGatewayBinding,\n\ttype AiGatewayBindingGateway,\n\ttype AiGatewayUniversalRequestLike,\n\tCLOUDFLARE_GATEWAY_BINDING_AUTH_SENTINEL,\n\tcreateGatewayBindingFetch,\n\ttype GatewayBindingFetchOptions,\n} from \"./core/cloudflare-gateway-binding.ts\";\n// Compaction\nexport {\n\ttype BranchPreparation,\n\ttype BranchSummaryResult,\n\ttype CollectEntriesResult,\n\ttype CompactedTranscript,\n\ttype CompactionPlannerModel,\n\ttype CompactionPlanOptions,\n\ttype CompactionRung,\n\ttype CompactionRungResult,\n\ttype CompactionRunRequest,\n\ttype CompactionUrgency,\n\tcalculateContextTokens,\n\tcollectEntriesForBranchSummary,\n\tDEFAULT_COMPACTION_SETTINGS,\n\testimateTokens,\n\ttype FileOperations,\n\ttype GenerateBranchSummaryOptions,\n\tgenerateBranchSummary,\n\tgetLastAssistantUsage,\n\ttype LineRange,\n\ttype PlannerAuth,\n\ttype PlannerBudget,\n\ttype PlannerLimitClass,\n\ttype PlannerOutcome,\n\tprepareBranchEntries,\n\tprepareCompactionBoundary,\n\trunVerbatimCompaction,\n\tserializeConversation,\n\tserializeConversationForCompaction,\n\tshouldCompact,\n\tstartNewContextWindow,\n\ttype VerbatimCompactionDetails,\n\ttype VerbatimCompactionParameters,\n\ttype VerbatimCompactionPreparation,\n\ttype VerbatimCompactionResult,\n} from \"./core/compaction/index.ts\";\nexport { createEventBus, type EventBus, type EventBusController } from \"./core/event-bus.js\";\nexport {\n\tAutoRoutingInferenceError,\n\ttype ModelRoute,\n\ttype ModelRoutingContext,\n\ttype RoutingInferenceBounds,\n\trouteExecutionModel,\n} from \"./core/execution-model-router.js\";\nexport { areExperimentalFeaturesEnabled } from \"./core/experimental.ts\";\nexport { sessionScopedExtensionState } from \"./core/extension-session-state.ts\";\nexport {\n\tExtensionStartupError,\n\ttype ExtensionStartupFailure,\n\tisExtensionStartupFailure,\n\tisTransientExtensionStartupFailure,\n} from \"./core/extension-startup-failure.ts\";\n// Run modes for programmatic SDK usage\nexport { noOpUIContext } from \"./core/extensions/runner-ui.ts\";\nexport {\n\tgetModelFastRoute,\n\tresolveUpstreamModelId,\n\tusesChatGptCodexTransport,\n\tusesFirstPartyCodexRouting,\n\twithCodexFastRouteHeaders,\n\twithFastRouteStreamOptions,\n} from \"./core/fast-model-routing.ts\";\nexport {\n\tCODEX_FAST_ROUTE_HEADER,\n\tCODEX_FAST_ROUTE_ORIGINATOR,\n} from \"./core/fast-model-routing-transport.ts\";\nexport {\n\tANTHROPIC_FAST_MODE_MODEL_IDS,\n\tcopilotAdvertisedFastModelIds,\n\tderiveFastModelVariants,\n\tFAST_MODEL_ID_SUFFIX,\n\tFAST_MODEL_SERVICE_TIER,\n\tFAST_MODEL_SPEED,\n\ttype FastModelVariantDerivation,\n\ttype FastModelVariantDiagnostic,\n\ttype FastModelVariantsOptions,\n\tfastModelId,\n\tisNativeFastRouteApi,\n\tusesAnthropicFastMode,\n\tusesOpenAIFastServiceTier,\n\tusesXaiFastServiceTier,\n\twithFastModelVariants,\n} from \"./core/fast-model-variants.ts\";\nexport {\n\tparseFlattenedKeyPath,\n\treconstructFlattenedKeys,\n\tunflattenArgumentsWithSchema,\n} from \"./core/flattened-tool-arguments.ts\";\n// Footer data provider (git branch + extension statuses - data not otherwise available to extensions)\nexport type { ReadonlyFooterDataProvider } from \"./core/footer-data-provider.ts\";\nexport {\n\tRUNTIME_INTERCOM_GROUP_ENV,\n\treadRuntimeIntercomGroup,\n\truntimeIntercomGroupEnvKey,\n} from \"./core/intercom-runtime-group.ts\";\nexport { keybindingIdentity } from \"./core/keybinding-identity.js\";\nexport { matchesMcpDirectToolSelection } from \"./core/mcp-child-policy.ts\";\nexport {\n\ttype McpExposure,\n\ttype McpOAuthConfig,\n\ttype McpServerConfig,\n\ttype McpServerContribution,\n\tmcpNamespace,\n\tvalidateMcpServerConfig,\n} from \"./core/mcp-servers.ts\";\nexport { convertToLlm } from \"./core/messages.ts\";\nexport type {\n\tModelFallbackFailureKind,\n\tModelFallbackFailureOptions,\n\tModelFallbackFailureSignal,\n\tModelFallbackFailureSource,\n} from \"./core/model-fallback-failures.ts\";\nexport {\n\terrorMessage,\n\tisRetryableModelFailure,\n\tisRetryableSameModelFailure,\n\tmodelFailureMessage,\n\tnormalizeModelFailureSignal,\n} from \"./core/model-fallback-failures.ts\";\nexport { ModelRegistry } from \"./core/model-registry.ts\";\nexport {\n\teligiblePair,\n\ttype ModelConstraints,\n\tModelConstraintsSchema,\n\ttype ModelRouterOutput,\n\tparseModelConstraints,\n\tsetsProviders,\n} from \"./core/model-routing-constraints.js\";\nexport {\n\tisModelRoutingDebugEnabled,\n\tMODEL_ROUTING_DEBUG_ENV,\n\treportModelRoutingDebug,\n} from \"./core/model-routing-debug.js\";\nexport {\n\tDIFFICULTY_LEVELS,\n\ttype Difficulty,\n\tMISTAKE_COST_LEVELS,\n\ttype MistakeCost,\n\tmergeTaskNeeds,\n\tparseTaskNeeds,\n\ttype TaskNeeds,\n\tTaskNeedsSchema,\n\tWORK_KINDS,\n\ttype WorkKind,\n} from \"./core/model-routing-needs.js\";\nexport {\n\ttype CreateModelRuntimeOptions,\n\tCredentialSynchronizationError,\n\ttype CredentialSynchronizationOperation,\n\tModelRuntime,\n\ttype ModelRuntimeAuthOverrides,\n} from \"./core/model-runtime.js\";\nexport type {\n\tPackageInstallFailure,\n\tPackageManager,\n\tPathMetadata,\n\tProgressCallback,\n\tProgressEvent,\n\tResolvedMcpServer,\n\tResolvedPaths,\n\tResolvedResource,\n} from \"./core/package-manager.ts\";\nexport { DefaultPackageManager } from \"./core/package-manager.ts\";\nexport {\n\tapplyProviderRateLimitObservation,\n\tconfigureProviderRequestBudget,\n\tisProviderRateLimit,\n\tmodelIdForModel,\n\tobserveProviderRateLimits,\n\ttype ProviderRateLimitObservation,\n\ttype ProviderRateLimitSnapshot,\n\ttype ProviderRequestBudget,\n\tproviderCooldownMs,\n\tproviderIdForModel,\n\tproviderRateLimitObservations,\n\tproviderRateLimitSnapshot,\n\tproviderRetryHint,\n\tproviderUnavailableMs,\n\trecordProviderRateLimit,\n} from \"./core/provider-rate-limits.js\";\nexport type {\n\tDefaultResourceLoaderInheritanceSnapshot,\n\tResourceCollision,\n\tResourceDiagnostic,\n\tResourceLoader,\n\tSkillCandidate,\n\tSkillCatalog,\n\tSkillCatalogCommand,\n\tSkillResolution,\n} from \"./core/resource-loader.ts\";\nexport {\n\tbuildSkillCatalog,\n\tDefaultResourceLoader,\n\tgetSkillCatalog,\n\tloadProjectContextFiles,\n} from \"./core/resource-loader.ts\";\nexport { nextRetryDecision, type RetryDecision, type RetryPolicySettings } from \"./core/retry-policy.ts\";\n// SDK for programmatic usage\nexport {\n\tAgentSessionRuntime,\n\ttype AgentSessionRuntimeDiagnostic,\n\ttype AgentSessionServices,\n\ttype AtomicBuiltin,\n\ttype CreateAgentSessionFromServicesOptions,\n\ttype CreateAgentSessionOptions,\n\ttype CreateAgentSessionResult,\n\ttype CreateAgentSessionRuntimeFactory,\n\ttype CreateAgentSessionRuntimeResult,\n\ttype CreateAgentSessionServicesOptions,\n\t// Factory\n\tcreateAgentSession,\n\tcreateAgentSessionFromServices,\n\tcreateAgentSessionRuntime,\n\tcreateAgentSessionServices,\n\tcreateBashTool,\n\t// Tool factories (for custom cwd)\n\tcreateCodingTools,\n\tcreateEditTool,\n\tcreateFindTool,\n\tcreateLsTool,\n\tcreatePowerShellTool,\n\tcreateReadOnlyTools,\n\tcreateReadTool,\n\tcreateSearchTool,\n\tcreateStructuredOutputCapture,\n\tcreateStructuredOutputTool,\n\tcreateWriteTool,\n\ttype JsonObject,\n\ttype JsonPrimitive,\n\ttype JsonValue,\n\ttype MessageEndEvent,\n\ttype MessageStartEvent,\n\ttype MessageUpdateEvent,\n\ttype PromptTemplate,\n\ttype ResourceAdmission,\n\ttype ResourceAdmissionRequest,\n\ttype ResourcePermit,\n\ttype ResourceProcessIdentity,\n\tSTRUCTURED_OUTPUT_TOOL_NAME,\n\ttype StructuredOutputCapture,\n\ttype StructuredOutputFileCapture,\n\ttype StructuredOutputToolOptions,\n\ttype ToolExecutionEndEvent,\n\ttype ToolExecutionStartEvent,\n\ttype ToolExecutionUpdateEvent,\n\twithResourceAdmission,\n} from \"./core/sdk.ts\";\nexport {\n\ttype BranchSummaryEntry,\n\tbuildContextEntries,\n\tbuildSessionContext,\n\tbuildSessionProjection,\n\ttype CompactionEntry,\n\ttype ContextEditableContent,\n\ttype ContextEditEntry,\n\tCURRENT_SESSION_VERSION,\n\ttype CustomEntry,\n\ttype CustomMessageEntry,\n\ttype FileEntry,\n\tgetDefaultSessionDirPath,\n\tgetLatestCompactionBoundaryEntry,\n\ttype ModelChangeEntry,\n\ttype NewSessionOptions,\n\ttype ProjectedSessionEntry,\n\tparseSessionEntries,\n\ttype SessionContext,\n\ttype SessionEntry,\n\ttype SessionEntryBase,\n\tSessionEntryError,\n\ttype SessionHeader,\n\tSessionIdError,\n\ttype SessionInfo,\n\ttype SessionInfoEntry,\n\tSessionManager,\n\ttype SessionMessageEntry,\n\ttype SessionNameState,\n\ttype SessionProjection,\n\ttype SessionSummaryEntry,\n\ttype SessionTreeNode,\n\ttype SessionWorkflowMetadata,\n\tsessionEntryToContextMessages,\n\ttype ThinkingLevelChangeEntry,\n} from \"./core/session-manager.ts\";\nexport {\n\tWORKFLOW_SESSION_METADATA_ENV,\n\tworkflowSessionMetadataFromEnv,\n} from \"./core/session-manager-classification.ts\";\nexport type { DefaultProjectTrust, QuietStartup } from \"./core/settings-manager.ts\";\nexport {\n\ttype CompactionModelOverride,\n\ttype CompactionSettings,\n\ttype ImageSettings,\n\ttype ModelRoutingSettings,\n\ttype PackageSource,\n\ttype RetrySettings,\n\ttype Settings,\n\tSettingsManager,\n\ttype SettingsManagerCreateOptions,\n} from \"./core/settings-manager.ts\";\n// Skills\nexport {\n\tformatSkillsForPrompt,\n\ttype LoadSkillsFromDirOptions,\n\ttype LoadSkillsResult,\n\tloadSkills,\n\tloadSkillsFromDir,\n\ttype Skill,\n\ttype SkillFrontmatter,\n} from \"./core/skills.ts\";\nexport { createSyntheticSourceInfo } from \"./core/source-info.ts\";\nexport {\n\tgenerateStructuredOutput,\n\ttype StructuredOutputRequest,\n\ttype StructuredOutputResult,\n} from \"./core/structured-output/index.js\";\nexport type { NormalizedBuildSystemPromptOptions } from \"./core/system-prompt.ts\";\nexport {\n\tformatToolStatus,\n\ttype ToolSelectionSource,\n\ttype ToolSelectionStatus,\n\ttype ToolStatus,\n\ttype ToolStatusFormatStyle,\n\ttype ToolStatusReport,\n\ttype UnavailableToolStatus,\n} from \"./core/tool-status.js\";\nexport { type EditDiffResult, generateDiffString, generateUnifiedPatch } from \"./core/tools/edit-diff.ts\";\n// Builtin tool definitions reusable by first-party extensions (e.g. workflows\n// invoking the structured ask_user_question UI deterministically).\n// Tools\nexport {\n\tBASH_SHELL_PRESENTATION,\n\ttype BashOperations,\n\ttype BashSpawnContext,\n\ttype BashSpawnHook,\n\ttype BashToolDetails,\n\ttype BashToolInput,\n\ttype BashToolOptions,\n\tbashToolSystemPromptContribution,\n\tcreateAskUserQuestionToolDefinition,\n\tcreateBashToolDefinition,\n\tcreateEditToolDefinition,\n\tcreateFindToolDefinition,\n\tcreateKillTool,\n\tcreateKillToolDefinition,\n\tcreateLocalBashOperations,\n\tcreateLocalPowerShellOperations,\n\tcreateLsToolDefinition,\n\tcreatePowerShellToolDefinition,\n\tcreateReadToolDefinition,\n\tcreateSearchToolDefinition,\n\tcreateWriteToolDefinition,\n\tDEFAULT_MAX_BYTES,\n\tDEFAULT_MAX_LINES,\n\ttype EditOperations,\n\ttype EditToolDetails,\n\ttype EditToolInput,\n\ttype EditToolOptions,\n\teditToolSystemPromptContribution,\n\ttype FindOperations,\n\ttype FindToolDetails,\n\ttype FindToolInput,\n\ttype FindToolOptions,\n\tfindToolSystemPromptContribution,\n\tformatSize,\n\ttype KillToolOptions,\n\ttype LsOperations,\n\ttype LsToolDetails,\n\ttype LsToolInput,\n\ttype LsToolOptions,\n\tlsToolSystemPromptContribution,\n\ttype PowerShellOperations,\n\ttype PowerShellSpawnContext,\n\ttype PowerShellSpawnHook,\n\ttype PowerShellToolDetails,\n\ttype PowerShellToolInput,\n\ttype PowerShellToolOptions,\n\ttype ReadOperations,\n\ttype ReadToolDetails,\n\ttype ReadToolInput,\n\ttype ReadToolOptions,\n\treadToolSystemPromptContribution,\n\ttype SearchToolDetails,\n\ttype SearchToolInput,\n\ttype SearchToolOptions,\n\ttype ShellToolPresentation,\n\tsearchToolSystemPromptContribution,\n\ttype ToolsOptions,\n\ttype TruncationOptions,\n\ttype TruncationResult,\n\ttruncateHead,\n\ttruncateLine,\n\ttruncateTail,\n\ttype WriteFileOptions,\n\ttype WriteOperations,\n\ttype WriteToolInput,\n\ttype WriteToolOptions,\n\twithFileMutationQueue,\n\twriteToolSystemPromptContribution,\n} from \"./core/tools/index.js\";\nexport {\n\thasProjectTrustInputs,\n\thasTrustRequiringProjectResources,\n\ttype ProjectTrustDecision,\n\tProjectTrustStore,\n\ttype ProjectTrustStoreEntry,\n\ttype ProjectTrustUpdate,\n\tTRUST_REQUIRING_PROJECT_CONFIG_RESOURCES,\n} from \"./core/trust-manager.ts\";\nexport { StringEnum, type StringEnumOptions } from \"./core/typebox-compat.ts\";\nexport {\n\ttype LoadedMcpConfig,\n\ttype McpServerConfigPatch,\n\ttype McpServerEntry,\n\tupdateMcpServerConfig,\n} from \"./extensions/mcp/config.ts\";\nexport { createMcpExtension, type McpExtensionOptions } from \"./extensions/mcp/index.js\";\nexport { McpOAuthCredentialStore } from \"./extensions/mcp/oauth.ts\";\nexport * from \"./index-extensions.js\";\n// Main entry point\nexport { type MainOptions, main } from \"./main.ts\";\nexport {\n\tInteractiveMode,\n\ttype InteractiveModeOptions,\n\ttype ModelInfo,\n\ttype PrintModeOptions,\n\tRpcClient,\n\ttype RpcClientOptions,\n\ttype RpcCommand,\n\ttype RpcEvent,\n\ttype RpcEventListener,\n\ttype RpcExtensionUIRequest,\n\ttype RpcExtensionUIResponse,\n\ttype RpcResponse,\n\ttype RpcSessionState,\n\trunPrintMode,\n\trunRpcMode,\n} from \"./modes/index.ts\";\n// UI components for extensions\nexport {\n\tArminComponent,\n\tAssistantMessageComponent,\n\tBashExecutionComponent,\n\tBorderedLoader,\n\tBranchSummaryMessageComponent,\n\ttype ChatMessageEntry,\n\ttype ChatMessageRenderOptions,\n\t// Internal host seam for bundled workflow stage chat; not yet a stable extension API.\n\tChatSessionHost,\n\ttype ChatSessionHostBashRequest,\n\ttype ChatSessionHostCommands,\n\ttype ChatSessionHostEntry,\n\ttype ChatSessionHostOpts,\n\ttype ChatSessionHostStyle,\n\ttype ChatSessionSubmitMode,\n\tChatTranscriptComponent,\n\ttype ChatTranscriptEntryLike,\n\ttype ChatTranscriptRenderer,\n\ttype ChatTranscriptRole,\n\tCustomEditor,\n\ttype CustomEditorOptions,\n\tCustomEntryComponent,\n\tCustomMessageComponent,\n\tchatEntriesFromAgentMessages,\n\tDynamicBorder,\n\tExtensionEditorComponent,\n\tExtensionInputComponent,\n\tExtensionSelectorComponent,\n\tFooterComponent,\n\tkeyHint,\n\tkeyHintIfBound,\n\tkeyText,\n\tLiveChatEntriesController,\n\tLoginDialogComponent,\n\tModelSelectorComponent,\n\tOAuthSelectorComponent,\n\ttype RenderDiffOptions,\n\trawKeyHint,\n\trenderChatMessageEntry,\n\trenderDiff,\n\tScrollableChatTranscriptComponent,\n\tScrollableComponentViewport,\n\tSessionSelectorComponent,\n\ttype SettingsCallbacks,\n\ttype SettingsConfig,\n\tSettingsSelectorComponent,\n\tShowImagesSelectorComponent,\n\tSkillInvocationMessageComponent,\n\tThemeSelectorComponent,\n\tThinkingSelectorComponent,\n\tToolExecutionComponent,\n\ttype ToolExecutionOptions,\n\tTRANSCRIPT_JUMP_TO_END_URL,\n\tTranscriptFollowIndicator,\n\tTreeSelectorComponent,\n\ttruncateToVisualLines,\n\tUsageMeterComponent,\n\tUserMessageComponent,\n\tUserMessageSelectorComponent,\n\ttype VisualTruncateResult,\n\tWorkingStatusComponent,\n\ttype WorkingStatusComponentOptions,\n} from \"./modes/interactive/components/index.ts\";\nexport {\n\tclassifyChatCommand,\n\tcreateSessionSkillAutocompleteProvider,\n\tgetSessionCommandCatalog,\n\tgetSessionSkillCommands,\n\ttype PendingSessionCommandCatalog,\n\ttype SessionCommandCatalog,\n} from \"./modes/interactive/skill-command-autocomplete.ts\";\n// Theme utilities for custom tools and extensions\nexport {\n\tgetLanguageFromPath,\n\tgetMarkdownTheme,\n\tgetSelectListTheme,\n\tgetSettingsListTheme,\n\thighlightCode,\n\tinitTheme,\n\tTheme,\n\ttype ThemeColor,\n} from \"./modes/interactive/theme/theme.js\";\nexport { pickWhimsicalWorkingMessage } from \"./modes/interactive/whimsical-messages.ts\";\nexport { createChildProcessEnvironment, spawnProcess } from \"./utils/child-process.ts\";\n// Clipboard utilities\nexport { copyToClipboard } from \"./utils/clipboard.js\";\nexport { parseFrontmatter, stripFrontmatter } from \"./utils/frontmatter.ts\";\nexport {\n\tisSafeFsWatchPathError,\n\tisUnsafeWindowsShortPath,\n\tresolveNativeWatchPath,\n\tSAFE_FS_WATCH_CANONICALIZATION_FAILED,\n\tSAFE_FS_WATCH_UNSAFE_WINDOWS_SHORT_PATH,\n\ttype SafeFsWatchErrorCode,\n\ttype SafeFsWatchPathError,\n\twatchWithErrorHandler,\n} from \"./utils/fs-watch.ts\";\nexport { createGitEnvironment, GIT_LOCAL_ENV_VARS } from \"./utils/git-env.ts\";\nexport { convertToPng } from \"./utils/image-convert.ts\";\nexport { formatDimensionNote, type ResizedImage, resizeImage } from \"./utils/image-resize.ts\";\nexport { INTERACTIVE_ENGINE_ENV_VARS, scrubInteractiveEngineEnv } from \"./utils/interactive-engine-env.ts\";\nexport { detectSupportedImageMimeTypeFromFile } from \"./utils/mime.ts\";\n// Shell utilities\nexport { getPowerShellConfig, getShellConfig } from \"./utils/shell.ts\";\n"]}
|
|
@@ -8,6 +8,8 @@ export declare class StartupChatContainer extends Container {
|
|
|
8
8
|
private startupOutputReleased;
|
|
9
9
|
releaseStartupOutput(): void;
|
|
10
10
|
render(width: number): string[];
|
|
11
|
+
/** A cleared transcript is rebuilt from new rows; the engine-rendered rows it drops are disposed. */
|
|
12
|
+
clear(): void;
|
|
11
13
|
}
|
|
12
14
|
interface StartupChatOutputHost {
|
|
13
15
|
chatContainer: Container;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interactive-startup-chat-container.d.ts","sourceRoot":"","sources":["../../../src/modes/interactive/interactive-startup-chat-container.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"interactive-startup-chat-container.d.ts","sourceRoot":"","sources":["../../../src/modes/interactive/interactive-startup-chat-container.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,SAAS,EAAE,MAAM,4BAA4B,CAAC;AAEvD;;;;GAIG;AACH,qBAAa,oBAAqB,SAAQ,SAAS;IAClD,OAAO,CAAC,qBAAqB,CAAS;IAEtC,oBAAoB,IAAI,IAAI,CAG3B;IAEQ,MAAM,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE,CAEvC;IAED,qGAAqG;IAC5F,KAAK,IAAI,IAAI,CAGrB;CACD;AAED,UAAU,qBAAqB;IAC9B,aAAa,EAAE,SAAS,CAAC;IACzB,EAAE,EAAE;QAAE,aAAa,IAAI,IAAI,CAAA;KAAE,CAAC;CAC9B;AAED,wBAAgB,wBAAwB,CAAC,IAAI,EAAE,qBAAqB,GAAG,IAAI,CAM1E"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { markLifecycleTiming } from "../../core/lifecycle-timings.js";
|
|
2
|
+
import { disposeRemoteRenderers } from "../interactive-engine/remote-renderer.js";
|
|
2
3
|
import { Container } from "./interactive-mode-deps.js";
|
|
3
4
|
/**
|
|
4
5
|
* Holds startup chat output off-screen until the resource disclosure slot has
|
|
@@ -14,6 +15,11 @@ export class StartupChatContainer extends Container {
|
|
|
14
15
|
render(width) {
|
|
15
16
|
return this.startupOutputReleased ? super.render(width) : [];
|
|
16
17
|
}
|
|
18
|
+
/** A cleared transcript is rebuilt from new rows; the engine-rendered rows it drops are disposed. */
|
|
19
|
+
clear() {
|
|
20
|
+
disposeRemoteRenderers(this.children);
|
|
21
|
+
super.clear();
|
|
22
|
+
}
|
|
17
23
|
}
|
|
18
24
|
export function releaseStartupChatOutput(host) {
|
|
19
25
|
if (host.chatContainer instanceof StartupChatContainer) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interactive-startup-chat-container.js","sourceRoot":"","sources":["../../../src/modes/interactive/interactive-startup-chat-container.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,iCAAiC,CAAC;AACtE,OAAO,EAAE,SAAS,EAAE,MAAM,4BAA4B,CAAC;AAEvD;;;;GAIG;AACH,MAAM,OAAO,oBAAqB,SAAQ,SAAS;IAC1C,qBAAqB,GAAG,KAAK,CAAC;IAEtC,oBAAoB;QACnB,IAAI,CAAC,qBAAqB,GAAG,IAAI,CAAC;QAClC,IAAI,CAAC,UAAU,EAAE,CAAC;IACnB,CAAC;IAEQ,MAAM,CAAC,KAAa;QAC5B,OAAO,IAAI,CAAC,qBAAqB,CAAC,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;IAC9D,CAAC;CACD;AAOD,MAAM,UAAU,wBAAwB,CAAC,IAA2B;IACnE,IAAI,IAAI,CAAC,aAAa,YAAY,oBAAoB,EAAE,CAAC;QACxD,IAAI,CAAC,aAAa,CAAC,oBAAoB,EAAE,CAAC;QAC1C,mBAAmB,CAAC,qBAAqB,CAAC,CAAC;QAC3C,IAAI,CAAC,EAAE,CAAC,aAAa,EAAE,CAAC;IACzB,CAAC;AACF,CAAC","sourcesContent":["import { markLifecycleTiming } from \"../../core/lifecycle-timings.ts\";\nimport { Container } from \"./interactive-mode-deps.ts\";\n\n/**\n * Holds startup chat output off-screen until the resource disclosure slot has\n * been filled. Terminal scrollback cannot reorder lines that were painted\n * before an earlier container received content.\n */\nexport class StartupChatContainer extends Container {\n\tprivate startupOutputReleased = false;\n\n\treleaseStartupOutput(): void {\n\t\tthis.startupOutputReleased = true;\n\t\tthis.invalidate();\n\t}\n\n\toverride render(width: number): string[] {\n\t\treturn this.startupOutputReleased ? super.render(width) : [];\n\t}\n}\n\ninterface StartupChatOutputHost {\n\tchatContainer: Container;\n\tui: { requestRender(): void };\n}\n\nexport function releaseStartupChatOutput(host: StartupChatOutputHost): void {\n\tif (host.chatContainer instanceof StartupChatContainer) {\n\t\thost.chatContainer.releaseStartupOutput();\n\t\tmarkLifecycleTiming(\"chat-output-release\");\n\t\thost.ui.requestRender();\n\t}\n}\n"]}
|
|
1
|
+
{"version":3,"file":"interactive-startup-chat-container.js","sourceRoot":"","sources":["../../../src/modes/interactive/interactive-startup-chat-container.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,iCAAiC,CAAC;AACtE,OAAO,EAAE,sBAAsB,EAAE,MAAM,0CAA0C,CAAC;AAClF,OAAO,EAAE,SAAS,EAAE,MAAM,4BAA4B,CAAC;AAEvD;;;;GAIG;AACH,MAAM,OAAO,oBAAqB,SAAQ,SAAS;IAC1C,qBAAqB,GAAG,KAAK,CAAC;IAEtC,oBAAoB;QACnB,IAAI,CAAC,qBAAqB,GAAG,IAAI,CAAC;QAClC,IAAI,CAAC,UAAU,EAAE,CAAC;IACnB,CAAC;IAEQ,MAAM,CAAC,KAAa;QAC5B,OAAO,IAAI,CAAC,qBAAqB,CAAC,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;IAC9D,CAAC;IAED,qGAAqG;IAC5F,KAAK;QACb,sBAAsB,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QACtC,KAAK,CAAC,KAAK,EAAE,CAAC;IACf,CAAC;CACD;AAOD,MAAM,UAAU,wBAAwB,CAAC,IAA2B;IACnE,IAAI,IAAI,CAAC,aAAa,YAAY,oBAAoB,EAAE,CAAC;QACxD,IAAI,CAAC,aAAa,CAAC,oBAAoB,EAAE,CAAC;QAC1C,mBAAmB,CAAC,qBAAqB,CAAC,CAAC;QAC3C,IAAI,CAAC,EAAE,CAAC,aAAa,EAAE,CAAC;IACzB,CAAC;AACF,CAAC","sourcesContent":["import { markLifecycleTiming } from \"../../core/lifecycle-timings.ts\";\nimport { disposeRemoteRenderers } from \"../interactive-engine/remote-renderer.ts\";\nimport { Container } from \"./interactive-mode-deps.ts\";\n\n/**\n * Holds startup chat output off-screen until the resource disclosure slot has\n * been filled. Terminal scrollback cannot reorder lines that were painted\n * before an earlier container received content.\n */\nexport class StartupChatContainer extends Container {\n\tprivate startupOutputReleased = false;\n\n\treleaseStartupOutput(): void {\n\t\tthis.startupOutputReleased = true;\n\t\tthis.invalidate();\n\t}\n\n\toverride render(width: number): string[] {\n\t\treturn this.startupOutputReleased ? super.render(width) : [];\n\t}\n\n\t/** A cleared transcript is rebuilt from new rows; the engine-rendered rows it drops are disposed. */\n\toverride clear(): void {\n\t\tdisposeRemoteRenderers(this.children);\n\t\tsuper.clear();\n\t}\n}\n\ninterface StartupChatOutputHost {\n\tchatContainer: Container;\n\tui: { requestRender(): void };\n}\n\nexport function releaseStartupChatOutput(host: StartupChatOutputHost): void {\n\tif (host.chatContainer instanceof StartupChatContainer) {\n\t\thost.chatContainer.releaseStartupOutput();\n\t\tmarkLifecycleTiming(\"chat-output-release\");\n\t\thost.ui.requestRender();\n\t}\n}\n"]}
|
|
@@ -1,6 +1,14 @@
|
|
|
1
1
|
import type { AgentSession } from "../../core/agent-session.js";
|
|
2
|
+
/**
|
|
3
|
+
* How many disposed row ids the engine remembers. A render request can reach the engine after its row's disposal:
|
|
4
|
+
* renders are coalesced behind the host's ordered writes, and a render's callback runs a turn after its line is read.
|
|
5
|
+
* Without the tombstone that late render would rebuild the record the disposal released, for the rest of the session.
|
|
6
|
+
* Row ids are never reused, and a render this many disposals late does not happen in practice.
|
|
7
|
+
*/
|
|
8
|
+
export declare const DISPOSED_RENDER_TOMBSTONE_LIMIT = 10000;
|
|
2
9
|
export declare class EngineRenderService {
|
|
3
10
|
private readonly records;
|
|
11
|
+
private readonly disposedIds;
|
|
4
12
|
private session;
|
|
5
13
|
private readonly write;
|
|
6
14
|
constructor(write: (line: string) => void);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"engine-render-service.d.ts","sourceRoot":"","sources":["../../../src/modes/interactive-engine/engine-render-service.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AA2DhE,qBAAa,mBAAmB;IAC/B,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAmC;IAC3D,OAAO,CAAC,OAAO,CAA2B;IAC1C,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAyB;IAE/C,YAAY,KAAK,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,EAExC;IAED,WAAW,CAAC,OAAO,EAAE,YAAY,GAAG,IAAI,CAGvC;IAED,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,
|
|
1
|
+
{"version":3,"file":"engine-render-service.d.ts","sourceRoot":"","sources":["../../../src/modes/interactive-engine/engine-render-service.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AA2DhE;;;;;GAKG;AACH,eAAO,MAAM,+BAA+B,QAAS,CAAC;AAEtD,qBAAa,mBAAmB;IAC/B,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAmC;IAC3D,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAqB;IACjD,OAAO,CAAC,OAAO,CAA2B;IAC1C,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAyB;IAE/C,YAAY,KAAK,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,EAExC;IAED,WAAW,CAAC,OAAO,EAAE,YAAY,GAAG,IAAI,CAGvC;IAED,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAyChC;IAED,OAAO,IAAI,IAAI,CAEd;IAED,OAAO,CAAC,YAAY;IAMpB,OAAO,CAAC,cAAc;IAItB,OAAO,CAAC,UAAU;IA8ClB,OAAO,CAAC,aAAa;IA8BrB,OAAO,CAAC,aAAa;IAQrB,OAAO,CAAC,IAAI;CAGZ"}
|
|
@@ -29,8 +29,16 @@ class RenderTerminal {
|
|
|
29
29
|
setProgress() { }
|
|
30
30
|
setProgramStatus() { }
|
|
31
31
|
}
|
|
32
|
+
/**
|
|
33
|
+
* How many disposed row ids the engine remembers. A render request can reach the engine after its row's disposal:
|
|
34
|
+
* renders are coalesced behind the host's ordered writes, and a render's callback runs a turn after its line is read.
|
|
35
|
+
* Without the tombstone that late render would rebuild the record the disposal released, for the rest of the session.
|
|
36
|
+
* Row ids are never reused, and a render this many disposals late does not happen in practice.
|
|
37
|
+
*/
|
|
38
|
+
export const DISPOSED_RENDER_TOMBSTONE_LIMIT = 10_000;
|
|
32
39
|
export class EngineRenderService {
|
|
33
40
|
records = new Map();
|
|
41
|
+
disposedIds = new Set();
|
|
34
42
|
session;
|
|
35
43
|
write;
|
|
36
44
|
constructor(write) {
|
|
@@ -46,6 +54,12 @@ export class EngineRenderService {
|
|
|
46
54
|
return false;
|
|
47
55
|
if (command.type === "engine_render_dispose") {
|
|
48
56
|
this.disposeRecord(command.componentId);
|
|
57
|
+
this.disposedIds.add(command.componentId);
|
|
58
|
+
if (this.disposedIds.size > DISPOSED_RENDER_TOMBSTONE_LIMIT) {
|
|
59
|
+
const oldest = this.disposedIds.values().next().value;
|
|
60
|
+
if (oldest !== undefined)
|
|
61
|
+
this.disposedIds.delete(oldest);
|
|
62
|
+
}
|
|
49
63
|
return true;
|
|
50
64
|
}
|
|
51
65
|
if (command.type !== "engine_tool_render" && command.type !== "engine_message_render")
|
|
@@ -54,14 +68,22 @@ export class EngineRenderService {
|
|
|
54
68
|
? `tool:${command.toolName}`
|
|
55
69
|
: `message:${command.message.customType ?? "custom"}`;
|
|
56
70
|
void runCallback({ kind: "renderer", name }, async () => {
|
|
71
|
+
// The row may have been disposed before this render arrived, or while it waited for its turn: rendering it
|
|
72
|
+
// now would rebuild the record its disposal released.
|
|
73
|
+
if (this.disposedIds.has(command.componentId))
|
|
74
|
+
return undefined;
|
|
57
75
|
return command.type === "engine_tool_render" ? this.renderTool(command) : this.renderMessage(command);
|
|
58
76
|
})
|
|
59
|
-
.then((lines) =>
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
77
|
+
.then((lines) => {
|
|
78
|
+
if (lines === undefined)
|
|
79
|
+
return;
|
|
80
|
+
this.send({
|
|
81
|
+
type: "engine_custom_frame",
|
|
82
|
+
componentId: command.componentId,
|
|
83
|
+
requestId: command.requestId,
|
|
84
|
+
lines,
|
|
85
|
+
});
|
|
86
|
+
})
|
|
65
87
|
.catch((error) => this.send({
|
|
66
88
|
type: "engine_custom_frame",
|
|
67
89
|
componentId: command.componentId,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"engine-render-service.js","sourceRoot":"","sources":["../../../src/modes/interactive-engine/engine-render-service.ts"],"names":[],"mappings":"AACA,OAAO,EAAY,aAAa,EAAE,MAAM,wBAAwB,CAAC;AACjE,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAE9C,OAAO,EAAE,WAAW,EAAE,MAAM,iCAAiC,CAAC;AAE9D,OAAO,EAAE,mBAAmB,EAAE,MAAM,8BAA8B,CAAC;AACnE,OAAO,EAAE,sBAAsB,EAAE,MAAM,6CAA6C,CAAC;AACrF,OAAO,EAAE,sBAAsB,EAAE,MAAM,6CAA6C,CAAC;AACrF,OAAO,EAGN,6BAA6B,EAC7B,iCAAiC,GACjC,MAAM,eAAe,CAAC;AAuBvB,MAAM,cAAc;IACnB,OAAO,GAAG,EAAE,CAAC;IACb,IAAI,GAAG,EAAE,CAAC;IACV,mBAAmB,GAAG,KAAK,CAAC;IACX,aAAa,CAAa;IAC3C,YAAY,aAAyB;QACpC,IAAI,CAAC,aAAa,GAAG,aAAa,CAAC;IACpC,CAAC;IACD,KAAK,KAAU,CAAC;IAChB,IAAI,KAAU,CAAC;IACf,KAAK,CAAC,UAAU,KAAmB,CAAC;IACpC,KAAK;QACJ,IAAI,CAAC,aAAa,EAAE,CAAC;IACtB,CAAC;IACD,MAAM,KAAU,CAAC;IACjB,UAAU,KAAU,CAAC;IACrB,UAAU,KAAU,CAAC;IACrB,SAAS,KAAU,CAAC;IACpB,eAAe,KAAU,CAAC;IAC1B,WAAW,KAAU,CAAC;IACtB,QAAQ,KAAU,CAAC;IACnB,WAAW,KAAU,CAAC;IACtB,gBAAgB,KAAU,CAAC;CAC3B;AAED,MAAM,OAAO,mBAAmB;IACd,OAAO,GAAG,IAAI,GAAG,EAAwB,CAAC;IACnD,OAAO,CAA2B;IACzB,KAAK,CAAy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GAAG,CAAC,EAAE,CAAC,CAAC;QACpC,IAAI,CAAC,MAAM;YAAE,OAAO;QACpB,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;QACxB,IAAI,MAAM,CAAC,IAAI,KAAK,MAAM;YAAE,MAAM,CAAC,SAAS,CAAC,OAAO,EAAE,CAAC;QACvD,MAAM,CAAC,GAAG,CAAC,IAAI,EAAE,CAAC;IACnB,CAAC;IAEO,IAAI,CAAC,OAAiC;QAC7C,IAAI,CAAC,KAAK,CAAC,iCAAiC,CAAC,OAAO,CAAC,CAAC,CAAC;IACxD,CAAC;CACD","sourcesContent":["import type { Terminal } from \"@earendil-works/pi-tui\";\nimport { type TUI, TuiMainScreen } from \"@earendil-works/pi-tui\";\nimport { getAgentDir } from \"../../config.js\";\nimport type { AgentSession } from \"../../core/agent-session.js\";\nimport { runCallback } from \"../../core/callback-activity.ts\";\nimport type { CustomMessage } from \"../../core/messages.ts\";\nimport { ensurePngTranscoder } from \"../../utils/image-convert.ts\";\nimport { CustomMessageComponent } from \"../interactive/components/custom-message.ts\";\nimport { ToolExecutionComponent } from \"../interactive/components/tool-execution.ts\";\nimport {\n\ttype InteractiveEngineCommand,\n\ttype InteractiveEngineMessage,\n\tparseInteractiveEngineCommand,\n\tserializeInteractiveEngineMessage,\n} from \"./protocol.ts\";\n\ntype ToolRenderCommand = Extract<InteractiveEngineCommand, { type: \"engine_tool_render\" }>;\ntype MessageRenderCommand = Extract<InteractiveEngineCommand, { type: \"engine_message_render\" }>;\n\n/**\n * Cached per-componentId render state. Records are REUSED across render\n * requests: recreating (and re-seeding) the component on every request made\n * the seeding setters call `ui.requestRender()` each time, whose eventual\n * terminal write emitted `engine_custom_invalidate` back to the host, which\n * re-sent the render request — a self-sustaining host⇄engine render\n * ping-pong that presented as full-screen TUI flicker (quit/pause while a\n * workflow stage streams). Reuse plus idempotent seeding setters lets the\n * loop converge after at most one round trip while still forwarding\n * legitimate async invalidations (e.g. image conversion). A record is rebuilt\n * once the session's extension runner changes, so rows rendered before\n * deferred resources loaded pick up the extensions' renderers.\n */\ntype RenderRecord = { runner: AgentSession[\"extensionRunner\"]; terminal: RenderTerminal; tui: TUI } & (\n\t| { kind: \"message\"; component: CustomMessageComponent }\n\t| { kind: \"tool\"; component: ToolExecutionComponent }\n);\n\nclass RenderTerminal implements Terminal {\n\tcolumns = 80;\n\trows = 24;\n\tkittyProtocolActive = false;\n\tprivate readonly requestRender: () => void;\n\tconstructor(requestRender: () => void) {\n\t\tthis.requestRender = requestRender;\n\t}\n\tstart(): void {}\n\tstop(): void {}\n\tasync drainInput(): Promise<void> {}\n\twrite(): void {\n\t\tthis.requestRender();\n\t}\n\tmoveBy(): void {}\n\thideCursor(): void {}\n\tshowCursor(): void {}\n\tclearLine(): void {}\n\tclearFromCursor(): void {}\n\tclearScreen(): void {}\n\tsetTitle(): void {}\n\tsetProgress(): void {}\n\tsetProgramStatus(): void {}\n}\n\nexport class EngineRenderService {\n\tprivate readonly records = new Map<string, RenderRecord>();\n\tprivate session: AgentSession | undefined;\n\tprivate readonly write: (line: string) => void;\n\n\tconstructor(write: (line: string) => void) {\n\t\tthis.write = write;\n\t}\n\n\tbindSession(session: AgentSession): void {\n\t\tthis.dispose();\n\t\tthis.session = session;\n\t}\n\n\thandleLine(line: string): boolean {\n\t\tconst command = parseInteractiveEngineCommand(line);\n\t\tif (!command?.type.startsWith(\"engine_\") || command.type.startsWith(\"engine_custom_\")) return false;\n\t\tif (command.type === \"engine_render_dispose\") {\n\t\t\tthis.disposeRecord(command.componentId);\n\t\t\treturn true;\n\t\t}\n\t\tif (command.type !== \"engine_tool_render\" && command.type !== \"engine_message_render\") return false;\n\t\tconst name =\n\t\t\tcommand.type === \"engine_tool_render\"\n\t\t\t\t? `tool:${command.toolName}`\n\t\t\t\t: `message:${command.message.customType ?? \"custom\"}`;\n\t\tvoid runCallback({ kind: \"renderer\", name }, async () => {\n\t\t\treturn command.type === \"engine_tool_render\" ? this.renderTool(command) : this.renderMessage(command);\n\t\t})\n\t\t\t.then((lines) =>\n\t\t\t\tthis.send({\n\t\t\t\t\ttype: \"engine_custom_frame\",\n\t\t\t\t\tcomponentId: command.componentId,\n\t\t\t\t\trequestId: command.requestId,\n\t\t\t\t\tlines,\n\t\t\t\t}),\n\t\t\t)\n\t\t\t.catch((error: Error) =>\n\t\t\t\tthis.send({\n\t\t\t\t\ttype: \"engine_custom_frame\",\n\t\t\t\t\tcomponentId: command.componentId,\n\t\t\t\t\trequestId: command.requestId,\n\t\t\t\t\tlines: [`Remote renderer failed: ${error.message}`],\n\t\t\t\t}),\n\t\t\t);\n\t\treturn true;\n\t}\n\n\tdispose(): void {\n\t\tfor (const id of [...this.records.keys()]) this.disposeRecord(id);\n\t}\n\n\tprivate boundSession(): AgentSession {\n\t\tconst session = this.session;\n\t\tif (!session) throw new Error(\"Renderer session is not bound\");\n\t\treturn session;\n\t}\n\n\tprivate createTerminal(componentId: string): RenderTerminal {\n\t\treturn new RenderTerminal(() => this.send({ type: \"engine_custom_invalidate\", componentId }));\n\t}\n\n\tprivate renderTool(command: ToolRenderCommand): string[] {\n\t\tlet record = this.records.get(command.componentId);\n\t\tif (record?.kind !== \"tool\" || record.runner !== this.session?.extensionRunner) {\n\t\t\tconst session = this.boundSession();\n\t\t\tthis.disposeRecord(command.componentId);\n\t\t\tconst terminal = this.createTerminal(command.componentId);\n\t\t\tterminal.columns = Math.max(1, command.width);\n\t\t\tconst tui = new TuiMainScreen(terminal, undefined, getAgentDir());\n\t\t\tensurePngTranscoder(() => {\n\t\t\t\ttui.invalidate();\n\t\t\t\ttui.requestRender();\n\t\t\t});\n\t\t\tconst component = new ToolExecutionComponent(\n\t\t\t\tcommand.toolName,\n\t\t\t\tcommand.toolCallId,\n\t\t\t\tcommand.args,\n\t\t\t\t{ showImages: command.showImages, imageWidthCells: command.imageWidthCells, outputPad: command.outputPad },\n\t\t\t\tsession.extensionRunner.resolveToolRenderers(command.toolName, () =>\n\t\t\t\t\tsession.getToolDefinition(command.toolName),\n\t\t\t\t),\n\t\t\t\ttui,\n\t\t\t\tsession.sessionManager.getCwd(),\n\t\t\t);\n\t\t\ttui.addChild(component);\n\t\t\trecord = { kind: \"tool\", component, terminal, tui, runner: session.extensionRunner };\n\t\t\tthis.records.set(command.componentId, record);\n\t\t} else {\n\t\t\trecord.terminal.columns = Math.max(1, command.width);\n\t\t\trecord.component.updateArgs(command.args);\n\t\t\trecord.component.setShowImages(command.showImages);\n\t\t\trecord.component.setImageWidthCells(command.imageWidthCells);\n\t\t\trecord.component.setOutputPad(command.outputPad ?? 1);\n\t\t}\n\t\tconst tool = record.component;\n\t\tif (command.executionStarted) tool.markExecutionStarted();\n\t\tif (command.argsComplete) tool.setArgsComplete();\n\t\ttool.setExpanded(command.expanded);\n\t\tif (command.result) {\n\t\t\ttool.updateResult(\n\t\t\t\tcommand.result as unknown as Parameters<ToolExecutionComponent[\"updateResult\"]>[0],\n\t\t\t\tcommand.isPartial,\n\t\t\t);\n\t\t}\n\t\treturn tool.render(command.width);\n\t}\n\n\tprivate renderMessage(command: MessageRenderCommand): string[] {\n\t\tlet record = this.records.get(command.componentId);\n\t\tif (record?.kind !== \"message\" || record.runner !== this.session?.extensionRunner) {\n\t\t\tconst session = this.boundSession();\n\t\t\tthis.disposeRecord(command.componentId);\n\t\t\tconst terminal = this.createTerminal(command.componentId);\n\t\t\tterminal.columns = Math.max(1, command.width);\n\t\t\tconst tui = new TuiMainScreen(terminal, undefined, getAgentDir());\n\t\t\tensurePngTranscoder(() => {\n\t\t\t\ttui.invalidate();\n\t\t\t\ttui.requestRender();\n\t\t\t});\n\t\t\tconst message = command.message as unknown as CustomMessage<object>;\n\t\t\tconst component = new CustomMessageComponent(\n\t\t\t\tmessage,\n\t\t\t\tsession.extensionRunner.getMessageRenderer(message.customType),\n\t\t\t\tundefined,\n\t\t\t\tcommand.outputPad,\n\t\t\t);\n\t\t\ttui.addChild(component);\n\t\t\trecord = { kind: \"message\", component, terminal, tui, runner: session.extensionRunner };\n\t\t\tthis.records.set(command.componentId, record);\n\t\t} else {\n\t\t\trecord.terminal.columns = Math.max(1, command.width);\n\t\t}\n\t\trecord.component.setExpanded(command.expanded);\n\t\trecord.component.setOutputPad(command.outputPad);\n\t\treturn record.component.render(command.width);\n\t}\n\n\tprivate disposeRecord(id: string): void {\n\t\tconst record = this.records.get(id);\n\t\tif (!record) return;\n\t\tthis.records.delete(id);\n\t\tif (record.kind === \"tool\") record.component.dispose();\n\t\trecord.tui.stop();\n\t}\n\n\tprivate send(message: InteractiveEngineMessage): void {\n\t\tthis.write(serializeInteractiveEngineMessage(message));\n\t}\n}\n"]}
|
|
1
|
+
{"version":3,"file":"engine-render-service.js","sourceRoot":"","sources":["../../../src/modes/interactive-engine/engine-render-service.ts"],"names":[],"mappings":"AACA,OAAO,EAAY,aAAa,EAAE,MAAM,wBAAwB,CAAC;AACjE,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAE9C,OAAO,EAAE,WAAW,EAAE,MAAM,iCAAiC,CAAC;AAE9D,OAAO,EAAE,mBAAmB,EAAE,MAAM,8BAA8B,CAAC;AACnE,OAAO,EAAE,sBAAsB,EAAE,MAAM,6CAA6C,CAAC;AACrF,OAAO,EAAE,sBAAsB,EAAE,MAAM,6CAA6C,CAAC;AACrF,OAAO,EAGN,6BAA6B,EAC7B,iCAAiC,GACjC,MAAM,eAAe,CAAC;AAuBvB,MAAM,cAAc;IACnB,OAAO,GAAG,EAAE,CAAC;IACb,IAAI,GAAG,EAAE,CAAC;IACV,mBAAmB,GAAG,KAAK,CAAC;IACX,aAAa,CAAa;IAC3C,YAAY,aAAyB;QACpC,IAAI,CAAC,aAAa,GAAG,aAAa,CAAC;IACpC,CAAC;IACD,KAAK,KAAU,CAAC;IAChB,IAAI,KAAU,CAAC;IACf,KAAK,CAAC,UAAU,KAAmB,CAAC;IACpC,KAAK;QACJ,IAAI,CAAC,aAAa,EAAE,CAAC;IACtB,CAAC;IACD,MAAM,KAAU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ACnB,CAAC;IAEO,IAAI,CAAC,OAAiC;QAC7C,IAAI,CAAC,KAAK,CAAC,iCAAiC,CAAC,OAAO,CAAC,CAAC,CAAC;IACxD,CAAC;CACD","sourcesContent":["import type { Terminal } from \"@earendil-works/pi-tui\";\nimport { type TUI, TuiMainScreen } from \"@earendil-works/pi-tui\";\nimport { getAgentDir } from \"../../config.js\";\nimport type { AgentSession } from \"../../core/agent-session.js\";\nimport { runCallback } from \"../../core/callback-activity.ts\";\nimport type { CustomMessage } from \"../../core/messages.ts\";\nimport { ensurePngTranscoder } from \"../../utils/image-convert.ts\";\nimport { CustomMessageComponent } from \"../interactive/components/custom-message.ts\";\nimport { ToolExecutionComponent } from \"../interactive/components/tool-execution.ts\";\nimport {\n\ttype InteractiveEngineCommand,\n\ttype InteractiveEngineMessage,\n\tparseInteractiveEngineCommand,\n\tserializeInteractiveEngineMessage,\n} from \"./protocol.ts\";\n\ntype ToolRenderCommand = Extract<InteractiveEngineCommand, { type: \"engine_tool_render\" }>;\ntype MessageRenderCommand = Extract<InteractiveEngineCommand, { type: \"engine_message_render\" }>;\n\n/**\n * Cached per-componentId render state. Records are REUSED across render\n * requests: recreating (and re-seeding) the component on every request made\n * the seeding setters call `ui.requestRender()` each time, whose eventual\n * terminal write emitted `engine_custom_invalidate` back to the host, which\n * re-sent the render request — a self-sustaining host⇄engine render\n * ping-pong that presented as full-screen TUI flicker (quit/pause while a\n * workflow stage streams). Reuse plus idempotent seeding setters lets the\n * loop converge after at most one round trip while still forwarding\n * legitimate async invalidations (e.g. image conversion). A record is rebuilt\n * once the session's extension runner changes, so rows rendered before\n * deferred resources loaded pick up the extensions' renderers.\n */\ntype RenderRecord = { runner: AgentSession[\"extensionRunner\"]; terminal: RenderTerminal; tui: TUI } & (\n\t| { kind: \"message\"; component: CustomMessageComponent }\n\t| { kind: \"tool\"; component: ToolExecutionComponent }\n);\n\nclass RenderTerminal implements Terminal {\n\tcolumns = 80;\n\trows = 24;\n\tkittyProtocolActive = false;\n\tprivate readonly requestRender: () => void;\n\tconstructor(requestRender: () => void) {\n\t\tthis.requestRender = requestRender;\n\t}\n\tstart(): void {}\n\tstop(): void {}\n\tasync drainInput(): Promise<void> {}\n\twrite(): void {\n\t\tthis.requestRender();\n\t}\n\tmoveBy(): void {}\n\thideCursor(): void {}\n\tshowCursor(): void {}\n\tclearLine(): void {}\n\tclearFromCursor(): void {}\n\tclearScreen(): void {}\n\tsetTitle(): void {}\n\tsetProgress(): void {}\n\tsetProgramStatus(): void {}\n}\n\n/**\n * How many disposed row ids the engine remembers. A render request can reach the engine after its row's disposal:\n * renders are coalesced behind the host's ordered writes, and a render's callback runs a turn after its line is read.\n * Without the tombstone that late render would rebuild the record the disposal released, for the rest of the session.\n * Row ids are never reused, and a render this many disposals late does not happen in practice.\n */\nexport const DISPOSED_RENDER_TOMBSTONE_LIMIT = 10_000;\n\nexport class EngineRenderService {\n\tprivate readonly records = new Map<string, RenderRecord>();\n\tprivate readonly disposedIds = new Set<string>();\n\tprivate session: AgentSession | undefined;\n\tprivate readonly write: (line: string) => void;\n\n\tconstructor(write: (line: string) => void) {\n\t\tthis.write = write;\n\t}\n\n\tbindSession(session: AgentSession): void {\n\t\tthis.dispose();\n\t\tthis.session = session;\n\t}\n\n\thandleLine(line: string): boolean {\n\t\tconst command = parseInteractiveEngineCommand(line);\n\t\tif (!command?.type.startsWith(\"engine_\") || command.type.startsWith(\"engine_custom_\")) return false;\n\t\tif (command.type === \"engine_render_dispose\") {\n\t\t\tthis.disposeRecord(command.componentId);\n\t\t\tthis.disposedIds.add(command.componentId);\n\t\t\tif (this.disposedIds.size > DISPOSED_RENDER_TOMBSTONE_LIMIT) {\n\t\t\t\tconst oldest = this.disposedIds.values().next().value;\n\t\t\t\tif (oldest !== undefined) this.disposedIds.delete(oldest);\n\t\t\t}\n\t\t\treturn true;\n\t\t}\n\t\tif (command.type !== \"engine_tool_render\" && command.type !== \"engine_message_render\") return false;\n\t\tconst name =\n\t\t\tcommand.type === \"engine_tool_render\"\n\t\t\t\t? `tool:${command.toolName}`\n\t\t\t\t: `message:${command.message.customType ?? \"custom\"}`;\n\t\tvoid runCallback({ kind: \"renderer\", name }, async () => {\n\t\t\t// The row may have been disposed before this render arrived, or while it waited for its turn: rendering it\n\t\t\t// now would rebuild the record its disposal released.\n\t\t\tif (this.disposedIds.has(command.componentId)) return undefined;\n\t\t\treturn command.type === \"engine_tool_render\" ? this.renderTool(command) : this.renderMessage(command);\n\t\t})\n\t\t\t.then((lines) => {\n\t\t\t\tif (lines === undefined) return;\n\t\t\t\tthis.send({\n\t\t\t\t\ttype: \"engine_custom_frame\",\n\t\t\t\t\tcomponentId: command.componentId,\n\t\t\t\t\trequestId: command.requestId,\n\t\t\t\t\tlines,\n\t\t\t\t});\n\t\t\t})\n\t\t\t.catch((error: Error) =>\n\t\t\t\tthis.send({\n\t\t\t\t\ttype: \"engine_custom_frame\",\n\t\t\t\t\tcomponentId: command.componentId,\n\t\t\t\t\trequestId: command.requestId,\n\t\t\t\t\tlines: [`Remote renderer failed: ${error.message}`],\n\t\t\t\t}),\n\t\t\t);\n\t\treturn true;\n\t}\n\n\tdispose(): void {\n\t\tfor (const id of [...this.records.keys()]) this.disposeRecord(id);\n\t}\n\n\tprivate boundSession(): AgentSession {\n\t\tconst session = this.session;\n\t\tif (!session) throw new Error(\"Renderer session is not bound\");\n\t\treturn session;\n\t}\n\n\tprivate createTerminal(componentId: string): RenderTerminal {\n\t\treturn new RenderTerminal(() => this.send({ type: \"engine_custom_invalidate\", componentId }));\n\t}\n\n\tprivate renderTool(command: ToolRenderCommand): string[] {\n\t\tlet record = this.records.get(command.componentId);\n\t\tif (record?.kind !== \"tool\" || record.runner !== this.session?.extensionRunner) {\n\t\t\tconst session = this.boundSession();\n\t\t\tthis.disposeRecord(command.componentId);\n\t\t\tconst terminal = this.createTerminal(command.componentId);\n\t\t\tterminal.columns = Math.max(1, command.width);\n\t\t\tconst tui = new TuiMainScreen(terminal, undefined, getAgentDir());\n\t\t\tensurePngTranscoder(() => {\n\t\t\t\ttui.invalidate();\n\t\t\t\ttui.requestRender();\n\t\t\t});\n\t\t\tconst component = new ToolExecutionComponent(\n\t\t\t\tcommand.toolName,\n\t\t\t\tcommand.toolCallId,\n\t\t\t\tcommand.args,\n\t\t\t\t{ showImages: command.showImages, imageWidthCells: command.imageWidthCells, outputPad: command.outputPad },\n\t\t\t\tsession.extensionRunner.resolveToolRenderers(command.toolName, () =>\n\t\t\t\t\tsession.getToolDefinition(command.toolName),\n\t\t\t\t),\n\t\t\t\ttui,\n\t\t\t\tsession.sessionManager.getCwd(),\n\t\t\t);\n\t\t\ttui.addChild(component);\n\t\t\trecord = { kind: \"tool\", component, terminal, tui, runner: session.extensionRunner };\n\t\t\tthis.records.set(command.componentId, record);\n\t\t} else {\n\t\t\trecord.terminal.columns = Math.max(1, command.width);\n\t\t\trecord.component.updateArgs(command.args);\n\t\t\trecord.component.setShowImages(command.showImages);\n\t\t\trecord.component.setImageWidthCells(command.imageWidthCells);\n\t\t\trecord.component.setOutputPad(command.outputPad ?? 1);\n\t\t}\n\t\tconst tool = record.component;\n\t\tif (command.executionStarted) tool.markExecutionStarted();\n\t\tif (command.argsComplete) tool.setArgsComplete();\n\t\ttool.setExpanded(command.expanded);\n\t\tif (command.result) {\n\t\t\ttool.updateResult(\n\t\t\t\tcommand.result as unknown as Parameters<ToolExecutionComponent[\"updateResult\"]>[0],\n\t\t\t\tcommand.isPartial,\n\t\t\t);\n\t\t}\n\t\treturn tool.render(command.width);\n\t}\n\n\tprivate renderMessage(command: MessageRenderCommand): string[] {\n\t\tlet record = this.records.get(command.componentId);\n\t\tif (record?.kind !== \"message\" || record.runner !== this.session?.extensionRunner) {\n\t\t\tconst session = this.boundSession();\n\t\t\tthis.disposeRecord(command.componentId);\n\t\t\tconst terminal = this.createTerminal(command.componentId);\n\t\t\tterminal.columns = Math.max(1, command.width);\n\t\t\tconst tui = new TuiMainScreen(terminal, undefined, getAgentDir());\n\t\t\tensurePngTranscoder(() => {\n\t\t\t\ttui.invalidate();\n\t\t\t\ttui.requestRender();\n\t\t\t});\n\t\t\tconst message = command.message as unknown as CustomMessage<object>;\n\t\t\tconst component = new CustomMessageComponent(\n\t\t\t\tmessage,\n\t\t\t\tsession.extensionRunner.getMessageRenderer(message.customType),\n\t\t\t\tundefined,\n\t\t\t\tcommand.outputPad,\n\t\t\t);\n\t\t\ttui.addChild(component);\n\t\t\trecord = { kind: \"message\", component, terminal, tui, runner: session.extensionRunner };\n\t\t\tthis.records.set(command.componentId, record);\n\t\t} else {\n\t\t\trecord.terminal.columns = Math.max(1, command.width);\n\t\t}\n\t\trecord.component.setExpanded(command.expanded);\n\t\trecord.component.setOutputPad(command.outputPad);\n\t\treturn record.component.render(command.width);\n\t}\n\n\tprivate disposeRecord(id: string): void {\n\t\tconst record = this.records.get(id);\n\t\tif (!record) return;\n\t\tthis.records.delete(id);\n\t\tif (record.kind === \"tool\") record.component.dispose();\n\t\trecord.tui.stop();\n\t}\n\n\tprivate send(message: InteractiveEngineMessage): void {\n\t\tthis.write(serializeInteractiveEngineMessage(message));\n\t}\n}\n"]}
|
|
@@ -2,8 +2,18 @@ import type { Component } from "@earendil-works/pi-tui";
|
|
|
2
2
|
import type { CustomMessage } from "../../core/messages.ts";
|
|
3
3
|
import type { ToolExecutionComponent } from "../interactive/components/tool-execution.ts";
|
|
4
4
|
import type { IsolatedInteractiveRuntime } from "./isolated-runtime.js";
|
|
5
|
-
import type { InteractiveEngineCommand } from "./protocol.ts";
|
|
5
|
+
import type { InteractiveEngineCommand, InteractiveEngineMessage } from "./protocol.ts";
|
|
6
6
|
type RenderableToolResult = Parameters<ToolExecutionComponent["updateResult"]>[0];
|
|
7
|
+
type RemoteRenderCommand = Extract<InteractiveEngineCommand, {
|
|
8
|
+
type: "engine_tool_render" | "engine_message_render";
|
|
9
|
+
}>;
|
|
10
|
+
/**
|
|
11
|
+
* How many rows' last frames are kept, by row identity (a tool call, a custom message), to repaint rebuilt rows. A chat
|
|
12
|
+
* rebuild (compaction, `/reload`, a switched session) recreates every row, and each new row waits for the engine to
|
|
13
|
+
* render it. Showing the row's last frame meanwhile keeps the rebuilt chat painted, instead of a screen of placeholders
|
|
14
|
+
* that lasts as long as the engine is busy.
|
|
15
|
+
*/
|
|
16
|
+
export declare const REMOTE_FRAME_CACHE_LIMIT = 2000;
|
|
7
17
|
declare abstract class RemoteRenderer implements Component {
|
|
8
18
|
protected readonly componentId: string;
|
|
9
19
|
private lines;
|
|
@@ -13,17 +23,32 @@ declare abstract class RemoteRenderer implements Component {
|
|
|
13
23
|
private dirty;
|
|
14
24
|
private disposed;
|
|
15
25
|
private readonly frameClamp;
|
|
16
|
-
private readonly
|
|
26
|
+
private readonly routes;
|
|
27
|
+
/**
|
|
28
|
+
* What each unanswered request showed (its frame identity, expansion included), by request id. A frame is
|
|
29
|
+
* remembered under the identity of the request it answers, not under the row's state when it arrives: a row
|
|
30
|
+
* collapsed while its expanded frame was in flight must not have that frame remembered as its collapsed one.
|
|
31
|
+
*/
|
|
32
|
+
private readonly requestIdentities;
|
|
17
33
|
protected readonly runtime: IsolatedInteractiveRuntime;
|
|
18
34
|
private readonly requestRender;
|
|
19
35
|
constructor(runtime: IsolatedInteractiveRuntime, requestRender: () => void);
|
|
36
|
+
/** An engine message addressed to this row. */
|
|
37
|
+
receive(message: InteractiveEngineMessage): void;
|
|
20
38
|
render(width: number): string[];
|
|
21
39
|
invalidate(): void;
|
|
22
40
|
dispose(): void;
|
|
23
41
|
protected changed(): void;
|
|
24
|
-
protected abstract command(requestId: number, width: number):
|
|
42
|
+
protected abstract command(requestId: number, width: number): RemoteRenderCommand;
|
|
43
|
+
/** Names what this row shows, the same for every row recreated for it. */
|
|
44
|
+
protected abstract frameIdentity(): string;
|
|
25
45
|
private markDirty;
|
|
26
46
|
}
|
|
47
|
+
/**
|
|
48
|
+
* Disposes the rows rendered by the engine among `components`, which a cleared chat no longer shows: each one
|
|
49
|
+
* otherwise keeps its renderer alive in the engine for the rest of the session.
|
|
50
|
+
*/
|
|
51
|
+
export declare function disposeRemoteRenderers(components: readonly Component[]): void;
|
|
27
52
|
export declare class RemoteToolExecutionComponent extends RemoteRenderer {
|
|
28
53
|
private readonly toolName;
|
|
29
54
|
private readonly toolCallId;
|
|
@@ -49,16 +74,19 @@ export declare class RemoteToolExecutionComponent extends RemoteRenderer {
|
|
|
49
74
|
setExpanded(expanded: boolean): void;
|
|
50
75
|
setShowImages(show: boolean): void;
|
|
51
76
|
setImageWidthCells(width: number): void;
|
|
52
|
-
protected command(requestId: number, width: number):
|
|
77
|
+
protected command(requestId: number, width: number): RemoteRenderCommand;
|
|
78
|
+
protected frameIdentity(): string;
|
|
53
79
|
}
|
|
54
80
|
export declare class RemoteCustomMessageComponent extends RemoteRenderer {
|
|
55
81
|
private readonly message;
|
|
82
|
+
private contentDigest;
|
|
56
83
|
private expanded;
|
|
57
84
|
private outputPad;
|
|
58
85
|
constructor(message: CustomMessage<unknown>, runtime: IsolatedInteractiveRuntime, requestRender: () => void, outputPad?: number);
|
|
59
86
|
setExpanded(expanded: boolean): void;
|
|
60
87
|
setOutputPad(outputPad: number): void;
|
|
61
|
-
protected command(requestId: number, width: number):
|
|
88
|
+
protected command(requestId: number, width: number): RemoteRenderCommand;
|
|
89
|
+
protected frameIdentity(): string;
|
|
62
90
|
}
|
|
63
91
|
export {};
|
|
64
92
|
//# sourceMappingURL=remote-renderer.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"remote-renderer.d.ts","sourceRoot":"","sources":["../../../src/modes/interactive-engine/remote-renderer.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"remote-renderer.d.ts","sourceRoot":"","sources":["../../../src/modes/interactive-engine/remote-renderer.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AACxD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAC5D,OAAO,KAAK,E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UAAQ,GAAG,IAAI,CAIlE;IACD,WAAW,CAAC,QAAQ,EAAE,OAAO,GAAG,IAAI,CAGnC;IACD,aAAa,CAAC,IAAI,EAAE,OAAO,GAAG,IAAI,CAGjC;IACD,kBAAkB,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAGtC;IAED,SAAS,CAAC,OAAO,CAAC,SAAS,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,mBAAmB,CAkBvE;IAED,SAAS,CAAC,aAAa,IAAI,MAAM,CAEhC;CACD;AAED,qBAAa,4BAA6B,SAAQ,cAAc;IAC/D,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAyB;IACjD,OAAO,CAAC,aAAa,CAAqB;IAC1C,OAAO,CAAC,QAAQ,CAAS;IACzB,OAAO,CAAC,SAAS,CAAS;IAC1B,YACC,OAAO,EAAE,aAAa,CAAC,OAAO,CAAC,EAC/B,OAAO,EAAE,0BAA0B,EACnC,aAAa,EAAE,MAAM,IAAI,EACzB,SAAS,SAAI,EAKb;IAED,WAAW,CAAC,QAAQ,EAAE,OAAO,GAAG,IAAI,CAGnC;IACD,YAAY,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI,CAGpC;IAED,SAAS,CAAC,OAAO,CAAC,SAAS,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,mBAAmB,CAUvE;IAED,SAAS,CAAC,aAAa,IAAI,MAAM,CAMhC;CACD"}
|
|
@@ -1,5 +1,39 @@
|
|
|
1
|
+
import { createHash } from "node:crypto";
|
|
1
2
|
import { RemoteFrameWidthClamp } from "./remote-frame-clamp.js";
|
|
2
3
|
let nextRemoteRendererId = 0;
|
|
4
|
+
const LOADING_LINES = ["Loading isolated renderer…"];
|
|
5
|
+
/**
|
|
6
|
+
* How many rows' last frames are kept, by row identity (a tool call, a custom message), to repaint rebuilt rows. A chat
|
|
7
|
+
* rebuild (compaction, `/reload`, a switched session) recreates every row, and each new row waits for the engine to
|
|
8
|
+
* render it. Showing the row's last frame meanwhile keeps the rebuilt chat painted, instead of a screen of placeholders
|
|
9
|
+
* that lasts as long as the engine is busy.
|
|
10
|
+
*/
|
|
11
|
+
export const REMOTE_FRAME_CACHE_LIMIT = 2_000;
|
|
12
|
+
const recentFrames = new Map();
|
|
13
|
+
function rememberFrame(key, lines) {
|
|
14
|
+
recentFrames.delete(key);
|
|
15
|
+
recentFrames.set(key, lines);
|
|
16
|
+
if (recentFrames.size > REMOTE_FRAME_CACHE_LIMIT) {
|
|
17
|
+
const oldest = recentFrames.keys().next().value;
|
|
18
|
+
if (oldest !== undefined)
|
|
19
|
+
recentFrames.delete(oldest);
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
/** One engine-message subscription per runtime, routed by component id, however many rows the chat holds. */
|
|
23
|
+
const routesByRuntime = new WeakMap();
|
|
24
|
+
function rendererRoutes(runtime) {
|
|
25
|
+
let routes = routesByRuntime.get(runtime);
|
|
26
|
+
if (routes === undefined) {
|
|
27
|
+
const created = new Map();
|
|
28
|
+
runtime.onEngineMessage((message) => {
|
|
29
|
+
if ("componentId" in message)
|
|
30
|
+
created.get(message.componentId)?.receive(message);
|
|
31
|
+
});
|
|
32
|
+
routesByRuntime.set(runtime, created);
|
|
33
|
+
routes = created;
|
|
34
|
+
}
|
|
35
|
+
return routes;
|
|
36
|
+
}
|
|
3
37
|
function jsonValue(value) {
|
|
4
38
|
if (value === undefined)
|
|
5
39
|
return null;
|
|
@@ -8,39 +42,57 @@ function jsonValue(value) {
|
|
|
8
42
|
}
|
|
9
43
|
class RemoteRenderer {
|
|
10
44
|
componentId = `remote_renderer_${++nextRemoteRendererId}`;
|
|
11
|
-
lines =
|
|
45
|
+
lines = LOADING_LINES;
|
|
12
46
|
width = 0;
|
|
13
47
|
requestId = 0;
|
|
14
48
|
appliedRequestId = 0;
|
|
15
49
|
dirty = true;
|
|
16
50
|
disposed = false;
|
|
17
51
|
frameClamp = new RemoteFrameWidthClamp();
|
|
18
|
-
|
|
52
|
+
routes;
|
|
53
|
+
/**
|
|
54
|
+
* What each unanswered request showed (its frame identity, expansion included), by request id. A frame is
|
|
55
|
+
* remembered under the identity of the request it answers, not under the row's state when it arrives: a row
|
|
56
|
+
* collapsed while its expanded frame was in flight must not have that frame remembered as its collapsed one.
|
|
57
|
+
*/
|
|
58
|
+
requestIdentities = new Map();
|
|
19
59
|
runtime;
|
|
20
60
|
requestRender;
|
|
21
61
|
constructor(runtime, requestRender) {
|
|
22
62
|
this.runtime = runtime;
|
|
23
63
|
this.requestRender = requestRender;
|
|
24
|
-
this.
|
|
25
|
-
|
|
64
|
+
this.routes = rendererRoutes(runtime);
|
|
65
|
+
this.routes.set(this.componentId, this);
|
|
66
|
+
}
|
|
67
|
+
/** An engine message addressed to this row. */
|
|
68
|
+
receive(message) {
|
|
69
|
+
if (message.type === "engine_custom_frame") {
|
|
70
|
+
if (message.requestId < this.appliedRequestId)
|
|
26
71
|
return;
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
72
|
+
this.appliedRequestId = message.requestId;
|
|
73
|
+
this.lines = message.lines;
|
|
74
|
+
const identity = this.requestIdentities.get(message.requestId);
|
|
75
|
+
for (const requestId of this.requestIdentities.keys())
|
|
76
|
+
if (requestId <= message.requestId)
|
|
77
|
+
this.requestIdentities.delete(requestId);
|
|
78
|
+
if (identity !== undefined)
|
|
79
|
+
rememberFrame(identity, message.lines);
|
|
80
|
+
this.requestRender();
|
|
81
|
+
}
|
|
82
|
+
else if (message.type === "engine_custom_invalidate") {
|
|
83
|
+
this.changed();
|
|
84
|
+
}
|
|
38
85
|
}
|
|
39
86
|
render(width) {
|
|
40
87
|
if (!this.disposed && (this.dirty || width !== this.width)) {
|
|
41
88
|
this.width = width;
|
|
42
89
|
this.dirty = false;
|
|
43
|
-
|
|
90
|
+
// A row rebuilt for a row the engine already rendered paints its last frame until the fresh one arrives.
|
|
91
|
+
const identity = this.frameIdentity();
|
|
92
|
+
if (this.lines === LOADING_LINES)
|
|
93
|
+
this.lines = recentFrames.get(identity) ?? LOADING_LINES;
|
|
94
|
+
this.requestIdentities.set(++this.requestId, identity);
|
|
95
|
+
this.runtime.sendEngineCommand(this.command(this.requestId, width));
|
|
44
96
|
}
|
|
45
97
|
// The engine child re-renders asynchronously; until the fresh frame
|
|
46
98
|
// arrives, the previous frame may be wrapped for an older terminal
|
|
@@ -55,7 +107,9 @@ class RemoteRenderer {
|
|
|
55
107
|
if (this.disposed)
|
|
56
108
|
return;
|
|
57
109
|
this.disposed = true;
|
|
58
|
-
this.
|
|
110
|
+
if (this.routes.get(this.componentId) === this)
|
|
111
|
+
this.routes.delete(this.componentId);
|
|
112
|
+
this.requestIdentities.clear();
|
|
59
113
|
this.runtime.sendEngineCommand({ type: "engine_render_dispose", componentId: this.componentId });
|
|
60
114
|
}
|
|
61
115
|
changed() {
|
|
@@ -66,6 +120,15 @@ class RemoteRenderer {
|
|
|
66
120
|
this.dirty = true;
|
|
67
121
|
}
|
|
68
122
|
}
|
|
123
|
+
/**
|
|
124
|
+
* Disposes the rows rendered by the engine among `components`, which a cleared chat no longer shows: each one
|
|
125
|
+
* otherwise keeps its renderer alive in the engine for the rest of the session.
|
|
126
|
+
*/
|
|
127
|
+
export function disposeRemoteRenderers(components) {
|
|
128
|
+
for (const component of components)
|
|
129
|
+
if (component instanceof RemoteRenderer)
|
|
130
|
+
component.dispose();
|
|
131
|
+
}
|
|
69
132
|
export class RemoteToolExecutionComponent extends RemoteRenderer {
|
|
70
133
|
toolName;
|
|
71
134
|
toolCallId;
|
|
@@ -139,9 +202,13 @@ export class RemoteToolExecutionComponent extends RemoteRenderer {
|
|
|
139
202
|
outputPad: this.outputPad,
|
|
140
203
|
};
|
|
141
204
|
}
|
|
205
|
+
frameIdentity() {
|
|
206
|
+
return JSON.stringify(["tool", this.toolName, this.toolCallId, this.expanded]);
|
|
207
|
+
}
|
|
142
208
|
}
|
|
143
209
|
export class RemoteCustomMessageComponent extends RemoteRenderer {
|
|
144
210
|
message;
|
|
211
|
+
contentDigest;
|
|
145
212
|
expanded = false;
|
|
146
213
|
outputPad;
|
|
147
214
|
constructor(message, runtime, requestRender, outputPad = 1) {
|
|
@@ -168,5 +235,12 @@ export class RemoteCustomMessageComponent extends RemoteRenderer {
|
|
|
168
235
|
outputPad: this.outputPad,
|
|
169
236
|
};
|
|
170
237
|
}
|
|
238
|
+
frameIdentity() {
|
|
239
|
+
// Not the timestamp: a message shown live and the same message restored from the session can differ in it.
|
|
240
|
+
this.contentDigest ??= createHash("sha1")
|
|
241
|
+
.update(JSON.stringify([this.message.content, this.message.details]) ?? "")
|
|
242
|
+
.digest("base64");
|
|
243
|
+
return JSON.stringify(["message", this.message.customType, this.contentDigest, this.expanded]);
|
|
244
|
+
}
|
|
171
245
|
}
|
|
172
246
|
//# sourceMappingURL=remote-renderer.js.map
|