@caupulican/pi-ai 0.93.3 → 0.93.5

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.
@@ -91,6 +91,7 @@ export declare const TOOL_EXECUTION_ERROR_CATALOGUE: readonly [{
91
91
  readonly name: "fileNotFound";
92
92
  readonly phase: "execution";
93
93
  readonly failureCode: "file_not_found";
94
+ readonly retainDiagnostic: true;
94
95
  readonly guidance: "Path not found. List parent directory or re-read path before retry.";
95
96
  readonly matches: (message: string) => boolean;
96
97
  }, {
@@ -1 +1 @@
1
- {"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../../../src/utils/tool-repair/registry.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,sBAAsB,YAClC,kBAAkB,EAClB,oBAAoB,EACpB,iBAAiB,EACjB,2BAA2B,EAC3B,kBAAkB,EAClB,gBAAgB,EAChB,wBAAwB,EACxB,kBAAkB,EAClB,gBAAgB,EAChB,mBAAmB,EACnB,uBAAuB,EACvB,wBAAwB,EACxB,qBAAqB,EACrB,0BAA0B,EAC1B,qBAAqB,EACrB,mBAAmB,CACV,CAAC;AAEX,MAAM,MAAM,kBAAkB,GAAG,CAAC,OAAO,sBAAsB,CAAC,CAAC,MAAM,CAAC,CAAC;AACzE,MAAM,MAAM,yBAAyB,GAAG,kBAAkB,GAAG,OAAO,CAAC;AAErE,MAAM,WAAW,uBAAuB;IACvC,IAAI,EAAE,kBAAkB,CAAC;IACzB,YAAY,EAAE,MAAM,CAAC;IACrB,YAAY,EAAE,MAAM,CAAC;CACrB;AAED,eAAO,MAAM,oBAAoB,EAAE,SAAS,uBAAuB,EAiFzD,CAAC;AAIX,wBAAgB,0BAA0B,CAAC,IAAI,EAAE,kBAAkB,GAAG,uBAAuB,CAI5F;AAED,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,kBAAkB,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,CAEnF;AAED,wBAAgB,4BAA4B,CAAC,IAAI,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oBACV,WAAW;0BACL,WAAW;uBACd,sFAAsF;gCAC/E,MAAM,KAAG,OAAO;EAO6B,CAAC;AAEjE,MAAM,MAAM,uBAAuB,GAAG,CAAC,OAAO,8BAA8B,CAAC,CAAC,MAAM,CAAC,CAAC,MAAM,CAAC,CAAC;AAG9F,MAAM,WAAW,wBAAwB;IACxC,IAAI,EAAE,uBAAuB,CAAC;IAC9B,KAAK,EAAE,gBAAgB,CAAC;IACxB,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,aAAa,EAAE,0BAA0B,CAAC;IAC1C,gBAAgB,EAAE,OAAO,CAAC;IAC1B,mBAAmB,EAAE,MAAM,CAAC;CAC5B;AAED,wBAAgB,2BAA2B,CAAC,YAAY,EAAE,MAAM,GAAG,wBAAwB,GAAG,SAAS,CAYtG;AAED,wBAAgB,6BAA6B,CAAC,WAAW,EAAE,MAAM,GAAG,0BAA0B,CAG7F;AAED,wBAAgB,mCAAmC,CAAC,WAAW,EAAE,MAAM,GAAG,MAAM,CAG/E;AAED,wBAAgB,6BAA6B,CAAC,YAAY,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAEtF"}
@@ -231,6 +231,7 @@ export const TOOL_EXECUTION_ERROR_CATALOGUE = [
231
231
  name: "fileNotFound",
232
232
  phase: "execution",
233
233
  failureCode: "file_not_found",
234
+ retainDiagnostic: true,
234
235
  guidance: "Path not found. List parent directory or re-read path before retry.",
235
236
  matches(message) {
236
237
  return (/\bENOENT\b/i.test(message) ||
@@ -1 +1 @@
1
- {"version":3,"file":"registry.js","sourceRoot":"","sources":["../../../src/utils/tool-repair/registry.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,sBAAsB,GAAG;IACrC,kBAAkB;IAClB,oBAAoB;IACpB,iBAAiB;IACjB,2BAA2B;IAC3B,kBAAkB;IAClB,gBAAgB;IAChB,wBAAwB;IACxB,kBAAkB;IAClB,gBAAgB;IAChB,mBAAmB;IACnB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CAAC;AAED,MAAM,UAAU,6BAA6B,CAAC,WAAmB;IAChE,MAAM,KAAK,GAAG,uBAAuB,CAAC,IAAI,CAAC,CAAC,SAAS,EAAE,EAAE,CAAC,SAAS,CAAC,WAAW,KAAK,WAAW,CAAC,CAAC;IACjG,OAAO,KAAK,EAAE,aAAa,IAAI,QAAQ,CAAC;AACzC,CAAC;AAED,MAAM,UAAU,mCAAmC,CAAC,WAAmB;IACtE,MAAM,KAAK,GAAG,uBAAuB,CAAC,IAAI,CAAC,CAAC,SAAS,EAAE,EAAE,CAAC,SAAS,CAAC,WAAW,KAAK,WAAW,CAAC,CAAC;IACjG,OAAO,KAAK,EAAE,mBAAmB,IAAI,CAAC,CAAC;AACxC,CAAC;AAED,MAAM,UAAU,6BAA6B,CAAC,YAAoB;IACjE,OAAO,2BAA2B,CAAC,YAAY,CAAC,EAAE,QAAQ,CAAC;AAC5D,CAAC","sourcesContent":["export const TOOL_REPAIR_MODE_NAMES = [\n\t\"nullOptionalDrop\",\n\t\"nullRequiredBounce\",\n\t\"jsonStringParse\",\n\t\"jsonObjectPropertySalvage\",\n\t\"singleObjectWrap\",\n\t\"bareScalarWrap\",\n\t\"emptyObjectPlaceholder\",\n\t\"numberFromString\",\n\t\"boolFromString\",\n\t\"enumCaseNormalize\",\n\t\"propertyCaseNormalize\",\n\t\"propertyAliasNormalize\",\n\t\"singleElementUnwrap\",\n\t\"stringifiedNumberInArray\",\n\t\"bashCommandArgvJoin\",\n\t\"bashCommandUnwrap\",\n] as const;\n\nexport type ToolRepairModeName = (typeof TOOL_REPAIR_MODE_NAMES)[number];\nexport type ToolRepairFailureModeName = ToolRepairModeName | \"other\";\n\nexport interface ToolRepairRegistryEntry {\n\tname: ToolRepairModeName;\n\tnoteTemplate: string;\n\tstandingRule: string;\n}\n\nexport const TOOL_REPAIR_REGISTRY: readonly ToolRepairRegistryEntry[] = [\n\t{\n\t\tname: \"nullOptionalDrop\",\n\t\tnoteTemplate: \"optional `{path}` was null; omit field\",\n\t\tstandingRule: \"Optional field: omit, never null.\",\n\t},\n\t{\n\t\tname: \"nullRequiredBounce\",\n\t\tnoteTemplate: \"required `{path}` was null; send real value\",\n\t\tstandingRule: \"Required field: real value, never null.\",\n\t},\n\t{\n\t\tname: \"jsonStringParse\",\n\t\tnoteTemplate: \"`{path}` was quoted JSON; send raw array/object\",\n\t\tstandingRule: \"Schema array/object: raw JSON, never quoted JSON string.\",\n\t},\n\t{\n\t\tname: \"jsonObjectPropertySalvage\",\n\t\tnoteTemplate: \"`{path}` was malformed JSON; retained declared properties\",\n\t\tstandingRule: \"JSON object: strict syntax, commas between properties, no extra inner text.\",\n\t},\n\t{\n\t\tname: \"singleObjectWrap\",\n\t\tnoteTemplate: \"`{path}` needs list; wrap object in [ ]\",\n\t\tstandingRule: \"List schema: wrap one object in [ ].\",\n\t},\n\t{\n\t\tname: \"bareScalarWrap\",\n\t\tnoteTemplate: \"`{path}` needs list; wrap scalar in [ ]\",\n\t\tstandingRule: \"List schema: wrap one scalar in [ ].\",\n\t},\n\t{\n\t\tname: \"emptyObjectPlaceholder\",\n\t\tnoteTemplate: \"`{path}` was `{}` placeholder; omit for default\",\n\t\tstandingRule: \"Defaulted object field: omit, never `{}` placeholder.\",\n\t},\n\t{\n\t\tname: \"numberFromString\",\n\t\tnoteTemplate: \"`{path}` was quoted number; send bare number\",\n\t\tstandingRule: \"Number schema: bare number, never quoted.\",\n\t},\n\t{\n\t\tname: \"boolFromString\",\n\t\tnoteTemplate: \"`{path}` was quoted boolean; send bare true/false\",\n\t\tstandingRule: \"Boolean schema: bare true/false, never quoted.\",\n\t},\n\t{\n\t\tname: \"enumCaseNormalize\",\n\t\tnoteTemplate: \"`{path}` normalized to declared enum case/spacing\",\n\t\tstandingRule: \"Enum value: exact declared case/spacing.\",\n\t},\n\t{\n\t\tname: \"propertyCaseNormalize\",\n\t\tnoteTemplate: \"`{path}` used wrong key case; use schema case\",\n\t\tstandingRule: \"Argument property: exact schema name/case.\",\n\t},\n\t{\n\t\tname: \"propertyAliasNormalize\",\n\t\tnoteTemplate: \"`{path}` used property alias; mapped to schema property\",\n\t\tstandingRule: \"Argument property: exact schema property name.\",\n\t},\n\t{\n\t\tname: \"singleElementUnwrap\",\n\t\tnoteTemplate: \"`{path}` needs scalar; unwrap 1-item list\",\n\t\tstandingRule: \"Scalar schema: direct value, never 1-item list.\",\n\t},\n\t{\n\t\tname: \"stringifiedNumberInArray\",\n\t\tnoteTemplate: \"number list `{path}` held quoted values; send bare numbers\",\n\t\tstandingRule: \"Number array: bare numbers, never quoted.\",\n\t},\n\t{\n\t\tname: \"bashCommandArgvJoin\",\n\t\tnoteTemplate: \"bash needs one command string; joined argv values\",\n\t\tstandingRule: \"bash command: one string, never argv array.\",\n\t},\n\t{\n\t\tname: \"bashCommandUnwrap\",\n\t\tnoteTemplate: \"bash `command` needs string; unwrapped object\",\n\t\tstandingRule: \"bash `command`: string, never object wrapper.\",\n\t},\n] as const;\n\nconst registryByName = new Map(TOOL_REPAIR_REGISTRY.map((entry) => [entry.name, entry]));\n\nexport function getToolRepairRegistryEntry(name: ToolRepairModeName): ToolRepairRegistryEntry {\n\tconst entry = registryByName.get(name);\n\tif (!entry) throw new Error(`Unknown tool repair mode: ${name}`);\n\treturn entry;\n}\n\nexport function formatToolRepairNote(name: ToolRepairModeName, path: string): string {\n\treturn getToolRepairRegistryEntry(name).noteTemplate.replaceAll(\"{path}\", path);\n}\n\nexport function formatToolRepairStandingRule(name: ToolRepairModeName): string {\n\treturn getToolRepairRegistryEntry(name).standingRule;\n}\n\nexport type ToolExecutionAttemptMemory = \"retain\" | \"discard\";\nexport type ToolFailurePhase =\n\t| \"validation\"\n\t| \"policy\"\n\t| \"preflight\"\n\t| \"execution\"\n\t| \"timeout\"\n\t| \"cancelled\"\n\t| \"provisioning\";\n\nexport const REPEATED_SUCCESSFUL_TOOL_CALL_FAILURE = {\n\tfailureCode: \"repeated_successful_call\",\n\tdiagnostic: \"The identical phone tool call already succeeded and was not executed again.\",\n\tguidance:\n\t\t\"Use prior successful result; continue. Task complete: answer user. Otherwise call different required tool. Never retry unchanged.\",\n} as const;\n\n/** Stable marker for a tool-owned guard that rejects one operation before external execution. */\nexport const TOOL_OPERATION_REJECTED_MARKER = \"PI_TOOL_OPERATION_REJECTED\";\n/**\n * bash.ts is the only emitter (`${TOOL_OPERATION_REJECTED_MARKER}: ...`) and always places the\n * marker at the very start of the thrown error's message, never mid-sentence. Anchor to a line\n * start so captured stdout/stderr that merely echoes the marker (e.g. a `grep` of this file)\n * cannot masquerade as a tool-owned rejection.\n */\nconst TOOL_OPERATION_REJECTED_LINE_PATTERN = new RegExp(`^${TOOL_OPERATION_REJECTED_MARKER}:`, \"m\");\n\ninterface ToolExecutionErrorCatalogueEntry {\n\tname: string;\n\tphase: ToolFailurePhase;\n\tguidance: string;\n\tfailureCode?: string;\n\tattemptMemory?: ToolExecutionAttemptMemory;\n\tretainDiagnostic?: boolean;\n\t/** Number of unchanged executions permitted after the first failure in one recovery window. */\n\tunchangedRetryLimit?: number;\n\tmatches(message: string): boolean;\n}\n\nexport const TOOL_EXECUTION_ERROR_CATALOGUE = [\n\t{\n\t\tname: \"operationRejected\",\n\t\tphase: \"policy\",\n\t\tfailureCode: \"operation_rejected\",\n\t\tattemptMemory: \"discard\",\n\t\tretainDiagnostic: true,\n\t\tguidance:\n\t\t\t\"Operation rejected before execution. Follow the diagnostic: correct or narrow the call, or continue independent work. The runtime remains available.\",\n\t\tmatches(message: string): boolean {\n\t\t\treturn TOOL_OPERATION_REJECTED_LINE_PATTERN.test(message);\n\t\t},\n\t},\n\t{\n\t\tname: \"provisioningFailed\",\n\t\tphase: \"provisioning\",\n\t\tfailureCode: \"provisioning_failed\",\n\t\tretainDiagnostic: true,\n\t\tguidance: \"Provisioning failed. Use exact diagnostic, fix cause; retry only after environment changes.\",\n\t\tmatches(message: string): boolean {\n\t\t\treturn /\\bPI_TOOL_PROVISIONING_FAILED\\b/i.test(message);\n\t\t},\n\t},\n\t{\n\t\tname: \"commandNotFound\",\n\t\tphase: \"provisioning\",\n\t\tguidance: \"Command not found. Check exact name/available tools before retry.\",\n\t\tmatches(message: string): boolean {\n\t\t\treturn /^spawn \\S+ ENOENT\\b/i.test(message) || /(?:^|\\n|:)\\s*command not found\\b/i.test(message);\n\t\t},\n\t},\n\t{\n\t\tname: \"bashNoOutput\",\n\t\tphase: \"execution\",\n\t\tguidance: \"Command failed without output. Verify syntax, exact command documentation before retry.\",\n\t\tmatches(message: string): boolean {\n\t\t\treturn message === \"(no output)\";\n\t\t},\n\t},\n\t{\n\t\tname: \"bashPosixNotSupported\",\n\t\tphase: \"execution\",\n\t\tguidance: \"Windows host rejects POSIX .sh scripts. Use PowerShell equivalent or invoke executable directly.\",\n\t\tmatches(message: string): boolean {\n\t\t\treturn /POSIX shell scripts are not supported by the Windows shell contract router/i.test(message);\n\t\t},\n\t},\n\t{\n\t\tname: \"bashNestedShell\",\n\t\tphase: \"execution\",\n\t\tguidance: \"Never wrap command in powershell.exe/pwsh. Invoke .ps1 or command directly.\",\n\t\tmatches(message: string): boolean {\n\t\t\treturn /Nested shell execution is not supported by the Windows shell contract router/i.test(message);\n\t\t},\n\t},\n\t{\n\t\tname: \"bashMissingCommandWord\",\n\t\tphase: \"execution\",\n\t\tguidance: \"Missing shell command word. Fix empty pipeline element or string quoting before retry.\",\n\t\tmatches(message: string): boolean {\n\t\t\treturn /Missing command: a pipeline\\/list element has no command word/i.test(message);\n\t\t},\n\t},\n\t{\n\t\tname: \"bashEmptyRedirectTarget\",\n\t\tphase: \"execution\",\n\t\tguidance: \"Empty redirect target. Supply valid file path before retry.\",\n\t\tmatches(message: string): boolean {\n\t\t\treturn /redirect target expanded to nothing/i.test(message);\n\t\t},\n\t},\n\t{\n\t\tname: \"encodingCorruption\",\n\t\tphase: \"execution\",\n\t\tfailureCode: \"encoding_corruption\",\n\t\tattemptMemory: \"discard\",\n\t\tguidance:\n\t\t\t\"Change approach: exact UTF-8 replacement unsafe. Use encoding-aware/byte-safe tool; never replay text edit.\",\n\t\tmatches(message: string): boolean {\n\t\t\treturn /\\bPI_FILE_ENCODING_CORRUPTION\\b/i.test(message);\n\t\t},\n\t},\n\t{\n\t\tname: \"repeatedSuccessfulCall\",\n\t\tphase: \"execution\",\n\t\tfailureCode: REPEATED_SUCCESSFUL_TOOL_CALL_FAILURE.failureCode,\n\t\tattemptMemory: \"discard\",\n\t\tretainDiagnostic: true,\n\t\tguidance: REPEATED_SUCCESSFUL_TOOL_CALL_FAILURE.guidance,\n\t\tmatches(message: string): boolean {\n\t\t\treturn message === REPEATED_SUCCESSFUL_TOOL_CALL_FAILURE.diagnostic;\n\t\t},\n\t},\n\t{\n\t\tname: \"fileMutationRetarget\",\n\t\tphase: \"execution\",\n\t\tfailureCode: \"mutation_retarget_required\",\n\t\tattemptMemory: \"discard\",\n\t\tretainDiagnostic: true,\n\t\tguidance:\n\t\t\t\"Harness retained mutation. Choose corrected target path, reuse exact diagnostic payloadRef; never regenerate content/edits.\",\n\t\tmatches(message: string): boolean {\n\t\t\treturn /\\bPI_FILE_MUTATION_RETARGET\\b/i.test(message);\n\t\t},\n\t},\n\t{\n\t\tname: \"fileNotFound\",\n\t\tphase: \"execution\",\n\t\tfailureCode: \"file_not_found\",\n\t\tguidance: \"Path not found. List parent directory or re-read path before retry.\",\n\t\tmatches(message: string): boolean {\n\t\t\treturn (\n\t\t\t\t/\\bENOENT\\b/i.test(message) ||\n\t\t\t\t/no such file or directory/i.test(message) ||\n\t\t\t\t/\\b(?:file|path) not found\\b/i.test(message)\n\t\t\t);\n\t\t},\n\t},\n\t{\n\t\tname: \"editOldTextNotFound\",\n\t\tphase: \"execution\",\n\t\tfailureCode: \"edit_old_text_not_found\",\n\t\tguidance: \"Re-read target; use exact current text before retry.\",\n\t\tmatches(message: string): boolean {\n\t\t\treturn /(?:oldText|old text|exact text).*(?:not found|no match|failed to match|must match)/is.test(message);\n\t\t},\n\t},\n\t{\n\t\tname: \"pathOutsideCwd\",\n\t\tphase: \"policy\",\n\t\tguidance: \"Choose path inside current working directory; ask before scope change.\",\n\t\tmatches(message: string): boolean {\n\t\t\treturn /outside (?:the )?(?:current working directory|cwd|workspace|root)/i.test(message);\n\t\t},\n\t},\n\t{\n\t\tname: \"permissionDenied\",\n\t\tphase: \"policy\",\n\t\tfailureCode: \"permission_denied\",\n\t\tretainDiagnostic: true,\n\t\tguidance: \"Access denied. Verify target/current authority; obtain permissions before retry.\",\n\t\tmatches(message: string): boolean {\n\t\t\treturn /\\b(?:EACCES|EPERM)\\b/i.test(message) || /(?:permission|access) (?:is )?denied/i.test(message);\n\t\t},\n\t},\n\t{\n\t\tname: \"invalidOption\",\n\t\tphase: \"execution\",\n\t\tfailureCode: \"invalid_option\",\n\t\tretainDiagnostic: true,\n\t\tguidance: \"Option rejected. Read command help; remove/replace option before retry.\",\n\t\tmatches(message: string): boolean {\n\t\t\treturn /\\b(?:invalid|unknown|unrecognized) (?:command-line )?(?:option|argument)\\b/i.test(message);\n\t\t},\n\t},\n\t{\n\t\tname: \"invalidPattern\",\n\t\tphase: \"execution\",\n\t\tfailureCode: \"invalid_pattern\",\n\t\tretainDiagnostic: true,\n\t\tguidance: \"Invalid search pattern. Simplify or fix regex/glob escaping before retry.\",\n\t\tmatches(message: string): boolean {\n\t\t\treturn (\n\t\t\t\t/(?:regex|regular expression|glob) (?:parse )?error\\b/i.test(message) ||\n\t\t\t\t/\\bunclosed (?:group|class)\\b/i.test(message)\n\t\t\t);\n\t\t},\n\t},\n\t{\n\t\tname: \"outputLimit\",\n\t\tphase: \"execution\",\n\t\tfailureCode: \"output_limit\",\n\t\tguidance: \"Output exceeded bound. Narrow scope, page request, or use retained artifact before retry.\",\n\t\tmatches(message: string): boolean {\n\t\t\treturn /\\b(?:output|result|response).*(?:limit|truncat|too large)\\b/i.test(message);\n\t\t},\n\t},\n\t{\n\t\tname: \"timedOut\",\n\t\tphase: \"timeout\",\n\t\tfailureCode: \"timeout\",\n\t\tunchangedRetryLimit: 1,\n\t\tguidance: \"Operation timed out. Narrow/split work; one unchanged retry only when safe, still required.\",\n\t\tmatches(message: string): boolean {\n\t\t\treturn (\n\t\t\t\t/\\b(?:command|operation|process|request|tool)\\s+(?:timed out|timeout(?: after)?)\\b/i.test(message) ||\n\t\t\t\t/\\bETIMEDOUT\\b/i.test(message)\n\t\t\t);\n\t\t},\n\t},\n\t{\n\t\tname: \"ownerAuthorizationRequired\",\n\t\tphase: \"policy\",\n\t\tfailureCode: \"owner_authorization_required\",\n\t\tguidance:\n\t\t\t\"Owner authorization is missing from the current prompt. Do not retry start. Continue without a goal or wait for owner speech.\",\n\t\tmatches(message: string): boolean {\n\t\t\treturn (\n\t\t\t\t/goal start requires explicit owner authorization/i.test(message) ||\n\t\t\t\t/tokenBudget requires an exact numeric token ceiling in the current owner prompt/i.test(message) ||\n\t\t\t\t/tokenBudget must equal the owner-requested ceiling/i.test(message)\n\t\t\t);\n\t\t},\n\t},\n\t{\n\t\tname: \"exclusiveArguments\",\n\t\tphase: \"validation\",\n\t\tfailureCode: \"invalid_arguments\",\n\t\tguidance: \"Provide exactly one of the mutually exclusive fields. Do not send both, and do not omit both.\",\n\t\tmatches(message: string): boolean {\n\t\t\treturn /Provide exactly one of /i.test(message);\n\t\t},\n\t},\n\t{\n\t\tname: \"skillNotEligible\",\n\t\tphase: \"policy\",\n\t\tfailureCode: \"skill_not_eligible\",\n\t\tguidance: \"Skill name is not eligible. Search, then load an exact listed name. Do not retry the same name.\",\n\t\tmatches(message: string): boolean {\n\t\t\treturn /No eligible skill named/i.test(message);\n\t\t},\n\t},\n\t{\n\t\tname: \"cancelled\",\n\t\tphase: \"cancelled\",\n\t\tfailureCode: \"cancelled\",\n\t\tguidance: \"Operation cancelled. Retry only when still required, cancellation condition cleared.\",\n\t\tmatches(message: string): boolean {\n\t\t\treturn (\n\t\t\t\t/^(?:operation|request|tool) (?:was )?(?:aborted|cancelled|canceled)\\b/i.test(message) ||\n\t\t\t\t/\\bAbortError\\b/i.test(message)\n\t\t\t);\n\t\t},\n\t},\n] as const satisfies readonly ToolExecutionErrorCatalogueEntry[];\n\nexport type ToolExecutionErrorClass = (typeof TOOL_EXECUTION_ERROR_CATALOGUE)[number][\"name\"];\nconst executionErrorCatalogue: readonly ToolExecutionErrorCatalogueEntry[] = TOOL_EXECUTION_ERROR_CATALOGUE;\n\nexport interface ToolExecutionErrorPolicy {\n\tname: ToolExecutionErrorClass;\n\tphase: ToolFailurePhase;\n\tguidance: string;\n\tfailureCode?: string;\n\tattemptMemory: ToolExecutionAttemptMemory;\n\tretainDiagnostic: boolean;\n\tunchangedRetryLimit: number;\n}\n\nexport function getToolExecutionErrorPolicy(errorMessage: string): ToolExecutionErrorPolicy | undefined {\n\tconst entry = executionErrorCatalogue.find((candidate) => candidate.matches(errorMessage));\n\tif (!entry) return undefined;\n\treturn {\n\t\tname: entry.name as ToolExecutionErrorClass,\n\t\tphase: entry.phase,\n\t\tguidance: entry.guidance,\n\t\t...(entry.failureCode ? { failureCode: entry.failureCode } : {}),\n\t\tattemptMemory: entry.attemptMemory ?? \"retain\",\n\t\tretainDiagnostic: entry.retainDiagnostic ?? false,\n\t\tunchangedRetryLimit: entry.unchangedRetryLimit ?? 0,\n\t};\n}\n\nexport function getToolExecutionAttemptMemory(failureCode: string): ToolExecutionAttemptMemory {\n\tconst entry = executionErrorCatalogue.find((candidate) => candidate.failureCode === failureCode);\n\treturn entry?.attemptMemory ?? \"retain\";\n}\n\nexport function getToolExecutionUnchangedRetryLimit(failureCode: string): number {\n\tconst entry = executionErrorCatalogue.find((candidate) => candidate.failureCode === failureCode);\n\treturn entry?.unchangedRetryLimit ?? 0;\n}\n\nexport function getToolExecutionErrorGuidance(errorMessage: string): string | undefined {\n\treturn getToolExecutionErrorPolicy(errorMessage)?.guidance;\n}\n"]}
1
+ {"version":3,"file":"registry.js","sourceRoot":"","sources":["../../../src/utils/tool-repair/registry.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,sBAAsB,GAAG;IACrC,k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E,aAAa,EAAE,KAAK,CAAC,aAAa,IAAI,QAAQ;QAC9C,gBAAgB,EAAE,KAAK,CAAC,gBAAgB,IAAI,KAAK;QACjD,mBAAmB,EAAE,KAAK,CAAC,mBAAmB,IAAI,CAAC;KACnD,CAAC;AACH,CAAC;AAED,MAAM,UAAU,6BAA6B,CAAC,WAAmB;IAChE,MAAM,KAAK,GAAG,uBAAuB,CAAC,IAAI,CAAC,CAAC,SAAS,EAAE,EAAE,CAAC,SAAS,CAAC,WAAW,KAAK,WAAW,CAAC,CAAC;IACjG,OAAO,KAAK,EAAE,aAAa,IAAI,QAAQ,CAAC;AACzC,CAAC;AAED,MAAM,UAAU,mCAAmC,CAAC,WAAmB;IACtE,MAAM,KAAK,GAAG,uBAAuB,CAAC,IAAI,CAAC,CAAC,SAAS,EAAE,EAAE,CAAC,SAAS,CAAC,WAAW,KAAK,WAAW,CAAC,CAAC;IACjG,OAAO,KAAK,EAAE,mBAAmB,IAAI,CAAC,CAAC;AACxC,CAAC;AAED,MAAM,UAAU,6BAA6B,CAAC,YAAoB;IACjE,OAAO,2BAA2B,CAAC,YAAY,CAAC,EAAE,QAAQ,CAAC;AAC5D,CAAC","sourcesContent":["export const TOOL_REPAIR_MODE_NAMES = [\n\t\"nullOptionalDrop\",\n\t\"nullRequiredBounce\",\n\t\"jsonStringParse\",\n\t\"jsonObjectPropertySalvage\",\n\t\"singleObjectWrap\",\n\t\"bareScalarWrap\",\n\t\"emptyObjectPlaceholder\",\n\t\"numberFromString\",\n\t\"boolFromString\",\n\t\"enumCaseNormalize\",\n\t\"propertyCaseNormalize\",\n\t\"propertyAliasNormalize\",\n\t\"singleElementUnwrap\",\n\t\"stringifiedNumberInArray\",\n\t\"bashCommandArgvJoin\",\n\t\"bashCommandUnwrap\",\n] as const;\n\nexport type ToolRepairModeName = (typeof TOOL_REPAIR_MODE_NAMES)[number];\nexport type ToolRepairFailureModeName = ToolRepairModeName | \"other\";\n\nexport interface ToolRepairRegistryEntry {\n\tname: ToolRepairModeName;\n\tnoteTemplate: string;\n\tstandingRule: string;\n}\n\nexport const TOOL_REPAIR_REGISTRY: readonly ToolRepairRegistryEntry[] = [\n\t{\n\t\tname: \"nullOptionalDrop\",\n\t\tnoteTemplate: \"optional `{path}` was null; omit field\",\n\t\tstandingRule: \"Optional field: omit, never null.\",\n\t},\n\t{\n\t\tname: \"nullRequiredBounce\",\n\t\tnoteTemplate: \"required `{path}` was null; send real value\",\n\t\tstandingRule: \"Required field: real value, never null.\",\n\t},\n\t{\n\t\tname: \"jsonStringParse\",\n\t\tnoteTemplate: \"`{path}` was quoted JSON; send raw array/object\",\n\t\tstandingRule: \"Schema array/object: raw JSON, never quoted JSON string.\",\n\t},\n\t{\n\t\tname: \"jsonObjectPropertySalvage\",\n\t\tnoteTemplate: \"`{path}` was malformed JSON; retained declared properties\",\n\t\tstandingRule: \"JSON object: strict syntax, commas between properties, no extra inner text.\",\n\t},\n\t{\n\t\tname: \"singleObjectWrap\",\n\t\tnoteTemplate: \"`{path}` needs list; wrap object in [ ]\",\n\t\tstandingRule: \"List schema: wrap one object in [ ].\",\n\t},\n\t{\n\t\tname: \"bareScalarWrap\",\n\t\tnoteTemplate: \"`{path}` needs list; wrap scalar in [ ]\",\n\t\tstandingRule: \"List schema: wrap one scalar in [ ].\",\n\t},\n\t{\n\t\tname: \"emptyObjectPlaceholder\",\n\t\tnoteTemplate: \"`{path}` was `{}` placeholder; omit for default\",\n\t\tstandingRule: \"Defaulted object field: omit, never `{}` placeholder.\",\n\t},\n\t{\n\t\tname: \"numberFromString\",\n\t\tnoteTemplate: \"`{path}` was quoted number; send bare number\",\n\t\tstandingRule: \"Number schema: bare number, never quoted.\",\n\t},\n\t{\n\t\tname: \"boolFromString\",\n\t\tnoteTemplate: \"`{path}` was quoted boolean; send bare true/false\",\n\t\tstandingRule: \"Boolean schema: bare true/false, never quoted.\",\n\t},\n\t{\n\t\tname: \"enumCaseNormalize\",\n\t\tnoteTemplate: \"`{path}` normalized to declared enum case/spacing\",\n\t\tstandingRule: \"Enum value: exact declared case/spacing.\",\n\t},\n\t{\n\t\tname: \"propertyCaseNormalize\",\n\t\tnoteTemplate: \"`{path}` used wrong key case; use schema case\",\n\t\tstandingRule: \"Argument property: exact schema name/case.\",\n\t},\n\t{\n\t\tname: \"propertyAliasNormalize\",\n\t\tnoteTemplate: \"`{path}` used property alias; mapped to schema property\",\n\t\tstandingRule: \"Argument property: exact schema property name.\",\n\t},\n\t{\n\t\tname: \"singleElementUnwrap\",\n\t\tnoteTemplate: \"`{path}` needs scalar; unwrap 1-item list\",\n\t\tstandingRule: \"Scalar schema: direct value, never 1-item list.\",\n\t},\n\t{\n\t\tname: \"stringifiedNumberInArray\",\n\t\tnoteTemplate: \"number list `{path}` held quoted values; send bare numbers\",\n\t\tstandingRule: \"Number array: bare numbers, never quoted.\",\n\t},\n\t{\n\t\tname: \"bashCommandArgvJoin\",\n\t\tnoteTemplate: \"bash needs one command string; joined argv values\",\n\t\tstandingRule: \"bash command: one string, never argv array.\",\n\t},\n\t{\n\t\tname: \"bashCommandUnwrap\",\n\t\tnoteTemplate: \"bash `command` needs string; unwrapped object\",\n\t\tstandingRule: \"bash `command`: string, never object wrapper.\",\n\t},\n] as const;\n\nconst registryByName = new Map(TOOL_REPAIR_REGISTRY.map((entry) => [entry.name, entry]));\n\nexport function getToolRepairRegistryEntry(name: ToolRepairModeName): ToolRepairRegistryEntry {\n\tconst entry = registryByName.get(name);\n\tif (!entry) throw new Error(`Unknown tool repair mode: ${name}`);\n\treturn entry;\n}\n\nexport function formatToolRepairNote(name: ToolRepairModeName, path: string): string {\n\treturn getToolRepairRegistryEntry(name).noteTemplate.replaceAll(\"{path}\", path);\n}\n\nexport function formatToolRepairStandingRule(name: ToolRepairModeName): string {\n\treturn getToolRepairRegistryEntry(name).standingRule;\n}\n\nexport type ToolExecutionAttemptMemory = \"retain\" | \"discard\";\nexport type ToolFailurePhase =\n\t| \"validation\"\n\t| \"policy\"\n\t| \"preflight\"\n\t| \"execution\"\n\t| \"timeout\"\n\t| \"cancelled\"\n\t| \"provisioning\";\n\nexport const REPEATED_SUCCESSFUL_TOOL_CALL_FAILURE = {\n\tfailureCode: \"repeated_successful_call\",\n\tdiagnostic: \"The identical phone tool call already succeeded and was not executed again.\",\n\tguidance:\n\t\t\"Use prior successful result; continue. Task complete: answer user. Otherwise call different required tool. Never retry unchanged.\",\n} as const;\n\n/** Stable marker for a tool-owned guard that rejects one operation before external execution. */\nexport const TOOL_OPERATION_REJECTED_MARKER = \"PI_TOOL_OPERATION_REJECTED\";\n/**\n * bash.ts is the only emitter (`${TOOL_OPERATION_REJECTED_MARKER}: ...`) and always places the\n * marker at the very start of the thrown error's message, never mid-sentence. Anchor to a line\n * start so captured stdout/stderr that merely echoes the marker (e.g. a `grep` of this file)\n * cannot masquerade as a tool-owned rejection.\n */\nconst TOOL_OPERATION_REJECTED_LINE_PATTERN = new RegExp(`^${TOOL_OPERATION_REJECTED_MARKER}:`, \"m\");\n\ninterface ToolExecutionErrorCatalogueEntry {\n\tname: string;\n\tphase: ToolFailurePhase;\n\tguidance: string;\n\tfailureCode?: string;\n\tattemptMemory?: ToolExecutionAttemptMemory;\n\tretainDiagnostic?: boolean;\n\t/** Number of unchanged executions permitted after the first failure in one recovery window. */\n\tunchangedRetryLimit?: number;\n\tmatches(message: string): boolean;\n}\n\nexport const TOOL_EXECUTION_ERROR_CATALOGUE = [\n\t{\n\t\tname: \"operationRejected\",\n\t\tphase: \"policy\",\n\t\tfailureCode: \"operation_rejected\",\n\t\tattemptMemory: \"discard\",\n\t\tretainDiagnostic: true,\n\t\tguidance:\n\t\t\t\"Operation rejected before execution. Follow the diagnostic: correct or narrow the call, or continue independent work. The runtime remains available.\",\n\t\tmatches(message: string): boolean {\n\t\t\treturn TOOL_OPERATION_REJECTED_LINE_PATTERN.test(message);\n\t\t},\n\t},\n\t{\n\t\tname: \"provisioningFailed\",\n\t\tphase: \"provisioning\",\n\t\tfailureCode: \"provisioning_failed\",\n\t\tretainDiagnostic: true,\n\t\tguidance: \"Provisioning failed. Use exact diagnostic, fix cause; retry only after environment changes.\",\n\t\tmatches(message: string): boolean {\n\t\t\treturn /\\bPI_TOOL_PROVISIONING_FAILED\\b/i.test(message);\n\t\t},\n\t},\n\t{\n\t\tname: \"commandNotFound\",\n\t\tphase: \"provisioning\",\n\t\tguidance: \"Command not found. Check exact name/available tools before retry.\",\n\t\tmatches(message: string): boolean {\n\t\t\treturn /^spawn \\S+ ENOENT\\b/i.test(message) || /(?:^|\\n|:)\\s*command not found\\b/i.test(message);\n\t\t},\n\t},\n\t{\n\t\tname: \"bashNoOutput\",\n\t\tphase: \"execution\",\n\t\tguidance: \"Command failed without output. Verify syntax, exact command documentation before retry.\",\n\t\tmatches(message: string): boolean {\n\t\t\treturn message === \"(no output)\";\n\t\t},\n\t},\n\t{\n\t\tname: \"bashPosixNotSupported\",\n\t\tphase: \"execution\",\n\t\tguidance: \"Windows host rejects POSIX .sh scripts. Use PowerShell equivalent or invoke executable directly.\",\n\t\tmatches(message: string): boolean {\n\t\t\treturn /POSIX shell scripts are not supported by the Windows shell contract router/i.test(message);\n\t\t},\n\t},\n\t{\n\t\tname: \"bashNestedShell\",\n\t\tphase: \"execution\",\n\t\tguidance: \"Never wrap command in powershell.exe/pwsh. Invoke .ps1 or command directly.\",\n\t\tmatches(message: string): boolean {\n\t\t\treturn /Nested shell execution is not supported by the Windows shell contract router/i.test(message);\n\t\t},\n\t},\n\t{\n\t\tname: \"bashMissingCommandWord\",\n\t\tphase: \"execution\",\n\t\tguidance: \"Missing shell command word. Fix empty pipeline element or string quoting before retry.\",\n\t\tmatches(message: string): boolean {\n\t\t\treturn /Missing command: a pipeline\\/list element has no command word/i.test(message);\n\t\t},\n\t},\n\t{\n\t\tname: \"bashEmptyRedirectTarget\",\n\t\tphase: \"execution\",\n\t\tguidance: \"Empty redirect target. Supply valid file path before retry.\",\n\t\tmatches(message: string): boolean {\n\t\t\treturn /redirect target expanded to nothing/i.test(message);\n\t\t},\n\t},\n\t{\n\t\tname: \"encodingCorruption\",\n\t\tphase: \"execution\",\n\t\tfailureCode: \"encoding_corruption\",\n\t\tattemptMemory: \"discard\",\n\t\tguidance:\n\t\t\t\"Change approach: exact UTF-8 replacement unsafe. Use encoding-aware/byte-safe tool; never replay text edit.\",\n\t\tmatches(message: string): boolean {\n\t\t\treturn /\\bPI_FILE_ENCODING_CORRUPTION\\b/i.test(message);\n\t\t},\n\t},\n\t{\n\t\tname: \"repeatedSuccessfulCall\",\n\t\tphase: \"execution\",\n\t\tfailureCode: REPEATED_SUCCESSFUL_TOOL_CALL_FAILURE.failureCode,\n\t\tattemptMemory: \"discard\",\n\t\tretainDiagnostic: true,\n\t\tguidance: REPEATED_SUCCESSFUL_TOOL_CALL_FAILURE.guidance,\n\t\tmatches(message: string): boolean {\n\t\t\treturn message === REPEATED_SUCCESSFUL_TOOL_CALL_FAILURE.diagnostic;\n\t\t},\n\t},\n\t{\n\t\tname: \"fileMutationRetarget\",\n\t\tphase: \"execution\",\n\t\tfailureCode: \"mutation_retarget_required\",\n\t\tattemptMemory: \"discard\",\n\t\tretainDiagnostic: true,\n\t\tguidance:\n\t\t\t\"Harness retained mutation. Choose corrected target path, reuse exact diagnostic payloadRef; never regenerate content/edits.\",\n\t\tmatches(message: string): boolean {\n\t\t\treturn /\\bPI_FILE_MUTATION_RETARGET\\b/i.test(message);\n\t\t},\n\t},\n\t{\n\t\tname: \"fileNotFound\",\n\t\tphase: \"execution\",\n\t\tfailureCode: \"file_not_found\",\n\t\tretainDiagnostic: true,\n\t\tguidance: \"Path not found. List parent directory or re-read path before retry.\",\n\t\tmatches(message: string): boolean {\n\t\t\treturn (\n\t\t\t\t/\\bENOENT\\b/i.test(message) ||\n\t\t\t\t/no such file or directory/i.test(message) ||\n\t\t\t\t/\\b(?:file|path) not found\\b/i.test(message)\n\t\t\t);\n\t\t},\n\t},\n\t{\n\t\tname: \"editOldTextNotFound\",\n\t\tphase: \"execution\",\n\t\tfailureCode: \"edit_old_text_not_found\",\n\t\tguidance: \"Re-read target; use exact current text before retry.\",\n\t\tmatches(message: string): boolean {\n\t\t\treturn /(?:oldText|old text|exact text).*(?:not found|no match|failed to match|must match)/is.test(message);\n\t\t},\n\t},\n\t{\n\t\tname: \"pathOutsideCwd\",\n\t\tphase: \"policy\",\n\t\tguidance: \"Choose path inside current working directory; ask before scope change.\",\n\t\tmatches(message: string): boolean {\n\t\t\treturn /outside (?:the )?(?:current working directory|cwd|workspace|root)/i.test(message);\n\t\t},\n\t},\n\t{\n\t\tname: \"permissionDenied\",\n\t\tphase: \"policy\",\n\t\tfailureCode: \"permission_denied\",\n\t\tretainDiagnostic: true,\n\t\tguidance: \"Access denied. Verify target/current authority; obtain permissions before retry.\",\n\t\tmatches(message: string): boolean {\n\t\t\treturn /\\b(?:EACCES|EPERM)\\b/i.test(message) || /(?:permission|access) (?:is )?denied/i.test(message);\n\t\t},\n\t},\n\t{\n\t\tname: \"invalidOption\",\n\t\tphase: \"execution\",\n\t\tfailureCode: \"invalid_option\",\n\t\tretainDiagnostic: true,\n\t\tguidance: \"Option rejected. Read command help; remove/replace option before retry.\",\n\t\tmatches(message: string): boolean {\n\t\t\treturn /\\b(?:invalid|unknown|unrecognized) (?:command-line )?(?:option|argument)\\b/i.test(message);\n\t\t},\n\t},\n\t{\n\t\tname: \"invalidPattern\",\n\t\tphase: \"execution\",\n\t\tfailureCode: \"invalid_pattern\",\n\t\tretainDiagnostic: true,\n\t\tguidance: \"Invalid search pattern. Simplify or fix regex/glob escaping before retry.\",\n\t\tmatches(message: string): boolean {\n\t\t\treturn (\n\t\t\t\t/(?:regex|regular expression|glob) (?:parse )?error\\b/i.test(message) ||\n\t\t\t\t/\\bunclosed (?:group|class)\\b/i.test(message)\n\t\t\t);\n\t\t},\n\t},\n\t{\n\t\tname: \"outputLimit\",\n\t\tphase: \"execution\",\n\t\tfailureCode: \"output_limit\",\n\t\tguidance: \"Output exceeded bound. Narrow scope, page request, or use retained artifact before retry.\",\n\t\tmatches(message: string): boolean {\n\t\t\treturn /\\b(?:output|result|response).*(?:limit|truncat|too large)\\b/i.test(message);\n\t\t},\n\t},\n\t{\n\t\tname: \"timedOut\",\n\t\tphase: \"timeout\",\n\t\tfailureCode: \"timeout\",\n\t\tunchangedRetryLimit: 1,\n\t\tguidance: \"Operation timed out. Narrow/split work; one unchanged retry only when safe, still required.\",\n\t\tmatches(message: string): boolean {\n\t\t\treturn (\n\t\t\t\t/\\b(?:command|operation|process|request|tool)\\s+(?:timed out|timeout(?: after)?)\\b/i.test(message) ||\n\t\t\t\t/\\bETIMEDOUT\\b/i.test(message)\n\t\t\t);\n\t\t},\n\t},\n\t{\n\t\tname: \"ownerAuthorizationRequired\",\n\t\tphase: \"policy\",\n\t\tfailureCode: \"owner_authorization_required\",\n\t\tguidance:\n\t\t\t\"Owner authorization is missing from the current prompt. Do not retry start. Continue without a goal or wait for owner speech.\",\n\t\tmatches(message: string): boolean {\n\t\t\treturn (\n\t\t\t\t/goal start requires explicit owner authorization/i.test(message) ||\n\t\t\t\t/tokenBudget requires an exact numeric token ceiling in the current owner prompt/i.test(message) ||\n\t\t\t\t/tokenBudget must equal the owner-requested ceiling/i.test(message)\n\t\t\t);\n\t\t},\n\t},\n\t{\n\t\tname: \"exclusiveArguments\",\n\t\tphase: \"validation\",\n\t\tfailureCode: \"invalid_arguments\",\n\t\tguidance: \"Provide exactly one of the mutually exclusive fields. Do not send both, and do not omit both.\",\n\t\tmatches(message: string): boolean {\n\t\t\treturn /Provide exactly one of /i.test(message);\n\t\t},\n\t},\n\t{\n\t\tname: \"skillNotEligible\",\n\t\tphase: \"policy\",\n\t\tfailureCode: \"skill_not_eligible\",\n\t\tguidance: \"Skill name is not eligible. Search, then load an exact listed name. Do not retry the same name.\",\n\t\tmatches(message: string): boolean {\n\t\t\treturn /No eligible skill named/i.test(message);\n\t\t},\n\t},\n\t{\n\t\tname: \"cancelled\",\n\t\tphase: \"cancelled\",\n\t\tfailureCode: \"cancelled\",\n\t\tguidance: \"Operation cancelled. Retry only when still required, cancellation condition cleared.\",\n\t\tmatches(message: string): boolean {\n\t\t\treturn (\n\t\t\t\t/^(?:operation|request|tool) (?:was )?(?:aborted|cancelled|canceled)\\b/i.test(message) ||\n\t\t\t\t/\\bAbortError\\b/i.test(message)\n\t\t\t);\n\t\t},\n\t},\n] as const satisfies readonly ToolExecutionErrorCatalogueEntry[];\n\nexport type ToolExecutionErrorClass = (typeof TOOL_EXECUTION_ERROR_CATALOGUE)[number][\"name\"];\nconst executionErrorCatalogue: readonly ToolExecutionErrorCatalogueEntry[] = TOOL_EXECUTION_ERROR_CATALOGUE;\n\nexport interface ToolExecutionErrorPolicy {\n\tname: ToolExecutionErrorClass;\n\tphase: ToolFailurePhase;\n\tguidance: string;\n\tfailureCode?: string;\n\tattemptMemory: ToolExecutionAttemptMemory;\n\tretainDiagnostic: boolean;\n\tunchangedRetryLimit: number;\n}\n\nexport function getToolExecutionErrorPolicy(errorMessage: string): ToolExecutionErrorPolicy | undefined {\n\tconst entry = executionErrorCatalogue.find((candidate) => candidate.matches(errorMessage));\n\tif (!entry) return undefined;\n\treturn {\n\t\tname: entry.name as ToolExecutionErrorClass,\n\t\tphase: entry.phase,\n\t\tguidance: entry.guidance,\n\t\t...(entry.failureCode ? { failureCode: entry.failureCode } : {}),\n\t\tattemptMemory: entry.attemptMemory ?? \"retain\",\n\t\tretainDiagnostic: entry.retainDiagnostic ?? false,\n\t\tunchangedRetryLimit: entry.unchangedRetryLimit ?? 0,\n\t};\n}\n\nexport function getToolExecutionAttemptMemory(failureCode: string): ToolExecutionAttemptMemory {\n\tconst entry = executionErrorCatalogue.find((candidate) => candidate.failureCode === failureCode);\n\treturn entry?.attemptMemory ?? \"retain\";\n}\n\nexport function getToolExecutionUnchangedRetryLimit(failureCode: string): number {\n\tconst entry = executionErrorCatalogue.find((candidate) => candidate.failureCode === failureCode);\n\treturn entry?.unchangedRetryLimit ?? 0;\n}\n\nexport function getToolExecutionErrorGuidance(errorMessage: string): string | undefined {\n\treturn getToolExecutionErrorPolicy(errorMessage)?.guidance;\n}\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@caupulican/pi-ai",
3
- "version": "0.93.3",
3
+ "version": "0.93.5",
4
4
  "description": "Unified LLM API with automatic model discovery and provider configuration",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",