@openspecui/core 6.0.1 → 6.2.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-w3LzenG5.d.mts → cli-projection-CvRCkCyI.d.mts} +9 -9
  5. package/dist/cli-projection.d.mts +5 -5
  6. package/dist/cli-projection.mjs +2 -2
  7. package/dist/{command-result-CjnZNtGL.d.mts → command-result-DPdfvbPT.d.mts} +101 -90
  8. package/dist/{dashboard-summary-transport-CYBuU4iT.mjs → dashboard-summary-transport-BMtZ0q12.mjs} +2 -2
  9. package/dist/{dashboard-summary-transport-DAFz2ZQe.d.mts → dashboard-summary-transport-iutogi2N.d.mts} +4924 -3475
  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-DyEj4JKj.d.mts → document-translation-DOcHp3o0.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 +968 -105
  24. package/dist/{local-download-profiles-BokmRLew.d.mts → local-download-profiles-xAbDVjd6.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-CgJlLgLO.d.mts → notifications-BP_02fdj.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-DnB0EalA.d.mts → openspec-projection-CPKTjO43.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-CQGXOj_a.d.mts → opsx-entity-BJz_BsKn.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-DTWBhlbh.d.mts → opsx-schema-detail-tkv6htQB.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-BKGpvDDe.d.mts → opsx-types-BNEqpP-B.d.mts} +213 -213
  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-C-BZiH0m.d.mts → schemas-D4afES_m.d.mts} +130 -130
  62. package/dist/{sounds-qhRgCy0F.d.mts → sounds-CsPiQKxX.d.mts} +4 -4
  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-3TzQ6ete.d.mts → store-mutation-protocol-Ckcv2-zs.d.mts} +48 -48
  74. package/dist/store-mutation-protocol.d.mts +1 -1
  75. package/dist/store-mutation-protocol.mjs +2 -2
  76. package/dist/{store-types-QeY5nWlF.d.mts → store-types-DIws57FV.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-tXDm_EDe.d.mts → terminal-audio-BXa1vpkF.d.mts} +1 -1
  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-rKDNnsUS.d.mts → terminal-invocation-DFhNS_lc.d.mts} +94 -94
  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-BEiXnLjR.d.mts → translator-B9j5lGVS.d.mts} +154 -154
  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 +28 -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,36 +1,37 @@
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";
@@ -40,7 +41,10 @@ import { watch } from "fs";
40
41
  import { exec, execFile } from "child_process";
41
42
  import { promisify } from "util";
42
43
  import crossSpawn from "cross-spawn";
43
- import { homedir, platform } from "node:os";
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";
44
48
  import { createHash, randomBytes } from "node:crypto";
45
49
 
46
50
  //#region src/entity-id.ts
@@ -1127,10 +1131,10 @@ var ReactiveState = class {
1127
1131
  * 如果在 ReactiveContext 中调用,会自动注册依赖
1128
1132
  */
1129
1133
  get() {
1130
- const context = contextStorage.getStore();
1131
- if (context) {
1132
- context.track(this);
1133
- 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);
1134
1138
  }
1135
1139
  return this.currentValue;
1136
1140
  }
