@openspecui/core 5.0.0 → 6.0.0-beta.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 (116) hide show
  1. package/dist/cli-projection-DxnVGm2B.d.mts +789 -0
  2. package/dist/cli-projection-vO3-FJg5.mjs +161 -0
  3. package/dist/cli-projection.d.mts +6 -0
  4. package/dist/cli-projection.mjs +4 -0
  5. package/dist/command-result-fkH3Ekdz.d.mts +8477 -0
  6. package/dist/common-D8YUK9dA.mjs +57 -0
  7. package/dist/dashboard-summary-transport-CQ4is5_e.d.mts +66227 -0
  8. package/dist/dashboard-summary-transport-D2VBAIxg.mjs +175 -0
  9. package/dist/dashboard-summary-transport.d.mts +25 -0
  10. package/dist/dashboard-summary-transport.mjs +6 -0
  11. package/dist/{document-translation-D4YK18I3.mjs → document-translation-CeJFGMoy.mjs} +1 -1
  12. package/dist/{document-translation-7R8cf8_B.d.mts → document-translation-D50BnvVh.d.mts} +2 -2
  13. package/dist/document-translation.d.mts +1 -1
  14. package/dist/document-translation.mjs +2 -2
  15. package/dist/{hosted-app-CzMRiEgY.mjs → hosted-app-BPU4OR41.mjs} +31 -9
  16. package/dist/hosted-app.d.mts +25 -2
  17. package/dist/hosted-app.mjs +7 -2
  18. package/dist/hosted-contract-CcRnb51e.mjs +234 -0
  19. package/dist/hosted-contract.d.mts +25 -0
  20. package/dist/hosted-contract.mjs +7 -0
  21. package/dist/index.d.mts +25 -2686
  22. package/dist/index.mjs +2114 -1098
  23. package/dist/{local-download-profiles-caa4PECd.d.mts → local-download-profiles-BL_rtlVM.d.mts} +1 -1
  24. package/dist/local-download-profiles.d.mts +2 -2
  25. package/dist/local-download-profiles.mjs +1 -1
  26. package/dist/markdown-facts.d.mts +1 -1
  27. package/dist/markdown-facts.mjs +1 -1
  28. package/dist/{markdown-reading-CgXuXp6s.d.mts → markdown-reading-LUdqfbxH.d.mts} +1 -1
  29. package/dist/{markdown-reading-DdcB7run.mjs → markdown-reading-mG4OAbDO.mjs} +1 -1
  30. package/dist/markdown-reading.d.mts +2 -2
  31. package/dist/markdown-reading.mjs +2 -2
  32. package/dist/{notifications-AKAcmeKT.mjs → notifications-C2bxAzX_.mjs} +13 -2
  33. package/dist/{notifications-DZeOl4HV.d.mts → notifications-CgJlLgLO.d.mts} +51 -25
  34. package/dist/notifications.d.mts +2 -2
  35. package/dist/notifications.mjs +3 -3
  36. package/dist/{openspec-annotations-CeXd0JIZ.d.mts → openspec-annotations-C58Aoi-V.d.mts} +2 -2
  37. package/dist/{openspec-annotations-D_6Pz7k4.mjs → openspec-annotations-DCfqBMal.mjs} +2 -2
  38. package/dist/openspec-annotations.d.mts +3 -3
  39. package/dist/openspec-annotations.mjs +3 -3
  40. package/dist/openspec-compat.d.mts +18 -11
  41. package/dist/openspec-compat.mjs +20 -13
  42. package/dist/{openspec-projection-B8s-KWQ7.mjs → openspec-projection-DCgToo0Q.mjs} +2 -2
  43. package/dist/{openspec-projection-B0ch1rZw.d.mts → openspec-projection-RohNZI4p.d.mts} +3 -3
  44. package/dist/openspec-projection.d.mts +5 -5
  45. package/dist/openspec-projection.mjs +4 -4
  46. package/dist/opsx-display-path.d.mts +1 -1
  47. package/dist/opsx-display-path.mjs +1 -1
  48. package/dist/{opsx-entity-DZyl-uhQ.d.mts → opsx-entity-D7kDQsze.d.mts} +2 -2
  49. package/dist/opsx-entity.d.mts +7 -3
  50. package/dist/opsx-entity.mjs +1 -1
  51. package/dist/{opsx-schema-detail-CS0tWa9v.d.mts → opsx-schema-detail-BxDXEwDY.d.mts} +2 -2
  52. package/dist/opsx-schema-detail.d.mts +8 -4
  53. package/dist/opsx-schema-detail.mjs +1 -1
  54. package/dist/opsx-types-BJ8AjhrS.d.mts +3642 -0
  55. package/dist/opsx-workflows-BvnJqjfL.d.mts +36 -0
  56. package/dist/opsx-workflows-Ccc6U7IR.mjs +89 -0
  57. package/dist/opsx-workflows.d.mts +2 -0
  58. package/dist/opsx-workflows.mjs +3 -0
  59. package/dist/planning-cli-projection-DIRxeq2H.mjs +421 -0
  60. package/dist/planning-cli-projection.d.mts +25 -0
  61. package/dist/planning-cli-projection.mjs +9 -0
  62. package/dist/schemas-BFroDdOC.mjs +287 -0
  63. package/dist/{schemas-D01aQnV4.d.mts → schemas-DS-JqAJ2.d.mts} +524 -78
  64. package/dist/{sounds-kgDn4x8v.d.mts → sounds-qhRgCy0F.d.mts} +12 -12
  65. package/dist/sounds.d.mts +1 -1
  66. package/dist/sounds.mjs +1 -1
  67. package/dist/spec-catalog-ZGuiZ4CE.mjs +901 -0
  68. package/dist/spec-catalog.d.mts +25 -0
  69. package/dist/spec-catalog.mjs +6 -0
  70. package/dist/store-mutation-protocol-5tfs-RmD.d.mts +727 -0
  71. package/dist/store-mutation-protocol-CSwD-xPO.mjs +63 -0
  72. package/dist/store-mutation-protocol.d.mts +2 -0
  73. package/dist/store-mutation-protocol.mjs +4 -0
  74. package/dist/{store-types-Cu41QSww.mjs → store-types-DlX1REBg.mjs} +39 -18
  75. package/dist/{store-types-BiE-Ey--.d.mts → store-types-b554wAQJ.d.mts} +22 -12
  76. package/dist/store-types.d.mts +6 -2
  77. package/dist/store-types.mjs +2 -2
  78. package/dist/task-progress-B_IWVXjA.mjs +216 -0
  79. package/dist/task-progress.d.mts +7 -4
  80. package/dist/task-progress.mjs +3 -3
  81. package/dist/{terminal-audio-TBoU2jSK.mjs → terminal-audio-d6KItUeJ.mjs} +1 -1
  82. package/dist/{terminal-audio-CsuGTNV-.d.mts → terminal-audio-tXDm_EDe.d.mts} +1 -1
  83. package/dist/terminal-audio.d.mts +2 -2
  84. package/dist/terminal-audio.mjs +2 -2
  85. package/dist/terminal-control.d.mts +2 -2
  86. package/dist/terminal-control.mjs +1 -1
  87. package/dist/{terminal-invocation-BlFwKpIc.d.mts → terminal-invocation-BOvxThym.d.mts} +239 -120
  88. package/dist/terminal-invocation.d.mts +1 -1
  89. package/dist/terminal-invocation.mjs +1 -1
  90. package/dist/terminal-theme.d.mts +1 -1
  91. package/dist/terminal-theme.mjs +1 -1
  92. package/dist/translation-language-pair.d.mts +1 -1
  93. package/dist/translation-language-pair.mjs +1 -1
  94. package/dist/{translator-BErXgQxx.d.mts → translator-NKv1wo3o.d.mts} +86 -86
  95. package/dist/translator.d.mts +1 -1
  96. package/dist/translator.mjs +1 -1
  97. package/package.json +55 -7
  98. package/dist/hosted-app-DHs94gIR.d.mts +0 -43
  99. package/dist/opsx-types-Dnb06uff.d.mts +0 -402
  100. package/dist/task-progress-C1TGMbIR.d.mts +0 -24
  101. package/dist/task-progress-DhHYHnTv.mjs +0 -70
  102. /package/dist/{local-download-profiles-kpNEcdF_.mjs → local-download-profiles-odzOdf96.mjs} +0 -0
  103. /package/dist/{markdown-facts-BBCTe_qq.mjs → markdown-facts-BUqLvFRf.mjs} +0 -0
  104. /package/dist/{markdown-facts-Dk7FKaaT.d.mts → markdown-facts-CCw3QdbM.d.mts} +0 -0
  105. /package/dist/{opsx-display-path-CUCOrHcM.mjs → opsx-display-path-D13XV20v.mjs} +0 -0
  106. /package/dist/{opsx-display-path-cIMKa1aw.d.mts → opsx-display-path-RXS5JTbV.d.mts} +0 -0
  107. /package/dist/{opsx-entity-c7m5CbgU.mjs → opsx-entity-Cn_Zu1J3.mjs} +0 -0
  108. /package/dist/{opsx-schema-detail-BH82X6aU.mjs → opsx-schema-detail-Beis4Ba2.mjs} +0 -0
  109. /package/dist/{sounds-CB3ubSnj.mjs → sounds-NXwveBqq.mjs} +0 -0
  110. /package/dist/{terminal-control-VpTuh17B.mjs → terminal-control-BSAlOTs8.mjs} +0 -0
  111. /package/dist/{terminal-invocation-C2MCNBhK.mjs → terminal-invocation-0p-j2eSP.mjs} +0 -0
  112. /package/dist/{terminal-theme-cevliJw2.mjs → terminal-theme-B8iRttTR.mjs} +0 -0
  113. /package/dist/{terminal-theme-hvQjTsNh.d.mts → terminal-theme-m3MSGJ7U.d.mts} +0 -0
  114. /package/dist/{translation-language-pair-DZ_WNp_M.mjs → translation-language-pair-Bbhk-LAC.mjs} +0 -0
  115. /package/dist/{translation-language-pair-DmaOfHqD.d.mts → translation-language-pair-C18GPATW.d.mts} +0 -0
  116. /package/dist/{translator-DbUT1Ayn.mjs → translator-Cjtv4tya.mjs} +0 -0
