@openspecui/core 3.1.0 → 3.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.mts CHANGED
@@ -19,13 +19,13 @@ declare const ChangeFileSchema: z.ZodObject<{
19
19
  /** Optional byte size for files */
20
20
  size: z.ZodOptional<z.ZodNumber>;
21
21
  }, "strip", z.ZodTypeAny, {
22
- path: string;
23
22
  type: "file" | "directory";
23
+ path: string;
24
24
  content?: string | undefined;
25
25
  size?: number | undefined;
26
26
  }, {
27
- path: string;
28
27
  type: "file" | "directory";
28
+ path: string;
29
29
  content?: string | undefined;
30
30
  size?: number | undefined;
31
31
  }>;
@@ -1442,9 +1442,9 @@ type GitConfig = z.infer<typeof GitConfigSchema>;
1442
1442
  declare const OpsxConfigSchema: z.ZodObject<{
1443
1443
  agentInvocationMode: z.ZodDefault<z.ZodEnum<["compose", "command"]>>;
1444
1444
  }, "strip", z.ZodTypeAny, {
1445
- agentInvocationMode: "compose" | "command";
1445
+ agentInvocationMode: "command" | "compose";
1446
1446
  }, {
1447
- agentInvocationMode?: "compose" | "command" | undefined;
1447
+ agentInvocationMode?: "command" | "compose" | undefined;
1448
1448
  }>;
1449
1449
  type OpsxConfig = z.infer<typeof OpsxConfigSchema>;
1450
1450
  /**
@@ -1482,9 +1482,9 @@ declare const OpenSpecUIConfigSchema: z.ZodObject<{
1482
1482
  opsx: z.ZodDefault<z.ZodObject<{
1483
1483
  agentInvocationMode: z.ZodDefault<z.ZodEnum<["compose", "command"]>>;
1484
1484
  }, "strip", z.ZodTypeAny, {
1485
- agentInvocationMode: "compose" | "command";
1485
+ agentInvocationMode: "command" | "compose";
1486
1486
  }, {
1487
- agentInvocationMode?: "compose" | "command" | undefined;
1487
+ agentInvocationMode?: "command" | "compose" | undefined;
1488
1488
  }>>;
1489
1489
  /** 终端配置 */
