@openspecui/core 6.0.0 → 6.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (120) hide show
  1. package/dist/app-daemon-control.d.mts +362 -0
  2. package/dist/app-daemon-control.mjs +81 -0
  3. package/dist/{cli-projection-vO3-FJg5.mjs → cli-projection-BHfqvlpA.mjs} +1 -1
  4. package/dist/{cli-projection-D97_RM6V.d.mts → cli-projection-DVpaxd82.d.mts} +1 -1
  5. package/dist/cli-projection.d.mts +5 -5
  6. package/dist/cli-projection.mjs +2 -2
  7. package/dist/{command-result-CfME21jF.d.mts → command-result-BRYzlmg1.d.mts} +102 -91
  8. package/dist/{dashboard-summary-transport-CYBuU4iT.mjs → dashboard-summary-transport-BMtZ0q12.mjs} +2 -2
  9. package/dist/{dashboard-summary-transport-CwQpcPXI.d.mts → dashboard-summary-transport-DEjdVWdn.d.mts} +3459 -2021
  10. package/dist/dashboard-summary-transport.d.mts +25 -24
  11. package/dist/dashboard-summary-transport.mjs +4 -4
  12. package/dist/{document-translation-CeJFGMoy.mjs → document-translation-CUkkxnYV.mjs} +1 -1
  13. package/dist/{document-translation-D9bhVMu9.d.mts → document-translation-J_NddeDy.d.mts} +102 -102
  14. package/dist/document-translation.d.mts +1 -1
  15. package/dist/document-translation.mjs +2 -2
  16. package/dist/{hosted-app-Y7yqlPBG.mjs → hosted-app-C3gBSvov.mjs} +3 -2
  17. package/dist/hosted-app.d.mts +26 -25
  18. package/dist/hosted-app.mjs +8 -7
  19. package/dist/{hosted-contract-BuhF_tuQ.mjs → hosted-contract-CaN2aw54.mjs} +31 -7
  20. package/dist/hosted-contract.d.mts +26 -25
  21. package/dist/hosted-contract.mjs +7 -6
  22. package/dist/index.d.mts +26 -25
  23. package/dist/index.mjs +979 -106
  24. package/dist/{local-download-profiles-D0EDIDY3.d.mts → local-download-profiles-CI66p2NW.d.mts} +1 -1
  25. package/dist/local-download-profiles.d.mts +2 -2
  26. package/dist/local-download-profiles.mjs +1 -1
  27. package/dist/markdown-facts.d.mts +1 -1
  28. package/dist/markdown-facts.mjs +1 -1
  29. package/dist/{markdown-reading-mG4OAbDO.mjs → markdown-reading-0L-mVBJp.mjs} +1 -1
  30. package/dist/{markdown-reading-LUdqfbxH.d.mts → markdown-reading-w686Obnl.d.mts} +1 -1
  31. package/dist/markdown-reading.d.mts +2 -2
  32. package/dist/markdown-reading.mjs +2 -2
  33. package/dist/{notifications-APukMHjf.d.mts → notifications-DaDB-ZBM.d.mts} +4 -4
  34. package/dist/{notifications-C2bxAzX_.mjs → notifications-E6_WBjQO.mjs} +2 -2
  35. package/dist/notifications.d.mts +2 -2
  36. package/dist/notifications.mjs +3 -3
  37. package/dist/{openspec-annotations-C58Aoi-V.d.mts → openspec-annotations-BXAqKLXc.d.mts} +2 -2
  38. package/dist/{openspec-annotations-DCfqBMal.mjs → openspec-annotations-DiHje5HD.mjs} +2 -2
  39. package/dist/openspec-annotations.d.mts +3 -3
  40. package/dist/openspec-annotations.mjs +3 -3
  41. package/dist/openspec-compat.d.mts +12 -10
  42. package/dist/openspec-compat.mjs +19 -23
  43. package/dist/{openspec-projection-CeRyRol_.d.mts → openspec-projection-DrrLI_ub.d.mts} +3 -3
  44. package/dist/{openspec-projection-DCgToo0Q.mjs → openspec-projection-DvJnsxLZ.mjs} +2 -2
  45. package/dist/openspec-projection.d.mts +5 -5
  46. package/dist/openspec-projection.mjs +4 -4
  47. package/dist/opsx-display-path.d.mts +1 -1
  48. package/dist/opsx-display-path.mjs +1 -1
  49. package/dist/{opsx-entity-O_EFhltR.d.mts → opsx-entity-BhMqFWGT.d.mts} +2 -2
  50. package/dist/opsx-entity.d.mts +7 -7
  51. package/dist/opsx-entity.mjs +1 -1
  52. package/dist/{opsx-schema-detail-BTksrDp1.d.mts → opsx-schema-detail-DvkJvwg_.d.mts} +2 -2
  53. package/dist/opsx-schema-detail.d.mts +8 -8
  54. package/dist/opsx-schema-detail.mjs +1 -1
  55. package/dist/{opsx-types-BYSPqX85.d.mts → opsx-types-DRg1Yo2Y.d.mts} +2 -2
  56. package/dist/opsx-workflows.d.mts +1 -1
  57. package/dist/opsx-workflows.mjs +1 -1
  58. package/dist/{planning-cli-projection-DIRxeq2H.mjs → planning-cli-projection-DrkT18EI.mjs} +4 -4
  59. package/dist/planning-cli-projection.d.mts +25 -24
  60. package/dist/planning-cli-projection.mjs +7 -7
  61. package/dist/{schemas-BLWVYKEk.d.mts → schemas-Bafi7L8Y.d.mts} +182 -182
  62. package/dist/{sounds-BLspIXhv.d.mts → sounds-B6SBMmGR.d.mts} +9 -9
  63. package/dist/sounds.d.mts +1 -1
  64. package/dist/sounds.mjs +1 -1
  65. package/dist/{spec-catalog-ZGuiZ4CE.mjs → spec-catalog-Dv2qolxy.mjs} +3 -3
  66. package/dist/spec-catalog.d.mts +25 -24
  67. package/dist/spec-catalog.mjs +4 -4
  68. package/dist/store-content-projection-BPDCma8v.d.mts +463 -0
  69. package/dist/store-content-projection-CiMcGZnG.mjs +82 -0
  70. package/dist/store-content-projection.d.mts +2 -0
  71. package/dist/store-content-projection.mjs +4 -0
  72. package/dist/{store-mutation-protocol-CSwD-xPO.mjs → store-mutation-protocol-CLtYUSwC.mjs} +1 -1
  73. package/dist/{store-mutation-protocol-B6AF69kW.d.mts → store-mutation-protocol-Ckcv2-zs.d.mts} +36 -36
  74. package/dist/store-mutation-protocol.d.mts +1 -1
  75. package/dist/store-mutation-protocol.mjs +2 -2
  76. package/dist/{store-types-pd0g35dI.d.mts → store-types-B0Qx8UPs.d.mts} +1 -1
  77. package/dist/store-types.d.mts +5 -5
  78. package/dist/store-types.mjs +1 -1
  79. package/dist/{task-progress-B_IWVXjA.mjs → task-progress-DpZak5xA.mjs} +1 -1
  80. package/dist/task-progress.d.mts +6 -6
  81. package/dist/task-progress.mjs +2 -2
  82. package/dist/{terminal-audio-DuJNjIJ3.d.mts → terminal-audio-BoIZa5SP.d.mts} +2 -2
  83. package/dist/{terminal-audio-d6KItUeJ.mjs → terminal-audio-punFQHXI.mjs} +1 -1
  84. package/dist/terminal-audio.d.mts +2 -2
  85. package/dist/terminal-audio.mjs +2 -2
  86. package/dist/terminal-control.d.mts +2 -2
  87. package/dist/terminal-control.mjs +1 -1
  88. package/dist/{terminal-invocation-C4EE7MeN.d.mts → terminal-invocation-ChWI_i72.d.mts} +12 -12
  89. package/dist/terminal-invocation.d.mts +1 -1
  90. package/dist/terminal-invocation.mjs +1 -1
  91. package/dist/terminal-theme.d.mts +1 -1
  92. package/dist/terminal-theme.mjs +1 -1
  93. package/dist/translation-language-pair.d.mts +1 -1
  94. package/dist/translation-language-pair.mjs +1 -1
  95. package/dist/{translator-BgYwP0UT.d.mts → translator-C7d_Bkbo.d.mts} +184 -184
  96. package/dist/translator.d.mts +1 -1
  97. package/dist/translator.mjs +1 -1
  98. package/dist/workspace-directory-catalog.d.mts +172 -0
  99. package/dist/workspace-directory-catalog.mjs +111 -0
  100. package/package.json +30 -5
  101. /package/dist/{common-D8YUK9dA.mjs → common-BpgNUOOT.mjs} +0 -0
  102. /package/dist/{local-download-profiles-odzOdf96.mjs → local-download-profiles-DK4g6FRe.mjs} +0 -0
  103. /package/dist/{markdown-facts-CCw3QdbM.d.mts → markdown-facts-C9yWB2I9.d.mts} +0 -0
  104. /package/dist/{markdown-facts-BUqLvFRf.mjs → markdown-facts-Dve6IAJP.mjs} +0 -0
  105. /package/dist/{opsx-display-path-D13XV20v.mjs → opsx-display-path-DuPEvPV0.mjs} +0 -0
  106. /package/dist/{opsx-display-path-RXS5JTbV.d.mts → opsx-display-path-eWJ4ve-O.d.mts} +0 -0
  107. /package/dist/{opsx-entity-Cn_Zu1J3.mjs → opsx-entity-Br5S5N0o.mjs} +0 -0
  108. /package/dist/{opsx-schema-detail-Beis4Ba2.mjs → opsx-schema-detail-CckZIEVr.mjs} +0 -0
  109. /package/dist/{opsx-workflows-BvnJqjfL.d.mts → opsx-workflows-Bhh_bI-e.d.mts} +0 -0
  110. /package/dist/{opsx-workflows-Ccc6U7IR.mjs → opsx-workflows-GPZSe1C_.mjs} +0 -0
  111. /package/dist/{schemas-BFroDdOC.mjs → schemas-BrS9qSB3.mjs} +0 -0
  112. /package/dist/{sounds-NXwveBqq.mjs → sounds-na4c8j0c.mjs} +0 -0
  113. /package/dist/{store-types-DlX1REBg.mjs → store-types-Cs40yohL.mjs} +0 -0
  114. /package/dist/{terminal-control-BSAlOTs8.mjs → terminal-control-BvoxwQ6m.mjs} +0 -0
  115. /package/dist/{terminal-invocation-0p-j2eSP.mjs → terminal-invocation-BexVY5E2.mjs} +0 -0
  116. /package/dist/{terminal-theme-m3MSGJ7U.d.mts → terminal-theme-BzARb2Do.d.mts} +0 -0
  117. /package/dist/{terminal-theme-B8iRttTR.mjs → terminal-theme-DIhzj5Si.mjs} +0 -0
  118. /package/dist/{translation-language-pair-Bbhk-LAC.mjs → translation-language-pair-BV2cGjfv.mjs} +0 -0
  119. /package/dist/{translation-language-pair-C18GPATW.d.mts → translation-language-pair-DeAiww3_.d.mts} +0 -0
  120. /package/dist/{translator-Cjtv4tya.mjs → translator-DCCZeHt1.mjs} +0 -0