@@ -0,0 +1,63 @@
1
+ import { n as CliDiagnosticSchema } from "./common-D8YUK9dA.mjs";
2
+ import { z } from "zod";
3
+
4
+ //#region src/store-mutation-protocol.ts
5
+ /**
6
+ * Orthogonal intents (created 2026-07-24 Asia/Shanghai):
7
+ * 1. Runtime-decode the browser-visible Store mutation lifecycle records.
8
+ * 2. Preserve correlated start/rejoin and lifecycle stream envelopes.
9
+ * 3. Keep Store mutation transport separate from Store inventory and Root projections.
10
+ *
11
+ * Original request (2026-07-24): "apply openspec-change: close-openspec-cli16-delivery-gaps"
12
+ *
13
+ * This intentionally covers only the P3-A mutation protocol. Health, Store inventory, Doctor, and Root
14
+ * Context envelopes remain separate P4 work.
15
+ */
16
+ /** Browser-safe runtime schema for terminal CLI evidence retained by a Store mutation. */
17
+ const StoreMutationResultSchema = z.object({
18
+ exitStatus: z.number().int().nullable(),
19
+ stdout: z.string().optional(),
20
+ stderr: z.string().optional(),
21
+ diagnostics: z.array(CliDiagnosticSchema).optional(),
22
+ payload: z.unknown().optional(),
23
+ contractError: z.string().optional()
24
+ });
25
+ const StoreMutationRecordSchema = z.object({
26
+ requestId: z.string().min(1),
27
+ envUri: z.string().min(1),
28
+ kind: z.enum([
29
+ "setup",
30
+ "register",
31
+ "unregister",
32
+ "remove"
33
+ ]),
34
+ storeId: z.string().min(1).optional(),
35
+ observedAt: z.number().int().nonnegative()
36
+ });
37
+ /** Browser-safe correlated schema for one Server-owned Store mutation record. */
38
+ const StoreMutationSchema = z.discriminatedUnion("status", [StoreMutationRecordSchema.extend({
39
+ status: z.enum(["accepted", "running"]),
40
+ result: z.undefined().optional()
41
+ }), StoreMutationRecordSchema.extend({
42
+ status: z.enum([
43
+ "succeeded",
44
+ "failed",
45
+ "indeterminate"
46
+ ]),
47
+ result: StoreMutationResultSchema
48
+ })]);
49
+ /** Runtime-decoded response for a mutation admission or a request-id rejoin. */
50
+ const StoreMutationStartResponseSchema = StoreMutationSchema.and(z.object({ rejoined: z.boolean() }));
51
+ /** Runtime-decoded Server lifecycle stream: a complete local-ledger snapshot or one changed record. */
52
+ const StoreMutationLifecycleEventSchema = z.discriminatedUnion("type", [z.object({
53
+ type: z.literal("snapshot"),
54
+ cursor: z.number().int().nonnegative(),
55
+ records: z.array(StoreMutationSchema)
56
+ }), z.object({
57
+ type: z.literal("changed"),
58
+ cursor: z.number().int().nonnegative(),
59
+ record: StoreMutationSchema
60
+ })]);
61
+
62
+ //#endregion
63
+ export { StoreMutationStartResponseSchema as i, StoreMutationResultSchema as n, StoreMutationSchema as r, StoreMutationLifecycleEventSchema as t };
@@ -0,0 +1,2 @@
1
+ import { a as StoreMutationResultSchema, c as StoreMutationStartResponseSchema, i as StoreMutationResultEnvelope, n as StoreMutationLifecycleEvent, o as StoreMutationSchema, r as StoreMutationLifecycleEventSchema, s as StoreMutationStartResponse, t as StoreMutationEnvelope } from "./store-mutation-protocol-5tfs-RmD.mjs";
2
+ export { StoreMutationEnvelope, StoreMutationLifecycleEvent, StoreMutationLifecycleEventSchema, StoreMutationResultEnvelope, StoreMutationResultSchema, StoreMutationSchema, StoreMutationStartResponse, StoreMutationStartResponseSchema };
@@ -0,0 +1,4 @@
1
+ import "./common-D8YUK9dA.mjs";
2
+ import { i as StoreMutationStartResponseSchema, n as StoreMutationResultSchema, r as StoreMutationSchema, t as StoreMutationLifecycleEventSchema } from "./store-mutation-protocol-CSwD-xPO.mjs";
3
+
4
+ export { StoreMutationLifecycleEventSchema, StoreMutationResultSchema, StoreMutationSchema, StoreMutationStartResponseSchema };
@@ -2,6 +2,14 @@ import { z } from "zod";
2
2
 
