@openspecui/core 3.0.1 → 3.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,31 @@
1
+ //#region src/hosted-app.d.ts
2
+ declare const OFFICIAL_APP_BASE_URL = "https://app.openspecui.com";
3
+ declare const HOSTED_SHELL_PROTOCOL_VERSION = 1;
4
+ interface HostedBackendHealthResponse {
5
+ status: 'ok';
6
+ projectDir: string;
7
+ projectName: string;
8
+ watcherEnabled: boolean;
9
+ openspecuiVersion: string;
10
+ hostedShellProtocolVersion: typeof HOSTED_SHELL_PROTOCOL_VERSION;
11
+ embeddedUiUrl: string;
12
+ }
13
+ declare function normalizeHostedAppBaseUrl(input: string): string;
14
+ declare function resolveHostedAppBaseUrl(options: {
15
+ override?: string | null;
16
+ configured?: string | null;
17
+ }): string;
18
+ declare function normalizeEmbeddedUiUrl(input: string): string;
19
+ declare function isSupportedEmbeddedUiUrl(input: string): boolean;
20
+ declare function buildHostedLaunchUrl(options: {
21
+ baseUrl: string;
22
+ apiBaseUrl: string;
23
+ }): string;
24
+ declare function buildEmbeddedUiLaunchUrl(options: {
25
+ embeddedUiUrl: string;
26
+ apiBaseUrl: string;
27
+ sessionId: string;
28
+ }): string;
29
+ declare function isHostedBackendHealthResponse(value: unknown): value is HostedBackendHealthResponse;
30
+ //#endregion
31
+ export { buildHostedLaunchUrl as a, normalizeEmbeddedUiUrl as c, buildEmbeddedUiLaunchUrl as i, normalizeHostedAppBaseUrl as l, HostedBackendHealthResponse as n, isHostedBackendHealthResponse as o, OFFICIAL_APP_BASE_URL as r, isSupportedEmbeddedUiUrl as s, HOSTED_SHELL_PROTOCOL_VERSION as t, resolveHostedAppBaseUrl as u };
@@ -0,0 +1,74 @@
1
+ //#region src/hosted-app.ts
2
+ const OFFICIAL_APP_BASE_URL = "https://app.openspecui.com";
3
+ const HOSTED_SHELL_PROTOCOL_VERSION = 1;
4
+ function isRecord(value) {
5
+ return typeof value === "object" && value !== null;
6
+ }
7
+ function withHttpsProtocol(value) {
8
+ if (/^[a-zA-Z][a-zA-Z\d+.-]*:\/\//.test(value)) return value;
9
+ return `https://${value}`;
10
+ }
11
+ function normalizeHostedAppBaseUrl(input) {
12
+ const trimmed = input.trim();
13
+ if (!trimmed) throw new Error("Hosted app base URL must not be empty");
14
+ let parsed;
15
+ try {
16
+ parsed = new URL(withHttpsProtocol(trimmed));
17
+ } catch (error) {
18
+ throw new Error(`Invalid hosted app base URL: ${error instanceof Error ? error.message : String(error)}`);
19
+ }
20
+ parsed.hash = "";
21
+ parsed.search = "";
22
+ const pathname = parsed.pathname.replace(/\/+$/, "");
23
+ parsed.pathname = pathname.length > 0 ? pathname : "/";
24
+ return parsed.toString().replace(/\/$/, parsed.pathname === "/" ? "" : "");
25
+ }
26
+ function resolveHostedAppBaseUrl(options) {
27
+ return normalizeHostedAppBaseUrl(options.override?.trim() || options.configured?.trim() || OFFICIAL_APP_BASE_URL);
28
+ }
29
+ function normalizeEmbeddedUiUrl(input) {
30
+ const trimmed = input.trim();
31
+ if (!trimmed) throw new Error("Embedded UI URL must not be empty");
32
+ let parsed;
33
+ try {
34
+ parsed = new URL(trimmed);
35
+ } catch (error) {
36
+ throw new Error(`Invalid embedded UI URL: ${error instanceof Error ? error.message : String(error)}`);
37
+ }
38
+ parsed.hash = "";
39
+ const pathname = parsed.pathname.replace(/\/+$/, "");
40
+ parsed.pathname = pathname.length > 0 ? pathname : "/";
41
+ return parsed.toString().replace(/\/$/, parsed.pathname === "/" ? "" : "");
42
+ }
43
+ function isLoopbackHostname(hostname) {
44
+ const normalized = hostname.toLowerCase();
45
+ return normalized === "localhost" || normalized === "127.0.0.1" || normalized === "[::1]" || normalized.endsWith(".localhost");
46
+ }
47
+ function isSupportedEmbeddedUiUrl(input) {
48
+ let parsed;
49
+ try {
50
+ parsed = new URL(input);
51
+ } catch {
52
+ return false;
53
+ }
54
+ if (parsed.protocol === "https:") return true;
55
+ return parsed.protocol === "http:" && isLoopbackHostname(parsed.hostname);
56
+ }
57
+ function buildHostedLaunchUrl(options) {
58
+ const url = new URL(normalizeHostedAppBaseUrl(options.baseUrl));
59
+ url.searchParams.set("api", options.apiBaseUrl);
60
+ return url.toString();
61
+ }
62
+ function buildEmbeddedUiLaunchUrl(options) {
63
+ const url = new URL(normalizeEmbeddedUiUrl(options.embeddedUiUrl));
64
+ url.searchParams.set("api", options.apiBaseUrl);
65
+ url.searchParams.set("session", options.sessionId);
66
+ return url.toString();
67
+ }
68
+ function isHostedBackendHealthResponse(value) {
69
+ if (!isRecord(value)) return false;
70
+ return value.status === "ok" && typeof value.projectDir === "string" && typeof value.projectName === "string" && typeof value.watcherEnabled === "boolean" && typeof value.openspecuiVersion === "string" && value.hostedShellProtocolVersion === HOSTED_SHELL_PROTOCOL_VERSION && typeof value.embeddedUiUrl === "string" && isSupportedEmbeddedUiUrl(value.embeddedUiUrl);
71
+ }
72
+
73
+ //#endregion
74
+ export { isHostedBackendHealthResponse as a, normalizeHostedAppBaseUrl as c, buildHostedLaunchUrl as i, resolveHostedAppBaseUrl as l, OFFICIAL_APP_BASE_URL as n, isSupportedEmbeddedUiUrl as o, buildEmbeddedUiLaunchUrl as r, normalizeEmbeddedUiUrl as s, HOSTED_SHELL_PROTOCOL_VERSION as t };
@@ -1,2 +1,2 @@
1
- import { a as HostedBackendHealthResponse, c as buildHostedVersionManifestUrl, d as normalizeHostedAppBaseUrl, f as resolveHostedAppBaseUrl, i as HostedAppVersionManifest, l as isHostedAppVersionManifest, n as HostedAppChannelManifest, o as OFFICIAL_APP_BASE_URL, p as resolveHostedChannelForVersion, r as HostedAppCompatibilityEntry, s as buildHostedLaunchUrl, t as HostedAppChannelKind, u as isHostedBackendHealthResponse } from "./hosted-app-Dy4D7wV9.mjs";
2
- export { HostedAppChannelKind, HostedAppChannelManifest, HostedAppCompatibilityEntry, HostedAppVersionManifest, HostedBackendHealthResponse, OFFICIAL_APP_BASE_URL, buildHostedLaunchUrl, buildHostedVersionManifestUrl, isHostedAppVersionManifest, isHostedBackendHealthResponse, normalizeHostedAppBaseUrl, resolveHostedAppBaseUrl, resolveHostedChannelForVersion };
1
+ import { a as buildHostedLaunchUrl, c as normalizeEmbeddedUiUrl, i as buildEmbeddedUiLaunchUrl, l as normalizeHostedAppBaseUrl, n as HostedBackendHealthResponse, o as isHostedBackendHealthResponse, r as OFFICIAL_APP_BASE_URL, s as isSupportedEmbeddedUiUrl, t as HOSTED_SHELL_PROTOCOL_VERSION, u as resolveHostedAppBaseUrl } from "./hosted-app-B6b6fAYZ.mjs";
2
+ export { HOSTED_SHELL_PROTOCOL_VERSION, HostedBackendHealthResponse, OFFICIAL_APP_BASE_URL, buildEmbeddedUiLaunchUrl, buildHostedLaunchUrl, isHostedBackendHealthResponse, isSupportedEmbeddedUiUrl, normalizeEmbeddedUiUrl, normalizeHostedAppBaseUrl, resolveHostedAppBaseUrl };
@@ -1,3 +1,3 @@
1
- import { a as isHostedBackendHealthResponse, c as resolveHostedChannelForVersion, i as isHostedAppVersionManifest, n as buildHostedLaunchUrl, o as normalizeHostedAppBaseUrl, r as buildHostedVersionManifestUrl, s as resolveHostedAppBaseUrl, t as OFFICIAL_APP_BASE_URL } from "./hosted-app-Bv10mEdq.mjs";
1
+ import { a as isHostedBackendHealthResponse, c as normalizeHostedAppBaseUrl, i as buildHostedLaunchUrl, l as resolveHostedAppBaseUrl, n as OFFICIAL_APP_BASE_URL, o as isSupportedEmbeddedUiUrl, r as buildEmbeddedUiLaunchUrl, s as normalizeEmbeddedUiUrl, t as HOSTED_SHELL_PROTOCOL_VERSION } from "./hosted-app-RXZDSUtU.mjs";
2
2
 
3
- export { OFFICIAL_APP_BASE_URL, buildHostedLaunchUrl, buildHostedVersionManifestUrl, isHostedAppVersionManifest, isHostedBackendHealthResponse, normalizeHostedAppBaseUrl, resolveHostedAppBaseUrl, resolveHostedChannelForVersion };
3
+ export { HOSTED_SHELL_PROTOCOL_VERSION, OFFICIAL_APP_BASE_URL, buildEmbeddedUiLaunchUrl, buildHostedLaunchUrl, isHostedBackendHealthResponse, isSupportedEmbeddedUiUrl, normalizeEmbeddedUiUrl, normalizeHostedAppBaseUrl, resolveHostedAppBaseUrl };
package/dist/index.d.mts CHANGED
@@ -1,4 +1,4 @@
1
- import { a as HostedBackendHealthResponse, c as buildHostedVersionManifestUrl, d as normalizeHostedAppBaseUrl, f as resolveHostedAppBaseUrl, i as HostedAppVersionManifest, l as isHostedAppVersionManifest, n as HostedAppChannelManifest, o as OFFICIAL_APP_BASE_URL, p as resolveHostedChannelForVersion, r as HostedAppCompatibilityEntry, s as buildHostedLaunchUrl, t as HostedAppChannelKind, u as isHostedBackendHealthResponse } from "./hosted-app-Dy4D7wV9.mjs";
1
+ import { a as buildHostedLaunchUrl, c as normalizeEmbeddedUiUrl, i as buildEmbeddedUiLaunchUrl, l as normalizeHostedAppBaseUrl, n as HostedBackendHealthResponse, o as isHostedBackendHealthResponse, r as OFFICIAL_APP_BASE_URL, s as isSupportedEmbeddedUiUrl, t as HOSTED_SHELL_PROTOCOL_VERSION, u as resolveHostedAppBaseUrl } from "./hosted-app-B6b6fAYZ.mjs";
2
2
  import { n as toOpsxDisplayPath, t as VIRTUAL_PROJECT_DIRNAME } from "./opsx-display-path-C1H1ryBL.mjs";
3
3
  import { AsyncLocalStorage } from "node:async_hooks";
4
4
  import { z } from "zod";
@@ -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
- type: "file" | "directory";
23
22
  path: string;
23
+ type: "file" | "directory";
24
24
  content?: string | undefined;
25
25
  size?: number | undefined;
26
26
  }, {
27
- type: "file" | "directory";
28
27
  path: string;
28
+ type: "file" | "directory";
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: "command" | "compose";
1445
+ agentInvocationMode: "compose" | "command";
1446
1446
  }, {
1447
- agentInvocationMode?: "command" | "compose" | undefined;
1447
+ agentInvocationMode?: "compose" | "command" | 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: "command" | "compose";
1485
+ agentInvocationMode: "compose" | "command";
1486
1486
  }, {
1487
- agentInvocationMode?: "command" | "compose" | undefined;
1487
+ agentInvocationMode?: "compose" | "command" | 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: "command" | "compose";
1539
+ agentInvocationMode: "compose" | "command";
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?: "command" | "compose" | undefined;
1566
+ agentInvocationMode?: "compose" | "command" | 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
- status: "done" | "ready" | "blocked";
1987
1986
  id: string;
1987
+ status: "done" | "ready" | "blocked";
1988
1988
  outputPath: string;
1989
1989
  missingDeps?: string[] | undefined;
1990
1990
  relativePath?: string | undefined;
1991
1991
  }, {
1992
- status: "done" | "ready" | "blocked";
1993
1992
  id: string;
1993
+ status: "done" | "ready" | "blocked";
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
- status: "done" | "ready" | "blocked";
2012
2011
  id: string;
2012
+ status: "done" | "ready" | "blocked";
2013
2013
  outputPath: string;
2014
2014
  missingDeps?: string[] | undefined;
2015
2015
  relativePath?: string | undefined;
2016
2016
  }, {
2017
- status: "done" | "ready" | "blocked";
2018
2017
  id: string;
2018
+ status: "done" | "ready" | "blocked";
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
- status: "done" | "ready" | "blocked";
2030
2029
  id: string;
2030
+ status: "done" | "ready" | "blocked";
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
- status: "done" | "ready" | "blocked";
2042
2041
  id: string;
2042
+ status: "done" | "ready" | "blocked";
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
- path: string;
2056
2055
  id: string;
2056
+ path: string;
2057
2057
  description: string;
2058
2058
  done: boolean;
2059
2059
  }, {
2060
- path: string;
2061
2060
  id: string;
2061
+ path: 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
- path: string;
2171
2170
  id: string;
2171
+ path: string;
2172
2172
  description: string;
2173
2173
  done: boolean;
2174
2174
  }, {
2175
- path: string;
2176
2175
  id: string;
2176
+ path: 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
- path: string;
2191
2190
  id: string;
2191
+ path: 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
- path: string;
2209
2208
  id: string;
2209
+ path: 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
- path: string;
2256
2255
  name: string;
2256
+ path: 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
- path: string;
2266
2265
  name: string;
2266
+ path: 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;
2695
2696
  command: string;
2696
2697
  args: string[];
2697
2698
  platform: "windows" | "macos" | "common";
2698
2699
  exitCode: number | null;
2699
2700
  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;
2705
2706
  command: string;
2706
2707
  args: string[];
2707
2708
  platform: "windows" | "macos" | "common";
2708
2709
  exitCode: number | null;
2709
2710
  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
- cols?: number | undefined;
2728
- rows?: number | undefined;
2729
2727
  command?: string | undefined;
2730
2728
  args?: string[] | undefined;
2729
+ cols?: number | undefined;
2730
+ rows?: number | 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
- cols?: number | undefined;
2737
- rows?: number | undefined;
2738
2736
  command?: string | undefined;
2739
2737
  args?: string[] | undefined;
2738
+ cols?: number | undefined;
2739
+ rows?: number | 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
- cols?: number | undefined;
2818
- rows?: number | undefined;
2819
2817
  command?: string | undefined;
2820
2818
  args?: string[] | undefined;
2819
+ cols?: number | undefined;
2820
+ rows?: number | 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
- cols?: number | undefined;
2827
- rows?: number | undefined;
2828
2826
  command?: string | undefined;
2829
2827
  args?: string[] | undefined;
2828
+ cols?: number | undefined;
2829
+ rows?: number | 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;
2971
2972
  command: string;
2972
2973
  args: string[];
2973
2974
  platform: "windows" | "macos" | "common";
2974
2975
  exitCode: number | null;
2975
2976
  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;
2981
2982
  command: string;
2982
2983
  args: string[];
2983
2984
  platform: "windows" | "macos" | "common";
2984
2985
  exitCode: number | null;
2985
2986
  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;
2994
2995
  command: string;
2995
2996
  args: string[];
2996
2997
  platform: "windows" | "macos" | "common";
2997
2998
  exitCode: number | null;
2998
2999
  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;
3007
3008
  command: string;
3008
3009
  args: string[];
3009
3010
  platform: "windows" | "macos" | "common";
3010
3011
  exitCode: number | null;
3011
3012
  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";
3026
3025
  code: "INVALID_JSON" | "INVALID_MESSAGE" | "SESSION_NOT_FOUND" | "PTY_CREATE_FAILED";
3027
3026
  message: string;
3027
+ type: "error";
3028
3028
  sessionId?: string | undefined;
3029
3029
  }, {
3030
- type: "error";
3031
3030
  code: "INVALID_JSON" | "INVALID_MESSAGE" | "SESSION_NOT_FOUND" | "PTY_CREATE_FAILED";
3032
3031
  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;
3111
3112
  command: string;
3112
3113
  args: string[];
3113
3114
  platform: "windows" | "macos" | "common";
3114
3115
  exitCode: number | null;
3115
3116
  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;
3121
3122
  command: string;
3122
3123
  args: string[];
3123
3124
  platform: "windows" | "macos" | "common";
3124
3125
  exitCode: number | null;
3125
3126
  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;
3134
3135
  command: string;
3135
3136
  args: string[];
3136
3137
  platform: "windows" | "macos" | "common";
3137
3138
  exitCode: number | null;
3138
3139
  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;
3147
3148
  command: string;
3148
3149
  args: string[];
3149
3150
  platform: "windows" | "macos" | "common";
3150
3151
  exitCode: number | null;
3151
3152
  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";
3164
3163
  code: "INVALID_JSON" | "INVALID_MESSAGE" | "SESSION_NOT_FOUND" | "PTY_CREATE_FAILED";
3165
3164
  message: string;
3165
+ type: "error";
3166
3166
  sessionId?: string | undefined;
3167
3167
  }, {
3168
- type: "error";
3169
3168
  code: "INVALID_JSON" | "INVALID_MESSAGE" | "SESSION_NOT_FOUND" | "PTY_CREATE_FAILED";
3170
3169
  message: string;
3170
+ type: "error";
3171
3171
  sessionId?: string | undefined;
3172
3172
  }>]>;
