@caupulican/pi-adaptative 0.81.13 → 0.81.15
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/CHANGELOG.md +8 -0
- package/dist/bundled-resources/skills/tool-call-repair/SKILL.md +13 -11
- package/dist/bundled-resources/skills/tool-call-repair/references/failure-grammar.md +16 -10
- package/dist/core/agent-session.d.ts +2 -0
- package/dist/core/agent-session.d.ts.map +1 -1
- package/dist/core/agent-session.js +40 -7
- package/dist/core/agent-session.js.map +1 -1
- package/docs/tool-repair.md +2 -0
- package/examples/extensions/custom-provider-anthropic/package-lock.json +2 -2
- package/examples/extensions/custom-provider-anthropic/package.json +1 -1
- package/examples/extensions/custom-provider-gitlab-duo/package.json +1 -1
- package/examples/extensions/sandbox/package-lock.json +2 -2
- package/examples/extensions/sandbox/package.json +1 -1
- package/examples/extensions/with-deps/package-lock.json +2 -2
- package/examples/extensions/with-deps/package.json +1 -1
- package/npm-shrinkwrap.json +12 -12
- package/package.json +4 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,11 @@
|
|
|
1
|
+
## [0.81.15] - 2026-07-07
|
|
2
|
+
|
|
3
|
+
## [0.81.14] - 2026-07-07
|
|
4
|
+
|
|
5
|
+
### Fixed
|
|
6
|
+
- Fixed text protocol model gating so persisted probe verdicts opt in only text-protocol models after env/settings/model gates, while unflagged native models do not receive the primer.
|
|
7
|
+
- Documented the `propertyCaseNormalize` and `jsonObjectPropertySalvage` repair modes in the operator docs and bundled tool-repair skill.
|
|
8
|
+
|
|
1
9
|
## [0.81.13] - 2026-07-07
|
|
2
10
|
|
|
3
11
|
### Fixed
|
|
@@ -103,17 +103,19 @@ as code (not prose):
|
|
|
103
103
|
|---|---|---|---|
|
|
104
104
|
| 1 | nullOptionalDrop | `null` for an optional field | delete key |
|
|
105
105
|
| 2 | nullRequiredBounce | `null` for a required field | no repair; bounce with required-value feedback |
|
|
106
|
-
| 3 | jsonStringParse | `"[...]"`/`"{...}"` string where container expected | JSON.parse; keep if it matches + checks |
|
|
107
|
-
| 4 |
|
|
108
|
-
| 5 |
|
|
109
|
-
| 6 |
|
|
110
|
-
| 7 |
|
|
111
|
-
| 8 |
|
|
112
|
-
| 9 |
|
|
113
|
-
| 10 |
|
|
114
|
-
| 11 |
|
|
115
|
-
| 12 |
|
|
116
|
-
| 13 |
|
|
106
|
+
| 3 | jsonStringParse | `"[...]"`/`"{...}"` string where container expected | JSON.parse; guarded smart-quote delimiter fallback; keep if it matches + checks |
|
|
107
|
+
| 4 | jsonObjectPropertySalvage | malformed object string with recoverable declared properties | keep declared property values if the whole object checks |
|
|
108
|
+
| 5 | singleObjectWrap | single object where array-of-objects expected | wrap `[obj]` if it passes `items` |
|
|
109
|
+
| 6 | bareScalarWrap | bare scalar where array expected | wrap `[v]` if it passes `items` |
|
|
110
|
+
| 7 | emptyObjectPlaceholder | `{}` placeholder where scalar expected | delete if optional (default applies); else bounce |
|
|
111
|
+
| 8 | numberFromString | `"42"` where number expected | `Number(s)` if finite |
|
|
112
|
+
| 9 | boolFromString | `"true"`/`"false"` where bool expected | exact map (never truthiness) |
|
|
113
|
+
| 10 | enumCaseNormalize | case/space enum variant | match to the one member, else bounce |
|
|
114
|
+
| 11 | propertyCaseNormalize | root argument key casing differs from schema casing | rename to the schema key when unique |
|
|
115
|
+
| 12 | singleElementUnwrap | `[v]` where scalar expected | unwrap if 1 elem and checks |
|
|
116
|
+
| 13 | stringifiedNumberInArray | `["1","2"]` where number[] expected | map Number if all finite |
|
|
117
|
+
| 14 | bashCommandArgvJoin | bash `command` sent as an argv list | join string values with spaces |
|
|
118
|
+
| 15 | bashCommandUnwrap | bash `command` sent as a single-key object wrapper | unwrap the string-valued wrapper |
|
|
117
119
|
|
|
118
120
|
Every entry is a NAMED registry entry
|
|
119
121
|
`{name, errorSignature, transform, guard, noteTemplate}` — one table powers
|
|
@@ -18,15 +18,17 @@ is in its parent's `required`; `def(P)` = P has a schema `default`.
|
|
|
18
18
|
|---|---|---|---|---|---|---|
|
|
19
19
|
| 1 | nullOptionalDrop | type mismatch at P | `null`, `!req(P)` | delete key P | always (absence is valid for optional) | "sent null for optional `P` → omit the field instead" |
|
|
20
20
|
| 1b | nullRequiredBounce | type mismatch at P | `null`, `req(P)`, `!def(P)` | none | never (bounce) | "`P` is required and cannot be null → send a real value" |
|
|
21
|
-
| 2 | jsonStringParse | expect array\|object at P, got string | `"[...]"`/`"{...}"
|
|
21
|
+
| 2 | jsonStringParse | expect array\|object at P, got string | `"[...]"`/`"{...}"`, including text-protocol smart-quote delimiter drift | `JSON.parse(s)`; if strict parse fails, normalize `“`/`”` delimiters and the observed missing object-key quote pattern, then parse | parsed matches expect(P) AND sub-checks | "sent `P` as a quoted JSON string → send a raw JSON array/object" |
|
|
22
|
+
| 2b | jsonObjectPropertySalvage | expect object at P, got malformed object string | e.g. `{"path":"x" extra:1000}` | extract schema-declared JSON literal property values into a new object | each declared property appears at most once, no undeclared value is kept, and whole-object Check passes | "sent `P` as malformed JSON with recoverable declared properties → keep the schema-declared properties" |
|
|
22
23
|
| 3 | singleObjectWrap | expect array at P, got object | `{...}` | `[obj]` | `[obj]` passes `items(P)` | "sent one object where `P` takes a list → wrap it in `[ ]`" |
|
|
23
24
|
| 4 | bareScalarWrap | expect array at P, got scalar | string/number/bool | `[v]` | `[v]` passes `items(P)` | "sent a single value where `P` takes a list → wrap it in `[ ]`" |
|
|
24
25
|
| 5 | emptyObjectPlaceholder | expect scalar at P (or array whose `items` reject `{}`), got object | `{}` | delete key P | `!req(P)` (schema default applies) else bounce | "sent `{}` as a placeholder → omit `P`; its default applies" |
|
|
25
26
|
| 6 | numberFromString | expect number/integer at P, got string | `"42"`, numeric | `Number(s)` | finite (and integer if integer(P)) | "sent `P` as a quoted number → send a bare number" |
|
|
26
27
|
| 7 | boolFromString | expect boolean at P, got string | `"true"`/`"false"` | `s === "true"` | exact match only (never truthiness) | "sent `P` as a quoted boolean → send bare true/false" |
|
|
27
28
|
| 8 | enumCaseNormalize | expect enum at P, got string not in set | case/space variant | match case-insensitively/trimmed to one enum member | exactly one member matches | "`P` must be one of `a|b|c` → matched `<value>`" |
|
|
28
|
-
| 9 |
|
|
29
|
-
| 10 |
|
|
29
|
+
| 9 | propertyCaseNormalize | root object has key K whose casing differs from a declared schema property | e.g. `Path` for `path` | rename K to the schema key | exactly one declared root property matches case-insensitively and the canonical key is absent | "sent `P` with different property-key casing → use the schema key casing" |
|
|
30
|
+
| 10 | singleElementUnwrap | expect scalar at P, got 1-elem array | `[v]` | `v` | `v` passes expect(P) AND `length===1` | "sent `P` as a 1-item list where a single value was expected → send the value" |
|
|
31
|
+
| 11 | stringifiedNumberInArray | expect number[] at P, got string[] | `["1","2"]` | map `Number` | all finite | "list `P` holds quoted numbers → send bare numbers" |
|
|
30
32
|
|
|
31
33
|
Rules that keep this deterministic and safe:
|
|
32
34
|
- **Repairs never invent a value.** 5 relies on the schema `default`; nothing
|
|
@@ -34,13 +36,14 @@ Rules that keep this deterministic and safe:
|
|
|
34
36
|
- **Guard is mandatory.** Every transform runs on a clone and is kept ONLY if
|
|
35
37
|
it Checks against the sub-schema at P. A transform whose guard fails leaves
|
|
36
38
|
args untouched and falls through to the next applicable mode, then bounce.
|
|
37
|
-
- **Order within one path:** 2 (parse) → 8/6/7 (coerce scalar) → 3/4/
|
|
38
|
-
→
|
|
39
|
+
- **Order within one path:** 2 (strict/quote-normalized parse) → 2b (declared-property salvage) → 8/6/7 (coerce scalar) → 3/4/11 (wrap)
|
|
40
|
+
→ 10 (unwrap) → 5 (placeholder-drop) → 1 (null-drop). Parse before wrap so a
|
|
39
41
|
stringified array becomes an array, not a wrapped string. Across paths:
|
|
40
|
-
instance-path order.
|
|
42
|
+
instance-path order. Root property-key casing repair runs before these per-path
|
|
43
|
+
transforms because required-property validator errors do not carry the misspelled key path.
|
|
41
44
|
- **One re-Check.** After all per-path transforms, Check the whole args once.
|
|
42
45
|
Pass → return repaired; fail → bounce. Never loop transforms.
|
|
43
|
-
- Modes 6–
|
|
46
|
+
- Modes 2b and 6–11 are the increment past the original four; each is guard-gated so
|
|
44
47
|
it can only ever turn an invalid call into a valid one, never change a
|
|
45
48
|
valid call (the hot path never reaches them — see Performance).
|
|
46
49
|
|
|
@@ -104,10 +107,13 @@ The failure grammar only ever runs on ALREADY-FAILED calls. The hot path
|
|
|
104
107
|
`validator.Check(args)` (cached compiled validator) and returns the SAME
|
|
105
108
|
object — no clone, no walk, no grammar lookup. This is the ~99% path for
|
|
106
109
|
strong models and it is unchanged from today's cost.
|
|
107
|
-
2. **Repairs are
|
|
110
|
+
2. **Repairs are bounded on the failed path.** The analyzer walks the
|
|
108
111
|
validator's error list (already produced by the failed Check), not the
|
|
109
|
-
schema tree
|
|
110
|
-
|
|
112
|
+
schema tree; the exceptions are `propertyCaseNormalize` and
|
|
113
|
+
`jsonObjectPropertySalvage`, which scan only root object keys or declared
|
|
114
|
+
object properties after a failed Check. Each
|
|
115
|
+
path error maps to at most a few candidate modes by a static dispatch table
|
|
116
|
+
keyed on `(expect, got)` — a Map lookup, not a scan.
|
|
111
117
|
3. **No per-call compilation.** errorSignature matchers are precompiled
|
|
112
118
|
constants; note templates are format strings; the registry is built once
|
|
113
119
|
at module load. Nothing in the repair path constructs a RegExp, compiles a
|
|
@@ -374,6 +374,7 @@ export declare class AgentSession {
|
|
|
374
374
|
private readonly _repairModeSessionCounts;
|
|
375
375
|
private readonly _textProtocolParseFailures;
|
|
376
376
|
private _textProtocolParseObservedThisTurn;
|
|
377
|
+
private _textProtocolValidationOutcomeThisTurn;
|
|
377
378
|
/** Assembles the session's base system prompt from live session state (see
|
|
378
379
|
* system-prompt-builder.ts); owns the paired _baseSystemPromptOptions. */
|
|
379
380
|
private readonly _systemPromptBuilder;
|
|
@@ -519,6 +520,7 @@ export declare class AgentSession {
|
|
|
519
520
|
private _resolveToolProbeModels;
|
|
520
521
|
probeToolCalling(target?: string): Promise<ToolProbeReport>;
|
|
521
522
|
private _handleTextToolProtocolParse;
|
|
523
|
+
private _handleTextToolProtocolValidationOutcome;
|
|
522
524
|
private _recordTextToolProtocolParseOutcomeFromLastAssistant;
|
|
523
525
|
private _looksLikeTextToolProtocolAttempt;
|
|
524
526
|
private _recordToolValidationBounce;
|