3
3
  //#region src/store-types.ts
4
4
  /**
5
+ * Orthogonal intents (updated 2026-07-16 Asia/Shanghai):
6
+ * 1. Keep beta Store UI projections lenient and independent from strict CLI command contracts.
7
+ * 2. Classify projection compatibility failures without crashing legacy Store UI.
8
+ * 3. Preserve complete typed CLI evidence through every beta projection outcome.
9
+ *
10
+ * Original request (2026-07-15): "为不同命令建立强类型适配器,不实现平行解析规则。"
11
+ */
12
+ /**
5
13
  * Beta feature fault-tolerance model (manager directive).
6
14
  *
7
15
  * 对于 beta 功能,openspecui 不负责兼容性。但这也意味着所有功能在后台需要有较强的容错能力
@@ -28,10 +36,12 @@ const StoreDiagnosticSchema = z.object({
28
36
  target: z.string().optional(),
29
37
  fix: z.string().optional()
30
38
  }).passthrough();
39
+ /** Browser-safe lenient fact for one Store inventory entry. */
31
40
  const StoreListEntrySchema = z.object({
32
41
  id: z.string(),
33
42
  root: z.string()
34
43
  }).passthrough();
44
+ /** Lenient beta projection of `openspec store list --json`. */
35
45
  const StoreListResultSchema = z.object({
36
46
  stores: z.array(StoreListEntrySchema).default([]),
37
47
  status: z.array(StoreDiagnosticSchema).optional()
@@ -53,6 +63,7 @@ const StoreGitFactsSchema = z.object({
53
63
  has_remote: z.boolean().nullable().optional(),
54
64
  origin_url: z.string().nullable().optional()
55
65
  }).passthrough();
66
+ /** Browser-safe lenient fact for one Store Doctor entry. */
56
67
  const StoreDoctorStoreSchema = z.object({
57
68
  id: z.string().optional(),
58
69
  root: z.string().optional(),
@@ -62,29 +73,32 @@ const StoreDoctorStoreSchema = z.object({
62
73
  git: StoreGitFactsSchema.optional(),
63
74
  status: z.array(StoreDiagnosticSchema).optional()
64
75
  }).passthrough();
76
+ /** Lenient beta projection of `openspec store doctor [id] --json`. */
65
77
  const StoreDoctorResultSchema = z.object({
66
78
  stores: z.array(StoreDoctorStoreSchema).default([]),
67
79
  status: z.array(StoreDiagnosticSchema).optional()
68
80
  }).passthrough();
69
- function classifyStoreCliOutput(input) {
70
- const { success, stdout, stderr, parse, cliVersion } = input;
71
- if (!success) return {
81
+ /** Classify a typed CLI result while projecting its already parsed payload leniently. */
82
+ function classifyStoreCliResult(input) {
83
+ const { result, schema, cliVersion } = input;
84
+ if (!result.success) return {
72
85
  kind: "command-unavailable",
73
- message: stderr.trim() || "OpenSpec CLI store command failed or is unavailable.",
86
+ message: result.stderr.trim() || result.diagnostics.map((diagnostic) => diagnostic.message).join("\n") || result.contractError || "OpenSpec CLI store command failed or is unavailable.",
87
+ evidence: result,
88
+ ...cliVersion ? { cliVersion } : {}
89
+ };
90
+ const projected = schema.safeParse(result.payload);
91
+ if (projected.success) return {
92
+ kind: "ok",
93
+ data: projected.data,
94
+ evidence: result
95
+ };
96
+ return {
97
+ kind: "data-incompatible",
98
+ message: `OpenSpec CLI returned an incompatible stores payload: ${result.contractError ?? projected.error.message}`,
99
+ evidence: result,
74
100
  ...cliVersion ? { cliVersion } : {}
75
101
  };
76
- try {
77
- return {
78
- kind: "ok",
79
- data: parse(stdout)
80
- };
81
- } catch (error) {
82
- return {
83
- kind: "data-incompatible",
84
- message: `OpenSpec CLI returned an incompatible stores payload: ${error instanceof Error ? error.message : String(error)}`,
85
- ...cliVersion ? { cliVersion } : {}
86
- };
87
- }
88
102
  }
89
103
  /**
90
104
  * 把归类结果转换成端点返回型。成功时 stores = data,失败时 stores = fallback(通常是空数组)
@@ -95,15 +109,22 @@ function toStoreFeatureResult(classification, options) {
95
109
  if (classification.kind === "ok") return {
96
110
  available: true,
97
111
  stores: options.fromData(classification.data),
112
+ evidence: classification.evidence,
98
113
  ...cliVersion ? { cliVersion } : {}
99
114
  };
115
+ const error = {
116
+ kind: classification.kind,
117
+ message: classification.message,
118
+ ...classification.cliVersion ? { cliVersion: classification.cliVersion } : {}
119
+ };
100
120
  return {
101
121
  available: false,
102
122
  stores: options.fallback,
103
- error: classification,
123
+ evidence: classification.evidence,
124
+ error,
104
125
  ...cliVersion ? { cliVersion } : {}
105
126
  };
106
127
  }
107
128
 
108
129
  //#endregion
109
- export { toStoreFeatureResult as i, StoreListResultSchema as n, classifyStoreCliOutput as r, StoreDoctorResultSchema as t };
130
+ export { StoreListResultSchema as a, StoreListEntrySchema as i, StoreDoctorResultSchema as n, classifyStoreCliResult as o, StoreDoctorStoreSchema as r, toStoreFeatureResult as s, StoreDiagnosticSchema as t };
@@ -1,3 +1,4 @@
1
+ import { t as CliCommandResult } from "./command-result-fkH3Ekdz.mjs";
1
2
  import { z } from "zod";
2
3
 
3
4
  //#region src/store-types.d.ts
@@ -41,6 +42,7 @@ declare const StoreDiagnosticSchema: z.ZodObject<{
41
42
  target: z.ZodOptional<z.ZodString>;
42
43
  fix: z.ZodOptional<z.ZodString>;
43
44
  }, z.ZodTypeAny, "passthrough">>;
45
+ /** Browser-safe lenient fact for one Store inventory entry. */
44
46
  declare const StoreListEntrySchema: z.ZodObject<{
45
47
  id: z.ZodString;
46
48
  root: z.ZodString;
@@ -51,6 +53,7 @@ declare const StoreListEntrySchema: z.ZodObject<{
51
53
  id: z.ZodString;
52
54
  root: z.ZodString;
53
55
  }, z.ZodTypeAny, "passthrough">>;
56
+ /** Lenient beta projection of `openspec store list --json`. */
54
57
  declare const StoreListResultSchema: z.ZodObject<{
55
58
  stores: z.ZodDefault<z.ZodArray<z.ZodObject<{
56
59
  id: z.ZodString;
@@ -142,6 +145,7 @@ declare const StoreListResultSchema: z.ZodObject<{
142
145
  fix: z.ZodOptional<z.ZodString>;
143
146
  }, z.ZodTypeAny, "passthrough">>, "many">>;
144
147
  }, z.ZodTypeAny, "passthrough">>;
148
+ /** Browser-safe lenient fact for one Store Doctor entry. */
145
149
  declare const StoreDoctorStoreSchema: z.ZodObject<{
146
150
  id: z.ZodOptional<z.ZodString>;
147
151
  root: z.ZodOptional<z.ZodString>;
@@ -347,6 +351,7 @@ declare const StoreDoctorStoreSchema: z.ZodObject<{
347
351
  fix: z.ZodOptional<z.ZodString>;
348
352
  }, z.ZodTypeAny, "passthrough">>, "many">>;
349
353
  }, z.ZodTypeAny, "passthrough">>;
354
+ /** Lenient beta projection of `openspec store doctor [id] --json`. */
350
355
  declare const StoreDoctorResultSchema: z.ZodObject<{
351
356
  stores: z.ZodDefault<z.ZodArray<z.ZodObject<{
352
357
  id: z.ZodOptional<z.ZodString>;
@@ -1028,6 +1033,8 @@ type StoreDoctorStore = z.infer<typeof StoreDoctorStoreSchema>;
1028
1033
  type StoreListResult = z.infer<typeof StoreListResultSchema>;
1029
1034
  type StoreDoctorResult = z.infer<typeof StoreDoctorResultSchema>;
1030
1035
  type StoreDiagnostic = z.infer<typeof StoreDiagnosticSchema>;
1036
+ /** Complete process and typed payload evidence for one Store-family CLI command. */
1037
+ type StoreCommandEvidence = CliCommandResult<Record<string, unknown>>;
1031
1038
  /**
1032
1039
  * 异常一:数据不兼容。
1033
1040
  * CLI 命令成功执行(exit 0),但返回的数据结构 openspecui 无法解析(zod 宽松验证仍失败)。
@@ -1057,6 +1064,7 @@ type StoreFeatureError = StoreDataIncompatibleError | StoreCommandUnavailableErr
1057
1064
  type StoreFeatureResult<T = StoreListEntry[]> = {
1058
1065
  available: boolean;
1059
1066
  stores: T;
1067
+ evidence: StoreCommandEvidence | null;
1060
1068
  error?: StoreFeatureError;
1061
1069
  cliVersion?: string;
1062
1070
  };
@@ -1068,25 +1076,27 @@ type StoreFeatureResult<T = StoreListEntry[]> = {
1068
1076
  * - exit 0 但 zod 失败 → 'data-incompatible'(异常一)
1069
1077
  * - 非 0 退出 / spawn 失败 → 'command-unavailable'(异常二)
1070
1078
  */
1071
- type StoreClassification = {
1079
+ type StoreClassification<T> = {
1072
1080
  kind: 'ok';
1073
- data: unknown;
1074
- } | StoreFeatureError;
1075
- declare function classifyStoreCliOutput(input: {
1076
- success: boolean;
1077
- stdout: string;
1078
- stderr: string;
1079
- parse: (stdout: string) => unknown;
1081
+ data: T;
1082
+ evidence: StoreCommandEvidence;
1083
+ } | (StoreFeatureError & {
1084
+ evidence: StoreCommandEvidence;
1085
+ });
1086
+ /** Classify a typed CLI result while projecting its already parsed payload leniently. */
1087
+ declare function classifyStoreCliResult<TSchema extends z.ZodTypeAny>(input: {
1088
+ result: StoreCommandEvidence;
1089
+ schema: TSchema;
1080
1090
  cliVersion?: string;
1081
- }): StoreClassification;
1091
+ }): StoreClassification<z.output<TSchema>>;
1082
1092
  /**
1083
1093
  * 把归类结果转换成端点返回型。成功时 stores = data,失败时 stores = fallback(通常是空数组)
1084
1094
  * 并附上 error。始终尽力带上 cliVersion(版本信息非常重要)。
1085
1095
  */
1086
- declare function toStoreFeatureResult<T>(classification: StoreClassification, options: {
1087
- fromData: (data: unknown) => T;
1096
+ declare function toStoreFeatureResult<T, TData>(classification: StoreClassification<TData>, options: {
1097
+ fromData: (data: TData) => T;
1088
1098
  fallback: T;
1089
1099
  cliVersion?: string;
1090
1100
  }): StoreFeatureResult<T>;
1091
1101
  //#endregion
1092
- export { StoreDoctorResult as a, StoreFeatureError as c, StoreListResult as d, StoreListResultSchema as f, StoreDiagnostic as i, StoreFeatureResult as l, toStoreFeatureResult as m, StoreCommandUnavailableError as n, StoreDoctorResultSchema as o, classifyStoreCliOutput as p, StoreDataIncompatibleError as r, StoreDoctorStore as s, StoreClassification as t, StoreListEntry as u };
1102
+ export { classifyStoreCliResult as _, StoreDiagnostic as a, StoreDoctorResultSchema as c, StoreFeatureError as d, StoreFeatureResult as f, StoreListResultSchema as g, StoreListResult as h, StoreDataIncompatibleError as i, StoreDoctorStore as l, StoreListEntrySchema as m, StoreCommandEvidence as n, StoreDiagnosticSchema as o, StoreListEntry as p, StoreCommandUnavailableError as r, StoreDoctorResult as s, StoreClassification as t, StoreDoctorStoreSchema as u, toStoreFeatureResult as v };
@@ -1,2 +1,6 @@
1
- import { a as StoreDoctorResult, c as StoreFeatureError, d as StoreListResult, f as StoreListResultSchema, i as StoreDiagnostic, l as StoreFeatureResult, m as toStoreFeatureResult, n as StoreCommandUnavailableError, o as StoreDoctorResultSchema, p as classifyStoreCliOutput, r as StoreDataIncompatibleError, s as StoreDoctorStore, t as StoreClassification, u as StoreListEntry } from "./store-types-BiE-Ey--.mjs";
2
- export { StoreClassification, StoreCommandUnavailableError, StoreDataIncompatibleError, StoreDiagnostic, StoreDoctorResult, StoreDoctorResultSchema, StoreDoctorStore, StoreFeatureError, StoreFeatureResult, StoreListEntry, StoreListResult, StoreListResultSchema, classifyStoreCliOutput, toStoreFeatureResult };
1
+ import "./command-result-fkH3Ekdz.mjs";
2
+ import "./document-translation-D50BnvVh.mjs";
3
+ import "./sounds-qhRgCy0F.mjs";
4
+ import "./notifications-CgJlLgLO.mjs";
5
+ import { _ as classifyStoreCliResult, a as StoreDiagnostic, c as StoreDoctorResultSchema, d as StoreFeatureError, f as StoreFeatureResult, g as StoreListResultSchema, h as StoreListResult, i as StoreDataIncompatibleError, l as StoreDoctorStore, m as StoreListEntrySchema, n as StoreCommandEvidence, o as StoreDiagnosticSchema, p as StoreListEntry, r as StoreCommandUnavailableError, s as StoreDoctorResult, t as StoreClassification, u as StoreDoctorStoreSchema, v as toStoreFeatureResult } from "./store-types-b554wAQJ.mjs";
6
+ export { StoreClassification, StoreCommandEvidence, StoreCommandUnavailableError, StoreDataIncompatibleError, StoreDiagnostic, StoreDiagnosticSchema, StoreDoctorResult, StoreDoctorResultSchema, StoreDoctorStore, StoreDoctorStoreSchema, StoreFeatureError, StoreFeatureResult, StoreListEntry, StoreListEntrySchema, StoreListResult, StoreListResultSchema, classifyStoreCliResult, toStoreFeatureResult };
@@ -1,3 +1,3 @@
1
- import { i as toStoreFeatureResult, n as StoreListResultSchema, r as classifyStoreCliOutput, t as StoreDoctorResultSchema } from "./store-types-Cu41QSww.mjs";
1
+ import { a as StoreListResultSchema, i as StoreListEntrySchema, n as StoreDoctorResultSchema, o as classifyStoreCliResult, r as StoreDoctorStoreSchema, s as toStoreFeatureResult, t as StoreDiagnosticSchema } from "./store-types-DlX1REBg.mjs";
2
2
 
3
- export { StoreDoctorResultSchema, StoreListResultSchema, classifyStoreCliOutput, toStoreFeatureResult };
3
+ export { StoreDiagnosticSchema, StoreDoctorResultSchema, StoreDoctorStoreSchema, StoreListEntrySchema, StoreListResultSchema, classifyStoreCliResult, toStoreFeatureResult };
@@ -0,0 +1,216 @@
1
+ import { s as opsxPathMatchesPattern } from "./opsx-entity-Cn_Zu1J3.mjs";
2
+
3
+ //#region src/task-progress.ts
4
+ /**
5
+ * Orthogonal intents (updated 2026-07-16 Asia/Shanghai):
6
+ * 1. Project OpenSpec's tracked artifact glob as the only workflow task truth.
7
+ * 2. Preserve schema-document checklists as grouped secondary analytics.
8
+ * 3. Attribute raw Apply instruction counts without normalizing tracked divergence.
9
+ * 4. Parse Markdown checkbox tasks once without exposing a generic progress alias.
10
+ * 5. Attach mutation-safe file identity to every tracked task.
11
+ *
12
+ * Original request (2026-07-15): "统计信息仍然有一定的间接价值。"
13
+ */
14
+ const CHECKBOX_TASK_LINE = /^\s*[-*]\s+\[([ xX])\]\s+(.+)$/;
15
+ const MARKDOWN_FILE_PATH = /\.(?:md|markdown)$/i;
16
+ function isMarkdownTaskSourcePath(path) {
17
+ return MARKDOWN_FILE_PATH.test(path);
18
+ }
19
+ function parseMarkdownTasks(content, options = {}) {
20
+ const tasks = [];
21
+ const lines = content.split("\n");
22
+ let currentSection = "";
23
+ let taskIndex = options.initialIndex ?? 0;
24
+ for (const line of lines) {
25
+ const headingMatch = line.match(/^#{1,6}\s+(.+)$/);
26
+ if (headingMatch) {
27
+ currentSection = headingMatch[1].trim();
28
+ continue;
29
+ }
30
+ const taskMatch = line.match(CHECKBOX_TASK_LINE);
31
+ if (!taskMatch) continue;
32
+ taskIndex += 1;
33
+ tasks.push({
34
+ id: `task-${taskIndex}`,
35
+ text: taskMatch[2].trim(),
36
+ completed: taskMatch[1].toLowerCase() === "x",
37
+ section: currentSection || void 0
38
+ });
39
+ }
40
+ return tasks;
41
+ }
42
+ function deriveTrackedTaskPhase(total, completed) {
43
+ if (total === 0) return "no-tasks";
44
+ return completed >= total ? "complete" : "in-progress";
45
+ }
46
+ function createTrackedTaskProgress(tasks, source = {
47
+ kind: "none",
48
+ artifactId: null,
49
+ outputPath: null,
50
+ filePaths: []
51
+ }) {
52
+ const total = tasks.length;
53
+ const completed = tasks.filter((task) => task.completed).length;
54
+ return {
55
+ tasks,
56
+ total,
57
+ completed,
58
+ remaining: total - completed,
59
+ phase: deriveTrackedTaskPhase(total, completed),
60
+ source
61
+ };
62
+ }
63
+ function createDocumentChecklistSummary(groups) {
64
+ const total = groups.reduce((sum, group) => sum + group.total, 0);
65
+ const completed = groups.reduce((sum, group) => sum + group.completed, 0);
66
+ return {
67
+ groups,
68
+ total,
69
+ completed,
70
+ remaining: total - completed
71
+ };
72
+ }
73
+ function createApplyInstructionProgress(input, trackedTaskProgress) {
74
+ const differs = trackedTaskProgress !== void 0 && trackedTaskProgress !== null && (input.total !== trackedTaskProgress.total || input.complete !== trackedTaskProgress.completed || input.remaining !== trackedTaskProgress.remaining);
75
+ return {
76
+ source: "openspec-instructions-apply",
77
+ total: input.total,
78
+ complete: input.complete,
79
+ remaining: input.remaining,
80
+ state: input.state,
81
+ divergence: differs ? {
82
+ kind: "tracked-task-mismatch",
83
+ message: "OpenSpec Apply instruction progress differs from the tracked artifact glob projection.",
84
+ apply: {
85
+ total: input.total,
86
+ complete: input.complete,
87
+ remaining: input.remaining
88
+ },
89
+ tracked: {
90
+ total: trackedTaskProgress.total,
91
+ completed: trackedTaskProgress.completed,
92
+ remaining: trackedTaskProgress.remaining,
93
+ phase: trackedTaskProgress.phase
94
+ }
95
+ } : null
96
+ };
97
+ }
98
+ function getTextFiles(files) {
99
+ return files.filter((file) => file.type === "file" && typeof file.content === "string").map((file) => ({
100
+ path: file.path,
101
+ content: file.content
102
+ })).sort((left, right) => left.path.localeCompare(right.path));
103
+ }
104
+ function getTrackedArtifact(schemaDetail) {
105
+ if (!schemaDetail) return null;
106
+ if (schemaDetail.applyTracks) return schemaDetail.artifacts.find((artifact) => artifact.outputPath === schemaDetail.applyTracks) ?? null;
107
+ return schemaDetail.artifacts.find((artifact) => artifact.id === "tasks") ?? null;
108
+ }
109
+ function selectTrackedSources(textFiles, schemaDetail) {
110
+ const trackedArtifact = getTrackedArtifact(schemaDetail);
111
+ if (trackedArtifact) {
112
+ const sources = textFiles.filter((file) => opsxPathMatchesPattern(file.path, trackedArtifact.outputPath));
113
+ if (sources.length > 0) return {
114
+ sources,
115
+ source: {
116
+ kind: "artifact",
117
+ artifactId: trackedArtifact.id,
118
+ outputPath: trackedArtifact.outputPath,
119
+ filePaths: sources.map((source) => source.path)
120
+ }
121
+ };
122
+ }
123
+ const fallback = textFiles.find((file) => file.path === "tasks.md");
124
+ if (fallback) return {
125
+ sources: [fallback],
126
+ source: {
127
+ kind: "top-level-fallback",
128
+ artifactId: null,
129
+ outputPath: "tasks.md",
130
+ filePaths: ["tasks.md"]
131
+ }
132
+ };
133
+ return {
134
+ sources: [],
135
+ source: {
136
+ kind: "none",
137
+ artifactId: null,
138
+ outputPath: null,
139
+ filePaths: []
140
+ }
141
+ };
142
+ }
143
+ function parseSources(sources) {
144
+ const tasks = [];
145
+ for (const source of sources) {
146
+ const sourceTasks = parseMarkdownTasks(source.content, { initialIndex: tasks.length });
147
+ tasks.push(...sourceTasks.map((task, index) => ({
148
+ ...task,
149
+ location: {
150
+ filePath: source.path,
151
+ taskIndex: index + 1
152
+ }
153
+ })));
154
+ }
155
+ return tasks;
156
+ }
157
+ /** Toggle one checkbox by its 1-based index while preserving the surrounding Markdown. */
158
+ function toggleMarkdownTask(content, taskIndex, completed) {
159
+ if (!Number.isInteger(taskIndex) || taskIndex < 1) return null;
160
+ const lines = content.split("\n");
161
+ let currentTaskIndex = 0;
162
+ for (let index = 0; index < lines.length; index += 1) {
163
+ const taskMatch = /^(\s*[-*]\s+)\[([ xX])\](\s+.*)$/.exec(lines[index]);
164
+ if (!taskMatch) continue;
165
+ currentTaskIndex += 1;
166
+ if (currentTaskIndex !== taskIndex) continue;
167
+ lines[index] = `${taskMatch[1]}[${completed ? "x" : " "}]${taskMatch[3]}`;
168
+ return lines.join("\n");
169
+ }
170
+ return null;
171
+ }
172
+ function selectDocumentSources(textFiles, options) {
173
+ const markdownFiles = textFiles.filter((file) => isMarkdownTaskSourcePath(file.path));
174
+ if (options.schemaDetail) return markdownFiles.flatMap((source) => {
175
+ const artifactIds = options.schemaDetail.artifacts.filter((artifact) => opsxPathMatchesPattern(source.path, artifact.outputPath)).map((artifact) => artifact.id);
176
+ return artifactIds.length > 0 ? [{
177
+ source,
178
+ artifactIds
179
+ }] : [];
180
+ });
181
+ if (options.hasSchemaMetadata) return markdownFiles.map((source) => ({
182
+ source,
183
+ artifactIds: []
184
+ }));
185
+ return markdownFiles.filter((source) => source.path === "tasks.md").map((source) => ({
186
+ source,
187
+ artifactIds: []
188
+ }));
189
+ }
190
+ function projectDocumentChecklistSummary(textFiles, options) {
191
+ let taskIndex = 0;
192
+ return createDocumentChecklistSummary(selectDocumentSources(textFiles, options).map(({ source, artifactIds }) => {
193
+ const tasks = parseMarkdownTasks(source.content, { initialIndex: taskIndex });
194
+ taskIndex += tasks.length;
195
+ const completed = tasks.filter((task) => task.completed).length;
196
+ return {
197
+ artifactIds,
198
+ filePath: source.path,
199
+ tasks,
200
+ total: tasks.length,
201
+ completed,
202
+ remaining: tasks.length - completed
203
+ };
204
+ }));
205
+ }
206
+ function projectTaskProjectionsFromMarkdownFiles(files, options = {}) {
207
+ const textFiles = getTextFiles(files);
208
+ const tracked = selectTrackedSources(textFiles, options.schemaDetail);
209
+ return {
210
+ trackedTaskProgress: createTrackedTaskProgress(parseSources(tracked.sources), tracked.source),
211
+ documentChecklistSummary: projectDocumentChecklistSummary(textFiles, options)
212
+ };
213
+ }
214
+
215
+ //#endregion
216
+ export { isMarkdownTaskSourcePath as a, toggleMarkdownTask as c, deriveTrackedTaskPhase as i, createDocumentChecklistSummary as n, parseMarkdownTasks as o, createTrackedTaskProgress as r, projectTaskProjectionsFromMarkdownFiles as s, createApplyInstructionProgress as t };
@@ -1,4 +1,7 @@
1
- import "./opsx-types-Dnb06uff.mjs";
2
- import "./schemas-D01aQnV4.mjs";
3
- import { a as isMarkdownTaskSourcePath, i as computeTaskProgress, n as TaskProjection, o as parseMarkdownTasks, r as TaskProjectionOptions, s as projectTasksFromMarkdownFiles, t as TaskProgress } from "./task-progress-C1TGMbIR.mjs";
4
- export { TaskProgress, TaskProjection, TaskProjectionOptions, computeTaskProgress, isMarkdownTaskSourcePath, parseMarkdownTasks, projectTasksFromMarkdownFiles };
1
+ import "./command-result-fkH3Ekdz.mjs";
2
+ import "./document-translation-D50BnvVh.mjs";
3
+ import "./sounds-qhRgCy0F.mjs";
4
+ import "./notifications-CgJlLgLO.mjs";
5
+ import "./schemas-DS-JqAJ2.mjs";
6
+ import { $ as projectTaskProjectionsFromMarkdownFiles, B as TaskProjectionOptions, F as ApplyInstructionDivergence, G as TrackedTaskProgress, H as TrackedTask, I as ApplyInstructionProgress, J as createDocumentChecklistSummary, K as TrackedTaskSource, L as ApplyInstructionState, Q as parseMarkdownTasks, R as DocumentChecklistGroup, U as TrackedTaskLocation, V as TaskProjections, W as TrackedTaskPhase, X as deriveTrackedTaskPhase, Y as createTrackedTaskProgress, Z as isMarkdownTaskSourcePath, et as toggleMarkdownTask, q as createApplyInstructionProgress, z as DocumentChecklistSummary } from "./opsx-types-BJ8AjhrS.mjs";
7
+ export { ApplyInstructionDivergence, ApplyInstructionProgress, ApplyInstructionState, DocumentChecklistGroup, DocumentChecklistSummary, TaskProjectionOptions, TaskProjections, TrackedTask, TrackedTaskLocation, TrackedTaskPhase, TrackedTaskProgress, TrackedTaskSource, createApplyInstructionProgress, createDocumentChecklistSummary, createTrackedTaskProgress, deriveTrackedTaskPhase, isMarkdownTaskSourcePath, parseMarkdownTasks, projectTaskProjectionsFromMarkdownFiles, toggleMarkdownTask };
@@ -1,4 +1,4 @@
1
- import "./opsx-entity-c7m5CbgU.mjs";
2
- import { i as projectTasksFromMarkdownFiles, n as isMarkdownTaskSourcePath, r as parseMarkdownTasks, t as computeTaskProgress } from "./task-progress-DhHYHnTv.mjs";
1
+ import "./opsx-entity-Cn_Zu1J3.mjs";
2
+ 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";
3
3
 
4
- export { computeTaskProgress, isMarkdownTaskSourcePath, parseMarkdownTasks, projectTasksFromMarkdownFiles };
4
+ export { createApplyInstructionProgress, createDocumentChecklistSummary, createTrackedTaskProgress, deriveTrackedTaskPhase, isMarkdownTaskSourcePath, parseMarkdownTasks, projectTaskProjectionsFromMarkdownFiles, toggleMarkdownTask };
@@ -1,4 +1,4 @@
1
- import { l as DEFAULT_BELL_SOUND_ID, m as SoundConfigIdSchema } from "./sounds-CB3ubSnj.mjs";
1
+ import { l as DEFAULT_BELL_SOUND_ID, m as SoundConfigIdSchema } from "./sounds-NXwveBqq.mjs";
2
2
 
3
3
  //#region src/terminal-audio.ts
4
4
  const TERMINAL_BELL_SOUND_VALUES = [
@@ -1,4 +1,4 @@
1
- import { x as SoundId } from "./sounds-kgDn4x8v.mjs";
1
+ import { x as SoundId } from "./sounds-qhRgCy0F.mjs";
2
2
  import * as zod0 from "zod";
3
3
 
4
4
  //#region src/terminal-audio.d.ts
@@ -1,3 +1,3 @@
1
- import "./sounds-kgDn4x8v.mjs";
2
- import { i as TerminalBellSoundSchema, n as TERMINAL_BELL_SOUND_VALUES, r as TerminalBellSound, t as TERMINAL_BELL_SOUND_OPTIONS } from "./terminal-audio-CsuGTNV-.mjs";
1
+ import "./sounds-qhRgCy0F.mjs";
2
+ import { i as TerminalBellSoundSchema, n as TERMINAL_BELL_SOUND_VALUES, r as TerminalBellSound, t as TERMINAL_BELL_SOUND_OPTIONS } from "./terminal-audio-tXDm_EDe.mjs";
3
3
  export { TERMINAL_BELL_SOUND_OPTIONS, TERMINAL_BELL_SOUND_VALUES, TerminalBellSound, TerminalBellSoundSchema };
@@ -1,4 +1,4 @@
1
- import "./sounds-CB3ubSnj.mjs";
2
- import { n as TERMINAL_BELL_SOUND_VALUES, r as TerminalBellSoundSchema, t as TERMINAL_BELL_SOUND_OPTIONS } from "./terminal-audio-TBoU2jSK.mjs";
1
+ import "./sounds-NXwveBqq.mjs";
2
+ import { n as TERMINAL_BELL_SOUND_VALUES, r as TerminalBellSoundSchema, t as TERMINAL_BELL_SOUND_OPTIONS } from "./terminal-audio-d6KItUeJ.mjs";
3
3
 
4
4
  export { TERMINAL_BELL_SOUND_OPTIONS, TERMINAL_BELL_SOUND_VALUES, TerminalBellSoundSchema };
@@ -1,3 +1,3 @@
1
- import "./sounds-kgDn4x8v.mjs";
2
- import { A as TerminalNotificationProtocol, D as TerminalControlEvent, M as TerminalPromptState, N as TerminalTitleTarget, O as TerminalControlParseResult, P as terminalNotificationEventToPublishInput, j as TerminalProgressState, k as TerminalControlParser } from "./notifications-DZeOl4HV.mjs";
1
+ import "./sounds-qhRgCy0F.mjs";
2
+ import { A as TerminalNotificationProtocol, D as TerminalControlEvent, M as TerminalPromptState, N as TerminalTitleTarget, O as TerminalControlParseResult, P as terminalNotificationEventToPublishInput, j as TerminalProgressState, k as TerminalControlParser } from "./notifications-CgJlLgLO.mjs";
3
3
  export { TerminalControlEvent, TerminalControlParseResult, TerminalControlParser, TerminalNotificationProtocol, TerminalProgressState, TerminalPromptState, TerminalTitleTarget, terminalNotificationEventToPublishInput };
@@ -1,3 +1,3 @@
1
- import { n as terminalNotificationEventToPublishInput, t as TerminalControlParser } from "./terminal-control-VpTuh17B.mjs";
1
+ import { n as terminalNotificationEventToPublishInput, t as TerminalControlParser } from "./terminal-control-BSAlOTs8.mjs";
2
2
 
3
3
  export { TerminalControlParser, terminalNotificationEventToPublishInput };