@openspecui/core 0.9.0 → 1.0.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.
Files changed (3) hide show
  1. package/dist/index.d.mts +1090 -108
  2. package/dist/index.mjs +1414 -269
  3. package/package.json +3 -1
package/dist/index.d.mts CHANGED
@@ -1284,16 +1284,40 @@ declare function createFileChangeObservable(watcher: OpenSpecWatcher): {
1284
1284
  };
1285
1285
  //#endregion
1286
1286
  //#region src/config.d.ts
1287
+ type RunnerId = 'configured' | 'openspec' | 'npx' | 'bunx' | 'deno' | 'pnpm' | 'yarn';
1288
+ interface CliRunnerCandidate {
1289
+ id: RunnerId;
1290
+ source: string;
1291
+ commandParts: readonly string[];
1292
+ }
1293
+ interface CliRunnerAttempt {
1294
+ source: string;
1295
+ command: string;
1296
+ success: boolean;
1297
+ version?: string;
1298
+ error?: string;
1299
+ exitCode: number | null;
1300
+ }
1301
+ interface ResolvedCliRunner {
1302
+ source: string;
1303
+ command: string;
1304
+ commandParts: readonly string[];
1305
+ version?: string;
1306
+ attempts: readonly CliRunnerAttempt[];
1307
+ }
1287
1308
  /**
1288
1309
  * 解析 CLI 命令字符串为数组
1289
1310
  *
1290
1311
  * 支持两种格式:
1291
1312
  * 1. JSON 数组:以 `[` 开头,如 `["npx", "@fission-ai/openspec"]`
1292
- * 2. 简单字符串:用空格分割,如 `npx @fission-ai/openspec`
1293
- *
1294
- * 注意:简单字符串解析不支持带引号的参数,如需复杂命令请使用 JSON 数组格式
1313
+ * 2. shell-like 字符串:支持引号与基础转义
1295
1314
  */
1296
1315
  declare function parseCliCommand(command: string): string[];
1316
+ declare function buildCliRunnerCandidates(options: {
1317
+ configuredCommandParts?: readonly string[];
1318
+ userAgent?: string | null;
1319
+ }): readonly CliRunnerCandidate[];
1320
+ declare function createCleanCliEnv(baseEnv?: NodeJS.ProcessEnv): NodeJS.ProcessEnv;
1297
1321
  /** CLI 嗅探结果 */
1298
1322
  interface CliSniffResult {
1299
1323
  /** 是否存在全局 openspec 命令 */
@@ -1325,6 +1349,26 @@ declare function getDefaultCliCommand(): Promise<readonly string[]>;
1325
1349
  * 获取默认 CLI 命令的字符串形式(用于 UI 显示)
1326
1350
  */
1327
1351
  declare function getDefaultCliCommandString(): Promise<string>;
1352
+ declare const TerminalConfigSchema: z.ZodObject<{
1353
+ fontSize: z.ZodDefault<z.ZodNumber>;
1354
+ fontFamily: z.ZodDefault<z.ZodString>;
1355
+ cursorBlink: z.ZodDefault<z.ZodBoolean>;
1356
+ cursorStyle: z.ZodDefault<z.ZodEnum<["block", "underline", "bar"]>>;
1357
+ scrollback: z.ZodDefault<z.ZodNumber>;
1358
+ }, "strip", z.ZodTypeAny, {
1359
+ fontSize: number;
1360
+ fontFamily: string;
1361
+ cursorBlink: boolean;
1362
+ cursorStyle: "block" | "underline" | "bar";
1363
+ scrollback: number;
1364
+ }, {
1365
+ fontSize?: number | undefined;
1366
+ fontFamily?: string | undefined;
1367
+ cursorBlink?: boolean | undefined;
1368
+ cursorStyle?: "block" | "underline" | "bar" | undefined;
1369
+ scrollback?: number | undefined;
1370
+ }>;
1371
+ type TerminalConfig = z.infer<typeof TerminalConfigSchema>;
1328
1372
  /**
1329
1373
  * OpenSpecUI 配置 Schema
1330
1374
  *
@@ -1335,36 +1379,73 @@ declare const OpenSpecUIConfigSchema: z.ZodObject<{
1335
1379
  cli: z.ZodDefault<z.ZodObject<{
1336
1380
  /** CLI 命令前缀 */
1337
1381
  command: z.ZodOptional<z.ZodString>;
1382
+ /** CLI 命令参数 */
1383
+ args: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
1338
1384
  }, "strip", z.ZodTypeAny, {
1339
1385
  command?: string | undefined;
1386
+ args?: string[] | undefined;
1340
1387
  }, {
1341
1388
  command?: string | undefined;
1389
+ args?: string[] | undefined;
1342
1390
  }>>;