1490
1490
  terminal: z.ZodDefault<z.ZodObject<{
@@ -1536,7 +1536,7 @@ declare const OpenSpecUIConfigSchema: z.ZodObject<{
1536
1536
  };
1537
1537
  appBaseUrl: string;
1538
1538
  opsx: {
1539
- agentInvocationMode: "compose" | "command";
1539
+ agentInvocationMode: "command" | "compose";
1540
1540
  };
1541
1541
  terminal: {
1542
1542
  fontSize: number;
@@ -1563,7 +1563,7 @@ declare const OpenSpecUIConfigSchema: z.ZodObject<{
1563
1563
  } | undefined;
1564
1564
  appBaseUrl?: string | undefined;
1565
1565
  opsx?: {
1566
- agentInvocationMode?: "compose" | "command" | undefined;
1566
+ agentInvocationMode?: "command" | "compose" | undefined;
1567
1567
  } | undefined;
1568
1568
  terminal?: {
1569
1569
  fontSize?: number | undefined;
@@ -1983,14 +1983,14 @@ declare const ArtifactStatusSchema: z.ZodObject<{
1983
1983
  missingDeps: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
1984
1984
  relativePath: z.ZodOptional<z.ZodString>;
1985
1985
  }, "strip", z.ZodTypeAny, {
1986
- id: string;
1987
1986
  status: "done" | "ready" | "blocked";
1987
+ id: string;
1988
1988
  outputPath: string;
1989
1989
  missingDeps?: string[] | undefined;
1990
1990
  relativePath?: string | undefined;
1991
1991
  }, {
1992
- id: string;
1993
1992
  status: "done" | "ready" | "blocked";
1993
+ id: string;
1994
1994
  outputPath: string;
1995
1995
  missingDeps?: string[] | undefined;
1996
1996
  relativePath?: string | undefined;
@@ -2008,14 +2008,14 @@ declare const ChangeStatusSchema: z.ZodObject<{
2008
2008
  missingDeps: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
2009
2009
  relativePath: z.ZodOptional<z.ZodString>;
2010
2010
  }, "strip", z.ZodTypeAny, {
2011
- id: string;
2012
2011
  status: "done" | "ready" | "blocked";
2012
+ id: string;
2013
2013
  outputPath: string;
2014
2014
  missingDeps?: string[] | undefined;
2015
2015
  relativePath?: string | undefined;
2016
2016
  }, {
2017
- id: string;
2018
2017
  status: "done" | "ready" | "blocked";
2018
+ id: string;
2019
2019
  outputPath: string;
2020
2020
  missingDeps?: string[] | undefined;
2021
2021
  relativePath?: string | undefined;
@@ -2026,8 +2026,8 @@ declare const ChangeStatusSchema: z.ZodObject<{
2026
2026
  isComplete: boolean;
2027
2027
  applyRequires: string[];
2028
2028
  artifacts: {
2029
- id: string;
2030
2029
  status: "done" | "ready" | "blocked";
2030
+ id: string;
2031
2031
  outputPath: string;
2032
2032
  missingDeps?: string[] | undefined;
2033
2033
  relativePath?: string | undefined;
@@ -2038,8 +2038,8 @@ declare const ChangeStatusSchema: z.ZodObject<{
2038
2038
  isComplete: boolean;
2039
2039
  applyRequires: string[];
2040
2040
  artifacts: {
2041
- id: string;
2042
2041
  status: "done" | "ready" | "blocked";
2042
+ id: string;
2043
2043
  outputPath: string;
2044
2044
  missingDeps?: string[] | undefined;
2045
2045
  relativePath?: string | undefined;
@@ -2052,13 +2052,13 @@ declare const DependencyInfoSchema: z.ZodObject<{
2052
2052
  path: z.ZodString;
2053
2053
  description: z.ZodString;
2054
2054
  }, "strip", z.ZodTypeAny, {
2055
- id: string;
2056
2055
  path: string;
2056
+ id: string;
2057
2057
  description: string;
2058
2058
  done: boolean;
2059
2059
  }, {
2060
- id: string;
2061
2060
  path: string;
2061
+ id: string;
2062
2062
  description: string;
2063
2063
  done: boolean;
2064
2064
  }>;
@@ -2167,13 +2167,13 @@ declare const ArtifactInstructionsSchema: z.ZodObject<{
2167
2167
  path: z.ZodString;
2168
2168
  description: z.ZodString;
2169
2169
  }, "strip", z.ZodTypeAny, {
2170
- id: string;
2171
2170
  path: string;
2171
+ id: string;
2172
2172
  description: string;
2173
2173
  done: boolean;
2174
2174
  }, {
2175
- id: string;
2176
2175
  path: string;
2176
+ id: string;
2177
2177
  description: string;
2178
2178
  done: boolean;
2179
2179
  }>, "many">;
@@ -2187,8 +2187,8 @@ declare const ArtifactInstructionsSchema: z.ZodObject<{
2187
2187
  artifactId: string;
2188
2188
  template: string;
2189
2189
  dependencies: {
2190
- id: string;
2191
2190
  path: string;
2191
+ id: string;
2192
2192
  description: string;
2193
2193
  done: boolean;
2194
2194
  }[];
@@ -2205,8 +2205,8 @@ declare const ArtifactInstructionsSchema: z.ZodObject<{
2205
2205
  artifactId: string;
2206
2206
  template: string;
2207
2207
  dependencies: {
2208
- id: string;
2209
2208
  path: string;
2209
+ id: string;
2210
2210
  description: string;
2211
2211
  done: boolean;
2212
2212
  }[];
@@ -2252,8 +2252,8 @@ declare const SchemaResolutionSchema: z.ZodObject<{
2252
2252
  displayPath?: string | undefined;
2253
2253
  }>, "many">;
2254
2254
  }, "strip", z.ZodTypeAny, {
2255
- name: string;
2256
2255
  path: string;
2256
+ name: string;
2257
2257
  source: "project" | "user" | "package";
2258
2258
  shadows: {
2259
2259
  path: string;
@@ -2262,8 +2262,8 @@ declare const SchemaResolutionSchema: z.ZodObject<{
2262
2262
  }[];
2263
2263
  displayPath?: string | undefined;
2264
2264
  }, {
2265
- name: string;
2266
2265
  path: string;
2266
+ name: string;
2267
2267
  source: "project" | "user" | "package";
2268
2268
  shadows: {
2269
2269
  path: string;
@@ -2692,22 +2692,22 @@ declare const PtySessionInfoSchema: z.ZodObject<{
2692
2692
  closeTip: z.ZodOptional<z.ZodString>;
2693
2693
  closeCallbackUrl: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodRecord<z.ZodString, z.ZodString>]>>;
2694
2694
  }, "strip", z.ZodTypeAny, {
2695
- id: string;
2696
2695
  command: string;
2697
2696
  args: string[];
2698
2697
  platform: "windows" | "macos" | "common";
2699
2698
  exitCode: number | null;
2700
2699
  title: string;
2700
+ id: string;
2701
2701
  isExited: boolean;
2702
2702
  closeTip?: string | undefined;
2703
2703
  closeCallbackUrl?: string | Record<string, string> | undefined;
2704
2704
  }, {
2705
- id: string;
2706
2705
  command: string;
2707
2706
  args: string[];
2708
2707
  platform: "windows" | "macos" | "common";
2709
2708
  exitCode: number | null;
2710
2709
  title: string;
2710
+ id: string;
2711
2711
  isExited: boolean;
2712
2712
  closeTip?: string | undefined;
2713
2713
  closeCallbackUrl?: string | Record<string, string> | undefined;
@@ -2724,19 +2724,19 @@ declare const PtyCreateMessageSchema: z.ZodObject<{
2724
2724
  }, "strip", z.ZodTypeAny, {
2725
2725
  type: "create";
2726
2726
  requestId: string;
2727
- command?: string | undefined;
2728
- args?: string[] | undefined;
2729
2727
  cols?: number | undefined;
2730
2728
  rows?: number | undefined;
2729
+ command?: string | undefined;
2730
+ args?: string[] | undefined;
2731
2731
  closeTip?: string | undefined;
2732
2732
  closeCallbackUrl?: string | Record<string, string> | undefined;
2733
2733
  }, {
2734
2734
  type: "create";
2735
2735
  requestId: string;
2736
- command?: string | undefined;
2737
- args?: string[] | undefined;
2738
2736
  cols?: number | undefined;
2739
2737
  rows?: number | undefined;
2738
+ command?: string | undefined;
2739
+ args?: string[] | undefined;
2740
2740
  closeTip?: string | undefined;
2741
2741
  closeCallbackUrl?: string | Record<string, string> | undefined;
2742
2742
  }>;
@@ -2814,19 +2814,19 @@ declare const PtyClientMessageSchema: z.ZodDiscriminatedUnion<"type", [z.ZodObje
2814
2814
  }, "strip", z.ZodTypeAny, {
2815
2815
  type: "create";
2816
2816
  requestId: string;
2817
- command?: string | undefined;
2818
- args?: string[] | undefined;
2819
2817
  cols?: number | undefined;
2820
2818
  rows?: number | undefined;
2819
+ command?: string | undefined;
2820
+ args?: string[] | undefined;
2821
2821
  closeTip?: string | undefined;
2822
2822
  closeCallbackUrl?: string | Record<string, string> | undefined;
2823
2823
  }, {
2824
2824
  type: "create";
2825
2825
  requestId: string;
2826
- command?: string | undefined;
2827
- args?: string[] | undefined;
2828
2826
  cols?: number | undefined;
2829
2827
  rows?: number | undefined;
2828
+ command?: string | undefined;
2829
+ args?: string[] | undefined;
2830
2830
  closeTip?: string | undefined;
2831
2831
  closeCallbackUrl?: string | Record<string, string> | undefined;
2832
2832
  }>, z.ZodObject<{
@@ -2968,22 +2968,22 @@ declare const PtyListResponseSchema: z.ZodObject<{
2968
2968
  closeTip: z.ZodOptional<z.ZodString>;
2969
2969
  closeCallbackUrl: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodRecord<z.ZodString, z.ZodString>]>>;
2970
2970
  }, "strip", z.ZodTypeAny, {
2971
- id: string;
2972
2971
  command: string;
2973
2972
  args: string[];
2974
2973
  platform: "windows" | "macos" | "common";
2975
2974
  exitCode: number | null;
2976
2975
  title: string;
2976
+ id: string;
2977
2977
  isExited: boolean;
2978
2978
  closeTip?: string | undefined;
2979
2979
  closeCallbackUrl?: string | Record<string, string> | undefined;
2980
2980
  }, {
2981
- id: string;
2982
2981
  command: string;
2983
2982
  args: string[];
2984
2983
  platform: "windows" | "macos" | "common";
2985
2984
  exitCode: number | null;
2986
2985
  title: string;
2986
+ id: string;
2987
2987
  isExited: boolean;
2988
2988
  closeTip?: string | undefined;
2989
2989
  closeCallbackUrl?: string | Record<string, string> | undefined;
@@ -2991,12 +2991,12 @@ declare const PtyListResponseSchema: z.ZodObject<{
2991
2991
  }, "strip", z.ZodTypeAny, {
2992
2992
  type: "list";
2993
2993
  sessions: {
2994
- id: string;
2995
2994
  command: string;
2996
2995
  args: string[];
2997
2996
  platform: "windows" | "macos" | "common";
2998
2997
  exitCode: number | null;
2999
2998
  title: string;
2999
+ id: string;
3000
3000
  isExited: boolean;
3001
3001
  closeTip?: string | undefined;
3002
3002
  closeCallbackUrl?: string | Record<string, string> | undefined;
@@ -3004,12 +3004,12 @@ declare const PtyListResponseSchema: z.ZodObject<{
3004
3004
  }, {
3005
3005
  type: "list";
3006
3006
  sessions: {
3007
- id: string;
3008
3007
  command: string;
3009
3008
  args: string[];
3010
3009
  platform: "windows" | "macos" | "common";
3011
3010
  exitCode: number | null;
3012
3011
  title: string;
3012
+ id: string;
3013
3013
  isExited: boolean;
3014
3014
  closeTip?: string | undefined;
3015
3015
  closeCallbackUrl?: string | Record<string, string> | undefined;
@@ -3022,14 +3022,14 @@ declare const PtyErrorResponseSchema: z.ZodObject<{
3022
3022
  message: z.ZodString;
3023
3023
  sessionId: z.ZodOptional<z.ZodString>;
3024
3024
  }, "strip", z.ZodTypeAny, {
3025
+ type: "error";
3025
3026
  code: "INVALID_JSON" | "INVALID_MESSAGE" | "SESSION_NOT_FOUND" | "PTY_CREATE_FAILED";
3026
3027
  message: string;
3027
- type: "error";
3028
3028
  sessionId?: string | undefined;
3029
3029
  }, {
3030
+ type: "error";
3030
3031
  code: "INVALID_JSON" | "INVALID_MESSAGE" | "SESSION_NOT_FOUND" | "PTY_CREATE_FAILED";
3031
3032
  message: string;
3032
- type: "error";
3033
3033
  sessionId?: string | undefined;
3034
3034
  }>;
3035
3035
  declare const PtyServerMessageSchema: z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
@@ -3108,22 +3108,22 @@ declare const PtyServerMessageSchema: z.ZodDiscriminatedUnion<"type", [z.ZodObje
3108
3108
  closeTip: z.ZodOptional<z.ZodString>;
3109
3109
  closeCallbackUrl: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodRecord<z.ZodString, z.ZodString>]>>;
3110
3110
  }, "strip", z.ZodTypeAny, {
3111
- id: string;
3112
3111
  command: string;
3113
3112
  args: string[];
3114
3113
  platform: "windows" | "macos" | "common";
3115
3114
  exitCode: number | null;
3116
3115
  title: string;
3116
+ id: string;
3117
3117
  isExited: boolean;
3118
3118
  closeTip?: string | undefined;
3119
3119
  closeCallbackUrl?: string | Record<string, string> | undefined;
3120
3120
  }, {
3121
- id: string;
3122
3121
  command: string;
3123
3122
  args: string[];
3124
3123
  platform: "windows" | "macos" | "common";
3125
3124
  exitCode: number | null;
3126
3125
  title: string;
3126
+ id: string;
3127
3127
  isExited: boolean;
3128
3128
  closeTip?: string | undefined;
3129
3129
  closeCallbackUrl?: string | Record<string, string> | undefined;
@@ -3131,12 +3131,12 @@ declare const PtyServerMessageSchema: z.ZodDiscriminatedUnion<"type", [z.ZodObje
3131
3131
  }, "strip", z.ZodTypeAny, {
3132
3132
  type: "list";
3133
3133
  sessions: {
3134
- id: string;
3135
3134
  command: string;
3136
3135
  args: string[];
3137
3136
  platform: "windows" | "macos" | "common";
3138
3137
  exitCode: number | null;
3139
3138
  title: string;
3139
+ id: string;
3140
3140
  isExited: boolean;
3141
3141
  closeTip?: string | undefined;
3142
3142
  closeCallbackUrl?: string | Record<string, string> | undefined;
@@ -3144,12 +3144,12 @@ declare const PtyServerMessageSchema: z.ZodDiscriminatedUnion<"type", [z.ZodObje
3144
3144
  }, {
3145
3145
  type: "list";
3146
3146
  sessions: {
3147
- id: string;
3148
3147
  command: string;
3149
3148
  args: string[];
3150
3149
  platform: "windows" | "macos" | "common";
3151
3150
  exitCode: number | null;
3152
3151
  title: string;
3152
+ id: string;
3153
3153
  isExited: boolean;
3154
3154
  closeTip?: string | undefined;
3155
3155
  closeCallbackUrl?: string | Record<string, string> | undefined;
@@ -3160,14 +3160,14 @@ declare const PtyServerMessageSchema: z.ZodDiscriminatedUnion<"type", [z.ZodObje
3160
3160
  message: z.ZodString;
3161
3161
  sessionId: z.ZodOptional<z.ZodString>;
3162
3162
  }, "strip", z.ZodTypeAny, {
3163
+ type: "error";
3163
3164
  code: "INVALID_JSON" | "INVALID_MESSAGE" | "SESSION_NOT_FOUND" | "PTY_CREATE_FAILED";
3164
3165
  message: string;
3165
- type: "error";
3166
3166
  sessionId?: string | undefined;
3167
3167
  }, {
3168
+ type: "error";
3168
3169
  code: "INVALID_JSON" | "INVALID_MESSAGE" | "SESSION_NOT_FOUND" | "PTY_CREATE_FAILED";
3169
3170
  message: string;
3170
- type: "error";
3171
3171
  sessionId?: string | undefined;
3172
3172
  }>]>;
3173
3173
  type PtyClientMessage = z.infer<typeof PtyClientMessageSchema>;
package/dist/index.mjs CHANGED
@@ -3873,6 +3873,17 @@ async function readEntriesUnderRoot(root) {
3873
3873
  };
3874
3874
  return collectEntries(root);
3875
3875
  }
3876
+ function splitRelativePathSegments(path) {
3877
+ return path.replace(/\\/g, "/").split("/").filter(Boolean);
3878
+ }
3879
+ function getGlobStaticPrefix(outputPath) {
3880
+ const normalizedPath = outputPath.replace(/\\/g, "/");
3881
+ const firstGlobIndex = normalizedPath.search(/[*?[]/);
3882
+ if (firstGlobIndex === -1) return normalizedPath;
3883
+ const staticPrefix = normalizedPath.slice(0, firstGlobIndex);
3884
+ const lastSlashIndex = staticPrefix.lastIndexOf("/");
3885
+ return lastSlashIndex === -1 ? "" : staticPrefix.slice(0, lastSlashIndex);
3886
+ }
3876
3887
  async function readGlobArtifactFiles(projectDir, changeId, outputPath) {
3877
3888
  return (await readEntriesUnderRoot(join$1(projectDir, "openspec", "changes", changeId))).filter((entry) => entry.type === "file" && matchesGlob(entry.path, outputPath)).map((entry) => ({
3878
3889
  path: entry.path,
@@ -3900,6 +3911,34 @@ async function touchOpsxChangeDeps(projectDir, changeId) {
3900
3911
  await reactiveReadDir(changeDir, { includeHidden: true });
3901
3912
  await reactiveReadFile(join$1(changeDir, ".openspec.yaml"));
3902
3913
  }
3914
+ async function touchDirectoryPathDeps(rootDir, relativePath) {
3915
+ let currentPath = rootDir;
3916
+ for (const segment of splitRelativePathSegments(relativePath)) {
3917
+ currentPath = join$1(currentPath, segment);
3918
+ await reactiveExists(currentPath);
3919
+ }
3920
+ }
3921
+ async function touchDirectoryTree(rootDir) {
3922
+ if (!(await reactiveStat(rootDir))?.isDirectory) return;
3923
+ const entries = await reactiveReadDir(rootDir, { includeHidden: true });
3924
+ await Promise.all(entries.map(async (entryName) => {
3925
+ const entryPath = join$1(rootDir, entryName);
3926
+ if ((await reactiveStat(entryPath))?.isDirectory) await touchDirectoryTree(entryPath);
3927
+ }));
3928
+ }
3929
+ async function touchArtifactOutputDeps(projectDir, changeId, outputPath) {
3930
+ const changeDir = join$1(projectDir, "openspec", "changes", changeId);
3931
+ const normalizedOutputPath = outputPath.replace(/\\/g, "/");
3932
+ if (isGlobPattern(normalizedOutputPath)) {
3933
+ const staticPrefix = getGlobStaticPrefix(normalizedOutputPath);
3934
+ if (staticPrefix) await touchDirectoryPathDeps(changeDir, staticPrefix);
3935
+ await touchDirectoryTree(staticPrefix ? join$1(changeDir, staticPrefix) : changeDir);
3936
+ return;
3937
+ }
3938
+ const parentPath = splitRelativePathSegments(normalizedOutputPath).slice(0, -1).join("/");
3939
+ if (parentPath) await touchDirectoryPathDeps(changeDir, parentPath);
3940
+ await reactiveExists(join$1(changeDir, normalizedOutputPath));
3941
+ }
3903
3942
  var OpsxKernel = class {
3904
3943
  projectDir;
3905
3944
  cliExecutor;
@@ -4237,7 +4276,10 @@ var OpsxKernel = class {
4237
4276
  if (!result.success) throw new Error(result.stderr || `openspec status failed (exit ${result.exitCode ?? "null"})`);
4238
4277
  const status = parseCliJson(result.stdout, ChangeStatusSchema, "openspec status");
4239
4278
  const changeRelDir = `openspec/changes/${changeId}`;
4240
- for (const artifact of status.artifacts) artifact.relativePath = `${changeRelDir}/${artifact.outputPath}`;
4279
+ for (const artifact of status.artifacts) {
4280
+ artifact.relativePath = `${changeRelDir}/${artifact.outputPath}`;
4281
+ await touchArtifactOutputDeps(this.projectDir, changeId, artifact.outputPath);
4282
+ }
4241
4283
  return status;
4242
4284
  }
4243
4285
  async fetchStatusList() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openspecui/core",
3
- "version": "3.1.0",
3
+ "version": "3.1.2",
4
4
  "description": "Core OpenSpec adapter and parser",
5
5
  "type": "module",
6
6
  "main": "./dist/index.mjs",