package/dist/index.mjs CHANGED
@@ -1,45 +1,50 @@
1
- import { _ as isTextLikeMime, a as DeltaSpecSchema, c as ScenarioStepSchema, d as TrackedTaskProgressSchema, f as FILE_PREVIEW_KINDS, g as isTextLikeFile, h as isPreviewableFile, i as DeltaSchema, l as SpecSchema, m as inferFilePreviewKind, n as ChangeSchema, o as RequirementSchema, p as inferFileMime, r as DeltaOperationType, s as ScenarioStepKeywordSchema, t as ChangeFileSchema, u as TaskSchema } from "./schemas-BFroDdOC.mjs";
2
- import { a as normalizeOpsxEntityPath, c as parseOpsxEntityMetadata, i as isOpsxGlobPattern, n as getOpsxEntityMetadataPath, o as opsxGlobToRegex, r as getOpsxEntityRootRelativePath, s as opsxPathMatchesPattern, t as buildOpsxEntityDetail } from "./opsx-entity-Cn_Zu1J3.mjs";
3
- import { t as parseOpsxSchemaDetail } from "./opsx-schema-detail-Beis4Ba2.mjs";
4
- import { n as toMarkdownFactKind, t as parseMarkdownFacts } from "./markdown-facts-BUqLvFRf.mjs";
5
- import { a as getMarkdownAnnotation, c as getMarkdownHeadingEnd, d as trimMarkdownSlice, i as createMarkdownReadingDocumentFromFacts, l as getMarkdownHeadingFacts, n as buildMarkdownParentMap, o as getMarkdownAnnotationsForFact, r as createMarkdownReadingDocument, s as getMarkdownFactSpan, t as MarkdownReadingPluginRegistry, u as sortMarkdownReadingPlugins } from "./markdown-reading-mG4OAbDO.mjs";
6
- import { a as getOpenSpecAnnotationsForFact, i as getOpenSpecAnnotation, n as annotateOpenSpecMarkdown, o as openSpecAnnotationRules, r as builtinOpenSpecReadingPlugin, t as annotateOpenSpecFacts } from "./openspec-annotations-DCfqBMal.mjs";
7
- import { a as getOpenSpecReadingSections, c as projectOpenSpecMarkdown, i as getOpenSpecProjectionAnnotation, n as OPEN_SPEC_SPEC_PROJECTION_ID, o as parseOpenSpecMarkdownToSpec, r as createOpenSpecReadingPlugin, s as projectAnnotatedOpenSpecToSpec, t as OPEN_SPEC_READING_SECTIONS_PROJECTION_ID } from "./openspec-projection-DCgToo0Q.mjs";
8
- import { a as isMarkdownTaskSourcePath, c as toggleMarkdownTask, i as deriveTrackedTaskPhase, n as createDocumentChecklistSummary, o as parseMarkdownTasks, r as createTrackedTaskProgress, s as projectTaskProjectionsFromMarkdownFiles, t as createApplyInstructionProgress } from "./task-progress-B_IWVXjA.mjs";
9
- import { a as CliRootSchema, i as CliReferenceIndexEntrySchema, n as CliDiagnosticSchema, o as CliRootSourceSchema, r as CliDoctorReferenceEntrySchema, t as CliDiagnosticFailureSchema } from "./common-D8YUK9dA.mjs";
10
- import { A as CliSchemasSchema, B as CliStoreCleanupSchema, C as CliArtifactInstructionsSuccessSchema, F as CliValidateSchema, G as CliStoreSchema, H as CliStoreDoctorSchema, I as CliWorkflowStatusSchema, K as parseCliCommandResult, L as CliWorkflowStatusSuccessSchema, M as CliShowSpecSchema, N as CliSpecListSchema, R as CliContextSchema, S as CliArtifactInstructionsSchema, T as CliChangeListSchema, U as CliStoreListSchema, V as CliStoreDoctorEntrySchema, W as CliStoreMutationSchema, _ as OpenSpecCliContractExecutor, a as SpecDocumentProjectionSchema, b as CliApplyInstructionsSuccessSchema, c as createStaticSpecCatalogOwnedProjection, d as getSpecCatalogEntry, f as isReferencedSpecIdentity, g as specRoutePath, h as specIdentityKey, i as SpecCommandEvidenceSchema, j as CliShowSpecDocumentSchema, l as createStaticSpecCatalogReferenceProjection, m as specIdentityFromRoute, n as ReferencedSpecIdentitySchema, o as SpecIdentitySchema, p as mergeSpecCatalog, r as SpecCatalogSchema, s as buildSpecCatalog, t as OwnedSpecIdentitySchema, u as createStaticSpecCatalogReferenceSource, x as CliArchiveSchema, y as CliApplyInstructionsSchema, z as CliDoctorSchema } from "./spec-catalog-ZGuiZ4CE.mjs";
11
- import { a as CliProjectionInvalidationCauseSchema, d as toCliProjectionCommandEvidence, f as toCliProjectionFailure, i as CliProjectionFailureSchema, l as cliProjectionStates, n as CliProjectionCommandError, o as CliProjectionNoticeSchema, p as toCliProjectionNotice, r as CliProjectionCommandEvidenceSchema, s as CliProjectionStateNameSchema, t as CliJsonValueSchema, u as createCliProjectionStateSchema } from "./cli-projection-vO3-FJg5.mjs";
12
- import { $ as shouldShowTranslationEngineInstallGate, A as TranslationEngineIdSchema, B as TranslationLocalLlamaSettingsUpdateSchema, C as TranslationDownloadGroupPlanSchema, D as TranslationEngineDependencyStatusSchema, E as TranslationEngineDependencyStateSchema, F as TranslationEngineRuntimeStateSchema, G as createTranslationEngineLifecycleStatus, H as TranslationLocalSettingsUpdateSchema, I as TranslationEngineRuntimeStatusSchema, J as getTranslationEngineManifest, K as getManagedLocalTranslationEngineManifest, L as TranslationLocalCt2SettingsSchema, M as TranslationEngineInstallLogStreamSchema, N as TranslationEngineLifecycleEventSchema, O as TranslationEngineGlobalSettingsSchema, P as TranslationEngineLifecycleStatusSchema, Q as isTranslationEngineRuntimeReady, R as TranslationLocalCt2SettingsUpdateSchema, S as TranslationDownloadFilePlanSchema, T as TranslationEngineAssetStatusSchema, U as TranslationOpenAISettingsSchema, V as TranslationLocalSettingsSchema, W as TranslationOpenAISettingsUpdateSchema, X as isManagedLocalTranslationEngineId, Y as isDirectionalManagedLocalTranslationEngineId, Z as isTranslationEngineDependencyReady, _ as SERVICE_TRANSLATION_ENGINE_IDS, a as LocalModelAssetLogSchema, b as TRANSLATION_ENGINE_MANIFESTS, c as LocalModelDownloadStatusSchema, d as LocalModelProfileLoadStateSchema, et as isBatchTranslationAbort, f as LocalModelProfileManifestFileSchema, g as ManagedLocalCatalogSourceSchema, h as LocalModelProfileStatusSchema, i as DEFAULT_TRANSLATION_ENGINE_ID, j as TranslationEngineInstallLogEventSchema, k as TranslationEngineGlobalSettingsUpdateSchema, l as LocalModelLifecycleFileStateSchema, m as LocalModelProfileManifestSchema, n as BatchTranslateInputSchema, nt as runControlledTranslationTask, o as LocalModelAssetPlanSnapshotSchema, p as LocalModelProfileManifestGroupSchema, q as getTranslationEngineLifecycleMessage, s as LocalModelAssetStateSchema, t as BatchTranslateEventSchema, tt as normalizeBatchTranslationError, u as LocalModelLifecycleGroupStateSchema, v as ServiceTranslationEngineIdSchema, w as TranslationEngineAssetStateSchema, x as TRANSLATOR_CONTRACT_VERSION, y as TRANSLATION_ENGINE_IDS, z as TranslationLocalLlamaSettingsSchema } from "./translator-Cjtv4tya.mjs";
13
- import { a as DocumentTranslationDisplayModeSchema, c as TRANSLATION_CACHE_POLICY_VERSION, d as TranslationCacheSettingsSchema, f as TranslationCacheSettingsUpdateSchema, g as TranslationEngineProjectSettingsUpdateSchema, h as TranslationEngineProjectSettingsSchema, i as DocumentTranslationConfigUpdateSchema, l as TranslationCacheEntrySchema, m as TranslationCacheWriteInputSchema, n as DOCUMENT_TRANSLATION_DISPLAY_MODES, o as MAX_TRANSLATION_CACHE_ENTRY_LIMIT, p as TranslationCacheStatsSchema, r as DocumentTranslationConfigSchema, s as MIN_TRANSLATION_CACHE_ENTRY_LIMIT, t as DEFAULT_TRANSLATION_CACHE_ENTRY_LIMIT, u as TranslationCacheReadInputSchema } from "./document-translation-CeJFGMoy.mjs";
14
- import { _ as customHashFromSoundId, a as CustomSoundHashSchema, b as soundIdFromCustomHash, c as CustomSoundMetadataSchema, f as LEGACY_SOUND_ID_MAP, g as SoundVolumeSchema, h as SoundIdSchema, i as CUSTOM_SOUND_ADD_VALUE, l as DEFAULT_BELL_SOUND_ID, m as SoundConfigIdSchema, n as BUILTIN_SOUND_OPTIONS, o as CustomSoundIdSchema, p as SILENT_SOUND_ID, r as BuiltinSoundIdSchema, s as CustomSoundMetadataFileSchema, t as BUILTIN_SOUND_IDS, u as DEFAULT_NOTIFICATION_SOUND_ID, v as getBuiltinSoundUrl, y as normalizeLegacySoundId } from "./sounds-NXwveBqq.mjs";
15
- import { n as terminalNotificationEventToPublishInput, t as TerminalControlParser } from "./terminal-control-BSAlOTs8.mjs";
16
- import { a as NotificationPublishInputSchema, c as NotificationSoundSchema, h as groupNotifications, i as NotificationGroupKeySchema, l as NotificationSourceSchema, m as getNotificationGroupLabel, n as NOTIFICATION_SOUND_VALUES, o as NotificationRecordSchema, p as getNotificationGroupKey, r as NotificationActionSchema, s as NotificationSettingsSchema, t as NOTIFICATION_SOUND_OPTIONS, u as TerminalNotificationParser } from "./notifications-C2bxAzX_.mjs";
17
- import { n as TERMINAL_BELL_SOUND_VALUES, r as TerminalBellSoundSchema, t as TERMINAL_BELL_SOUND_OPTIONS } from "./terminal-audio-d6KItUeJ.mjs";
18
- import { a as TERMINAL_THEME_VALUES, i as TERMINAL_THEME_MODE_VALUES, n as DEFAULT_TERMINAL_LIGHT_THEME, r as DEFAULT_TERMINAL_THEME_MODE, t as DEFAULT_TERMINAL_DARK_THEME } from "./terminal-theme-B8iRttTR.mjs";
19
- import { i as selectLocalDownloadGroup, n as buildLocalDownloadPlanFromRepositoryFiles, r as buildLocalDownloadPlanFromRuntimeProfileFiles, t as LOCAL_MODEL_PROFILE_DEFINITIONS } from "./local-download-profiles-odzOdf96.mjs";
20
- import { n as inferLocalDirectionalModelLanguagePair, t as checkLocalDirectionalModelLanguagePair } from "./translation-language-pair-Bbhk-LAC.mjs";
21
- import { C as TemplateContentMapSchema, E as isGlobPattern, S as SchemaResolutionSchema, T as TemplatesSchema, _ as OpsxConfigBundleSchema, a as PlanningCliProjectionDataSchema, b as SchemaDetailSchema, c as ApplyInstructionsContextFilesSchema, d as ApplyTaskSchema, f as ArtifactInstructionsSchema, g as OpsxCliEvidenceSchema, h as DependencyInfoSchema, i as EnvironmentGlobalProjectionStateSchema, l as ApplyInstructionsProjectionSchema, m as ChangeStatusSchema, n as EnvironmentGlobalFileProjectionStateSchema, o as PlanningCliProjectionSelectorSchema, p as ArtifactStatusSchema, r as EnvironmentGlobalProjectionDataSchema, s as PlanningCliProjectionStateSchema, t as EnvironmentGlobalFileProjectionDataSchema, u as ApplyInstructionsSchema, v as OpsxStatusEvidenceSchema, w as TemplateContentSchema, x as SchemaInfoSchema, y as SchemaArtifactSchema } from "./planning-cli-projection-DIRxeq2H.mjs";
22
- import { a as OPSX_CORE_PROFILE_WORKFLOWS, c as OPSX_WORKFLOW_TO_SKILL_DIR, i as OPSX_COMMAND_CAPABLE_WORKFLOWS, l as isOpsxCoreWorkflowSelection, n as OPSX_ARTIFACT_INPUT_ACTIONS, o as OPSX_TEXT_INPUT_ACTIONS, r as OPSX_CHANGE_INPUT_ACTIONS, s as OPSX_WORKFLOW_LABELS, t as OPSX_ALL_WORKFLOWS } from "./opsx-workflows-Ccc6U7IR.mjs";
23
- import { a as DASHBOARD_METRIC_KEYS, c as DashboardSummaryProjectionSchema, i as DashboardSummaryProjectionStateSchema, l as DashboardTrendsProjectionSchema, n as DashboardSummaryInvalidationCauseSchema, o as DashboardGitSnapshotSchema, r as DashboardSummaryInvalidationSchema, s as DashboardOverviewSchema, t as DashboardSummaryIdentitySchema } from "./dashboard-summary-transport-CYBuU4iT.mjs";
24
- import { i as StoreMutationStartResponseSchema, n as StoreMutationResultSchema, r as StoreMutationSchema, t as StoreMutationLifecycleEventSchema } from "./store-mutation-protocol-CSwD-xPO.mjs";
25
- import { a as StoreListResultSchema, n as StoreDoctorResultSchema, o as classifyStoreCliResult, s as toStoreFeatureResult } from "./store-types-DlX1REBg.mjs";
26
- import { S as isTerminalMutationStatus, b as asEnvUri, t as HOSTED_SHELL_PROTOCOL_VERSION, v as OPENSPECUI_RUNTIME_CAPABILITIES, x as hasCapability } from "./hosted-contract-BuhF_tuQ.mjs";
27
- import { a as buildHostedLaunchUrl, c as isSupportedEmbeddedUiUrl, d as resolveHostedAppBaseUrl, i as buildEmbeddedUiLaunchUrl, l as normalizeEmbeddedUiUrl, n as OFFICIAL_APP_BASE_URL, o as isBackendHealthRuntimeMetadata, r as buildBackendHealthPayload, s as isHostedBackendHealthResponse, u as normalizeHostedAppBaseUrl } from "./hosted-app-Y7yqlPBG.mjs";
28
- import { n as toOpsxDisplayPath, t as VIRTUAL_PROJECT_DIRNAME } from "./opsx-display-path-D13XV20v.mjs";
29
- import { a as TerminalInvocationSettingsSchema, c as TerminalSpawnCommandSchema, f as quoteTerminalShellArg, g as resolveTerminalShellDefaults, h as renderTerminalSpawnCommandLine, i as TerminalCommandFieldSchema, n as TERMINAL_COMMAND_FIELD_TYPE_VALUES, o as TerminalShellProfileSchema, p as renderTerminalCommandArgs, r as TERMINAL_SHELL_QUOTE_STYLE_VALUES, s as TerminalShellQuoteStyleSchema, t as BUILTIN_TERMINAL_SPAWN_COMMANDS, u as getTerminalCommandDefaultValues } from "./terminal-invocation-0p-j2eSP.mjs";
1
+ import { _ as isTextLikeMime, a as DeltaSpecSchema, c as ScenarioStepSchema, d as TrackedTaskProgressSchema, f as FILE_PREVIEW_KINDS, g as isTextLikeFile, h as isPreviewableFile, i as DeltaSchema, l as SpecSchema, m as inferFilePreviewKind, n as ChangeSchema, o as RequirementSchema, p as inferFileMime, r as DeltaOperationType, s as ScenarioStepKeywordSchema, t as ChangeFileSchema, u as TaskSchema } from "./schemas-BrS9qSB3.mjs";
2
+ import { a as normalizeOpsxEntityPath, c as parseOpsxEntityMetadata, i as isOpsxGlobPattern, n as getOpsxEntityMetadataPath, o as opsxGlobToRegex, r as getOpsxEntityRootRelativePath, s as opsxPathMatchesPattern, t as buildOpsxEntityDetail } from "./opsx-entity-Br5S5N0o.mjs";
3
+ import { t as parseOpsxSchemaDetail } from "./opsx-schema-detail-CckZIEVr.mjs";
4
+ import { n as toMarkdownFactKind, t as parseMarkdownFacts } from "./markdown-facts-Dve6IAJP.mjs";
5
+ import { a as getMarkdownAnnotation, c as getMarkdownHeadingEnd, d as trimMarkdownSlice, i as createMarkdownReadingDocumentFromFacts, l as getMarkdownHeadingFacts, n as buildMarkdownParentMap, o as getMarkdownAnnotationsForFact, r as createMarkdownReadingDocument, s as getMarkdownFactSpan, t as MarkdownReadingPluginRegistry, u as sortMarkdownReadingPlugins } from "./markdown-reading-0L-mVBJp.mjs";
6
+ import { a as getOpenSpecAnnotationsForFact, i as getOpenSpecAnnotation, n as annotateOpenSpecMarkdown, o as openSpecAnnotationRules, r as builtinOpenSpecReadingPlugin, t as annotateOpenSpecFacts } from "./openspec-annotations-DiHje5HD.mjs";
7
+ import { a as getOpenSpecReadingSections, c as projectOpenSpecMarkdown, i as getOpenSpecProjectionAnnotation, n as OPEN_SPEC_SPEC_PROJECTION_ID, o as parseOpenSpecMarkdownToSpec, r as createOpenSpecReadingPlugin, s as projectAnnotatedOpenSpecToSpec, t as OPEN_SPEC_READING_SECTIONS_PROJECTION_ID } from "./openspec-projection-DvJnsxLZ.mjs";
8
+ import { a as isMarkdownTaskSourcePath, c as toggleMarkdownTask, i as deriveTrackedTaskPhase, n as createDocumentChecklistSummary, o as parseMarkdownTasks, r as createTrackedTaskProgress, s as projectTaskProjectionsFromMarkdownFiles, t as createApplyInstructionProgress } from "./task-progress-DpZak5xA.mjs";
9
+ import { a as CliRootSchema, i as CliReferenceIndexEntrySchema, n as CliDiagnosticSchema, o as CliRootSourceSchema, r as CliDoctorReferenceEntrySchema, t as CliDiagnosticFailureSchema } from "./common-BpgNUOOT.mjs";
10
+ import { A as CliSchemasSchema, B as CliStoreCleanupSchema, C as CliArtifactInstructionsSuccessSchema, F as CliValidateSchema, G as CliStoreSchema, H as CliStoreDoctorSchema, I as CliWorkflowStatusSchema, K as parseCliCommandResult, L as CliWorkflowStatusSuccessSchema, M as CliShowSpecSchema, N as CliSpecListSchema, R as CliContextSchema, S as CliArtifactInstructionsSchema, T as CliChangeListSchema, U as CliStoreListSchema, V as CliStoreDoctorEntrySchema, W as CliStoreMutationSchema, _ as OpenSpecCliContractExecutor, a as SpecDocumentProjectionSchema, b as CliApplyInstructionsSuccessSchema, c as createStaticSpecCatalogOwnedProjection, d as getSpecCatalogEntry, f as isReferencedSpecIdentity, g as specRoutePath, h as specIdentityKey, i as SpecCommandEvidenceSchema, j as CliShowSpecDocumentSchema, l as createStaticSpecCatalogReferenceProjection, m as specIdentityFromRoute, n as ReferencedSpecIdentitySchema, o as SpecIdentitySchema, p as mergeSpecCatalog, r as SpecCatalogSchema, s as buildSpecCatalog, t as OwnedSpecIdentitySchema, u as createStaticSpecCatalogReferenceSource, x as CliArchiveSchema, y as CliApplyInstructionsSchema, z as CliDoctorSchema } from "./spec-catalog-Dv2qolxy.mjs";
11
+ import { a as CliProjectionInvalidationCauseSchema, d as toCliProjectionCommandEvidence, f as toCliProjectionFailure, i as CliProjectionFailureSchema, l as cliProjectionStates, n as CliProjectionCommandError, o as CliProjectionNoticeSchema, p as toCliProjectionNotice, r as CliProjectionCommandEvidenceSchema, s as CliProjectionStateNameSchema, t as CliJsonValueSchema, u as createCliProjectionStateSchema } from "./cli-projection-BHfqvlpA.mjs";
12
+ import { $ as shouldShowTranslationEngineInstallGate, A as TranslationEngineIdSchema, B as TranslationLocalLlamaSettingsUpdateSchema, C as TranslationDownloadGroupPlanSchema, D as TranslationEngineDependencyStatusSchema, E as TranslationEngineDependencyStateSchema, F as TranslationEngineRuntimeStateSchema, G as createTranslationEngineLifecycleStatus, H as TranslationLocalSettingsUpdateSchema, I as TranslationEngineRuntimeStatusSchema, J as getTranslationEngineManifest, K as getManagedLocalTranslationEngineManifest, L as TranslationLocalCt2SettingsSchema, M as TranslationEngineInstallLogStreamSchema, N as TranslationEngineLifecycleEventSchema, O as TranslationEngineGlobalSettingsSchema, P as TranslationEngineLifecycleStatusSchema, Q as isTranslationEngineRuntimeReady, R as TranslationLocalCt2SettingsUpdateSchema, S as TranslationDownloadFilePlanSchema, T as TranslationEngineAssetStatusSchema, U as TranslationOpenAISettingsSchema, V as TranslationLocalSettingsSchema, W as TranslationOpenAISettingsUpdateSchema, X as isManagedLocalTranslationEngineId, Y as isDirectionalManagedLocalTranslationEngineId, Z as isTranslationEngineDependencyReady, _ as SERVICE_TRANSLATION_ENGINE_IDS, a as LocalModelAssetLogSchema, b as TRANSLATION_ENGINE_MANIFESTS, c as LocalModelDownloadStatusSchema, d as LocalModelProfileLoadStateSchema, et as isBatchTranslationAbort, f as LocalModelProfileManifestFileSchema, g as ManagedLocalCatalogSourceSchema, h as LocalModelProfileStatusSchema, i as DEFAULT_TRANSLATION_ENGINE_ID, j as TranslationEngineInstallLogEventSchema, k as TranslationEngineGlobalSettingsUpdateSchema, l as LocalModelLifecycleFileStateSchema, m as LocalModelProfileManifestSchema, n as BatchTranslateInputSchema, nt as runControlledTranslationTask, o as LocalModelAssetPlanSnapshotSchema, p as LocalModelProfileManifestGroupSchema, q as getTranslationEngineLifecycleMessage, s as LocalModelAssetStateSchema, t as BatchTranslateEventSchema, tt as normalizeBatchTranslationError, u as LocalModelLifecycleGroupStateSchema, v as ServiceTranslationEngineIdSchema, w as TranslationEngineAssetStateSchema, x as TRANSLATOR_CONTRACT_VERSION, y as TRANSLATION_ENGINE_IDS, z as TranslationLocalLlamaSettingsSchema } from "./translator-DCCZeHt1.mjs";
13
+ import { a as DocumentTranslationDisplayModeSchema, c as TRANSLATION_CACHE_POLICY_VERSION, d as TranslationCacheSettingsSchema, f as TranslationCacheSettingsUpdateSchema, g as TranslationEngineProjectSettingsUpdateSchema, h as TranslationEngineProjectSettingsSchema, i as DocumentTranslationConfigUpdateSchema, l as TranslationCacheEntrySchema, m as TranslationCacheWriteInputSchema, n as DOCUMENT_TRANSLATION_DISPLAY_MODES, o as MAX_TRANSLATION_CACHE_ENTRY_LIMIT, p as TranslationCacheStatsSchema, r as DocumentTranslationConfigSchema, s as MIN_TRANSLATION_CACHE_ENTRY_LIMIT, t as DEFAULT_TRANSLATION_CACHE_ENTRY_LIMIT, u as TranslationCacheReadInputSchema } from "./document-translation-CUkkxnYV.mjs";
14
+ import { _ as customHashFromSoundId, a as CustomSoundHashSchema, b as soundIdFromCustomHash, c as CustomSoundMetadataSchema, f as LEGACY_SOUND_ID_MAP, g as SoundVolumeSchema, h as SoundIdSchema, i as CUSTOM_SOUND_ADD_VALUE, l as DEFAULT_BELL_SOUND_ID, m as SoundConfigIdSchema, n as BUILTIN_SOUND_OPTIONS, o as CustomSoundIdSchema, p as SILENT_SOUND_ID, r as BuiltinSoundIdSchema, s as CustomSoundMetadataFileSchema, t as BUILTIN_SOUND_IDS, u as DEFAULT_NOTIFICATION_SOUND_ID, v as getBuiltinSoundUrl, y as normalizeLegacySoundId } from "./sounds-na4c8j0c.mjs";
15
+ import { n as terminalNotificationEventToPublishInput, t as TerminalControlParser } from "./terminal-control-BvoxwQ6m.mjs";
16
+ import { a as NotificationPublishInputSchema, c as NotificationSoundSchema, h as groupNotifications, i as NotificationGroupKeySchema, l as NotificationSourceSchema, m as getNotificationGroupLabel, n as NOTIFICATION_SOUND_VALUES, o as NotificationRecordSchema, p as getNotificationGroupKey, r as NotificationActionSchema, s as NotificationSettingsSchema, t as NOTIFICATION_SOUND_OPTIONS, u as TerminalNotificationParser } from "./notifications-E6_WBjQO.mjs";
17
+ import { n as TERMINAL_BELL_SOUND_VALUES, r as TerminalBellSoundSchema, t as TERMINAL_BELL_SOUND_OPTIONS } from "./terminal-audio-punFQHXI.mjs";
18
+ import { a as TERMINAL_THEME_VALUES, i as TERMINAL_THEME_MODE_VALUES, n as DEFAULT_TERMINAL_LIGHT_THEME, r as DEFAULT_TERMINAL_THEME_MODE, t as DEFAULT_TERMINAL_DARK_THEME } from "./terminal-theme-DIhzj5Si.mjs";
19
+ import { i as selectLocalDownloadGroup, n as buildLocalDownloadPlanFromRepositoryFiles, r as buildLocalDownloadPlanFromRuntimeProfileFiles, t as LOCAL_MODEL_PROFILE_DEFINITIONS } from "./local-download-profiles-DK4g6FRe.mjs";
20
+ import { n as inferLocalDirectionalModelLanguagePair, t as checkLocalDirectionalModelLanguagePair } from "./translation-language-pair-BV2cGjfv.mjs";
21
+ import { C as TemplateContentMapSchema, E as isGlobPattern, S as SchemaResolutionSchema, T as TemplatesSchema, _ as OpsxConfigBundleSchema, a as PlanningCliProjectionDataSchema, b as SchemaDetailSchema, c as ApplyInstructionsContextFilesSchema, d as ApplyTaskSchema, f as ArtifactInstructionsSchema, g as OpsxCliEvidenceSchema, h as DependencyInfoSchema, i as EnvironmentGlobalProjectionStateSchema, l as ApplyInstructionsProjectionSchema, m as ChangeStatusSchema, n as EnvironmentGlobalFileProjectionStateSchema, o as PlanningCliProjectionSelectorSchema, p as ArtifactStatusSchema, r as EnvironmentGlobalProjectionDataSchema, s as PlanningCliProjectionStateSchema, t as EnvironmentGlobalFileProjectionDataSchema, u as ApplyInstructionsSchema, v as OpsxStatusEvidenceSchema, w as TemplateContentSchema, x as SchemaInfoSchema, y as SchemaArtifactSchema } from "./planning-cli-projection-DrkT18EI.mjs";
22
+ import { a as OPSX_CORE_PROFILE_WORKFLOWS, c as OPSX_WORKFLOW_TO_SKILL_DIR, i as OPSX_COMMAND_CAPABLE_WORKFLOWS, l as isOpsxCoreWorkflowSelection, n as OPSX_ARTIFACT_INPUT_ACTIONS, o as OPSX_TEXT_INPUT_ACTIONS, r as OPSX_CHANGE_INPUT_ACTIONS, s as OPSX_WORKFLOW_LABELS, t as OPSX_ALL_WORKFLOWS } from "./opsx-workflows-GPZSe1C_.mjs";
23
+ import { a as DASHBOARD_METRIC_KEYS, c as DashboardSummaryProjectionSchema, i as DashboardSummaryProjectionStateSchema, l as DashboardTrendsProjectionSchema, n as DashboardSummaryInvalidationCauseSchema, o as DashboardGitSnapshotSchema, r as DashboardSummaryInvalidationSchema, s as DashboardOverviewSchema, t as DashboardSummaryIdentitySchema } from "./dashboard-summary-transport-BMtZ0q12.mjs";
24
+ import { a as StoreListResultSchema, n as StoreDoctorResultSchema, o as classifyStoreCliResult, s as toStoreFeatureResult } from "./store-types-Cs40yohL.mjs";
25
+ import "./store-content-projection-CiMcGZnG.mjs";
26
+ import { i as StoreMutationStartResponseSchema, n as StoreMutationResultSchema, r as StoreMutationSchema, t as StoreMutationLifecycleEventSchema } from "./store-mutation-protocol-CLtYUSwC.mjs";
27
+ import { C as OPENSPECUI_RUNTIME_CAPABILITIES, D as isTerminalMutationStatus, E as hasCapability, T as asEnvUri, t as HOSTED_SHELL_PROTOCOL_VERSION } from "./hosted-contract-CaN2aw54.mjs";
28
+ import { a as buildHostedLaunchUrl, c as isSupportedEmbeddedUiUrl, d as resolveHostedAppBaseUrl, i as buildEmbeddedUiLaunchUrl, l as normalizeEmbeddedUiUrl, n as OFFICIAL_APP_BASE_URL, o as isBackendHealthRuntimeMetadata, r as buildBackendHealthPayload, s as isHostedBackendHealthResponse, u as normalizeHostedAppBaseUrl } from "./hosted-app-C3gBSvov.mjs";
29
+ import { n as toOpsxDisplayPath, t as VIRTUAL_PROJECT_DIRNAME } from "./opsx-display-path-DuPEvPV0.mjs";
30
+ import { a as TerminalInvocationSettingsSchema, c as TerminalSpawnCommandSchema, f as quoteTerminalShellArg, g as resolveTerminalShellDefaults, h as renderTerminalSpawnCommandLine, i as TerminalCommandFieldSchema, n as TERMINAL_COMMAND_FIELD_TYPE_VALUES, o as TerminalShellProfileSchema, p as renderTerminalCommandArgs, r as TERMINAL_SHELL_QUOTE_STYLE_VALUES, s as TerminalShellQuoteStyleSchema, t as BUILTIN_TERMINAL_SPAWN_COMMANDS, u as getTerminalCommandDefaultValues } from "./terminal-invocation-BexVY5E2.mjs";
30
31
  import { mkdir, writeFile } from "fs/promises";