@@ -1142,15 +1146,15 @@ var ReactiveState = class {
1142
1146
  set(newValue) {
1143
1147
  if (this.equals(this.currentValue, newValue)) return false;
1144
1148
  this.currentValue = newValue;
1145
- for (const context of this.subscribers) context.notifyChange();
1149
+ for (const context$1 of this.subscribers) context$1.notifyChange();
1146
1150
  return true;
1147
1151
  }
1148
1152
  /**
1149
1153
  * 取消订阅
1150
1154
  * 当 Context 销毁时调用
1151
1155
  */
1152
- unsubscribe(context) {
1153
- this.subscribers.delete(context);
1156
+ unsubscribe(context$1) {
1157
+ this.subscribers.delete(context$1);
1154
1158
  }
1155
1159
  /**
1156
1160
  * 获取当前订阅者数量(用于调试)
@@ -2600,55 +2604,164 @@ function spawnSafe(command, args, options) {
2600
2604
  };
2601
2605
  }
2602
2606
  }
2603
- function killChild(child) {
2607
+ function killChild(child, signal = "SIGTERM") {
2604
2608
  try {
2605
- child.kill();
2609
+ child.kill(signal);
2606
2610
  } catch {}
2607
2611
  }
2612
+ const EAGER_JSON_EXIT_GRACE_MS = 25;
2613
+ const BUFFERED_FORCE_KILL_DELAY_MS = 1e3;
2608
2614
  function runBufferedCommand(options) {
2609
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");
2610
2638
  const started = spawnSafe(options.command, options.args, {
2611
2639
  cwd: options.cwd,
2612
2640
  shell: false,
2613
2641
  env: options.env
2614
2642
  });
2615
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" });
2616
2648
  resolve$1({
2617
2649
  stdout: "",
2618
2650
  stderr: "",
2619
2651
  exitCode: null,
2620
2652
  timedOut: false,
2621
- spawnError: started.error
2653
+ spawnError: started.error,
2654
+ phases
2622
2655
  });
2623
2656
  return;
2624
2657
  }
2625
2658
  const { child } = started;
2659
+ phases.spawnReturnedAt = performance.now();
2660
+ observe("spawn-returned", { pid: child.pid });
2626
2661
  let stdout = "";
2627
2662
  let stderr = "";
2628
2663
  let timedOut = false;
2629
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
+ };
2630
2689
  let clearTimer = () => {};
2631
2690
  if (options.timeoutMs !== void 0) {
2632
2691
  const timer = setTimeout(() => {
2633
2692
  timedOut = true;
2634
- killChild(child);
2693
+ requestTermination("timeout");
2635
2694
  }, options.timeoutMs);
2636
2695
  clearTimer = () => clearTimeout(timer);
2637
2696
  }
2638
- 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) => {
2639
2705
  if (settled) return;
2640
2706
  settled = true;
2641
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 });
2642
2714
  resolve$1(result);
2643
2715
  };
2716
+ child.once("spawn", () => {
2717
+ phases.spawnObservedAt = performance.now();
2718
+ observe("spawn-observed", { pid: child.pid });
2719
+ });
2644
2720
  child.stdout?.on("data", (data) => {
2721
+ if (!phases.firstStdoutAt) {
2722
+ phases.firstStdoutAt = performance.now();
2723
+ observe("first-stdout-observed");
2724
+ }
2645
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 {}
2646
2743
  });
2647
2744
  child.stderr?.on("data", (data) => {
2745
+ if (!phases.firstStderrAt) {
2746
+ phases.firstStderrAt = performance.now();
2747
+ observe("first-stderr-observed");
2748
+ }
2648
2749
  stderr += data.toString();
2649
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
+ });
2650
2762
  child.on("error", (err) => {
2651
- finish({
2763
+ observe("spawn-error", { reason: "spawn-error" });
2764
+ finish("spawn-error", {
2652
2765
  stdout,
2653
2766
  stderr,
2654
2767
  exitCode: null,
@@ -2656,8 +2769,14 @@ function runBufferedCommand(options) {
2656
2769
  spawnError: formatSpawnError(err)
2657
2770
  });
2658
2771
  });
2659
- child.on("close", (exitCode) => {
2660
- 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", {
2661
2780
  stdout,
2662
2781
  stderr,
2663
2782
  exitCode,
@@ -3701,15 +3820,19 @@ const DocumentTranslationGlobalSettingsUpdateSchema = z.object({
3701
3820
  displayMode: DocumentTranslationDisplayModeSchema.optional(),
3702
3821
  cacheEnabled: z.boolean().optional()
3703
3822
  });
3823
+ const SERVE_PRESENTATION_MODES = ["app", "web"];
3824
+ const ServePresentationModeSchema = z.enum(SERVE_PRESENTATION_MODES);
3704
3825
  const OpenSpecUIGlobalSettingsSchema = z.object({
3705
3826
  translation: DocumentTranslationGlobalSettingsSchema.default(DocumentTranslationGlobalSettingsSchema.parse({})),
3706
3827
  translationCache: TranslationCacheSettingsSchema.default(TranslationCacheSettingsSchema.parse({})),
3707
- translationEngines: TranslationEngineGlobalSettingsSchema.default(TranslationEngineGlobalSettingsSchema.parse({}))
3828
+ translationEngines: TranslationEngineGlobalSettingsSchema.default(TranslationEngineGlobalSettingsSchema.parse({})),
3829
+ servePresentation: ServePresentationModeSchema.optional()
3708
3830
  });
3709
3831
  const OpenSpecUIGlobalSettingsUpdateSchema = z.object({
3710
3832
  translation: DocumentTranslationGlobalSettingsUpdateSchema.optional(),
3711
3833
  translationCache: TranslationCacheSettingsUpdateSchema.optional(),
3712
- translationEngines: TranslationEngineGlobalSettingsUpdateSchema.optional()
3834
+ translationEngines: TranslationEngineGlobalSettingsUpdateSchema.optional(),
3835
+ servePresentation: ServePresentationModeSchema.nullable().optional()
3713
3836
  });
3714
3837
  const DEFAULT_GLOBAL_SETTINGS = OpenSpecUIGlobalSettingsSchema.parse({});
3715
3838
  const PERSISTED_GLOBAL_SETTINGS_SANITIZE_RULES = [
@@ -3777,6 +3900,12 @@ const PERSISTED_GLOBAL_SETTINGS_SANITIZE_RULES = [
3777
3900
  kind: "object",
3778
3901
  path: ["translationEngines", "localLlama"],
3779
3902
  fallback: {}
3903
+ },
3904
+ {
3905
+ kind: "field",
3906
+ path: ["servePresentation"],
3907
+ schema: ServePresentationModeSchema,
3908
+ fallback: void 0
3780
3909
  }
3781
3910
  ];
3782
3911
  function getDefaultGlobalSettingsPath() {
@@ -3839,6 +3968,7 @@ function toPersistedGlobalSettings(settings) {
3839
3968
  if (settings.translationEngines.localLlama.memoryBudgetPercent !== defaultTranslationEngines.localLlama.memoryBudgetPercent) localLlama.memoryBudgetPercent = settings.translationEngines.localLlama.memoryBudgetPercent;
3840
3969
  if (hasOwnEntries(localLlama)) translationEngines.localLlama = localLlama;
3841
3970
  if (hasOwnEntries(translationEngines)) persisted.translationEngines = translationEngines;
3971
+ if (settings.servePresentation !== void 0) persisted.servePresentation = settings.servePresentation;
3842
3972
  return persisted;
3843
3973
  }
3844
3974
  function isPersistedGlobalSettingsEmpty(settings) {
@@ -3898,7 +4028,8 @@ var GlobalSettingsManager = class {
3898
4028
  local: mergeNullablePatch(current.translationEngines.local, update.translationEngines?.local),
3899
4029
  localCt2: mergeNullablePatch(current.translationEngines.localCt2, update.translationEngines?.localCt2),
3900
4030
  localLlama: mergeNullablePatch(current.translationEngines.localLlama, update.translationEngines?.localLlama)
3901
- }
4031
+ },
4032
+ servePresentation: update.servePresentation === void 0 ? current.servePresentation : update.servePresentation === null ? void 0 : update.servePresentation
3902
4033
  }));
3903
4034
  if (isPersistedGlobalSettingsEmpty(persisted) && !fileExists) return;
3904
4035
  const serialized = isPersistedGlobalSettingsEmpty(persisted) ? "{}" : JSON.stringify(persisted, null, 2);
@@ -4113,6 +4244,82 @@ function buildRuntimePackageInstallCommand(input) {
4113
4244
  }) ?? null;
4114
4245
  }
4115
4246
 
4247
+ //#endregion
4248
+ //#region src/cli-buffered-admission.ts
4249
+ /**
4250
+ * Orthogonal intents (updated 2026-07-31 Asia/Shanghai):
4251
+ * 1. Own the process-local FIFO admission boundary for buffered CLI child processes.
4252
+ * 2. Expose queue/running observations without owning command semantics or subprocess lifecycle.
4253
+ * 3. Retire queued admissions when the owning CliExecutor is disposed.
4254
+ *
4255
+ * Original request (2026-07-31): "系统性地进行修复,因为List页面也有类似的问题。所有可能其它页面都有类似的问题。"
4256
+ * Owner evidence (2026-07-31): a spawned `openspec doctor --json` emitted no stdout for 12.95s
4257
+ * while other Dashboard-originated CLI projection work was active.
4258
+ */
4259
+ /** One CliExecutor-wide buffered subprocess slot. Streaming terminal commands remain independent. */
4260
+ var CliBufferedAdmission = class {
4261
+ limit = 1;
4262
+ active = 0;
4263
+ queue = [];
4264
+ acquire(signal) {
4265
+ if (signal.aborted) return Promise.resolve(null);
4266
+ return new Promise((resolve$1) => {
4267
+ const waiter = {
4268
+ enqueuedAt: performance$1.now(),
4269
+ activeAtEnqueue: this.active,
4270
+ waitingAtEnqueue: this.queue.length,
4271
+ resolve: resolve$1,
4272
+ detachAbort: () => {},
4273
+ settled: false
4274
+ };
4275
+ const abort = () => {
4276
+ if (waiter.settled) return;
4277
+ waiter.settled = true;
4278
+ waiter.detachAbort();
4279
+ const index = this.queue.indexOf(waiter);
4280
+ if (index >= 0) this.queue.splice(index, 1);
4281
+ resolve$1(null);
4282
+ };
4283
+ signal.addEventListener("abort", abort, { once: true });
4284
+ waiter.detachAbort = () => signal.removeEventListener("abort", abort);
4285
+ this.queue.push(waiter);
4286
+ this.drain();
4287
+ });
4288
+ }
4289
+ stats() {
4290
+ return {
4291
+ active: this.active,
4292
+ waiting: this.queue.length
4293
+ };
4294
+ }
4295
+ drain() {
4296
+ if (this.active >= this.limit) return;
4297
+ const waiter = this.queue.shift();
4298
+ if (!waiter) return;
4299
+ if (waiter.settled) {
4300
+ this.drain();
4301
+ return;
4302
+ }
4303
+ waiter.settled = true;
4304
+ waiter.detachAbort();
4305
+ this.active += 1;
4306
+ let released = false;
4307
+ waiter.resolve({
4308
+ evidence: {
4309
+ activeAtEnqueue: waiter.activeAtEnqueue,
4310
+ waitingAtEnqueue: waiter.waitingAtEnqueue,
4311
+ waitMs: performance$1.now() - waiter.enqueuedAt
4312
+ },
4313
+ release: () => {
4314
+ if (released) return;
4315
+ released = true;
4316
+ this.active -= 1;
4317
+ this.drain();
4318
+ }
4319
+ });
4320
+ }
4321
+ };
4322
+
4116
4323
  //#endregion
4117
4324
  //#region src/cli-stream-child-owner.ts
4118
4325
  /** Internal owner for the direct child of one CLI stream. */
@@ -4145,8 +4352,292 @@ var CliStreamChildOwner = class {
4145
4352
  };
4146
4353
  const ownersByChild = /* @__PURE__ */ new WeakMap();
4147
4354
 
4355
+ //#endregion
4356
+ //#region src/openspec-cli-worker.ts
4357
+ /**
4358
+ * Orthogonal intents (updated 2026-07-31 Asia/Shanghai):
4359
+ * 1. Resolve an installed OpenSpec package's importable CLI module from its configured runner and
4360
+ * distinguish objective module absence from Worker startup/execution failure.
4361
+ * 2. Execute one buffered OpenSpec command inside an isolated Node Worker with project cwd semantics.
4362
+ * 3. Project Worker stdout, stderr, cancellation, and settlement through the buffered spawn contract.
4363
+ *
4364
+ * Original request (2026-07-31): "直接寻址到本地 openspec 背后的 js,直接用 worker_thread 来运行它。"
4365
+ * Original request (2026-07-31): "通过 OPENSPEC_SPAWN_MODE=process|worker 来进行区分两种模式。"
4366
+ */
4367
+ const OPENSPEC_SPAWN_MODE_ENV = "OPENSPEC_SPAWN_MODE";
4368
+ /** Objective signal that no importable OpenSpec CLI JavaScript module exists behind the runner. */
4369
+ var OpenSpecCliModuleNotFoundError = class extends Error {
4370
+ constructor(message) {
4371
+ super(message);
4372
+ this.name = "OpenSpecCliModuleNotFoundError";
4373
+ }
4374
+ };
4375
+ const WORKER_BOOTSTRAP = String.raw`
4376
+ const { parentPort, workerData } = require('node:worker_threads')
4377
+ const { pathToFileURL } = require('node:url')
4378
+
4379
+ process.argv.splice(0, process.argv.length, process.execPath, 'openspec', ...workerData.args)
4380
+ process.cwd = () => workerData.cwd
4381
+
4382
+ void (async () => {
4383
+ const cli = await import(pathToFileURL(workerData.modulePath).href)
4384
+ if (!cli.program || typeof cli.program.parseAsync !== 'function') {
4385
+ throw new TypeError('OpenSpec CLI module does not export program.parseAsync().')
4386
+ }
4387
+ await cli.program.parseAsync(process.argv)
4388
+ parentPort.postMessage({ type: 'completed', exitCode: process.exitCode ?? 0 })
4389
+ parentPort.close()
4390
+ })().catch((error) => {
4391
+ const message = error instanceof Error ? (error.stack ?? error.message) : String(error)
4392
+ process.stderr.write(message + '\n')
4393
+ process.exitCode = 1
4394
+ parentPort.close()
4395
+ })
4396
+ `;
4397
+ function createPhases() {
4398
+ return {
4399
+ spawnCalledAt: performance$1.now(),
4400
+ spawnReturnedAt: 0,
4401
+ spawnObservedAt: 0,
4402
+ firstStdoutAt: 0,
4403
+ firstStderrAt: 0,
4404
+ jsonCompleteAt: 0,
4405
+ terminationRequestedAt: 0,
4406
+ resultResolvedAt: 0,
4407
+ exitAt: 0,
4408
+ closeAt: 0,
4409
+ eagerResolved: false,
4410
+ resultReason: null
4411
+ };
4412
+ }
4413
+ function isOpenSpecWorkerMessage(value) {
4414
+ if (typeof value !== "object" || value === null) return false;
4415
+ const candidate = value;
4416
+ return candidate.type === "completed" && typeof candidate.exitCode === "number";
4417
+ }
4418
+ function cleanWorkerEnv(env) {
4419
+ return Object.fromEntries(Object.entries(env).filter((entry) => entry[1] !== void 0));
4420
+ }
4421
+ function isNodeExecutable(command) {
4422
+ const executable = basename(command).toLowerCase();
4423
+ return executable === "node" || executable === "node.exe" || resolve(command) === resolve(process.execPath);
4424
+ }
4425
+ function isMissingPathError(error) {
4426
+ if (typeof error !== "object" || error === null || !("code" in error)) return false;
4427
+ const code = error.code;
4428
+ return code === "ENOENT" || code === "ENOTDIR";
4429
+ }
4430
+ async function existingFile(path) {
4431
+ try {
4432
+ await access(path);
4433
+ return path;
4434
+ } catch (error) {
4435
+ if (isMissingPathError(error)) return null;
4436
+ throw error;
4437
+ }
4438
+ }
4439
+ async function moduleFromBin(binPath) {
4440
+ let physicalBin;
4441
+ try {
4442
+ physicalBin = await realpath(binPath);
4443
+ } catch (error) {
4444
+ if (isMissingPathError(error)) return null;
4445
+ throw error;
4446
+ }
4447
+ if (physicalBin.endsWith(join$1("dist", "cli", "index.js"))) return existingFile(physicalBin);
4448
+ if (basename(physicalBin) !== "openspec.js" || basename(dirname$1(physicalBin)) !== "bin") return null;
4449
+ return existingFile(join$1(dirname$1(dirname$1(physicalBin)), "dist", "cli", "index.js"));
4450
+ }
4451
+ async function moduleFromVitePlusShim(command) {
4452
+ if (basename(command) !== "openspec" || basename(dirname$1(command)) !== "bin") return null;
4453
+ const vitePlusRoot = dirname$1(dirname$1(command));
4454
+ if (basename(vitePlusRoot) !== ".vite-plus") return null;
4455
+ return existingFile(join$1(vitePlusRoot, "packages", "@fission-ai", "openspec", "lib", "node_modules", "@fission-ai", "openspec", "dist", "cli", "index.js"));
4456
+ }
4457
+ async function resolveOpenSpecWorkerInvocation(fullCommand) {
4458
+ const [command, ...commandArgs] = fullCommand;
4459
+ if (!command) throw new Error("OpenSpec CLI command is empty.");
4460
+ if (isNodeExecutable(command)) {
4461
+ const [binPath, ...args] = commandArgs;
4462
+ if (!binPath) throw new Error("Node OpenSpec runner does not include its bin entry.");
4463
+ const modulePath$1 = await moduleFromBin(binPath);
4464
+ if (!modulePath$1) throw new OpenSpecCliModuleNotFoundError(`Cannot resolve the OpenSpec CLI module from Node entry: ${binPath}`);
4465
+ return {
4466
+ modulePath: modulePath$1,
4467
+ args
4468
+ };
4469
+ }
4470
+ const modulePath = await moduleFromBin(command) ?? await moduleFromVitePlusShim(resolve(command)) ?? await moduleFromVitePlusShim(command);
4471
+ if (!modulePath) throw new OpenSpecCliModuleNotFoundError(`Cannot resolve the OpenSpec CLI module from runner: ${command}`);
4472
+ return {
4473
+ modulePath,
4474
+ args: commandArgs
4475
+ };
4476
+ }
4477
+ /** Resolve the main-thread buffered OpenSpec execution mode. */
4478
+ function resolveOpenSpecSpawnMode(value = process.env[OPENSPEC_SPAWN_MODE_ENV]) {
4479
+ if (value === void 0 || value === "" || value === "worker") return "worker";
4480
+ if (value === "process") return "process";
4481
+ throw new RangeError(`OPENSPEC_SPAWN_MODE must be "process" or "worker"; received "${value}".`);
4482
+ }
4483
+ /** Execute one importable OpenSpec CLI command in a dedicated Worker. */
4484
+ function runOpenSpecCliWorker(options) {
4485
+ return new Promise((resolveResult) => {
4486
+ const phases = createPhases();
4487
+ let stderr = "";
4488
+ let stdout = "";
4489
+ let settled = false;
4490
+ let worker = null;
4491
+ let completedExitCode = null;
4492
+ let workerError;
4493
+ let aborted = false;
4494
+ const observe = (phase, evidence = {}) => options.onPhase?.({
4495
+ phase,
4496
+ at: performance$1.now(),
4497
+ ...evidence
4498
+ });
4499
+ const finish = (reason, exitCode) => {
4500
+ if (settled) return;
4501
+ settled = true;
4502
+ phases.resultResolvedAt = performance$1.now();
4503
+ phases.resultReason = reason;
4504
+ observe("result-resolved", { reason });
4505
+ resolveResult({
4506
+ stdout,
4507
+ stderr,
4508
+ exitCode,
4509
+ timedOut: false,
4510
+ ...workerError ? { spawnError: workerError } : {},
4511
+ phases
4512
+ });
4513
+ };
4514
+ const requestTermination = (reason) => {
4515
+ if (!worker || phases.terminationRequestedAt) return;
4516
+ phases.terminationRequestedAt = performance$1.now();
4517
+ observe("termination-requested", { reason });
4518
+ worker.terminate();
4519
+ };
4520
+ const onAbort = () => {
4521
+ aborted = true;
4522
+ requestTermination("abort");
4523
+ };
4524
+ if (options.signal?.aborted) {
4525
+ phases.resultResolvedAt = performance$1.now();
4526
+ phases.resultReason = "close";
4527
+ observe("result-resolved", { reason: "close" });
4528
+ resolveResult({
4529
+ stdout,
4530
+ stderr,
4531
+ exitCode: null,
4532
+ timedOut: false,
4533
+ phases
4534
+ });
4535
+ return;
4536
+ }
4537
+ options.signal?.addEventListener("abort", onAbort, { once: true });
4538
+ observe("spawn-called");
4539
+ Promise.all([Promise.resolve(options.invocation), realpath(options.cwd).catch(() => resolve(options.cwd))]).then(([invocation, physicalCwd]) => {
4540
+ if (options.signal?.aborted) {
4541
+ onAbort();
4542
+ finish("close", null);
4543
+ return;
4544
+ }
4545
+ options.onModuleResolved?.(invocation.modulePath);
4546
+ try {
4547
+ worker = new Worker(WORKER_BOOTSTRAP, {
4548
+ env: cleanWorkerEnv(options.env),
4549
+ eval: true,
4550
+ execArgv: [],
4551
+ stderr: true,
4552
+ stdout: true,
4553
+ workerData: {
4554
+ args: invocation.args,
4555
+ cwd: physicalCwd,
4556
+ modulePath: invocation.modulePath
4557
+ }
4558
+ });
4559
+ } catch (error) {
4560
+ workerError = formatSpawnError(error);
4561
+ observe("spawn-error", { reason: "spawn-error" });
4562
+ finish("spawn-error", null);
4563
+ return;
4564
+ }
4565
+ phases.spawnReturnedAt = performance$1.now();
4566
+ observe("spawn-returned");
4567
+ worker.once("online", () => {
4568
+ phases.spawnObservedAt = performance$1.now();
4569
+ observe("spawn-observed");
4570
+ });
4571
+ worker.stdout.on("data", (data) => {
4572
+ if (!phases.firstStdoutAt) {
4573
+ phases.firstStdoutAt = performance$1.now();
4574
+ observe("first-stdout-observed");
4575
+ }
4576
+ stdout += data.toString();
4577
+ if (options.eagerResolveJson && !phases.eagerResolved && stdout.trimStart().startsWith("{")) try {
4578
+ JSON.parse(stdout);
4579
+ phases.eagerResolved = true;
4580
+ phases.jsonCompleteAt = performance$1.now();
4581
+ observe("json-complete-observed");
4582
+ requestTermination("eager-json");
4583
+ } catch {}
4584
+ });
4585
+ worker.stderr.on("data", (data) => {
4586
+ if (!phases.firstStderrAt) {
4587
+ phases.firstStderrAt = performance$1.now();
4588
+ observe("first-stderr-observed");
4589
+ }
4590
+ stderr += data.toString();
4591
+ });
4592
+ worker.on("message", (message) => {
4593
+ if (isOpenSpecWorkerMessage(message)) completedExitCode = message.exitCode;
4594
+ });
4595
+ worker.once("error", (error) => {
4596
+ workerError = formatSpawnError(error);
4597
+ observe("spawn-error", { reason: "spawn-error" });
4598
+ });
4599
+ worker.once("exit", (workerExitCode) => {
4600
+ options.signal?.removeEventListener("abort", onAbort);
4601
+ phases.exitAt = performance$1.now();
4602
+ const exitCode = aborted ? null : phases.eagerResolved ? 0 : completedExitCode ?? workerExitCode;
4603
+ observe("exit-observed", { exitCode });
4604
+ phases.closeAt = performance$1.now();
4605
+ observe("close-observed", { exitCode });
4606
+ if (workerError) finish("spawn-error", null);
4607
+ else finish(phases.eagerResolved ? "eager-json" : "close", exitCode);
4608
+ });
4609
+ }, (error) => {
4610
+ options.signal?.removeEventListener("abort", onAbort);
4611
+ workerError = formatSpawnError(error);
4612
+ observe("spawn-error", { reason: "spawn-error" });
4613
+ finish("spawn-error", null);
4614
+ });
4615
+ });
4616
+ }
4617
+
4148
4618
  //#endregion
4149
4619
  //#region src/cli-executor.ts
4620
+ /**
4621
+ * Orthogonal intents (updated 2026-07-31 Asia/Shanghai):
4622
+ * 1. Execute buffered CLI work through process/Worker backends with runner recovery,
4623
+ * observer-explicit OTel phase evidence, bounded probes, and owner-scoped disposal.
4624
+ * 2. Own streaming CLI processes through cancellation request, escalation, and confirmed settlement.
4625
+ * 3. Retain established init/schema/template and human validate/archive helpers.
4626
+ * 4. Expose the physically separated OpenSpec 1.6 typed command facade.
4627
+ * 5. Clear the Core-owned direct-child slot independently from stream settlement, and keep
4628
+ * response-Span delivery physically separate from late child-process settlement evidence.
4629
+ *
4630
+ * Original request (2026-07-15): "你先负责后端(内核)的开发。"
4631
+ * Original request (2026-07-17): "A stream cancellation request is not child-process settlement."
4632
+ * Built-runtime correction (2026-07-30): foreground Server shutdown must retire buffered projection children and settled probe timers.
4633
+ * Tracing (2026-07-31): each CLI subprocess call is wrapped in an OpenTelemetry span so the Server
4634
+ * `planningRoot.runOperation` breakdown can attribute latency to specific CLI invocations
4635
+ * (doctor / context / list ...). Uses `@opentelemetry/api` only — a no-op tracer is returned when
4636
+ * no SDK is registered, so standalone Core use incurs zero overhead.
4637
+ * Original request (2026-07-31): "这些命令的执行,时间绝对不是七八秒那么久...请看一下代码,看能不能让trace更精确"
4638
+ * Original request (2026-07-31): "终端大量报错,比如: Cannot execute the operation on ended Span"
4639
+ * Original request (2026-07-31): "在主线程,通过 OPENSPEC_SPAWN_MODE=process|worker 来进行区分两种模式。"
4640
+ */
4150
4641
  /** Failure raised when even forced termination cannot confirm child-process close. */
4151
4642
  var CliStreamTerminationError = class extends Error {
4152
4643
  constructor(command) {
@@ -4156,6 +4647,52 @@ var CliStreamTerminationError = class extends Error {
4156
4647
  };
4157
4648
  const STREAM_TERMINATION_GRACE_MS = 1e3;
4158
4649
  const STREAM_FORCE_CLOSE_TIMEOUT_MS = 1e3;
4650
+ const CLI_PHASE_EVENT_SUFFIXES = {
4651
+ "spawn-called": "spawn.called",
4652
+ "spawn-returned": "spawn.returned",
4653
+ "spawn-observed": "spawn.observed",
4654
+ "first-stdout-observed": "stdout.first.observed",
4655
+ "first-stderr-observed": "stderr.first.observed",
4656
+ "json-complete-observed": "json.complete.observed",
4657
+ "termination-requested": "termination.requested",
4658
+ "exit-observed": "exit.observed",
4659
+ "close-observed": "close.observed",
4660
+ "result-resolved": "result.resolved",
4661
+ "spawn-error": "spawn.error"
4662
+ };
4663
+ function roundedMs(value) {
4664
+ return Math.round(value * 1e3) / 1e3;
4665
+ }
4666
+ function phaseEventAttributes(event, spawnCalledAt, attempt) {
4667
+ const attributes = {
4668
+ "cli.attempt": attempt,
4669
+ "cli.phase.elapsed_ms": roundedMs(event.at - spawnCalledAt)
4670
+ };
4671
+ if (event.pid !== void 0) attributes["process.pid"] = event.pid;
4672
+ if (event.exitCode !== void 0 && event.exitCode !== null) attributes["process.exit.code"] = event.exitCode;
4673
+ if (event.signal) attributes["process.exit.signal"] = event.signal;
4674
+ if (event.reason) attributes["cli.phase.reason"] = event.reason;
4675
+ return attributes;
4676
+ }
4677
+ function setObservedDuration(span, key, base, observedAt) {
4678
+ if (observedAt > 0) span.setAttribute(key, roundedMs(observedAt - base));
4679
+ }
4680
+ function executableRealpath(command) {
4681
+ if (!isAbsolute(command)) return null;
4682
+ try {
4683
+ return realpathSync.native(command);
4684
+ } catch {
4685
+ return null;
4686
+ }
4687
+ }
4688
+ function systemLoadAttributes(suffix) {
4689
+ const [oneMinute, fiveMinutes, fifteenMinutes] = loadavg();
4690
+ return {
4691
+ [`system.load.1m.${suffix}`]: oneMinute,
4692
+ [`system.load.5m.${suffix}`]: fiveMinutes,
4693
+ [`system.load.15m.${suffix}`]: fifteenMinutes
4694
+ };
4695
+ }
4159
4696
  function createDeferred() {
4160
4697
  let resolve$1;
4161
4698
  let reject;
@@ -4168,6 +4705,15 @@ function createDeferred() {
4168
4705
  reject
4169
4706
  };
4170
4707
  }
4708
+ function settleWithin(operation, timeout, message) {
4709
+ let timer = null;
4710
+ const timeoutFailure = new Promise((_, reject) => {
4711
+ timer = setTimeout(() => reject(new Error(message)), timeout);
4712
+ });
4713
+ return Promise.race([operation, timeoutFailure]).finally(() => {
4714
+ if (timer) clearTimeout(timer);
4715
+ });
4716
+ }
4171
4717
  /**
4172
4718
  * CLI 执行器
4173
4719
  *
@@ -4176,6 +4722,13 @@ function createDeferred() {
4176
4722
  */
4177
4723
  var CliExecutor = class {
4178
4724
  contracts;
4725
+ bufferedAdmission = new CliBufferedAdmission();
4726
+ bufferedAbortController = new AbortController();
4727
+ activeBufferedCommands = /* @__PURE__ */ new Set();
4728
+ activeBufferedChildren = 0;
4729
+ peakBufferedChildren = 0;
4730
+ disposePromise = null;
4731
+ disposed = false;
4179
4732
  constructor(configManager, projectDir) {
4180
4733
  this.configManager = configManager;
4181
4734
  this.projectDir = projectDir;
@@ -4184,50 +4737,296 @@ var CliExecutor = class {
4184
4737
  async buildCommandArray(args) {
4185
4738
  return [...await this.configManager.getCliCommand(), ...args];
4186
4739
  }
4187
- async runCommandOnce(fullCommand) {
4740
+ async runCommandOnce(fullCommand, traceContext) {
4741
+ if (this.disposed) return {
4742
+ success: false,
4743
+ stdout: "",
4744
+ stderr: "CLI executor is disposed.",
4745
+ exitCode: null,
4746
+ errorCode: "ABORT_ERR"
4747
+ };
4188
4748
  const [cmd, ...cmdArgs] = fullCommand;
4189
- const result = await runBufferedCommand({
4749
+ const isJsonCommand = cmdArgs.includes("--json");
4750
+ const requestedSpawnMode = resolveOpenSpecSpawnMode();
4751
+ let spawnMode = requestedSpawnMode;
4752
+ let workerInvocation = null;
4753
+ let workerFallbackReason = null;
4754
+ if (requestedSpawnMode === "worker") try {
4755
+ workerInvocation = await resolveOpenSpecWorkerInvocation(fullCommand);
4756
+ } catch (error) {
4757
+ if (!(error instanceof OpenSpecCliModuleNotFoundError)) throw error;
4758
+ spawnMode = "process";
4759
+ workerFallbackReason = "module-not-found";
4760
+ traceContext.span.addEvent("cli.worker.fallback", {
4761
+ "cli.worker.fallback.reason": workerFallbackReason,
4762
+ "cli.worker.fallback.message": error.message
4763
+ });
4764
+ }
4765
+ const queuedStats = this.bufferedAdmission.stats();
4766
+ traceContext.span.addEvent("cli.admission.queued", {
4767
+ "cli.concurrent.active": queuedStats.active,
4768
+ "cli.concurrent.waiting": queuedStats.waiting,
4769
+ "cli.concurrent.limit": this.bufferedAdmission.limit
4770
+ });
4771
+ const admission = await this.bufferedAdmission.acquire(this.bufferedAbortController.signal);
4772
+ if (!admission || this.disposed) {
4773
+ admission?.release();
4774
+ traceContext.span.addEvent("cli.admission.cancelled");
4775
+ return {
4776
+ success: false,
4777
+ stdout: "",
4778
+ stderr: "CLI executor is disposed.",
4779
+ exitCode: null,
4780
+ errorCode: "ABORT_ERR"
4781
+ };
4782
+ }
4783
+ this.recordAdmissionEvidence(traceContext.span, admission);
4784
+ traceContext.span.addEvent("cli.admission.acquired", {
4785
+ "cli.concurrent.wait_ms": roundedMs(admission.evidence.waitMs),
4786
+ "cli.concurrent.active_at_enqueue": admission.evidence.activeAtEnqueue,
4787
+ "cli.concurrent.waiting_at_enqueue": admission.evidence.waitingAtEnqueue
4788
+ });
4789
+ traceContext.span.setAttribute("cli.spawn_mode", spawnMode);
4790
+ traceContext.span.setAttribute("cli.spawn_mode.requested", requestedSpawnMode);
4791
+ if (workerFallbackReason) traceContext.span.setAttribute("cli.worker.fallback.reason", workerFallbackReason);
4792
+ const processSpan = trace.getTracer("openspecui-core").startSpan(`cli.${spawnMode} ${traceContext.subcommand}`, { attributes: {
4793
+ "cli.attempt": traceContext.attempt,
4794
+ "cli.cwd": this.projectDir,
4795
+ "cli.executable": cmd,
4796
+ "cli.json": isJsonCommand,
4797
+ "cli.spawn_mode": spawnMode,
4798
+ "cli.spawn_mode.requested": requestedSpawnMode,
4799
+ ...workerFallbackReason ? { "cli.worker.fallback.reason": workerFallbackReason } : {},
4800
+ "cli.concurrent.limit": this.bufferedAdmission.limit,
4801
+ "cli.concurrent.active_at_enqueue": admission.evidence.activeAtEnqueue,
4802
+ "cli.concurrent.waiting_at_enqueue": admission.evidence.waitingAtEnqueue,
4803
+ "cli.concurrent.wait_ms": roundedMs(admission.evidence.waitMs),
4804
+ "process.parent.pid": process.pid,
4805
+ ...systemLoadAttributes("admitted")
4806
+ } }, context.active());
4807
+ const resolvedExecutable = executableRealpath(cmd);
4808
+ if (resolvedExecutable) {
4809
+ processSpan.setAttribute("cli.runner.realpath", resolvedExecutable);
4810
+ traceContext.span.setAttribute("cli.runner.realpath", resolvedExecutable);
4811
+ }
4812
+ let spawnCalledAt = performance$1.now();
4813
+ let childHandleReturned = false;
4814
+ let processCloseObserved = false;
4815
+ let responseDelivered = false;
4816
+ let processSpanEnded = false;
4817
+ let childCounted = false;
4818
+ const executionKind = spawnMode === "process" ? "processes" : "workers";
4819
+ const endProcessSpan = () => {
4820
+ if (processSpanEnded) return;
4821
+ processSpanEnded = true;
4822
+ processSpan.end();
4823
+ };
4824
+ const observePhase = (event) => {
4825
+ if (event.phase === "spawn-called") spawnCalledAt = event.at;
4826
+ if (event.phase === "spawn-returned") {
4827
+ childHandleReturned = true;
4828
+ if (!childCounted) {
4829
+ childCounted = true;
4830
+ this.activeBufferedChildren += 1;
4831
+ this.peakBufferedChildren = Math.max(this.peakBufferedChildren, this.activeBufferedChildren);
4832
+ }
4833
+ }
4834
+ const eventName = `cli.${spawnMode}.${CLI_PHASE_EVENT_SUFFIXES[event.phase]}`;
4835
+ const admissionStats = this.bufferedAdmission.stats();
4836
+ const attributes = {
4837
+ ...phaseEventAttributes(event, spawnCalledAt, traceContext.attempt),
4838
+ "cli.concurrent.active": admissionStats.active,
4839
+ "cli.concurrent.waiting": admissionStats.waiting,
4840
+ "cli.executions.active": this.activeBufferedChildren,
4841
+ "cli.executions.peak": this.peakBufferedChildren,
4842
+ [`cli.${executionKind}.active`]: this.activeBufferedChildren,
4843
+ [`cli.${executionKind}.peak`]: this.peakBufferedChildren
4844
+ };
4845
+ if (event.phase === "spawn-called") Object.assign(attributes, systemLoadAttributes("spawn"));
4846
+ if (event.phase === "first-stdout-observed") Object.assign(attributes, systemLoadAttributes("first_stdout"));
4847
+ if (!responseDelivered) traceContext.span.addEvent(eventName, attributes);
4848
+ processSpan.addEvent(eventName, attributes);
4849
+ if (event.phase === "spawn-returned") {
4850
+ traceContext.span.setAttribute(`cli.${executionKind}.active_at_spawn`, this.activeBufferedChildren);
4851
+ processSpan.setAttribute(`cli.${executionKind}.active_at_spawn`, this.activeBufferedChildren);
4852
+ }
4853
+ if (event.phase === "first-stdout-observed") {
4854
+ traceContext.span.setAttribute(`cli.${executionKind}.active_at_first_stdout`, this.activeBufferedChildren);
4855
+ processSpan.setAttribute(`cli.${executionKind}.active_at_first_stdout`, this.activeBufferedChildren);
4856
+ }
4857
+ if (event.pid !== void 0) processSpan.setAttribute("process.pid", event.pid);
4858
+ if (event.phase === "exit-observed" && event.exitCode !== void 0) processSpan.setAttribute("process.exit.code", event.exitCode ?? -1);
4859
+ if (event.phase === "result-resolved") {
4860
+ responseDelivered = true;
4861
+ processSpan.setAttribute("cli.result.reason", event.reason ?? "unknown");
4862
+ if (!(childHandleReturned && !processCloseObserved && (event.reason === "eager-json" || event.reason === "spawn-error"))) endProcessSpan();
4863
+ }
4864
+ if (event.phase === "close-observed") {
4865
+ processCloseObserved = true;
4866
+ if (childCounted) {
4867
+ childCounted = false;
4868
+ this.activeBufferedChildren -= 1;
4869
+ processSpan.setAttribute(`cli.${executionKind}.active_after_close`, this.activeBufferedChildren);
4870
+ }
4871
+ if (responseDelivered) endProcessSpan();
4872
+ }
4873
+ };
4874
+ const cliEnv = createCleanCliEnv();
4875
+ const command = spawnMode === "worker" && workerInvocation ? runOpenSpecCliWorker({
4876
+ cwd: this.projectDir,
4877
+ env: cliEnv,
4878
+ signal: this.bufferedAbortController.signal,
4879
+ eagerResolveJson: isJsonCommand,
4880
+ invocation: workerInvocation,
4881
+ onModuleResolved: (modulePath) => {
4882
+ processSpan.setAttribute("cli.worker.module", modulePath);
4883
+ traceContext.span.setAttribute("cli.worker.module", modulePath);
4884
+ },
4885
+ onPhase: observePhase
4886
+ }) : runBufferedCommand({
4190
4887
  command: cmd,
4191
4888
  args: cmdArgs,
4192
4889
  cwd: this.projectDir,
4193
- env: createCleanCliEnv()
4890
+ env: cliEnv,
4891
+ signal: this.bufferedAbortController.signal,
4892
+ eagerResolveJson: isJsonCommand,
4893
+ onPhase: observePhase
4894
+ });
4895
+ this.activeBufferedCommands.add(command);
4896
+ const result = await command.finally(() => {
4897
+ this.activeBufferedCommands.delete(command);
4898
+ admission.release();
4194
4899
  });
4195
4900
  if (result.spawnError) return {
4196
4901
  success: false,
4197
4902
  stdout: result.stdout,
4198
4903
  stderr: result.stderr ? `${result.stderr}\n${result.spawnError.message}` : result.spawnError.message,
4199
4904
  exitCode: null,
4200
- errorCode: result.spawnError.code
4905
+ errorCode: result.spawnError.code,
4906
+ phases: result.phases,
4907
+ spawnMode
4201
4908
  };
4202
4909
  return {
4203
4910
  success: result.exitCode === 0,
4204
4911
  stdout: result.stdout,
4205
4912
  stderr: result.stderr,
4206
- exitCode: result.exitCode
4913
+ exitCode: result.exitCode,
4914
+ phases: result.phases,
4915
+ spawnMode
4207
4916
  };
4208
4917
  }
4918
+ recordAdmissionEvidence(span, admission) {
4919
+ span.setAttributes({
4920
+ "cli.cwd": this.projectDir,
4921
+ "cli.concurrent.limit": this.bufferedAdmission.limit,
4922
+ "cli.concurrent.active_at_enqueue": admission.evidence.activeAtEnqueue,
4923
+ "cli.concurrent.waiting_at_enqueue": admission.evidence.waitingAtEnqueue,
4924
+ "cli.concurrent.wait_ms": roundedMs(admission.evidence.waitMs),
4925
+ "process.parent.pid": process.pid,
4926
+ ...systemLoadAttributes("admitted")
4927
+ });
4928
+ }
4209
4929
  async executeInternal(args, allowRetry) {
4930
+ const tracer = trace.getTracer("openspecui-core");
4931
+ const subcommand = args[0] ?? "cli";
4932
+ return tracer.startActiveSpan(`cli.execute ${subcommand}`, async (span) => {
4933
+ const executionStartedAt = performance$1.now();
4934
+ const eventLoopStartedAt = performance$1.eventLoopUtilization();
4935
+ span.setAttribute("cli.args", args.join(" "));
4936
+ try {
4937
+ const result = await this.executeInternalCore(args, allowRetry, span, subcommand);
4938
+ span.setAttribute("cli.exitCode", result.exitCode ?? -1);
4939
+ span.setAttribute("cli.attempts", result.attempts ?? 1);
4940
+ const phases = result.phases;
4941
+ if (phases) {
4942
+ const base = phases.spawnCalledAt;
4943
+ span.setAttribute("cli.eagerResolved", phases.eagerResolved);
4944
+ span.setAttribute("cli.result.reason", phases.resultReason ?? "unknown");
4945
+ setObservedDuration(span, "cli.ms.spawnCall", base, phases.spawnReturnedAt);
4946
+ setObservedDuration(span, "cli.ms.spawnObserved", base, phases.spawnObservedAt);
4947
+ setObservedDuration(span, "cli.ms.firstStdoutObserved", base, phases.firstStdoutAt);
4948
+ setObservedDuration(span, "cli.ms.firstStderrObserved", base, phases.firstStderrAt);
4949
+ setObservedDuration(span, "cli.ms.jsonCompleteObserved", base, phases.jsonCompleteAt);
4950
+ setObservedDuration(span, "cli.ms.terminationRequested", base, phases.terminationRequestedAt);
4951
+ setObservedDuration(span, "cli.ms.resultResolved", base, phases.resultResolvedAt);
4952
+ setObservedDuration(span, "cli.ms.exitObserved", base, phases.exitAt);
4953
+ setObservedDuration(span, "cli.ms.closeObserved", base, phases.closeAt);
4954
+ const spawnMode = result.spawnMode ?? resolveOpenSpecSpawnMode();
4955
+ span.setAttribute(`cli.${spawnMode}.exitObservedBeforeResult`, phases.exitAt > 0 && phases.exitAt <= phases.resultResolvedAt);
4956
+ span.setAttribute(`cli.${spawnMode}.closeObservedBeforeResult`, phases.closeAt > 0 && phases.closeAt <= phases.resultResolvedAt);
4957
+ if (phases.exitAt && phases.closeAt) span.setAttribute("cli.ms.exitToCloseObserved", roundedMs(phases.closeAt - phases.exitAt));
4958
+ }
4959
+ if (!result.success) span.setStatus({
4960
+ code: 2,
4961
+ message: result.stderr || `exit ${result.exitCode}`
4962
+ });
4963
+ return result;
4964
+ } catch (err) {
4965
+ span.recordException(err instanceof Error ? err : String(err));
4966
+ span.setStatus({
4967
+ code: 2,
4968
+ message: err instanceof Error ? err.message : String(err)
4969
+ });
4970
+ throw err;
4971
+ } finally {
4972
+ const eventLoop = performance$1.eventLoopUtilization(eventLoopStartedAt);
4973
+ span.setAttributes({
4974
+ "cli.ms.response": roundedMs(performance$1.now() - executionStartedAt),
4975
+ "cli.event_loop.utilization": eventLoop.utilization,
4976
+ "cli.ms.event_loop_active": roundedMs(eventLoop.active),
4977
+ "cli.ms.event_loop_idle": roundedMs(eventLoop.idle)
4978
+ });
4979
+ span.end();
4980
+ }
4981
+ });
4982
+ }
4983
+ async executeInternalCore(args, allowRetry, span, subcommand, attempt = 1) {
4210
4984
  let fullCommand;
4985
+ const runnerResolveStartedAt = performance$1.now();
4211
4986
  try {
4212
4987
  fullCommand = await this.buildCommandArray(args);
4213
4988
  } catch (err) {
4989
+ span.addEvent("cli.runner.resolve.error", {
4990
+ "cli.attempt": attempt,
4991
+ "cli.ms.runnerResolve": roundedMs(performance$1.now() - runnerResolveStartedAt)
4992
+ });
4214
4993
  return {
4215
4994
  success: false,
4216
4995
  stdout: "",
4217
4996
  stderr: err instanceof Error ? err.message : String(err),
4218
- exitCode: null
4997
+ exitCode: null,
4998
+ attempts: attempt
4219
4999
  };
4220
5000
  }
4221
- const result = await this.runCommandOnce(fullCommand);
5001
+ const runnerResolveMs = roundedMs(performance$1.now() - runnerResolveStartedAt);
5002
+ span.setAttribute("cli.ms.runnerResolve", runnerResolveMs);
5003
+ span.setAttribute("cli.executable", fullCommand[0] ?? "");
5004
+ span.addEvent("cli.runner.resolved", {
5005
+ "cli.attempt": attempt,
5006
+ "cli.ms.runnerResolve": runnerResolveMs,
5007
+ "cli.executable": fullCommand[0] ?? ""
5008
+ });
5009
+ const result = await this.runCommandOnce(fullCommand, {
5010
+ span,
5011
+ attempt,
5012
+ subcommand
5013
+ });
4222
5014
  if (allowRetry && result.errorCode === "ENOENT") {
5015
+ span.addEvent("cli.runner.retry", {
5016
+ "cli.attempt": attempt,
5017
+ "cli.retry.reason": "ENOENT"
5018
+ });
4223
5019
  this.configManager.invalidateResolvedCliRunner();
4224
- return this.executeInternal(args, false);
5020
+ return this.executeInternalCore(args, false, span, subcommand, attempt + 1);
4225
5021
  }
4226
5022
  return {
4227
5023
  success: result.success,
4228
5024
  stdout: result.stdout,
4229
5025
  stderr: result.stderr,
4230
- exitCode: result.exitCode
5026
+ exitCode: result.exitCode,
5027
+ phases: result.phases,
5028
+ spawnMode: result.spawnMode,
5029
+ attempts: attempt
4231
5030
  };
4232
5031
  }
4233
5032
  /**
@@ -4236,6 +5035,15 @@ var CliExecutor = class {
4236
5035
  async execute(args) {
4237
5036
  return this.executeInternal(args, true);
4238
5037
  }
5038
+ /** Cancel and await every buffered CLI child owned by this executor. */
5039
+ dispose() {
5040
+ if (this.disposePromise) return this.disposePromise;
5041
+ this.disposed = true;
5042
+ this.bufferedAbortController.abort();
5043
+ const activeCommands = [...this.activeBufferedCommands];
5044
+ this.disposePromise = Promise.allSettled(activeCommands).then(() => void 0);
5045
+ return this.disposePromise;
5046
+ }
4239
5047
  /**
4240
5048
  * 执行 openspec init(非交互式)
4241
5049
  */
@@ -4311,27 +5119,56 @@ var CliExecutor = class {
4311
5119
  * 检查 CLI 是否可用
4312
5120
  */
4313
5121
  async checkAvailability(timeout = 1e4) {
4314
- try {
4315
- const resolved = await Promise.race([this.configManager.getResolvedCliRunner(), new Promise((_, reject) => setTimeout(() => reject(/* @__PURE__ */ new Error("CLI runner resolve timed out")), timeout))]);
4316
- const versionResult = await Promise.race([this.runCommandOnce([...resolved.commandParts, "--version"]), new Promise((_, reject) => setTimeout(() => reject(/* @__PURE__ */ new Error("CLI check timed out")), timeout))]);
4317
- if (versionResult.success) return {
4318
- available: true,
4319
- version: versionResult.stdout.trim() || resolved.version,
4320
- effectiveCommand: resolved.command,
4321
- tried: resolved.attempts.map((attempt) => attempt.command)
4322
- };
4323
- return {
4324
- available: false,
4325
- error: versionResult.stderr || "Unknown error",
4326
- effectiveCommand: resolved.command,
4327
- tried: resolved.attempts.map((attempt) => attempt.command)
4328
- };
4329
- } catch (err) {
4330
- return {
4331
- available: false,
4332
- error: err instanceof Error ? err.message : String(err)
4333
- };
4334
- }
5122
+ return trace.getTracer("openspecui-core").startActiveSpan("cli.checkAvailability", async (span) => {
5123
+ const checkStartedAt = performance$1.now();
5124
+ const eventLoopStartedAt = performance$1.eventLoopUtilization();
5125
+ try {
5126
+ const runnerResolveStartedAt = performance$1.now();
5127
+ const resolved = await settleWithin(this.configManager.getResolvedCliRunner(), timeout, "CLI runner resolve timed out");
5128
+ const runnerResolveMs = roundedMs(performance$1.now() - runnerResolveStartedAt);
5129
+ span.setAttribute("cli.triedCount", resolved.attempts.length);
5130
+ span.setAttribute("cli.ms.runnerResolve", runnerResolveMs);
5131
+ span.setAttribute("cli.executable", resolved.commandParts[0] ?? "");
5132
+ span.addEvent("cli.runner.resolved", {
5133
+ "cli.ms.runnerResolve": runnerResolveMs,
5134
+ "cli.executable": resolved.commandParts[0] ?? "",
5135
+ "cli.runner.attempts": resolved.attempts.length
5136
+ });
5137
+ const versionResult = await settleWithin(this.runCommandOnce([...resolved.commandParts, "--version"], {
5138
+ span,
5139
+ attempt: 1,
5140
+ subcommand: "check-availability"
5141
+ }), timeout, "CLI check timed out");
5142
+ span.setAttribute("cli.available", versionResult.success);
5143
+ if (versionResult.success) return {
5144
+ available: true,
5145
+ version: versionResult.stdout.trim() || resolved.version,
5146
+ effectiveCommand: resolved.command,
5147
+ tried: resolved.attempts.map((attempt) => attempt.command)
5148
+ };
5149
+ return {
5150
+ available: false,
5151
+ error: versionResult.stderr || "Unknown error",
5152
+ effectiveCommand: resolved.command,
5153
+ tried: resolved.attempts.map((attempt) => attempt.command)
5154
+ };
5155
+ } catch (err) {
5156
+ span.setAttribute("cli.available", false);
5157
+ return {
5158
+ available: false,
5159
+ error: err instanceof Error ? err.message : String(err)
5160
+ };
5161
+ } finally {
5162
+ const eventLoop = performance$1.eventLoopUtilization(eventLoopStartedAt);
5163
+ span.setAttributes({
5164
+ "cli.ms.response": roundedMs(performance$1.now() - checkStartedAt),
5165
+ "cli.event_loop.utilization": eventLoop.utilization,
5166
+ "cli.ms.event_loop_active": roundedMs(eventLoop.active),
5167
+ "cli.ms.event_loop_idle": roundedMs(eventLoop.idle)
5168
+ });
5169
+ span.end();
5170
+ }
5171
+ });
4335
5172
  }
4336
5173
  /**
4337
5174
  * 流式执行 CLI 命令
@@ -4798,9 +5635,9 @@ function publicCommandEvidence(evidence) {
4798
5635
  ...evidence.contractError ? { contractError: evidence.contractError } : {}
4799
5636
  };
4800
5637
  }
4801
- function createRootContext(options, cli, doctor, context, observedAt) {
5638
+ function createRootContext(options, cli, doctor, context$1, observedAt) {
4802
5639
  const doctorData = doctor?.data ?? null;
4803
- const contextData = context?.data ?? null;
5640
+ const contextData = context$1?.data ?? null;
4804
5641
  const planningRoot = doctorData?.root ?? null;
4805
5642
  return {
4806
5643
  launchProject: {
@@ -4816,11 +5653,11 @@ function createRootContext(options, cli, doctor, context, observedAt) {
4816
5653
  diagnostics: {
4817
5654
  root: planningRoot?.status ?? [],
4818
5655
  doctor: doctorData?.status ?? doctor?.diagnostics ?? [],
4819
- context: contextData?.status ?? context?.diagnostics ?? []
5656
+ context: contextData?.status ?? context$1?.diagnostics ?? []
4820
5657
  },
4821
5658
  evidence: {
4822
5659
  doctor: publicCommandEvidence(doctor),
4823
- context: publicCommandEvidence(context)
5660
+ context: publicCommandEvidence(context$1)
4824
5661
  },
4825
5662
  observedAt
4826
5663
  };
@@ -4837,10 +5674,10 @@ function errorState(attempt, code, message) {
4837
5674
  observedAt: attempt.observedAt
4838
5675
  };
4839
5676
  }
4840
- function rootsMatch(doctor, context) {
4841
- 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);
5677
+ function rootsMatch(doctor, context$1) {
5678
+ 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);
4842
5679
  }
4843
- function classifyRootContext(attempt, doctor, context) {
5680
+ function classifyRootContext(attempt, doctor, context$1) {
4844
5681
  const { cli, planningRoot, references } = attempt;
4845
5682
  if (!cli.available) return errorState(attempt, "cli-unavailable", cli.error ?? "OpenSpec CLI is unavailable.");
4846
5683
  if (!doctor) return errorState(attempt, "resolver-failed", "OpenSpec Doctor did not return command evidence.");
@@ -4848,10 +5685,10 @@ function classifyRootContext(attempt, doctor, context) {
4848
5685
  if (!doctor.success) return errorState(attempt, "doctor-command-failed", commandMessage(doctor, "OpenSpec Doctor failed."));
4849
5686
  if (!planningRoot) return errorState(attempt, "root-unresolved", "OpenSpec Doctor did not resolve a planning root.");
4850
5687
  if (!planningRoot.healthy) return errorState(attempt, "root-unhealthy", planningRoot.status.map((diagnostic) => diagnostic.message).join("\n") || "OpenSpec Doctor reported an unhealthy planning root.");
4851
- if (!context) return errorState(attempt, "resolver-failed", "OpenSpec Context did not return command evidence.");
4852
- if (context.contractError) return errorState(attempt, "context-contract-drift", commandMessage(context, "OpenSpec Context returned an incompatible payload."));
4853
- if (!context.success) return errorState(attempt, "context-command-failed", commandMessage(context, "OpenSpec Context failed."));
4854
- 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.");
5688
+ if (!context$1) return errorState(attempt, "resolver-failed", "OpenSpec Context did not return command evidence.");
5689
+ if (context$1.contractError) return errorState(attempt, "context-contract-drift", commandMessage(context$1, "OpenSpec Context returned an incompatible payload."));
5690
+ if (!context$1.success) return errorState(attempt, "context-command-failed", commandMessage(context$1, "OpenSpec Context failed."));
5691
+ 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.");
4855
5692
  const failedReference = references.flatMap((reference) => reference.status).find((diagnostic) => diagnostic.severity === "error");
4856
5693
  if (failedReference) return errorState(attempt, "references-unresolved", failedReference.message);
4857
5694
  return {
@@ -4881,15 +5718,15 @@ async function resolveRootContext(options) {
4881
5718
  const selector = {};
4882
5719
  const [doctorSettled, contextSettled] = await Promise.allSettled([options.cliExecutor.contracts.doctorRoot(selector), options.cliExecutor.contracts.context(selector)]);
4883
5720
  const doctor = doctorSettled.status === "fulfilled" ? doctorSettled.value : null;
4884
- const context = contextSettled.status === "fulfilled" ? contextSettled.value : null;
4885
- const attempt = createRootContext(options, cli, doctor, context, observedAt);
5721
+ const context$1 = contextSettled.status === "fulfilled" ? contextSettled.value : null;
5722
+ const attempt = createRootContext(options, cli, doctor, context$1, observedAt);
4886
5723
  if (doctorSettled.status === "rejected" || contextSettled.status === "rejected") {
4887
5724
  let failure;
4888
5725
  if (doctorSettled.status === "rejected") failure = doctorSettled.reason;
4889
5726
  else if (contextSettled.status === "rejected") failure = contextSettled.reason;
4890
5727
  return errorState(attempt, "resolver-failed", failure instanceof Error ? failure.message : String(failure));
4891
5728
  }
4892
- return classifyRootContext(attempt, doctor, context);
5729
+ return classifyRootContext(attempt, doctor, context$1);
4893
5730
  }
4894
5731
 
4895
5732
  //#endregion
@@ -5649,10 +6486,26 @@ function snapshotHasAbsolutePath(snapshot) {
5649
6486
  return /\b(?:\/[\w.\-@]+){2,}/.test(text) || /[A-Za-z]:\//.test(text);
5650
6487
  }
5651
6488
 
6489
+ //#endregion
6490
+ //#region src/cli-projection-sequence.ts
6491
+ /**
6492
+ * Orthogonal intents (created 2026-07-31 Asia/Shanghai):
6493
+ * 1. Submit aggregate CLI projection entities lazily while preserving source order.
6494
+ * 2. Prevent one aggregate read from pre-filling the shared buffered CLI admission queue.
6495
+ *
6496
+ * Original request (2026-07-31): "系统性地进行修复,因为List页面也有类似的问题。所有可能其它页面都有类似的问题。"
6497
+ */
6498
+ /** Map CLI-backed projection entities in order, admitting only the current entity. */
6499
+ async function mapCliProjectionSeries(inputs, project) {
6500
+ const outputs = [];
6501
+ for (const [index, input] of inputs.entries()) outputs.push(await project(input, index));
6502
+ return outputs;
6503
+ }
6504
+
5652
6505
  //#endregion
5653
6506
  //#region src/opsx-kernel.ts
5654
6507
  /**
5655
- * Orthogonal intents (updated 2026-07-27 Asia/Shanghai):
6508
+ * Orthogonal intents (updated 2026-07-31 Asia/Shanghai):
5656
6509
  * 1. Maintain reactive CLI-backed projections and their direct typed Projection Work readers.
5657
6510
  * 2. Share and release per-entity streams through one planning-root kernel lifecycle.
5658
6511
  * 3. Keep OpenSpec configuration ownership outside the workflow projection cache.
@@ -5662,6 +6515,7 @@ function snapshotHasAbsolutePath(snapshot) {
5662
6515
  * Original request (2026-07-15): "Planning-root adapters and services consume the CLI-resolved root."
5663
6516
  * Original request (2026-07-23): "OPSX Status 不应等待完整 Kernel warmup,且必须保留 CLI evidence。"
5664
6517
  * Original request (2026-07-26): "展开全面的接口升级和内核升级和测试升级。"
6518
+ * Original request (2026-07-31): "系统性地进行修复,因为List页面也有类似的问题。所有可能其它页面都有类似的问题。"
5665
6519
  */
5666
6520
  function toRelativePath(root, absolutePath) {
5667
6521
  return relative(root, absolutePath).split(sep).join("/");
@@ -5935,6 +6789,15 @@ var OpsxKernel = class {
5935
6789
  if (!state) throw new Error(`Schema yaml not found for "${name}"`);
5936
6790
  return state.get();
5937
6791
  }
6792
+ /** Non-throwing schema detail read; returns null when the schema is not yet loaded. */
6793
+ tryGetSchemaDetail(name) {
6794
+ return this.peekSchemaDetail(name);
6795
+ }
6796
+ /** Non-throwing schema yaml read; returns null when the schema is not yet loaded. */
6797
+ tryGetSchemaYaml(name) {
6798
+ const state = this._schemaYamls.get(name);
6799
+ return state ? state.get() : null;
6800
+ }
5938
6801
  getChangeMetadata(changeId) {
5939
6802
  const state = this._changeMetadata.get(changeId);
5940
6803
  if (!state) return null;
@@ -5954,11 +6817,11 @@ var OpsxKernel = class {
5954
6817
  }
5955
6818
  startStream(state, task, signal) {
5956
6819
  return new Promise((resolve$1, reject) => {
5957
- const context = new ReactiveContext();
6820
+ const context$1 = new ReactiveContext();
5958
6821
  let first = true;
5959
6822
  (async () => {
5960
6823
  try {
5961
- for await (const data of context.stream(task, signal)) {
6824
+ for await (const data of context$1.stream(task, signal)) {
5962
6825
  state.set(data);
5963
6826
  if (first) {
5964
6827
  first = false;
@@ -6040,11 +6903,11 @@ var OpsxKernel = class {
6040
6903
  }));
6041
6904
  }
6042
6905
  watchSchemaChanges(signal) {
6043
- const context = new ReactiveContext();
6906
+ const context$1 = new ReactiveContext();
6044
6907
  (async () => {
6045
6908
  let prevNames = new Set(this._schemas.get().map((s) => s.name));
6046
6909
  try {
6047
- for await (const schemas of context.stream(() => Promise.resolve(this._schemas.get()), signal)) {
6910
+ for await (const schemas of context$1.stream(() => Promise.resolve(this._schemas.get()), signal)) {
6048
6911
  const newNames = new Set(schemas.map((s) => s.name));
6049
6912
  for (const name of newNames) if (!prevNames.has(name)) this.warmupSchema(name, signal).catch(() => {});
6050
6913
  for (const name of prevNames) if (!newNames.has(name)) {
@@ -6063,11 +6926,11 @@ var OpsxKernel = class {
6063
6926
  })();
6064
6927
  }
6065
6928
  watchChangeIdChanges(signal) {
6066
- const context = new ReactiveContext();
6929
+ const context$1 = new ReactiveContext();
6067
6930
  (async () => {
6068
6931
  let prevIds = new Set(this._changeIds.get());
6069
6932
  try {
6070
- for await (const ids of context.stream(() => Promise.resolve(this._changeIds.get()), signal)) {
6933
+ for await (const ids of context$1.stream(() => Promise.resolve(this._changeIds.get()), signal)) {
6071
6934
  const newIds = new Set(ids);
6072
6935
  for (const id of newIds) if (!prevIds.has(id)) this.warmupChange(id, signal).catch(() => {});
6073
6936
  for (const id of prevIds) if (!newIds.has(id)) {
@@ -6175,7 +7038,7 @@ var OpsxKernel = class {
6175
7038
  async fetchStatusList() {
6176
7039
  await this.ensureChangeIds();
6177
7040
  const changeIds = this._changeIds.get();
6178
- await Promise.all(changeIds.map((id) => this.ensureStatus(id)));
7041
+ await mapCliProjectionSeries(changeIds, (id) => this.ensureStatus(id));
6179
7042
  return changeIds.map((id) => this.getStatus(id));
6180
7043
  }
6181
7044
  async fetchInstructions(changeId, artifact, schema) {
@@ -6316,7 +7179,7 @@ var OpsxKernel = class {
6316
7179
  async readStatusListProjection() {
6317
7180
  const changeList = await this.fetchChangeListProjection();
6318
7181
  return {
6319
- value: await Promise.all(changeList.value.map((changeId) => this.fetchStatus(changeId))),
7182
+ value: await mapCliProjectionSeries(changeList.value, (changeId) => this.fetchStatus(changeId)),
6320
7183
  evidence: changeList.evidence
6321
7184
  };
6322
7185
  }
@@ -6331,14 +7194,14 @@ var OpsxKernel = class {
6331
7194
  /** Execute the aggregate Schema bundle while retaining exact resolved-file dependencies. */
6332
7195
  async readConfigBundleProjection() {
6333
7196
  const schemasProjection = await this.fetchSchemasProjection();
6334
- const details = await Promise.all(schemasProjection.value.map(async ({ name }) => {
7197
+ const details = await mapCliProjectionSeries(schemasProjection.value, async ({ name }) => {
6335
7198
  const resolution = await this.fetchSchemaResolutionProjection(name);
6336
7199
  return {
6337
7200
  name,
6338
7201
  detail: await this.fetchSchemaDetailAtResolution(name, resolution.value).catch(() => null),
6339
7202
  resolution
6340
7203
  };
6341
- }));
7204
+ });
6342
7205
  return {
6343
7206
  value: {
6344
7207
  schemas: schemasProjection.value,
@@ -6650,4 +7513,4 @@ const PtyServerMessageSchema = z.discriminatedUnion("type", [
6650
7513
  ]);
6651
7514
 
6652
7515
  //#endregion
6653
- 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 };
7516
+ 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, SERVE_PRESENTATION_MODES, SERVICE_TRANSLATION_ENGINE_IDS, SILENT_SOUND_ID, ScenarioStepKeywordSchema, ScenarioStepSchema, SchemaArtifactSchema, SchemaDetailSchema, SchemaInfoSchema, SchemaResolutionSchema, ServePresentationModeSchema, 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 };