@x-otto/plugin 0.1.0-alpha.1 → 0.1.0-alpha.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,40 +1,42 @@
1
1
  # @x-otto/plugin
2
2
 
3
- > Plugin 清单(`otto-plugin.json`)的解析、目录发现、贡献词表、信任模型与作者 SDK——RFC-044 插件体系的「只读不执行」地基层。
3
+ > Parsing of the plugin manifest (`otto-plugin.json`), directory discovery, contribution vocabulary, trust model, and author SDK — the "read-only, no execution" foundation layer of the plugin system.
4
4
 
5
- `@x-otto/plugin` otto 插件系统的协议层与契约层。一个插件 = 一个目录 + 一份 `otto-plugin.json`,其目录下用 `skills/`、`agents/`、`commands/`、`.mcp.json` 等子目录贡献能力(由消费方 `@x-otto/coding` 的各轴 loader 消费)。
5
+ `@x-otto/plugin` is the protocol and contract layer of otto's plugin system. A plugin = a directory + an
6
+ `otto-plugin.json` file, which contributes capabilities via subdirectories such as `skills/`, `agents/`, `commands/`,
7
+ and `.mcp.json` (consumed by the various axis loaders in `@x-otto/coding`).
6
8
 
7
- ## 核心功能
9
+ ## Core Features
8
10
 
9
- | 模块 | 功能 |
11
+ | Module | Function |
10
12
  |------|------|