3173
3173
  type PtyClientMessage = z.infer<typeof PtyClientMessageSchema>;
@@ -3175,4 +3175,4 @@ type PtyServerMessage = z.infer<typeof PtyServerMessageSchema>;
3175
3175
  type PtySessionInfo = z.infer<typeof PtySessionInfoSchema>;
3176
3176
  type PtyPlatform = z.infer<typeof PtyPlatformSchema>;
3177
3177
  //#endregion
3178
- export { type AIToolOption, AI_TOOLS, type ApplyInstructions, ApplyInstructionsContextFilesSchema, ApplyInstructionsSchema, type ApplyTask, ApplyTaskSchema, type ArchiveMeta, type ArtifactInstructions, ArtifactInstructionsSchema, type ArtifactStatus, ArtifactStatusSchema, CODE_EDITOR_THEME_VALUES, type Change, type ChangeFile, ChangeFileSchema, type ChangeMeta, ChangeSchema, type ChangeStatus, ChangeStatusSchema, CliExecutor, type CliResult, type CliRunnerAttempt, type CliSniffResult, type CliStreamEvent, type CodeEditorTheme, CodeEditorThemeSchema, ConfigManager, DASHBOARD_METRIC_KEYS, DEFAULT_CONFIG, DEFAULT_GIT_DIFF_EAGER_LINE_BUDGET, type DashboardCardAvailability, type DashboardConfig, DashboardConfigSchema, type DashboardGitCommitEntry, type DashboardGitDiffStats, type DashboardGitEntry, type DashboardGitSnapshot, type DashboardGitUncommittedEntry, type DashboardGitWorktree, type DashboardMetricKey, type DashboardOverview, type DashboardSummary, type DashboardTrendKind, type DashboardTrendMeta, type DashboardTrendPoint, type DashboardTriColorTrendPoint, type Delta, type DeltaOperation, DeltaOperationType, DeltaSchema, type DeltaSpec, DeltaSpecSchema, type DependencyInfo, DependencyInfoSchema, type ExportSnapshot, type FileChangeEvent, type FileChangeType, type GitConfig, GitConfigSchema, type GitEntriesPage, type GitEntryCursor, type GitEntryDetail, type GitEntryFileDiff, type GitEntryFilePatch, type GitEntryFileSource, type GitEntryFileSummary, type GitEntryFiles, type GitEntryPatch, type GitEntrySelector, type GitEntryShell, type GitFileChangeType, type GitPatchFile, type GitPatchState, type GitWorktreeHandoff, type GitWorktreeOverview, type GitWorktreeSummary, type HostedAppChannelKind, type HostedAppChannelManifest, type HostedAppCompatibilityEntry, type HostedAppVersionManifest, type HostedBackendHealthResponse, MarkdownParser, OFFICIAL_APP_BASE_URL, OPSX_AGENT_INVOCATION_MODE_VALUES, OpenSpecAdapter, type OpenSpecUIConfig, OpenSpecUIConfigSchema, type OpenSpecUIConfigUpdate, OpenSpecWatcher, type OpsxAgentInvocationMode, OpsxAgentInvocationModeSchema, type OpsxConfig, OpsxConfigSchema, OpsxKernel, type PathCallback, type ProjectRecoveryStatus, type ProjectResidencyEvictionReason, type ProjectResidencyStatus, ProjectWatcher, type ProjectWatcherReinitializeReason, type ProjectWatcherRuntimeStatus, type ProjectWatcherRuntimeStatusListener, PtyAttachMessageSchema, PtyBufferResponseSchema, type PtyClientMessage, PtyClientMessageSchema, PtyCloseMessageSchema, PtyCreateMessageSchema, PtyCreatedResponseSchema, PtyErrorCodeSchema, PtyErrorResponseSchema, PtyExitResponseSchema, PtyInputMessageSchema, PtyListMessageSchema, PtyListResponseSchema, PtyOutputResponseSchema, type PtyPlatform, PtyPlatformSchema, PtyResizeMessageSchema, type PtyServerMessage, PtyServerMessageSchema, type PtySessionInfo, PtyTitleResponseSchema, ReactiveContext, ReactiveState, type ReactiveStateOptions, type Requirement, RequirementSchema, type ResolvedCliRunner, type SchemaArtifact, SchemaArtifactSchema, type SchemaDetail, SchemaDetailSchema, type SchemaInfo, SchemaInfoSchema, type SchemaResolution, SchemaResolutionSchema, type Spec, type SpecMeta, SpecSchema, TOOL_WORKFLOW_TO_SKILL_DIR, type Task, TaskSchema, type TemplateContentMap, type TemplatesMap, TemplatesSchema, type TerminalConfig, TerminalConfigSchema, type TerminalRendererEngine, TerminalRendererEngineSchema, type ToolConfig, type ToolInitDelivery, type ToolInitState, type ToolInitStatus, type ToolWorkflowId, VIRTUAL_PROJECT_DIRNAME, type ValidationIssue, type ValidationResult, Validator, type WatchEvent, type WatchEventType, type WatcherRuntimeStatus, acquireWatcher, buildCliRunnerCandidates, buildHostedLaunchUrl, buildHostedVersionManifestUrl, clearCache, closeAllProjectWatchers, closeAllWatchers, contextStorage, createCleanCliEnv, createFileChangeObservable, getActiveWatcherCount, getAllToolIds, getAllTools, getAvailableToolIds, getAvailableTools, getCacheSize, getConfiguredTools, getDefaultCliCommand, getDefaultCliCommandString, getDetectedProjectTools, getProjectWatcher, getToolById, getToolInitStates, getWatchedProjectDir, getWatcherRuntimeStatus, initWatcherPool, isGlobPattern, isHostedAppVersionManifest, isHostedBackendHealthResponse, isTerminalRendererEngine, isToolConfigured, isWatcherPoolInitialized, normalizeHostedAppBaseUrl, parseCliCommand, reactiveExists, reactiveReadDir, reactiveReadFile, reactiveStat, resolveHostedAppBaseUrl, resolveHostedChannelForVersion, sniffGlobalCli, subscribeWatcherRuntimeStatus, toOpsxDisplayPath };
3178
+ export { type AIToolOption, AI_TOOLS, type ApplyInstructions, ApplyInstructionsContextFilesSchema, ApplyInstructionsSchema, type ApplyTask, ApplyTaskSchema, type ArchiveMeta, type ArtifactInstructions, ArtifactInstructionsSchema, type ArtifactStatus, ArtifactStatusSchema, CODE_EDITOR_THEME_VALUES, type Change, type ChangeFile, ChangeFileSchema, type ChangeMeta, ChangeSchema, type ChangeStatus, ChangeStatusSchema, CliExecutor, type CliResult, type CliRunnerAttempt, type CliSniffResult, type CliStreamEvent, type CodeEditorTheme, CodeEditorThemeSchema, ConfigManager, DASHBOARD_METRIC_KEYS, DEFAULT_CONFIG, DEFAULT_GIT_DIFF_EAGER_LINE_BUDGET, type DashboardCardAvailability, type DashboardConfig, DashboardConfigSchema, type DashboardGitCommitEntry, type DashboardGitDiffStats, type DashboardGitEntry, type DashboardGitSnapshot, type DashboardGitUncommittedEntry, type DashboardGitWorktree, type DashboardMetricKey, type DashboardOverview, type DashboardSummary, type DashboardTrendKind, type DashboardTrendMeta, type DashboardTrendPoint, type DashboardTriColorTrendPoint, type Delta, type DeltaOperation, DeltaOperationType, DeltaSchema, type DeltaSpec, DeltaSpecSchema, type DependencyInfo, DependencyInfoSchema, type ExportSnapshot, type FileChangeEvent, type FileChangeType, type GitConfig, GitConfigSchema, type GitEntriesPage, type GitEntryCursor, type GitEntryDetail, type GitEntryFileDiff, type GitEntryFilePatch, type GitEntryFileSource, type GitEntryFileSummary, type GitEntryFiles, type GitEntryPatch, type GitEntrySelector, type GitEntryShell, type GitFileChangeType, type GitPatchFile, type GitPatchState, type GitWorktreeHandoff, type GitWorktreeOverview, type GitWorktreeSummary, HOSTED_SHELL_PROTOCOL_VERSION, type HostedBackendHealthResponse, MarkdownParser, OFFICIAL_APP_BASE_URL, OPSX_AGENT_INVOCATION_MODE_VALUES, OpenSpecAdapter, type OpenSpecUIConfig, OpenSpecUIConfigSchema, type OpenSpecUIConfigUpdate, OpenSpecWatcher, type OpsxAgentInvocationMode, OpsxAgentInvocationModeSchema, type OpsxConfig, OpsxConfigSchema, OpsxKernel, type PathCallback, type ProjectRecoveryStatus, type ProjectResidencyEvictionReason, type ProjectResidencyStatus, ProjectWatcher, type ProjectWatcherReinitializeReason, type ProjectWatcherRuntimeStatus, type ProjectWatcherRuntimeStatusListener, PtyAttachMessageSchema, PtyBufferResponseSchema, type PtyClientMessage, PtyClientMessageSchema, PtyCloseMessageSchema, PtyCreateMessageSchema, PtyCreatedResponseSchema, PtyErrorCodeSchema, PtyErrorResponseSchema, PtyExitResponseSchema, PtyInputMessageSchema, PtyListMessageSchema, PtyListResponseSchema, PtyOutputResponseSchema, type PtyPlatform, PtyPlatformSchema, PtyResizeMessageSchema, type PtyServerMessage, PtyServerMessageSchema, type PtySessionInfo, PtyTitleResponseSchema, ReactiveContext, ReactiveState, type ReactiveStateOptions, type Requirement, RequirementSchema, type ResolvedCliRunner, type SchemaArtifact, SchemaArtifactSchema, type SchemaDetail, SchemaDetailSchema, type SchemaInfo, SchemaInfoSchema, type SchemaResolution, SchemaResolutionSchema, type Spec, type SpecMeta, SpecSchema, TOOL_WORKFLOW_TO_SKILL_DIR, type Task, TaskSchema, type TemplateContentMap, type TemplatesMap, TemplatesSchema, type TerminalConfig, TerminalConfigSchema, type TerminalRendererEngine, TerminalRendererEngineSchema, type ToolConfig, type ToolInitDelivery, type ToolInitState, type ToolInitStatus, type ToolWorkflowId, VIRTUAL_PROJECT_DIRNAME, type ValidationIssue, type ValidationResult, Validator, type WatchEvent, type WatchEventType, type WatcherRuntimeStatus, acquireWatcher, buildCliRunnerCandidates, buildEmbeddedUiLaunchUrl, buildHostedLaunchUrl, clearCache, closeAllProjectWatchers, closeAllWatchers, contextStorage, createCleanCliEnv, createFileChangeObservable, getActiveWatcherCount, getAllToolIds, getAllTools, getAvailableToolIds, getAvailableTools, getCacheSize, getConfiguredTools, getDefaultCliCommand, getDefaultCliCommandString, getDetectedProjectTools, getProjectWatcher, getToolById, getToolInitStates, getWatchedProjectDir, getWatcherRuntimeStatus, initWatcherPool, isGlobPattern, isHostedBackendHealthResponse, isSupportedEmbeddedUiUrl, isTerminalRendererEngine, isToolConfigured, isWatcherPoolInitialized, normalizeEmbeddedUiUrl, normalizeHostedAppBaseUrl, parseCliCommand, reactiveExists, reactiveReadDir, reactiveReadFile, reactiveStat, resolveHostedAppBaseUrl, sniffGlobalCli, subscribeWatcherRuntimeStatus, toOpsxDisplayPath };
package/dist/index.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { a as isHostedBackendHealthResponse, c as resolveHostedChannelForVersion, i as isHostedAppVersionManifest, n as buildHostedLaunchUrl, o as normalizeHostedAppBaseUrl, r as buildHostedVersionManifestUrl, s as resolveHostedAppBaseUrl, t as OFFICIAL_APP_BASE_URL } from "./hosted-app-Bv10mEdq.mjs";
1
+ import { a as isHostedBackendHealthResponse, c as normalizeHostedAppBaseUrl, i as buildHostedLaunchUrl, l as resolveHostedAppBaseUrl, n as OFFICIAL_APP_BASE_URL, o as isSupportedEmbeddedUiUrl, r as buildEmbeddedUiLaunchUrl, s as normalizeEmbeddedUiUrl, t as HOSTED_SHELL_PROTOCOL_VERSION } from "./hosted-app-RXZDSUtU.mjs";
2
2
  import { n as toOpsxDisplayPath, t as VIRTUAL_PROJECT_DIRNAME } from "./opsx-display-path-Cja3Bt1P.mjs";
