@gaunt-sloth/core 2.0.0-alpha.3 → 2.0.0-alpha.30
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 +52 -20
- package/dist/config/colour.d.ts +38 -0
- package/dist/config/colour.js +36 -0
- package/dist/config/colour.js.map +1 -0
- package/dist/config/defaults.d.ts +84 -0
- package/dist/config/defaults.js +99 -0
- package/dist/config/defaults.js.map +1 -0
- package/dist/config/filesystem-tools.d.ts +41 -0
- package/dist/config/filesystem-tools.js +56 -0
- package/dist/config/filesystem-tools.js.map +1 -0
- package/dist/config/jsonc.d.ts +12 -0
- package/dist/config/jsonc.js +41 -0
- package/dist/config/jsonc.js.map +1 -0
- package/dist/config/loader.d.ts +246 -0
- package/dist/config/loader.js +1321 -0
- package/dist/config/loader.js.map +1 -0
- package/dist/config/mouse.d.ts +50 -0
- package/dist/config/mouse.js +44 -0
- package/dist/config/mouse.js.map +1 -0
- package/dist/config/profiles.d.ts +68 -0
- package/dist/config/profiles.js +93 -0
- package/dist/config/profiles.js.map +1 -0
- package/dist/config/providerKeys.d.ts +69 -0
- package/dist/config/providerKeys.js +69 -0
- package/dist/config/providerKeys.js.map +1 -0
- package/dist/config/schema.d.ts +2999 -0
- package/dist/config/schema.js +1519 -0
- package/dist/config/schema.js.map +1 -0
- package/dist/config/shell-policy.d.ts +896 -0
- package/dist/config/shell-policy.js +750 -0
- package/dist/config/shell-policy.js.map +1 -0
- package/dist/config/tool-descriptions.d.ts +211 -0
- package/dist/config/tool-descriptions.js +272 -0
- package/dist/config/tool-descriptions.js.map +1 -0
- package/dist/config/types.d.ts +760 -0
- package/dist/config/types.js +13 -0
- package/dist/config/types.js.map +1 -0
- package/dist/config.d.ts +34 -827
- package/dist/config.js +25 -657
- package/dist/config.js.map +1 -1
- package/dist/constants.d.ts +46 -0
- package/dist/constants.js +46 -0
- package/dist/constants.js.map +1 -1
- package/dist/core/GthAbstractAgent.d.ts +135 -2
- package/dist/core/GthAbstractAgent.js +496 -30
- package/dist/core/GthAbstractAgent.js.map +1 -1
- package/dist/core/GthAgentRunner.d.ts +568 -54
- package/dist/core/GthAgentRunner.js +1537 -136
- package/dist/core/GthAgentRunner.js.map +1 -1
- package/dist/core/GthLangChainAgent.d.ts +115 -0
- package/dist/core/GthLangChainAgent.js +644 -17
- package/dist/core/GthLangChainAgent.js.map +1 -1
- package/dist/core/approvals/annotations.d.ts +122 -0
- package/dist/core/approvals/annotations.js +137 -0
- package/dist/core/approvals/annotations.js.map +1 -0
- package/dist/core/approvals/grants.d.ts +216 -0
- package/dist/core/approvals/grants.js +469 -0
- package/dist/core/approvals/grants.js.map +1 -0
- package/dist/core/approvals/matcher.d.ts +202 -0
- package/dist/core/approvals/matcher.js +267 -0
- package/dist/core/approvals/matcher.js.map +1 -0
- package/dist/core/approvals/mcpSubjects.d.ts +40 -0
- package/dist/core/approvals/mcpSubjects.js +99 -0
- package/dist/core/approvals/mcpSubjects.js.map +1 -0
- package/dist/core/approvals/toolAnnotationSources.d.ts +105 -0
- package/dist/core/approvals/toolAnnotationSources.js +277 -0
- package/dist/core/approvals/toolAnnotationSources.js.map +1 -0
- package/dist/core/approvals/toolHost.d.ts +46 -0
- package/dist/core/approvals/toolHost.js +108 -0
- package/dist/core/approvals/toolHost.js.map +1 -0
- package/dist/core/debugCapture.d.ts +75 -0
- package/dist/core/debugCapture.js +101 -0
- package/dist/core/debugCapture.js.map +1 -0
- package/dist/core/gthLeanAgentFactory.d.ts +9 -0
- package/dist/core/gthLeanAgentFactory.js +10 -0
- package/dist/core/gthLeanAgentFactory.js.map +1 -0
- package/dist/core/launchBanner.d.ts +120 -0
- package/dist/core/launchBanner.js +418 -0
- package/dist/core/launchBanner.js.map +1 -0
- package/dist/core/plainToolIndication.d.ts +15 -0
- package/dist/core/plainToolIndication.js +174 -0
- package/dist/core/plainToolIndication.js.map +1 -0
- package/dist/core/reasoningBlocks.d.ts +60 -0
- package/dist/core/reasoningBlocks.js +98 -0
- package/dist/core/reasoningBlocks.js.map +1 -0
- package/dist/core/refusal.d.ts +53 -0
- package/dist/core/refusal.js +133 -0
- package/dist/core/refusal.js.map +1 -0
- package/dist/core/runStats.d.ts +52 -0
- package/dist/core/runStats.js +118 -0
- package/dist/core/runStats.js.map +1 -0
- package/dist/core/shell/ShellCommandFailedError.d.ts +54 -0
- package/dist/core/shell/ShellCommandFailedError.js +68 -0
- package/dist/core/shell/ShellCommandFailedError.js.map +1 -0
- package/dist/core/shell/abstention.d.ts +88 -0
- package/dist/core/shell/abstention.js +184 -0
- package/dist/core/shell/abstention.js.map +1 -0
- package/dist/core/shell/approvalCapture.d.ts +271 -0
- package/dist/core/shell/approvalCapture.js +108 -0
- package/dist/core/shell/approvalCapture.js.map +1 -0
- package/dist/core/shell/approvalStop.d.ts +84 -0
- package/dist/core/shell/approvalStop.js +119 -0
- package/dist/core/shell/approvalStop.js.map +1 -0
- package/dist/core/shell/arity.d.ts +6 -0
- package/dist/core/shell/arity.js +20 -6
- package/dist/core/shell/arity.js.map +1 -1
- package/dist/core/shell/denylist.d.ts +11 -0
- package/dist/core/shell/denylist.js +37 -0
- package/dist/core/shell/denylist.js.map +1 -0
- package/dist/core/shell/escalationSeverity.d.ts +141 -0
- package/dist/core/shell/escalationSeverity.js +89 -0
- package/dist/core/shell/escalationSeverity.js.map +1 -0
- package/dist/core/shell/framing.d.ts +190 -0
- package/dist/core/shell/framing.js +633 -0
- package/dist/core/shell/framing.js.map +1 -0
- package/dist/core/shell/hardline.d.ts +81 -0
- package/dist/core/shell/hardline.js +607 -0
- package/dist/core/shell/hardline.js.map +1 -0
- package/dist/core/shell/negotiation.d.ts +249 -0
- package/dist/core/shell/negotiation.js +355 -0
- package/dist/core/shell/negotiation.js.map +1 -0
- package/dist/core/shell/normalize.d.ts +44 -4
- package/dist/core/shell/normalize.js +61 -7
- package/dist/core/shell/normalize.js.map +1 -1
- package/dist/core/shell/openWorld.d.ts +263 -0
- package/dist/core/shell/openWorld.js +1188 -0
- package/dist/core/shell/openWorld.js.map +1 -0
- package/dist/core/shell/rater.d.ts +935 -0
- package/dist/core/shell/rater.js +1473 -0
- package/dist/core/shell/rater.js.map +1 -0
- package/dist/core/shell/raterModel.d.ts +41 -0
- package/dist/core/shell/raterModel.js +51 -0
- package/dist/core/shell/raterModel.js.map +1 -0
- package/dist/core/shell/rejection.d.ts +69 -0
- package/dist/core/shell/rejection.js +38 -0
- package/dist/core/shell/rejection.js.map +1 -0
- package/dist/core/toolCallRepair/grammar.d.ts +41 -0
- package/dist/core/toolCallRepair/grammar.js +116 -0
- package/dist/core/toolCallRepair/grammar.js.map +1 -0
- package/dist/core/toolCallRepair/index.d.ts +2 -0
- package/dist/core/toolCallRepair/index.js +7 -0
- package/dist/core/toolCallRepair/index.js.map +1 -0
- package/dist/core/toolCallRepair/payload.d.ts +36 -0
- package/dist/core/toolCallRepair/payload.js +341 -0
- package/dist/core/toolCallRepair/payload.js.map +1 -0
- package/dist/core/toolCallRepair/promote.d.ts +45 -0
- package/dist/core/toolCallRepair/promote.js +90 -0
- package/dist/core/toolCallRepair/promote.js.map +1 -0
- package/dist/core/toolDisplay.d.ts +123 -0
- package/dist/core/toolDisplay.js +451 -0
- package/dist/core/toolDisplay.js.map +1 -0
- package/dist/core/toolOutputChannel.d.ts +95 -0
- package/dist/core/toolOutputChannel.js +165 -0
- package/dist/core/toolOutputChannel.js.map +1 -0
- package/dist/core/types.d.ts +294 -12
- package/dist/core/types.js.map +1 -1
- package/dist/history/historyFormat.d.ts +28 -0
- package/dist/history/historyFormat.js +127 -0
- package/dist/history/historyFormat.js.map +1 -0
- package/dist/history/historyStore.d.ts +198 -0
- package/dist/history/historyStore.js +482 -0
- package/dist/history/historyStore.js.map +1 -0
- package/dist/history/recordSession.d.ts +37 -0
- package/dist/history/recordSession.js +56 -0
- package/dist/history/recordSession.js.map +1 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.js +4 -0
- package/dist/index.js.map +1 -1
- package/dist/providers/anthropic.d.ts +1 -1
- package/dist/providers/anthropic.js +5 -10
- package/dist/providers/anthropic.js.map +1 -1
- package/dist/providers/deepseek.d.ts +1 -1
- package/dist/providers/deepseek.js +5 -10
- package/dist/providers/deepseek.js.map +1 -1
- package/dist/providers/geminiSchemaSanitizer.d.ts +55 -0
- package/dist/providers/geminiSchemaSanitizer.js +347 -0
- package/dist/providers/geminiSchemaSanitizer.js.map +1 -0
- package/dist/providers/geminiThinking.d.ts +52 -0
- package/dist/providers/geminiThinking.js +72 -0
- package/dist/providers/geminiThinking.js.map +1 -0
- package/dist/providers/google-genai.d.ts +1 -1
- package/dist/providers/google-genai.js +12 -11
- package/dist/providers/google-genai.js.map +1 -1
- package/dist/providers/groq.d.ts +1 -1
- package/dist/providers/groq.js +5 -10
- package/dist/providers/groq.js.map +1 -1
- package/dist/providers/huggingface.d.ts +25 -0
- package/dist/providers/huggingface.js +69 -0
- package/dist/providers/huggingface.js.map +1 -0
- package/dist/providers/modelCatalog.d.ts +109 -0
- package/dist/providers/modelCatalog.js +245 -0
- package/dist/providers/modelCatalog.js.map +1 -0
- package/dist/providers/modelDiscovery.d.ts +153 -6
- package/dist/providers/modelDiscovery.js +295 -41
- package/dist/providers/modelDiscovery.js.map +1 -1
- package/dist/providers/ollama.d.ts +19 -5
- package/dist/providers/ollama.js +60 -52
- package/dist/providers/ollama.js.map +1 -1
- package/dist/providers/openai.d.ts +1 -1
- package/dist/providers/openai.js +39 -10
- package/dist/providers/openai.js.map +1 -1
- package/dist/providers/openrouter.d.ts +4 -5
- package/dist/providers/openrouter.js +20 -35
- package/dist/providers/openrouter.js.map +1 -1
- package/dist/providers/vertexai.d.ts +1 -1
- package/dist/providers/vertexai.js +12 -11
- package/dist/providers/vertexai.js.map +1 -1
- package/dist/providers/xai.d.ts +1 -1
- package/dist/providers/xai.js +5 -10
- package/dist/providers/xai.js.map +1 -1
- package/dist/runtime/askStructured.d.ts +105 -0
- package/dist/runtime/askStructured.js +120 -0
- package/dist/runtime/askStructured.js.map +1 -0
- package/dist/runtime/conversation.d.ts +60 -0
- package/dist/runtime/conversation.js +151 -0
- package/dist/runtime/conversation.js.map +1 -0
- package/dist/runtime/singleShot.d.ts +25 -5
- package/dist/runtime/singleShot.js +95 -36
- package/dist/runtime/singleShot.js.map +1 -1
- package/dist/runtime/structuredOutput.d.ts +104 -0
- package/dist/runtime/structuredOutput.js +393 -0
- package/dist/runtime/structuredOutput.js.map +1 -0
- package/dist/utils/ProgressIndicator.d.ts +21 -0
- package/dist/utils/ProgressIndicator.js +30 -3
- package/dist/utils/ProgressIndicator.js.map +1 -1
- package/dist/utils/aiignoreUtils.js.map +1 -1
- package/dist/utils/binaryOutputUtils.js.map +1 -1
- package/dist/utils/consoleUtils.d.ts +52 -0
- package/dist/utils/consoleUtils.js +72 -2
- package/dist/utils/consoleUtils.js.map +1 -1
- package/dist/utils/crashHandler.d.ts +87 -0
- package/dist/utils/crashHandler.js +128 -0
- package/dist/utils/crashHandler.js.map +1 -0
- package/dist/utils/debugDump.d.ts +134 -0
- package/dist/utils/debugDump.js +381 -0
- package/dist/utils/debugDump.js.map +1 -0
- package/dist/utils/debugUtils.d.ts +13 -4
- package/dist/utils/debugUtils.js +36 -13
- package/dist/utils/debugUtils.js.map +1 -1
- package/dist/utils/displayWidth.d.ts +53 -0
- package/dist/utils/displayWidth.js +195 -0
- package/dist/utils/displayWidth.js.map +1 -0
- package/dist/utils/fileUtils.d.ts +24 -2
- package/dist/utils/fileUtils.js +54 -12
- package/dist/utils/fileUtils.js.map +1 -1
- package/dist/utils/llmUtils.d.ts +39 -8
- package/dist/utils/llmUtils.js +76 -8
- package/dist/utils/llmUtils.js.map +1 -1
- package/dist/utils/redactSecrets.d.ts +63 -0
- package/dist/utils/redactSecrets.js +286 -0
- package/dist/utils/redactSecrets.js.map +1 -0
- package/dist/utils/systemPromptNotes.d.ts +225 -0
- package/dist/utils/systemPromptNotes.js +340 -0
- package/dist/utils/systemPromptNotes.js.map +1 -0
- package/dist/utils/systemUtils.d.ts +49 -1
- package/dist/utils/systemUtils.js +67 -3
- package/dist/utils/systemUtils.js.map +1 -1
- package/dist/utils/toolMatching.d.ts +30 -0
- package/dist/utils/toolMatching.js +44 -0
- package/dist/utils/toolMatching.js.map +1 -0
- package/dist/utils/untrustedText.d.ts +66 -0
- package/dist/utils/untrustedText.js +80 -0
- package/dist/utils/untrustedText.js.map +1 -0
- package/package.json +22 -6
- package/schema/gsloth-config.schema.json +3134 -0
- package/dist/core/shell/allowlist.d.ts +0 -75
- package/dist/core/shell/allowlist.js +0 -187
- package/dist/core/shell/allowlist.js.map +0 -1
- package/dist/core/shell/judge.d.ts +0 -161
- package/dist/core/shell/judge.js +0 -261
- package/dist/core/shell/judge.js.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rater.js","sourceRoot":"","sources":["../../../src/core/shell/rater.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AAGH,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AACvE,OAAO,KAAK,CAAC,MAAM,KAAK,CAAC;AAGzB,OAAO,EAAE,iBAAiB,EAAE,WAAW,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAIlF,OAAO,EAAE,wBAAwB,EAAE,MAAM,+BAA+B,CAAC;AACzE,iGAAiG;AACjG,gGAAgG;AAChG,qCAAqC;AACrC,OAAO,EACL,wBAAwB,EAExB,eAAe,GAChB,MAAM,oCAAoC,CAAC;AAC5C,OAAO,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AAChE,OAAO,EACL,0BAA0B,EAC1B,yBAAyB,GAC1B,MAAM,8BAA8B,CAAC;AACtC,OAAO,EAAE,wBAAwB,EAAE,MAAM,kCAAkC,CAAC;AAC5E,OAAO,EAAE,QAAQ,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAEnE;;;;;;;;;;;;;;;;;;;;;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EAAE,MAAM,EAAE,QAAQ,EAAE,OAAO,EAAE,SAAS,EAAE,CAAC;IAClD,CAAC;IACD,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,OAAO,EAAE,SAAS,EAAE,CAAC;AACpD,CAAC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,MAAM,UAAU,8BAA8B,CAC5C,OAAuC;IAEvC,MAAM,SAAS,GAAuB,OAAO,IAAI,mBAAmB,CAAC;IACrE,IAAI,SAAS,CAAC,OAAO,KAAK,QAAQ;QAAE,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,SAAS,EAAE,CAAC;IAClF,IAAI,SAAS,CAAC,OAAO,KAAK,cAAc;QAAE,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,OAAO,EAAE,SAAS,EAAE,CAAC;IAC5F,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,OAAO,EAAE,SAAS,EAAE,CAAC;AACnD,CAAC"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module core/shell/raterModel
|
|
3
|
+
*
|
|
4
|
+
* CFG-26 — resolve the model the AI rater rates with when `approvals.rater.profile` names an
|
|
5
|
+
* identity profile. Without this the profile is validated and then IGNORED: the config parses,
|
|
6
|
+
* `gth config validate` passes, CFG-24's first-run dialog promises "set a stronger model as the
|
|
7
|
+
* rater later via approvals.rater.profile" — and the runtime quietly rates with the main model.
|
|
8
|
+
*
|
|
9
|
+
* Why it matters concretely (QA-5 rater baseline, 2026-07-26): rating quality varies enormously by
|
|
10
|
+
* model. A local `gemma4:12b` scored 61.7% tier accuracy; `llama3.2:1b` scored 25.5% and rated
|
|
11
|
+
* EVERY safe command `danger`. Pointing the rater at a competent model is the difference between
|
|
12
|
+
* `auto` being useful and being `ask` with a bill attached — so the knob has to actually work.
|
|
13
|
+
*
|
|
14
|
+
* Kept in its own module (rather than inline in {@link GthAgentRunner}) for two reasons: the
|
|
15
|
+
* runner's specs can mock THIS seam instead of the whole `#src/config.js` barrel, and the
|
|
16
|
+
* global-state discipline below lives in exactly one place.
|
|
17
|
+
*/
|
|
18
|
+
import type { BaseChatModel } from '@langchain/core/language_models/chat_models';
|
|
19
|
+
/**
|
|
20
|
+
* Load the identity profile named by `approvals.rater.profile` and return ITS model.
|
|
21
|
+
*
|
|
22
|
+
* Strict, per [[GS2-62]]: a profile that cannot be loaded, or that resolves to a config with no
|
|
23
|
+
* usable model, is an ERROR — never a silent fallback to the session's main model. A silent
|
|
24
|
+
* fallback is precisely the failure this function exists to remove (the user asked for a stronger
|
|
25
|
+
* rater and would have been given the weak one, with nothing said). The profile's EXISTENCE is
|
|
26
|
+
* already validated at config-load time by the loader (and by `gth config validate`); this is the
|
|
27
|
+
* later, separate question of whether it yields a usable model.
|
|
28
|
+
*
|
|
29
|
+
* **Global-state discipline.** `initConfig` re-runs project discovery and calls
|
|
30
|
+
* `setProjectDir(discovered?.dir)` as a side effect. That is correct for the SESSION's config load
|
|
31
|
+
* but wrong for this subsidiary one: a rater sub-config must never re-root the session. Because
|
|
32
|
+
* this call passes no `customConfigPath`, discovery re-walks from cwd and can legitimately land on
|
|
33
|
+
* a different dir than the session did (e.g. a session started with `-c <path>`), which would then
|
|
34
|
+
* silently repoint every `getProjectDir()` consumer — prompt files, output paths, the shell
|
|
35
|
+
* allow-list file, debug dumps. So the project dir is snapshotted and restored in a `finally`.
|
|
36
|
+
*
|
|
37
|
+
* @param profile The identity profile name from `approvals.rater.profile`.
|
|
38
|
+
* @returns The profile's chat model, ready to be handed to `rateShellCommand`'s `model` option.
|
|
39
|
+
* @throws When the profile's config cannot be loaded or carries no usable model.
|
|
40
|
+
*/
|
|
41
|
+
export declare function resolveRaterModel(profile: string): Promise<BaseChatModel>;
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { initConfig } from '#src/config/loader.js';
|
|
2
|
+
import { peekProjectDir, setProjectDir } from '#src/utils/systemUtils.js';
|
|
3
|
+
/**
|
|
4
|
+
* Load the identity profile named by `approvals.rater.profile` and return ITS model.
|
|
5
|
+
*
|
|
6
|
+
* Strict, per [[GS2-62]]: a profile that cannot be loaded, or that resolves to a config with no
|
|
7
|
+
* usable model, is an ERROR — never a silent fallback to the session's main model. A silent
|
|
8
|
+
* fallback is precisely the failure this function exists to remove (the user asked for a stronger
|
|
9
|
+
* rater and would have been given the weak one, with nothing said). The profile's EXISTENCE is
|
|
10
|
+
* already validated at config-load time by the loader (and by `gth config validate`); this is the
|
|
11
|
+
* later, separate question of whether it yields a usable model.
|
|
12
|
+
*
|
|
13
|
+
* **Global-state discipline.** `initConfig` re-runs project discovery and calls
|
|
14
|
+
* `setProjectDir(discovered?.dir)` as a side effect. That is correct for the SESSION's config load
|
|
15
|
+
* but wrong for this subsidiary one: a rater sub-config must never re-root the session. Because
|
|
16
|
+
* this call passes no `customConfigPath`, discovery re-walks from cwd and can legitimately land on
|
|
17
|
+
* a different dir than the session did (e.g. a session started with `-c <path>`), which would then
|
|
18
|
+
* silently repoint every `getProjectDir()` consumer — prompt files, output paths, the shell
|
|
19
|
+
* allow-list file, debug dumps. So the project dir is snapshotted and restored in a `finally`.
|
|
20
|
+
*
|
|
21
|
+
* @param profile The identity profile name from `approvals.rater.profile`.
|
|
22
|
+
* @returns The profile's chat model, ready to be handed to `rateShellCommand`'s `model` option.
|
|
23
|
+
* @throws When the profile's config cannot be loaded or carries no usable model.
|
|
24
|
+
*/
|
|
25
|
+
export async function resolveRaterModel(profile) {
|
|
26
|
+
// Snapshot BEFORE initConfig's discovery mutates it (see the note above). `peekProjectDir`
|
|
27
|
+
// rather than `getProjectDir` so an UNSET dir is restored as unset, not pinned to today's cwd.
|
|
28
|
+
const projectDirBefore = peekProjectDir();
|
|
29
|
+
let raterConfig;
|
|
30
|
+
try {
|
|
31
|
+
raterConfig = await initConfig({ identityProfile: profile });
|
|
32
|
+
}
|
|
33
|
+
catch (error) {
|
|
34
|
+
throw new Error(`Could not load the AI rater profile "${profile}" named by approvals.rater.profile: ` +
|
|
35
|
+
`${error instanceof Error ? error.message : String(error)}`, error instanceof Error ? { cause: error } : undefined);
|
|
36
|
+
}
|
|
37
|
+
finally {
|
|
38
|
+
setProjectDir(projectDirBefore);
|
|
39
|
+
}
|
|
40
|
+
const model = raterConfig?.llm;
|
|
41
|
+
// Guard explicitly rather than returning `undefined`: `rateShellCommand` falls back to
|
|
42
|
+
// `config.llm` when its `model` option is undefined, so handing it undefined here would
|
|
43
|
+
// reintroduce the very silent fallback this module removes.
|
|
44
|
+
if (!model || typeof model.withStructuredOutput !== 'function') {
|
|
45
|
+
throw new Error(`The AI rater profile "${profile}" resolved to a config with no usable model. ` +
|
|
46
|
+
'Give that profile a valid `llm`, or remove approvals.rater.profile to rate with the ' +
|
|
47
|
+
'session model.');
|
|
48
|
+
}
|
|
49
|
+
return model;
|
|
50
|
+
}
|
|
51
|
+
//# sourceMappingURL=raterModel.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"raterModel.js","sourceRoot":"","sources":["../../../src/core/shell/raterModel.ts"],"names":[],"mappings":"AAmBA,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACnD,OAAO,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAE1E;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,MAAM,CAAC,KAAK,UAAU,iBAAiB,CAAC,OAAe;IACrD,2FAA2F;IAC3F,+FAA+F;IAC/F,MAAM,gBAAgB,GAAG,cAAc,EAAE,CAAC;IAC1C,IAAI,WAAW,CAAC;IAChB,IAAI,CAAC;QACH,WAAW,GAAG,MAAM,UAAU,CAAC,EAAE,eAAe,EAAE,OAAO,EAAE,CAAC,CAAC;IAC/D,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,MAAM,IAAI,KAAK,CACb,wCAAwC,OAAO,sCAAsC;YACnF,GAAG,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,EAC7D,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC,SAAS,CACtD,CAAC;IACJ,CAAC;YAAS,CAAC;QACT,aAAa,CAAC,gBAAgB,CAAC,CAAC;IAClC,CAAC;IAED,MAAM,KAAK,GAAG,WAAW,EAAE,GAAG,CAAC;IAC/B,uFAAuF;IACvF,wFAAwF;IACxF,4DAA4D;IAC5D,IAAI,CAAC,KAAK,IAAI,OAAO,KAAK,CAAC,oBAAoB,KAAK,UAAU,EAAE,CAAC;QAC/D,MAAM,IAAI,KAAK,CACb,yBAAyB,OAAO,+CAA+C;YAC7E,sFAAsF;YACtF,gBAAgB,CACnB,CAAC;IACJ,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC"}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module core/shell/rejection
|
|
3
|
+
*
|
|
4
|
+
* EXT-58 (spec §7) — **what the model is told when a gated tool call is refused.**
|
|
5
|
+
*
|
|
6
|
+
* A rejection returned to the model MUST name the moves available to it, not merely the refusal.
|
|
7
|
+
* The pre-EXT-58 message was the bare string *"User rejected the shell command."*, which tells the
|
|
8
|
+
* model it failed and nothing about what to do instead — so it either re-runs the identical call or
|
|
9
|
+
* abandons a legitimate task silently. §7 fixes both ends: state the refusal, carry the explanation
|
|
10
|
+
* when one exists, and name the three moves (re-call with a justification, call a different
|
|
11
|
+
* command, ask the user).
|
|
12
|
+
*
|
|
13
|
+
* When the rater named an already-granted alternative (§4.4), the message MUST carry it **and** say
|
|
14
|
+
* that the alternative needs no approval. That last clause is the sentence that actually redirects
|
|
15
|
+
* behaviour: without it the model reads a tool name and still has no reason to believe calling it
|
|
16
|
+
* is cheaper than arguing about the command it already chose.
|
|
17
|
+
*
|
|
18
|
+
* What this module deliberately does NOT do:
|
|
19
|
+
*
|
|
20
|
+
* - It does not decide anything. It renders a refusal that has already been decided elsewhere; a
|
|
21
|
+
* suggestion it carries is never an approval and changes no outcome (§4.4).
|
|
22
|
+
* - It does not serve a **halt** (§4.2). A halt is not a rejection and offers the model no moves,
|
|
23
|
+
* so it is an error (`AttackHaltError`) rather than a message — see `approvalStop.ts`.
|
|
24
|
+
* - It does not serve a **deny-list** refusal. A deny entry is the user's own hardline, and
|
|
25
|
+
* "re-call the same command with a justification" is not a move the model has there; that message
|
|
26
|
+
* stays as it is, in `GthAgentRunner.decideToolApproval`.
|
|
27
|
+
* - It does not serve a command the gate's parser could not READ. There is no such refusal:
|
|
28
|
+
* [[EXT-81]] rates that command instead of refusing it, so every rejection this module renders is
|
|
29
|
+
* a JUDGED one and "call the same command with a justification" is always a move the model has.
|
|
30
|
+
*/
|
|
31
|
+
import type { ShellSafetyVerdict } from '#src/core/shell/rater.js';
|
|
32
|
+
/** Who refused the call — the opening sentence and the moves both follow from this. */
|
|
33
|
+
export type RejectionSource =
|
|
34
|
+
/** The human answered "no" at the escalation prompt (§6). */
|
|
35
|
+
'user'
|
|
36
|
+
/** The auto-rater refused during a negotiation (§5 / [[EXT-29]]). */
|
|
37
|
+
| 'rater';
|
|
38
|
+
/** The three moves §7 requires a JUDGED rejection to name. */
|
|
39
|
+
export declare const REJECTION_MOVES: string;
|
|
40
|
+
/**
|
|
41
|
+
* §7 — the clause that makes a suggestion actionable. Verbatim in substance from the spec:
|
|
42
|
+
* *"`gth_edit_file` does this and is already approved at this level, so it will not interrupt the
|
|
43
|
+
* user."*
|
|
44
|
+
*/
|
|
45
|
+
export declare function buildGrantedAlternativeClause(toolName: string): string;
|
|
46
|
+
/** Inputs to {@link buildRejectionMessage}. */
|
|
47
|
+
export interface RejectionMessageOptions {
|
|
48
|
+
/** Who refused. */
|
|
49
|
+
source: RejectionSource;
|
|
50
|
+
/** The tool that was refused; defaults to a generic phrasing when absent. */
|
|
51
|
+
toolName?: string;
|
|
52
|
+
/**
|
|
53
|
+
* The rating that accompanied the escalation, when one exists. Carries both the explanation the
|
|
54
|
+
* model is owed and — when the rater named one — the granted alternative (§4.4). Absent at the
|
|
55
|
+
* unrated rungs (`manual`, `write`), where there is no rating at all and the descriptions of
|
|
56
|
+
* §4.5 are the only mechanism in play.
|
|
57
|
+
*/
|
|
58
|
+
verdict?: ShellSafetyVerdict;
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Build the rejection message handed back to the model as the refused call's tool result.
|
|
62
|
+
*
|
|
63
|
+
* §7 shape, each part omitted when it does not apply:
|
|
64
|
+
* 1. who refused what;
|
|
65
|
+
* 2. the rater's explanation, when a rating exists;
|
|
66
|
+
* 3. the three moves — always;
|
|
67
|
+
* 4. the granted alternative plus the no-approval-needed clause, when the rater named one.
|
|
68
|
+
*/
|
|
69
|
+
export declare function buildRejectionMessage(options: RejectionMessageOptions): string;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/** The three moves §7 requires a JUDGED rejection to name. */
|
|
2
|
+
export const REJECTION_MOVES = 'You may call the same command with a justification, call a different command, or ask the user ' +
|
|
3
|
+
'if there is no way around it.';
|
|
4
|
+
/**
|
|
5
|
+
* §7 — the clause that makes a suggestion actionable. Verbatim in substance from the spec:
|
|
6
|
+
* *"`gth_edit_file` does this and is already approved at this level, so it will not interrupt the
|
|
7
|
+
* user."*
|
|
8
|
+
*/
|
|
9
|
+
export function buildGrantedAlternativeClause(toolName) {
|
|
10
|
+
return `\`${toolName}\` does this and is already approved at this level, so it will not interrupt the user.`;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Build the rejection message handed back to the model as the refused call's tool result.
|
|
14
|
+
*
|
|
15
|
+
* §7 shape, each part omitted when it does not apply:
|
|
16
|
+
* 1. who refused what;
|
|
17
|
+
* 2. the rater's explanation, when a rating exists;
|
|
18
|
+
* 3. the three moves — always;
|
|
19
|
+
* 4. the granted alternative plus the no-approval-needed clause, when the rater named one.
|
|
20
|
+
*/
|
|
21
|
+
export function buildRejectionMessage(options) {
|
|
22
|
+
const target = options.toolName ? `your call to ${options.toolName}` : 'your command';
|
|
23
|
+
const opener = options.source === 'rater'
|
|
24
|
+
? `The auto-rater rejected ${target}.`
|
|
25
|
+
: `The user rejected ${target}.`;
|
|
26
|
+
const parts = [opener];
|
|
27
|
+
const reason = options.verdict?.reason?.trim();
|
|
28
|
+
if (reason) {
|
|
29
|
+
parts.push(`Explanation: ${reason}`);
|
|
30
|
+
}
|
|
31
|
+
parts.push(REJECTION_MOVES);
|
|
32
|
+
const suggested = options.verdict?.suggestedTool?.trim();
|
|
33
|
+
if (suggested) {
|
|
34
|
+
parts.push(buildGrantedAlternativeClause(suggested));
|
|
35
|
+
}
|
|
36
|
+
return parts.join(' ');
|
|
37
|
+
}
|
|
38
|
+
//# sourceMappingURL=rejection.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rejection.js","sourceRoot":"","sources":["../../../src/core/shell/rejection.ts"],"names":[],"mappings":"AAuCA,8DAA8D;AAC9D,MAAM,CAAC,MAAM,eAAe,GAC1B,gGAAgG;IAChG,+BAA+B,CAAC;AAElC;;;;GAIG;AACH,MAAM,UAAU,6BAA6B,CAAC,QAAgB;IAC5D,OAAO,KAAK,QAAQ,wFAAwF,CAAC;AAC/G,CAAC;AAiBD;;;;;;;;GAQG;AACH,MAAM,UAAU,qBAAqB,CAAC,OAAgC;IACpE,MAAM,MAAM,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC,gBAAgB,OAAO,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC,cAAc,CAAC;IACtF,MAAM,MAAM,GACV,OAAO,CAAC,MAAM,KAAK,OAAO;QACxB,CAAC,CAAC,2BAA2B,MAAM,GAAG;QACtC,CAAC,CAAC,qBAAqB,MAAM,GAAG,CAAC;IAErC,MAAM,KAAK,GAAa,CAAC,MAAM,CAAC,CAAC;IACjC,MAAM,MAAM,GAAG,OAAO,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC;IAC/C,IAAI,MAAM,EAAE,CAAC;QACX,KAAK,CAAC,IAAI,CAAC,gBAAgB,MAAM,EAAE,CAAC,CAAC;IACvC,CAAC;IACD,KAAK,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC;IAC5B,MAAM,SAAS,GAAG,OAAO,CAAC,OAAO,EAAE,aAAa,EAAE,IAAI,EAAE,CAAC;IACzD,IAAI,SAAS,EAAE,CAAC;QACd,KAAK,CAAC,IAAI,CAAC,6BAA6B,CAAC,SAAS,CAAC,CAAC,CAAC;IACvD,CAAC;IACD,OAAO,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AACzB,CAAC"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/** Legacy marker some models emit after a serialized JSON tool request. */
|
|
2
|
+
export declare const END_TOOL_REQUEST = "[END_TOOL_REQUEST]";
|
|
3
|
+
/** Harmony stream marker that introduces the target channel before a tool call. */
|
|
4
|
+
export declare const HARMONY_CHANNEL_MARKER = "<|channel|>";
|
|
5
|
+
/** Harmony stream marker that may separate the header from the JSON payload. */
|
|
6
|
+
export declare const HARMONY_MESSAGE_MARKER = "<|message|>";
|
|
7
|
+
/** Harmony stream marker that may close a serialized tool-call payload. */
|
|
8
|
+
export declare const HARMONY_CALL_MARKER = "<|call|>";
|
|
9
|
+
/**
|
|
10
|
+
* Harmony marker real gpt-oss emits in place of the reference grammar's literal `code` token —
|
|
11
|
+
* e.g. `<|constrain|>json` declares the tool-call payload format. (EXT-43.)
|
|
12
|
+
*/
|
|
13
|
+
export declare const HARMONY_CONSTRAIN_MARKER = "<|constrain|>";
|
|
14
|
+
/** Tool names in bracket/plain-text repairs intentionally match provider-safe ids only. */
|
|
15
|
+
export declare function isPlainTextToolNameChar(char: string | undefined): boolean;
|
|
16
|
+
/**
|
|
17
|
+
* Harmony tool names may be NAMESPACED with dots (real gpt-oss emits `to=functions.get_weather`),
|
|
18
|
+
* so the Harmony header scanner accepts `.` on top of the provider-safe id chars. This is a
|
|
19
|
+
* Harmony-only widening (EXT-43): the bracket/XML-ish dialects keep {@link isPlainTextToolNameChar}
|
|
20
|
+
* unchanged so their prose-safety is untouched. The final dot-segment is the tool name matched
|
|
21
|
+
* against the allow-list (see {@link finalDotSegment}).
|
|
22
|
+
*/
|
|
23
|
+
export declare function isHarmonyToolNameChar(char: string | undefined): boolean;
|
|
24
|
+
/**
|
|
25
|
+
* The tool name for a (possibly namespaced) Harmony target: the final dot-segment.
|
|
26
|
+
* `functions.get_weather` → `get_weather`; `functions.tools.get_weather` → `get_weather`; a dotless
|
|
27
|
+
* `get_weather` → itself. Returns `''` for a trailing-dot / empty final segment (rejected upstream).
|
|
28
|
+
*/
|
|
29
|
+
export declare function finalDotSegment(name: string): string;
|
|
30
|
+
/** Skips spaces and tabs only, preserving line boundaries for grammar decisions. */
|
|
31
|
+
export declare function skipHorizontalWhitespace(text: string, start: number): number;
|
|
32
|
+
/** Skips all JavaScript whitespace when line structure is no longer meaningful. */
|
|
33
|
+
export declare function skipWhitespace(text: string, start: number): number;
|
|
34
|
+
/** Consumes either Unix or Windows line endings and returns the first offset after them. */
|
|
35
|
+
export declare function consumeLineBreak(text: string, start: number): number | null;
|
|
36
|
+
/**
|
|
37
|
+
* Finds the exclusive end offset of a balanced JSON object starting at `start`. Returns null if
|
|
38
|
+
* the object never closes, or (when `maxPayloadBytes` is set) as soon as the scan runs past the
|
|
39
|
+
* cap — the payload-size gate that keeps a runaway blob from being treated as a tool call.
|
|
40
|
+
*/
|
|
41
|
+
export declare function findJsonObjectEnd(text: string, start: number, maxPayloadBytes?: number): number | null;
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
// EXT-35 — plain-text tool-call repair grammar.
|
|
2
|
+
//
|
|
3
|
+
// Ported (TypeScript, gaunt-sloth house style) from the openclaw
|
|
4
|
+
// `@openclaw/tool-call-repair` reference (`packages/tool-call-repair/src/grammar.ts`).
|
|
5
|
+
// Only the low-level scanners the standalone-block parser in `./payload.ts` needs are
|
|
6
|
+
// carried over; the reference's streaming/normalizer/strip helpers are intentionally omitted.
|
|
7
|
+
//
|
|
8
|
+
// These functions recognise the fixed protocol markers small/local models emit when they
|
|
9
|
+
// serialise a tool call as assistant TEXT instead of a native tool_call. They do no allow-list
|
|
10
|
+
// or size gating themselves — that lives in `./payload.ts` / `./promote.ts`.
|
|
11
|
+
/** Legacy marker some models emit after a serialized JSON tool request. */
|
|
12
|
+
export const END_TOOL_REQUEST = '[END_TOOL_REQUEST]';
|
|
13
|
+
/** Harmony stream marker that introduces the target channel before a tool call. */
|
|
14
|
+
export const HARMONY_CHANNEL_MARKER = '<|channel|>';
|
|
15
|
+
/** Harmony stream marker that may separate the header from the JSON payload. */
|
|
16
|
+
export const HARMONY_MESSAGE_MARKER = '<|message|>';
|
|
17
|
+
/** Harmony stream marker that may close a serialized tool-call payload. */
|
|
18
|
+
export const HARMONY_CALL_MARKER = '<|call|>';
|
|
19
|
+
/**
|
|
20
|
+
* Harmony marker real gpt-oss emits in place of the reference grammar's literal `code` token —
|
|
21
|
+
* e.g. `<|constrain|>json` declares the tool-call payload format. (EXT-43.)
|
|
22
|
+
*/
|
|
23
|
+
export const HARMONY_CONSTRAIN_MARKER = '<|constrain|>';
|
|
24
|
+
/** Tool names in bracket/plain-text repairs intentionally match provider-safe ids only. */
|
|
25
|
+
export function isPlainTextToolNameChar(char) {
|
|
26
|
+
return Boolean(char && /[A-Za-z0-9_-]/.test(char));
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Harmony tool names may be NAMESPACED with dots (real gpt-oss emits `to=functions.get_weather`),
|
|
30
|
+
* so the Harmony header scanner accepts `.` on top of the provider-safe id chars. This is a
|
|
31
|
+
* Harmony-only widening (EXT-43): the bracket/XML-ish dialects keep {@link isPlainTextToolNameChar}
|
|
32
|
+
* unchanged so their prose-safety is untouched. The final dot-segment is the tool name matched
|
|
33
|
+
* against the allow-list (see {@link finalDotSegment}).
|
|
34
|
+
*/
|
|
35
|
+
export function isHarmonyToolNameChar(char) {
|
|
36
|
+
return Boolean(char && /[A-Za-z0-9_.-]/.test(char));
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* The tool name for a (possibly namespaced) Harmony target: the final dot-segment.
|
|
40
|
+
* `functions.get_weather` → `get_weather`; `functions.tools.get_weather` → `get_weather`; a dotless
|
|
41
|
+
* `get_weather` → itself. Returns `''` for a trailing-dot / empty final segment (rejected upstream).
|
|
42
|
+
*/
|
|
43
|
+
export function finalDotSegment(name) {
|
|
44
|
+
const lastDot = name.lastIndexOf('.');
|
|
45
|
+
return lastDot === -1 ? name : name.slice(lastDot + 1);
|
|
46
|
+
}
|
|
47
|
+
/** Skips spaces and tabs only, preserving line boundaries for grammar decisions. */
|
|
48
|
+
export function skipHorizontalWhitespace(text, start) {
|
|
49
|
+
let index = start;
|
|
50
|
+
while (index < text.length && (text[index] === ' ' || text[index] === '\t')) {
|
|
51
|
+
index += 1;
|
|
52
|
+
}
|
|
53
|
+
return index;
|
|
54
|
+
}
|
|
55
|
+
/** Skips all JavaScript whitespace when line structure is no longer meaningful. */
|
|
56
|
+
export function skipWhitespace(text, start) {
|
|
57
|
+
let index = start;
|
|
58
|
+
while (index < text.length && /\s/.test(text[index] ?? '')) {
|
|
59
|
+
index += 1;
|
|
60
|
+
}
|
|
61
|
+
return index;
|
|
62
|
+
}
|
|
63
|
+
/** Consumes either Unix or Windows line endings and returns the first offset after them. */
|
|
64
|
+
export function consumeLineBreak(text, start) {
|
|
65
|
+
if (text[start] === '\r') {
|
|
66
|
+
return text[start + 1] === '\n' ? start + 2 : start + 1;
|
|
67
|
+
}
|
|
68
|
+
if (text[start] === '\n') {
|
|
69
|
+
return start + 1;
|
|
70
|
+
}
|
|
71
|
+
return null;
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Finds the exclusive end offset of a balanced JSON object starting at `start`. Returns null if
|
|
75
|
+
* the object never closes, or (when `maxPayloadBytes` is set) as soon as the scan runs past the
|
|
76
|
+
* cap — the payload-size gate that keeps a runaway blob from being treated as a tool call.
|
|
77
|
+
*/
|
|
78
|
+
export function findJsonObjectEnd(text, start, maxPayloadBytes) {
|
|
79
|
+
let depth = 0;
|
|
80
|
+
let inString = false;
|
|
81
|
+
let escaped = false;
|
|
82
|
+
for (let index = start; index < text.length; index += 1) {
|
|
83
|
+
if (maxPayloadBytes !== undefined && index + 1 - start > maxPayloadBytes) {
|
|
84
|
+
return null;
|
|
85
|
+
}
|
|
86
|
+
const char = text[index];
|
|
87
|
+
if (inString) {
|
|
88
|
+
if (escaped) {
|
|
89
|
+
escaped = false;
|
|
90
|
+
}
|
|
91
|
+
else if (char === '\\') {
|
|
92
|
+
escaped = true;
|
|
93
|
+
}
|
|
94
|
+
else if (char === '"') {
|
|
95
|
+
inString = false;
|
|
96
|
+
}
|
|
97
|
+
continue;
|
|
98
|
+
}
|
|
99
|
+
if (char === '"') {
|
|
100
|
+
inString = true;
|
|
101
|
+
continue;
|
|
102
|
+
}
|
|
103
|
+
if (char === '{') {
|
|
104
|
+
depth += 1;
|
|
105
|
+
continue;
|
|
106
|
+
}
|
|
107
|
+
if (char === '}') {
|
|
108
|
+
depth -= 1;
|
|
109
|
+
if (depth === 0) {
|
|
110
|
+
return index + 1;
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
return null;
|
|
115
|
+
}
|
|
116
|
+
//# sourceMappingURL=grammar.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"grammar.js","sourceRoot":"","sources":["../../../src/core/toolCallRepair/grammar.ts"],"names":[],"mappings":"AAAA,gDAAgD;AAChD,EAAE;AACF,iEAAiE;AACjE,uFAAuF;AACvF,sFAAsF;AACtF,8FAA8F;AAC9F,EAAE;AACF,yFAAyF;AACzF,+FAA+F;AAC/F,6EAA6E;AAE7E,2EAA2E;AAC3E,MAAM,CAAC,MAAM,gBAAgB,GAAG,oBAAoB,CAAC;AACrD,mFAAmF;AACnF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AE,CAAC;gBACzB,OAAO,GAAG,IAAI,CAAC;YACjB,CAAC;iBAAM,IAAI,IAAI,KAAK,GAAG,EAAE,CAAC;gBACxB,QAAQ,GAAG,KAAK,CAAC;YACnB,CAAC;YACD,SAAS;QACX,CAAC;QACD,IAAI,IAAI,KAAK,GAAG,EAAE,CAAC;YACjB,QAAQ,GAAG,IAAI,CAAC;YAChB,SAAS;QACX,CAAC;QACD,IAAI,IAAI,KAAK,GAAG,EAAE,CAAC;YACjB,KAAK,IAAI,CAAC,CAAC;YACX,SAAS;QACX,CAAC;QACD,IAAI,IAAI,KAAK,GAAG,EAAE,CAAC;YACjB,KAAK,IAAI,CAAC,CAAC;YACX,IAAI,KAAK,KAAK,CAAC,EAAE,CAAC;gBAChB,OAAO,KAAK,GAAG,CAAC,CAAC;YACnB,CAAC;QACH,CAAC;IACH,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
export { parseStandalonePlainTextToolCallBlocks, type PlainTextToolCallBlock, type PlainTextToolCallParseOptions, } from './payload.js';
|
|
2
|
+
export { textToNativeToolCalls, promoteTextEmittedToolCallMessage, MAX_TEXT_EMITTED_TOOL_CALL_PAYLOAD_BYTES, type TextToolCallRepairOptions, } from './promote.js';
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
// EXT-35 — plain-text tool-call repair: promote a text-emitted tool call to a native tool_call.
|
|
2
|
+
// Ported/adapted from the openclaw `@openclaw/tool-call-repair` reference. See the sibling files
|
|
3
|
+
// for the per-dialect grammar (`grammar.ts`), the standalone-block parser (`payload.ts`), and the
|
|
4
|
+
// LangChain-message promotion + gates (`promote.ts`).
|
|
5
|
+
export { parseStandalonePlainTextToolCallBlocks, } from './payload.js';
|
|
6
|
+
export { textToNativeToolCalls, promoteTextEmittedToolCallMessage, MAX_TEXT_EMITTED_TOOL_CALL_PAYLOAD_BYTES, } from './promote.js';
|
|
7
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/core/toolCallRepair/index.ts"],"names":[],"mappings":"AAAA,gGAAgG;AAChG,iGAAiG;AACjG,kGAAkG;AAClG,sDAAsD;AACtD,OAAO,EACL,sCAAsC,GAGvC,MAAM,cAAc,CAAC;AACtB,OAAO,EACL,qBAAqB,EACrB,iCAAiC,EACjC,wCAAwC,GAEzC,MAAM,cAAc,CAAC"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/** Parsed standalone plain-text tool call block with source offsets for repair. */
|
|
2
|
+
export type PlainTextToolCallBlock = {
|
|
3
|
+
/** Parsed JSON arguments object. */
|
|
4
|
+
arguments: Record<string, unknown>;
|
|
5
|
+
/** Exclusive end offset of the parsed block. */
|
|
6
|
+
end: number;
|
|
7
|
+
/** Tool name parsed from bracket, Harmony, or XML-ish syntax. */
|
|
8
|
+
name: string;
|
|
9
|
+
/** Original text slice that produced this block. */
|
|
10
|
+
raw: string;
|
|
11
|
+
/** Inclusive start offset of the parsed block. */
|
|
12
|
+
start: number;
|
|
13
|
+
};
|
|
14
|
+
/** Parser limits and allow-list options for plain-text tool-call repair. */
|
|
15
|
+
export type PlainTextToolCallParseOptions = {
|
|
16
|
+
/** Optional allow-list of tool names that may be repaired. */
|
|
17
|
+
allowedToolNames?: Iterable<string>;
|
|
18
|
+
/** Maximum serialized payload size accepted for one repaired call. */
|
|
19
|
+
maxPayloadBytes?: number;
|
|
20
|
+
};
|
|
21
|
+
/**
|
|
22
|
+
* The single source of truth for the plain-text tool-call payload cap (256 KB). A serialized call
|
|
23
|
+
* larger than this is never treated as a tool call. Re-exported from `./promote.js` (and the module
|
|
24
|
+
* index) as `MAX_TEXT_EMITTED_TOOL_CALL_PAYLOAD_BYTES` — the public name — so there is ONE constant,
|
|
25
|
+
* not two duplicated literals. (EXT-43 unified the former `DEFAULT_MAX_PLAIN_TEXT_TOOL_PAYLOAD_BYTES`
|
|
26
|
+
* here with `promote.ts`'s copy.)
|
|
27
|
+
*/
|
|
28
|
+
export declare const MAX_TEXT_EMITTED_TOOL_CALL_PAYLOAD_BYTES = 256000;
|
|
29
|
+
/**
|
|
30
|
+
* Parse the WHOLE input into standalone plain-text tool-call blocks, or return null if any part of
|
|
31
|
+
* it is not such a block. This all-or-nothing walk is the standalone-only gate: prose that merely
|
|
32
|
+
* mentions a tool name, contains brackets, or embeds a call inside a sentence never parses (the
|
|
33
|
+
* first non-block character aborts the parse). Allow-list + payload-cap gating are applied per
|
|
34
|
+
* block via {@link PlainTextToolCallParseOptions}.
|
|
35
|
+
*/
|
|
36
|
+
export declare function parseStandalonePlainTextToolCallBlocks(text: string, options?: PlainTextToolCallParseOptions): PlainTextToolCallBlock[] | null;
|