31
32
  import { dirname, join } from "path";
32
33
  import { isMap, parseDocument } from "yaml";
33
- import { lstat, mkdir as mkdir$1, readFile, readdir, realpath, rm, stat, writeFile as writeFile$1 } from "node:fs/promises";
34
+ import { access, lstat, mkdir as mkdir$1, readFile, readdir, realpath, rm, stat, writeFile as writeFile$1 } from "node:fs/promises";
34
35
  import { basename, dirname as dirname$1, isAbsolute, join as join$1, matchesGlob, posix, relative, resolve, sep, win32 } from "node:path";
35
36
  import { existsSync, lstatSync, readFileSync, realpathSync } from "node:fs";
36
37
  import { AsyncLocalStorage } from "node:async_hooks";
37
38
  import { z } from "zod";
38
39
  import { EventEmitter } from "events";
39
40
  import { watch } from "fs";
40
- import { exec, execFile, spawn } from "child_process";
41
+ import { exec, execFile } from "child_process";
41
42
  import { promisify } from "util";
42
- import { homedir, platform } from "node:os";
43
+ import crossSpawn from "cross-spawn";
44
+ import { homedir, loadavg, platform } from "node:os";
45
+ import { context, trace } from "@opentelemetry/api";
46
+ import { performance as performance$1 } from "node:perf_hooks";
47
+ import { Worker } from "node:worker_threads";
43
48
  import { createHash, randomBytes } from "node:crypto";
44
49
 
45
50
  //#region src/entity-id.ts