3
3
  import { mkdir, readFile, rename, writeFile } from "fs/promises";
4
4
  import { dirname, join } from "path";
@@ -4587,4 +4587,4 @@ const PtyServerMessageSchema = z.discriminatedUnion("type", [
4587
4587
  ]);
4588
4588
 
4589
4589
  //#endregion
4590
- export { AI_TOOLS, ApplyInstructionsContextFilesSchema, ApplyInstructionsSchema, ApplyTaskSchema, ArtifactInstructionsSchema, ArtifactStatusSchema, CODE_EDITOR_THEME_VALUES, ChangeFileSchema, ChangeSchema, ChangeStatusSchema, CliExecutor, CodeEditorThemeSchema, ConfigManager, DASHBOARD_METRIC_KEYS, DEFAULT_CONFIG, DEFAULT_GIT_DIFF_EAGER_LINE_BUDGET, DashboardConfigSchema, DeltaOperationType, DeltaSchema, DeltaSpecSchema, DependencyInfoSchema, GitConfigSchema, MarkdownParser, OFFICIAL_APP_BASE_URL, OPSX_AGENT_INVOCATION_MODE_VALUES, OpenSpecAdapter, OpenSpecUIConfigSchema, OpenSpecWatcher, OpsxAgentInvocationModeSchema, OpsxConfigSchema, OpsxKernel, ProjectWatcher, PtyAttachMessageSchema, PtyBufferResponseSchema, PtyClientMessageSchema, PtyCloseMessageSchema, PtyCreateMessageSchema, PtyCreatedResponseSchema, PtyErrorCodeSchema, PtyErrorResponseSchema, PtyExitResponseSchema, PtyInputMessageSchema, PtyListMessageSchema, PtyListResponseSchema, PtyOutputResponseSchema, PtyPlatformSchema, PtyResizeMessageSchema, PtyServerMessageSchema, PtyTitleResponseSchema, ReactiveContext, ReactiveState, RequirementSchema, SchemaArtifactSchema, SchemaDetailSchema, SchemaInfoSchema, SchemaResolutionSchema, SpecSchema, TOOL_WORKFLOW_TO_SKILL_DIR, TaskSchema, TemplatesSchema, TerminalConfigSchema, TerminalRendererEngineSchema, VIRTUAL_PROJECT_DIRNAME, Validator, acquireWatcher, buildCliRunnerCandidates, buildHostedLaunchUrl, buildHostedVersionManifestUrl, clearCache, closeAllProjectWatchers, closeAllWatchers, contextStorage, createCleanCliEnv, createFileChangeObservable, getActiveWatcherCount, getAllToolIds, getAllTools, getAvailableToolIds, getAvailableTools, getCacheSize, getConfiguredTools, getDefaultCliCommand, getDefaultCliCommandString, getDetectedProjectTools, getProjectWatcher, getToolById, getToolInitStates, getWatchedProjectDir, getWatcherRuntimeStatus, initWatcherPool, isGlobPattern, isHostedAppVersionManifest, isHostedBackendHealthResponse, isTerminalRendererEngine, isToolConfigured, isWatcherPoolInitialized, normalizeHostedAppBaseUrl, parseCliCommand, reactiveExists, reactiveReadDir, reactiveReadFile, reactiveStat, resolveHostedAppBaseUrl, resolveHostedChannelForVersion, sniffGlobalCli, subscribeWatcherRuntimeStatus, toOpsxDisplayPath };
4590
+ export { AI_TOOLS, ApplyInstructionsContextFilesSchema, ApplyInstructionsSchema, ApplyTaskSchema, ArtifactInstructionsSchema, ArtifactStatusSchema, CODE_EDITOR_THEME_VALUES, ChangeFileSchema, ChangeSchema, ChangeStatusSchema, CliExecutor, CodeEditorThemeSchema, ConfigManager, DASHBOARD_METRIC_KEYS, DEFAULT_CONFIG, DEFAULT_GIT_DIFF_EAGER_LINE_BUDGET, DashboardConfigSchema, DeltaOperationType, DeltaSchema, DeltaSpecSchema, DependencyInfoSchema, GitConfigSchema, HOSTED_SHELL_PROTOCOL_VERSION, MarkdownParser, OFFICIAL_APP_BASE_URL, OPSX_AGENT_INVOCATION_MODE_VALUES, OpenSpecAdapter, OpenSpecUIConfigSchema, OpenSpecWatcher, OpsxAgentInvocationModeSchema, OpsxConfigSchema, OpsxKernel, ProjectWatcher, PtyAttachMessageSchema, PtyBufferResponseSchema, PtyClientMessageSchema, PtyCloseMessageSchema, PtyCreateMessageSchema, PtyCreatedResponseSchema, PtyErrorCodeSchema, PtyErrorResponseSchema, PtyExitResponseSchema, PtyInputMessageSchema, PtyListMessageSchema, PtyListResponseSchema, PtyOutputResponseSchema, PtyPlatformSchema, PtyResizeMessageSchema, PtyServerMessageSchema, PtyTitleResponseSchema, ReactiveContext, ReactiveState, RequirementSchema, SchemaArtifactSchema, SchemaDetailSchema, SchemaInfoSchema, SchemaResolutionSchema, SpecSchema, TOOL_WORKFLOW_TO_SKILL_DIR, TaskSchema, TemplatesSchema, TerminalConfigSchema, TerminalRendererEngineSchema, VIRTUAL_PROJECT_DIRNAME, Validator, acquireWatcher, buildCliRunnerCandidates, buildEmbeddedUiLaunchUrl, buildHostedLaunchUrl, clearCache, closeAllProjectWatchers, closeAllWatchers, contextStorage, createCleanCliEnv, createFileChangeObservable, getActiveWatcherCount, getAllToolIds, getAllTools, getAvailableToolIds, getAvailableTools, getCacheSize, getConfiguredTools, getDefaultCliCommand, getDefaultCliCommandString, getDetectedProjectTools, getProjectWatcher, getToolById, getToolInitStates, getWatchedProjectDir, getWatcherRuntimeStatus, initWatcherPool, isGlobPattern, isHostedBackendHealthResponse, isSupportedEmbeddedUiUrl, isTerminalRendererEngine, isToolConfigured, isWatcherPoolInitialized, normalizeEmbeddedUiUrl, normalizeHostedAppBaseUrl, parseCliCommand, reactiveExists, reactiveReadDir, reactiveReadFile, reactiveStat, resolveHostedAppBaseUrl, sniffGlobalCli, subscribeWatcherRuntimeStatus, toOpsxDisplayPath };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openspecui/core",
3
- "version": "3.0.1",
3
+ "version": "3.1.0",
4
4
  "description": "Core OpenSpec adapter and parser",