1343
- /** UI 配置 */
1344
- ui: z.ZodDefault<z.ZodObject<{
1345
- /** 主题 */
1346
- theme: z.ZodDefault<z.ZodEnum<["light", "dark", "system"]>>;
1391
+ /** 主题 */
1392
+ theme: z.ZodDefault<z.ZodEnum<["light", "dark", "system"]>>;
1393
+ /** 终端配置 */
1394
+ terminal: z.ZodDefault<z.ZodObject<{
1395
+ fontSize: z.ZodDefault<z.ZodNumber>;
1396
+ fontFamily: z.ZodDefault<z.ZodString>;
1397
+ cursorBlink: z.ZodDefault<z.ZodBoolean>;
1398
+ cursorStyle: z.ZodDefault<z.ZodEnum<["block", "underline", "bar"]>>;
1399
+ scrollback: z.ZodDefault<z.ZodNumber>;
1347
1400
  }, "strip", z.ZodTypeAny, {
1348
- theme: "light" | "dark" | "system";
1401
+ fontSize: number;
1402
+ fontFamily: string;
1403
+ cursorBlink: boolean;
1404
+ cursorStyle: "block" | "underline" | "bar";
1405
+ scrollback: number;
1349
1406
  }, {
1350
- theme?: "light" | "dark" | "system" | undefined;
1407
+ fontSize?: number | undefined;
1408
+ fontFamily?: string | undefined;
1409
+ cursorBlink?: boolean | undefined;
1410
+ cursorStyle?: "block" | "underline" | "bar" | undefined;
1411
+ scrollback?: number | undefined;
1351
1412
  }>>;
1352
1413
  }, "strip", z.ZodTypeAny, {
1353
1414
  cli: {
1354
1415
  command?: string | undefined;
1416
+ args?: string[] | undefined;
1355
1417
  };
1356
- ui: {
1357
- theme: "light" | "dark" | "system";
1418
+ theme: "light" | "dark" | "system";
1419
+ terminal: {
1420
+ fontSize: number;
1421
+ fontFamily: string;
1422
+ cursorBlink: boolean;
1423
+ cursorStyle: "block" | "underline" | "bar";
1424
+ scrollback: number;
1358
1425
  };
1359
1426
  }, {
1360
1427
  cli?: {
1361
1428
  command?: string | undefined;
1429
+ args?: string[] | undefined;
1362
1430
  } | undefined;
1363
- ui?: {
1364
- theme?: "light" | "dark" | "system" | undefined;
1431
+ theme?: "light" | "dark" | "system" | undefined;
1432
+ terminal?: {
1433
+ fontSize?: number | undefined;
1434
+ fontFamily?: string | undefined;
1435
+ cursorBlink?: boolean | undefined;
1436
+ cursorStyle?: "block" | "underline" | "bar" | undefined;
1437
+ scrollback?: number | undefined;
1365
1438
  } | undefined;
1366
1439
  }>;
1367
1440
  type OpenSpecUIConfig = z.infer<typeof OpenSpecUIConfigSchema>;
1441
+ type OpenSpecUIConfigUpdate = {
1442
+ cli?: {
1443
+ command?: string | null;
1444
+ args?: string[] | null;
1445
+ };
1446
+ theme?: OpenSpecUIConfig['theme'];
1447
+ terminal?: Partial<TerminalConfig>;
1448
+ };
1368
1449
  /** 默认配置(静态,用于测试和类型) */
1369
1450
  declare const DEFAULT_CONFIG: OpenSpecUIConfig;
1370
1451
  /**
@@ -1375,6 +1456,9 @@ declare const DEFAULT_CONFIG: OpenSpecUIConfig;
1375
1456
  */
1376
1457
  declare class ConfigManager {
1377
1458
  private configPath;
1459
+ private projectDir;
1460
+ private resolvedRunner;
1461
+ private resolvingRunnerPromise;
1378
1462
  constructor(projectDir: string);
1379
1463
  /**
1380
1464
  * 读取配置(响应式)
@@ -1388,23 +1472,41 @@ declare class ConfigManager {
1388
1472
  *
1389
1473
  * 会触发文件监听,自动更新订阅者。
1390
1474
  */
1391
- writeConfig(config: Partial<OpenSpecUIConfig>): Promise<void>;
1475
+ writeConfig(config: OpenSpecUIConfigUpdate): Promise<void>;
1476
+ /**
1477
+ * 解析并缓存可用 CLI runner。
1478
+ */
1479
+ private resolveCliRunner;
1480
+ private resolveCliRunnerUncached;
1392
1481
  /**
1393
1482
  * 获取 CLI 命令(数组形式)
1394
- *
1395
- * 优先级:配置文件 > 全局 openspec 命令 > npx fallback
1396
- *
1397
- * @returns CLI 命令数组,如 `['openspec']` 或 `['npx', '@fission-ai/openspec']`
1398
1483
  */
1399
1484
  getCliCommand(): Promise<readonly string[]>;
1400
1485
  /**
1401
1486
  * 获取 CLI 命令的字符串形式(用于 UI 显示)
1402
1487
  */
1403
1488
  getCliCommandString(): Promise<string>;
1489
+ /**
1490
+ * 获取 CLI 解析结果(用于诊断)
1491
+ */
1492
+ getResolvedCliRunner(): Promise<ResolvedCliRunner>;
1493
+ /**
1494
+ * 清理 CLI 解析缓存(用于 ENOENT 自愈)
1495
+ */
1496
+ invalidateResolvedCliRunner(): void;
1404
1497
  /**
1405
1498
  * 设置 CLI 命令
1406
1499
  */
1407
1500
  setCliCommand(command: string): Promise<void>;
1501
+ private getConfiguredCommandParts;
1502
+ /**
1503
+ * 设置主题
1504
+ */
1505
+ setTheme(theme: OpenSpecUIConfig['theme']): Promise<void>;
1506
+ /**
1507
+ * 设置终端配置(部分更新)
1508
+ */
1509
+ setTerminalConfig(terminal: Partial<TerminalConfig>): Promise<void>;
1408
1510
  }
1409
1511
  //#endregion
1410
1512
  //#region src/cli-executor.d.ts
@@ -1424,48 +1526,26 @@ interface CliStreamEvent {
1424
1526
  /**
1425
1527
  * CLI 执行器
1426
1528
  *
1427
- * 负责调用外部 openspec CLI 命令。
1428
- * 命令前缀从 ConfigManager 获取,支持:
1429
- * - ['npx', '@fission-ai/openspec'] (默认)
1430
- * - ['openspec'] (全局安装)
1431
- * - 自定义数组或字符串
1432
- *
1433
- * 注意:所有命令都使用 shell: false 执行,避免 shell 注入风险
1529
+ * 负责调用外部 openspec CLI 命令,统一通过 ConfigManager 的 runner 解析结果执行。
1530
+ * 所有命令都使用 shell: false,避免 shell 注入风险。
1434
1531
  */
1435
1532
  declare class CliExecutor {
1436
1533
  private configManager;
1437
1534
  private projectDir;
1438
1535
  constructor(configManager: ConfigManager, projectDir: string);
1439
- /**
1440
- * 创建干净的环境变量,移除 pnpm 特有的配置
1441
- * 避免 pnpm 环境变量污染 npx/npm 执行
1442
- */
1443
- private getCleanEnv;
1444
- /**
1445
- * 构建完整命令数组
1446
- *
1447
- * @param args CLI 参数,如 ['init'] 或 ['archive', 'change-id']
1448
- * @returns [command, ...commandArgs, ...args]
1449
- */
1450
1536
  private buildCommandArray;
1537
+ private runCommandOnce;
1538
+ private executeInternal;
1451
1539
  /**
1452
1540
  * 执行 CLI 命令
1453
- *
1454
- * @param args CLI 参数,如 ['init'] 或 ['archive', 'change-id']
1455
- * @returns 执行结果
1456
1541
  */
1457
1542
  execute(args: string[]): Promise<CliResult>;
1458
1543
  /**
1459
1544
  * 执行 openspec init(非交互式)
1460
- *
1461
- * @param tools 工具列表,如 ['claude', 'cursor'] 或 'all' 或 'none'
1462
1545
  */
1463
1546
  init(tools?: string[] | 'all' | 'none'): Promise<CliResult>;
1464
1547
  /**
1465
1548
  * 执行 openspec archive <changeId>(非交互式)
1466
- *
1467
- * @param changeId 要归档的 change ID
1468
- * @param options 选项
1469
1549
  */
1470
1550
  archive(changeId: string, options?: {
1471
1551
  skipSpecs?: boolean;
@@ -1475,25 +1555,34 @@ declare class CliExecutor {
1475
1555
  * 执行 openspec validate [type] [id]
1476
1556
  */
1477
1557
  validate(type?: 'spec' | 'change', id?: string): Promise<CliResult>;
1558
+ /**
1559
+ * 执行 openspec schemas --json
1560
+ */
1561
+ schemas(): Promise<CliResult>;
1562
+ /**
1563
+ * 执行 openspec schema which <name> --json
1564
+ */
1565
+ schemaWhich(name: string): Promise<CliResult>;
1566
+ /**
1567
+ * 执行 openspec templates --json [--schema <name>]
1568
+ */
1569
+ templates(schema?: string): Promise<CliResult>;
1478
1570
  /**
1479
1571
  * 流式执行 openspec validate
1480
1572
  */
1481
1573
  validateStream(type: 'spec' | 'change' | undefined, id: string | undefined, onEvent: (event: CliStreamEvent) => void): Promise<() => void>;
1482
1574
  /**
1483
1575
  * 检查 CLI 是否可用
1484
- * @param timeout 超时时间(毫秒),默认 10 秒
1485
1576
  */
1486
1577
  checkAvailability(timeout?: number): Promise<{
1487
1578
  available: boolean;
1488
1579
  version?: string;
1489
1580
  error?: string;
1581
+ effectiveCommand?: string;
1582
+ tried?: string[];
1490
1583
  }>;
1491
1584
  /**
1492
1585
  * 流式执行 CLI 命令
1493
- *
1494
- * @param args CLI 参数
1495
- * @param onEvent 事件回调
1496
- * @returns 取消函数
1497
1586
  */
1498
1587
  executeStream(args: string[], onEvent: (event: CliStreamEvent) => void): Promise<() => void>;
1499
1588
  /**
@@ -1509,13 +1598,6 @@ declare class CliExecutor {
1509
1598
  }, onEvent: (event: CliStreamEvent) => void): Promise<() => void>;
1510
1599
  /**
1511
1600
  * 流式执行任意命令(数组形式)
1512
- *
1513
- * 用于执行不需要 openspec CLI 前缀的命令,如 npm install。
1514
- * 使用 shell: false 避免 shell 注入风险。
1515
- *
1516
- * @param command 命令数组,如 ['npm', 'install', '-g', '@fission-ai/openspec']
1517
- * @param onEvent 事件回调
1518
- * @returns 取消函数
1519
1601
  */
1520
1602
  executeCommandStream(command: readonly string[], onEvent: (event: CliStreamEvent) => void): () => void;
1521
1603
  }
@@ -1524,23 +1606,9 @@ declare class CliExecutor {
1524
1606
  /**
1525
1607
  * 工具配置检测模块
1526
1608
  *
1527
- * 完全对齐 @fission-ai/openspec 的官方实现
1528
- * 用于检测项目中已配置的 AI 工具
1529
- *
1530
- * 重要:使用响应式文件系统实现,监听配置目录,
1531
- * 当配置文件变化时会自动触发更新。
1532
- *
1533
- * @see references/openspec/src/core/config.ts (AI_TOOLS)
1534
- * @see references/openspec/src/core/configurators/slash/
1535
- * @see references/openspec/src/core/init.ts (isToolConfigured)
1536
- */
1537
- /**
1538
- * 检测路径范围
1539
- * - project: 相对于项目根目录
1540
- * - global: 绝对路径(如 Codex 的 ~/.codex/prompts/)
1541
- * - none: 无检测路径(如 Universal AGENTS.md 通过项目 AGENTS.md 检测)
1609
+ * 对齐 @fission-ai/openspec 的 skills 体系,
1610
+ * 通过 `skills/<skill>/SKILL.md` 判断工具是否已配置。
1542
1611
  */
1543
- type DetectionScope = 'project' | 'global' | 'none';
1544
1612
  /**
1545
1613
  * AI 工具选项(与官方 OpenSpec CLI 完全一致)
1546
1614
  * @see references/openspec/src/core/config.ts
@@ -1554,33 +1622,16 @@ interface AIToolOption {
1554
1622
  available: boolean;
1555
1623
  /** 成功消息中使用的标签 */
1556
1624
  successLabel?: string;
1625
+ /** 技能目录(相对项目根目录) */
1626
+ skillsDir?: string;
1557
1627
  }
1558
1628
  /**
1559
- * 工具检测配置
1629
+ * 完整的工具配置(元信息 + skills 目录)
1560
1630
  */
1561
- interface ToolDetectionConfig {
1562
- /** 检测路径范围 */
1563
- scope: DetectionScope;
1564
- /**
1565
- * 检测路径
1566
- * - scope='project': 相对于项目根目录的路径
1567
- * - scope='global': 返回绝对路径的函数
1568
- * - scope='none': undefined
1569
- */
1570
- detectionPath?: string | (() => string);
1571
- }
1572
- /**
1573
- * 完整的工具配置(元信息 + 检测配置)
1574
- */
1575
- interface ToolConfig extends AIToolOption, ToolDetectionConfig {}
1631
+ interface ToolConfig extends AIToolOption {}
1576
1632
  /**
1577
1633
  * 所有支持的 AI 工具配置
1578
- *
1579
1634
  * 完全对齐官方 OpenSpec CLI 的 AI_TOOLS
1580
- * 按字母顺序排序(与官方一致)
1581
- *
1582
- * @see references/openspec/src/core/config.ts
1583
- * @see references/openspec/src/core/configurators/slash/registry.ts
1584
1635
  */
1585
1636
  declare const AI_TOOLS: ToolConfig[];
1586
1637
  /**
@@ -1605,28 +1656,401 @@ declare function getAllToolIds(): string[];
1605
1656
  declare function getToolById(toolId: string): ToolConfig | undefined;
1606
1657
  /**
1607
1658
  * 检测项目中已配置的工具(响应式)
1608
- *
1609
- * 监听两类目录:
1610
- * 1. 项目级配置目录(如 .claude, .cursor 等)
1611
- * 2. 全局配置目录(如 ~/.codex/prompts/)
1612
- *
1613
- * @param projectDir 项目根目录
1614
- * @returns 已配置的工具 ID 列表
1615
1659
  */
1616
1660
  declare function getConfiguredTools(projectDir: string): Promise<string[]>;
1617
1661
  /**
1618
1662
  * 检查特定工具是否已配置
1619
- *
1620
- * @param projectDir 项目根目录
1621
- * @param toolId 工具 ID
1622
- * @returns 是否已配置
1623
1663
  */
1624
1664
  declare function isToolConfigured(projectDir: string, toolId: string): Promise<boolean>;
1625
1665
  //#endregion
1666
+ //#region src/opsx-types.d.ts
1667
+ /** Check if an outputPath contains glob pattern characters */
1668
+ declare function isGlobPattern(pattern: string): boolean;
1669
+ declare const ArtifactStatusSchema: z.ZodObject<{
1670
+ id: z.ZodString;
1671
+ outputPath: z.ZodString;
1672
+ status: z.ZodEnum<["done", "ready", "blocked"]>;
1673
+ missingDeps: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
1674
+ relativePath: z.ZodOptional<z.ZodString>;
1675
+ }, "strip", z.ZodTypeAny, {
1676
+ id: string;
1677
+ status: "done" | "ready" | "blocked";
1678
+ outputPath: string;
1679
+ missingDeps?: string[] | undefined;
1680
+ relativePath?: string | undefined;
1681
+ }, {
1682
+ id: string;
1683
+ status: "done" | "ready" | "blocked";
1684
+ outputPath: string;
1685
+ missingDeps?: string[] | undefined;
1686
+ relativePath?: string | undefined;
1687
+ }>;
1688
+ type ArtifactStatus = z.infer<typeof ArtifactStatusSchema>;
1689
+ declare const ChangeStatusSchema: z.ZodObject<{
1690
+ changeName: z.ZodString;
1691
+ schemaName: z.ZodString;
1692
+ isComplete: z.ZodBoolean;
1693
+ applyRequires: z.ZodArray<z.ZodString, "many">;
1694
+ artifacts: z.ZodArray<z.ZodObject<{
1695
+ id: z.ZodString;
1696
+ outputPath: z.ZodString;
1697
+ status: z.ZodEnum<["done", "ready", "blocked"]>;
1698
+ missingDeps: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
1699
+ relativePath: z.ZodOptional<z.ZodString>;
1700
+ }, "strip", z.ZodTypeAny, {
1701
+ id: string;
1702
+ status: "done" | "ready" | "blocked";
1703
+ outputPath: string;
1704
+ missingDeps?: string[] | undefined;
1705
+ relativePath?: string | undefined;
1706
+ }, {
1707
+ id: string;
1708
+ status: "done" | "ready" | "blocked";
1709
+ outputPath: string;
1710
+ missingDeps?: string[] | undefined;
1711
+ relativePath?: string | undefined;
1712
+ }>, "many">;
1713
+ }, "strip", z.ZodTypeAny, {
1714
+ changeName: string;
1715
+ schemaName: string;
1716
+ isComplete: boolean;
1717
+ applyRequires: string[];
1718
+ artifacts: {
1719
+ id: string;
1720
+ status: "done" | "ready" | "blocked";
1721
+ outputPath: string;
1722
+ missingDeps?: string[] | undefined;
1723
+ relativePath?: string | undefined;
1724
+ }[];
1725
+ }, {
1726
+ changeName: string;
1727
+ schemaName: string;
1728
+ isComplete: boolean;
1729
+ applyRequires: string[];
1730
+ artifacts: {
1731
+ id: string;
1732
+ status: "done" | "ready" | "blocked";
1733
+ outputPath: string;
1734
+ missingDeps?: string[] | undefined;
1735
+ relativePath?: string | undefined;
1736
+ }[];
1737
+ }>;
1738
+ type ChangeStatus = z.infer<typeof ChangeStatusSchema>;
1739
+ declare const DependencyInfoSchema: z.ZodObject<{
1740
+ id: z.ZodString;
1741
+ done: z.ZodBoolean;
1742
+ path: z.ZodString;
1743
+ description: z.ZodString;
1744
+ }, "strip", z.ZodTypeAny, {
1745
+ id: string;
1746
+ path: string;
1747
+ description: string;
1748
+ done: boolean;
1749
+ }, {
1750
+ id: string;
1751
+ path: string;
1752
+ description: string;
1753
+ done: boolean;
1754
+ }>;
1755
+ type DependencyInfo = z.infer<typeof DependencyInfoSchema>;
1756
+ declare const ApplyTaskSchema: z.ZodObject<{
1757
+ id: z.ZodString;
1758
+ description: z.ZodString;
1759
+ done: z.ZodBoolean;
1760
+ }, "strip", z.ZodTypeAny, {
1761
+ id: string;
1762
+ description: string;
1763
+ done: boolean;
1764
+ }, {
1765
+ id: string;
1766
+ description: string;
1767
+ done: boolean;
1768
+ }>;
1769
+ type ApplyTask = z.infer<typeof ApplyTaskSchema>;
1770
+ declare const ApplyInstructionsSchema: z.ZodObject<{
1771
+ changeName: z.ZodString;
1772
+ changeDir: z.ZodString;
1773
+ schemaName: z.ZodString;
1774
+ contextFiles: z.ZodRecord<z.ZodString, z.ZodString>;
1775
+ progress: z.ZodObject<{
1776
+ total: z.ZodNumber;
1777
+ complete: z.ZodNumber;
1778
+ remaining: z.ZodNumber;
1779
+ }, "strip", z.ZodTypeAny, {
1780
+ total: number;
1781
+ complete: number;
1782
+ remaining: number;
1783
+ }, {
1784
+ total: number;
1785
+ complete: number;
1786
+ remaining: number;
1787
+ }>;
1788
+ tasks: z.ZodArray<z.ZodObject<{
1789
+ id: z.ZodString;
1790
+ description: z.ZodString;
1791
+ done: z.ZodBoolean;
1792
+ }, "strip", z.ZodTypeAny, {
1793
+ id: string;
1794
+ description: string;
1795
+ done: boolean;
1796
+ }, {
1797
+ id: string;
1798
+ description: string;
1799
+ done: boolean;
1800
+ }>, "many">;
1801
+ state: z.ZodEnum<["blocked", "all_done", "ready"]>;
1802
+ missingArtifacts: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
1803
+ instruction: z.ZodString;
1804
+ }, "strip", z.ZodTypeAny, {
1805
+ tasks: {
1806
+ id: string;
1807
+ description: string;
1808
+ done: boolean;
1809
+ }[];
1810
+ progress: {
1811
+ total: number;
1812
+ complete: number;
1813
+ remaining: number;
1814
+ };
1815
+ changeName: string;
1816
+ schemaName: string;
1817
+ changeDir: string;
1818
+ contextFiles: Record<string, string>;
1819
+ state: "ready" | "blocked" | "all_done";
1820
+ instruction: string;
1821
+ missingArtifacts?: string[] | undefined;
1822
+ }, {
1823
+ tasks: {
1824
+ id: string;
1825
+ description: string;
1826
+ done: boolean;
1827
+ }[];
1828
+ progress: {
1829
+ total: number;
1830
+ complete: number;
1831
+ remaining: number;
1832
+ };
1833
+ changeName: string;
1834
+ schemaName: string;
1835
+ changeDir: string;
1836
+ contextFiles: Record<string, string>;
1837
+ state: "ready" | "blocked" | "all_done";
1838
+ instruction: string;
1839
+ missingArtifacts?: string[] | undefined;
1840
+ }>;
1841
+ type ApplyInstructions = z.infer<typeof ApplyInstructionsSchema>;
1842
+ declare const ArtifactInstructionsSchema: z.ZodObject<{
1843
+ changeName: z.ZodString;
1844
+ artifactId: z.ZodString;
1845
+ schemaName: z.ZodString;
1846
+ changeDir: z.ZodString;
1847
+ outputPath: z.ZodString;
1848
+ description: z.ZodString;
1849
+ instruction: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1850
+ context: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1851
+ rules: z.ZodNullable<z.ZodOptional<z.ZodArray<z.ZodString, "many">>>;
1852
+ template: z.ZodString;
1853
+ dependencies: z.ZodArray<z.ZodObject<{
1854
+ id: z.ZodString;
1855
+ done: z.ZodBoolean;
1856
+ path: z.ZodString;
1857
+ description: z.ZodString;
1858
+ }, "strip", z.ZodTypeAny, {
1859
+ id: string;
1860
+ path: string;
1861
+ description: string;
1862
+ done: boolean;
1863
+ }, {
1864
+ id: string;
1865
+ path: string;
1866
+ description: string;
1867
+ done: boolean;
1868
+ }>, "many">;
1869
+ unlocks: z.ZodArray<z.ZodString, "many">;
1870
+ }, "strip", z.ZodTypeAny, {
1871
+ description: string;
1872
+ outputPath: string;
1873
+ changeName: string;
1874
+ schemaName: string;
1875
+ changeDir: string;
1876
+ artifactId: string;
1877
+ template: string;
1878
+ dependencies: {
1879
+ id: string;
1880
+ path: string;
1881
+ description: string;
1882
+ done: boolean;
1883
+ }[];
1884
+ unlocks: string[];
1885
+ instruction?: string | null | undefined;
1886
+ context?: string | null | undefined;
1887
+ rules?: string[] | null | undefined;
1888
+ }, {
1889
+ description: string;
1890
+ outputPath: string;
1891
+ changeName: string;
1892
+ schemaName: string;
1893
+ changeDir: string;
1894
+ artifactId: string;
1895
+ template: string;
1896
+ dependencies: {
1897
+ id: string;
1898
+ path: string;
1899
+ description: string;
1900
+ done: boolean;
1901
+ }[];
1902
+ unlocks: string[];
1903
+ instruction?: string | null | undefined;
1904
+ context?: string | null | undefined;
1905
+ rules?: string[] | null | undefined;
1906
+ }>;
1907
+ type ArtifactInstructions = z.infer<typeof ArtifactInstructionsSchema>;
1908
+ declare const SchemaInfoSchema: z.ZodObject<{
1909
+ name: z.ZodString;
1910
+ description: z.ZodOptional<z.ZodString>;
1911
+ artifacts: z.ZodArray<z.ZodString, "many">;
1912
+ source: z.ZodEnum<["project", "user", "package"]>;
1913
+ }, "strip", z.ZodTypeAny, {
1914
+ name: string;
1915
+ artifacts: string[];
1916
+ source: "project" | "user" | "package";
1917
+ description?: string | undefined;
1918
+ }, {
1919
+ name: string;
1920
+ artifacts: string[];
1921
+ source: "project" | "user" | "package";
1922
+ description?: string | undefined;
1923
+ }>;
1924
+ type SchemaInfo = z.infer<typeof SchemaInfoSchema>;
1925
+ declare const SchemaResolutionSchema: z.ZodObject<{
1926
+ name: z.ZodString;
1927
+ source: z.ZodEnum<["project", "user", "package"]>;
1928
+ path: z.ZodString;
1929
+ shadows: z.ZodArray<z.ZodObject<{
1930
+ source: z.ZodEnum<["project", "user", "package"]>;
1931
+ path: z.ZodString;
1932
+ }, "strip", z.ZodTypeAny, {
1933
+ path: string;
1934
+ source: "project" | "user" | "package";
1935
+ }, {
1936
+ path: string;
1937
+ source: "project" | "user" | "package";
1938
+ }>, "many">;
1939
+ }, "strip", z.ZodTypeAny, {
1940
+ name: string;
1941
+ path: string;
1942
+ source: "project" | "user" | "package";
1943
+ shadows: {
1944
+ path: string;
1945
+ source: "project" | "user" | "package";
1946
+ }[];
1947
+ }, {
1948
+ name: string;
1949
+ path: string;
1950
+ source: "project" | "user" | "package";
1951
+ shadows: {
1952
+ path: string;
1953
+ source: "project" | "user" | "package";
1954
+ }[];
1955
+ }>;
1956
+ type SchemaResolution = z.infer<typeof SchemaResolutionSchema>;
1957
+ declare const TemplatesSchema: z.ZodRecord<z.ZodString, z.ZodObject<{
1958
+ path: z.ZodString;
1959
+ source: z.ZodEnum<["project", "user", "package"]>;
1960
+ }, "strip", z.ZodTypeAny, {
1961
+ path: string;
1962
+ source: "project" | "user" | "package";
1963
+ }, {
1964
+ path: string;
1965
+ source: "project" | "user" | "package";
1966
+ }>>;
1967
+ type TemplatesMap = z.infer<typeof TemplatesSchema>;
1968
+ declare const SchemaArtifactSchema: z.ZodObject<{
1969
+ id: z.ZodString;
1970
+ outputPath: z.ZodString;
1971
+ description: z.ZodOptional<z.ZodString>;
1972
+ template: z.ZodOptional<z.ZodString>;
1973
+ instruction: z.ZodOptional<z.ZodString>;
1974
+ requires: z.ZodArray<z.ZodString, "many">;
1975
+ }, "strip", z.ZodTypeAny, {
1976
+ id: string;
1977
+ outputPath: string;
1978
+ requires: string[];
1979
+ description?: string | undefined;
1980
+ instruction?: string | undefined;
1981
+ template?: string | undefined;
1982
+ }, {
1983
+ id: string;
1984
+ outputPath: string;
1985
+ requires: string[];
1986
+ description?: string | undefined;
1987
+ instruction?: string | undefined;
1988
+ template?: string | undefined;
1989
+ }>;
1990
+ type SchemaArtifact = z.infer<typeof SchemaArtifactSchema>;
1991
+ declare const SchemaDetailSchema: z.ZodObject<{
1992
+ name: z.ZodString;
1993
+ description: z.ZodOptional<z.ZodString>;
1994
+ version: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodNumber]>>;
1995
+ artifacts: z.ZodArray<z.ZodObject<{
1996
+ id: z.ZodString;
1997
+ outputPath: z.ZodString;
1998
+ description: z.ZodOptional<z.ZodString>;
1999
+ template: z.ZodOptional<z.ZodString>;
2000
+ instruction: z.ZodOptional<z.ZodString>;
2001
+ requires: z.ZodArray<z.ZodString, "many">;
2002
+ }, "strip", z.ZodTypeAny, {
2003
+ id: string;
2004
+ outputPath: string;
2005
+ requires: string[];
2006
+ description?: string | undefined;
2007
+ instruction?: string | undefined;
2008
+ template?: string | undefined;
2009
+ }, {
2010
+ id: string;
2011
+ outputPath: string;
2012
+ requires: string[];
2013
+ description?: string | undefined;
2014
+ instruction?: string | undefined;
2015
+ template?: string | undefined;
2016
+ }>, "many">;
2017
+ applyRequires: z.ZodArray<z.ZodString, "many">;
2018
+ applyTracks: z.ZodOptional<z.ZodString>;
2019
+ applyInstruction: z.ZodOptional<z.ZodString>;
2020
+ }, "strip", z.ZodTypeAny, {
2021
+ name: string;
2022
+ applyRequires: string[];
2023
+ artifacts: {
2024
+ id: string;
2025
+ outputPath: string;
2026
+ requires: string[];
2027
+ description?: string | undefined;
2028
+ instruction?: string | undefined;
2029
+ template?: string | undefined;
2030
+ }[];
2031
+ version?: string | number | undefined;
2032
+ description?: string | undefined;
2033
+ applyTracks?: string | undefined;
2034
+ applyInstruction?: string | undefined;
2035
+ }, {
2036
+ name: string;
2037
+ applyRequires: string[];
2038
+ artifacts: {
2039
+ id: string;
2040
+ outputPath: string;
2041
+ requires: string[];
2042
+ description?: string | undefined;
2043
+ instruction?: string | undefined;
2044
+ template?: string | undefined;
2045
+ }[];
2046
+ version?: string | number | undefined;
2047
+ description?: string | undefined;
2048
+ applyTracks?: string | undefined;
2049
+ applyInstruction?: string | undefined;
2050
+ }>;
2051
+ type SchemaDetail = z.infer<typeof SchemaDetailSchema>;
2052
+ //#endregion
1626
2053
  //#region src/export-types.d.ts
1627
- /**
1628
- * Types for static export / SSG
1629
- */
1630
2054
  /**
1631
2055
  * Complete snapshot of an OpenSpec project for static export
1632
2056
  */
@@ -1707,6 +2131,564 @@ interface ExportSnapshot {
1707
2131
  projectMd?: string;
1708
2132
  /** AGENTS.md content */
1709
2133
  agentsMd?: string;
2134
+ /** OPSX configuration data (for Config view) */
2135
+ opsx?: {
2136
+ configYaml?: string;
2137
+ schemas: SchemaInfo[];
2138
+ schemaDetails: Record<string, SchemaDetail>;
2139
+ schemaResolutions: Record<string, SchemaResolution>;
2140
+ templates: Record<string, TemplatesMap>;
2141
+ changeMetadata: Record<string, string | null>;
2142
+ };
2143
+ }
2144
+ //#endregion
2145
+ //#region src/opsx-kernel.d.ts
2146
+ type TemplateContentMap = Record<string, {
2147
+ content: string | null;
2148
+ path: string;
2149
+ source: TemplatesMap[string]['source'];
2150
+ }>;
2151
+ interface GlobArtifactFile {
2152
+ path: string;
2153
+ type: 'file';
2154
+ content: string;
1710
2155
  }
2156
+ declare class OpsxKernel {
2157
+ private readonly projectDir;
2158
+ private readonly cliExecutor;
2159
+ private readonly controller;
2160
+ private _statusList;
2161
+ private _schemas;
2162
+ private _changeIds;
2163
+ private _projectConfig;
2164
+ private _schemaResolutions;
2165
+ private _schemaDetails;
2166
+ private _schemaFiles;
2167
+ private _schemaYamls;
2168
+ private _templates;
2169
+ private _templateContents;
2170
+ private _statuses;
2171
+ private _instructions;
2172
+ private _applyInstructions;
2173
+ private _changeMetadata;
2174
+ private _artifactOutputs;
2175
+ private _globArtifactFiles;
2176
+ private _entityControllers;
2177
+ constructor(projectDir: string, cliExecutor: CliExecutor);
2178
+ warmup(): Promise<void>;
2179
+ dispose(): void;
2180
+ getStatusList(): ChangeStatus[];
2181
+ getSchemas(): SchemaInfo[];
2182
+ getChangeIds(): string[];
2183
+ getProjectConfig(): string | null;
2184
+ getTemplates(schema?: string): TemplatesMap;
2185
+ getTemplateContents(schema?: string): TemplateContentMap;
2186
+ getStatus(changeId: string, schema?: string): ChangeStatus;
2187
+ getInstructions(changeId: string, artifact: string, schema?: string): ArtifactInstructions;
2188
+ getApplyInstructions(changeId: string, schema?: string): ApplyInstructions;
2189
+ getSchemaResolution(name: string): SchemaResolution;
2190
+ getSchemaDetail(name: string): SchemaDetail;
2191
+ getSchemaFiles(name: string): ChangeFile[];
2192
+ getSchemaYaml(name: string): string | null;
2193
+ getChangeMetadata(changeId: string): string | null;
2194
+ getArtifactOutput(changeId: string, outputPath: string): string | null;
2195
+ getGlobArtifactFiles(changeId: string, outputPath: string): GlobArtifactFile[];
2196
+ private startStream;
2197
+ private warmupSchema;
2198
+ private warmupChange;
2199
+ private watchSchemaChanges;
2200
+ private watchChangeIdChanges;
2201
+ private teardownEntity;
2202
+ private fetchSchemas;
2203
+ private fetchChangeIds;
2204
+ private fetchProjectConfig;
2205
+ private fetchStatus;
2206
+ private fetchStatusList;
2207
+ private fetchInstructions;
2208
+ private fetchApplyInstructions;
2209
+ private fetchSchemaResolution;
2210
+ private fetchSchemaDetail;
2211
+ private fetchSchemaFiles;
2212
+ private fetchSchemaYaml;
2213
+ private fetchTemplates;
2214
+ private fetchTemplateContents;
2215
+ private fetchChangeMetadata;
2216
+ private fetchArtifactOutput;
2217
+ /**
2218
+ * Ensure a per-change status stream exists. If not yet warmed up,
2219
+ * creates the state and starts a stream lazily.
2220
+ */
2221
+ ensureStatus(changeId: string, schema?: string): void;
2222
+ ensureInstructions(changeId: string, artifact: string, schema?: string): void;
2223
+ ensureApplyInstructions(changeId: string, schema?: string): void;
2224
+ ensureArtifactOutput(changeId: string, outputPath: string): void;
2225
+ ensureGlobArtifactFiles(changeId: string, outputPath: string): void;
2226
+ ensureSchemaResolution(name: string): void;
2227
+ ensureSchemaDetail(name: string): void;
2228
+ ensureSchemaFiles(name: string): void;
2229
+ ensureSchemaYaml(name: string): void;
2230
+ ensureTemplates(schema?: string): void;
2231
+ ensureTemplateContents(schema?: string): void;
2232
+ ensureChangeMetadata(changeId: string): void;
2233
+ private combineSignals;
2234
+ }
2235
+ //#endregion
2236
+ //#region src/pty-protocol.d.ts
2237
+ declare const PtyPlatformSchema: z.ZodEnum<["windows", "macos", "common"]>;
2238
+ declare const PtySessionInfoSchema: z.ZodObject<{
2239
+ id: z.ZodString;
2240
+ title: z.ZodString;
2241
+ command: z.ZodString;
2242
+ args: z.ZodArray<z.ZodString, "many">;
2243
+ platform: z.ZodEnum<["windows", "macos", "common"]>;
2244
+ isExited: z.ZodBoolean;
2245
+ exitCode: z.ZodNullable<z.ZodNumber>;
2246
+ }, "strip", z.ZodTypeAny, {
2247
+ id: string;
2248
+ command: string;
2249
+ args: string[];
2250
+ platform: "windows" | "macos" | "common";
2251
+ exitCode: number | null;
2252
+ title: string;
2253
+ isExited: boolean;
2254
+ }, {
2255
+ id: string;
2256
+ command: string;
2257
+ args: string[];
2258
+ platform: "windows" | "macos" | "common";
2259
+ exitCode: number | null;
2260
+ title: string;
2261
+ isExited: boolean;
2262
+ }>;
2263
+ declare const PtyCreateMessageSchema: z.ZodObject<{
2264
+ type: z.ZodLiteral<"create">;
2265
+ requestId: z.ZodString;
2266
+ cols: z.ZodOptional<z.ZodNumber>;
2267
+ rows: z.ZodOptional<z.ZodNumber>;
2268
+ command: z.ZodOptional<z.ZodString>;
2269
+ args: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
2270
+ }, "strip", z.ZodTypeAny, {
2271
+ type: "create";
2272
+ requestId: string;
2273
+ cols?: number | undefined;
2274
+ rows?: number | undefined;
2275
+ command?: string | undefined;
2276
+ args?: string[] | undefined;
2277
+ }, {
2278
+ type: "create";
2279
+ requestId: string;
2280
+ cols?: number | undefined;
2281
+ rows?: number | undefined;
2282
+ command?: string | undefined;
2283
+ args?: string[] | undefined;
2284
+ }>;
2285
+ declare const PtyInputMessageSchema: z.ZodObject<{
2286
+ type: z.ZodLiteral<"input">;
2287
+ sessionId: z.ZodString;
2288
+ data: z.ZodString;
2289
+ }, "strip", z.ZodTypeAny, {
2290
+ type: "input";
2291
+ sessionId: string;
2292
+ data: string;
2293
+ }, {
2294
+ type: "input";
2295
+ sessionId: string;
2296
+ data: string;
2297
+ }>;
2298
+ declare const PtyResizeMessageSchema: z.ZodObject<{
2299
+ type: z.ZodLiteral<"resize">;
2300
+ sessionId: z.ZodString;
2301
+ cols: z.ZodNumber;
2302
+ rows: z.ZodNumber;
2303
+ }, "strip", z.ZodTypeAny, {
2304
+ type: "resize";
2305
+ cols: number;
2306
+ rows: number;
2307
+ sessionId: string;
2308
+ }, {
2309
+ type: "resize";
2310
+ cols: number;
2311
+ rows: number;
2312
+ sessionId: string;
2313
+ }>;
2314
+ declare const PtyCloseMessageSchema: z.ZodObject<{
2315
+ type: z.ZodLiteral<"close">;
2316
+ sessionId: z.ZodString;
2317
+ }, "strip", z.ZodTypeAny, {
2318
+ type: "close";
2319
+ sessionId: string;
2320
+ }, {
2321
+ type: "close";
2322
+ sessionId: string;
2323
+ }>;
2324
+ declare const PtyAttachMessageSchema: z.ZodObject<{
2325
+ type: z.ZodLiteral<"attach">;
2326
+ sessionId: z.ZodString;
2327
+ cols: z.ZodOptional<z.ZodNumber>;
2328
+ rows: z.ZodOptional<z.ZodNumber>;
2329
+ }, "strip", z.ZodTypeAny, {
2330
+ type: "attach";
2331
+ sessionId: string;
2332
+ cols?: number | undefined;
2333
+ rows?: number | undefined;
2334
+ }, {
2335
+ type: "attach";
2336
+ sessionId: string;
2337
+ cols?: number | undefined;
2338
+ rows?: number | undefined;
2339
+ }>;
2340
+ declare const PtyListMessageSchema: z.ZodObject<{
2341
+ type: z.ZodLiteral<"list">;
2342
+ }, "strip", z.ZodTypeAny, {
2343
+ type: "list";
2344
+ }, {
2345
+ type: "list";
2346
+ }>;
2347
+ declare const PtyClientMessageSchema: z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
2348
+ type: z.ZodLiteral<"create">;
2349
+ requestId: z.ZodString;
2350
+ cols: z.ZodOptional<z.ZodNumber>;
2351
+ rows: z.ZodOptional<z.ZodNumber>;
2352
+ command: z.ZodOptional<z.ZodString>;
2353
+ args: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
2354
+ }, "strip", z.ZodTypeAny, {
2355
+ type: "create";
2356
+ requestId: string;
2357
+ cols?: number | undefined;
2358
+ rows?: number | undefined;
2359
+ command?: string | undefined;
2360
+ args?: string[] | undefined;
2361
+ }, {
2362
+ type: "create";
2363
+ requestId: string;
2364
+ cols?: number | undefined;
2365
+ rows?: number | undefined;
2366
+ command?: string | undefined;
2367
+ args?: string[] | undefined;
2368
+ }>, z.ZodObject<{
2369
+ type: z.ZodLiteral<"input">;
2370
+ sessionId: z.ZodString;
2371
+ data: z.ZodString;
2372
+ }, "strip", z.ZodTypeAny, {
2373
+ type: "input";
2374
+ sessionId: string;
2375
+ data: string;
2376
+ }, {
2377
+ type: "input";
2378
+ sessionId: string;
2379
+ data: string;
2380
+ }>, z.ZodObject<{
2381
+ type: z.ZodLiteral<"resize">;
2382
+ sessionId: z.ZodString;
2383
+ cols: z.ZodNumber;
2384
+ rows: z.ZodNumber;
2385
+ }, "strip", z.ZodTypeAny, {
2386
+ type: "resize";
2387
+ cols: number;
2388
+ rows: number;
2389
+ sessionId: string;
2390
+ }, {
2391
+ type: "resize";
2392
+ cols: number;
2393
+ rows: number;
2394
+ sessionId: string;
2395
+ }>, z.ZodObject<{
2396
+ type: z.ZodLiteral<"close">;
2397
+ sessionId: z.ZodString;
2398
+ }, "strip", z.ZodTypeAny, {
2399
+ type: "close";
2400
+ sessionId: string;
2401
+ }, {
2402
+ type: "close";
2403
+ sessionId: string;
2404
+ }>, z.ZodObject<{
2405
+ type: z.ZodLiteral<"attach">;
2406
+ sessionId: z.ZodString;
2407
+ cols: z.ZodOptional<z.ZodNumber>;
2408
+ rows: z.ZodOptional<z.ZodNumber>;
2409
+ }, "strip", z.ZodTypeAny, {
2410
+ type: "attach";
2411
+ sessionId: string;
2412
+ cols?: number | undefined;
2413
+ rows?: number | undefined;
2414
+ }, {
2415
+ type: "attach";
2416
+ sessionId: string;
2417
+ cols?: number | undefined;
2418
+ rows?: number | undefined;
2419
+ }>, z.ZodObject<{
2420
+ type: z.ZodLiteral<"list">;
2421
+ }, "strip", z.ZodTypeAny, {
2422
+ type: "list";
2423
+ }, {
2424
+ type: "list";
2425
+ }>]>;
2426
+ declare const PtyCreatedResponseSchema: z.ZodObject<{
2427
+ type: z.ZodLiteral<"created">;
2428
+ requestId: z.ZodString;
2429
+ sessionId: z.ZodString;
2430
+ platform: z.ZodEnum<["windows", "macos", "common"]>;
2431
+ }, "strip", z.ZodTypeAny, {
2432
+ type: "created";
2433
+ requestId: string;
2434
+ sessionId: string;
2435
+ platform: "windows" | "macos" | "common";
2436
+ }, {
2437
+ type: "created";
2438
+ requestId: string;
2439
+ sessionId: string;
2440
+ platform: "windows" | "macos" | "common";
2441
+ }>;
2442
+ declare const PtyOutputResponseSchema: z.ZodObject<{
2443
+ type: z.ZodLiteral<"output">;
2444
+ sessionId: z.ZodString;
2445
+ data: z.ZodString;
2446
+ }, "strip", z.ZodTypeAny, {
2447
+ type: "output";
2448
+ sessionId: string;
2449
+ data: string;
2450
+ }, {
2451
+ type: "output";
2452
+ sessionId: string;
2453
+ data: string;
2454
+ }>;
2455
+ declare const PtyExitResponseSchema: z.ZodObject<{
2456
+ type: z.ZodLiteral<"exit">;
2457
+ sessionId: z.ZodString;
2458
+ exitCode: z.ZodNumber;
2459
+ }, "strip", z.ZodTypeAny, {
2460
+ type: "exit";
2461
+ sessionId: string;
2462
+ exitCode: number;
2463
+ }, {
2464
+ type: "exit";
2465
+ sessionId: string;
2466
+ exitCode: number;
2467
+ }>;
2468
+ declare const PtyTitleResponseSchema: z.ZodObject<{
2469
+ type: z.ZodLiteral<"title">;
2470
+ sessionId: z.ZodString;
2471
+ title: z.ZodString;
2472
+ }, "strip", z.ZodTypeAny, {
2473
+ type: "title";
2474
+ sessionId: string;
2475
+ title: string;
2476
+ }, {
2477
+ type: "title";
2478
+ sessionId: string;
2479
+ title: string;
2480
+ }>;
2481
+ declare const PtyBufferResponseSchema: z.ZodObject<{
2482
+ type: z.ZodLiteral<"buffer">;
2483
+ sessionId: z.ZodString;
2484
+ data: z.ZodString;
2485
+ }, "strip", z.ZodTypeAny, {
2486
+ type: "buffer";
2487
+ sessionId: string;
2488
+ data: string;
2489
+ }, {
2490
+ type: "buffer";
2491
+ sessionId: string;
2492
+ data: string;
2493
+ }>;
2494
+ declare const PtyListResponseSchema: z.ZodObject<{
2495
+ type: z.ZodLiteral<"list">;
2496
+ sessions: z.ZodArray<z.ZodObject<{
2497
+ id: z.ZodString;
2498
+ title: z.ZodString;
2499
+ command: z.ZodString;
2500
+ args: z.ZodArray<z.ZodString, "many">;
2501
+ platform: z.ZodEnum<["windows", "macos", "common"]>;
2502
+ isExited: z.ZodBoolean;
2503
+ exitCode: z.ZodNullable<z.ZodNumber>;
2504
+ }, "strip", z.ZodTypeAny, {
2505
+ id: string;
2506
+ command: string;
2507
+ args: string[];
2508
+ platform: "windows" | "macos" | "common";
2509
+ exitCode: number | null;
2510
+ title: string;
2511
+ isExited: boolean;
2512
+ }, {
2513
+ id: string;
2514
+ command: string;
2515
+ args: string[];
2516
+ platform: "windows" | "macos" | "common";
2517
+ exitCode: number | null;
2518
+ title: string;
2519
+ isExited: boolean;
2520
+ }>, "many">;
2521
+ }, "strip", z.ZodTypeAny, {
2522
+ type: "list";
2523
+ sessions: {
2524
+ id: string;
2525
+ command: string;
2526
+ args: string[];
2527
+ platform: "windows" | "macos" | "common";
2528
+ exitCode: number | null;
2529
+ title: string;
2530
+ isExited: boolean;
2531
+ }[];
2532
+ }, {
2533
+ type: "list";
2534
+ sessions: {
2535
+ id: string;
2536
+ command: string;
2537
+ args: string[];
2538
+ platform: "windows" | "macos" | "common";
2539
+ exitCode: number | null;
2540
+ title: string;
2541
+ isExited: boolean;
2542
+ }[];
2543
+ }>;
2544
+ declare const PtyErrorCodeSchema: z.ZodEnum<["INVALID_JSON", "INVALID_MESSAGE", "SESSION_NOT_FOUND"]>;
2545
+ declare const PtyErrorResponseSchema: z.ZodObject<{
2546
+ type: z.ZodLiteral<"error">;
2547
+ code: z.ZodEnum<["INVALID_JSON", "INVALID_MESSAGE", "SESSION_NOT_FOUND"]>;
2548
+ message: z.ZodString;
2549
+ sessionId: z.ZodOptional<z.ZodString>;
2550
+ }, "strip", z.ZodTypeAny, {
2551
+ code: "INVALID_JSON" | "INVALID_MESSAGE" | "SESSION_NOT_FOUND";
2552
+ message: string;
2553
+ type: "error";
2554
+ sessionId?: string | undefined;
2555
+ }, {
2556
+ code: "INVALID_JSON" | "INVALID_MESSAGE" | "SESSION_NOT_FOUND";
2557
+ message: string;
2558
+ type: "error";
2559
+ sessionId?: string | undefined;
2560
+ }>;
2561
+ declare const PtyServerMessageSchema: z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
2562
+ type: z.ZodLiteral<"created">;
2563
+ requestId: z.ZodString;
2564
+ sessionId: z.ZodString;
2565
+ platform: z.ZodEnum<["windows", "macos", "common"]>;
2566
+ }, "strip", z.ZodTypeAny, {
2567
+ type: "created";
2568
+ requestId: string;
2569
+ sessionId: string;
2570
+ platform: "windows" | "macos" | "common";
2571
+ }, {
2572
+ type: "created";
2573
+ requestId: string;
2574
+ sessionId: string;
2575
+ platform: "windows" | "macos" | "common";
2576
+ }>, z.ZodObject<{
2577
+ type: z.ZodLiteral<"output">;
2578
+ sessionId: z.ZodString;
2579
+ data: z.ZodString;
2580
+ }, "strip", z.ZodTypeAny, {
2581
+ type: "output";
2582
+ sessionId: string;
2583
+ data: string;
2584
+ }, {
2585
+ type: "output";
2586
+ sessionId: string;
2587
+ data: string;
2588
+ }>, z.ZodObject<{
2589
+ type: z.ZodLiteral<"exit">;
2590
+ sessionId: z.ZodString;
2591
+ exitCode: z.ZodNumber;
2592
+ }, "strip", z.ZodTypeAny, {
2593
+ type: "exit";
2594
+ sessionId: string;
2595
+ exitCode: number;
2596
+ }, {
2597
+ type: "exit";
2598
+ sessionId: string;
2599
+ exitCode: number;
2600
+ }>, z.ZodObject<{
2601
+ type: z.ZodLiteral<"title">;
2602
+ sessionId: z.ZodString;
2603
+ title: z.ZodString;
2604
+ }, "strip", z.ZodTypeAny, {
2605
+ type: "title";
2606
+ sessionId: string;
2607
+ title: string;
2608
+ }, {
2609
+ type: "title";
2610
+ sessionId: string;
2611
+ title: string;
2612
+ }>, z.ZodObject<{
2613
+ type: z.ZodLiteral<"buffer">;
2614
+ sessionId: z.ZodString;
2615
+ data: z.ZodString;
2616
+ }, "strip", z.ZodTypeAny, {
2617
+ type: "buffer";
2618
+ sessionId: string;
2619
+ data: string;
2620
+ }, {
2621
+ type: "buffer";
2622
+ sessionId: string;
2623
+ data: string;
2624
+ }>, z.ZodObject<{
2625
+ type: z.ZodLiteral<"list">;
2626
+ sessions: z.ZodArray<z.ZodObject<{
2627
+ id: z.ZodString;
2628
+ title: z.ZodString;
2629
+ command: z.ZodString;
2630
+ args: z.ZodArray<z.ZodString, "many">;
2631
+ platform: z.ZodEnum<["windows", "macos", "common"]>;
2632
+ isExited: z.ZodBoolean;
2633
+ exitCode: z.ZodNullable<z.ZodNumber>;
2634
+ }, "strip", z.ZodTypeAny, {
2635
+ id: string;
2636
+ command: string;
2637
+ args: string[];
2638
+ platform: "windows" | "macos" | "common";
2639
+ exitCode: number | null;
2640
+ title: string;
2641
+ isExited: boolean;
2642
+ }, {
2643
+ id: string;
2644
+ command: string;
2645
+ args: string[];
2646
+ platform: "windows" | "macos" | "common";
2647
+ exitCode: number | null;
2648
+ title: string;
2649
+ isExited: boolean;
2650
+ }>, "many">;
2651
+ }, "strip", z.ZodTypeAny, {
2652
+ type: "list";
2653
+ sessions: {
2654
+ id: string;
2655
+ command: string;
2656
+ args: string[];
2657
+ platform: "windows" | "macos" | "common";
2658
+ exitCode: number | null;
2659
+ title: string;
2660
+ isExited: boolean;
2661
+ }[];
2662
+ }, {
2663
+ type: "list";
2664
+ sessions: {
2665
+ id: string;
2666
+ command: string;
2667
+ args: string[];
2668
+ platform: "windows" | "macos" | "common";
2669
+ exitCode: number | null;
2670
+ title: string;
2671
+ isExited: boolean;
2672
+ }[];
2673
+ }>, z.ZodObject<{
2674
+ type: z.ZodLiteral<"error">;
2675
+ code: z.ZodEnum<["INVALID_JSON", "INVALID_MESSAGE", "SESSION_NOT_FOUND"]>;
2676
+ message: z.ZodString;
2677
+ sessionId: z.ZodOptional<z.ZodString>;
2678
+ }, "strip", z.ZodTypeAny, {
2679
+ code: "INVALID_JSON" | "INVALID_MESSAGE" | "SESSION_NOT_FOUND";
2680
+ message: string;
2681
+ type: "error";
2682
+ sessionId?: string | undefined;
2683
+ }, {
2684
+ code: "INVALID_JSON" | "INVALID_MESSAGE" | "SESSION_NOT_FOUND";
2685
+ message: string;
2686
+ type: "error";
2687
+ sessionId?: string | undefined;
2688
+ }>]>;
2689
+ type PtyClientMessage = z.infer<typeof PtyClientMessageSchema>;
2690
+ type PtyServerMessage = z.infer<typeof PtyServerMessageSchema>;
2691
+ type PtySessionInfo = z.infer<typeof PtySessionInfoSchema>;
2692
+ type PtyPlatform = z.infer<typeof PtyPlatformSchema>;
1711
2693
  //#endregion
1712
- export { type AIToolOption, AI_TOOLS, type ArchiveMeta, type Change, type ChangeFile, ChangeFileSchema, type ChangeMeta, ChangeSchema, CliExecutor, type CliResult, type CliSniffResult, type CliStreamEvent, ConfigManager, DEFAULT_CONFIG, type Delta, type DeltaOperation, DeltaOperationType, DeltaSchema, type DeltaSpec, DeltaSpecSchema, type ExportSnapshot, type FileChangeEvent, type FileChangeType, MarkdownParser, OpenSpecAdapter, type OpenSpecUIConfig, OpenSpecUIConfigSchema, OpenSpecWatcher, type PathCallback, ProjectWatcher, ReactiveContext, ReactiveState, type ReactiveStateOptions, type Requirement, RequirementSchema, type Spec, type SpecMeta, SpecSchema, type Task, TaskSchema, type ToolConfig, type ToolDetectionConfig, type ValidationIssue, type ValidationResult, Validator, type WatchEvent, type WatchEventType, acquireWatcher, clearCache, closeAllProjectWatchers, closeAllWatchers, contextStorage, createFileChangeObservable, getActiveWatcherCount, getAllToolIds, getAllTools, getAvailableToolIds, getAvailableTools, getCacheSize, getConfiguredTools, getDefaultCliCommand, getDefaultCliCommandString, getProjectWatcher, getToolById, getWatchedProjectDir, initWatcherPool, isToolConfigured, isWatcherPoolInitialized, parseCliCommand, reactiveExists, reactiveReadDir, reactiveReadFile, reactiveStat, sniffGlobalCli };
2694
+ export { type AIToolOption, AI_TOOLS, type ApplyInstructions, ApplyInstructionsSchema, type ApplyTask, ApplyTaskSchema, type ArchiveMeta, type ArtifactInstructions, ArtifactInstructionsSchema, type ArtifactStatus, ArtifactStatusSchema, type Change, type ChangeFile, ChangeFileSchema, type ChangeMeta, ChangeSchema, type ChangeStatus, ChangeStatusSchema, CliExecutor, type CliResult, type CliRunnerAttempt, type CliSniffResult, type CliStreamEvent, ConfigManager, DEFAULT_CONFIG, type Delta, type DeltaOperation, DeltaOperationType, DeltaSchema, type DeltaSpec, DeltaSpecSchema, type DependencyInfo, DependencyInfoSchema, type ExportSnapshot, type FileChangeEvent, type FileChangeType, MarkdownParser, OpenSpecAdapter, type OpenSpecUIConfig, OpenSpecUIConfigSchema, type OpenSpecUIConfigUpdate, OpenSpecWatcher, OpsxKernel, type PathCallback, ProjectWatcher, 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, type Task, TaskSchema, type TemplateContentMap, type TemplatesMap, TemplatesSchema, type TerminalConfig, TerminalConfigSchema, type ToolConfig, type ValidationIssue, type ValidationResult, Validator, type WatchEvent, type WatchEventType, acquireWatcher, buildCliRunnerCandidates, clearCache, closeAllProjectWatchers, closeAllWatchers, contextStorage, createCleanCliEnv, createFileChangeObservable, getActiveWatcherCount, getAllToolIds, getAllTools, getAvailableToolIds, getAvailableTools, getCacheSize, getConfiguredTools, getDefaultCliCommand, getDefaultCliCommandString, getProjectWatcher, getToolById, getWatchedProjectDir, initWatcherPool, isGlobPattern, isToolConfigured, isWatcherPoolInitialized, parseCliCommand, reactiveExists, reactiveReadDir, reactiveReadFile, reactiveStat, sniffGlobalCli };