11
- | `parsePluginManifest` | 解析 manifestfail-closed + lenient 混合) |
12
- | `discoverPlugins` | 扫描三层插件目录(项目/仓库/用户) |
13
- | `topoSortPlugins` | 拓扑排序 + 缺依赖传递剔除 + 环检测 |
14
- | `filterEngineCompatible` | 引擎 ABI 版本兼容过滤 |
15
- | `definePlugin` | 插件作者 SDKVite defineConfig 对等物) |
16
- | 信任模型 | 布尔信任 + 逐高危能力授予 |
17
- | `PluginI18nRegistry` | 国际化条目注册表(与 TUI STR 平行) |
18
- | 贡献点系统 | 动作/菜单/context-key 贡献点解析与派发 |
13
+ | `parsePluginManifest` | Parses the manifest (fail-closed + lenient hybrid) |
14
+ | `discoverPlugins` | Scans the three-tier plugin directory structure (project/repository/user) |
15
+ | `topoSortPlugins` | Topological sort + transitive removal of missing dependencies + cycle detection |
16
+ | `filterEngineCompatible` | Filters by engine ABI version compatibility |
17
+ | `definePlugin` | Plugin-author SDK (equivalent to Vite's defineConfig) |
18
+ | Trust Model | Boolean trust + per-high-risk-capability grants |
19
+ | `PluginI18nRegistry` | Internationalization entry registry (parallel to TUI STR) |
20
+ | Contribution Point System | Parsing and dispatch of action/menu/context-key contribution points |
19
21
 
20
- ## 安装
22
+ ## Installation
21
23
 
22
24
  ```bash
23
25
  pnpm add @x-otto/plugin
24
26
  ```
25
27
 
26
- ## 用法
28
+ ## Usage
27
29
 
28
30
  ```ts
29
- // 发现已安装插件
31
+ // Discover installed plugins
30
32
  import { discoverPlugins } from '@x-otto/plugin'
31
33
  const plugins = discoverPlugins({ cwd, homedir, disabled: ['plugin-x'] })
32
34
 
33
- // 解析单一 manifest
35
+ // Parse a single manifest
34
36
  import { parsePluginManifest } from '@x-otto/plugin'
35
37
  const manifest = parsePluginManifest(content, path) // null on fail
36
38
 
37
- // 作者定义插件
39
+ // Author-defined plugin
38
40
  import { definePlugin } from '@x-otto/plugin'
39
41
  export default definePlugin((ctx) => ({
40
42
  hooks: {
@@ -43,48 +45,49 @@ export default definePlugin((ctx) => ({
43
45
  }))
44
46
  ```
45
47
 
46
- ## 目录概览
48
+ ## Directory Overview
47
49
 
48
50
  ```
49
51
  src/
50
52
  manifest.ts # PluginManifest zod schema + parsePluginManifest
51
- discovery.ts # discoverPlugins 三层目录扫描
52
- contributions.ts # PluginContributions 统一贡献词表类型
53
- contribution-points.ts # 贡献点注册表(POINT 常量)
54
- contribution-resolver.ts # 贡献点解析器
55
- context-keys.ts # 上下文键求值
56
- contribution-dispatch.ts # 贡献点派发器
53
+ discovery.ts # discoverPlugins three-tier directory scanning
54
+ contributions.ts # PluginContributions unified contribution vocabulary type
55
+ contribution-points.ts # contribution point registry (POINT constants)
56
+ contribution-resolver.ts # contribution point resolver
57
+ context-keys.ts # context key evaluation
58
+ contribution-dispatch.ts # contribution point dispatcher
57
59
  sdk.ts # definePlugin + PluginModule/PluginContext/PluginHooks
58
- dependency-graph.ts # topoSortPlugins 拓扑排序
59
- engine-compat.ts # 引擎版本兼容门
60
- api-version.ts # PLUGIN_API_VERSION 常量
61
- plugin-trust.ts # 信任模型(HIGH_RISK_CAPABILITIES
62
- trust-store.ts # 信任白名单持久化
63
- i18n-registry.ts # 国际化条目注册表
64
- input/ # sigil 输入系统(builtin/file/registry
60
+ dependency-graph.ts # topoSortPlugins topological sort
61
+ engine-compat.ts # engine version compatibility gate
62
+ api-version.ts # PLUGIN_API_VERSION constant
63
+ plugin-trust.ts # trust model (HIGH_RISK_CAPABILITIES)
64
+ trust-store.ts # trust allowlist persistence
65
+ i18n-registry.ts # internationalization entry registry
66
+ input/ # sigil input system (builtin/file/registry)
65
67
  index.ts
66
- tests/ # 测试文件
68
+ tests/ # test files
67
69
  ```
68
70
 
69
- ## 关键类型
71
+ ## Key Types
70
72
 
71
- - `PluginManifest`:插件清单(id/name/scripts/capabilities/engines/contributes
72
- - `PluginContributions`:统一贡献词表(commands/agents/skills/mcp/providers/oauth/panels/actions/menus/...)
73
- - `PluginModule`:代码插件的运行时模块(hooks/tools/monitors/providerFactories/services/...)
74
- - `PluginContext`:装载时注入工厂的上下文
75
- - `DiscoveredPlugin`:发现结果(id/dir/manifest/scope
73
+ - `PluginManifest`: the plugin manifest (id/name/scripts/capabilities/engines/contributes)
74
+ - `PluginContributions`: unified contribution vocabulary (commands/agents/skills/mcp/providers/oauth/panels/actions/menus/...)
75
+ - `PluginModule`: the runtime module of a code plugin (hooks/tools/monitors/providerFactories/services/...)
76
+ - `PluginContext`: the context injected with factories at load time
77
+ - `DiscoveredPlugin`: a discovery result (id/dir/manifest/scope)
76
78
 
77
- ## 信任模型
79
+ ## Trust Model
78
80
 
79
- 高危能力清单(`HIGH_RISK_CAPABILITIES`):provider / tools / tui.renderer / network / wire-protocol / a2ui.component / panel.backend / input.resolver / a2ui.renderer / agent.dispatch / service。已信任插件升级后首次声明这些能力必须重新确认。
81
+ High-risk capability list (`HIGH_RISK_CAPABILITIES`): provider / tools / tui.renderer / network / wire-protocol /
82
+ a2ui.component / panel.backend / input.resolver / a2ui.renderer / agent.dispatch / service. When an already-trusted
83
+ plugin is upgraded and declares one of these capabilities for the first time, it must be re-confirmed.
80
84
 
81
- ## 依赖
85
+ ## Dependencies
82
86
 
83
87
  - Internal: `@x-otto/env`, `@x-otto/interchange`, `@x-otto/provider`, `@x-otto/shared`
84
88
  - External: `zod`, `semver`
85
89
 
86
- ## 相关
90
+ ## Related
87
91
 
88
92
  - [Architecture](./ARCHITECTURE.md)
89
- - RFC-044 插件体系(D2 manifest/发现;R4 fail-closed、R6 source key、R7 层源覆盖)
90
- - `@x-otto/extension`(re-export 本包 SDK 作为 extension 作者统一入口)
93
+ - `@x-otto/extension` (re-exports this package's SDK as the unified entry point for extension authors)
package/dist/index.d.ts CHANGED
@@ -240,6 +240,10 @@ declare const modelEntrySchema: z.ZodObject<{
240
240
  "long-context": "long-context";
241
241
  }>>>>;
242
242
  reasoning: z.ZodCatch<z.ZodOptional<z.ZodBoolean>>;
243
+ input: z.ZodCatch<z.ZodOptional<z.ZodArray<z.ZodEnum<{
244
+ text: "text";
245
+ image: "image";
246
+ }>>>>;
243
247
  thinkingLevels: z.ZodCatch<z.ZodOptional<z.ZodArray<z.ZodEnum<{
244
248
  low: "low";
245
249
  medium: "medium";
@@ -400,11 +404,11 @@ declare const themePresetContributionSchema: z.ZodObject<{
400
404
  success: "success";
401
405
  error: "error";
402
406
  accent: "accent";
407
+ text: "text";
403
408
  brand: "brand";
404
409
  brandShimmer: "brandShimmer";
405
410
  accentDim: "accentDim";
406
411
  accentBright: "accentBright";
407
- text: "text";
408
412
  inactive: "inactive";
409
413
  secondary: "secondary";
410
414
  subtle: "subtle";
@@ -429,11 +433,11 @@ declare const themePresetContributionSchema: z.ZodObject<{
429
433
  success: "success";
430
434
  error: "error";
431
435
  accent: "accent";
436
+ text: "text";
432
437
  brand: "brand";
433
438
  brandShimmer: "brandShimmer";
434
439
  accentDim: "accentDim";
435
440
  accentBright: "accentBright";
436
- text: "text";
437
441
  inactive: "inactive";
438
442
  secondary: "secondary";
439
443
  subtle: "subtle";
@@ -458,11 +462,11 @@ declare const themePresetContributionSchema: z.ZodObject<{
458
462
  success: "success";
459
463
  error: "error";
460
464
  accent: "accent";
465
+ text: "text";
461
466
  brand: "brand";
462
467
  brandShimmer: "brandShimmer";
463
468
  accentDim: "accentDim";
464
469
  accentBright: "accentBright";
465
- text: "text";
466
470
  inactive: "inactive";
467
471
  secondary: "secondary";
468
472
  subtle: "subtle";
@@ -487,11 +491,11 @@ declare const themePresetContributionSchema: z.ZodObject<{
487
491
  success: "success";
488
492
  error: "error";
489
493
  accent: "accent";
494
+ text: "text";
490
495
  brand: "brand";
491
496
  brandShimmer: "brandShimmer";
492
497
  accentDim: "accentDim";
493
498
  accentBright: "accentBright";
494
- text: "text";
495
499
  inactive: "inactive";
496
500
  secondary: "secondary";
497
501
  subtle: "subtle";
@@ -516,11 +520,11 @@ declare const themePresetContributionSchema: z.ZodObject<{
516
520
  success: "success";
517
521
  error: "error";
518
522
  accent: "accent";
523
+ text: "text";
519
524
  brand: "brand";
520
525
  brandShimmer: "brandShimmer";
521
526
  accentDim: "accentDim";
522
527
  accentBright: "accentBright";
523
- text: "text";
524
528
  inactive: "inactive";
525
529
  secondary: "secondary";
526
530
  subtle: "subtle";
@@ -545,11 +549,11 @@ declare const themePresetContributionSchema: z.ZodObject<{
545
549
  success: "success";
546
550
  error: "error";
547
551
  accent: "accent";
552
+ text: "text";
548
553
  brand: "brand";
549
554
  brandShimmer: "brandShimmer";
550
555
  accentDim: "accentDim";
551
556
  accentBright: "accentBright";
552
- text: "text";
553
557
  inactive: "inactive";
554
558
  secondary: "secondary";
555
559
  subtle: "subtle";
@@ -574,11 +578,11 @@ declare const themePresetContributionSchema: z.ZodObject<{
574
578
  success: "success";
575
579
  error: "error";
576
580
  accent: "accent";
581
+ text: "text";
577
582
  brand: "brand";
578
583
  brandShimmer: "brandShimmer";
579
584
  accentDim: "accentDim";
580
585
  accentBright: "accentBright";
581
- text: "text";
582
586
  inactive: "inactive";
583
587
  secondary: "secondary";
584
588
  subtle: "subtle";
@@ -603,11 +607,11 @@ declare const themePresetContributionSchema: z.ZodObject<{
603
607
  success: "success";
604
608
  error: "error";
605
609
  accent: "accent";
610
+ text: "text";
606
611
  brand: "brand";
607
612
  brandShimmer: "brandShimmer";
608
613
  accentDim: "accentDim";
609
614
  accentBright: "accentBright";
610
- text: "text";
611
615
  inactive: "inactive";
612
616
  secondary: "secondary";
613
617
  subtle: "subtle";
@@ -632,11 +636,11 @@ declare const themePresetContributionSchema: z.ZodObject<{
632
636
  success: "success";
633
637
  error: "error";
634
638
  accent: "accent";
639
+ text: "text";
635
640
  brand: "brand";
636
641
  brandShimmer: "brandShimmer";
637
642
  accentDim: "accentDim";
638
643
  accentBright: "accentBright";
639
- text: "text";
640
644
  inactive: "inactive";
641
645
  secondary: "secondary";
642
646
  subtle: "subtle";
@@ -661,11 +665,11 @@ declare const themePresetContributionSchema: z.ZodObject<{
661
665
  success: "success";
662
666
  error: "error";
663
667
  accent: "accent";
668
+ text: "text";
664
669
  brand: "brand";
665
670
  brandShimmer: "brandShimmer";
666
671
  accentDim: "accentDim";
667
672
  accentBright: "accentBright";
668
- text: "text";
669
673
  inactive: "inactive";
670
674
  secondary: "secondary";
671
675
  subtle: "subtle";
@@ -690,11 +694,11 @@ declare const themePresetContributionSchema: z.ZodObject<{
690
694
  success: "success";
691
695
  error: "error";
692
696
  accent: "accent";
697
+ text: "text";
693
698
  brand: "brand";
694
699
  brandShimmer: "brandShimmer";
695
700
  accentDim: "accentDim";
696
701
  accentBright: "accentBright";
697
- text: "text";
698
702
  inactive: "inactive";
699
703
  secondary: "secondary";
700
704
  subtle: "subtle";
@@ -719,11 +723,11 @@ declare const themePresetContributionSchema: z.ZodObject<{
719
723
  success: "success";
720
724
  error: "error";
721
725
  accent: "accent";
726
+ text: "text";
722
727
  brand: "brand";
723
728
  brandShimmer: "brandShimmer";
724
729
  accentDim: "accentDim";
725
730
  accentBright: "accentBright";
726
- text: "text";
727
731
  inactive: "inactive";
728
732
  secondary: "secondary";
729
733
  subtle: "subtle";
@@ -809,6 +813,7 @@ declare const providerEntrySchema: z.ZodObject<{
809
813
  } | undefined;
810
814
  strengths?: ("planning" | "knowledge" | "coding" | "reasoning" | "vision" | "speed" | "long-context")[] | undefined;
811
815
  reasoning?: boolean | undefined;
816
+ input?: ("text" | "image")[] | undefined;
812
817
  thinkingLevels?: ("low" | "medium" | "high" | "xhigh" | "max")[] | undefined;
813
818
  thinkingMode?: "enabled" | "adaptive" | undefined;
814
819
  }[] | undefined, unknown, z.core.$ZodTypeInternals<{
@@ -823,6 +828,7 @@ declare const providerEntrySchema: z.ZodObject<{
823
828
  } | undefined;
824
829
  strengths?: ("planning" | "knowledge" | "coding" | "reasoning" | "vision" | "speed" | "long-context")[] | undefined;
825
830
  reasoning?: boolean | undefined;
831
+ input?: ("text" | "image")[] | undefined;
826
832
  thinkingLevels?: ("low" | "medium" | "high" | "xhigh" | "max")[] | undefined;
827
833
  thinkingMode?: "enabled" | "adaptive" | undefined;
828
834
  }[] | undefined, unknown>>>>;
@@ -860,6 +866,7 @@ declare const providerEntrySchema: z.ZodObject<{
860
866
  }, z.core.$strip>>>;
861
867
  allowAuthHeaderOverride: z.ZodCatch<z.ZodOptional<z.ZodBoolean>>;
862
868
  preserveProviderId: z.ZodCatch<z.ZodOptional<z.ZodBoolean>>;
869
+ requiresIntranet: z.ZodCatch<z.ZodOptional<z.ZodBoolean>>;
863
870
  imageConstraints: z.ZodCatch<z.ZodOptional<z.ZodObject<{
864
871
  maxImagesPerRequest: z.ZodNumber;
865
872
  maxDimensionPxIfOverLimit: z.ZodCatch<z.ZodOptional<z.ZodNumber>>;
@@ -1034,6 +1041,7 @@ declare const contributesSchema: z.ZodObject<{
1034
1041
  } | undefined;
1035
1042
  strengths?: ("planning" | "knowledge" | "coding" | "reasoning" | "vision" | "speed" | "long-context")[] | undefined;
1036
1043
  reasoning?: boolean | undefined;
1044
+ input?: ("text" | "image")[] | undefined;
1037
1045
  thinkingLevels?: ("low" | "medium" | "high" | "xhigh" | "max")[] | undefined;
1038
1046
  thinkingMode?: "enabled" | "adaptive" | undefined;
1039
1047
  }[] | undefined;
@@ -1059,6 +1067,7 @@ declare const contributesSchema: z.ZodObject<{
1059
1067
  } | undefined;
1060
1068
  allowAuthHeaderOverride?: boolean | undefined;
1061
1069
  preserveProviderId?: boolean | undefined;
1070
+ requiresIntranet?: boolean | undefined;
1062
1071
  imageConstraints?: {
1063
1072
  maxImagesPerRequest: number;
1064
1073
  maxDimensionPxIfOverLimit?: number | undefined;
@@ -1085,6 +1094,7 @@ declare const contributesSchema: z.ZodObject<{
1085
1094
  } | undefined;
1086
1095
  strengths?: ("planning" | "knowledge" | "coding" | "reasoning" | "vision" | "speed" | "long-context")[] | undefined;
1087
1096
  reasoning?: boolean | undefined;
1097
+ input?: ("text" | "image")[] | undefined;
1088
1098
  thinkingLevels?: ("low" | "medium" | "high" | "xhigh" | "max")[] | undefined;
1089
1099
  thinkingMode?: "enabled" | "adaptive" | undefined;
1090
1100
  }[] | undefined;
@@ -1110,6 +1120,7 @@ declare const contributesSchema: z.ZodObject<{
1110
1120
  } | undefined;
1111
1121
  allowAuthHeaderOverride?: boolean | undefined;
1112
1122
  preserveProviderId?: boolean | undefined;
1123
+ requiresIntranet?: boolean | undefined;
1113
1124
  imageConstraints?: {
1114
1125
  maxImagesPerRequest: number;
1115
1126
  maxDimensionPxIfOverLimit?: number | undefined;
@@ -1313,18 +1324,18 @@ declare const contributesSchema: z.ZodObject<{
1313
1324
  text?: string | undefined;
1314
1325
  };
1315
1326
  markdown?: {
1316
- heading1?: "success" | "error" | "accent" | "brand" | "brandShimmer" | "accentDim" | "accentBright" | "text" | "inactive" | "secondary" | "subtle" | "replyPrefix" | "warning" | "special" | "suggestion" | "permission" | "codeText" | "diffAdd" | "diffRemove" | "diffAddBg" | "diffRemoveBg" | "panelBorder" | "overlayBg" | "tagBg" | "toolText" | "focusBorder" | "selection" | undefined;
1317
- heading2?: "success" | "error" | "accent" | "brand" | "brandShimmer" | "accentDim" | "accentBright" | "text" | "inactive" | "secondary" | "subtle" | "replyPrefix" | "warning" | "special" | "suggestion" | "permission" | "codeText" | "diffAdd" | "diffRemove" | "diffAddBg" | "diffRemoveBg" | "panelBorder" | "overlayBg" | "tagBg" | "toolText" | "focusBorder" | "selection" | undefined;
1318
- headingWeak?: "success" | "error" | "accent" | "brand" | "brandShimmer" | "accentDim" | "accentBright" | "text" | "inactive" | "secondary" | "subtle" | "replyPrefix" | "warning" | "special" | "suggestion" | "permission" | "codeText" | "diffAdd" | "diffRemove" | "diffAddBg" | "diffRemoveBg" | "panelBorder" | "overlayBg" | "tagBg" | "toolText" | "focusBorder" | "selection" | undefined;
1319
- listMarker?: "success" | "error" | "accent" | "brand" | "brandShimmer" | "accentDim" | "accentBright" | "text" | "inactive" | "secondary" | "subtle" | "replyPrefix" | "warning" | "special" | "suggestion" | "permission" | "codeText" | "diffAdd" | "diffRemove" | "diffAddBg" | "diffRemoveBg" | "panelBorder" | "overlayBg" | "tagBg" | "toolText" | "focusBorder" | "selection" | undefined;
1320
- listMarkerMuted?: "success" | "error" | "accent" | "brand" | "brandShimmer" | "accentDim" | "accentBright" | "text" | "inactive" | "secondary" | "subtle" | "replyPrefix" | "warning" | "special" | "suggestion" | "permission" | "codeText" | "diffAdd" | "diffRemove" | "diffAddBg" | "diffRemoveBg" | "panelBorder" | "overlayBg" | "tagBg" | "toolText" | "focusBorder" | "selection" | undefined;
1321
- quoteBar?: "success" | "error" | "accent" | "brand" | "brandShimmer" | "accentDim" | "accentBright" | "text" | "inactive" | "secondary" | "subtle" | "replyPrefix" | "warning" | "special" | "suggestion" | "permission" | "codeText" | "diffAdd" | "diffRemove" | "diffAddBg" | "diffRemoveBg" | "panelBorder" | "overlayBg" | "tagBg" | "toolText" | "focusBorder" | "selection" | undefined;
1322
- quoteText?: "success" | "error" | "accent" | "brand" | "brandShimmer" | "accentDim" | "accentBright" | "text" | "inactive" | "secondary" | "subtle" | "replyPrefix" | "warning" | "special" | "suggestion" | "permission" | "codeText" | "diffAdd" | "diffRemove" | "diffAddBg" | "diffRemoveBg" | "panelBorder" | "overlayBg" | "tagBg" | "toolText" | "focusBorder" | "selection" | undefined;
1323
- link?: "success" | "error" | "accent" | "brand" | "brandShimmer" | "accentDim" | "accentBright" | "text" | "inactive" | "secondary" | "subtle" | "replyPrefix" | "warning" | "special" | "suggestion" | "permission" | "codeText" | "diffAdd" | "diffRemove" | "diffAddBg" | "diffRemoveBg" | "panelBorder" | "overlayBg" | "tagBg" | "toolText" | "focusBorder" | "selection" | undefined;
1324
- inlineCode?: "success" | "error" | "accent" | "brand" | "brandShimmer" | "accentDim" | "accentBright" | "text" | "inactive" | "secondary" | "subtle" | "replyPrefix" | "warning" | "special" | "suggestion" | "permission" | "codeText" | "diffAdd" | "diffRemove" | "diffAddBg" | "diffRemoveBg" | "panelBorder" | "overlayBg" | "tagBg" | "toolText" | "focusBorder" | "selection" | undefined;
1325
- codeFence?: "success" | "error" | "accent" | "brand" | "brandShimmer" | "accentDim" | "accentBright" | "text" | "inactive" | "secondary" | "subtle" | "replyPrefix" | "warning" | "special" | "suggestion" | "permission" | "codeText" | "diffAdd" | "diffRemove" | "diffAddBg" | "diffRemoveBg" | "panelBorder" | "overlayBg" | "tagBg" | "toolText" | "focusBorder" | "selection" | undefined;
1326
- tableHeader?: "success" | "error" | "accent" | "brand" | "brandShimmer" | "accentDim" | "accentBright" | "text" | "inactive" | "secondary" | "subtle" | "replyPrefix" | "warning" | "special" | "suggestion" | "permission" | "codeText" | "diffAdd" | "diffRemove" | "diffAddBg" | "diffRemoveBg" | "panelBorder" | "overlayBg" | "tagBg" | "toolText" | "focusBorder" | "selection" | undefined;
1327
- tableDivider?: "success" | "error" | "accent" | "brand" | "brandShimmer" | "accentDim" | "accentBright" | "text" | "inactive" | "secondary" | "subtle" | "replyPrefix" | "warning" | "special" | "suggestion" | "permission" | "codeText" | "diffAdd" | "diffRemove" | "diffAddBg" | "diffRemoveBg" | "panelBorder" | "overlayBg" | "tagBg" | "toolText" | "focusBorder" | "selection" | undefined;
1327
+ heading1?: "success" | "error" | "accent" | "text" | "brand" | "brandShimmer" | "accentDim" | "accentBright" | "inactive" | "secondary" | "subtle" | "replyPrefix" | "warning" | "special" | "suggestion" | "permission" | "codeText" | "diffAdd" | "diffRemove" | "diffAddBg" | "diffRemoveBg" | "panelBorder" | "overlayBg" | "tagBg" | "toolText" | "focusBorder" | "selection" | undefined;
1328
+ heading2?: "success" | "error" | "accent" | "text" | "brand" | "brandShimmer" | "accentDim" | "accentBright" | "inactive" | "secondary" | "subtle" | "replyPrefix" | "warning" | "special" | "suggestion" | "permission" | "codeText" | "diffAdd" | "diffRemove" | "diffAddBg" | "diffRemoveBg" | "panelBorder" | "overlayBg" | "tagBg" | "toolText" | "focusBorder" | "selection" | undefined;
1329
+ headingWeak?: "success" | "error" | "accent" | "text" | "brand" | "brandShimmer" | "accentDim" | "accentBright" | "inactive" | "secondary" | "subtle" | "replyPrefix" | "warning" | "special" | "suggestion" | "permission" | "codeText" | "diffAdd" | "diffRemove" | "diffAddBg" | "diffRemoveBg" | "panelBorder" | "overlayBg" | "tagBg" | "toolText" | "focusBorder" | "selection" | undefined;
1330
+ listMarker?: "success" | "error" | "accent" | "text" | "brand" | "brandShimmer" | "accentDim" | "accentBright" | "inactive" | "secondary" | "subtle" | "replyPrefix" | "warning" | "special" | "suggestion" | "permission" | "codeText" | "diffAdd" | "diffRemove" | "diffAddBg" | "diffRemoveBg" | "panelBorder" | "overlayBg" | "tagBg" | "toolText" | "focusBorder" | "selection" | undefined;
1331
+ listMarkerMuted?: "success" | "error" | "accent" | "text" | "brand" | "brandShimmer" | "accentDim" | "accentBright" | "inactive" | "secondary" | "subtle" | "replyPrefix" | "warning" | "special" | "suggestion" | "permission" | "codeText" | "diffAdd" | "diffRemove" | "diffAddBg" | "diffRemoveBg" | "panelBorder" | "overlayBg" | "tagBg" | "toolText" | "focusBorder" | "selection" | undefined;
1332
+ quoteBar?: "success" | "error" | "accent" | "text" | "brand" | "brandShimmer" | "accentDim" | "accentBright" | "inactive" | "secondary" | "subtle" | "replyPrefix" | "warning" | "special" | "suggestion" | "permission" | "codeText" | "diffAdd" | "diffRemove" | "diffAddBg" | "diffRemoveBg" | "panelBorder" | "overlayBg" | "tagBg" | "toolText" | "focusBorder" | "selection" | undefined;
1333
+ quoteText?: "success" | "error" | "accent" | "text" | "brand" | "brandShimmer" | "accentDim" | "accentBright" | "inactive" | "secondary" | "subtle" | "replyPrefix" | "warning" | "special" | "suggestion" | "permission" | "codeText" | "diffAdd" | "diffRemove" | "diffAddBg" | "diffRemoveBg" | "panelBorder" | "overlayBg" | "tagBg" | "toolText" | "focusBorder" | "selection" | undefined;
1334
+ link?: "success" | "error" | "accent" | "text" | "brand" | "brandShimmer" | "accentDim" | "accentBright" | "inactive" | "secondary" | "subtle" | "replyPrefix" | "warning" | "special" | "suggestion" | "permission" | "codeText" | "diffAdd" | "diffRemove" | "diffAddBg" | "diffRemoveBg" | "panelBorder" | "overlayBg" | "tagBg" | "toolText" | "focusBorder" | "selection" | undefined;
1335
+ inlineCode?: "success" | "error" | "accent" | "text" | "brand" | "brandShimmer" | "accentDim" | "accentBright" | "inactive" | "secondary" | "subtle" | "replyPrefix" | "warning" | "special" | "suggestion" | "permission" | "codeText" | "diffAdd" | "diffRemove" | "diffAddBg" | "diffRemoveBg" | "panelBorder" | "overlayBg" | "tagBg" | "toolText" | "focusBorder" | "selection" | undefined;
1336
+ codeFence?: "success" | "error" | "accent" | "text" | "brand" | "brandShimmer" | "accentDim" | "accentBright" | "inactive" | "secondary" | "subtle" | "replyPrefix" | "warning" | "special" | "suggestion" | "permission" | "codeText" | "diffAdd" | "diffRemove" | "diffAddBg" | "diffRemoveBg" | "panelBorder" | "overlayBg" | "tagBg" | "toolText" | "focusBorder" | "selection" | undefined;
1337
+ tableHeader?: "success" | "error" | "accent" | "text" | "brand" | "brandShimmer" | "accentDim" | "accentBright" | "inactive" | "secondary" | "subtle" | "replyPrefix" | "warning" | "special" | "suggestion" | "permission" | "codeText" | "diffAdd" | "diffRemove" | "diffAddBg" | "diffRemoveBg" | "panelBorder" | "overlayBg" | "tagBg" | "toolText" | "focusBorder" | "selection" | undefined;
1338
+ tableDivider?: "success" | "error" | "accent" | "text" | "brand" | "brandShimmer" | "accentDim" | "accentBright" | "inactive" | "secondary" | "subtle" | "replyPrefix" | "warning" | "special" | "suggestion" | "permission" | "codeText" | "diffAdd" | "diffRemove" | "diffAddBg" | "diffRemoveBg" | "panelBorder" | "overlayBg" | "tagBg" | "toolText" | "focusBorder" | "selection" | undefined;
1328
1339
  listIndent?: 2 | 3 | undefined;
1329
1340
  listMarkers?: [string, string, string, string] | undefined;
1330
1341
  codeBlockDivider?: "none" | "hr" | undefined;
@@ -1368,18 +1379,18 @@ declare const contributesSchema: z.ZodObject<{
1368
1379
  text?: string | undefined;
1369
1380
  };
1370
1381
  markdown?: {
1371
- heading1?: "success" | "error" | "accent" | "brand" | "brandShimmer" | "accentDim" | "accentBright" | "text" | "inactive" | "secondary" | "subtle" | "replyPrefix" | "warning" | "special" | "suggestion" | "permission" | "codeText" | "diffAdd" | "diffRemove" | "diffAddBg" | "diffRemoveBg" | "panelBorder" | "overlayBg" | "tagBg" | "toolText" | "focusBorder" | "selection" | undefined;
1372
- heading2?: "success" | "error" | "accent" | "brand" | "brandShimmer" | "accentDim" | "accentBright" | "text" | "inactive" | "secondary" | "subtle" | "replyPrefix" | "warning" | "special" | "suggestion" | "permission" | "codeText" | "diffAdd" | "diffRemove" | "diffAddBg" | "diffRemoveBg" | "panelBorder" | "overlayBg" | "tagBg" | "toolText" | "focusBorder" | "selection" | undefined;
1373
- headingWeak?: "success" | "error" | "accent" | "brand" | "brandShimmer" | "accentDim" | "accentBright" | "text" | "inactive" | "secondary" | "subtle" | "replyPrefix" | "warning" | "special" | "suggestion" | "permission" | "codeText" | "diffAdd" | "diffRemove" | "diffAddBg" | "diffRemoveBg" | "panelBorder" | "overlayBg" | "tagBg" | "toolText" | "focusBorder" | "selection" | undefined;
1374
- listMarker?: "success" | "error" | "accent" | "brand" | "brandShimmer" | "accentDim" | "accentBright" | "text" | "inactive" | "secondary" | "subtle" | "replyPrefix" | "warning" | "special" | "suggestion" | "permission" | "codeText" | "diffAdd" | "diffRemove" | "diffAddBg" | "diffRemoveBg" | "panelBorder" | "overlayBg" | "tagBg" | "toolText" | "focusBorder" | "selection" | undefined;
1375
- listMarkerMuted?: "success" | "error" | "accent" | "brand" | "brandShimmer" | "accentDim" | "accentBright" | "text" | "inactive" | "secondary" | "subtle" | "replyPrefix" | "warning" | "special" | "suggestion" | "permission" | "codeText" | "diffAdd" | "diffRemove" | "diffAddBg" | "diffRemoveBg" | "panelBorder" | "overlayBg" | "tagBg" | "toolText" | "focusBorder" | "selection" | undefined;
1376
- quoteBar?: "success" | "error" | "accent" | "brand" | "brandShimmer" | "accentDim" | "accentBright" | "text" | "inactive" | "secondary" | "subtle" | "replyPrefix" | "warning" | "special" | "suggestion" | "permission" | "codeText" | "diffAdd" | "diffRemove" | "diffAddBg" | "diffRemoveBg" | "panelBorder" | "overlayBg" | "tagBg" | "toolText" | "focusBorder" | "selection" | undefined;
1377
- quoteText?: "success" | "error" | "accent" | "brand" | "brandShimmer" | "accentDim" | "accentBright" | "text" | "inactive" | "secondary" | "subtle" | "replyPrefix" | "warning" | "special" | "suggestion" | "permission" | "codeText" | "diffAdd" | "diffRemove" | "diffAddBg" | "diffRemoveBg" | "panelBorder" | "overlayBg" | "tagBg" | "toolText" | "focusBorder" | "selection" | undefined;
1378
- link?: "success" | "error" | "accent" | "brand" | "brandShimmer" | "accentDim" | "accentBright" | "text" | "inactive" | "secondary" | "subtle" | "replyPrefix" | "warning" | "special" | "suggestion" | "permission" | "codeText" | "diffAdd" | "diffRemove" | "diffAddBg" | "diffRemoveBg" | "panelBorder" | "overlayBg" | "tagBg" | "toolText" | "focusBorder" | "selection" | undefined;
1379
- inlineCode?: "success" | "error" | "accent" | "brand" | "brandShimmer" | "accentDim" | "accentBright" | "text" | "inactive" | "secondary" | "subtle" | "replyPrefix" | "warning" | "special" | "suggestion" | "permission" | "codeText" | "diffAdd" | "diffRemove" | "diffAddBg" | "diffRemoveBg" | "panelBorder" | "overlayBg" | "tagBg" | "toolText" | "focusBorder" | "selection" | undefined;
1380
- codeFence?: "success" | "error" | "accent" | "brand" | "brandShimmer" | "accentDim" | "accentBright" | "text" | "inactive" | "secondary" | "subtle" | "replyPrefix" | "warning" | "special" | "suggestion" | "permission" | "codeText" | "diffAdd" | "diffRemove" | "diffAddBg" | "diffRemoveBg" | "panelBorder" | "overlayBg" | "tagBg" | "toolText" | "focusBorder" | "selection" | undefined;
1381
- tableHeader?: "success" | "error" | "accent" | "brand" | "brandShimmer" | "accentDim" | "accentBright" | "text" | "inactive" | "secondary" | "subtle" | "replyPrefix" | "warning" | "special" | "suggestion" | "permission" | "codeText" | "diffAdd" | "diffRemove" | "diffAddBg" | "diffRemoveBg" | "panelBorder" | "overlayBg" | "tagBg" | "toolText" | "focusBorder" | "selection" | undefined;
1382
- tableDivider?: "success" | "error" | "accent" | "brand" | "brandShimmer" | "accentDim" | "accentBright" | "text" | "inactive" | "secondary" | "subtle" | "replyPrefix" | "warning" | "special" | "suggestion" | "permission" | "codeText" | "diffAdd" | "diffRemove" | "diffAddBg" | "diffRemoveBg" | "panelBorder" | "overlayBg" | "tagBg" | "toolText" | "focusBorder" | "selection" | undefined;
1382
+ heading1?: "success" | "error" | "accent" | "text" | "brand" | "brandShimmer" | "accentDim" | "accentBright" | "inactive" | "secondary" | "subtle" | "replyPrefix" | "warning" | "special" | "suggestion" | "permission" | "codeText" | "diffAdd" | "diffRemove" | "diffAddBg" | "diffRemoveBg" | "panelBorder" | "overlayBg" | "tagBg" | "toolText" | "focusBorder" | "selection" | undefined;
1383
+ heading2?: "success" | "error" | "accent" | "text" | "brand" | "brandShimmer" | "accentDim" | "accentBright" | "inactive" | "secondary" | "subtle" | "replyPrefix" | "warning" | "special" | "suggestion" | "permission" | "codeText" | "diffAdd" | "diffRemove" | "diffAddBg" | "diffRemoveBg" | "panelBorder" | "overlayBg" | "tagBg" | "toolText" | "focusBorder" | "selection" | undefined;
1384
+ headingWeak?: "success" | "error" | "accent" | "text" | "brand" | "brandShimmer" | "accentDim" | "accentBright" | "inactive" | "secondary" | "subtle" | "replyPrefix" | "warning" | "special" | "suggestion" | "permission" | "codeText" | "diffAdd" | "diffRemove" | "diffAddBg" | "diffRemoveBg" | "panelBorder" | "overlayBg" | "tagBg" | "toolText" | "focusBorder" | "selection" | undefined;
1385
+ listMarker?: "success" | "error" | "accent" | "text" | "brand" | "brandShimmer" | "accentDim" | "accentBright" | "inactive" | "secondary" | "subtle" | "replyPrefix" | "warning" | "special" | "suggestion" | "permission" | "codeText" | "diffAdd" | "diffRemove" | "diffAddBg" | "diffRemoveBg" | "panelBorder" | "overlayBg" | "tagBg" | "toolText" | "focusBorder" | "selection" | undefined;
1386
+ listMarkerMuted?: "success" | "error" | "accent" | "text" | "brand" | "brandShimmer" | "accentDim" | "accentBright" | "inactive" | "secondary" | "subtle" | "replyPrefix" | "warning" | "special" | "suggestion" | "permission" | "codeText" | "diffAdd" | "diffRemove" | "diffAddBg" | "diffRemoveBg" | "panelBorder" | "overlayBg" | "tagBg" | "toolText" | "focusBorder" | "selection" | undefined;
1387
+ quoteBar?: "success" | "error" | "accent" | "text" | "brand" | "brandShimmer" | "accentDim" | "accentBright" | "inactive" | "secondary" | "subtle" | "replyPrefix" | "warning" | "special" | "suggestion" | "permission" | "codeText" | "diffAdd" | "diffRemove" | "diffAddBg" | "diffRemoveBg" | "panelBorder" | "overlayBg" | "tagBg" | "toolText" | "focusBorder" | "selection" | undefined;
1388
+ quoteText?: "success" | "error" | "accent" | "text" | "brand" | "brandShimmer" | "accentDim" | "accentBright" | "inactive" | "secondary" | "subtle" | "replyPrefix" | "warning" | "special" | "suggestion" | "permission" | "codeText" | "diffAdd" | "diffRemove" | "diffAddBg" | "diffRemoveBg" | "panelBorder" | "overlayBg" | "tagBg" | "toolText" | "focusBorder" | "selection" | undefined;
1389
+ link?: "success" | "error" | "accent" | "text" | "brand" | "brandShimmer" | "accentDim" | "accentBright" | "inactive" | "secondary" | "subtle" | "replyPrefix" | "warning" | "special" | "suggestion" | "permission" | "codeText" | "diffAdd" | "diffRemove" | "diffAddBg" | "diffRemoveBg" | "panelBorder" | "overlayBg" | "tagBg" | "toolText" | "focusBorder" | "selection" | undefined;
1390
+ inlineCode?: "success" | "error" | "accent" | "text" | "brand" | "brandShimmer" | "accentDim" | "accentBright" | "inactive" | "secondary" | "subtle" | "replyPrefix" | "warning" | "special" | "suggestion" | "permission" | "codeText" | "diffAdd" | "diffRemove" | "diffAddBg" | "diffRemoveBg" | "panelBorder" | "overlayBg" | "tagBg" | "toolText" | "focusBorder" | "selection" | undefined;
1391
+ codeFence?: "success" | "error" | "accent" | "text" | "brand" | "brandShimmer" | "accentDim" | "accentBright" | "inactive" | "secondary" | "subtle" | "replyPrefix" | "warning" | "special" | "suggestion" | "permission" | "codeText" | "diffAdd" | "diffRemove" | "diffAddBg" | "diffRemoveBg" | "panelBorder" | "overlayBg" | "tagBg" | "toolText" | "focusBorder" | "selection" | undefined;
1392
+ tableHeader?: "success" | "error" | "accent" | "text" | "brand" | "brandShimmer" | "accentDim" | "accentBright" | "inactive" | "secondary" | "subtle" | "replyPrefix" | "warning" | "special" | "suggestion" | "permission" | "codeText" | "diffAdd" | "diffRemove" | "diffAddBg" | "diffRemoveBg" | "panelBorder" | "overlayBg" | "tagBg" | "toolText" | "focusBorder" | "selection" | undefined;
1393
+ tableDivider?: "success" | "error" | "accent" | "text" | "brand" | "brandShimmer" | "accentDim" | "accentBright" | "inactive" | "secondary" | "subtle" | "replyPrefix" | "warning" | "special" | "suggestion" | "permission" | "codeText" | "diffAdd" | "diffRemove" | "diffAddBg" | "diffRemoveBg" | "panelBorder" | "overlayBg" | "tagBg" | "toolText" | "focusBorder" | "selection" | undefined;
1383
1394
  listIndent?: 2 | 3 | undefined;
1384
1395
  listMarkers?: [string, string, string, string] | undefined;
1385
1396
  codeBlockDivider?: "none" | "hr" | undefined;
@@ -1559,6 +1570,7 @@ declare const manifestSchema: z.ZodObject<{
1559
1570
  } | undefined;
1560
1571
  strengths?: ("planning" | "knowledge" | "coding" | "reasoning" | "vision" | "speed" | "long-context")[] | undefined;
1561
1572
  reasoning?: boolean | undefined;
1573
+ input?: ("text" | "image")[] | undefined;
1562
1574
  thinkingLevels?: ("low" | "medium" | "high" | "xhigh" | "max")[] | undefined;
1563
1575
  thinkingMode?: "enabled" | "adaptive" | undefined;
1564
1576
  }[] | undefined;
@@ -1584,6 +1596,7 @@ declare const manifestSchema: z.ZodObject<{
1584
1596
  } | undefined;
1585
1597
  allowAuthHeaderOverride?: boolean | undefined;
1586
1598
  preserveProviderId?: boolean | undefined;
1599
+ requiresIntranet?: boolean | undefined;
1587
1600
  imageConstraints?: {
1588
1601
  maxImagesPerRequest: number;
1589
1602
  maxDimensionPxIfOverLimit?: number | undefined;
@@ -1610,6 +1623,7 @@ declare const manifestSchema: z.ZodObject<{
1610
1623
  } | undefined;
1611
1624
  strengths?: ("planning" | "knowledge" | "coding" | "reasoning" | "vision" | "speed" | "long-context")[] | undefined;
1612
1625
  reasoning?: boolean | undefined;
1626
+ input?: ("text" | "image")[] | undefined;
1613
1627
  thinkingLevels?: ("low" | "medium" | "high" | "xhigh" | "max")[] | undefined;
1614
1628
  thinkingMode?: "enabled" | "adaptive" | undefined;
1615
1629
  }[] | undefined;
@@ -1635,6 +1649,7 @@ declare const manifestSchema: z.ZodObject<{
1635
1649
  } | undefined;
1636
1650
  allowAuthHeaderOverride?: boolean | undefined;
1637
1651
  preserveProviderId?: boolean | undefined;
1652
+ requiresIntranet?: boolean | undefined;
1638
1653
  imageConstraints?: {
1639
1654
  maxImagesPerRequest: number;
1640
1655
  maxDimensionPxIfOverLimit?: number | undefined;
@@ -1838,18 +1853,18 @@ declare const manifestSchema: z.ZodObject<{
1838
1853
  text?: string | undefined;
1839
1854
  };
1840
1855
  markdown?: {
1841
- heading1?: "success" | "error" | "accent" | "brand" | "brandShimmer" | "accentDim" | "accentBright" | "text" | "inactive" | "secondary" | "subtle" | "replyPrefix" | "warning" | "special" | "suggestion" | "permission" | "codeText" | "diffAdd" | "diffRemove" | "diffAddBg" | "diffRemoveBg" | "panelBorder" | "overlayBg" | "tagBg" | "toolText" | "focusBorder" | "selection" | undefined;
1842
- heading2?: "success" | "error" | "accent" | "brand" | "brandShimmer" | "accentDim" | "accentBright" | "text" | "inactive" | "secondary" | "subtle" | "replyPrefix" | "warning" | "special" | "suggestion" | "permission" | "codeText" | "diffAdd" | "diffRemove" | "diffAddBg" | "diffRemoveBg" | "panelBorder" | "overlayBg" | "tagBg" | "toolText" | "focusBorder" | "selection" | undefined;
1843
- headingWeak?: "success" | "error" | "accent" | "brand" | "brandShimmer" | "accentDim" | "accentBright" | "text" | "inactive" | "secondary" | "subtle" | "replyPrefix" | "warning" | "special" | "suggestion" | "permission" | "codeText" | "diffAdd" | "diffRemove" | "diffAddBg" | "diffRemoveBg" | "panelBorder" | "overlayBg" | "tagBg" | "toolText" | "focusBorder" | "selection" | undefined;
1844
- listMarker?: "success" | "error" | "accent" | "brand" | "brandShimmer" | "accentDim" | "accentBright" | "text" | "inactive" | "secondary" | "subtle" | "replyPrefix" | "warning" | "special" | "suggestion" | "permission" | "codeText" | "diffAdd" | "diffRemove" | "diffAddBg" | "diffRemoveBg" | "panelBorder" | "overlayBg" | "tagBg" | "toolText" | "focusBorder" | "selection" | undefined;
1845
- listMarkerMuted?: "success" | "error" | "accent" | "brand" | "brandShimmer" | "accentDim" | "accentBright" | "text" | "inactive" | "secondary" | "subtle" | "replyPrefix" | "warning" | "special" | "suggestion" | "permission" | "codeText" | "diffAdd" | "diffRemove" | "diffAddBg" | "diffRemoveBg" | "panelBorder" | "overlayBg" | "tagBg" | "toolText" | "focusBorder" | "selection" | undefined;
1846
- quoteBar?: "success" | "error" | "accent" | "brand" | "brandShimmer" | "accentDim" | "accentBright" | "text" | "inactive" | "secondary" | "subtle" | "replyPrefix" | "warning" | "special" | "suggestion" | "permission" | "codeText" | "diffAdd" | "diffRemove" | "diffAddBg" | "diffRemoveBg" | "panelBorder" | "overlayBg" | "tagBg" | "toolText" | "focusBorder" | "selection" | undefined;
1847
- quoteText?: "success" | "error" | "accent" | "brand" | "brandShimmer" | "accentDim" | "accentBright" | "text" | "inactive" | "secondary" | "subtle" | "replyPrefix" | "warning" | "special" | "suggestion" | "permission" | "codeText" | "diffAdd" | "diffRemove" | "diffAddBg" | "diffRemoveBg" | "panelBorder" | "overlayBg" | "tagBg" | "toolText" | "focusBorder" | "selection" | undefined;
1848
- link?: "success" | "error" | "accent" | "brand" | "brandShimmer" | "accentDim" | "accentBright" | "text" | "inactive" | "secondary" | "subtle" | "replyPrefix" | "warning" | "special" | "suggestion" | "permission" | "codeText" | "diffAdd" | "diffRemove" | "diffAddBg" | "diffRemoveBg" | "panelBorder" | "overlayBg" | "tagBg" | "toolText" | "focusBorder" | "selection" | undefined;
1849
- inlineCode?: "success" | "error" | "accent" | "brand" | "brandShimmer" | "accentDim" | "accentBright" | "text" | "inactive" | "secondary" | "subtle" | "replyPrefix" | "warning" | "special" | "suggestion" | "permission" | "codeText" | "diffAdd" | "diffRemove" | "diffAddBg" | "diffRemoveBg" | "panelBorder" | "overlayBg" | "tagBg" | "toolText" | "focusBorder" | "selection" | undefined;
1850
- codeFence?: "success" | "error" | "accent" | "brand" | "brandShimmer" | "accentDim" | "accentBright" | "text" | "inactive" | "secondary" | "subtle" | "replyPrefix" | "warning" | "special" | "suggestion" | "permission" | "codeText" | "diffAdd" | "diffRemove" | "diffAddBg" | "diffRemoveBg" | "panelBorder" | "overlayBg" | "tagBg" | "toolText" | "focusBorder" | "selection" | undefined;
1851
- tableHeader?: "success" | "error" | "accent" | "brand" | "brandShimmer" | "accentDim" | "accentBright" | "text" | "inactive" | "secondary" | "subtle" | "replyPrefix" | "warning" | "special" | "suggestion" | "permission" | "codeText" | "diffAdd" | "diffRemove" | "diffAddBg" | "diffRemoveBg" | "panelBorder" | "overlayBg" | "tagBg" | "toolText" | "focusBorder" | "selection" | undefined;
1852
- tableDivider?: "success" | "error" | "accent" | "brand" | "brandShimmer" | "accentDim" | "accentBright" | "text" | "inactive" | "secondary" | "subtle" | "replyPrefix" | "warning" | "special" | "suggestion" | "permission" | "codeText" | "diffAdd" | "diffRemove" | "diffAddBg" | "diffRemoveBg" | "panelBorder" | "overlayBg" | "tagBg" | "toolText" | "focusBorder" | "selection" | undefined;
1856
+ heading1?: "success" | "error" | "accent" | "text" | "brand" | "brandShimmer" | "accentDim" | "accentBright" | "inactive" | "secondary" | "subtle" | "replyPrefix" | "warning" | "special" | "suggestion" | "permission" | "codeText" | "diffAdd" | "diffRemove" | "diffAddBg" | "diffRemoveBg" | "panelBorder" | "overlayBg" | "tagBg" | "toolText" | "focusBorder" | "selection" | undefined;
1857
+ heading2?: "success" | "error" | "accent" | "text" | "brand" | "brandShimmer" | "accentDim" | "accentBright" | "inactive" | "secondary" | "subtle" | "replyPrefix" | "warning" | "special" | "suggestion" | "permission" | "codeText" | "diffAdd" | "diffRemove" | "diffAddBg" | "diffRemoveBg" | "panelBorder" | "overlayBg" | "tagBg" | "toolText" | "focusBorder" | "selection" | undefined;
1858
+ headingWeak?: "success" | "error" | "accent" | "text" | "brand" | "brandShimmer" | "accentDim" | "accentBright" | "inactive" | "secondary" | "subtle" | "replyPrefix" | "warning" | "special" | "suggestion" | "permission" | "codeText" | "diffAdd" | "diffRemove" | "diffAddBg" | "diffRemoveBg" | "panelBorder" | "overlayBg" | "tagBg" | "toolText" | "focusBorder" | "selection" | undefined;
1859
+ listMarker?: "success" | "error" | "accent" | "text" | "brand" | "brandShimmer" | "accentDim" | "accentBright" | "inactive" | "secondary" | "subtle" | "replyPrefix" | "warning" | "special" | "suggestion" | "permission" | "codeText" | "diffAdd" | "diffRemove" | "diffAddBg" | "diffRemoveBg" | "panelBorder" | "overlayBg" | "tagBg" | "toolText" | "focusBorder" | "selection" | undefined;
1860
+ listMarkerMuted?: "success" | "error" | "accent" | "text" | "brand" | "brandShimmer" | "accentDim" | "accentBright" | "inactive" | "secondary" | "subtle" | "replyPrefix" | "warning" | "special" | "suggestion" | "permission" | "codeText" | "diffAdd" | "diffRemove" | "diffAddBg" | "diffRemoveBg" | "panelBorder" | "overlayBg" | "tagBg" | "toolText" | "focusBorder" | "selection" | undefined;
1861
+ quoteBar?: "success" | "error" | "accent" | "text" | "brand" | "brandShimmer" | "accentDim" | "accentBright" | "inactive" | "secondary" | "subtle" | "replyPrefix" | "warning" | "special" | "suggestion" | "permission" | "codeText" | "diffAdd" | "diffRemove" | "diffAddBg" | "diffRemoveBg" | "panelBorder" | "overlayBg" | "tagBg" | "toolText" | "focusBorder" | "selection" | undefined;
1862
+ quoteText?: "success" | "error" | "accent" | "text" | "brand" | "brandShimmer" | "accentDim" | "accentBright" | "inactive" | "secondary" | "subtle" | "replyPrefix" | "warning" | "special" | "suggestion" | "permission" | "codeText" | "diffAdd" | "diffRemove" | "diffAddBg" | "diffRemoveBg" | "panelBorder" | "overlayBg" | "tagBg" | "toolText" | "focusBorder" | "selection" | undefined;
1863
+ link?: "success" | "error" | "accent" | "text" | "brand" | "brandShimmer" | "accentDim" | "accentBright" | "inactive" | "secondary" | "subtle" | "replyPrefix" | "warning" | "special" | "suggestion" | "permission" | "codeText" | "diffAdd" | "diffRemove" | "diffAddBg" | "diffRemoveBg" | "panelBorder" | "overlayBg" | "tagBg" | "toolText" | "focusBorder" | "selection" | undefined;
1864
+ inlineCode?: "success" | "error" | "accent" | "text" | "brand" | "brandShimmer" | "accentDim" | "accentBright" | "inactive" | "secondary" | "subtle" | "replyPrefix" | "warning" | "special" | "suggestion" | "permission" | "codeText" | "diffAdd" | "diffRemove" | "diffAddBg" | "diffRemoveBg" | "panelBorder" | "overlayBg" | "tagBg" | "toolText" | "focusBorder" | "selection" | undefined;
1865
+ codeFence?: "success" | "error" | "accent" | "text" | "brand" | "brandShimmer" | "accentDim" | "accentBright" | "inactive" | "secondary" | "subtle" | "replyPrefix" | "warning" | "special" | "suggestion" | "permission" | "codeText" | "diffAdd" | "diffRemove" | "diffAddBg" | "diffRemoveBg" | "panelBorder" | "overlayBg" | "tagBg" | "toolText" | "focusBorder" | "selection" | undefined;
1866
+ tableHeader?: "success" | "error" | "accent" | "text" | "brand" | "brandShimmer" | "accentDim" | "accentBright" | "inactive" | "secondary" | "subtle" | "replyPrefix" | "warning" | "special" | "suggestion" | "permission" | "codeText" | "diffAdd" | "diffRemove" | "diffAddBg" | "diffRemoveBg" | "panelBorder" | "overlayBg" | "tagBg" | "toolText" | "focusBorder" | "selection" | undefined;
1867
+ tableDivider?: "success" | "error" | "accent" | "text" | "brand" | "brandShimmer" | "accentDim" | "accentBright" | "inactive" | "secondary" | "subtle" | "replyPrefix" | "warning" | "special" | "suggestion" | "permission" | "codeText" | "diffAdd" | "diffRemove" | "diffAddBg" | "diffRemoveBg" | "panelBorder" | "overlayBg" | "tagBg" | "toolText" | "focusBorder" | "selection" | undefined;
1853
1868
  listIndent?: 2 | 3 | undefined;
1854
1869
  listMarkers?: [string, string, string, string] | undefined;
1855
1870
  codeBlockDivider?: "none" | "hr" | undefined;
@@ -1893,18 +1908,18 @@ declare const manifestSchema: z.ZodObject<{
1893
1908
  text?: string | undefined;
1894
1909
  };
1895
1910
  markdown?: {
1896
- heading1?: "success" | "error" | "accent" | "brand" | "brandShimmer" | "accentDim" | "accentBright" | "text" | "inactive" | "secondary" | "subtle" | "replyPrefix" | "warning" | "special" | "suggestion" | "permission" | "codeText" | "diffAdd" | "diffRemove" | "diffAddBg" | "diffRemoveBg" | "panelBorder" | "overlayBg" | "tagBg" | "toolText" | "focusBorder" | "selection" | undefined;
1897
- heading2?: "success" | "error" | "accent" | "brand" | "brandShimmer" | "accentDim" | "accentBright" | "text" | "inactive" | "secondary" | "subtle" | "replyPrefix" | "warning" | "special" | "suggestion" | "permission" | "codeText" | "diffAdd" | "diffRemove" | "diffAddBg" | "diffRemoveBg" | "panelBorder" | "overlayBg" | "tagBg" | "toolText" | "focusBorder" | "selection" | undefined;
1898
- headingWeak?: "success" | "error" | "accent" | "brand" | "brandShimmer" | "accentDim" | "accentBright" | "text" | "inactive" | "secondary" | "subtle" | "replyPrefix" | "warning" | "special" | "suggestion" | "permission" | "codeText" | "diffAdd" | "diffRemove" | "diffAddBg" | "diffRemoveBg" | "panelBorder" | "overlayBg" | "tagBg" | "toolText" | "focusBorder" | "selection" | undefined;
1899
- listMarker?: "success" | "error" | "accent" | "brand" | "brandShimmer" | "accentDim" | "accentBright" | "text" | "inactive" | "secondary" | "subtle" | "replyPrefix" | "warning" | "special" | "suggestion" | "permission" | "codeText" | "diffAdd" | "diffRemove" | "diffAddBg" | "diffRemoveBg" | "panelBorder" | "overlayBg" | "tagBg" | "toolText" | "focusBorder" | "selection" | undefined;
1900
- listMarkerMuted?: "success" | "error" | "accent" | "brand" | "brandShimmer" | "accentDim" | "accentBright" | "text" | "inactive" | "secondary" | "subtle" | "replyPrefix" | "warning" | "special" | "suggestion" | "permission" | "codeText" | "diffAdd" | "diffRemove" | "diffAddBg" | "diffRemoveBg" | "panelBorder" | "overlayBg" | "tagBg" | "toolText" | "focusBorder" | "selection" | undefined;
1901
- quoteBar?: "success" | "error" | "accent" | "brand" | "brandShimmer" | "accentDim" | "accentBright" | "text" | "inactive" | "secondary" | "subtle" | "replyPrefix" | "warning" | "special" | "suggestion" | "permission" | "codeText" | "diffAdd" | "diffRemove" | "diffAddBg" | "diffRemoveBg" | "panelBorder" | "overlayBg" | "tagBg" | "toolText" | "focusBorder" | "selection" | undefined;
1902
- quoteText?: "success" | "error" | "accent" | "brand" | "brandShimmer" | "accentDim" | "accentBright" | "text" | "inactive" | "secondary" | "subtle" | "replyPrefix" | "warning" | "special" | "suggestion" | "permission" | "codeText" | "diffAdd" | "diffRemove" | "diffAddBg" | "diffRemoveBg" | "panelBorder" | "overlayBg" | "tagBg" | "toolText" | "focusBorder" | "selection" | undefined;
1903
- link?: "success" | "error" | "accent" | "brand" | "brandShimmer" | "accentDim" | "accentBright" | "text" | "inactive" | "secondary" | "subtle" | "replyPrefix" | "warning" | "special" | "suggestion" | "permission" | "codeText" | "diffAdd" | "diffRemove" | "diffAddBg" | "diffRemoveBg" | "panelBorder" | "overlayBg" | "tagBg" | "toolText" | "focusBorder" | "selection" | undefined;
1904
- inlineCode?: "success" | "error" | "accent" | "brand" | "brandShimmer" | "accentDim" | "accentBright" | "text" | "inactive" | "secondary" | "subtle" | "replyPrefix" | "warning" | "special" | "suggestion" | "permission" | "codeText" | "diffAdd" | "diffRemove" | "diffAddBg" | "diffRemoveBg" | "panelBorder" | "overlayBg" | "tagBg" | "toolText" | "focusBorder" | "selection" | undefined;
1905
- codeFence?: "success" | "error" | "accent" | "brand" | "brandShimmer" | "accentDim" | "accentBright" | "text" | "inactive" | "secondary" | "subtle" | "replyPrefix" | "warning" | "special" | "suggestion" | "permission" | "codeText" | "diffAdd" | "diffRemove" | "diffAddBg" | "diffRemoveBg" | "panelBorder" | "overlayBg" | "tagBg" | "toolText" | "focusBorder" | "selection" | undefined;
1906
- tableHeader?: "success" | "error" | "accent" | "brand" | "brandShimmer" | "accentDim" | "accentBright" | "text" | "inactive" | "secondary" | "subtle" | "replyPrefix" | "warning" | "special" | "suggestion" | "permission" | "codeText" | "diffAdd" | "diffRemove" | "diffAddBg" | "diffRemoveBg" | "panelBorder" | "overlayBg" | "tagBg" | "toolText" | "focusBorder" | "selection" | undefined;
1907
- tableDivider?: "success" | "error" | "accent" | "brand" | "brandShimmer" | "accentDim" | "accentBright" | "text" | "inactive" | "secondary" | "subtle" | "replyPrefix" | "warning" | "special" | "suggestion" | "permission" | "codeText" | "diffAdd" | "diffRemove" | "diffAddBg" | "diffRemoveBg" | "panelBorder" | "overlayBg" | "tagBg" | "toolText" | "focusBorder" | "selection" | undefined;
1911
+ heading1?: "success" | "error" | "accent" | "text" | "brand" | "brandShimmer" | "accentDim" | "accentBright" | "inactive" | "secondary" | "subtle" | "replyPrefix" | "warning" | "special" | "suggestion" | "permission" | "codeText" | "diffAdd" | "diffRemove" | "diffAddBg" | "diffRemoveBg" | "panelBorder" | "overlayBg" | "tagBg" | "toolText" | "focusBorder" | "selection" | undefined;
1912
+ heading2?: "success" | "error" | "accent" | "text" | "brand" | "brandShimmer" | "accentDim" | "accentBright" | "inactive" | "secondary" | "subtle" | "replyPrefix" | "warning" | "special" | "suggestion" | "permission" | "codeText" | "diffAdd" | "diffRemove" | "diffAddBg" | "diffRemoveBg" | "panelBorder" | "overlayBg" | "tagBg" | "toolText" | "focusBorder" | "selection" | undefined;
1913
+ headingWeak?: "success" | "error" | "accent" | "text" | "brand" | "brandShimmer" | "accentDim" | "accentBright" | "inactive" | "secondary" | "subtle" | "replyPrefix" | "warning" | "special" | "suggestion" | "permission" | "codeText" | "diffAdd" | "diffRemove" | "diffAddBg" | "diffRemoveBg" | "panelBorder" | "overlayBg" | "tagBg" | "toolText" | "focusBorder" | "selection" | undefined;
1914
+ listMarker?: "success" | "error" | "accent" | "text" | "brand" | "brandShimmer" | "accentDim" | "accentBright" | "inactive" | "secondary" | "subtle" | "replyPrefix" | "warning" | "special" | "suggestion" | "permission" | "codeText" | "diffAdd" | "diffRemove" | "diffAddBg" | "diffRemoveBg" | "panelBorder" | "overlayBg" | "tagBg" | "toolText" | "focusBorder" | "selection" | undefined;
1915
+ listMarkerMuted?: "success" | "error" | "accent" | "text" | "brand" | "brandShimmer" | "accentDim" | "accentBright" | "inactive" | "secondary" | "subtle" | "replyPrefix" | "warning" | "special" | "suggestion" | "permission" | "codeText" | "diffAdd" | "diffRemove" | "diffAddBg" | "diffRemoveBg" | "panelBorder" | "overlayBg" | "tagBg" | "toolText" | "focusBorder" | "selection" | undefined;
1916
+ quoteBar?: "success" | "error" | "accent" | "text" | "brand" | "brandShimmer" | "accentDim" | "accentBright" | "inactive" | "secondary" | "subtle" | "replyPrefix" | "warning" | "special" | "suggestion" | "permission" | "codeText" | "diffAdd" | "diffRemove" | "diffAddBg" | "diffRemoveBg" | "panelBorder" | "overlayBg" | "tagBg" | "toolText" | "focusBorder" | "selection" | undefined;
1917
+ quoteText?: "success" | "error" | "accent" | "text" | "brand" | "brandShimmer" | "accentDim" | "accentBright" | "inactive" | "secondary" | "subtle" | "replyPrefix" | "warning" | "special" | "suggestion" | "permission" | "codeText" | "diffAdd" | "diffRemove" | "diffAddBg" | "diffRemoveBg" | "panelBorder" | "overlayBg" | "tagBg" | "toolText" | "focusBorder" | "selection" | undefined;
1918
+ link?: "success" | "error" | "accent" | "text" | "brand" | "brandShimmer" | "accentDim" | "accentBright" | "inactive" | "secondary" | "subtle" | "replyPrefix" | "warning" | "special" | "suggestion" | "permission" | "codeText" | "diffAdd" | "diffRemove" | "diffAddBg" | "diffRemoveBg" | "panelBorder" | "overlayBg" | "tagBg" | "toolText" | "focusBorder" | "selection" | undefined;
1919
+ inlineCode?: "success" | "error" | "accent" | "text" | "brand" | "brandShimmer" | "accentDim" | "accentBright" | "inactive" | "secondary" | "subtle" | "replyPrefix" | "warning" | "special" | "suggestion" | "permission" | "codeText" | "diffAdd" | "diffRemove" | "diffAddBg" | "diffRemoveBg" | "panelBorder" | "overlayBg" | "tagBg" | "toolText" | "focusBorder" | "selection" | undefined;
1920
+ codeFence?: "success" | "error" | "accent" | "text" | "brand" | "brandShimmer" | "accentDim" | "accentBright" | "inactive" | "secondary" | "subtle" | "replyPrefix" | "warning" | "special" | "suggestion" | "permission" | "codeText" | "diffAdd" | "diffRemove" | "diffAddBg" | "diffRemoveBg" | "panelBorder" | "overlayBg" | "tagBg" | "toolText" | "focusBorder" | "selection" | undefined;
1921
+ tableHeader?: "success" | "error" | "accent" | "text" | "brand" | "brandShimmer" | "accentDim" | "accentBright" | "inactive" | "secondary" | "subtle" | "replyPrefix" | "warning" | "special" | "suggestion" | "permission" | "codeText" | "diffAdd" | "diffRemove" | "diffAddBg" | "diffRemoveBg" | "panelBorder" | "overlayBg" | "tagBg" | "toolText" | "focusBorder" | "selection" | undefined;
1922
+ tableDivider?: "success" | "error" | "accent" | "text" | "brand" | "brandShimmer" | "accentDim" | "accentBright" | "inactive" | "secondary" | "subtle" | "replyPrefix" | "warning" | "special" | "suggestion" | "permission" | "codeText" | "diffAdd" | "diffRemove" | "diffAddBg" | "diffRemoveBg" | "panelBorder" | "overlayBg" | "tagBg" | "toolText" | "focusBorder" | "selection" | undefined;
1908
1923
  listIndent?: 2 | 3 | undefined;
1909
1924
  listMarkers?: [string, string, string, string] | undefined;
1910
1925
  codeBlockDivider?: "none" | "hr" | undefined;
@@ -1980,6 +1995,7 @@ declare const manifestSchema: z.ZodObject<{
1980
1995
  } | undefined;
1981
1996
  strengths?: ("planning" | "knowledge" | "coding" | "reasoning" | "vision" | "speed" | "long-context")[] | undefined;
1982
1997
  reasoning?: boolean | undefined;
1998
+ input?: ("text" | "image")[] | undefined;
1983
1999
  thinkingLevels?: ("low" | "medium" | "high" | "xhigh" | "max")[] | undefined;
1984
2000
  thinkingMode?: "enabled" | "adaptive" | undefined;
1985
2001
  }[] | undefined;
@@ -2312,7 +2328,16 @@ interface ToolUseContext {
2312
2328
  toolName: string;
2313
2329
  input: unknown;
2314
2330
  }
2315
- /** PreToolUse 决策(拦截器返回)。`allow` 放行;`deny` 拒绝;`ask` 转人工确认。 */
2331
+ /**
2332
+ * PreToolUse 决策(拦截器返回)。`deny` 拒绝;`ask` 转人工确认。
2333
+ *
2334
+ * ⚠ `allow` 变体是**兼容残留**(RFC-082 时代遗留):运行时恒为 no-op——
2335
+ * `module-wiring.ts` 的 preToolUse 映射是 safe-by-construction(allow→no-op,
2336
+ * 永不授权)。插件作者**不应**返回 allow(没有任何语义效果,deny/ask 之外的
2337
+ * 返回值等价于放行到既有 hook 链判定)。其存在只为了避免存量插件类型迁移破坏,
2338
+ * 新增代码请勿依赖它——capabilities.ts 的 `hooks: false`(非高危)前提之一
2339
+ * 正是「allow 恒 no-op」(架构 review 2026-08-12 S5)。
2340
+ */
2316
2341
  type PreToolUseDecision = {
2317
2342
  decision: 'allow';
2318
2343
  } | {
@@ -2584,10 +2609,21 @@ type MonitorEvent = {
2584
2609
  input: number;
2585
2610
  output: number;
2586
2611
  };
2587
- } | {
2612
+ }
2613
+ /**
2614
+ * 压缩发生。`tokensSaved` **可选**——引擎侧 `compaction.after` 当前只携带
2615
+ * `retainedCount`(裁剪后保留的消息数),没有"裁剪前后 token 差值"这个量纲
2616
+ * (见 `@x-otto/hook-contracts` 的 `HookPayloadMap['compaction.after']`)。
2617
+ *
2618
+ * 为什么是可选而不是填 0:`0` 是一个**合法取值**("确实没省下 token"),用它冒充
2619
+ * "未知"会让任何基于该字段的统计静默得到错误结果,且插件作者无从分辨。`undefined`
2620
+ * 在类型层就强制消费方处理"拿不到这个量"的情况,这是诚实降级的正确形态。
2621
+ * 若未来 `compaction.after` 补充 token 维度数据,此处透传真实值即可,契约无需再改。
2622
+ */
2623
+ | {
2588
2624
  type: 'compaction.occurred';
2589
2625
  sessionId: string;
2590
- tokensSaved: number;
2626
+ tokensSaved?: number;
2591
2627
  } | {
2592
2628
  type: 'error';
2593
2629
  sessionId: string;
@@ -3109,7 +3145,15 @@ declare function createFileProvider(opts: FileProviderOptions): SigilProvider;
3109
3145
  declare function isPathTrusted(storePath: string, key: string): boolean;
3110
3146
  /** 加入白名单(幂等)。返回是否发生变更(供调用方决定是否记日志)。 */
3111
3147
  declare function trustPath(storePath: string, key: string, label: string): boolean;
3112
- /** 移出白名单。返回是否发生变更。同时清除该 key 的已授予能力集(撤信任=能力清零,无残留特权)。 */
3148
+ /**
3149
+ * 移出白名单。返回是否发生变更。同时清除该 key 的已授予能力集
3150
+ * (撤信任=能力清零,无残留特权)。
3151
+ *
3152
+ * **RFC-354 P1-1**:本函数是唯一走 `requireLock` 的路径——撤销丢失是 fail-open
3153
+ * (用户以为收回权限、实际没有),故锁拿不到时**抛错而非无锁硬写**。
3154
+ * 同理 `writeStore` 落盘失败也会抛出(P5-2):撤销必须失败可见,不允许虚假确认。
3155
+ * 调用方(`extension-plugin.ts` / `misc.ts` 的撤销入口)应捕获并如实告知用户。
3156
+ */
3113
3157
  declare function untrustPath(storePath: string, key: string, label: string): boolean;
3114
3158
  //#endregion
3115
3159
  //#region src/plugin-trust.d.ts
@@ -3141,6 +3185,8 @@ interface PluginExecutableSurface {
3141
3185
  commands: boolean;
3142
3186
  scripts: boolean;
3143
3187
  panels: boolean;
3188
+ /** 插件代码入口存在(`plugin.ts`/`plugin.tsx`,与 module-loader 的 PLUGIN_ENTRY_CANDIDATES 同源)。 */
3189
+ pluginEntry: boolean;
3144
3190
  skills: boolean;
3145
3191
  agents: boolean;
3146
3192
  cli: boolean;
package/dist/index.js CHANGED
@@ -1,3 +1,3 @@
1
- import{z as e}from"zod";import{TypedEventEmitter as t,acquireFileLockSync as n,createLogger as r,releaseFileLockSync as i,waitForFileLockReleaseSync as a}from"@x-otto/shared";import{closeSync as o,existsSync as s,fsyncSync as c,mkdirSync as l,openSync as u,readFileSync as d,readSync as f,readdirSync as p,renameSync as ee,statSync as te,unlinkSync as ne,writeFileSync as re}from"node:fs";import{basename as m,dirname as ie,join as h,relative as ae,resolve as g}from"node:path";import{OTTO_HOME as _,findWorkspaceRoot as oe,isShadowModeEnabled as se,resolveConfigLayers as ce}from"@x-otto/env";import{satisfies as le,validRange as ue}from"semver";import{homedir as v}from"node:os";import{sigilOf as y}from"@x-otto/interchange";import{readdir as de}from"node:fs/promises";import{randomUUID as fe}from"node:crypto";const pe=[`provider`,`tools`,`hooks`,`tui.renderer`,`network`,`context`,`monitor`,`wire-protocol`,`a2ui.component`,`panel.backend`,`mcp.server`,`feedback`,`input.resolver`,`a2ui.renderer`,`theme`,`agent.dispatch`,`service`,`storage`,`session.read`,`llm.complete`,`user.notify`,`user.ask`],b={provider:!0,tools:!0,hooks:!1,"tui.renderer":!0,network:!0,context:!1,monitor:!1,"wire-protocol":!0,"a2ui.component":!0,"panel.backend":!0,"mcp.server":!0,feedback:!1,"input.resolver":!0,"a2ui.renderer":!0,theme:!1,"agent.dispatch":!0,service:!0,storage:!1,"session.read":!0,"llm.complete":!0,"user.notify":!1,"user.ask":!0},x=Object.freeze(Object.keys(b).filter(e=>b[e])),S=r(`@x-otto/coding:plugin-manifest`),C=`otto-plugin.json`,w=/^[a-z0-9]+(?:-[a-z0-9]+)*$/,T=e=>e.optional().catch(void 0),E=e.string().refine(e=>e.trim().length>0,`must be non-empty`),me=e.object({id:E,title:E,entry:E.refine(e=>!e.startsWith(`/`)&&!e.split(/[\\/]/).includes(`..`),`unsafe path (absolute or traversal)`),export:T(E)}),he=e.object({role:T(E),toolName:T(E),contentType:T(E)}).refine(e=>e.role!=null||e.toolName!=null||e.contentType!=null,{message:`matcher must declare at least one of role/toolName/contentType`}),ge=e.object({id:E,matcher:he,entry:E.refine(e=>!e.startsWith(`/`)&&!e.split(/[\\/]/).includes(`..`),`unsafe path (absolute or traversal)`),export:T(E)}),_e=e.object({id:E,matcher:he,entry:E.refine(e=>!e.startsWith(`/`)&&!e.split(/[\\/]/).includes(`..`),`unsafe path (absolute or traversal)`),export:T(E)}),ve=e.object({extensions:T(e.array(E)),filenames:T(e.array(E)),glob:T(e.array(E))}).refine(e=>(e.extensions?.length??0)+(e.filenames?.length??0)+(e.glob?.length??0)>0,{message:`matcher must declare at least one of extensions/filenames/glob`}),ye=D(e.object({id:E,label:E,matcher:ve,entry:E.refine(e=>!e.startsWith(`/`)&&!e.split(/[\\/]/).includes(`..`),`unsafe path (absolute or traversal)`),export:T(E),order:T(e.number())}),`fileViewers`),be=D(e.object({type:E,entry:E.refine(e=>!e.startsWith(`/`)&&!e.split(/[\\/]/).includes(`..`),`unsafe path (absolute or traversal)`),export:T(E)}),`a2uiComponents`),xe=D(e.object({id:E,entry:E.refine(e=>!e.startsWith(`/`)&&!e.split(/[\\/]/).includes(`..`),`unsafe path (absolute or traversal)`),export:T(E),order:T(e.number()),tickMs:T(e.number())}),`statusWidgets`),Se=D(ge,`renderers`),Ce=D(me,`panels`),we=e.discriminatedUnion(`type`,[e.object({type:e.literal(`builtin`),id:E}),e.object({type:e.literal(`mcp`),server:E,tool:E,params:T(e.record(e.string(),e.unknown()))}),e.object({type:e.literal(`open`),target:E}),e.object({type:e.literal(`command`),name:E,args:T(E)}),e.object({type:e.literal(`script`),name:E})]),Te=e.object({id:E,title:E,command:we,color:T(e.enum([`accent`,`amber`,`red`,`green`,`gray`]))}),Ee=e.object({action:E,point:E,when:T(E),order:T(e.number())}),De=e.object({key:E,groups:e.array(e.array(E)),map:e.object({none:E,partial:E,all:E})});function D(t,n){return e.array(e.unknown()).transform(e=>{let r=e.map(e=>t.safeParse(e)),i=r.filter(e=>e.success).map(e=>e.data),a=r.length-i.length;if(a>0&&n){let e=r.filter(e=>!e.success).map(e=>e.success?``:e.error.issues.map(e=>e.message).join(`; `));S.warn({label:n,dropped:a,total:r.length,issues:e},`contributes.${n}: ${a}/${r.length} 条 entry 校验失败,已静默丢弃(fail-soft)`)}return i.length>0?i:void 0})}const Oe=e.object({input:e.number().min(0),output:e.number().min(0),cacheRead:e.number().min(0),cacheWrite:e.number().min(0)}),ke=e.object({maxImagesPerRequest:e.number().int().positive(),maxDimensionPxIfOverLimit:T(e.number().int().positive())}),Ae=e.enum([`planning`,`knowledge`,`coding`,`reasoning`,`vision`,`speed`,`long-context`]),je=e.enum([`low`,`medium`,`high`,`xhigh`,`max`]),Me=e.enum([`enabled`,`adaptive`]),Ne=e.object({id:E,contextWindow:e.number().int().positive(),maxOutput:e.number().int().positive(),cost:T(Oe),strengths:T(e.array(Ae).min(1)),reasoning:T(e.boolean()),thinkingLevels:T(e.array(je).min(1)),thinkingMode:T(Me)}),Pe=e.enum([`openai-completions`,`openai-responses`,`anthropic-messages`]),Fe=e.object({label:E,value:E.refine(e=>!e.startsWith(`!`)&&!e.startsWith(`#`),`value must not start with '!' or '#' (mode-prefix collision)`),kind:e.enum([`resource`,`hashtag`]),description:T(E),resolverId:T(E)}),Ie=e.object({id:E,dataSource:e.object({contextKey:E}),point:T(E),when:T(E),order:T(e.number())}),Le=e.union([E,e.object({file:E.refine(e=>!e.startsWith(`/`)&&!e.split(/[\\/]/).includes(`..`),`unsafe path (absolute or traversal)`)})]),Re=e.object({id:E,priority:T(e.number()),content:Le}),ze=e.object({id:E,translations:e.record(e.string(),e.string())}),Be=/[\u0000-\u0008\u000b\u000c\u000e-\u001f\u007f]/,O=e=>!Be.test(e),Ve=/^#(?:[0-9a-fA-F]{3}|[0-9a-fA-F]{6})$/,k=t=>e.string().max(16).refine(e=>Ve.test(e),`${t} must be a #RRGGBB or #RGB hex color`),He=e.object({brand:k(`brand`),brandShimmer:k(`brandShimmer`),accent:k(`accent`),accentDim:k(`accentDim`),accentBright:k(`accentBright`),text:T(k(`text`)),inactive:k(`inactive`),secondary:k(`secondary`),subtle:k(`subtle`),replyPrefix:k(`replyPrefix`),success:k(`success`),error:k(`error`),warning:k(`warning`),special:k(`special`),suggestion:k(`suggestion`),permission:k(`permission`),codeText:k(`codeText`),diffAdd:k(`diffAdd`),diffRemove:k(`diffRemove`),diffAddBg:k(`diffAddBg`),diffRemoveBg:k(`diffRemoveBg`),panelBorder:k(`panelBorder`),overlayBg:k(`overlayBg`),tagBg:k(`tagBg`),toolText:k(`toolText`),focusBorder:k(`focusBorder`),selection:k(`selection`)}),A=e.enum(`brand.brandShimmer.accent.accentDim.accentBright.text.inactive.secondary.subtle.replyPrefix.success.error.warning.special.suggestion.permission.codeText.diffAdd.diffRemove.diffAddBg.diffRemoveBg.panelBorder.overlayBg.tagBg.toolText.focusBorder.selection`.split(`.`)),Ue=e.strictObject({heading1:T(A),heading2:T(A),headingWeak:T(A),listMarker:T(A),listMarkerMuted:T(A),quoteBar:T(A),quoteText:T(A),link:T(A),inlineCode:T(A),codeFence:T(A),tableHeader:T(A),tableDivider:T(A),listIndent:T(e.union([e.literal(2),e.literal(3)])),listMarkers:T(e.tuple([e.string().min(1).max(4),e.string().min(1).max(4),e.string().min(1).max(4),e.string().min(1).max(4)])),codeBlockDivider:T(e.enum([`hr`,`none`]))}),We=e.object({localId:E.max(64).refine(e=>w.test(e),`localId must be kebab-case`),label:E.max(64).refine(O,`label must not contain control characters`),appearance:e.enum([`dark`,`light`]),colors:He,markdown:T(Ue),meta:T(e.object({author:T(E.max(128).refine(O,`author must not contain control characters`)),description:T(E.max(256).refine(O,`description must not contain control characters`)),version:T(E.max(32).refine(O,`version must not contain control characters`))}))}),Ge=10,Ke=500,qe=2*1024,Je=20,Ye=64*1024,Xe=e.object({id:E,label:E,toolRef:E}),Ze=e.object({header:E.refine(e=>/^[a-zA-Z0-9][a-zA-Z0-9\-_]*$/.test(e),`header name must be alphanumeric with hyphens/underscores only`),source:e.object({kind:e.literal(`jwt-claim`),claim:E,namespace:T(E),tokenSources:T(e.array(e.enum([`id_token`,`access_token`])))})}),Qe=e.object({imageConstraints:T(ke),supportsTools:T(e.boolean())}),j=e.object({url:E,responseFormat:e.literal(`openai-list`),authScheme:T(e.enum([`bearer`,`x-api-key`,`auto`])),betaHeaderName:T(E),modelIdExclude:T(D(e.string(),`modelIdExclude`))}),M=e.object({store:T(e.boolean()),sendMaxOutputTokens:T(e.boolean())}),$e=e.object({id:E,name:T(E),catalogOnly:T(e.boolean()),baseUrl:T(E),wireApi:T(Pe),envKey:T(E),oauthRef:T(E),headers:T(e.record(e.string(),e.string())),models:T(D(Ne,`models`)),tokenDerivedHeaders:T(D(Ze,`tokenDerivedHeaders`)),modelsEndpoint:T(j),responseBodyPolicy:T(M),allowAuthHeaderOverride:T(e.boolean()),preserveProviderId:T(e.boolean())}).extend(Qe.shape).superRefine((t,n)=>{if(t.catalogOnly===!0){t.wireApi&&n.addIssue({code:e.ZodIssueCode.custom,message:`catalogOnly entries must not declare wireApi; use providerFactories for custom protocols`,path:[`wireApi`]}),t.baseUrl&&n.addIssue({code:e.ZodIssueCode.custom,message:`catalogOnly entries must not declare baseUrl; use providerFactories for custom protocols`,path:[`baseUrl`]});return}t.baseUrl||n.addIssue({code:e.ZodIssueCode.custom,message:`baseUrl is required unless catalogOnly is true`,path:[`baseUrl`]}),t.wireApi||n.addIssue({code:e.ZodIssueCode.custom,message:`wireApi is required unless catalogOnly is true`,path:[`wireApi`]})}),et=e.object({name:E.refine(e=>/^[a-z][a-z0-9-]*$/.test(e),`must be lowercase kebab-case`),bin:T(E)}),tt=e.discriminatedUnion(`kind`,[e.object({kind:e.literal(`pkce`),id:E,name:T(E),clientId:E,authorizeUrl:E,tokenUrl:E,redirectUri:E,scope:E,loopbackPorts:T(e.array(e.number().int().positive())),assumesLoopbackAlways:T(e.boolean()),extraAuthParams:T(e.record(e.string(),e.string())),tokenExchangeEncoding:T(e.enum([`json`,`form`])),subscriptionScoped:T(e.boolean()),oauthBeta:T(E)}),e.object({kind:e.literal(`device-flow`),id:E,name:T(E),clientId:E,deviceCodeUrlTemplate:E,tokenUrlTemplate:E,refreshUrlTemplate:T(E),scope:E,allowCustomDomain:T(e.boolean()),userAgent:T(E)})]),nt=e.object({skills:T(e.boolean()),agents:T(e.boolean()),commands:T(e.boolean()),mcp:T(e.boolean()),cli:T(et),panels:T(Ce),actions:T(D(Te,`actions`)),menus:T(D(Ee,`menus`)),contextKeys:T(D(De,`contextKeys`)),providers:T(D($e,`providers`)),oauth:T(D(tt,`oauth`)),statusItems:T(D(Ie,`statusItems`)),perfMetrics:T(D(Xe,`perfMetrics`)),renderers:T(Se),fileViewers:T(ye),statusWidgets:T(xe),a2uiComponents:T(be),contextSources:T(D(Re,`contextSources`)),i18n:T(D(ze,`i18n`)),themePresets:T(D(We,`themePresets`)),i18nDir:T(E.refine(e=>!e.startsWith(`/`)&&!e.split(/[\\/]/).includes(`..`),`unsafe path (absolute or traversal)`)),inputEntries:T(E),sigilEntries:T(D(Fe,`sigilEntries`)),a2uiRenderers:T(D(_e,`a2uiRenderers`))}),rt=e.enum(pe),it=e.array(e.unknown()).transform(e=>{let t=e.map(e=>rt.safeParse(e)).filter(e=>e.success).map(e=>e.data);return t.length>0?[...new Set(t)]:void 0}),at=/^(onStartup|onCommand:[^\s]+|onView:[^\s]+|onProvider:[^\s]+)$/,ot=e.array(e.unknown()).transform(e=>{let t=e.filter(e=>typeof e==`string`&&at.test(e));return t.length>0?[...new Set(t)]:void 0}),st=e.array(e.unknown()).transform(e=>{let t=e.filter(e=>typeof e==`string`&&w.test(e));return t.length>0?[...new Set(t)]:void 0}),ct=e.array(e.unknown()).transform(e=>{let t=e.filter(e=>typeof e==`string`&&e.trim().length>0);return t.length>0?[...new Set(t)]:void 0}),lt=j.extend({headers:T(e.record(e.string(),e.string()))}),ut=e.record(e.string(),e.unknown()).transform(e=>{let t={};for(let[n,r]of Object.entries(e)){let e=lt.safeParse(r);e.success&&(t[n]=e.data)}return Object.keys(t).length>0?t:void 0}),dt=e.object({baseUrl:E,models:D(Ne,`codeProviderModels`),responseBodyPolicy:T(M)}).extend(Qe.shape),ft=e.record(e.string(),e.unknown()).transform(e=>{let t={};for(let[n,r]of Object.entries(e)){let e=dt.safeParse(r);e.success&&e.data.models&&e.data.models.length>0&&(t[n]=e.data)}return Object.keys(t).length>0?t:void 0}),pt=e.object({postinstall:T(E),setup:T(E)}).catchall(E),mt=e.object({otto:T(E)}),ht=e.object({id:e.string().regex(w),name:T(e.string()),version:T(e.string()),description:T(e.string()),engines:T(mt),contributes:T(nt),scripts:T(pt),capabilities:T(it),activationEvents:T(ot),dependsOn:T(st),codeProviderIds:T(ct),codeProviderModelsEndpoints:T(ut),codeProviderModels:T(ft)});function gt(e){return e.activationEvents?.length?e.activationEvents:[`onStartup`]}function N(e,t){let n;try{n=JSON.parse(e)}catch(e){return S.warn({sourcePath:t,err:String(e)},`plugin manifest invalid JSON, skipped`),null}let r=ht.safeParse(n);return r.success?r.data:(S.warn({sourcePath:t,issues:r.error.issues.map(e=>e.path.join(`.`)||`<root>`)},`plugin manifest missing/invalid "id" (kebab-case required) or not an object, skipped`),null)}const P=r(`@x-otto/coding:plugin-discovery`);function F(e){try{return te(e).isDirectory()}catch{return!1}}const _t=[{id:`otto-plugin-manager`,dir:`<builtin:otto-plugin-manager>`,scope:`builtin`,manifest:{id:`otto-plugin-manager`,name:`Plugin Manager`,description:`otto 插件生命周期管理(create/build/dev/install)—— 随 otto 内置分发,恒定信任、恒定启用。`,version:void 0,contributes:void 0,scripts:void 0,capabilities:void 0,activationEvents:void 0,dependsOn:void 0}},{id:`otto-tui`,dir:`<builtin:otto-tui>`,scope:`builtin`,manifest:{id:`otto-tui`,name:`TUI`,description:`otto 终端交互界面本体(渲染/输入/面板/状态栏)—— 随 otto 内置分发,恒定信任、恒定启用。`,version:void 0,contributes:void 0,scripts:void 0,capabilities:void 0,activationEvents:void 0,dependsOn:void 0}}];function vt(e){let{cwd:t,homedir:n}=e,r=e.disabled?new Set(e.disabled):null,i=ce({cwd:t,homedir:n,claudeCompat:!1,workspaceRoot:oe(t)}).filter(e=>e.kind===`otto`).map(e=>({dir:h(e.dir,`plugins`),scope:e.scope}));for(let t of e.bundledDirs??[])s(t)&&i.unshift({dir:t,scope:`bundled`});let a=new Map;for(let e of _t)a.set(e.id,e);for(let{dir:e,scope:t}of i){if(!s(e)||!F(e))continue;let n;try{n=p(e).sort()}catch(t){P.warn({root:e,err:String(t)},`failed to read plugins root, skipped`);continue}for(let i of n){let n=h(e,i);if(!F(n))continue;let o=h(n,C);if(!s(o))continue;let c;try{c=d(o,`utf-8`)}catch(e){P.warn({manifestPath:o,err:String(e)},`failed to read plugin manifest, skipped`);continue}let l=N(c,o);l&&(r?.has(l.id)||a.has(l.id)||a.set(l.id,{id:l.id,dir:n,manifest:l,scope:t}))}}return[...a.values()].sort((e,t)=>e.id.localeCompare(t.id))}function I(e){return e.manifest.dependsOn??[]}function yt(e){let t=new Map,n=new Map,r=e.filter(e=>e.scope===`builtin`),i=e.filter(e=>e.scope!==`builtin`),a=new Set(r.map(e=>e.id)),o=new Map;for(let e of i)o.set(e.id,e);let s=e=>o.has(e)||a.has(e),c=!0;for(;c;){c=!1;for(let e of o.values()){let t=I(e).filter(e=>!s(e));t.length>0&&(n.set(e.id,[...new Set(t)]),o.delete(e.id),c=!0)}}let l=new Map,u=new Map;for(let e of o.values()){let t=I(e).filter(e=>o.has(e));l.set(e.id,t.length);for(let n of t){let t=u.get(n);t?t.push(e.id):u.set(n,[e.id])}}let d=[...o.values()].filter(e=>l.get(e.id)===0).map(e=>e.id).sort((e,t)=>e.localeCompare(t)),f=[];for(;d.length>0;){let e=d.shift();f.push(e);let t=[];for(let n of u.get(e)??[]){let e=(l.get(n)??0)-1;l.set(n,e),e===0&&t.push(n)}t.length>0&&(d.push(...t),d.sort((e,t)=>e.localeCompare(t)))}let p=new Set(f);for(let e of o.values())p.has(e.id)||t.set(e.id,bt(e.id,o));return{ordered:[...r,...f.map(e=>o.get(e))],cyclic:t,missingDeps:n}}function bt(e,t){let n=[],r=new Set,i=e;for(;i&&!r.has(i);){n.push(i),r.add(i);let e=t.get(i);if(!e)break;i=I(e).filter(e=>t.has(e)).sort((e,t)=>e.localeCompare(t))[0]}return i===e&&n.push(e),n}const xt=1;function St(){return`1.0.0`}function L(e){if(e.scope===`builtin`)return!0;let t=e.manifest.engines?.otto;return t?ue(t)?le(St(),t):!1:!0}function Ct(e){let t=[],n=new Map;for(let r of e)L(r)?t.push(r):n.set(r.id,r.manifest.engines?.otto??`(invalid range)`);return{compatible:t,incompatible:n}}function wt(e,t,n){if(!e?.length)return t?[...t]:void 0;if(!t?.length)return[...e];if(!n)return[...e,...t];let r=new Map(t.map(e=>[n(e),e])),i=new Set,a=[];for(let t of e){let e=n(t);i.add(e),a.push(r.has(e)?r.get(e):t)}for(let e of t)i.has(n(e))||a.push(e);return a}const R={commands:e=>e.name,agents:e=>e.name,skills:e=>e.name,mcp:e=>e.name,panels:e=>e.id,actions:e=>e.id,menus:null,contextKeys:e=>e.key,statusItems:e=>e.id,renderers:e=>e.id,contextSources:e=>e.id,a2uiComponents:e=>e.type,statusWidgets:e=>e.id,fileViewers:e=>e.id};function Tt(...e){let t=e.filter(e=>e!=null);return t.length===0?{}:t.reduce((e,t)=>{let n={};for(let r of Object.keys(R)){let i=R[r],a=wt(e[r],t[r],i);a&&(n[r]=a)}return n},{})}const z={extensionDetailActions:`extension/detail/actions`},B={statuslineItem:`shell/statusline/item`,menuItem:`shell/menu/item`},Et={...z,...B};function V(e,t){if(!e)return!0;let n=e.indexOf(`:`);if(n===-1){let n=t[e];return n===!0||typeof n==`string`&&n.length>0}let r=e.slice(0,n),i=e.slice(n+1),a=t[r];return a!=null&&String(a)===i}function Dt(e,t,n,r){let i=new Map((n??[]).map(e=>[e.id,e]));return(t??[]).filter(t=>t.point===e&&V(t.when,r)).map(e=>({menu:e,action:i.get(e.action)})).filter(e=>e.action!=null).sort((e,t)=>(e.menu.order??0)-(t.menu.order??0)).map(({action:e})=>({id:e.id,title:e.title,color:e.color,command:e.command}))}function H(e){let t=e.replace(/\$\{OTTO_HOME\}/g,_);return t===`~`?v():t.startsWith(`~/`)?v()+t.slice(1):t}function U(e,t=s){let n=e.groups.length;if(n===0)return e.map.none;let r=e.groups.filter(e=>e.some(e=>t(H(e)))).length;return r===0?e.map.none:r===n?e.map.all:e.map.partial}function Ot(e,t){let n={};for(let r of e??[])n[r.key]=U(r,t);return n}var W=class extends Error{constructor(e){super(`dispatch: 缺少 capability「${e}」——宿主未注入`),this.name=`MissingCapabilityError`}};async function kt(e,t){switch(e.type){case`builtin`:if(!t.builtin)throw new W(`builtin`);await t.builtin(e.id);return;case`mcp`:if(!t.callMcp)throw new W(`mcp`);await t.callMcp(e.server,e.tool,e.params);return;case`open`:if(!t.open)throw new W(`open`);await t.open(e.target);return;case`command`:if(!t.runCommand)throw new W(`command`);await t.runCommand(e.name,e.args);return;case`script`:if(!t.runScript)throw new W(`script`);await t.runScript(e.name);return;default:throw new W(e.type)}}function At(e){return e}function G(e){return`${e.kind}\u0000${e.label}`}function jt(e,t){if(t===``)return 0;let n=e.label.toLowerCase();return n.startsWith(t)?2:e.description&&e.description.toLowerCase().includes(t)?1:n.includes(t)?0:-1}function Mt(e){return e.startsWith(`!`)||e.startsWith(`#`)}function Nt(){let e=new Map,t=new Map;function n(t){for(let n of t){if(Mt(n.value))throw Error(`[plugin-input] sigil value 不得以 '!' 或 '#' 开头(会被误判为 bash/memory 模式):${JSON.stringify(n.value)}`);let t=G(n);e.delete(t),e.set(t,n)}}function r(t){let n=[...e.values()];return t?n.filter(e=>y(e.kind)===t):n}function i(t,n,r=50){let i=t.toLowerCase(),a=[],o=0;for(let t of e.values()){let e=o++;if(n&&y(t.kind)!==n)continue;let r=jt(t,i);r<0||a.push({entry:t,score:r,order:e})}return a.sort((e,t)=>t.score-e.score||e.order-t.order),a.length<=r?a.map(e=>e.entry):a.slice(0,r).map(e=>e.entry)}function a(e,n){let r=t.get(e);return r||(r=new Set,t.set(e,r)),r.add(n),()=>{r?.delete(n)}}async function o(e,n,r=50){let a=i(e,n,r),o=n?t.get(n):void 0;if(!o||o.size===0)return a;let s=[],c=await Promise.allSettled([...o].map(t=>Promise.resolve().then(()=>t(e,n))));for(let e of c)e.status===`fulfilled`&&s.push(...e.value.filter(e=>!Mt(e.value)));let l=new Set(a.map(e=>G(e))),u=[...a];for(let e of s){let t=G(e);l.has(t)||(l.add(t),u.push(e))}return u.length<=r?u:u.slice(0,r)}function s(t){for(let n of e.values())if(n.label===t)return n}function c(t){let n=!1;for(let[r,i]of e)i.label===t&&(e.delete(r),n=!0);return n}function l(t){for(let[n,r]of e)r.source===t&&e.delete(n)}return{register:n,registerProvider:a,search:i,searchAsync:o,getAll:r,findByLabel:s,unregister:c,unregisterBySource:l}}function Pt(){return[{label:`Code Review`,description:`请求代码审查`,value:`Please review the following code for correctness, style, security, and performance. Provide specific, actionable feedback.`,kind:`hashtag`,source:`builtin`},{label:`Write Tests`,description:`为代码编写单元测试`,value:`Please write comprehensive unit tests for the following code. Cover normal cases, edge cases, error cases, and ensure high coverage.`,kind:`hashtag`,source:`builtin`},{label:`Explain Code`,description:`解释代码逻辑`,value:`Please explain the following code in detail. Cover the overall architecture, key algorithms, data flow, and any notable design decisions.`,kind:`hashtag`,source:`builtin`}]}const Ft=r(`@x-otto/plugin:file-provider`),It=new Set([`node_modules`,`.git`,`dist`,`build`,`out`,`coverage`,`.next`,`.nuxt`,`.turbo`,`.nx`,`.cache`,`.otto`,`.venv`,`__pycache__`]);async function Lt(e,t,n){let r=[];async function i(a,o){if(r.length>=t)return;let s;try{s=await de(a,{withFileTypes:!0})}catch(e){o&&n?.(e);return}for(let n of s){if(r.length>=t)return;if(n.isDirectory()){if(It.has(n.name)||n.name.startsWith(`.`))continue;await i(h(a,n.name),!1)}else n.isFile()&&r.push(ae(e,h(a,n.name)))}}return await i(e,!0),r}function Rt(e,t){if(t===``)return 0;let n=e.toLowerCase();return m(n).startsWith(t)?3:n.startsWith(t)?2:n.includes(t)?1:-1}function zt(e,t,n,r){let i;try{i=u(h(e,t),`r`);let a=Buffer.allocUnsafe(8192),o=f(i,a,0,a.length,0),s=a.toString(`utf-8`,0,o).split(`
1
+ import{z as e}from"zod";import{TypedEventEmitter as t,acquireFileLockSync as n,createLogger as r,releaseFileLockSync as i,waitForFileLockReleaseSync as a}from"@x-otto/shared";import{closeSync as o,existsSync as s,fsyncSync as c,mkdirSync as l,openSync as u,readFileSync as d,readSync as f,readdirSync as p,renameSync as ee,statSync as te,unlinkSync as ne,writeFileSync as re}from"node:fs";import{basename as m,dirname as ie,join as h,relative as ae,resolve as g}from"node:path";import{OTTO_HOME as _,findWorkspaceRoot as oe,isShadowModeEnabled as se,resolveConfigLayers as ce}from"@x-otto/env";import{satisfies as le,validRange as ue}from"semver";import{homedir as v}from"node:os";import{sigilOf as y}from"@x-otto/interchange";import{readdir as de}from"node:fs/promises";import{randomUUID as fe}from"node:crypto";const pe=[`provider`,`tools`,`hooks`,`tui.renderer`,`network`,`context`,`monitor`,`wire-protocol`,`a2ui.component`,`panel.backend`,`mcp.server`,`feedback`,`input.resolver`,`a2ui.renderer`,`theme`,`agent.dispatch`,`service`,`storage`,`session.read`,`llm.complete`,`user.notify`,`user.ask`],b={provider:!0,tools:!0,hooks:!1,"tui.renderer":!0,network:!0,context:!1,monitor:!1,"wire-protocol":!0,"a2ui.component":!0,"panel.backend":!0,"mcp.server":!0,feedback:!1,"input.resolver":!0,"a2ui.renderer":!0,theme:!1,"agent.dispatch":!0,service:!0,storage:!1,"session.read":!0,"llm.complete":!0,"user.notify":!1,"user.ask":!0},x=Object.freeze(Object.keys(b).filter(e=>b[e])),S=r(`@x-otto/coding:plugin-manifest`),C=`otto-plugin.json`,w=/^[a-z0-9]+(?:-[a-z0-9]+)*$/,T=e=>e.optional().catch(void 0),E=e.string().refine(e=>e.trim().length>0,`must be non-empty`),me=e.object({id:E,title:E,entry:E.refine(e=>!e.startsWith(`/`)&&!e.split(/[\\/]/).includes(`..`),`unsafe path (absolute or traversal)`),export:T(E)}),he=e.object({role:T(E),toolName:T(E),contentType:T(E)}).refine(e=>e.role!=null||e.toolName!=null||e.contentType!=null,{message:`matcher must declare at least one of role/toolName/contentType`}),ge=e.object({id:E,matcher:he,entry:E.refine(e=>!e.startsWith(`/`)&&!e.split(/[\\/]/).includes(`..`),`unsafe path (absolute or traversal)`),export:T(E)}),_e=e.object({id:E,matcher:he,entry:E.refine(e=>!e.startsWith(`/`)&&!e.split(/[\\/]/).includes(`..`),`unsafe path (absolute or traversal)`),export:T(E)}),ve=e.object({extensions:T(e.array(E)),filenames:T(e.array(E)),glob:T(e.array(E))}).refine(e=>(e.extensions?.length??0)+(e.filenames?.length??0)+(e.glob?.length??0)>0,{message:`matcher must declare at least one of extensions/filenames/glob`}),ye=D(e.object({id:E,label:E,matcher:ve,entry:E.refine(e=>!e.startsWith(`/`)&&!e.split(/[\\/]/).includes(`..`),`unsafe path (absolute or traversal)`),export:T(E),order:T(e.number())}),`fileViewers`),be=D(e.object({type:E,entry:E.refine(e=>!e.startsWith(`/`)&&!e.split(/[\\/]/).includes(`..`),`unsafe path (absolute or traversal)`),export:T(E)}),`a2uiComponents`),xe=D(e.object({id:E,entry:E.refine(e=>!e.startsWith(`/`)&&!e.split(/[\\/]/).includes(`..`),`unsafe path (absolute or traversal)`),export:T(E),order:T(e.number()),tickMs:T(e.number())}),`statusWidgets`),Se=D(ge,`renderers`),Ce=D(me,`panels`),we=e.discriminatedUnion(`type`,[e.object({type:e.literal(`builtin`),id:E}),e.object({type:e.literal(`mcp`),server:E,tool:E,params:T(e.record(e.string(),e.unknown()))}),e.object({type:e.literal(`open`),target:E}),e.object({type:e.literal(`command`),name:E,args:T(E)}),e.object({type:e.literal(`script`),name:E})]),Te=e.object({id:E,title:E,command:we,color:T(e.enum([`accent`,`amber`,`red`,`green`,`gray`]))}),Ee=e.object({action:E,point:E,when:T(E),order:T(e.number())}),De=e.object({key:E,groups:e.array(e.array(E)),map:e.object({none:E,partial:E,all:E})});function D(t,n){return e.array(e.unknown()).transform(e=>{let r=e.map(e=>t.safeParse(e)),i=r.filter(e=>e.success).map(e=>e.data),a=r.length-i.length;if(a>0&&n){let e=r.filter(e=>!e.success).map(e=>e.success?``:e.error.issues.map(e=>e.message).join(`; `));S.warn({label:n,dropped:a,total:r.length,issues:e},`contributes.${n}: ${a}/${r.length} 条 entry 校验失败,已静默丢弃(fail-soft)`)}return i.length>0?i:void 0})}const Oe=e.object({input:e.number().min(0),output:e.number().min(0),cacheRead:e.number().min(0),cacheWrite:e.number().min(0)}),ke=e.object({maxImagesPerRequest:e.number().int().positive(),maxDimensionPxIfOverLimit:T(e.number().int().positive())}),Ae=e.enum([`planning`,`knowledge`,`coding`,`reasoning`,`vision`,`speed`,`long-context`]),je=e.enum([`low`,`medium`,`high`,`xhigh`,`max`]),Me=e.enum([`enabled`,`adaptive`]),Ne=e.object({id:E,contextWindow:e.number().int().positive(),maxOutput:e.number().int().positive(),cost:T(Oe),strengths:T(e.array(Ae).min(1)),reasoning:T(e.boolean()),input:T(e.array(e.enum([`text`,`image`])).min(1)),thinkingLevels:T(e.array(je).min(1)),thinkingMode:T(Me)}),Pe=e.enum([`openai-completions`,`openai-responses`,`anthropic-messages`]),Fe=e.object({label:E,value:E.refine(e=>!e.startsWith(`!`)&&!e.startsWith(`#`),`value must not start with '!' or '#' (mode-prefix collision)`),kind:e.enum([`resource`,`hashtag`]),description:T(E),resolverId:T(E)}),Ie=e.object({id:E,dataSource:e.object({contextKey:E}),point:T(E),when:T(E),order:T(e.number())}),Le=e.union([E,e.object({file:E.refine(e=>!e.startsWith(`/`)&&!e.split(/[\\/]/).includes(`..`),`unsafe path (absolute or traversal)`)})]),Re=e.object({id:E,priority:T(e.number()),content:Le}),ze=e.object({id:E,translations:e.record(e.string(),e.string())}),Be=/[\u0000-\u0008\u000b\u000c\u000e-\u001f\u007f]/,O=e=>!Be.test(e),Ve=/^#(?:[0-9a-fA-F]{3}|[0-9a-fA-F]{6})$/,k=t=>e.string().max(16).refine(e=>Ve.test(e),`${t} must be a #RRGGBB or #RGB hex color`),He=e.object({brand:k(`brand`),brandShimmer:k(`brandShimmer`),accent:k(`accent`),accentDim:k(`accentDim`),accentBright:k(`accentBright`),text:T(k(`text`)),inactive:k(`inactive`),secondary:k(`secondary`),subtle:k(`subtle`),replyPrefix:k(`replyPrefix`),success:k(`success`),error:k(`error`),warning:k(`warning`),special:k(`special`),suggestion:k(`suggestion`),permission:k(`permission`),codeText:k(`codeText`),diffAdd:k(`diffAdd`),diffRemove:k(`diffRemove`),diffAddBg:k(`diffAddBg`),diffRemoveBg:k(`diffRemoveBg`),panelBorder:k(`panelBorder`),overlayBg:k(`overlayBg`),tagBg:k(`tagBg`),toolText:k(`toolText`),focusBorder:k(`focusBorder`),selection:k(`selection`)}),A=e.enum(`brand.brandShimmer.accent.accentDim.accentBright.text.inactive.secondary.subtle.replyPrefix.success.error.warning.special.suggestion.permission.codeText.diffAdd.diffRemove.diffAddBg.diffRemoveBg.panelBorder.overlayBg.tagBg.toolText.focusBorder.selection`.split(`.`)),Ue=e.strictObject({heading1:T(A),heading2:T(A),headingWeak:T(A),listMarker:T(A),listMarkerMuted:T(A),quoteBar:T(A),quoteText:T(A),link:T(A),inlineCode:T(A),codeFence:T(A),tableHeader:T(A),tableDivider:T(A),listIndent:T(e.union([e.literal(2),e.literal(3)])),listMarkers:T(e.tuple([e.string().min(1).max(4),e.string().min(1).max(4),e.string().min(1).max(4),e.string().min(1).max(4)])),codeBlockDivider:T(e.enum([`hr`,`none`]))}),We=e.object({localId:E.max(64).refine(e=>w.test(e),`localId must be kebab-case`),label:E.max(64).refine(O,`label must not contain control characters`),appearance:e.enum([`dark`,`light`]),colors:He,markdown:T(Ue),meta:T(e.object({author:T(E.max(128).refine(O,`author must not contain control characters`)),description:T(E.max(256).refine(O,`description must not contain control characters`)),version:T(E.max(32).refine(O,`version must not contain control characters`))}))}),Ge=10,Ke=500,qe=2*1024,Je=20,Ye=64*1024,Xe=e.object({id:E,label:E,toolRef:E}),Ze=e.object({header:E.refine(e=>/^[a-zA-Z0-9][a-zA-Z0-9\-_]*$/.test(e),`header name must be alphanumeric with hyphens/underscores only`),source:e.object({kind:e.literal(`jwt-claim`),claim:E,namespace:T(E),tokenSources:T(e.array(e.enum([`id_token`,`access_token`])))})}),j=e.object({imageConstraints:T(ke),supportsTools:T(e.boolean())}),M=e.object({url:E,responseFormat:e.literal(`openai-list`),authScheme:T(e.enum([`bearer`,`x-api-key`,`auto`])),betaHeaderName:T(E),modelIdExclude:T(D(e.string(),`modelIdExclude`))}),N=e.object({store:T(e.boolean()),sendMaxOutputTokens:T(e.boolean())}),Qe=e.object({id:E,name:T(E),catalogOnly:T(e.boolean()),baseUrl:T(E),wireApi:T(Pe),envKey:T(E),oauthRef:T(E),headers:T(e.record(e.string(),e.string())),models:T(D(Ne,`models`)),tokenDerivedHeaders:T(D(Ze,`tokenDerivedHeaders`)),modelsEndpoint:T(M),responseBodyPolicy:T(N),allowAuthHeaderOverride:T(e.boolean()),preserveProviderId:T(e.boolean()),requiresIntranet:T(e.boolean())}).extend(j.shape).superRefine((t,n)=>{if(t.catalogOnly===!0){t.wireApi&&n.addIssue({code:e.ZodIssueCode.custom,message:`catalogOnly entries must not declare wireApi; use providerFactories for custom protocols`,path:[`wireApi`]}),t.baseUrl&&n.addIssue({code:e.ZodIssueCode.custom,message:`catalogOnly entries must not declare baseUrl; use providerFactories for custom protocols`,path:[`baseUrl`]});return}t.baseUrl||n.addIssue({code:e.ZodIssueCode.custom,message:`baseUrl is required unless catalogOnly is true`,path:[`baseUrl`]}),t.wireApi||n.addIssue({code:e.ZodIssueCode.custom,message:`wireApi is required unless catalogOnly is true`,path:[`wireApi`]})}),$e=e.object({name:E.refine(e=>/^[a-z][a-z0-9-]*$/.test(e),`must be lowercase kebab-case`),bin:T(E)}),et=e.discriminatedUnion(`kind`,[e.object({kind:e.literal(`pkce`),id:E,name:T(E),clientId:E,authorizeUrl:E,tokenUrl:E,redirectUri:E,scope:E,loopbackPorts:T(e.array(e.number().int().positive())),assumesLoopbackAlways:T(e.boolean()),extraAuthParams:T(e.record(e.string(),e.string())),tokenExchangeEncoding:T(e.enum([`json`,`form`])),subscriptionScoped:T(e.boolean()),oauthBeta:T(E)}),e.object({kind:e.literal(`device-flow`),id:E,name:T(E),clientId:E,deviceCodeUrlTemplate:E,tokenUrlTemplate:E,refreshUrlTemplate:T(E),scope:E,allowCustomDomain:T(e.boolean()),userAgent:T(E)})]),tt=e.object({skills:T(e.boolean()),agents:T(e.boolean()),commands:T(e.boolean()),mcp:T(e.boolean()),cli:T($e),panels:T(Ce),actions:T(D(Te,`actions`)),menus:T(D(Ee,`menus`)),contextKeys:T(D(De,`contextKeys`)),providers:T(D(Qe,`providers`)),oauth:T(D(et,`oauth`)),statusItems:T(D(Ie,`statusItems`)),perfMetrics:T(D(Xe,`perfMetrics`)),renderers:T(Se),fileViewers:T(ye),statusWidgets:T(xe),a2uiComponents:T(be),contextSources:T(D(Re,`contextSources`)),i18n:T(D(ze,`i18n`)),themePresets:T(D(We,`themePresets`)),i18nDir:T(E.refine(e=>!e.startsWith(`/`)&&!e.split(/[\\/]/).includes(`..`),`unsafe path (absolute or traversal)`)),inputEntries:T(E),sigilEntries:T(D(Fe,`sigilEntries`)),a2uiRenderers:T(D(_e,`a2uiRenderers`))}),nt=e.enum(pe),rt=e.array(e.unknown()).transform(e=>{let t=e.map(e=>nt.safeParse(e)).filter(e=>e.success).map(e=>e.data);return t.length>0?[...new Set(t)]:void 0}),it=/^(onStartup|onCommand:[^\s]+|onView:[^\s]+|onProvider:[^\s]+)$/,at=e.array(e.unknown()).transform(e=>{let t=e.filter(e=>typeof e==`string`&&it.test(e));return t.length>0?[...new Set(t)]:void 0}),ot=e.array(e.unknown()).transform(e=>{let t=e.filter(e=>typeof e==`string`&&w.test(e));return t.length>0?[...new Set(t)]:void 0}),st=e.array(e.unknown()).transform(e=>{let t=e.filter(e=>typeof e==`string`&&e.trim().length>0);return t.length>0?[...new Set(t)]:void 0}),ct=M.extend({headers:T(e.record(e.string(),e.string()))}),lt=e.record(e.string(),e.unknown()).transform(e=>{let t={};for(let[n,r]of Object.entries(e)){let e=ct.safeParse(r);e.success&&(t[n]=e.data)}return Object.keys(t).length>0?t:void 0}),ut=e.object({baseUrl:E,models:D(Ne,`codeProviderModels`),responseBodyPolicy:T(N)}).extend(j.shape),dt=e.record(e.string(),e.unknown()).transform(e=>{let t={};for(let[n,r]of Object.entries(e)){let e=ut.safeParse(r);e.success&&e.data.models&&e.data.models.length>0&&(t[n]=e.data)}return Object.keys(t).length>0?t:void 0}),ft=e.object({postinstall:T(E),setup:T(E)}).catchall(E),pt=e.object({otto:T(E)}),mt=e.object({id:e.string().regex(w),name:T(e.string()),version:T(e.string()),description:T(e.string()),engines:T(pt),contributes:T(tt),scripts:T(ft),capabilities:T(rt),activationEvents:T(at),dependsOn:T(ot),codeProviderIds:T(st),codeProviderModelsEndpoints:T(lt),codeProviderModels:T(dt)});function ht(e){return e.activationEvents?.length?e.activationEvents:[`onStartup`]}function P(e,t){let n;try{n=JSON.parse(e)}catch(e){return S.warn({sourcePath:t,err:String(e)},`plugin manifest invalid JSON, skipped`),null}let r=mt.safeParse(n);return r.success?r.data:(S.warn({sourcePath:t,issues:r.error.issues.map(e=>e.path.join(`.`)||`<root>`)},`plugin manifest missing/invalid "id" (kebab-case required) or not an object, skipped`),null)}const F=r(`@x-otto/coding:plugin-discovery`);function I(e){try{return te(e).isDirectory()}catch{return!1}}const gt=[{id:`otto-plugin-manager`,dir:`<builtin:otto-plugin-manager>`,scope:`builtin`,manifest:{id:`otto-plugin-manager`,name:`Plugin Manager`,description:`otto 插件生命周期管理(create/build/dev/install)—— 随 otto 内置分发,恒定信任、恒定启用。`,version:void 0,contributes:void 0,scripts:void 0,capabilities:void 0,activationEvents:void 0,dependsOn:void 0}},{id:`otto-tui`,dir:`<builtin:otto-tui>`,scope:`builtin`,manifest:{id:`otto-tui`,name:`TUI`,description:`otto 终端交互界面本体(渲染/输入/面板/状态栏)—— 随 otto 内置分发,恒定信任、恒定启用。`,version:void 0,contributes:void 0,scripts:void 0,capabilities:void 0,activationEvents:void 0,dependsOn:void 0}}];function _t(e){let{cwd:t,homedir:n}=e,r=e.disabled?new Set(e.disabled):null,i=ce({cwd:t,homedir:n,claudeCompat:!1,workspaceRoot:oe(t)}).filter(e=>e.kind===`otto`).map(e=>({dir:h(e.dir,`plugins`),scope:e.scope}));for(let t of e.bundledDirs??[])s(t)&&i.unshift({dir:t,scope:`bundled`});let a=new Map;for(let e of gt)a.set(e.id,e);for(let{dir:e,scope:t}of i){if(!s(e)||!I(e))continue;let n;try{n=p(e).sort()}catch(t){F.warn({root:e,err:String(t)},`failed to read plugins root, skipped`);continue}for(let i of n){let n=h(e,i);if(!I(n))continue;let o=h(n,C);if(!s(o))continue;let c;try{c=d(o,`utf-8`)}catch(e){F.warn({manifestPath:o,err:String(e)},`failed to read plugin manifest, skipped`);continue}let l=P(c,o);l&&(r?.has(l.id)||a.has(l.id)||a.set(l.id,{id:l.id,dir:n,manifest:l,scope:t}))}}return[...a.values()].sort((e,t)=>e.id.localeCompare(t.id))}function L(e){return e.manifest.dependsOn??[]}function vt(e){let t=new Map,n=new Map,r=e.filter(e=>e.scope===`builtin`),i=e.filter(e=>e.scope!==`builtin`),a=new Set(r.map(e=>e.id)),o=new Map;for(let e of i)o.set(e.id,e);let s=e=>o.has(e)||a.has(e),c=!0;for(;c;){c=!1;for(let e of o.values()){let t=L(e).filter(e=>!s(e));t.length>0&&(n.set(e.id,[...new Set(t)]),o.delete(e.id),c=!0)}}let l=new Map,u=new Map;for(let e of o.values()){let t=L(e).filter(e=>o.has(e));l.set(e.id,t.length);for(let n of t){let t=u.get(n);t?t.push(e.id):u.set(n,[e.id])}}let d=[...o.values()].filter(e=>l.get(e.id)===0).map(e=>e.id).sort((e,t)=>e.localeCompare(t)),f=[];for(;d.length>0;){let e=d.shift();f.push(e);let t=[];for(let n of u.get(e)??[]){let e=(l.get(n)??0)-1;l.set(n,e),e===0&&t.push(n)}t.length>0&&(d.push(...t),d.sort((e,t)=>e.localeCompare(t)))}let p=new Set(f);for(let e of o.values())p.has(e.id)||t.set(e.id,yt(e.id,o));return{ordered:[...r,...f.map(e=>o.get(e))],cyclic:t,missingDeps:n}}function yt(e,t){let n=[],r=new Set,i=e;for(;i&&!r.has(i);){n.push(i),r.add(i);let e=t.get(i);if(!e)break;i=L(e).filter(e=>t.has(e)).sort((e,t)=>e.localeCompare(t))[0]}return i===e&&n.push(e),n}const bt=1;function xt(){return`1.0.0`}function R(e){if(e.scope===`builtin`)return!0;let t=e.manifest.engines?.otto;return t?ue(t)?le(xt(),t):!1:!0}function St(e){let t=[],n=new Map;for(let r of e)R(r)?t.push(r):n.set(r.id,r.manifest.engines?.otto??`(invalid range)`);return{compatible:t,incompatible:n}}function Ct(e,t,n){if(!e?.length)return t?[...t]:void 0;if(!t?.length)return[...e];if(!n)return[...e,...t];let r=new Map(t.map(e=>[n(e),e])),i=new Set,a=[];for(let t of e){let e=n(t);i.add(e),a.push(r.has(e)?r.get(e):t)}for(let e of t)i.has(n(e))||a.push(e);return a}const z={commands:e=>e.name,agents:e=>e.name,skills:e=>e.name,mcp:e=>e.name,panels:e=>e.id,actions:e=>e.id,menus:null,contextKeys:e=>e.key,statusItems:e=>e.id,renderers:e=>e.id,contextSources:e=>e.id,a2uiComponents:e=>e.type,statusWidgets:e=>e.id,fileViewers:e=>e.id};function wt(...e){let t=e.filter(e=>e!=null);return t.length===0?{}:t.reduce((e,t)=>{let n={};for(let r of Object.keys(z)){let i=z[r],a=Ct(e[r],t[r],i);a&&(n[r]=a)}return n},{})}const B={extensionDetailActions:`extension/detail/actions`},V={statuslineItem:`shell/statusline/item`,menuItem:`shell/menu/item`},Tt={...B,...V};function H(e,t){if(!e)return!0;let n=e.indexOf(`:`);if(n===-1){let n=t[e];return n===!0||typeof n==`string`&&n.length>0}let r=e.slice(0,n),i=e.slice(n+1),a=t[r];return a!=null&&String(a)===i}function Et(e,t,n,r){let i=new Map((n??[]).map(e=>[e.id,e]));return(t??[]).filter(t=>t.point===e&&H(t.when,r)).map(e=>({menu:e,action:i.get(e.action)})).filter(e=>e.action!=null).sort((e,t)=>(e.menu.order??0)-(t.menu.order??0)).map(({action:e})=>({id:e.id,title:e.title,color:e.color,command:e.command}))}function U(e){let t=e.replace(/\$\{OTTO_HOME\}/g,_);return t===`~`?v():t.startsWith(`~/`)?v()+t.slice(1):t}function W(e,t=s){let n=e.groups.length;if(n===0)return e.map.none;let r=e.groups.filter(e=>e.some(e=>t(U(e)))).length;return r===0?e.map.none:r===n?e.map.all:e.map.partial}function Dt(e,t){let n={};for(let r of e??[])n[r.key]=W(r,t);return n}var G=class extends Error{constructor(e){super(`dispatch: 缺少 capability「${e}」——宿主未注入`),this.name=`MissingCapabilityError`}};async function Ot(e,t){switch(e.type){case`builtin`:if(!t.builtin)throw new G(`builtin`);await t.builtin(e.id);return;case`mcp`:if(!t.callMcp)throw new G(`mcp`);await t.callMcp(e.server,e.tool,e.params);return;case`open`:if(!t.open)throw new G(`open`);await t.open(e.target);return;case`command`:if(!t.runCommand)throw new G(`command`);await t.runCommand(e.name,e.args);return;case`script`:if(!t.runScript)throw new G(`script`);await t.runScript(e.name);return;default:throw new G(e.type)}}function kt(e){return e}function K(e){return`${e.kind}\u0000${e.label}`}function At(e,t){if(t===``)return 0;let n=e.label.toLowerCase();return n.startsWith(t)?2:e.description&&e.description.toLowerCase().includes(t)?1:n.includes(t)?0:-1}function jt(e){return e.startsWith(`!`)||e.startsWith(`#`)}function Mt(){let e=new Map,t=new Map;function n(t){for(let n of t){if(jt(n.value))throw Error(`[plugin-input] sigil value 不得以 '!' 或 '#' 开头(会被误判为 bash/memory 模式):${JSON.stringify(n.value)}`);let t=K(n);e.delete(t),e.set(t,n)}}function r(t){let n=[...e.values()];return t?n.filter(e=>y(e.kind)===t):n}function i(t,n,r=50){let i=t.toLowerCase(),a=[],o=0;for(let t of e.values()){let e=o++;if(n&&y(t.kind)!==n)continue;let r=At(t,i);r<0||a.push({entry:t,score:r,order:e})}return a.sort((e,t)=>t.score-e.score||e.order-t.order),a.length<=r?a.map(e=>e.entry):a.slice(0,r).map(e=>e.entry)}function a(e,n){let r=t.get(e);return r||(r=new Set,t.set(e,r)),r.add(n),()=>{r?.delete(n)}}async function o(e,n,r=50){let a=i(e,n,r),o=n?t.get(n):void 0;if(!o||o.size===0)return a;let s=[],c=await Promise.allSettled([...o].map(t=>Promise.resolve().then(()=>t(e,n))));for(let e of c)e.status===`fulfilled`&&s.push(...e.value.filter(e=>!jt(e.value)));let l=new Set(a.map(e=>K(e))),u=[...a];for(let e of s){let t=K(e);l.has(t)||(l.add(t),u.push(e))}return u.length<=r?u:u.slice(0,r)}function s(t){for(let n of e.values())if(n.label===t)return n}function c(t){let n=!1;for(let[r,i]of e)i.label===t&&(e.delete(r),n=!0);return n}function l(t){for(let[n,r]of e)r.source===t&&e.delete(n)}return{register:n,registerProvider:a,search:i,searchAsync:o,getAll:r,findByLabel:s,unregister:c,unregisterBySource:l}}function Nt(){return[{label:`Code Review`,description:`请求代码审查`,value:`Please review the following code for correctness, style, security, and performance. Provide specific, actionable feedback.`,kind:`hashtag`,source:`builtin`},{label:`Write Tests`,description:`为代码编写单元测试`,value:`Please write comprehensive unit tests for the following code. Cover normal cases, edge cases, error cases, and ensure high coverage.`,kind:`hashtag`,source:`builtin`},{label:`Explain Code`,description:`解释代码逻辑`,value:`Please explain the following code in detail. Cover the overall architecture, key algorithms, data flow, and any notable design decisions.`,kind:`hashtag`,source:`builtin`}]}const Pt=r(`@x-otto/plugin:file-provider`),Ft=new Set([`node_modules`,`.git`,`dist`,`build`,`out`,`coverage`,`.next`,`.nuxt`,`.turbo`,`.nx`,`.cache`,`.otto`,`.venv`,`__pycache__`]);async function It(e,t,n){let r=[];async function i(a,o){if(r.length>=t)return;let s;try{s=await de(a,{withFileTypes:!0})}catch(e){o&&n?.(e);return}for(let n of s){if(r.length>=t)return;if(n.isDirectory()){if(Ft.has(n.name)||n.name.startsWith(`.`))continue;await i(h(a,n.name),!1)}else n.isFile()&&r.push(ae(e,h(a,n.name)))}}return await i(e,!0),r}function Lt(e,t){if(t===``)return 0;let n=e.toLowerCase();return m(n).startsWith(t)?3:n.startsWith(t)?2:n.includes(t)?1:-1}function Rt(e,t,n,r){let i;try{i=u(h(e,t),`r`);let a=Buffer.allocUnsafe(8192),o=f(i,a,0,a.length,0),s=a.toString(`utf-8`,0,o).split(`
2
2
  `).slice(0,n).join(`
3
- `);return s.length>r?`${s.slice(0,r-1)}…`:s}catch{return``}finally{if(i!==void 0)try{o(i)}catch{}}}function Bt(e){let{cwd:t,max:n=20,walkMax:r=5e3,ttlMs:i=1e4,now:a=Date.now}=e,o=null,s=0,c=null,l=new Map;async function u(){return o&&a()-s<i?o:c||(c=Lt(t,r,e=>{Ft.warn({cwd:t,err:String(e)},`@file provider workspace walk failed at root — @ panel will show no files`)}).then(e=>(o=e,s=a(),c=null,l=new Map,e)),c)}function d(e){let n=l.get(e);if(n!==void 0)return n;let r=zt(t,e,20,500);return l.set(e,r),r}return async e=>{let t=await u(),r=e.toLowerCase(),i=[];for(let e of t){let t=Rt(e,r);if(!(t<0)&&(i.push({path:e,score:t}),r===``&&i.length>=n))break}return i.sort((e,t)=>t.score-e.score||e.path.length-t.path.length),i.slice(0,n).map(({path:e})=>({label:e,value:`[@file:${e.replace(/]/g,`\\]`)}]`,kind:`file`,source:`file`,preview:d(e)}))}}const Vt=r(`@x-otto/coding:trust-store`),Ht={"ui.renderer":`tui.renderer`};function Ut(e){return[...new Set(e.map(e=>Ht[e]??e))]}const K=2e3;function q(e,t){let r=ie(e),o=m(e),s=n(r,o,{timeoutMs:K});s||a(r,o,{timeoutMs:K})&&(s=n(r,o,{timeoutMs:K}));try{return t()}finally{s&&i(r,o)}}function J(e){try{let t=JSON.parse(d(e,`utf-8`)),n=t?.trusted,r=t?.capabilities,i={};if(r&&typeof r==`object`)for(let[e,t]of Object.entries(r))Array.isArray(t)&&(i[e]=Ut(t.filter(e=>typeof e==`string`)));return{trusted:Array.isArray(n)?n.filter(e=>typeof e==`string`):[],capabilities:i}}catch{return{trusted:[],capabilities:{}}}}function Wt(e,t){let n=`${e}.${fe()}.tmp`,r;try{r=u(n,`w`),re(r,t),c(r),o(r),r=void 0,ee(n,e)}catch(e){if(r!==void 0)try{o(r)}catch{}try{ne(n)}catch{}throw e}}function Y(e,t,n){if(!se())try{l(ie(e),{recursive:!0});let n={trusted:[...new Set(t.trusted)]};t.capabilities&&Object.keys(t.capabilities).length>0&&(n.capabilities=t.capabilities),Wt(e,JSON.stringify(n,null,2))}catch(t){Vt.warn({storePath:e,err:t},`Failed to persist ${n} store`)}}function Gt(e,t){return J(e).trusted.includes(g(t))}function Kt(e,t,n){return q(e,()=>{let r=g(t),i=J(e);return i.trusted.includes(r)?!1:(i.trusted.push(r),Y(e,i,n),!0)})}function qt(e,t,n){return q(e,()=>{let r=g(t),i=J(e),a=i.trusted.filter(e=>e!==r),o={...i.capabilities},s=r in o;return delete o[r],a.length===i.trusted.length&&!s?!1:(Y(e,{trusted:a,capabilities:o},n),!0)})}function Jt(e,t){return J(e).capabilities?.[g(t)]??[]}function Yt(e,t,n,r){return q(e,()=>{let i=g(t),a=J(e),o=new Set(a.capabilities?.[i]??[]),s=o.size;for(let e of n)o.add(e);return o.size===s?!1:(Y(e,{trusted:a.trusted,capabilities:{...a.capabilities,[i]:[...o]}},r),!0)})}const X=r(`@x-otto/plugin:trust`);function Z(){return process.env.OTTO_PLUGIN_TRUST_PATH||h(_,`plugin-trust.json`)}function Xt(e,t=Z()){return Gt(t,e)}function Zt(e,t=Z()){Kt(t,e,`plugin-trust`)&&X.info({dir:g(e)},`Plugin trusted`)}function Qt(e,t=Z()){qt(t,e,`plugin-trust`)&&X.info({dir:g(e)},`Plugin trust revoked`)}function $t(e,t=Z()){return Jt(t,e)}function en(e){try{let t=h(e,C);if(!s(t))return[];let n=N(d(t,`utf8`),t);return n?.capabilities?n.capabilities.filter(e=>x.includes(e)):[]}catch{return[]}}function tn(e,t,n=Z()){Yt(n,e,t,`plugin-trust`)&&X.info({dir:g(e),caps:t},`Plugin capabilities granted`)}function Q(e){try{return p(e).length>0}catch{return!1}}function nn(e,t){let n=g(e),r=s(h(n,`.mcp.json`)),i=Q(h(n,`commands`)),a=!!(t?.scripts?.postinstall||t?.scripts?.setup),o=!!(t?.contributes?.panels&&t.contributes.panels.length>0),c=Q(h(n,`skills`)),l=Q(h(n,`agents`)),u=!!t?.contributes?.cli,d=!!t?.capabilities?.some(e=>x.includes(e));return{mcpJson:r,commands:i,scripts:a,panels:o,skills:c,agents:l,cli:u,highRiskCapabilities:d,any:r||i||a||o||c||l||u||d}}function rn(e,t=Z()){let n=nn(e.dir,e.manifest),r=Xt(e.dir,t),i=(e.scope===`project`||e.scope===`repository`)&&n.any&&!r,a=new Set(e.manifest?.capabilities??[]),o=e.scope===`bundled`||e.scope===`builtin`?a:new Set(Jt(t,e.dir));return{surface:n,trusted:r,gated:i,pendingCapabilities:x.filter(e=>a.has(e)&&!o.has(e)),grantedCapabilities:x.filter(e=>a.has(e)&&o.has(e))}}function $(e){return e.split(/[-_]/)[0]??e}var an=class extends t{entries=new Map;currentLocale=`zh`;register(e){this.entries.clear();for(let t of e)this.entries.set(`${t.pluginId}:${t.id}`,t.translations)}get size(){return this.entries.size}getLocale(){return this.currentLocale}setLocale(e){e!==this.currentLocale&&(this.currentLocale=e,this.emit(`change`,e))}t(e,t=this.currentLocale){let n=this.entries.get(e);if(!n)return e;let r=n[t];if(r!==void 0)return r;let i=$(t);for(let[e,t]of Object.entries(n))if($(e)===i)return t;return n.en===void 0?Object.values(n)[0]??e:n.en}};export{z as EXTENSION_POINTS,x as HIGH_RISK_CAPABILITIES,w as ID_RE,Ke as MAX_I18N_ENTRIES_PER_PLUGIN,Ye as MAX_I18N_FILE_BYTES,Je as MAX_I18N_LOCALE_FILES_PER_PLUGIN,qe as MAX_I18N_TRANSLATION_BYTES,Ge as MAX_THEME_PRESETS_PER_PLUGIN,xt as PLUGIN_API_VERSION,pe as PLUGIN_CAPABILITIES,C as PLUGIN_MANIFEST_FILENAME,Et as POINT,an as PluginI18nRegistry,B as SHELL_POINTS,Pt as createBuiltinHashtags,Bt as createFileProvider,Nt as createPluginInputRegistry,At as definePlugin,nn as detectPluginExecutableSurface,vt as discoverPlugins,kt as dispatch,U as evaluateContextKey,Ot as evaluateContextKeys,rn as evaluatePluginTrust,V as evaluateWhen,H as expandPath,Ct as filterEngineCompatible,tn as grantPluginCapabilities,$t as grantedPluginCapabilities,L as isEngineCompatible,Gt as isPathTrusted,Xt as isPluginTrusted,Tt as mergeContributions,N as parsePluginManifest,Z as pluginTrustStorePath,en as readHighRiskCapabilities,Dt as resolveActions,gt as resolveActivationEvents,y as sigilOf,yt as topoSortPlugins,Kt as trustPath,Zt as trustPlugin,qt as untrustPath,Qt as untrustPlugin};
3
+ `);return s.length>r?`${s.slice(0,r-1)}…`:s}catch{return``}finally{if(i!==void 0)try{o(i)}catch{}}}function zt(e){let{cwd:t,max:n=20,walkMax:r=5e3,ttlMs:i=1e4,now:a=Date.now}=e,o=null,s=0,c=null,l=new Map;async function u(){return o&&a()-s<i?o:c||(c=It(t,r,e=>{Pt.warn({cwd:t,err:String(e)},`@file provider workspace walk failed at root — @ panel will show no files`)}).then(e=>(o=e,s=a(),c=null,l=new Map,e)),c)}function d(e){let n=l.get(e);if(n!==void 0)return n;let r=Rt(t,e,20,500);return l.set(e,r),r}return async e=>{let t=await u(),r=e.toLowerCase(),i=[];for(let e of t){let t=Lt(e,r);if(!(t<0)&&(i.push({path:e,score:t}),r===``&&i.length>=n))break}return i.sort((e,t)=>t.score-e.score||e.path.length-t.path.length),i.slice(0,n).map(({path:e})=>({label:e,value:`[@file:${e.replace(/]/g,`\\]`)}]`,kind:`file`,source:`file`,preview:d(e)}))}}const Bt=r(`@x-otto/coding:trust-store`),Vt={"ui.renderer":`tui.renderer`};function Ht(e){return[...new Set(e.map(e=>Vt[e]??e))]}const q=2e3;function J(e,t,r){let o=ie(e),s=m(e),c=n(o,s,{timeoutMs:q});if(c||a(o,s,{timeoutMs:q})&&(c=n(o,s,{timeoutMs:q})),!c&&r?.requireLock)throw Error(`Failed to acquire trust store lock within ${q}ms; revocation aborted to avoid silently losing it to a concurrent writer`);try{return t()}finally{c&&i(o,s)}}function Y(e){try{let t=JSON.parse(d(e,`utf-8`)),n=t?.trusted,r=t?.capabilities,i={};if(r&&typeof r==`object`)for(let[e,t]of Object.entries(r))Array.isArray(t)&&(i[e]=Ht(t.filter(e=>typeof e==`string`)));return{trusted:Array.isArray(n)?n.filter(e=>typeof e==`string`):[],capabilities:i}}catch{return{trusted:[],capabilities:{}}}}function Ut(e,t){let n=`${e}.${fe()}.tmp`,r;try{r=u(n,`w`),re(r,t),c(r),o(r),r=void 0,ee(n,e)}catch(e){if(r!==void 0)try{o(r)}catch{}try{ne(n)}catch{}throw e}}function X(e,t,n){if(!se())try{l(ie(e),{recursive:!0});let n={trusted:[...new Set(t.trusted)]};t.capabilities&&Object.keys(t.capabilities).length>0&&(n.capabilities=t.capabilities),Ut(e,JSON.stringify(n,null,2))}catch(t){throw Bt.warn({storePath:e,err:t},`Failed to persist ${n} store`),t}}function Wt(e,t){return Y(e).trusted.includes(g(t))}function Gt(e,t,n){return J(e,()=>{let r=g(t),i=Y(e);return i.trusted.includes(r)?!1:(i.trusted.push(r),X(e,i,n),!0)})}function Kt(e,t,n){return J(e,()=>{let r=g(t),i=Y(e),a=i.trusted.filter(e=>e!==r),o={...i.capabilities},s=r in o;return delete o[r],a.length===i.trusted.length&&!s?!1:(X(e,{trusted:a,capabilities:o},n),!0)},{requireLock:!0})}function qt(e,t){return Y(e).capabilities?.[g(t)]??[]}function Jt(e,t,n,r){return J(e,()=>{let i=g(t),a=Y(e),o=new Set(a.capabilities?.[i]??[]),s=o.size;for(let e of n)o.add(e);return o.size===s?!1:(X(e,{trusted:a.trusted,capabilities:{...a.capabilities,[i]:[...o]}},r),!0)})}const Z=r(`@x-otto/plugin:trust`);function Q(){return process.env.OTTO_PLUGIN_TRUST_PATH||h(_,`plugin-trust.json`)}function Yt(e,t=Q()){return Wt(t,e)}function Xt(e,t=Q()){Gt(t,e,`plugin-trust`)&&Z.info({dir:g(e)},`Plugin trusted`)}function Zt(e,t=Q()){Kt(t,e,`plugin-trust`)&&Z.info({dir:g(e)},`Plugin trust revoked`)}function Qt(e,t=Q()){return qt(t,e)}function $t(e){try{let t=h(e,C);if(!s(t))return[];let n=P(d(t,`utf8`),t);return n?.capabilities?n.capabilities.filter(e=>x.includes(e)):[]}catch{return[]}}function en(e,t,n=Q()){Jt(n,e,t,`plugin-trust`)&&Z.info({dir:g(e),caps:t},`Plugin capabilities granted`)}function $(e){try{return p(e).length>0}catch{return!1}}function tn(e,t){let n=g(e),r=s(h(n,`.mcp.json`)),i=$(h(n,`commands`)),a=!!(t?.scripts?.postinstall||t?.scripts?.setup),o=!!(t?.contributes?.panels&&t.contributes.panels.length>0),c=[`plugin.ts`,`plugin.tsx`].some(e=>s(h(n,e))),l=$(h(n,`skills`)),u=$(h(n,`agents`)),d=!!t?.contributes?.cli,f=!!t?.capabilities?.some(e=>x.includes(e));return{mcpJson:r,commands:i,scripts:a,panels:o,pluginEntry:c,skills:l,agents:u,cli:d,highRiskCapabilities:f,any:r||i||a||o||c||l||u||d||f}}function nn(e,t=Q()){let n=tn(e.dir,e.manifest),r=Yt(e.dir,t),i=(e.scope===`project`||e.scope===`repository`)&&n.any&&!r,a=new Set(e.manifest?.capabilities??[]),o=e.scope===`bundled`||e.scope===`builtin`?a:new Set(qt(t,e.dir));return{surface:n,trusted:r,gated:i,pendingCapabilities:x.filter(e=>a.has(e)&&!o.has(e)),grantedCapabilities:x.filter(e=>a.has(e)&&o.has(e))}}function rn(e){return e.split(/[-_]/)[0]??e}var an=class extends t{entries=new Map;currentLocale=`zh`;register(e){this.entries.clear();for(let t of e)this.entries.set(`${t.pluginId}:${t.id}`,t.translations)}get size(){return this.entries.size}getLocale(){return this.currentLocale}setLocale(e){e!==this.currentLocale&&(this.currentLocale=e,this.emit(`change`,e))}t(e,t=this.currentLocale){let n=this.entries.get(e);if(!n)return e;let r=n[t];if(r!==void 0)return r;let i=rn(t);for(let[e,t]of Object.entries(n))if(rn(e)===i)return t;return n.en===void 0?Object.values(n)[0]??e:n.en}};export{B as EXTENSION_POINTS,x as HIGH_RISK_CAPABILITIES,w as ID_RE,Ke as MAX_I18N_ENTRIES_PER_PLUGIN,Ye as MAX_I18N_FILE_BYTES,Je as MAX_I18N_LOCALE_FILES_PER_PLUGIN,qe as MAX_I18N_TRANSLATION_BYTES,Ge as MAX_THEME_PRESETS_PER_PLUGIN,bt as PLUGIN_API_VERSION,pe as PLUGIN_CAPABILITIES,C as PLUGIN_MANIFEST_FILENAME,Tt as POINT,an as PluginI18nRegistry,V as SHELL_POINTS,Nt as createBuiltinHashtags,zt as createFileProvider,Mt as createPluginInputRegistry,kt as definePlugin,tn as detectPluginExecutableSurface,_t as discoverPlugins,Ot as dispatch,W as evaluateContextKey,Dt as evaluateContextKeys,nn as evaluatePluginTrust,H as evaluateWhen,U as expandPath,St as filterEngineCompatible,en as grantPluginCapabilities,Qt as grantedPluginCapabilities,R as isEngineCompatible,Wt as isPathTrusted,Yt as isPluginTrusted,wt as mergeContributions,P as parsePluginManifest,Q as pluginTrustStorePath,$t as readHighRiskCapabilities,Et as resolveActions,ht as resolveActivationEvents,y as sigilOf,vt as topoSortPlugins,Gt as trustPath,Xt as trustPlugin,Kt as untrustPath,Zt as untrustPlugin};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@x-otto/plugin",
3
- "version": "0.1.0-alpha.1",
3
+ "version": "0.1.0-alpha.3",
4
4
  "files": [
5
5
  "dist",
6
6
  "README.md"
@@ -20,12 +20,12 @@
20
20
  "tag": "alpha"
21
21
  },
22
22
  "dependencies": {
23
- "@x-otto/env": "0.1.0-alpha.1",
24
- "@x-otto/interchange": "0.1.0-alpha.1",
25
- "@x-otto/provider": "0.1.0-alpha.1",
26
- "@x-otto/shared": "0.1.0-alpha.1",
27
23
  "semver": "7.7.4",
28
- "zod": "4.3.6"
24
+ "zod": "4.3.6",
25
+ "@x-otto/env": "0.1.0-alpha.5",
26
+ "@x-otto/provider": "0.1.0-alpha.4",
27
+ "@x-otto/shared": "0.1.0-alpha.5",
28
+ "@x-otto/interchange": "0.1.0-alpha.2"
29
29
  },
30
30
  "devDependencies": {
31
31
  "@types/semver": "7.7.1"