@@ -1126,10 +1131,10 @@ var ReactiveState = class {
1126
1131
  * 如果在 ReactiveContext 中调用,会自动注册依赖
1127
1132
  */
1128
1133
  get() {
1129
- const context = contextStorage.getStore();
1130
- if (context) {
1131
- context.track(this);
1132
- this.subscribers.add(context);
1134
+ const context$1 = contextStorage.getStore();
1135
+ if (context$1) {
1136
+ context$1.track(this);
1137
+ this.subscribers.add(context$1);
1133
1138
  }
1134
1139
  return this.currentValue;
1135
1140
  }
@@ -1141,15 +1146,15 @@ var ReactiveState = class {
1141
1146
  set(newValue) {
1142
1147
  if (this.equals(this.currentValue, newValue)) return false;
1143
1148
  this.currentValue = newValue;
1144
- for (const context of this.subscribers) context.notifyChange();
1149
+ for (const context$1 of this.subscribers) context$1.notifyChange();
1145
1150
  return true;
1146
1151
  }
1147
1152
  /**
1148
1153
  * 取消订阅
1149
1154
  * 当 Context 销毁时调用
1150
1155
  */
1151
- unsubscribe(context) {
1152
- this.subscribers.delete(context);
1156
+ unsubscribe(context$1) {
1157
+ this.subscribers.delete(context$1);
1153
1158
  }
1154
1159
  /**
1155
1160
  * 获取当前订阅者数量(用于调试)
@@ -2590,7 +2595,7 @@ function spawnSafe(command, args, options) {
2590
2595
  try {
2591
2596
  return {
2592
2597
  ok: true,
2593
- child: spawn(command, [...args], options)
2598
+ child: crossSpawn(command, [...args], options)
2594
2599
  };
2595
2600
  } catch (err) {
2596
2601
  return {
@@ -2599,55 +2604,164 @@ function spawnSafe(command, args, options) {
2599
2604
  };
2600
2605
  }
2601
2606
  }
2602
- function killChild(child) {
2607
+ function killChild(child, signal = "SIGTERM") {
2603
2608
  try {
2604
- child.kill();
2609
+ child.kill(signal);
2605
2610
  } catch {}
2606
2611
  }
2612
+ const EAGER_JSON_EXIT_GRACE_MS = 25;
2613
+ const BUFFERED_FORCE_KILL_DELAY_MS = 1e3;
2607
2614
  function runBufferedCommand(options) {
2608
2615
  return new Promise((resolve$1) => {
2616
+ const phases = {
2617
+ spawnCalledAt: performance.now(),
2618
+ spawnReturnedAt: 0,
2619
+ spawnObservedAt: 0,
2620
+ firstStdoutAt: 0,
2621
+ firstStderrAt: 0,
2622
+ jsonCompleteAt: 0,
2623
+ terminationRequestedAt: 0,
2624
+ resultResolvedAt: 0,
2625
+ exitAt: 0,
2626
+ closeAt: 0,
2627
+ eagerResolved: false,
2628
+ resultReason: null
2629
+ };
2630
+ const observe = (phase, evidence = {}) => {
2631
+ options.onPhase?.({
2632
+ phase,
2633
+ at: performance.now(),
2634
+ ...evidence
2635
+ });
2636
+ };
2637
+ observe("spawn-called");
2609
2638
  const started = spawnSafe(options.command, options.args, {
2610
2639
  cwd: options.cwd,
2611
2640
  shell: false,
2612
2641
  env: options.env
2613
2642
  });
2614
2643
  if (!started.ok) {
2644
+ observe("spawn-error", { reason: "spawn-error" });
2645
+ phases.resultResolvedAt = performance.now();
2646
+ phases.resultReason = "spawn-error";
2647
+ observe("result-resolved", { reason: "spawn-error" });
2615
2648
  resolve$1({
2616
2649
  stdout: "",
2617
2650
  stderr: "",
2618
2651
  exitCode: null,
2619
2652
  timedOut: false,
2620
- spawnError: started.error
2653
+ spawnError: started.error,
2654
+ phases
2621
2655
  });
2622
2656
  return;
2623
2657
  }
2624
2658
  const { child } = started;
2659
+ phases.spawnReturnedAt = performance.now();
2660
+ observe("spawn-returned", { pid: child.pid });
2625
2661
  let stdout = "";
2626
2662
  let stderr = "";
2627
2663
  let timedOut = false;
2628
2664
  let settled = false;
2665
+ let eagerJsonTimer = null;
2666
+ let forceKillTimer = null;
2667
+ const clearEagerJsonTimer = () => {
2668
+ if (!eagerJsonTimer) return;
2669
+ clearTimeout(eagerJsonTimer);
2670
+ eagerJsonTimer = null;
2671
+ };
2672
+ const clearForceKillTimer = () => {
2673
+ if (!forceKillTimer) return;
2674
+ clearTimeout(forceKillTimer);
2675
+ forceKillTimer = null;
2676
+ };
2677
+ const requestTermination = (reason) => {
2678
+ if (!phases.terminationRequestedAt) {
2679
+ phases.terminationRequestedAt = performance.now();
2680
+ observe("termination-requested", { reason });
2681
+ }
2682
+ killChild(child);
2683
+ if (forceKillTimer) return;
2684
+ forceKillTimer = setTimeout(() => {
2685
+ forceKillTimer = null;
2686
+ if (!phases.exitAt && !phases.closeAt) killChild(child, "SIGKILL");
2687
+ }, BUFFERED_FORCE_KILL_DELAY_MS);
2688
+ };
2629
2689
  let clearTimer = () => {};
2630
2690
  if (options.timeoutMs !== void 0) {
2631
2691
  const timer = setTimeout(() => {
2632
2692
  timedOut = true;
2633
- killChild(child);
2693
+ requestTermination("timeout");
2634
2694
  }, options.timeoutMs);
2635
2695
  clearTimer = () => clearTimeout(timer);
2636
2696
  }
2637
- const finish = (result) => {
2697
+ if (options.signal) {
2698
+ const onAbort = () => {
2699
+ requestTermination("abort");
2700
+ };
2701
+ if (options.signal.aborted) onAbort();
2702
+ else options.signal.addEventListener("abort", onAbort, { once: true });
2703
+ }
2704
+ const finish = (reason, result) => {
2638
2705
  if (settled) return;
2639
2706
  settled = true;
2640
2707
  clearTimer();
2708
+ clearEagerJsonTimer();
2709
+ if (reason !== "eager-json") clearForceKillTimer();
2710
+ phases.resultResolvedAt = performance.now();
2711
+ phases.resultReason = reason;
2712
+ result.phases = phases;
2713
+ observe("result-resolved", { reason });
2641
2714
  resolve$1(result);
2642
2715
  };
2716
+ child.once("spawn", () => {
2717
+ phases.spawnObservedAt = performance.now();
2718
+ observe("spawn-observed", { pid: child.pid });
2719
+ });
2643
2720
  child.stdout?.on("data", (data) => {
2721
+ if (!phases.firstStdoutAt) {
2722
+ phases.firstStdoutAt = performance.now();
2723
+ observe("first-stdout-observed");
2724
+ }
2644
2725
  stdout += data.toString();
2726
+ if (options.eagerResolveJson && !phases.jsonCompleteAt && stdout.trimStart().startsWith("{")) try {
2727
+ JSON.parse(stdout);
2728
+ phases.jsonCompleteAt = performance.now();
2729
+ observe("json-complete-observed");
2730
+ eagerJsonTimer = setTimeout(() => {
2731
+ eagerJsonTimer = null;
2732
+ if (settled || phases.exitAt) return;
2733
+ phases.eagerResolved = true;
2734
+ requestTermination("eager-json");
2735
+ finish("eager-json", {
2736
+ stdout,
2737
+ stderr,
2738
+ exitCode: 0,
2739
+ timedOut
2740
+ });
2741
+ }, EAGER_JSON_EXIT_GRACE_MS);
2742
+ } catch {}
2645
2743
  });
2646
2744
  child.stderr?.on("data", (data) => {
2745
+ if (!phases.firstStderrAt) {
2746
+ phases.firstStderrAt = performance.now();
2747
+ observe("first-stderr-observed");
2748
+ }
2647
2749
  stderr += data.toString();
2648
2750
  });
2751
+ child.on("exit", (exitCode, signal) => {
2752
+ clearEagerJsonTimer();
2753
+ clearForceKillTimer();
2754
+ if (!phases.exitAt) {
2755
+ phases.exitAt = performance.now();
2756
+ observe("exit-observed", {
2757
+ exitCode,
2758
+ signal
2759
+ });
2760
+ }
2761
+ });
2649
2762
  child.on("error", (err) => {
2650
- finish({
2763
+ observe("spawn-error", { reason: "spawn-error" });
2764
+ finish("spawn-error", {
2651
2765
  stdout,
2652
2766
  stderr,
2653
2767
  exitCode: null,
@@ -2655,8 +2769,14 @@ function runBufferedCommand(options) {
2655
2769
  spawnError: formatSpawnError(err)
2656
2770
  });
2657
2771
  });
2658
- child.on("close", (exitCode) => {
2659
- finish({
2772
+ child.on("close", (exitCode, signal) => {
2773
+ clearForceKillTimer();
2774
+ phases.closeAt = performance.now();
2775
+ observe("close-observed", {
2776
+ exitCode,
2777
+ signal
2778
+ });
2779
+ finish("close", {
2660
2780
  stdout,
2661
2781
  stderr,
2662
2782
  exitCode,
@@ -2669,15 +2789,19 @@ function runBufferedCommand(options) {
2669
2789
  //#endregion
2670
2790
  //#region src/config.ts
2671
2791
  /**
2672
- * Orthogonal intents (updated 2026-07-20 Asia/Shanghai):
2792
+ * Orthogonal intents (updated 2026-07-30 Asia/Shanghai):
2673
2793
  * 1. Define and persist project-scoped OpenSpecUI settings.
2674
2794
  * 2. Resolve, diagnose, cache, and explicitly invalidate the OpenSpec CLI runner.
2675
2795
  * 3. Prevent retired in-flight runner resolutions from reclaiming cache ownership.
2676
2796
  * 4. Preserve reactive config reads and serialized config writes.
2797
+ * 5. Resolve Windows `where` candidates by PATHEXT so the executable shim is preferred over the
2798
+ * extension-less script (issue #209 hotfix).
2677
2799
  *
2678
2800
  * Original request (2026-07-14): "openspec 1.6.0 已经放出,我们需要开始进行适配。"
2679
2801
  * Independent review correction (2026-07-20): Global CLI installation must retire cached and
2680
2802
  * in-flight runner authority.
2803
+ * Hotfix (2026-07-30, issue #209): `where openspec` returns the extension-less npm shim first;
2804
+ * `spawn({shell:false})` cannot execute it. Prefer the PATHEXT-matching entry (e.g. `.cmd`).
2681
2805
  *
2682
2806
  * Compromise: configuration schemas and runtime management remain in one historical physical file;
2683
2807
  * splitting that public surface is outside the bounded 6.13 correction.
@@ -2858,6 +2982,23 @@ function isBareExecutableCommand(command) {
2858
2982
  function quotePosixShellArg(value) {
2859
2983
  return `'${value.replace(/'/g, `'\\''`)}'`;
2860
2984
  }
2985
+ /**
2986
+ * Pick the most executable path from Windows `where` output.
2987
+ *
2988
+ * npm global installs emit three siblings: the extension-less Unix shim (returned first and
2989
+ * usable only by Git Bash/WSL), `<cmd>.cmd`, and `<cmd>.ps1`. Node `spawn({shell:false})` cannot
2990
+ * execute the extension-less shim, so prefer the first entry that matches `PATHEXT`. Only fall
2991
+ * back to the raw first line when no entry carries an executable extension.
2992
+ */
2993
+ function pickWindowsExecutablePath(lines, pathExt) {
2994
+ const trimmed = lines.map((line) => line.trim()).filter((line) => line.length > 0);
2995
+ if (trimmed.length === 0) return null;
2996
+ const extensions = (pathExt ?? ".COM;.EXE;.BAT;.CMD;.VBS;.JS;.WS;.MSC").split(";").map((ext) => ext.trim().toLowerCase()).filter((ext) => ext.length > 0);
2997
+ return trimmed.find((line) => {
2998
+ const lower = line.toLowerCase();
2999
+ return extensions.some((ext) => lower.endsWith(ext));
3000
+ }) ?? trimmed[0];
3001
+ }
2861
3002
  async function resolveShellExecutablePath(command, cwd, env) {
2862
3003
  if (!isBareExecutableCommand(command)) return null;
2863
3004
  try {
@@ -2868,7 +3009,7 @@ async function resolveShellExecutablePath(command, cwd, env) {
2868
3009
  encoding: "utf8",
2869
3010
  timeout: 5e3
2870
3011
  });
2871
- return stdout$1.split(/\r?\n/).map((line) => line.trim()).find((line) => line.length > 0) || null;
3012
+ return pickWindowsExecutablePath(stdout$1.split(/\r?\n/), env.PATHEXT);
2872
3013
  }
2873
3014
  const { stdout } = await execFileAsync(env.SHELL || process.env.SHELL || "/bin/sh", ["-lc", `command -v -- ${quotePosixShellArg(command)}`], {
2874
3015
  cwd,
@@ -4091,6 +4232,82 @@ function buildRuntimePackageInstallCommand(input) {
4091
4232
  }) ?? null;
4092
4233
  }
4093
4234
 
4235
+ //#endregion
4236
+ //#region src/cli-buffered-admission.ts
4237
+ /**
4238
+ * Orthogonal intents (updated 2026-07-31 Asia/Shanghai):
4239
+ * 1. Own the process-local FIFO admission boundary for buffered CLI child processes.
4240
+ * 2. Expose queue/running observations without owning command semantics or subprocess lifecycle.
4241
+ * 3. Retire queued admissions when the owning CliExecutor is disposed.
4242
+ *
4243
+ * Original request (2026-07-31): "系统性地进行修复,因为List页面也有类似的问题。所有可能其它页面都有类似的问题。"
4244
+ * Owner evidence (2026-07-31): a spawned `openspec doctor --json` emitted no stdout for 12.95s
4245
+ * while other Dashboard-originated CLI projection work was active.
4246
+ */
4247
+ /** One CliExecutor-wide buffered subprocess slot. Streaming terminal commands remain independent. */
4248
+ var CliBufferedAdmission = class {
4249
+ limit = 1;
4250
+ active = 0;
4251
+ queue = [];
4252
+ acquire(signal) {
4253
+ if (signal.aborted) return Promise.resolve(null);
4254
+ return new Promise((resolve$1) => {
4255
+ const waiter = {
4256
+ enqueuedAt: performance$1.now(),
4257
+ activeAtEnqueue: this.active,
4258
+ waitingAtEnqueue: this.queue.length,
4259
+ resolve: resolve$1,
4260
+ detachAbort: () => {},
4261
+ settled: false
4262
+ };
4263
+ const abort = () => {
4264
+ if (waiter.settled) return;
4265
+ waiter.settled = true;
4266
+ waiter.detachAbort();
4267
+ const index = this.queue.indexOf(waiter);
4268
+ if (index >= 0) this.queue.splice(index, 1);
4269
+ resolve$1(null);
4270
+ };
4271
+ signal.addEventListener("abort", abort, { once: true });
4272
+ waiter.detachAbort = () => signal.removeEventListener("abort", abort);
4273
+ this.queue.push(waiter);
4274
+ this.drain();
4275
+ });
4276
+ }
4277
+ stats() {
4278
+ return {
4279
+ active: this.active,
4280
+ waiting: this.queue.length
4281
+ };
4282
+ }
4283
+ drain() {
4284
+ if (this.active >= this.limit) return;
4285
+ const waiter = this.queue.shift();
4286
+ if (!waiter) return;
4287
+ if (waiter.settled) {
4288
+ this.drain();
4289
+ return;
4290
+ }
4291
+ waiter.settled = true;
4292
+ waiter.detachAbort();
4293
+ this.active += 1;
4294
+ let released = false;
4295
+ waiter.resolve({
4296
+ evidence: {
4297
+ activeAtEnqueue: waiter.activeAtEnqueue,
4298
+ waitingAtEnqueue: waiter.waitingAtEnqueue,
4299
+ waitMs: performance$1.now() - waiter.enqueuedAt
4300
+ },
4301
+ release: () => {
4302
+ if (released) return;
4303
+ released = true;
4304
+ this.active -= 1;
4305
+ this.drain();
4306
+ }
4307
+ });
4308
+ }
4309
+ };
4310
+
4094
4311
  //#endregion
4095
4312
  //#region src/cli-stream-child-owner.ts
4096
4313
  /** Internal owner for the direct child of one CLI stream. */
@@ -4123,8 +4340,292 @@ var CliStreamChildOwner = class {
4123
4340
  };
4124
4341
  const ownersByChild = /* @__PURE__ */ new WeakMap();
4125
4342
 
4343
+ //#endregion
4344
+ //#region src/openspec-cli-worker.ts
4345
+ /**
4346
+ * Orthogonal intents (updated 2026-07-31 Asia/Shanghai):
4347
+ * 1. Resolve an installed OpenSpec package's importable CLI module from its configured runner and
4348
+ * distinguish objective module absence from Worker startup/execution failure.
4349
+ * 2. Execute one buffered OpenSpec command inside an isolated Node Worker with project cwd semantics.
4350
+ * 3. Project Worker stdout, stderr, cancellation, and settlement through the buffered spawn contract.
4351
+ *
4352
+ * Original request (2026-07-31): "直接寻址到本地 openspec 背后的 js,直接用 worker_thread 来运行它。"
4353
+ * Original request (2026-07-31): "通过 OPENSPEC_SPAWN_MODE=process|worker 来进行区分两种模式。"
4354
+ */
4355
+ const OPENSPEC_SPAWN_MODE_ENV = "OPENSPEC_SPAWN_MODE";
4356
+ /** Objective signal that no importable OpenSpec CLI JavaScript module exists behind the runner. */
4357
+ var OpenSpecCliModuleNotFoundError = class extends Error {
4358
+ constructor(message) {
4359
+ super(message);
4360
+ this.name = "OpenSpecCliModuleNotFoundError";
4361
+ }
4362
+ };
4363
+ const WORKER_BOOTSTRAP = String.raw`
4364
+ const { parentPort, workerData } = require('node:worker_threads')
4365
+ const { pathToFileURL } = require('node:url')
4366
+
4367
+ process.argv.splice(0, process.argv.length, process.execPath, 'openspec', ...workerData.args)
4368
+ process.cwd = () => workerData.cwd
4369
+
4370
+ void (async () => {
4371
+ const cli = await import(pathToFileURL(workerData.modulePath).href)
4372
+ if (!cli.program || typeof cli.program.parseAsync !== 'function') {
4373
+ throw new TypeError('OpenSpec CLI module does not export program.parseAsync().')
4374
+ }
4375
+ await cli.program.parseAsync(process.argv)
4376
+ parentPort.postMessage({ type: 'completed', exitCode: process.exitCode ?? 0 })
4377
+ parentPort.close()
4378
+ })().catch((error) => {
4379
+ const message = error instanceof Error ? (error.stack ?? error.message) : String(error)
4380
+ process.stderr.write(message + '\n')
4381
+ process.exitCode = 1
4382
+ parentPort.close()
4383
+ })
4384
+ `;
4385
+ function createPhases() {
4386
+ return {
4387
+ spawnCalledAt: performance$1.now(),
4388
+ spawnReturnedAt: 0,
4389
+ spawnObservedAt: 0,
4390
+ firstStdoutAt: 0,
4391
+ firstStderrAt: 0,
4392
+ jsonCompleteAt: 0,
4393
+ terminationRequestedAt: 0,
4394
+ resultResolvedAt: 0,
4395
+ exitAt: 0,
4396
+ closeAt: 0,
4397
+ eagerResolved: false,
4398
+ resultReason: null
4399
+ };
4400
+ }
4401
+ function isOpenSpecWorkerMessage(value) {
4402
+ if (typeof value !== "object" || value === null) return false;
4403
+ const candidate = value;
4404
+ return candidate.type === "completed" && typeof candidate.exitCode === "number";
4405
+ }
4406
+ function cleanWorkerEnv(env) {
4407
+ return Object.fromEntries(Object.entries(env).filter((entry) => entry[1] !== void 0));
4408
+ }
4409
+ function isNodeExecutable(command) {
4410
+ const executable = basename(command).toLowerCase();
4411
+ return executable === "node" || executable === "node.exe" || resolve(command) === resolve(process.execPath);
4412
+ }
4413
+ function isMissingPathError(error) {
4414
+ if (typeof error !== "object" || error === null || !("code" in error)) return false;
4415
+ const code = error.code;
4416
+ return code === "ENOENT" || code === "ENOTDIR";
4417
+ }
4418
+ async function existingFile(path) {
4419
+ try {
4420
+ await access(path);
4421
+ return path;
4422
+ } catch (error) {
4423
+ if (isMissingPathError(error)) return null;
4424
+ throw error;
4425
+ }
4426
+ }
4427
+ async function moduleFromBin(binPath) {
4428
+ let physicalBin;
4429
+ try {
4430
+ physicalBin = await realpath(binPath);
4431
+ } catch (error) {
4432
+ if (isMissingPathError(error)) return null;
4433
+ throw error;
4434
+ }
4435
+ if (physicalBin.endsWith(join$1("dist", "cli", "index.js"))) return existingFile(physicalBin);
4436
+ if (basename(physicalBin) !== "openspec.js" || basename(dirname$1(physicalBin)) !== "bin") return null;
4437
+ return existingFile(join$1(dirname$1(dirname$1(physicalBin)), "dist", "cli", "index.js"));
4438
+ }
4439
+ async function moduleFromVitePlusShim(command) {
4440
+ if (basename(command) !== "openspec" || basename(dirname$1(command)) !== "bin") return null;
4441
+ const vitePlusRoot = dirname$1(dirname$1(command));
4442
+ if (basename(vitePlusRoot) !== ".vite-plus") return null;
4443
+ return existingFile(join$1(vitePlusRoot, "packages", "@fission-ai", "openspec", "lib", "node_modules", "@fission-ai", "openspec", "dist", "cli", "index.js"));
4444
+ }
4445
+ async function resolveOpenSpecWorkerInvocation(fullCommand) {
4446
+ const [command, ...commandArgs] = fullCommand;
4447
+ if (!command) throw new Error("OpenSpec CLI command is empty.");
4448
+ if (isNodeExecutable(command)) {
4449
+ const [binPath, ...args] = commandArgs;
4450
+ if (!binPath) throw new Error("Node OpenSpec runner does not include its bin entry.");
4451
+ const modulePath$1 = await moduleFromBin(binPath);
4452
+ if (!modulePath$1) throw new OpenSpecCliModuleNotFoundError(`Cannot resolve the OpenSpec CLI module from Node entry: ${binPath}`);
4453
+ return {
4454
+ modulePath: modulePath$1,
4455
+ args
4456
+ };
4457
+ }
4458
+ const modulePath = await moduleFromBin(command) ?? await moduleFromVitePlusShim(resolve(command)) ?? await moduleFromVitePlusShim(command);
4459
+ if (!modulePath) throw new OpenSpecCliModuleNotFoundError(`Cannot resolve the OpenSpec CLI module from runner: ${command}`);
4460
+ return {
4461
+ modulePath,
4462
+ args: commandArgs
4463
+ };
4464
+ }
4465
+ /** Resolve the main-thread buffered OpenSpec execution mode. */
4466
+ function resolveOpenSpecSpawnMode(value = process.env[OPENSPEC_SPAWN_MODE_ENV]) {
4467
+ if (value === void 0 || value === "" || value === "worker") return "worker";
4468
+ if (value === "process") return "process";
4469
+ throw new RangeError(`OPENSPEC_SPAWN_MODE must be "process" or "worker"; received "${value}".`);
4470
+ }
4471
+ /** Execute one importable OpenSpec CLI command in a dedicated Worker. */
4472
+ function runOpenSpecCliWorker(options) {
4473
+ return new Promise((resolveResult) => {
4474
+ const phases = createPhases();
4475
+ let stderr = "";
4476
+ let stdout = "";
4477
+ let settled = false;
4478
+ let worker = null;
4479
+ let completedExitCode = null;
4480
+ let workerError;
4481
+ let aborted = false;
4482
+ const observe = (phase, evidence = {}) => options.onPhase?.({
4483
+ phase,
4484
+ at: performance$1.now(),
4485
+ ...evidence
4486
+ });
4487
+ const finish = (reason, exitCode) => {
4488
+ if (settled) return;
4489
+ settled = true;
4490
+ phases.resultResolvedAt = performance$1.now();
4491
+ phases.resultReason = reason;
4492
+ observe("result-resolved", { reason });
4493
+ resolveResult({
4494
+ stdout,
4495
+ stderr,
4496
+ exitCode,
4497
+ timedOut: false,
4498
+ ...workerError ? { spawnError: workerError } : {},
4499
+ phases
4500
+ });
4501
+ };
4502
+ const requestTermination = (reason) => {
4503
+ if (!worker || phases.terminationRequestedAt) return;
4504
+ phases.terminationRequestedAt = performance$1.now();
4505
+ observe("termination-requested", { reason });
4506
+ worker.terminate();
4507
+ };
4508
+ const onAbort = () => {
4509
+ aborted = true;
4510
+ requestTermination("abort");
4511
+ };
4512
+ if (options.signal?.aborted) {
4513
+ phases.resultResolvedAt = performance$1.now();
4514
+ phases.resultReason = "close";
4515
+ observe("result-resolved", { reason: "close" });
4516
+ resolveResult({
4517
+ stdout,
4518
+ stderr,
4519
+ exitCode: null,
4520
+ timedOut: false,
4521
+ phases
4522
+ });
4523
+ return;
4524
+ }
4525
+ options.signal?.addEventListener("abort", onAbort, { once: true });
4526
+ observe("spawn-called");
4527
+ Promise.all([Promise.resolve(options.invocation), realpath(options.cwd).catch(() => resolve(options.cwd))]).then(([invocation, physicalCwd]) => {
4528
+ if (options.signal?.aborted) {
4529
+ onAbort();
4530
+ finish("close", null);
4531
+ return;
4532
+ }
4533
+ options.onModuleResolved?.(invocation.modulePath);
4534
+ try {
4535
+ worker = new Worker(WORKER_BOOTSTRAP, {
4536
+ env: cleanWorkerEnv(options.env),
4537
+ eval: true,
4538
+ execArgv: [],
4539
+ stderr: true,
4540
+ stdout: true,
4541
+ workerData: {
4542
+ args: invocation.args,
4543
+ cwd: physicalCwd,
4544
+ modulePath: invocation.modulePath
4545
+ }
4546
+ });
4547
+ } catch (error) {
4548
+ workerError = formatSpawnError(error);
4549
+ observe("spawn-error", { reason: "spawn-error" });
4550
+ finish("spawn-error", null);
4551
+ return;
4552
+ }
4553
+ phases.spawnReturnedAt = performance$1.now();
4554
+ observe("spawn-returned");
4555
+ worker.once("online", () => {
4556
+ phases.spawnObservedAt = performance$1.now();
4557
+ observe("spawn-observed");
4558
+ });
4559
+ worker.stdout.on("data", (data) => {
4560
+ if (!phases.firstStdoutAt) {
4561
+ phases.firstStdoutAt = performance$1.now();
4562
+ observe("first-stdout-observed");
4563
+ }
4564
+ stdout += data.toString();
4565
+ if (options.eagerResolveJson && !phases.eagerResolved && stdout.trimStart().startsWith("{")) try {
4566
+ JSON.parse(stdout);
4567
+ phases.eagerResolved = true;
4568
+ phases.jsonCompleteAt = performance$1.now();
4569
+ observe("json-complete-observed");
4570
+ requestTermination("eager-json");
4571
+ } catch {}
4572
+ });
4573
+ worker.stderr.on("data", (data) => {
4574
+ if (!phases.firstStderrAt) {
4575
+ phases.firstStderrAt = performance$1.now();
4576
+ observe("first-stderr-observed");
4577
+ }
4578
+ stderr += data.toString();
4579
+ });
4580
+ worker.on("message", (message) => {
4581
+ if (isOpenSpecWorkerMessage(message)) completedExitCode = message.exitCode;
4582
+ });
4583
+ worker.once("error", (error) => {
4584
+ workerError = formatSpawnError(error);
4585
+ observe("spawn-error", { reason: "spawn-error" });
4586
+ });
4587
+ worker.once("exit", (workerExitCode) => {
4588
+ options.signal?.removeEventListener("abort", onAbort);
4589
+ phases.exitAt = performance$1.now();
4590
+ const exitCode = aborted ? null : phases.eagerResolved ? 0 : completedExitCode ?? workerExitCode;
4591
+ observe("exit-observed", { exitCode });
4592
+ phases.closeAt = performance$1.now();
4593
+ observe("close-observed", { exitCode });
4594
+ if (workerError) finish("spawn-error", null);
4595
+ else finish(phases.eagerResolved ? "eager-json" : "close", exitCode);
4596
+ });
4597
+ }, (error) => {
4598
+ options.signal?.removeEventListener("abort", onAbort);
4599
+ workerError = formatSpawnError(error);
4600
+ observe("spawn-error", { reason: "spawn-error" });
4601
+ finish("spawn-error", null);
4602
+ });
4603
+ });
4604
+ }
4605
+
4126
4606
  //#endregion
4127
4607
  //#region src/cli-executor.ts
4608
+ /**
4609
+ * Orthogonal intents (updated 2026-07-31 Asia/Shanghai):
4610
+ * 1. Execute buffered CLI work through process/Worker backends with runner recovery,
4611
+ * observer-explicit OTel phase evidence, bounded probes, and owner-scoped disposal.
4612
+ * 2. Own streaming CLI processes through cancellation request, escalation, and confirmed settlement.
4613
+ * 3. Retain established init/schema/template and human validate/archive helpers.
4614
+ * 4. Expose the physically separated OpenSpec 1.6 typed command facade.
4615
+ * 5. Clear the Core-owned direct-child slot independently from stream settlement, and keep
4616
+ * response-Span delivery physically separate from late child-process settlement evidence.
4617
+ *
4618
+ * Original request (2026-07-15): "你先负责后端(内核)的开发。"
4619
+ * Original request (2026-07-17): "A stream cancellation request is not child-process settlement."
4620
+ * Built-runtime correction (2026-07-30): foreground Server shutdown must retire buffered projection children and settled probe timers.
4621
+ * Tracing (2026-07-31): each CLI subprocess call is wrapped in an OpenTelemetry span so the Server
4622
+ * `planningRoot.runOperation` breakdown can attribute latency to specific CLI invocations
4623
+ * (doctor / context / list ...). Uses `@opentelemetry/api` only — a no-op tracer is returned when
4624
+ * no SDK is registered, so standalone Core use incurs zero overhead.
4625
+ * Original request (2026-07-31): "这些命令的执行,时间绝对不是七八秒那么久...请看一下代码,看能不能让trace更精确"
4626
+ * Original request (2026-07-31): "终端大量报错,比如: Cannot execute the operation on ended Span"
4627
+ * Original request (2026-07-31): "在主线程,通过 OPENSPEC_SPAWN_MODE=process|worker 来进行区分两种模式。"
4628
+ */
4128
4629
  /** Failure raised when even forced termination cannot confirm child-process close. */
4129
4630
  var CliStreamTerminationError = class extends Error {
4130
4631
  constructor(command) {
@@ -4134,6 +4635,52 @@ var CliStreamTerminationError = class extends Error {
4134
4635
  };
4135
4636
  const STREAM_TERMINATION_GRACE_MS = 1e3;
4136
4637
  const STREAM_FORCE_CLOSE_TIMEOUT_MS = 1e3;
4638
+ const CLI_PHASE_EVENT_SUFFIXES = {
4639
+ "spawn-called": "spawn.called",
4640
+ "spawn-returned": "spawn.returned",
4641
+ "spawn-observed": "spawn.observed",
4642
+ "first-stdout-observed": "stdout.first.observed",
4643
+ "first-stderr-observed": "stderr.first.observed",
4644
+ "json-complete-observed": "json.complete.observed",
4645
+ "termination-requested": "termination.requested",
4646
+ "exit-observed": "exit.observed",
4647
+ "close-observed": "close.observed",
4648
+ "result-resolved": "result.resolved",
4649
+ "spawn-error": "spawn.error"
4650
+ };
4651
+ function roundedMs(value) {
4652
+ return Math.round(value * 1e3) / 1e3;
4653
+ }
4654
+ function phaseEventAttributes(event, spawnCalledAt, attempt) {
4655
+ const attributes = {
4656
+ "cli.attempt": attempt,
4657
+ "cli.phase.elapsed_ms": roundedMs(event.at - spawnCalledAt)
4658
+ };
4659
+ if (event.pid !== void 0) attributes["process.pid"] = event.pid;
4660
+ if (event.exitCode !== void 0 && event.exitCode !== null) attributes["process.exit.code"] = event.exitCode;
4661
+ if (event.signal) attributes["process.exit.signal"] = event.signal;
4662
+ if (event.reason) attributes["cli.phase.reason"] = event.reason;
4663
+ return attributes;
4664
+ }
4665
+ function setObservedDuration(span, key, base, observedAt) {
4666
+ if (observedAt > 0) span.setAttribute(key, roundedMs(observedAt - base));
4667
+ }
4668
+ function executableRealpath(command) {
4669
+ if (!isAbsolute(command)) return null;
4670
+ try {
4671
+ return realpathSync.native(command);
4672
+ } catch {
4673
+ return null;
4674
+ }
4675
+ }
4676
+ function systemLoadAttributes(suffix) {
4677
+ const [oneMinute, fiveMinutes, fifteenMinutes] = loadavg();
4678
+ return {
4679
+ [`system.load.1m.${suffix}`]: oneMinute,
4680
+ [`system.load.5m.${suffix}`]: fiveMinutes,
4681
+ [`system.load.15m.${suffix}`]: fifteenMinutes
4682
+ };
4683
+ }
4137
4684
  function createDeferred() {
4138
4685
  let resolve$1;
4139
4686
  let reject;
@@ -4146,6 +4693,15 @@ function createDeferred() {
4146
4693
  reject
4147
4694
  };
4148
4695
  }
4696
+ function settleWithin(operation, timeout, message) {
4697
+ let timer = null;
4698
+ const timeoutFailure = new Promise((_, reject) => {
4699
+ timer = setTimeout(() => reject(new Error(message)), timeout);
4700
+ });
4701
+ return Promise.race([operation, timeoutFailure]).finally(() => {
4702
+ if (timer) clearTimeout(timer);
4703
+ });
4704
+ }
4149
4705
  /**
4150
4706
  * CLI 执行器
4151
4707
  *
@@ -4154,6 +4710,13 @@ function createDeferred() {
4154
4710
  */
4155
4711
  var CliExecutor = class {
4156
4712
  contracts;
4713
+ bufferedAdmission = new CliBufferedAdmission();
4714
+ bufferedAbortController = new AbortController();
4715
+ activeBufferedCommands = /* @__PURE__ */ new Set();
4716
+ activeBufferedChildren = 0;
4717
+ peakBufferedChildren = 0;
4718
+ disposePromise = null;
4719
+ disposed = false;
4157
4720
  constructor(configManager, projectDir) {
4158
4721
  this.configManager = configManager;
4159
4722
  this.projectDir = projectDir;
@@ -4162,50 +4725,296 @@ var CliExecutor = class {
4162
4725
  async buildCommandArray(args) {
4163
4726
  return [...await this.configManager.getCliCommand(), ...args];
4164
4727
  }
4165
- async runCommandOnce(fullCommand) {
4728
+ async runCommandOnce(fullCommand, traceContext) {
4729
+ if (this.disposed) return {
4730
+ success: false,
4731
+ stdout: "",
4732
+ stderr: "CLI executor is disposed.",
4733
+ exitCode: null,
4734
+ errorCode: "ABORT_ERR"
4735
+ };
4166
4736
  const [cmd, ...cmdArgs] = fullCommand;
4167
- const result = await runBufferedCommand({
4737
+ const isJsonCommand = cmdArgs.includes("--json");
4738
+ const requestedSpawnMode = resolveOpenSpecSpawnMode();
4739
+ let spawnMode = requestedSpawnMode;
4740
+ let workerInvocation = null;
4741
+ let workerFallbackReason = null;
4742
+ if (requestedSpawnMode === "worker") try {
4743
+ workerInvocation = await resolveOpenSpecWorkerInvocation(fullCommand);
4744
+ } catch (error) {
4745
+ if (!(error instanceof OpenSpecCliModuleNotFoundError)) throw error;
4746
+ spawnMode = "process";
4747
+ workerFallbackReason = "module-not-found";
4748
+ traceContext.span.addEvent("cli.worker.fallback", {
4749
+ "cli.worker.fallback.reason": workerFallbackReason,
4750
+ "cli.worker.fallback.message": error.message
4751
+ });
4752
+ }
4753
+ const queuedStats = this.bufferedAdmission.stats();
4754
+ traceContext.span.addEvent("cli.admission.queued", {
4755
+ "cli.concurrent.active": queuedStats.active,
4756
+ "cli.concurrent.waiting": queuedStats.waiting,
4757
+ "cli.concurrent.limit": this.bufferedAdmission.limit
4758
+ });
4759
+ const admission = await this.bufferedAdmission.acquire(this.bufferedAbortController.signal);
4760
+ if (!admission || this.disposed) {
4761
+ admission?.release();
4762
+ traceContext.span.addEvent("cli.admission.cancelled");
4763
+ return {
4764
+ success: false,
4765
+ stdout: "",
4766
+ stderr: "CLI executor is disposed.",
4767
+ exitCode: null,
4768
+ errorCode: "ABORT_ERR"
4769
+ };
4770
+ }
4771
+ this.recordAdmissionEvidence(traceContext.span, admission);
4772
+ traceContext.span.addEvent("cli.admission.acquired", {
4773
+ "cli.concurrent.wait_ms": roundedMs(admission.evidence.waitMs),
4774
+ "cli.concurrent.active_at_enqueue": admission.evidence.activeAtEnqueue,
4775
+ "cli.concurrent.waiting_at_enqueue": admission.evidence.waitingAtEnqueue
4776
+ });
4777
+ traceContext.span.setAttribute("cli.spawn_mode", spawnMode);
4778
+ traceContext.span.setAttribute("cli.spawn_mode.requested", requestedSpawnMode);
4779
+ if (workerFallbackReason) traceContext.span.setAttribute("cli.worker.fallback.reason", workerFallbackReason);
4780
+ const processSpan = trace.getTracer("openspecui-core").startSpan(`cli.${spawnMode} ${traceContext.subcommand}`, { attributes: {
4781
+ "cli.attempt": traceContext.attempt,
4782
+ "cli.cwd": this.projectDir,
4783
+ "cli.executable": cmd,
4784
+ "cli.json": isJsonCommand,
4785
+ "cli.spawn_mode": spawnMode,
4786
+ "cli.spawn_mode.requested": requestedSpawnMode,
4787
+ ...workerFallbackReason ? { "cli.worker.fallback.reason": workerFallbackReason } : {},
4788
+ "cli.concurrent.limit": this.bufferedAdmission.limit,
4789
+ "cli.concurrent.active_at_enqueue": admission.evidence.activeAtEnqueue,
4790
+ "cli.concurrent.waiting_at_enqueue": admission.evidence.waitingAtEnqueue,
4791
+ "cli.concurrent.wait_ms": roundedMs(admission.evidence.waitMs),
4792
+ "process.parent.pid": process.pid,
4793
+ ...systemLoadAttributes("admitted")
4794
+ } }, context.active());
4795
+ const resolvedExecutable = executableRealpath(cmd);
4796
+ if (resolvedExecutable) {
4797
+ processSpan.setAttribute("cli.runner.realpath", resolvedExecutable);
4798
+ traceContext.span.setAttribute("cli.runner.realpath", resolvedExecutable);
4799
+ }
4800
+ let spawnCalledAt = performance$1.now();
4801
+ let childHandleReturned = false;
4802
+ let processCloseObserved = false;
4803
+ let responseDelivered = false;
4804
+ let processSpanEnded = false;
4805
+ let childCounted = false;
4806
+ const executionKind = spawnMode === "process" ? "processes" : "workers";
4807
+ const endProcessSpan = () => {
4808
+ if (processSpanEnded) return;
4809
+ processSpanEnded = true;
4810
+ processSpan.end();
4811
+ };
4812
+ const observePhase = (event) => {
4813
+ if (event.phase === "spawn-called") spawnCalledAt = event.at;
4814
+ if (event.phase === "spawn-returned") {
4815
+ childHandleReturned = true;
4816
+ if (!childCounted) {
4817
+ childCounted = true;
4818
+ this.activeBufferedChildren += 1;
4819
+ this.peakBufferedChildren = Math.max(this.peakBufferedChildren, this.activeBufferedChildren);
4820
+ }
4821
+ }
4822
+ const eventName = `cli.${spawnMode}.${CLI_PHASE_EVENT_SUFFIXES[event.phase]}`;
4823
+ const admissionStats = this.bufferedAdmission.stats();
4824
+ const attributes = {
4825
+ ...phaseEventAttributes(event, spawnCalledAt, traceContext.attempt),
4826
+ "cli.concurrent.active": admissionStats.active,
4827
+ "cli.concurrent.waiting": admissionStats.waiting,
4828
+ "cli.executions.active": this.activeBufferedChildren,
4829
+ "cli.executions.peak": this.peakBufferedChildren,
4830
+ [`cli.${executionKind}.active`]: this.activeBufferedChildren,
4831
+ [`cli.${executionKind}.peak`]: this.peakBufferedChildren
4832
+ };
4833
+ if (event.phase === "spawn-called") Object.assign(attributes, systemLoadAttributes("spawn"));
4834
+ if (event.phase === "first-stdout-observed") Object.assign(attributes, systemLoadAttributes("first_stdout"));
4835
+ if (!responseDelivered) traceContext.span.addEvent(eventName, attributes);
4836
+ processSpan.addEvent(eventName, attributes);
4837
+ if (event.phase === "spawn-returned") {
4838
+ traceContext.span.setAttribute(`cli.${executionKind}.active_at_spawn`, this.activeBufferedChildren);
4839
+ processSpan.setAttribute(`cli.${executionKind}.active_at_spawn`, this.activeBufferedChildren);
4840
+ }
4841
+ if (event.phase === "first-stdout-observed") {
4842
+ traceContext.span.setAttribute(`cli.${executionKind}.active_at_first_stdout`, this.activeBufferedChildren);
4843
+ processSpan.setAttribute(`cli.${executionKind}.active_at_first_stdout`, this.activeBufferedChildren);
4844
+ }
4845
+ if (event.pid !== void 0) processSpan.setAttribute("process.pid", event.pid);
4846
+ if (event.phase === "exit-observed" && event.exitCode !== void 0) processSpan.setAttribute("process.exit.code", event.exitCode ?? -1);
4847
+ if (event.phase === "result-resolved") {
4848
+ responseDelivered = true;
4849
+ processSpan.setAttribute("cli.result.reason", event.reason ?? "unknown");
4850
+ if (!(childHandleReturned && !processCloseObserved && (event.reason === "eager-json" || event.reason === "spawn-error"))) endProcessSpan();
4851
+ }
4852
+ if (event.phase === "close-observed") {
4853
+ processCloseObserved = true;
4854
+ if (childCounted) {
4855
+ childCounted = false;
4856
+ this.activeBufferedChildren -= 1;
4857
+ processSpan.setAttribute(`cli.${executionKind}.active_after_close`, this.activeBufferedChildren);
4858
+ }
4859
+ if (responseDelivered) endProcessSpan();
4860
+ }
4861
+ };
4862
+ const cliEnv = createCleanCliEnv();
4863
+ const command = spawnMode === "worker" && workerInvocation ? runOpenSpecCliWorker({
4864
+ cwd: this.projectDir,
4865
+ env: cliEnv,
4866
+ signal: this.bufferedAbortController.signal,
4867
+ eagerResolveJson: isJsonCommand,
4868
+ invocation: workerInvocation,
4869
+ onModuleResolved: (modulePath) => {
4870
+ processSpan.setAttribute("cli.worker.module", modulePath);
4871
+ traceContext.span.setAttribute("cli.worker.module", modulePath);
4872
+ },
4873
+ onPhase: observePhase
4874
+ }) : runBufferedCommand({
4168
4875
  command: cmd,
4169
4876
  args: cmdArgs,
4170
4877
  cwd: this.projectDir,
4171
- env: createCleanCliEnv()
4878
+ env: cliEnv,
4879
+ signal: this.bufferedAbortController.signal,
4880
+ eagerResolveJson: isJsonCommand,
4881
+ onPhase: observePhase
4882
+ });
4883
+ this.activeBufferedCommands.add(command);
4884
+ const result = await command.finally(() => {
4885
+ this.activeBufferedCommands.delete(command);
4886
+ admission.release();
4172
4887
  });
4173
4888
  if (result.spawnError) return {
4174
4889
  success: false,
4175
4890
  stdout: result.stdout,
4176
4891
  stderr: result.stderr ? `${result.stderr}\n${result.spawnError.message}` : result.spawnError.message,
4177
4892
  exitCode: null,
4178
- errorCode: result.spawnError.code
4893
+ errorCode: result.spawnError.code,
4894
+ phases: result.phases,
4895
+ spawnMode
4179
4896
  };
4180
4897
  return {
4181
4898
  success: result.exitCode === 0,
4182
4899
  stdout: result.stdout,
4183
4900
  stderr: result.stderr,
4184
- exitCode: result.exitCode
4901
+ exitCode: result.exitCode,
4902
+ phases: result.phases,
4903
+ spawnMode
4185
4904
  };
4186
4905
  }
4906
+ recordAdmissionEvidence(span, admission) {
4907
+ span.setAttributes({
4908
+ "cli.cwd": this.projectDir,
4909
+ "cli.concurrent.limit": this.bufferedAdmission.limit,
4910
+ "cli.concurrent.active_at_enqueue": admission.evidence.activeAtEnqueue,
4911
+ "cli.concurrent.waiting_at_enqueue": admission.evidence.waitingAtEnqueue,
4912
+ "cli.concurrent.wait_ms": roundedMs(admission.evidence.waitMs),
4913
+ "process.parent.pid": process.pid,
4914
+ ...systemLoadAttributes("admitted")
4915
+ });
4916
+ }
4187
4917
  async executeInternal(args, allowRetry) {
4918
+ const tracer = trace.getTracer("openspecui-core");
4919
+ const subcommand = args[0] ?? "cli";
4920
+ return tracer.startActiveSpan(`cli.execute ${subcommand}`, async (span) => {
4921
+ const executionStartedAt = performance$1.now();
4922
+ const eventLoopStartedAt = performance$1.eventLoopUtilization();
4923
+ span.setAttribute("cli.args", args.join(" "));
4924
+ try {
4925
+ const result = await this.executeInternalCore(args, allowRetry, span, subcommand);
4926
+ span.setAttribute("cli.exitCode", result.exitCode ?? -1);
4927
+ span.setAttribute("cli.attempts", result.attempts ?? 1);
4928
+ const phases = result.phases;
4929
+ if (phases) {
4930
+ const base = phases.spawnCalledAt;
4931
+ span.setAttribute("cli.eagerResolved", phases.eagerResolved);
4932
+ span.setAttribute("cli.result.reason", phases.resultReason ?? "unknown");
4933
+ setObservedDuration(span, "cli.ms.spawnCall", base, phases.spawnReturnedAt);
4934
+ setObservedDuration(span, "cli.ms.spawnObserved", base, phases.spawnObservedAt);
4935
+ setObservedDuration(span, "cli.ms.firstStdoutObserved", base, phases.firstStdoutAt);
4936
+ setObservedDuration(span, "cli.ms.firstStderrObserved", base, phases.firstStderrAt);
4937
+ setObservedDuration(span, "cli.ms.jsonCompleteObserved", base, phases.jsonCompleteAt);
4938
+ setObservedDuration(span, "cli.ms.terminationRequested", base, phases.terminationRequestedAt);
4939
+ setObservedDuration(span, "cli.ms.resultResolved", base, phases.resultResolvedAt);
4940
+ setObservedDuration(span, "cli.ms.exitObserved", base, phases.exitAt);
4941
+ setObservedDuration(span, "cli.ms.closeObserved", base, phases.closeAt);
4942
+ const spawnMode = result.spawnMode ?? resolveOpenSpecSpawnMode();
4943
+ span.setAttribute(`cli.${spawnMode}.exitObservedBeforeResult`, phases.exitAt > 0 && phases.exitAt <= phases.resultResolvedAt);
4944
+ span.setAttribute(`cli.${spawnMode}.closeObservedBeforeResult`, phases.closeAt > 0 && phases.closeAt <= phases.resultResolvedAt);
4945
+ if (phases.exitAt && phases.closeAt) span.setAttribute("cli.ms.exitToCloseObserved", roundedMs(phases.closeAt - phases.exitAt));
4946
+ }
4947
+ if (!result.success) span.setStatus({
4948
+ code: 2,
4949
+ message: result.stderr || `exit ${result.exitCode}`
4950
+ });
4951
+ return result;
4952
+ } catch (err) {
4953
+ span.recordException(err instanceof Error ? err : String(err));
4954
+ span.setStatus({
4955
+ code: 2,
4956
+ message: err instanceof Error ? err.message : String(err)
4957
+ });
4958
+ throw err;
4959
+ } finally {
4960
+ const eventLoop = performance$1.eventLoopUtilization(eventLoopStartedAt);
4961
+ span.setAttributes({
4962
+ "cli.ms.response": roundedMs(performance$1.now() - executionStartedAt),
4963
+ "cli.event_loop.utilization": eventLoop.utilization,
4964
+ "cli.ms.event_loop_active": roundedMs(eventLoop.active),
4965
+ "cli.ms.event_loop_idle": roundedMs(eventLoop.idle)
4966
+ });
4967
+ span.end();
4968
+ }
4969
+ });
4970
+ }
4971
+ async executeInternalCore(args, allowRetry, span, subcommand, attempt = 1) {
4188
4972
  let fullCommand;
4973
+ const runnerResolveStartedAt = performance$1.now();
4189
4974
  try {
4190
4975
  fullCommand = await this.buildCommandArray(args);
4191
4976
  } catch (err) {
4977
+ span.addEvent("cli.runner.resolve.error", {
4978
+ "cli.attempt": attempt,
4979
+ "cli.ms.runnerResolve": roundedMs(performance$1.now() - runnerResolveStartedAt)
4980
+ });
4192
4981
  return {
4193
4982
  success: false,
4194
4983
  stdout: "",
4195
4984
  stderr: err instanceof Error ? err.message : String(err),
4196
- exitCode: null
4985
+ exitCode: null,
4986
+ attempts: attempt
4197
4987
  };
4198
4988
  }
4199
- const result = await this.runCommandOnce(fullCommand);
4989
+ const runnerResolveMs = roundedMs(performance$1.now() - runnerResolveStartedAt);
4990
+ span.setAttribute("cli.ms.runnerResolve", runnerResolveMs);
4991
+ span.setAttribute("cli.executable", fullCommand[0] ?? "");
4992
+ span.addEvent("cli.runner.resolved", {
4993
+ "cli.attempt": attempt,
4994
+ "cli.ms.runnerResolve": runnerResolveMs,
4995
+ "cli.executable": fullCommand[0] ?? ""
4996
+ });
4997
+ const result = await this.runCommandOnce(fullCommand, {
4998
+ span,
4999
+ attempt,
5000
+ subcommand
5001
+ });
4200
5002
  if (allowRetry && result.errorCode === "ENOENT") {
5003
+ span.addEvent("cli.runner.retry", {
5004
+ "cli.attempt": attempt,
5005
+ "cli.retry.reason": "ENOENT"
5006
+ });
4201
5007
  this.configManager.invalidateResolvedCliRunner();
4202
- return this.executeInternal(args, false);
5008
+ return this.executeInternalCore(args, false, span, subcommand, attempt + 1);
4203
5009
  }
4204
5010
  return {
4205
5011
  success: result.success,
4206
5012
  stdout: result.stdout,
4207
5013
  stderr: result.stderr,
4208
- exitCode: result.exitCode
5014
+ exitCode: result.exitCode,
5015
+ phases: result.phases,
5016
+ spawnMode: result.spawnMode,
5017
+ attempts: attempt
4209
5018
  };
4210
5019
  }
4211
5020
  /**
@@ -4214,6 +5023,15 @@ var CliExecutor = class {
4214
5023
  async execute(args) {
4215
5024
  return this.executeInternal(args, true);
4216
5025
  }
5026
+ /** Cancel and await every buffered CLI child owned by this executor. */
5027
+ dispose() {
5028
+ if (this.disposePromise) return this.disposePromise;
5029
+ this.disposed = true;
5030
+ this.bufferedAbortController.abort();
5031
+ const activeCommands = [...this.activeBufferedCommands];
5032
+ this.disposePromise = Promise.allSettled(activeCommands).then(() => void 0);
5033
+ return this.disposePromise;
5034
+ }
4217
5035
  /**
4218
5036
  * 执行 openspec init(非交互式)
4219
5037
  */
@@ -4289,27 +5107,56 @@ var CliExecutor = class {
4289
5107
  * 检查 CLI 是否可用
4290
5108
  */
4291
5109
  async checkAvailability(timeout = 1e4) {
4292
- try {
4293
- const resolved = await Promise.race([this.configManager.getResolvedCliRunner(), new Promise((_, reject) => setTimeout(() => reject(/* @__PURE__ */ new Error("CLI runner resolve timed out")), timeout))]);
4294
- const versionResult = await Promise.race([this.runCommandOnce([...resolved.commandParts, "--version"]), new Promise((_, reject) => setTimeout(() => reject(/* @__PURE__ */ new Error("CLI check timed out")), timeout))]);
4295
- if (versionResult.success) return {
4296
- available: true,
4297
- version: versionResult.stdout.trim() || resolved.version,
4298
- effectiveCommand: resolved.command,
4299
- tried: resolved.attempts.map((attempt) => attempt.command)
4300
- };
4301
- return {
4302
- available: false,
4303
- error: versionResult.stderr || "Unknown error",
4304
- effectiveCommand: resolved.command,
4305
- tried: resolved.attempts.map((attempt) => attempt.command)
4306
- };
4307
- } catch (err) {
4308
- return {
4309
- available: false,
4310
- error: err instanceof Error ? err.message : String(err)
4311
- };
4312
- }
5110
+ return trace.getTracer("openspecui-core").startActiveSpan("cli.checkAvailability", async (span) => {
5111
+ const checkStartedAt = performance$1.now();
5112
+ const eventLoopStartedAt = performance$1.eventLoopUtilization();
5113
+ try {
5114
+ const runnerResolveStartedAt = performance$1.now();
5115
+ const resolved = await settleWithin(this.configManager.getResolvedCliRunner(), timeout, "CLI runner resolve timed out");
5116
+ const runnerResolveMs = roundedMs(performance$1.now() - runnerResolveStartedAt);
5117
+ span.setAttribute("cli.triedCount", resolved.attempts.length);
5118
+ span.setAttribute("cli.ms.runnerResolve", runnerResolveMs);
5119
+ span.setAttribute("cli.executable", resolved.commandParts[0] ?? "");
5120
+ span.addEvent("cli.runner.resolved", {
5121
+ "cli.ms.runnerResolve": runnerResolveMs,
5122
+ "cli.executable": resolved.commandParts[0] ?? "",
5123
+ "cli.runner.attempts": resolved.attempts.length
5124
+ });
5125
+ const versionResult = await settleWithin(this.runCommandOnce([...resolved.commandParts, "--version"], {
5126
+ span,
5127
+ attempt: 1,
5128
+ subcommand: "check-availability"
5129
+ }), timeout, "CLI check timed out");
5130
+ span.setAttribute("cli.available", versionResult.success);
5131
+ if (versionResult.success) return {
5132
+ available: true,
5133
+ version: versionResult.stdout.trim() || resolved.version,
5134
+ effectiveCommand: resolved.command,
5135
+ tried: resolved.attempts.map((attempt) => attempt.command)
5136
+ };
5137
+ return {
5138
+ available: false,
5139
+ error: versionResult.stderr || "Unknown error",
5140
+ effectiveCommand: resolved.command,
5141
+ tried: resolved.attempts.map((attempt) => attempt.command)
5142
+ };
5143
+ } catch (err) {
5144
+ span.setAttribute("cli.available", false);
5145
+ return {
5146
+ available: false,
5147
+ error: err instanceof Error ? err.message : String(err)
5148
+ };
5149
+ } finally {
5150
+ const eventLoop = performance$1.eventLoopUtilization(eventLoopStartedAt);
5151
+ span.setAttributes({
5152
+ "cli.ms.response": roundedMs(performance$1.now() - checkStartedAt),
5153
+ "cli.event_loop.utilization": eventLoop.utilization,
5154
+ "cli.ms.event_loop_active": roundedMs(eventLoop.active),
5155
+ "cli.ms.event_loop_idle": roundedMs(eventLoop.idle)
5156
+ });
5157
+ span.end();
5158
+ }
5159
+ });
4313
5160
  }
4314
5161
  /**
4315
5162
  * 流式执行 CLI 命令
@@ -4776,9 +5623,9 @@ function publicCommandEvidence(evidence) {
4776
5623
  ...evidence.contractError ? { contractError: evidence.contractError } : {}
4777
5624
  };
4778
5625
  }
4779
- function createRootContext(options, cli, doctor, context, observedAt) {
5626
+ function createRootContext(options, cli, doctor, context$1, observedAt) {
4780
5627
  const doctorData = doctor?.data ?? null;
4781
- const contextData = context?.data ?? null;
5628
+ const contextData = context$1?.data ?? null;
4782
5629
  const planningRoot = doctorData?.root ?? null;
4783
5630
  return {
4784
5631
  launchProject: {
@@ -4794,11 +5641,11 @@ function createRootContext(options, cli, doctor, context, observedAt) {
4794
5641
  diagnostics: {
4795
5642
  root: planningRoot?.status ?? [],
4796
5643
  doctor: doctorData?.status ?? doctor?.diagnostics ?? [],
4797
- context: contextData?.status ?? context?.diagnostics ?? []
5644
+ context: contextData?.status ?? context$1?.diagnostics ?? []
4798
5645
  },
4799
5646
  evidence: {
4800
5647
  doctor: publicCommandEvidence(doctor),
4801
- context: publicCommandEvidence(context)
5648
+ context: publicCommandEvidence(context$1)
4802
5649
  },
4803
5650
  observedAt
4804
5651
  };
@@ -4815,10 +5662,10 @@ function errorState(attempt, code, message) {
4815
5662
  observedAt: attempt.observedAt
4816
5663
  };
4817
5664
  }
4818
- function rootsMatch(doctor, context) {
4819
- return doctor.path === context.path && doctor.source === context.source && (doctor.store_id === void 0 || context.store_id === void 0 || doctor.store_id === context.store_id);
5665
+ function rootsMatch(doctor, context$1) {
5666
+ return doctor.path === context$1.path && doctor.source === context$1.source && (doctor.store_id === void 0 || context$1.store_id === void 0 || doctor.store_id === context$1.store_id);
4820
5667
  }
4821
- function classifyRootContext(attempt, doctor, context) {
5668
+ function classifyRootContext(attempt, doctor, context$1) {
4822
5669
  const { cli, planningRoot, references } = attempt;
4823
5670
  if (!cli.available) return errorState(attempt, "cli-unavailable", cli.error ?? "OpenSpec CLI is unavailable.");
4824
5671
  if (!doctor) return errorState(attempt, "resolver-failed", "OpenSpec Doctor did not return command evidence.");
@@ -4826,10 +5673,10 @@ function classifyRootContext(attempt, doctor, context) {
4826
5673
  if (!doctor.success) return errorState(attempt, "doctor-command-failed", commandMessage(doctor, "OpenSpec Doctor failed."));
4827
5674
  if (!planningRoot) return errorState(attempt, "root-unresolved", "OpenSpec Doctor did not resolve a planning root.");
4828
5675
  if (!planningRoot.healthy) return errorState(attempt, "root-unhealthy", planningRoot.status.map((diagnostic) => diagnostic.message).join("\n") || "OpenSpec Doctor reported an unhealthy planning root.");
4829
- if (!context) return errorState(attempt, "resolver-failed", "OpenSpec Context did not return command evidence.");
4830
- if (context.contractError) return errorState(attempt, "context-contract-drift", commandMessage(context, "OpenSpec Context returned an incompatible payload."));
4831
- if (!context.success) return errorState(attempt, "context-command-failed", commandMessage(context, "OpenSpec Context failed."));
4832
- if (!context.data?.root || !rootsMatch(planningRoot, context.data.root)) return errorState(attempt, "context-root-mismatch", "OpenSpec Doctor and Context did not report the same planning root.");
5676
+ if (!context$1) return errorState(attempt, "resolver-failed", "OpenSpec Context did not return command evidence.");
5677
+ if (context$1.contractError) return errorState(attempt, "context-contract-drift", commandMessage(context$1, "OpenSpec Context returned an incompatible payload."));
5678
+ if (!context$1.success) return errorState(attempt, "context-command-failed", commandMessage(context$1, "OpenSpec Context failed."));
5679
+ if (!context$1.data?.root || !rootsMatch(planningRoot, context$1.data.root)) return errorState(attempt, "context-root-mismatch", "OpenSpec Doctor and Context did not report the same planning root.");
4833
5680
  const failedReference = references.flatMap((reference) => reference.status).find((diagnostic) => diagnostic.severity === "error");
4834
5681
  if (failedReference) return errorState(attempt, "references-unresolved", failedReference.message);
4835
5682
  return {
@@ -4859,15 +5706,15 @@ async function resolveRootContext(options) {
4859
5706
  const selector = {};
4860
5707
  const [doctorSettled, contextSettled] = await Promise.allSettled([options.cliExecutor.contracts.doctorRoot(selector), options.cliExecutor.contracts.context(selector)]);
4861
5708
  const doctor = doctorSettled.status === "fulfilled" ? doctorSettled.value : null;
4862
- const context = contextSettled.status === "fulfilled" ? contextSettled.value : null;
4863
- const attempt = createRootContext(options, cli, doctor, context, observedAt);
5709
+ const context$1 = contextSettled.status === "fulfilled" ? contextSettled.value : null;
5710
+ const attempt = createRootContext(options, cli, doctor, context$1, observedAt);
4864
5711
  if (doctorSettled.status === "rejected" || contextSettled.status === "rejected") {
4865
5712
  let failure;
4866
5713
  if (doctorSettled.status === "rejected") failure = doctorSettled.reason;
4867
5714
  else if (contextSettled.status === "rejected") failure = contextSettled.reason;
4868
5715
  return errorState(attempt, "resolver-failed", failure instanceof Error ? failure.message : String(failure));
4869
5716
  }
4870
- return classifyRootContext(attempt, doctor, context);
5717
+ return classifyRootContext(attempt, doctor, context$1);
4871
5718
  }
4872
5719
 
4873
5720
  //#endregion
@@ -5627,10 +6474,26 @@ function snapshotHasAbsolutePath(snapshot) {
5627
6474
  return /\b(?:\/[\w.\-@]+){2,}/.test(text) || /[A-Za-z]:\//.test(text);
5628
6475
  }
5629
6476
 
6477
+ //#endregion
6478
+ //#region src/cli-projection-sequence.ts
6479
+ /**
6480
+ * Orthogonal intents (created 2026-07-31 Asia/Shanghai):
6481
+ * 1. Submit aggregate CLI projection entities lazily while preserving source order.
6482
+ * 2. Prevent one aggregate read from pre-filling the shared buffered CLI admission queue.
6483
+ *
6484
+ * Original request (2026-07-31): "系统性地进行修复,因为List页面也有类似的问题。所有可能其它页面都有类似的问题。"
6485
+ */
6486
+ /** Map CLI-backed projection entities in order, admitting only the current entity. */
6487
+ async function mapCliProjectionSeries(inputs, project) {
6488
+ const outputs = [];
6489
+ for (const [index, input] of inputs.entries()) outputs.push(await project(input, index));
6490
+ return outputs;
6491
+ }
6492
+
5630
6493
  //#endregion
5631
6494
  //#region src/opsx-kernel.ts
5632
6495
  /**
5633
- * Orthogonal intents (updated 2026-07-27 Asia/Shanghai):
6496
+ * Orthogonal intents (updated 2026-07-31 Asia/Shanghai):
5634
6497
  * 1. Maintain reactive CLI-backed projections and their direct typed Projection Work readers.
5635
6498
  * 2. Share and release per-entity streams through one planning-root kernel lifecycle.
5636
6499
  * 3. Keep OpenSpec configuration ownership outside the workflow projection cache.
@@ -5640,6 +6503,7 @@ function snapshotHasAbsolutePath(snapshot) {
5640
6503
  * Original request (2026-07-15): "Planning-root adapters and services consume the CLI-resolved root."
5641
6504
  * Original request (2026-07-23): "OPSX Status 不应等待完整 Kernel warmup,且必须保留 CLI evidence。"
5642
6505
  * Original request (2026-07-26): "展开全面的接口升级和内核升级和测试升级。"
6506
+ * Original request (2026-07-31): "系统性地进行修复,因为List页面也有类似的问题。所有可能其它页面都有类似的问题。"
5643
6507
  */
5644
6508
  function toRelativePath(root, absolutePath) {
5645
6509
  return relative(root, absolutePath).split(sep).join("/");
@@ -5913,6 +6777,15 @@ var OpsxKernel = class {
5913
6777
  if (!state) throw new Error(`Schema yaml not found for "${name}"`);
5914
6778
  return state.get();
5915
6779
  }
6780
+ /** Non-throwing schema detail read; returns null when the schema is not yet loaded. */
6781
+ tryGetSchemaDetail(name) {
6782
+ return this.peekSchemaDetail(name);
6783
+ }
6784
+ /** Non-throwing schema yaml read; returns null when the schema is not yet loaded. */
6785
+ tryGetSchemaYaml(name) {
6786
+ const state = this._schemaYamls.get(name);
6787
+ return state ? state.get() : null;
6788
+ }
5916
6789
  getChangeMetadata(changeId) {
5917
6790
  const state = this._changeMetadata.get(changeId);
5918
6791
  if (!state) return null;
@@ -5932,11 +6805,11 @@ var OpsxKernel = class {
5932
6805
  }
5933
6806
  startStream(state, task, signal) {
5934
6807
  return new Promise((resolve$1, reject) => {
5935
- const context = new ReactiveContext();
6808
+ const context$1 = new ReactiveContext();
5936
6809
  let first = true;
5937
6810
  (async () => {
5938
6811
  try {
5939
- for await (const data of context.stream(task, signal)) {
6812
+ for await (const data of context$1.stream(task, signal)) {
5940
6813
  state.set(data);
5941
6814
  if (first) {
5942
6815
  first = false;
@@ -6018,11 +6891,11 @@ var OpsxKernel = class {
6018
6891
  }));
6019
6892
  }
6020
6893
  watchSchemaChanges(signal) {
6021
- const context = new ReactiveContext();
6894
+ const context$1 = new ReactiveContext();
6022
6895
  (async () => {
6023
6896
  let prevNames = new Set(this._schemas.get().map((s) => s.name));
6024
6897
  try {
6025
- for await (const schemas of context.stream(() => Promise.resolve(this._schemas.get()), signal)) {
6898
+ for await (const schemas of context$1.stream(() => Promise.resolve(this._schemas.get()), signal)) {
6026
6899
  const newNames = new Set(schemas.map((s) => s.name));
6027
6900
  for (const name of newNames) if (!prevNames.has(name)) this.warmupSchema(name, signal).catch(() => {});
6028
6901
  for (const name of prevNames) if (!newNames.has(name)) {
@@ -6041,11 +6914,11 @@ var OpsxKernel = class {
6041
6914
  })();
6042
6915
  }
6043
6916
  watchChangeIdChanges(signal) {
6044
- const context = new ReactiveContext();
6917
+ const context$1 = new ReactiveContext();
6045
6918
  (async () => {
6046
6919
  let prevIds = new Set(this._changeIds.get());
6047
6920
  try {
6048
- for await (const ids of context.stream(() => Promise.resolve(this._changeIds.get()), signal)) {
6921
+ for await (const ids of context$1.stream(() => Promise.resolve(this._changeIds.get()), signal)) {
6049
6922
  const newIds = new Set(ids);
6050
6923
  for (const id of newIds) if (!prevIds.has(id)) this.warmupChange(id, signal).catch(() => {});
6051
6924
  for (const id of prevIds) if (!newIds.has(id)) {
@@ -6153,7 +7026,7 @@ var OpsxKernel = class {
6153
7026
  async fetchStatusList() {
6154
7027
  await this.ensureChangeIds();
6155
7028
  const changeIds = this._changeIds.get();
6156
- await Promise.all(changeIds.map((id) => this.ensureStatus(id)));
7029
+ await mapCliProjectionSeries(changeIds, (id) => this.ensureStatus(id));
6157
7030
  return changeIds.map((id) => this.getStatus(id));
6158
7031
  }
6159
7032
  async fetchInstructions(changeId, artifact, schema) {
@@ -6294,7 +7167,7 @@ var OpsxKernel = class {
6294
7167
  async readStatusListProjection() {
6295
7168
  const changeList = await this.fetchChangeListProjection();
6296
7169
  return {
6297
- value: await Promise.all(changeList.value.map((changeId) => this.fetchStatus(changeId))),
7170
+ value: await mapCliProjectionSeries(changeList.value, (changeId) => this.fetchStatus(changeId)),
6298
7171
  evidence: changeList.evidence
6299
7172
  };
6300
7173
  }
@@ -6309,14 +7182,14 @@ var OpsxKernel = class {
6309
7182
  /** Execute the aggregate Schema bundle while retaining exact resolved-file dependencies. */
6310
7183
  async readConfigBundleProjection() {
6311
7184
  const schemasProjection = await this.fetchSchemasProjection();
6312
- const details = await Promise.all(schemasProjection.value.map(async ({ name }) => {
7185
+ const details = await mapCliProjectionSeries(schemasProjection.value, async ({ name }) => {
6313
7186
  const resolution = await this.fetchSchemaResolutionProjection(name);
6314
7187
  return {
6315
7188
  name,
6316
7189
  detail: await this.fetchSchemaDetailAtResolution(name, resolution.value).catch(() => null),
6317
7190
  resolution
6318
7191
  };
6319
- }));
7192
+ });
6320
7193
  return {
6321
7194
  value: {
6322
7195
  schemas: schemasProjection.value,
@@ -6628,4 +7501,4 @@ const PtyServerMessageSchema = z.discriminatedUnion("type", [
6628
7501
  ]);
6629
7502
 
6630
7503
  //#endregion
6631
- export { ACCESS_GATE_CREDENTIAL_BYTES, AI_TOOLS, ApplyInstructionsContextFilesSchema, ApplyInstructionsProjectionSchema, ApplyInstructionsSchema, ApplyTaskSchema, ArtifactInstructionsSchema, ArtifactStatusSchema, BUILTIN_SOUND_IDS, BUILTIN_SOUND_OPTIONS, BUILTIN_TERMINAL_SPAWN_COMMANDS, BatchTranslateEventSchema, BatchTranslateInputSchema, BuiltinSoundIdSchema, CODE_EDITOR_THEME_VALUES, CUSTOM_SOUND_ADD_VALUE, ChangeFileSchema, ChangeSchema, ChangeStatusSchema, CliApplyInstructionsSchema, CliArchiveSchema, CliArtifactInstructionsSchema, CliChangeListSchema, CliContextSchema, CliDiagnosticFailureSchema, CliDiagnosticSchema, CliDoctorReferenceEntrySchema, CliDoctorSchema, CliExecutor, CliJsonValueSchema, CliProjectionCommandError, CliProjectionCommandEvidenceSchema, CliProjectionFailureSchema, CliProjectionInvalidationCauseSchema, CliProjectionNoticeSchema, CliProjectionStateNameSchema, CliReferenceIndexEntrySchema, CliRootSchema, CliRootSourceSchema, CliShowSpecDocumentSchema, CliShowSpecSchema, CliSpecListSchema, CliStoreCleanupSchema, CliStoreDoctorEntrySchema, CliStoreDoctorSchema, CliStoreListSchema, CliStoreMutationSchema, CliStoreSchema, CliStreamTerminationError, CliValidateSchema, CliWorkflowStatusSchema, CodeEditorThemeSchema, ConfigManager, CustomSoundHashSchema, CustomSoundIdSchema, CustomSoundMetadataFileSchema, CustomSoundMetadataSchema, DASHBOARD_METRIC_KEYS, DEFAULT_BELL_SOUND_ID, DEFAULT_CONFIG, DEFAULT_GIT_DIFF_EAGER_LINE_BUDGET, DEFAULT_GLOBAL_SETTINGS, DEFAULT_NOTIFICATION_SOUND_ID, DEFAULT_TERMINAL_DARK_THEME, DEFAULT_TERMINAL_LIGHT_THEME, DEFAULT_TERMINAL_THEME_MODE, DEFAULT_TRANSLATION_CACHE_ENTRY_LIMIT, DEFAULT_TRANSLATION_ENGINE_ID, DOCUMENT_TRANSLATION_DISPLAY_MODES, DashboardConfigSchema, DashboardGitSnapshotSchema, DashboardOverviewSchema, DashboardSummaryIdentitySchema, DashboardSummaryInvalidationCauseSchema, DashboardSummaryInvalidationSchema, DashboardSummaryProjectionSchema, DashboardSummaryProjectionStateSchema, DashboardTrendsProjectionSchema, DeltaOperationType, DeltaSchema, DeltaSpecSchema, DependencyInfoSchema, DocumentTranslationConfigSchema, DocumentTranslationConfigUpdateSchema, DocumentTranslationDisplayModeSchema, DocumentTranslationGlobalSettingsUpdateSchema, EnvironmentGlobalConfigValueSchema, EnvironmentGlobalFileProjectionDataSchema, EnvironmentGlobalFileProjectionStateSchema, EnvironmentGlobalProjectionDataSchema, EnvironmentGlobalProjectionStateSchema, FILE_PREVIEW_KINDS, GitConfigSchema, GlobalSettingsManager, HOSTED_SHELL_PROTOCOL_VERSION, LEGACY_SOUND_ID_MAP, LOCAL_MODEL_PROFILE_DEFINITIONS, LocalModelAssetLogSchema, LocalModelAssetPlanSnapshotSchema, LocalModelAssetStateSchema, LocalModelDownloadStatusSchema, LocalModelLifecycleFileStateSchema, LocalModelLifecycleGroupStateSchema, LocalModelProfileLoadStateSchema, LocalModelProfileManifestFileSchema, LocalModelProfileManifestGroupSchema, LocalModelProfileManifestSchema, LocalModelProfileStatusSchema, MAX_TRANSLATION_CACHE_ENTRY_LIMIT, MIN_TRANSLATION_CACHE_ENTRY_LIMIT, ManagedLocalCatalogSourceSchema, MarkdownParser, MarkdownReadingPluginRegistry, NOTIFICATION_SOUND_OPTIONS, NOTIFICATION_SOUND_VALUES, NotificationActionSchema, NotificationGroupKeySchema, NotificationPublishInputSchema, NotificationRecordSchema, NotificationSettingsSchema, NotificationSoundSchema, NotificationSourceSchema, OFFICIAL_APP_BASE_URL, OPENSPECUI_DOCUMENT_HOOK_VERSION, OPENSPECUI_RUNTIME_CAPABILITIES, OPENSPECUI_WORKFLOW_HOOK_VERSION, OPEN_SPEC_DATA_DIRECTORY_NAME, OPEN_SPEC_DATA_HOME_OBSERVATION_TARGETS, OPEN_SPEC_READING_SECTIONS_PROJECTION_ID, OPEN_SPEC_SPEC_PROJECTION_ID, OPSX_AGENT_INVOCATION_MODE_VALUES, OPSX_ALL_WORKFLOWS, OPSX_ARTIFACT_INPUT_ACTIONS, OPSX_CHANGE_INPUT_ACTIONS, OPSX_COMMAND_CAPABLE_WORKFLOWS, OPSX_CORE_PROFILE_WORKFLOWS, OPSX_TEXT_INPUT_ACTIONS, OPSX_WORKFLOW_LABELS, OPSX_WORKFLOW_TO_SKILL_DIR, OPSX_WORKFLOW_TO_SKILL_DIR as TOOL_WORKFLOW_TO_SKILL_DIR, OpenSpecAdapter, OpenSpecCliContractExecutor, OpenSpecDataHomeObserver, OpenSpecUIConfigSchema, OpenSpecUIGlobalSettingsSchema, OpenSpecUIGlobalSettingsUpdateSchema, OpenSpecWatcher, OpsxAgentInvocationModeSchema, OpsxCliEvidenceSchema, OpsxConfigBundleSchema, OpsxConfigSchema, OpsxKernel, OpsxStatusEvidenceSchema, OwnedSpecIdentitySchema, PlanningCliProjectionDataSchema, PlanningCliProjectionSelectorSchema, PlanningCliProjectionStateSchema, PlanningConfigJsonValueSchema, PlanningConfigReferenceSchema, ProjectBindingUpdateSchema, ProjectWatcher, PtyAttachMessageSchema, PtyBellResponseSchema, PtyBufferResponseSchema, PtyClientMessageSchema, PtyCloseMessageSchema, PtyCreateMessageSchema, PtyCreatedResponseSchema, PtyErrorCodeSchema, PtyErrorResponseSchema, PtyExitResponseSchema, PtyInputMessageSchema, PtyListMessageSchema, PtyListResponseSchema, PtyOutputResponseSchema, PtyPlatformSchema, PtyProcessTitleResponseSchema, PtyResizeMessageSchema, PtyServerMessageSchema, PtyTitleResponseSchema, RUNTIME_INVALIDATION_FACETS, ReactiveContext, ReactiveObservationEnvironment, ReactiveState, ReferencedSpecIdentitySchema, RequirementSchema, RuntimeInvalidationIndex, RuntimeRootInvalidationRegistry, SERVICE_TRANSLATION_ENGINE_IDS, SILENT_SOUND_ID, ScenarioStepKeywordSchema, ScenarioStepSchema, SchemaArtifactSchema, SchemaDetailSchema, SchemaInfoSchema, SchemaResolutionSchema, ServiceTranslationEngineIdSchema, SoundConfigIdSchema, SoundIdSchema, SpecCatalogSchema, SpecCommandEvidenceSchema, SpecDocumentProjectionSchema, SpecIdentitySchema, SpecSchema, StoreDoctorResultSchema, StoreListResultSchema, StoreMutationLifecycleEventSchema, StoreMutationResultSchema, StoreMutationSchema, StoreMutationStartResponseSchema, TERMINAL_BELL_SOUND_OPTIONS, TERMINAL_BELL_SOUND_VALUES, TERMINAL_COMMAND_FIELD_TYPE_VALUES, TERMINAL_SHELL_QUOTE_STYLE_VALUES, TERMINAL_THEME_MODE_VALUES, TERMINAL_THEME_VALUES, TRANSLATION_CACHE_POLICY_VERSION, TRANSLATION_ENGINE_IDS, TRANSLATION_ENGINE_MANIFESTS, TRANSLATOR_CONTRACT_VERSION, TaskSchema, TemplateContentMapSchema, TemplateContentSchema, TemplatesSchema, TerminalBellSoundSchema, TerminalCommandFieldSchema, TerminalConfigSchema, TerminalControlParser, TerminalCwdTargetSchema, TerminalInvocationSettingsSchema, TerminalNotificationParser, TerminalRendererEngineSchema, TerminalShellProfileSchema, TerminalShellQuoteStyleSchema, TerminalSpawnCommandSchema, TerminalThemeModeSchema, TerminalThemeSchema, TrackedTaskProgressSchema, TranslationCacheEntrySchema, TranslationCacheReadInputSchema, TranslationCacheSettingsSchema, TranslationCacheSettingsUpdateSchema, TranslationCacheStatsSchema, TranslationCacheWriteInputSchema, TranslationDownloadFilePlanSchema, TranslationDownloadGroupPlanSchema, TranslationEngineAssetStateSchema, TranslationEngineAssetStatusSchema, TranslationEngineDependencyStateSchema, TranslationEngineDependencyStatusSchema, TranslationEngineGlobalSettingsSchema, TranslationEngineGlobalSettingsUpdateSchema, TranslationEngineIdSchema, TranslationEngineInstallLogEventSchema, TranslationEngineInstallLogStreamSchema, TranslationEngineLifecycleEventSchema, TranslationEngineLifecycleStatusSchema, TranslationEngineProjectSettingsSchema, TranslationEngineProjectSettingsUpdateSchema, TranslationEngineRuntimeStateSchema, TranslationEngineRuntimeStatusSchema, TranslationLocalCt2SettingsSchema, TranslationLocalCt2SettingsUpdateSchema, TranslationLocalLlamaSettingsSchema, TranslationLocalLlamaSettingsUpdateSchema, TranslationLocalSettingsSchema, TranslationLocalSettingsUpdateSchema, TranslationOpenAISettingsSchema, TranslationOpenAISettingsUpdateSchema, VIRTUAL_PROJECT_DIRNAME, Validator, accessGateFingerprint, acquireWatcher, acquireWatcherRoot, annotateOpenSpecFacts, annotateOpenSpecMarkdown, asEnvUri, buildBackendHealthPayload, buildCliRunnerCandidates, buildEmbeddedUiLaunchUrl, buildHostedLaunchUrl, buildLocalDownloadPlanFromRepositoryFiles, buildLocalDownloadPlanFromRuntimeProfileFiles, buildMarkdownParentMap, buildOpsxEntityDetail, buildRuntimePackageInstallCommand, buildSpecCatalog, builtinOpenSpecReadingPlugin, checkLocalDirectionalModelLanguagePair, classifyStoreCliResult, clearCache, cliProjectionStates, closeAllProjectWatchers, closeAllWatchers, computeEnvUri, constantTimeEqual, contextStorage, createApplyInstructionProgress, createCleanCliEnv, createCliProjectionStateSchema, createDocumentChecklistSummary, createFileChangeObservable, createMarkdownReadingDocument, createMarkdownReadingDocumentFromFacts, createOpenSpecReadingPlugin, createPhysicalReactiveDirectory, createStaticSpecCatalogOwnedProjection, createStaticSpecCatalogReferenceProjection, createStaticSpecCatalogReferenceSource, createToolInitStateProjection, createTrackedTaskProgress, createTranslationEngineLifecycleStatus, customHashFromSoundId, deriveTrackedTaskPhase, detectRuntimePackageManager, generateAccessGateCredential, getActiveWatcherCount, getAllToolIds, getAllTools, getAvailableToolIds, getAvailableTools, getBuiltinSoundUrl, getCacheSize, getConfiguredTools, getDefaultCliCommand, getDefaultCliCommandString, getDefaultGlobalSettingsPath, getDetectedProjectTools, getExternalCodexCommandObservationRoot, getManagedLocalTranslationEngineManifest, getMarkdownAnnotation, getMarkdownAnnotationsForFact, getMarkdownFactSpan, getMarkdownHeadingEnd, getMarkdownHeadingFacts, getNotificationGroupKey, getNotificationGroupLabel, getOpenSpecAnnotation, getOpenSpecAnnotationsForFact, getOpenSpecProjectionAnnotation, getOpenSpecReadingSections, getOpsxEntityMetadataPath, getOpsxEntityRootRelativePath, getProjectWatcher, getRootContextCliSelector, getSpecCatalogEntry, getTerminalCommandDefaultValues, getToolById, getToolInitStates, getTranslationEngineLifecycleMessage, getTranslationEngineManifest, getWatcherRuntimeStatus, groupNotifications, hasCapability, inferFileMime, inferFilePreviewKind, inferLocalDirectionalModelLanguagePair, inspectProjectBinding, isBackendHealthRuntimeMetadata, isBatchTranslationAbort, isDirectionalManagedLocalTranslationEngineId, isGlobPattern, isHostedBackendHealthResponse, isManagedLocalTranslationEngineId, isMarkdownTaskSourcePath, isOpsxCoreWorkflowSelection, isOpsxGlobPattern, isPreviewableFile, isReferencedSpecIdentity, isSupportedEmbeddedUiUrl, isTerminalMutationStatus, isTerminalRendererEngine, isTextLikeFile, isTextLikeMime, isToolConfigured, isTranslationEngineDependencyReady, isTranslationEngineRuntimeReady, isWatcherPoolInitialized, mergeSpecCatalog, normalizeAccessGatePassword, normalizeBatchTranslationError, normalizeEmbeddedUiUrl, normalizeHostedAppBaseUrl, normalizeLegacySoundId, normalizeOpsxEntityPath, openSpecAnnotationRules, opsxGlobToRegex, opsxPathMatchesPattern, parseCliCommand, parseCliCommandResult, parseMarkdownFacts, parseMarkdownTasks, parseOpenSpecMarkdownToSpec, parseOpsxEntityMetadata, parseOpsxSchemaDetail, projectAnnotatedOpenSpecToSpec, projectOpenSpecMarkdown, projectTaskProjectionsFromMarkdownFiles, quoteTerminalShellArg, reactiveExists, reactiveReadDir, reactiveReadFile, reactiveStat, redactSnapshotForPublication, removePhysicalReactivePath, renderTerminalCommandArgs, renderTerminalSpawnCommandLine, requireCanonicalOpenSpecEntityId, requireOpenSpecEntityRelativePath, resolveHostedAppBaseUrl, resolveOpenSpecDataScope, resolveRootContext, resolveRuntimePackageInstallStrategy, resolveTerminalShellDefaults, runControlledTranslationTask, runPhysicalReactivePathMutation, selectLocalDownloadGroup, shouldShowTranslationEngineInstallGate, snapshotHasAbsolutePath, sniffGlobalCli, sortMarkdownReadingPlugins, soundIdFromCustomHash, specIdentityFromRoute, specIdentityKey, specRoutePath, subscribeWatcherRuntimeStatus, terminalNotificationEventToPublishInput, toCliProjectionCommandEvidence, toCliProjectionFailure, toCliProjectionNotice, toMarkdownFactKind, toOpsxDisplayPath, toPersistedGlobalSettings, toStoreFeatureResult, toggleMarkdownTask, trimMarkdownSlice, updateProjectBindingContent, updateReactiveFileCache, writePhysicalReactiveFile };
7504
+ export { ACCESS_GATE_CREDENTIAL_BYTES, AI_TOOLS, ApplyInstructionsContextFilesSchema, ApplyInstructionsProjectionSchema, ApplyInstructionsSchema, ApplyTaskSchema, ArtifactInstructionsSchema, ArtifactStatusSchema, BUILTIN_SOUND_IDS, BUILTIN_SOUND_OPTIONS, BUILTIN_TERMINAL_SPAWN_COMMANDS, BatchTranslateEventSchema, BatchTranslateInputSchema, BuiltinSoundIdSchema, CODE_EDITOR_THEME_VALUES, CUSTOM_SOUND_ADD_VALUE, ChangeFileSchema, ChangeSchema, ChangeStatusSchema, CliApplyInstructionsSchema, CliArchiveSchema, CliArtifactInstructionsSchema, CliChangeListSchema, CliContextSchema, CliDiagnosticFailureSchema, CliDiagnosticSchema, CliDoctorReferenceEntrySchema, CliDoctorSchema, CliExecutor, CliJsonValueSchema, CliProjectionCommandError, CliProjectionCommandEvidenceSchema, CliProjectionFailureSchema, CliProjectionInvalidationCauseSchema, CliProjectionNoticeSchema, CliProjectionStateNameSchema, CliReferenceIndexEntrySchema, CliRootSchema, CliRootSourceSchema, CliShowSpecDocumentSchema, CliShowSpecSchema, CliSpecListSchema, CliStoreCleanupSchema, CliStoreDoctorEntrySchema, CliStoreDoctorSchema, CliStoreListSchema, CliStoreMutationSchema, CliStoreSchema, CliStreamTerminationError, CliValidateSchema, CliWorkflowStatusSchema, CodeEditorThemeSchema, ConfigManager, CustomSoundHashSchema, CustomSoundIdSchema, CustomSoundMetadataFileSchema, CustomSoundMetadataSchema, DASHBOARD_METRIC_KEYS, DEFAULT_BELL_SOUND_ID, DEFAULT_CONFIG, DEFAULT_GIT_DIFF_EAGER_LINE_BUDGET, DEFAULT_GLOBAL_SETTINGS, DEFAULT_NOTIFICATION_SOUND_ID, DEFAULT_TERMINAL_DARK_THEME, DEFAULT_TERMINAL_LIGHT_THEME, DEFAULT_TERMINAL_THEME_MODE, DEFAULT_TRANSLATION_CACHE_ENTRY_LIMIT, DEFAULT_TRANSLATION_ENGINE_ID, DOCUMENT_TRANSLATION_DISPLAY_MODES, DashboardConfigSchema, DashboardGitSnapshotSchema, DashboardOverviewSchema, DashboardSummaryIdentitySchema, DashboardSummaryInvalidationCauseSchema, DashboardSummaryInvalidationSchema, DashboardSummaryProjectionSchema, DashboardSummaryProjectionStateSchema, DashboardTrendsProjectionSchema, DeltaOperationType, DeltaSchema, DeltaSpecSchema, DependencyInfoSchema, DocumentTranslationConfigSchema, DocumentTranslationConfigUpdateSchema, DocumentTranslationDisplayModeSchema, DocumentTranslationGlobalSettingsUpdateSchema, EnvironmentGlobalConfigValueSchema, EnvironmentGlobalFileProjectionDataSchema, EnvironmentGlobalFileProjectionStateSchema, EnvironmentGlobalProjectionDataSchema, EnvironmentGlobalProjectionStateSchema, FILE_PREVIEW_KINDS, GitConfigSchema, GlobalSettingsManager, HOSTED_SHELL_PROTOCOL_VERSION, LEGACY_SOUND_ID_MAP, LOCAL_MODEL_PROFILE_DEFINITIONS, LocalModelAssetLogSchema, LocalModelAssetPlanSnapshotSchema, LocalModelAssetStateSchema, LocalModelDownloadStatusSchema, LocalModelLifecycleFileStateSchema, LocalModelLifecycleGroupStateSchema, LocalModelProfileLoadStateSchema, LocalModelProfileManifestFileSchema, LocalModelProfileManifestGroupSchema, LocalModelProfileManifestSchema, LocalModelProfileStatusSchema, MAX_TRANSLATION_CACHE_ENTRY_LIMIT, MIN_TRANSLATION_CACHE_ENTRY_LIMIT, ManagedLocalCatalogSourceSchema, MarkdownParser, MarkdownReadingPluginRegistry, NOTIFICATION_SOUND_OPTIONS, NOTIFICATION_SOUND_VALUES, NotificationActionSchema, NotificationGroupKeySchema, NotificationPublishInputSchema, NotificationRecordSchema, NotificationSettingsSchema, NotificationSoundSchema, NotificationSourceSchema, OFFICIAL_APP_BASE_URL, OPENSPECUI_DOCUMENT_HOOK_VERSION, OPENSPECUI_RUNTIME_CAPABILITIES, OPENSPECUI_WORKFLOW_HOOK_VERSION, OPENSPEC_SPAWN_MODE_ENV, OPEN_SPEC_DATA_DIRECTORY_NAME, OPEN_SPEC_DATA_HOME_OBSERVATION_TARGETS, OPEN_SPEC_READING_SECTIONS_PROJECTION_ID, OPEN_SPEC_SPEC_PROJECTION_ID, OPSX_AGENT_INVOCATION_MODE_VALUES, OPSX_ALL_WORKFLOWS, OPSX_ARTIFACT_INPUT_ACTIONS, OPSX_CHANGE_INPUT_ACTIONS, OPSX_COMMAND_CAPABLE_WORKFLOWS, OPSX_CORE_PROFILE_WORKFLOWS, OPSX_TEXT_INPUT_ACTIONS, OPSX_WORKFLOW_LABELS, OPSX_WORKFLOW_TO_SKILL_DIR, OPSX_WORKFLOW_TO_SKILL_DIR as TOOL_WORKFLOW_TO_SKILL_DIR, OpenSpecAdapter, OpenSpecCliContractExecutor, OpenSpecDataHomeObserver, OpenSpecUIConfigSchema, OpenSpecUIGlobalSettingsSchema, OpenSpecUIGlobalSettingsUpdateSchema, OpenSpecWatcher, OpsxAgentInvocationModeSchema, OpsxCliEvidenceSchema, OpsxConfigBundleSchema, OpsxConfigSchema, OpsxKernel, OpsxStatusEvidenceSchema, OwnedSpecIdentitySchema, PlanningCliProjectionDataSchema, PlanningCliProjectionSelectorSchema, PlanningCliProjectionStateSchema, PlanningConfigJsonValueSchema, PlanningConfigReferenceSchema, ProjectBindingUpdateSchema, ProjectWatcher, PtyAttachMessageSchema, PtyBellResponseSchema, PtyBufferResponseSchema, PtyClientMessageSchema, PtyCloseMessageSchema, PtyCreateMessageSchema, PtyCreatedResponseSchema, PtyErrorCodeSchema, PtyErrorResponseSchema, PtyExitResponseSchema, PtyInputMessageSchema, PtyListMessageSchema, PtyListResponseSchema, PtyOutputResponseSchema, PtyPlatformSchema, PtyProcessTitleResponseSchema, PtyResizeMessageSchema, PtyServerMessageSchema, PtyTitleResponseSchema, RUNTIME_INVALIDATION_FACETS, ReactiveContext, ReactiveObservationEnvironment, ReactiveState, ReferencedSpecIdentitySchema, RequirementSchema, RuntimeInvalidationIndex, RuntimeRootInvalidationRegistry, SERVICE_TRANSLATION_ENGINE_IDS, SILENT_SOUND_ID, ScenarioStepKeywordSchema, ScenarioStepSchema, SchemaArtifactSchema, SchemaDetailSchema, SchemaInfoSchema, SchemaResolutionSchema, ServiceTranslationEngineIdSchema, SoundConfigIdSchema, SoundIdSchema, SpecCatalogSchema, SpecCommandEvidenceSchema, SpecDocumentProjectionSchema, SpecIdentitySchema, SpecSchema, StoreDoctorResultSchema, StoreListResultSchema, StoreMutationLifecycleEventSchema, StoreMutationResultSchema, StoreMutationSchema, StoreMutationStartResponseSchema, TERMINAL_BELL_SOUND_OPTIONS, TERMINAL_BELL_SOUND_VALUES, TERMINAL_COMMAND_FIELD_TYPE_VALUES, TERMINAL_SHELL_QUOTE_STYLE_VALUES, TERMINAL_THEME_MODE_VALUES, TERMINAL_THEME_VALUES, TRANSLATION_CACHE_POLICY_VERSION, TRANSLATION_ENGINE_IDS, TRANSLATION_ENGINE_MANIFESTS, TRANSLATOR_CONTRACT_VERSION, TaskSchema, TemplateContentMapSchema, TemplateContentSchema, TemplatesSchema, TerminalBellSoundSchema, TerminalCommandFieldSchema, TerminalConfigSchema, TerminalControlParser, TerminalCwdTargetSchema, TerminalInvocationSettingsSchema, TerminalNotificationParser, TerminalRendererEngineSchema, TerminalShellProfileSchema, TerminalShellQuoteStyleSchema, TerminalSpawnCommandSchema, TerminalThemeModeSchema, TerminalThemeSchema, TrackedTaskProgressSchema, TranslationCacheEntrySchema, TranslationCacheReadInputSchema, TranslationCacheSettingsSchema, TranslationCacheSettingsUpdateSchema, TranslationCacheStatsSchema, TranslationCacheWriteInputSchema, TranslationDownloadFilePlanSchema, TranslationDownloadGroupPlanSchema, TranslationEngineAssetStateSchema, TranslationEngineAssetStatusSchema, TranslationEngineDependencyStateSchema, TranslationEngineDependencyStatusSchema, TranslationEngineGlobalSettingsSchema, TranslationEngineGlobalSettingsUpdateSchema, TranslationEngineIdSchema, TranslationEngineInstallLogEventSchema, TranslationEngineInstallLogStreamSchema, TranslationEngineLifecycleEventSchema, TranslationEngineLifecycleStatusSchema, TranslationEngineProjectSettingsSchema, TranslationEngineProjectSettingsUpdateSchema, TranslationEngineRuntimeStateSchema, TranslationEngineRuntimeStatusSchema, TranslationLocalCt2SettingsSchema, TranslationLocalCt2SettingsUpdateSchema, TranslationLocalLlamaSettingsSchema, TranslationLocalLlamaSettingsUpdateSchema, TranslationLocalSettingsSchema, TranslationLocalSettingsUpdateSchema, TranslationOpenAISettingsSchema, TranslationOpenAISettingsUpdateSchema, VIRTUAL_PROJECT_DIRNAME, Validator, accessGateFingerprint, acquireWatcher, acquireWatcherRoot, annotateOpenSpecFacts, annotateOpenSpecMarkdown, asEnvUri, buildBackendHealthPayload, buildCliRunnerCandidates, buildEmbeddedUiLaunchUrl, buildHostedLaunchUrl, buildLocalDownloadPlanFromRepositoryFiles, buildLocalDownloadPlanFromRuntimeProfileFiles, buildMarkdownParentMap, buildOpsxEntityDetail, buildRuntimePackageInstallCommand, buildSpecCatalog, builtinOpenSpecReadingPlugin, checkLocalDirectionalModelLanguagePair, classifyStoreCliResult, clearCache, cliProjectionStates, closeAllProjectWatchers, closeAllWatchers, computeEnvUri, constantTimeEqual, contextStorage, createApplyInstructionProgress, createCleanCliEnv, createCliProjectionStateSchema, createDocumentChecklistSummary, createFileChangeObservable, createMarkdownReadingDocument, createMarkdownReadingDocumentFromFacts, createOpenSpecReadingPlugin, createPhysicalReactiveDirectory, createStaticSpecCatalogOwnedProjection, createStaticSpecCatalogReferenceProjection, createStaticSpecCatalogReferenceSource, createToolInitStateProjection, createTrackedTaskProgress, createTranslationEngineLifecycleStatus, customHashFromSoundId, deriveTrackedTaskPhase, detectRuntimePackageManager, generateAccessGateCredential, getActiveWatcherCount, getAllToolIds, getAllTools, getAvailableToolIds, getAvailableTools, getBuiltinSoundUrl, getCacheSize, getConfiguredTools, getDefaultCliCommand, getDefaultCliCommandString, getDefaultGlobalSettingsPath, getDetectedProjectTools, getExternalCodexCommandObservationRoot, getManagedLocalTranslationEngineManifest, getMarkdownAnnotation, getMarkdownAnnotationsForFact, getMarkdownFactSpan, getMarkdownHeadingEnd, getMarkdownHeadingFacts, getNotificationGroupKey, getNotificationGroupLabel, getOpenSpecAnnotation, getOpenSpecAnnotationsForFact, getOpenSpecProjectionAnnotation, getOpenSpecReadingSections, getOpsxEntityMetadataPath, getOpsxEntityRootRelativePath, getProjectWatcher, getRootContextCliSelector, getSpecCatalogEntry, getTerminalCommandDefaultValues, getToolById, getToolInitStates, getTranslationEngineLifecycleMessage, getTranslationEngineManifest, getWatcherRuntimeStatus, groupNotifications, hasCapability, inferFileMime, inferFilePreviewKind, inferLocalDirectionalModelLanguagePair, inspectProjectBinding, isBackendHealthRuntimeMetadata, isBatchTranslationAbort, isDirectionalManagedLocalTranslationEngineId, isGlobPattern, isHostedBackendHealthResponse, isManagedLocalTranslationEngineId, isMarkdownTaskSourcePath, isOpsxCoreWorkflowSelection, isOpsxGlobPattern, isPreviewableFile, isReferencedSpecIdentity, isSupportedEmbeddedUiUrl, isTerminalMutationStatus, isTerminalRendererEngine, isTextLikeFile, isTextLikeMime, isToolConfigured, isTranslationEngineDependencyReady, isTranslationEngineRuntimeReady, isWatcherPoolInitialized, mergeSpecCatalog, normalizeAccessGatePassword, normalizeBatchTranslationError, normalizeEmbeddedUiUrl, normalizeHostedAppBaseUrl, normalizeLegacySoundId, normalizeOpsxEntityPath, openSpecAnnotationRules, opsxGlobToRegex, opsxPathMatchesPattern, parseCliCommand, parseCliCommandResult, parseMarkdownFacts, parseMarkdownTasks, parseOpenSpecMarkdownToSpec, parseOpsxEntityMetadata, parseOpsxSchemaDetail, projectAnnotatedOpenSpecToSpec, projectOpenSpecMarkdown, projectTaskProjectionsFromMarkdownFiles, quoteTerminalShellArg, reactiveExists, reactiveReadDir, reactiveReadFile, reactiveStat, redactSnapshotForPublication, removePhysicalReactivePath, renderTerminalCommandArgs, renderTerminalSpawnCommandLine, requireCanonicalOpenSpecEntityId, requireOpenSpecEntityRelativePath, resolveHostedAppBaseUrl, resolveOpenSpecDataScope, resolveOpenSpecSpawnMode, resolveRootContext, resolveRuntimePackageInstallStrategy, resolveTerminalShellDefaults, runControlledTranslationTask, runPhysicalReactivePathMutation, selectLocalDownloadGroup, shouldShowTranslationEngineInstallGate, snapshotHasAbsolutePath, sniffGlobalCli, sortMarkdownReadingPlugins, soundIdFromCustomHash, specIdentityFromRoute, specIdentityKey, specRoutePath, subscribeWatcherRuntimeStatus, terminalNotificationEventToPublishInput, toCliProjectionCommandEvidence, toCliProjectionFailure, toCliProjectionNotice, toMarkdownFactKind, toOpsxDisplayPath, toPersistedGlobalSettings, toStoreFeatureResult, toggleMarkdownTask, trimMarkdownSlice, updateProjectBindingContent, updateReactiveFileCache, writePhysicalReactiveFile };