@zhushanwen/pi-structured-output 6.2.4 → 6.2.6

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zhushanwen/pi-structured-output",
3
- "version": "6.2.4",
3
+ "version": "6.2.6",
4
4
  "description": "Structured output tool for Pi — workflow schema enforcement via pi's parameter layer; interactive mode validates self-reported schemas with Ajv",
5
5
  "type": "module",
6
6
  "main": "index.ts",
@@ -26,8 +26,8 @@
26
26
  ],
27
27
  "dependencies": {
28
28
  "ajv": "^8.17.0",
29
- "@zhushanwen/extension-protocol": "0.25.0",
30
- "@zhushanwen/pi-ext-guards": "0.5.0"
29
+ "@zhushanwen/extension-protocol": "0.27.0",
30
+ "@zhushanwen/pi-ext-guards": "0.5.1"
31
31
  },
32
32
  "peerDependencies": {
33
33
  "@earendil-works/pi-ai": "^1.0.0",
package/src/execute.ts CHANGED
@@ -45,7 +45,9 @@ import {
45
45
  *
46
46
  * [同源锚定] packages/subagent-core 的 agent-opts-resolver.ts(src/orchestration/)
47
47
  * 持有本函数的本地副本(两包独立 npm 不能直接 import,optional peer 不保证存在),
48
- * 其 ASP 文案按本判定同源条件化——改动本函数判定逻辑必须同步该副本。
48
+ * 其 ASP 文案按本判定同源条件化——改动本函数判定逻辑必须同步该副本;两侧一致由
49
+ * __tests__/object-root-schema-parity.test.ts 跨包对拍锁定(行为级:本侧判定 ↔
50
+ * 对端 formatSchemaInstruction 契约文案选行),副本漂移即红。
49
51
  */
50
52
  export function isObjectRootSchema(schema: unknown): schema is Record<string, unknown> {
51
53
  if (!isRecord(schema)) return false;
package/src/loop-gate.ts CHANGED
@@ -110,19 +110,15 @@ function requiredBulletPrefix(bulletPath: string, firstField: string): string {
110
110
  * 的字段)——keys 分桶被错误激活,与常规 token 并集对流(同分桶陷阱的伪 AP 变体,
111
111
  * 漏杀方向)。精确化后逐行匹配路径位之后的固定文案,字段名在冒号前不可能命中:
112
112
  *
113
- * 覆盖两种实装形态(均为固定文案,字段名不可能携带):
114
- * 1. pi-ai 参数层 bullet(pi-ai 0.84.1 dist/utils/validation.js + typebox 1.3.7
115
- * Compile 探针核实:message 恒为小写 "must not have additional properties",
116
- * 行形态 ` - <path>: must not have additional properties`)——行级后缀匹配
117
- * AP_LINE_SUFFIX_RE;路径位即 AP 层路径(root / a / a.b / list.0,
118
- * formatValidationPath 对 instancePath 点分),供嵌套 keys 下钻(R4-F2)。
119
- * 2. 日常模式 ajv(execute.ts instancePath 拼接形态,ajv locale 模板大写 "must
120
- * NOT have additional properties")——模板词组含空格与固定语序,字段名不可能
121
- * 携带。该形态无 "Received arguments:" 回显段,keys 分桶天然不激活
122
- * (hasApError 仅作标记;门禁仅 workflow 模式装配,此形态实为防御性保留)。
113
+ * 覆盖实装形态(固定文案,字段名不可能携带):pi-ai 参数层 bullet(pi-ai 0.84.1
114
+ * dist/utils/validation.js + typebox 1.3.7 Compile 探针核实:message 恒为小写
115
+ * "must not have additional properties",行形态 ` - <path>: must not have
116
+ * additional properties`)——行级后缀匹配 AP_LINE_SUFFIX_RE;路径位即 AP 层路径
117
+ * (root / a / a.b / list.0,formatValidationPath 对 instancePath 点分),供嵌套
118
+ * keys 下钻(R4-F2)。(日常模式 ajv 大写 "must NOT" 形态分支已删:门禁仅
119
+ * workflow 模式装配,日常 ajv 错误文本到不了这里。)
123
120
  */
124
121
  const AP_LINE_SUFFIX_RE = /^(.*):\s*must not have additional properties\s*$/;
125
- const AP_AJV_MESSAGE_RE = /must NOT have additional properties/;
126
122
  /** pi-ai bullet message 位(冒号后)的 AP 固定文案原文(见上方探针核实记录)。 */
127
123
  const AP_BULLET_MESSAGE = "must not have additional properties";
128
124
 
@@ -197,7 +193,7 @@ function extractErrorFieldTokens(errorLines: string): {
197
193
  }
198
194
  return {
199
195
  tokens: [...tokens],
200
- hasApError: apPaths.size > 0 || AP_AJV_MESSAGE_RE.test(errorLines),
196
+ hasApError: apPaths.size > 0,
201
197
  apPaths: [...apPaths],
202
198
  };
203
199
  }
@@ -247,18 +247,10 @@ export function createDailyToolDefinition() {
247
247
  _toolCallId: string,
248
248
  params: { schema: unknown; data: unknown },
249
249
  ) {
250
- // 运行假设:workflow 子进程是单 session 进程(由 applySchemaEnvToChildEnv 在
251
- // session-runner 注入 PI_WORKFLOW_SCHEMA)。装配分岔下日常变体注册时 env 为空,
252
- // 但桥接判定保留(ENV_SCHEMA 存在 = workflow 模式):env 有值时注入
253
- // authoritativeSchema 走 execute 的 workflow 透传分支。
254
- // 判空用 `|| undefined` 归一空串为 undefined(truthy 语义),与 entry 的
255
- // `if (schemaEnv)` 统一:空串 env 视为未设置。
256
- const authoritativeSchema = process.env[ENV_SCHEMA] || undefined;
257
- return executeStructuredOutput(
258
- authoritativeSchema !== undefined
259
- ? { ...params, authoritativeSchema }
260
- : params,
261
- );
250
+ // env 读取与 authoritativeSchema 注入的旧桥接分支已删(装配分岔下日常变体
251
+ // 注册时 env 恒空,读到的值结构性不可达非空):workflow 模式由 index.ts 分岔
252
+ // 注册 workflow 变体,本变体恒走日常自报校验。
253
+ return executeStructuredOutput(params);
262
254
  },
263
255
 
264
256
  // 摘要不进 details:同 workflow 变体(details = 数据本体,parsedOutput 契约);