5
5
  "type": "module",
6
6
  "main": "./dist/index.mjs",
@@ -1,86 +0,0 @@
1
- //#region src/hosted-app.ts
2
- const OFFICIAL_APP_BASE_URL = "https://app.openspecui.com";
3
- function isRecord(value) {
4
- return typeof value === "object" && value !== null;
5
- }
6
- function withHttpsProtocol(value) {
7
- if (/^[a-zA-Z][a-zA-Z\d+.-]*:\/\//.test(value)) return value;
8
- return `https://${value}`;
9
- }
10
- function parseVersionTuple(raw) {
11
- const match = raw.trim().match(/^(\d+)\.(\d+)\.(\d+)(?:[-+].*)?$/);
12
- if (!match) return null;
13
- return {
14
- major: Number(match[1]),
15
- minor: Number(match[2]),
16
- patch: Number(match[3])
17
- };
18
- }
19
- function parseCompatibilityRange(range) {
20
- const match = range.trim().match(/^~(\d+)\.(\d+)\.\d+$/);
21
- if (!match) return null;
22
- return {
23
- major: Number(match[1]),
24
- minor: Number(match[2])
25
- };
26
- }
27
- function normalizeHostedAppBaseUrl(input) {
28
- const trimmed = input.trim();
29
- if (!trimmed) throw new Error("Hosted app base URL must not be empty");
30
- let parsed;
31
- try {
32
- parsed = new URL(withHttpsProtocol(trimmed));
33
- } catch (error) {
34
- throw new Error(`Invalid hosted app base URL: ${error instanceof Error ? error.message : String(error)}`);
35
- }
36
- parsed.hash = "";
37
- parsed.search = "";
38
- const pathname = parsed.pathname.replace(/\/+$/, "");
39
- parsed.pathname = pathname.length > 0 ? pathname : "/";
40
- return parsed.toString().replace(/\/$/, parsed.pathname === "/" ? "" : "");
41
- }
42
- function resolveHostedAppBaseUrl(options) {
43
- return normalizeHostedAppBaseUrl(options.override?.trim() || options.configured?.trim() || OFFICIAL_APP_BASE_URL);
44
- }
45
- function buildHostedVersionManifestUrl(baseUrl) {
46
- return `${normalizeHostedAppBaseUrl(baseUrl)}/version.json`;
47
- }
48
- function buildHostedLaunchUrl(options) {
49
- const url = new URL(normalizeHostedAppBaseUrl(options.baseUrl));
50
- url.searchParams.set("api", options.apiBaseUrl);
51
- return url.toString();
52
- }
53
- function isHostedAppVersionManifest(value) {
54
- if (!isRecord(value)) return false;
55
- if (value.packageName !== "openspecui") return false;
56
- if (typeof value.generatedAt !== "string") return false;
57
- if (typeof value.defaultChannel !== "string") return false;
58
- if (!isRecord(value.channels)) return false;
59
- if (!Array.isArray(value.compatibility)) return false;
60
- return Object.values(value.channels).every((channel) => {
61
- if (!isRecord(channel)) return false;
62
- return typeof channel.id === "string" && typeof channel.kind === "string" && typeof channel.selector === "string" && typeof channel.resolvedVersion === "string" && typeof channel.rootPath === "string" && typeof channel.shellPath === "string" && typeof channel.major === "number";
63
- });
64
- }
65
- function isHostedBackendHealthResponse(value) {
66
- if (!isRecord(value)) return false;
67
- return value.status === "ok" && typeof value.projectDir === "string" && typeof value.projectName === "string" && typeof value.watcherEnabled === "boolean" && typeof value.openspecuiVersion === "string";
68
- }
69
- function resolveHostedChannelForVersion(manifest, version) {
70
- const parsed = parseVersionTuple(version);
71
- if (!parsed) return null;
72
- for (const entry of manifest.compatibility) {
73
- const range = parseCompatibilityRange(entry.range);
74
- if (!range) continue;
75
- if (!manifest.channels[entry.channel]) continue;
76
- if (range.major === parsed.major && range.minor === parsed.minor) return entry.channel;
77
- }
78
- const exactMinorChannel = `v${parsed.major}.${parsed.minor}`;
79
- if (manifest.channels[exactMinorChannel]) return exactMinorChannel;
80
- const majorChannel = `v${parsed.major}`;
81
- if (manifest.channels[majorChannel]) return majorChannel;
82
- return manifest.channels[manifest.defaultChannel] ? manifest.defaultChannel : null;
83
- }
84
-
85
- //#endregion
86
- export { isHostedBackendHealthResponse as a, resolveHostedChannelForVersion as c, isHostedAppVersionManifest as i, buildHostedLaunchUrl as n, normalizeHostedAppBaseUrl as o, buildHostedVersionManifestUrl as r, resolveHostedAppBaseUrl as s, OFFICIAL_APP_BASE_URL as t };
@@ -1,46 +0,0 @@
1
- //#region src/hosted-app.d.ts
2
- declare const OFFICIAL_APP_BASE_URL = "https://app.openspecui.com";
3
- type HostedAppChannelKind = 'latest' | 'major' | 'minor';
4
- interface HostedAppChannelManifest {
5
- id: string;
6
- kind: HostedAppChannelKind;
7
- selector: string;
8
- resolvedVersion: string;
9
- rootPath: string;
10
- shellPath: string;
11
- major: number;
12
- minor?: number;
13
- }
14
- interface HostedAppCompatibilityEntry {
15
- range: string;
16
- channel: string;
17
- }
18
- interface HostedAppVersionManifest {
19
- packageName: 'openspecui';
20
- generatedAt: string;
21
- defaultChannel: string;
22
- channels: Record<string, HostedAppChannelManifest>;
23
- compatibility: HostedAppCompatibilityEntry[];
24
- }
25
- interface HostedBackendHealthResponse {
26
- status: 'ok';
27
- projectDir: string;
28
- projectName: string;
29
- watcherEnabled: boolean;
30
- openspecuiVersion: string;
31
- }
32
- declare function normalizeHostedAppBaseUrl(input: string): string;
33
- declare function resolveHostedAppBaseUrl(options: {
34
- override?: string | null;
35
- configured?: string | null;
36
- }): string;
37
- declare function buildHostedVersionManifestUrl(baseUrl: string): string;
38
- declare function buildHostedLaunchUrl(options: {
39
- baseUrl: string;
40
- apiBaseUrl: string;
41
- }): string;
42
- declare function isHostedAppVersionManifest(value: unknown): value is HostedAppVersionManifest;
43
- declare function isHostedBackendHealthResponse(value: unknown): value is HostedBackendHealthResponse;
44
- declare function resolveHostedChannelForVersion(manifest: HostedAppVersionManifest, version: string): string | null;
45
- //#endregion
46
- export { HostedBackendHealthResponse as a, buildHostedVersionManifestUrl as c, normalizeHostedAppBaseUrl as d, resolveHostedAppBaseUrl as f, HostedAppVersionManifest as i, isHostedAppVersionManifest as l, HostedAppChannelManifest as n, OFFICIAL_APP_BASE_URL as o, resolveHostedChannelForVersion as p, HostedAppCompatibilityEntry as r, buildHostedLaunchUrl as s, HostedAppChannelKind as t, isHostedBackendHealthResponse as u };