@openspecui/core 3.0.1 → 3.1.1

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";
@@ -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.1",
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 };