@miphamai/cli 0.85.37 → 0.85.39

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.
@@ -88,12 +88,44 @@ function collectSurfaces(schema: unknown, depth = 0): ArgumentSurface[] {
88
88
  const node = isPlainObject(schema) ? schema : {}
89
89
  if (hasProperties(node)) return [surfaceOf(node)]
90
90
  if (depth >= 8) return []
91
+ if (Array.isArray(node.allOf)) {
92
+ const merged = mergeAllOf(node.allOf, depth)
93
+ if (merged) return [merged]
94
+ }
91
95
  const branches = (
92
96
  Array.isArray(node.anyOf) ? node.anyOf : Array.isArray(node.oneOf) ? node.oneOf : []
93
97
  ).filter(isPlainObject)
94
98
  return branches.flatMap((branch) => collectSurfaces(branch, depth + 1))
95
99
  }
96
100
 
101
+ /**
102
+ * `allOf` is conjunction, not a menu: every branch applies at once.
103
+ *
104
+ * Merging it into a single surface is what makes `required` come out right —
105
+ * a name is mandatory when *any* conjunct requires it, which is the opposite
106
+ * of the `anyOf` rule (mandatory only when every branch does). Ignoring the
107
+ * keyword (the state before this) left the tool callable with **no parameters
108
+ * at all**, the same failure a root-level `anyOf` used to have.
109
+ */
110
+ function mergeAllOf(branches: unknown[], depth: number): ArgumentSurface | null {
111
+ const properties: Record<string, unknown> = {}
112
+ const required = new Set<string>()
113
+ let merged = false
114
+ for (const branch of branches.filter(isPlainObject)) {
115
+ for (const surface of collectSurfaces(branch, depth + 1)) {
116
+ merged = true
117
+ for (const [name, property] of Object.entries(surface.properties)) {
118
+ if (isPlainObject(property) && !Object.prototype.hasOwnProperty.call(properties, name)) {
119
+ properties[name] = property
120
+ }
121
+ }
122
+ for (const name of surface.required ?? []) required.add(name)
123
+ }
124
+ }
125
+ if (!merged) return null
126
+ return required.size > 0 ? { properties, required: [...required] } : { properties }
127
+ }
128
+
97
129
  /**
98
130
  * Coerce a server-declared `inputSchema` into a shape every provider accepts.
99
131
  *
@@ -9,7 +9,7 @@
9
9
  export const PACKAGE_NAME = '@miphamai/cli' as const
10
10
 
11
11
  /** 当前发布版本 */
12
- export const PACKAGE_VERSION = '0.85.37' as const
12
+ export const PACKAGE_VERSION = '0.85.39' as const
13
13
 
14
14
  /** npm install 全局安装命令 */
15
15
  export const NPM_INSTALL_COMMAND = `npm install -g ${PACKAGE_NAME}` as const
@@ -90,4 +90,4 @@ export const TOOL_COUNT = 31 as const
90
90
  * —— `test/e2e/full-pipeline.test.ts` 在 Linux 上整文件 skip、在 macOS 上跑 ——
91
91
  * 但**总数相同**(两边都把被 skip 的算进去)。
92
92
  */
93
- export const TEST_COUNT = 4969 as const
93
+ export const TEST_COUNT = 5008 as const