@gaunt-sloth/core 2.0.0-alpha.8 → 2.0.0-beta.0
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/.gsloth.review.md +2 -0
- package/README.md +71 -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/configDiscovery.d.ts +79 -0
- package/dist/config/configDiscovery.js +80 -0
- package/dist/config/configDiscovery.js.map +1 -0
- package/dist/config/defaults.d.ts +20 -20
- package/dist/config/defaults.js +10 -8
- package/dist/config/defaults.js.map +1 -1
- 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/loader.d.ts +171 -19
- package/dist/config/loader.js +1054 -144
- package/dist/config/loader.js.map +1 -1
- 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 +2671 -138
- package/dist/config/schema.js +1361 -85
- package/dist/config/schema.js.map +1 -1
- package/dist/config/shell-policy.d.ts +899 -111
- package/dist/config/shell-policy.js +800 -70
- package/dist/config/shell-policy.js.map +1 -1
- 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 +352 -41
- package/dist/config/types.js +1 -0
- package/dist/config/types.js.map +1 -1
- package/dist/config.d.ts +35 -1
- package/dist/config.js +16 -1
- package/dist/config.js.map +1 -1
- package/dist/constants.d.ts +28 -1
- package/dist/constants.js +28 -1
- package/dist/constants.js.map +1 -1
- package/dist/core/GthAbstractAgent.d.ts +166 -11
- package/dist/core/GthAbstractAgent.js +484 -45
- package/dist/core/GthAbstractAgent.js.map +1 -1
- package/dist/core/GthAgentRunner.d.ts +543 -57
- package/dist/core/GthAgentRunner.js +1494 -140
- package/dist/core/GthAgentRunner.js.map +1 -1
- package/dist/core/GthLangChainAgent.d.ts +117 -2
- package/dist/core/GthLangChainAgent.js +602 -29
- 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/promptHeader.d.ts +28 -0
- package/dist/core/approvals/promptHeader.js +62 -0
- package/dist/core/approvals/promptHeader.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 +74 -0
- package/dist/core/debugCapture.js +100 -0
- package/dist/core/debugCapture.js.map +1 -0
- package/dist/core/gthLeanAgentFactory.d.ts +4 -4
- package/dist/core/gthLeanAgentFactory.js +4 -4
- package/dist/core/launchBanner.d.ts +127 -0
- package/dist/core/launchBanner.js +414 -0
- package/dist/core/launchBanner.js.map +1 -0
- package/dist/core/modelLabel.d.ts +19 -0
- package/dist/core/modelLabel.js +26 -0
- package/dist/core/modelLabel.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 +65 -0
- package/dist/core/reasoningBlocks.js +103 -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/runHeader.d.ts +38 -0
- package/dist/core/runHeader.js +42 -0
- package/dist/core/runHeader.js.map +1 -0
- package/dist/core/runStats.d.ts +14 -3
- package/dist/core/runStats.js +48 -3
- package/dist/core/runStats.js.map +1 -1
- package/dist/core/shell/ShellCommandFailedError.d.ts +3 -4
- package/dist/core/shell/ShellCommandFailedError.js +3 -4
- package/dist/core/shell/ShellCommandFailedError.js.map +1 -1
- 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 +123 -0
- package/dist/core/shell/approvalStop.js +269 -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 +103 -0
- package/dist/core/shell/hardline.js +780 -0
- package/dist/core/shell/hardline.js.map +1 -0
- package/dist/core/shell/negotiation.d.ts +328 -0
- package/dist/core/shell/negotiation.js +488 -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 +873 -0
- package/dist/core/shell/rater.js +1454 -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/raterVocabulary.d.ts +121 -0
- package/dist/core/shell/raterVocabulary.js +116 -0
- package/dist/core/shell/raterVocabulary.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 +349 -16
- package/dist/core/types.js.map +1 -1
- package/dist/history/historyFormat.d.ts +12 -3
- package/dist/history/historyFormat.js +50 -8
- package/dist/history/historyFormat.js.map +1 -1
- package/dist/history/historyStore.d.ts +77 -0
- package/dist/history/historyStore.js +173 -6
- package/dist/history/historyStore.js.map +1 -1
- package/dist/history/recordSession.d.ts +10 -1
- package/dist/history/recordSession.js +27 -0
- package/dist/history/recordSession.js.map +1 -1
- package/dist/providers/anthropic.js +12 -0
- package/dist/providers/anthropic.js.map +1 -1
- package/dist/providers/configurationPassthrough.d.ts +107 -0
- package/dist/providers/configurationPassthrough.js +148 -0
- package/dist/providers/configurationPassthrough.js.map +1 -0
- 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 +60 -0
- package/dist/providers/geminiThinking.js +92 -0
- package/dist/providers/geminiThinking.js.map +1 -0
- package/dist/providers/google-genai.js +18 -1
- package/dist/providers/google-genai.js.map +1 -1
- package/dist/providers/groq.js +12 -0
- 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 +99 -5
- package/dist/providers/modelDiscovery.js +191 -35
- package/dist/providers/modelDiscovery.js.map +1 -1
- package/dist/providers/ollama.d.ts +18 -4
- package/dist/providers/ollama.js +67 -37
- package/dist/providers/ollama.js.map +1 -1
- package/dist/providers/openai.js +34 -0
- package/dist/providers/openai.js.map +1 -1
- package/dist/providers/openrouter.d.ts +26 -4
- package/dist/providers/openrouter.js +83 -26
- package/dist/providers/openrouter.js.map +1 -1
- package/dist/providers/vertexai.js +19 -1
- package/dist/providers/vertexai.js.map +1 -1
- package/dist/providers/xai.js +20 -0
- 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 +64 -0
- package/dist/runtime/conversation.js +171 -0
- package/dist/runtime/conversation.js.map +1 -0
- package/dist/runtime/singleShot.d.ts +37 -6
- package/dist/runtime/singleShot.js +113 -67
- 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 +95 -0
- package/dist/utils/consoleUtils.js +112 -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.js.map +1 -1
- package/dist/utils/globalConfigUtils.d.ts +14 -2
- package/dist/utils/globalConfigUtils.js +22 -4
- package/dist/utils/globalConfigUtils.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 +222 -0
- package/dist/utils/systemPromptNotes.js +338 -0
- package/dist/utils/systemPromptNotes.js.map +1 -0
- package/dist/utils/systemUtils.d.ts +18 -1
- package/dist/utils/systemUtils.js +38 -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 +86 -0
- package/dist/utils/untrustedText.js +101 -0
- package/dist/utils/untrustedText.js.map +1 -0
- package/package.json +21 -7
- package/schema/gsloth-config.schema.json +1921 -326
- 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
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shell-policy.js","sourceRoot":"","sources":["../../src/config/shell-policy.ts"],"names":[],"mappings":"AAkIA;;;;GAIG;AACH,MAAM,CAAC,MAAM,wBAAwB,GAAG,OAAO,CAAC;AAEhD;;;;GAIG;AACH,MAAM,CAAC,MAAM,8BAA8B,GAAG,OAAO,CAAC;AAEtD;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,UAAU,kBAAkB,CAChC,QAAuC,EACvC,OAAgC;IAEhC,MAAM,KAAK,GAAG,QAAQ,EAAE,KAAK,CAAC;IAC9B,IAAI,OAAO,KAAK,KAAK,SAAS;QAAE,OAAO,KAAK,CAAC;IAC7C,IAAI,KAAK,IAAI,OAAO,KAAK,KAAK,QAAQ;QAAE,OAAO,KAAK,CAAC,OAAO,KAAK,IAAI,CAAC;IACtE,gFAAgF;IAChF,OAAO,OAAO,KAAK,MAAM,CAAC;AAC5B,CAAC;AAED;;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;gBACvB,OAAO,EACL,sEAAsE,IAAI,KAAK;oBAC/E,sEAAsE;aACzE;SACF,CAAC;IACJ,CAAC;IACD,OAAO;QACL,SAAS;QACT,MAAM,EAAE;YACN,KAAK,EAAE,WAAW,CAAC,IAAI;YACvB,OAAO,EAAE,gFAAgF,IAAI,IAAI;SAClG;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,211 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @packageDocumentation
|
|
3
|
+
* EXT-58 — **rung-aware tool descriptions** (`docs/gaunt-sloth-2.0/approvals-and-rater-spec.md`
|
|
4
|
+
* §4.5) and the table of built-in tools the rater may offer as a granted alternative (§4.4).
|
|
5
|
+
*
|
|
6
|
+
* §4.5 is the *prevention* half of the approvals design. Shell commands are gated; built-in tools
|
|
7
|
+
* at or below the current rung are not, so a model that reaches for the shell to do something a
|
|
8
|
+
* granted built-in already does converts a free action into an interruption. A model chooses a
|
|
9
|
+
* tool by reading that tool's description, so the approvals posture is stated **there** — not as a
|
|
10
|
+
* global preference in the system prompt, which sits far from the decision and can drift out of
|
|
11
|
+
* step with the gate.
|
|
12
|
+
*
|
|
13
|
+
* Two properties are load-bearing and are why this module exists at all:
|
|
14
|
+
*
|
|
15
|
+
* 1. **A tool that is auto-approved gets NO suffix.** The absence of the sentence is what marks it
|
|
16
|
+
* free. Appending "this tool is already approved" would be the opposite of the design.
|
|
17
|
+
* 2. **The suffix is derived from the rung in force AND from the set of tools that rung actually
|
|
18
|
+
* gates.** "A description that disagrees with what the gate will actually do is worse than no
|
|
19
|
+
* description at all" (§4.5), so {@link isGrantedAtRung} takes the LIVE gated set as a parameter
|
|
20
|
+
* and both backends pass the SAME `resolveGatedToolNames` result. The two can therefore not
|
|
21
|
+
* drift: widening what a rung gates ([[EXT-30]]) widens the descriptions in the same breath.
|
|
22
|
+
* That set is narrower than the rung-independent one wired into the interrupt
|
|
23
|
+
* (`resolveInterruptToolNames`), because a call the live rung does not gate is approved on
|
|
24
|
+
* arrival and so is genuinely free.
|
|
25
|
+
*
|
|
26
|
+
* **Scope, per §4.3.** The *rater* covers the shell only: every other gated tool goes to the human
|
|
27
|
+
* without a rating call until [[EXT-30]] widens the rater. The *gate* is wider than the rater. At
|
|
28
|
+
* the two deterministic rungs (`manual`, `write`) both backends gate every bound tool the rung's
|
|
29
|
+
* access class does not auto-grant — the write built-ins, the shell, MCP tools (whatever their
|
|
30
|
+
* `readOnlyHint` says) and custom tools — so at those rungs a non-granted call always reaches the
|
|
31
|
+
* human. At `assisted`, `auto` and `bypass` the gated set is the shell alone.
|
|
32
|
+
*
|
|
33
|
+
* `config/shell-policy.ts`'s `isToolGatedAtRung` is the single rule for all of that, and both the
|
|
34
|
+
* live gated set and this module's grant are projections of it, so what a rung gates and the grant
|
|
35
|
+
* reported here cannot disagree.
|
|
36
|
+
*/
|
|
37
|
+
import type { ApprovalRung } from '#src/config/shell-policy.js';
|
|
38
|
+
/**
|
|
39
|
+
* §4.5's table, **verbatim**. The wordings are normative copy the model reads; do not paraphrase,
|
|
40
|
+
* re-punctuate or "improve" them.
|
|
41
|
+
*
|
|
42
|
+
* - `manual` and `write` share one sentence: at both rungs a non-granted call goes to the human,
|
|
43
|
+
* so the user's approval is a certainty, not a possibility.
|
|
44
|
+
* - `assisted` softens `will` to `MAY`: the rater approves what it rates safe, so only some calls
|
|
45
|
+
* reach the user.
|
|
46
|
+
* - `auto` has its own sentence, and the difference it states is real: [[EXT-29]]'s negotiation
|
|
47
|
+
* hands a call the rater will not clear back to the **model**, with the reason, so the first
|
|
48
|
+
* consequence of an unsafe-looking call there is a refusal it can answer rather than a person
|
|
49
|
+
* being asked — what changes is who answers first, and that is the one thing a model choosing a
|
|
50
|
+
* tool can act on. A shared wording would hide it in the model's own tool-selection input.
|
|
51
|
+
*
|
|
52
|
+
* Its `MAY` therefore sits **outside** the contrast the three bullets above draw: it qualifies
|
|
53
|
+
* *"be refused by the auto-rater"*, not *"require the user's approval"*, so this sentence says
|
|
54
|
+
* nothing either way about whether a person can be asked. That silence is deliberate — the
|
|
55
|
+
* string is §4.5's row verbatim — and its cost is recorded here rather than left to be
|
|
56
|
+
* discovered: `catastrophic` escalates to a human on the FIRST hit with no rounds at all, so a
|
|
57
|
+
* person *can* be reached at `auto` and this input does not say so. Silent is not false, which
|
|
58
|
+
* is why the wording stands and why the premise quoted above still holds; a wording claiming the
|
|
59
|
+
* user is never asked would be false.
|
|
60
|
+
* - `bypass` appends nothing to anything: no gate, so no sentence could be true.
|
|
61
|
+
*/
|
|
62
|
+
export declare const RUNG_TOOL_DESCRIPTION_SUFFIXES: Readonly<Record<ApprovalRung, string | null>>;
|
|
63
|
+
/**
|
|
64
|
+
* The access class of a built-in tool, in the sense §2 grants them: `read` = reading and listing
|
|
65
|
+
* files within the working folder; `write` = creating, editing, moving and deleting files within
|
|
66
|
+
* the working folder. A tool that does neither (the shell, a network fetch, an MCP call) has no
|
|
67
|
+
* class and is granted by no rung but `bypass`.
|
|
68
|
+
*/
|
|
69
|
+
export type BuiltInToolAccess = 'read' | 'write';
|
|
70
|
+
/**
|
|
71
|
+
* Access class per built-in tool name. Keyed by NAME, not by owner, so it covers gsloth's own
|
|
72
|
+
* `GthFileSystemToolkit` and the conventional filesystem names (`ls`/`glob`/`grep`, and the
|
|
73
|
+
* `read_file`/`write_file`/`edit_file` the two conventions share) that a graph builder or an MCP
|
|
74
|
+
* server may register instead. One flat table serves them all.
|
|
75
|
+
*
|
|
76
|
+
* Deliberately absent: `run_shell_command`, the fixed dev-command tools,
|
|
77
|
+
* `gth_web_fetch`, `gth_checklist`, `gth_status_update`, `show_a2ui_surface`, MCP/custom/A2A tools.
|
|
78
|
+
* None of them is "reading or writing files in the working folder", so none is granted by a rung's
|
|
79
|
+
* access class, and at `manual`/`write` every one of them escalates to the human.
|
|
80
|
+
*
|
|
81
|
+
* **An MCP tool's own `readOnlyHint` earns it nothing here.** A server's self-declared annotation is
|
|
82
|
+
* least earned exactly where the ladder is strictest, so it must not skip the prompt at those two
|
|
83
|
+
* rungs; membership of this table is the only thing that does. Adding a name here grants it at a
|
|
84
|
+
* rung, so add one only for a tool that genuinely reads or writes files in the working folder.
|
|
85
|
+
*/
|
|
86
|
+
export declare const BUILT_IN_TOOL_ACCESS: Readonly<Record<string, BuiltInToolAccess>>;
|
|
87
|
+
/** A built-in tool the rater may offer as an already-granted alternative (§4.4). */
|
|
88
|
+
export interface GrantedToolSummary {
|
|
89
|
+
/** The registered tool name, exactly as the model sees it. */
|
|
90
|
+
name: string;
|
|
91
|
+
/** One line, authored here — locally-generated trusted text (§4.3), never a tool's own blurb. */
|
|
92
|
+
description: string;
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* §4.3/§4.4 — the one-line descriptions handed to the rater with the granted tools' names.
|
|
96
|
+
*
|
|
97
|
+
* **Authored here on purpose.** §4.3 admits this list as *"trusted, locally-generated text, not
|
|
98
|
+
* part of the fenced block"*, so it may not be assembled from tool `description` fields at large:
|
|
99
|
+
* an MCP server's tool description is attacker-influenceable text, and placing it outside the
|
|
100
|
+
* fenced block would open an injection channel straight past the rater's untrusted-input preamble.
|
|
101
|
+
* Only tools named in THIS table are ever offered, so an MCP, custom or A2A tool can never
|
|
102
|
+
* contribute text to the rater prompt.
|
|
103
|
+
*
|
|
104
|
+
* Restricted to tools that could plausibly stand in for a shell command — the file tools, content
|
|
105
|
+
* search, and the fixed dev-command tools (whose command is human-authored config, so suggesting
|
|
106
|
+
* `run_tests` over `npm test` is exactly the trade this section exists to make). `gth_checklist`,
|
|
107
|
+
* `gth_status_update` and `show_a2ui_surface` are omitted: they substitute for nothing a model
|
|
108
|
+
* would otherwise shell out for, and a suggestion list is only useful while it is short.
|
|
109
|
+
*
|
|
110
|
+
* **`gth_web_fetch` is deliberately NOT here**, though it is ungated at every rung. §4.5's
|
|
111
|
+
* justification for disclosing the posture at all is that the granted tools are "by construction,
|
|
112
|
+
* the constrained ones confined to the working folder" — a network fetch is not. Offering it would
|
|
113
|
+
* let a refused `curl`/`wget` come back as a suggestion whose §7 clause tells the model, verbatim,
|
|
114
|
+
* that the alternative "will not interrupt the user": a refused egress turned into a free one,
|
|
115
|
+
* through the rater rather than through the gate. An `attack` halts before any message reaches the
|
|
116
|
+
* model, but a merely `destructive` fetch would not. Same reasoning excludes MCP and custom tools,
|
|
117
|
+
* which additionally supply text we did not author.
|
|
118
|
+
*/
|
|
119
|
+
export declare const BUILT_IN_TOOL_SUMMARIES: Readonly<Record<string, string>>;
|
|
120
|
+
/** The sentence §4.5 appends at this rung, or `null` when the rung appends nothing (`bypass`). */
|
|
121
|
+
export declare function getRungToolDescriptionSuffix(rung: ApprovalRung): string | null;
|
|
122
|
+
/**
|
|
123
|
+
* §2 — does `rung`'s own grant cover this tool's **access class**, i.e. is the tool free *on its
|
|
124
|
+
* class alone*, before anything is asked about whether the gate gates it?
|
|
125
|
+
*
|
|
126
|
+
* - `read` — granted at every rung (§2.1).
|
|
127
|
+
* - `write` — granted from `write` up (§2.2, and §2.3/§2.4 which grant "everything `write` grants"),
|
|
128
|
+
* so it escalates at `manual`.
|
|
129
|
+
* - **no class at all** — the shell, a network call, an MCP tool, a custom or
|
|
130
|
+
* agent-authored tool: granted by no rung. There is no implicit exemption; a tool is free here
|
|
131
|
+
* only by appearing in {@link BUILT_IN_TOOL_ACCESS}.
|
|
132
|
+
*
|
|
133
|
+
* **This is the one implementation of that rule.** {@link isGrantedAtRung} decides a grant with it,
|
|
134
|
+
* and `config/shell-policy.ts`'s `isToolGatedAtRung` decides gated-set membership with it — which
|
|
135
|
+
* is in turn what the backends' interrupt set and `GthAgentRunner`'s own live-rung check are built
|
|
136
|
+
* from. So the gate cannot escalate a call the descriptions and the rater's granted list call free
|
|
137
|
+
* — the drift §4.5 names as worse than having no description at all. Two derivations of one rule is
|
|
138
|
+
* exactly what this function exists to prevent; do not inline it back into either caller.
|
|
139
|
+
*
|
|
140
|
+
* `bypass` is not special-cased: it grants everything for a reason unrelated to access class (the
|
|
141
|
+
* gate is off), which {@link isGrantedAtRung} states where that belongs.
|
|
142
|
+
*/
|
|
143
|
+
export declare function isAccessClassGrantedAtRung(toolName: string, rung: ApprovalRung): boolean;
|
|
144
|
+
/**
|
|
145
|
+
* Is `toolName` auto-approved (granted, free, no prompt and no rating) at `rung`?
|
|
146
|
+
*
|
|
147
|
+
* @param toolName The registered tool name.
|
|
148
|
+
* @param rung The rung in force for the session.
|
|
149
|
+
* @param gatedTools The LIVE gated set — what `rung` actually gates, i.e.
|
|
150
|
+
* `resolveGatedToolNames` for the rung in force. **This is the parameter that keeps the
|
|
151
|
+
* descriptions honest**: a tool the rung does not gate cannot require approval, whatever a rung's
|
|
152
|
+
* table row says about tool classes, so it is granted. It is deliberately NOT the wider,
|
|
153
|
+
* rung-independent set the backends wire into `interruptOn` (`resolveInterruptToolNames`): a call
|
|
154
|
+
* the live rung does not gate is auto-approved the moment it arrives at the runner, so describing
|
|
155
|
+
* it as needing approval would be a promise nothing keeps.
|
|
156
|
+
*
|
|
157
|
+
* Order:
|
|
158
|
+
* 1. `bypass` grants everything (§2.5) — the gate is off.
|
|
159
|
+
* 2. A tool the live rung does not gate cannot require approval, so it is granted at every rung.
|
|
160
|
+
* 3. A gated tool is granted only where the rung's own grant covers its access class —
|
|
161
|
+
* {@link isAccessClassGrantedAtRung}, the same rule `resolveGatedToolNames` selects the gated set
|
|
162
|
+
* with. At the two deterministic rungs those two uses are complementary by construction: a tool
|
|
163
|
+
* is gated there precisely when this returns false, so step 3 answers false for every tool step 2
|
|
164
|
+
* let through, and the gate and the description say the same thing.
|
|
165
|
+
*/
|
|
166
|
+
export declare function isGrantedAtRung(toolName: string, rung: ApprovalRung, gatedTools: readonly string[]): boolean;
|
|
167
|
+
/**
|
|
168
|
+
* Remove a previously-appended §4.5 suffix (any rung's), returning the tool's own description.
|
|
169
|
+
*
|
|
170
|
+
* Makes {@link applyRungAwareToolDescriptions} idempotent and re-appliable at a different rung —
|
|
171
|
+
* which matters because a resolver may hand back the SAME tool instance on a re-init (an MCP
|
|
172
|
+
* client caches its tool objects), and a second pass would otherwise stack sentences.
|
|
173
|
+
*/
|
|
174
|
+
export declare function stripRungToolDescriptionSuffix(description: string): string;
|
|
175
|
+
/** The minimal shape {@link applyRungAwareToolDescriptions} needs; keeps this module langchain-free. */
|
|
176
|
+
export interface DescribableTool {
|
|
177
|
+
name?: string;
|
|
178
|
+
description?: string;
|
|
179
|
+
}
|
|
180
|
+
/**
|
|
181
|
+
* §4.5 — at tool-registration time, append the rung's sentence to the description of every tool
|
|
182
|
+
* that is NOT auto-approved at that rung, and leave every granted tool's description untouched.
|
|
183
|
+
*
|
|
184
|
+
* Mutates in place (and returns the same array): the tools are about to be handed to
|
|
185
|
+
* `createAgent`/`createDeepAgent`, and the array is freshly resolved per init. Idempotent — any
|
|
186
|
+
* previously-appended suffix is stripped first, so re-registration at a different rung replaces
|
|
187
|
+
* the sentence rather than stacking one.
|
|
188
|
+
*
|
|
189
|
+
* A tool with no name is left alone (provider-native "magic object" tools carry no name and cannot
|
|
190
|
+
* be classified); a tool with an empty description gets the suffix as its whole description rather
|
|
191
|
+
* than a leading space.
|
|
192
|
+
*/
|
|
193
|
+
export declare function applyRungAwareToolDescriptions<T extends DescribableTool>(tools: T[], options: {
|
|
194
|
+
rung: ApprovalRung;
|
|
195
|
+
gatedTools: readonly string[];
|
|
196
|
+
}): T[];
|
|
197
|
+
/**
|
|
198
|
+
* §4.3/§4.4 — the names and one-line descriptions of the built-in tools already granted at `rung`,
|
|
199
|
+
* for the rater prompt.
|
|
200
|
+
*
|
|
201
|
+
* Filtered three ways, each of which matters:
|
|
202
|
+
* - to tools **actually registered** in this session (a suggestion naming a tool the model does not
|
|
203
|
+
* have is worse than no suggestion);
|
|
204
|
+
* - to tools in {@link BUILT_IN_TOOL_SUMMARIES}, so only locally-authored text ever reaches the
|
|
205
|
+
* rater prompt (never an MCP/custom tool's own description);
|
|
206
|
+
* - to tools **granted at the rung** — suggesting a tool that would itself need approval defeats
|
|
207
|
+
* the point.
|
|
208
|
+
*
|
|
209
|
+
* Order follows the registration order so the prompt is stable across runs.
|
|
210
|
+
*/
|
|
211
|
+
export declare function describeGrantedBuiltInTools(registeredToolNames: readonly string[], rung: ApprovalRung, gatedTools: readonly string[]): GrantedToolSummary[];
|
|
@@ -0,0 +1,272 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* §4.5's table, **verbatim**. The wordings are normative copy the model reads; do not paraphrase,
|
|
3
|
+
* re-punctuate or "improve" them.
|
|
4
|
+
*
|
|
5
|
+
* - `manual` and `write` share one sentence: at both rungs a non-granted call goes to the human,
|
|
6
|
+
* so the user's approval is a certainty, not a possibility.
|
|
7
|
+
* - `assisted` softens `will` to `MAY`: the rater approves what it rates safe, so only some calls
|
|
8
|
+
* reach the user.
|
|
9
|
+
* - `auto` has its own sentence, and the difference it states is real: [[EXT-29]]'s negotiation
|
|
10
|
+
* hands a call the rater will not clear back to the **model**, with the reason, so the first
|
|
11
|
+
* consequence of an unsafe-looking call there is a refusal it can answer rather than a person
|
|
12
|
+
* being asked — what changes is who answers first, and that is the one thing a model choosing a
|
|
13
|
+
* tool can act on. A shared wording would hide it in the model's own tool-selection input.
|
|
14
|
+
*
|
|
15
|
+
* Its `MAY` therefore sits **outside** the contrast the three bullets above draw: it qualifies
|
|
16
|
+
* *"be refused by the auto-rater"*, not *"require the user's approval"*, so this sentence says
|
|
17
|
+
* nothing either way about whether a person can be asked. That silence is deliberate — the
|
|
18
|
+
* string is §4.5's row verbatim — and its cost is recorded here rather than left to be
|
|
19
|
+
* discovered: `catastrophic` escalates to a human on the FIRST hit with no rounds at all, so a
|
|
20
|
+
* person *can* be reached at `auto` and this input does not say so. Silent is not false, which
|
|
21
|
+
* is why the wording stands and why the premise quoted above still holds; a wording claiming the
|
|
22
|
+
* user is never asked would be false.
|
|
23
|
+
* - `bypass` appends nothing to anything: no gate, so no sentence could be true.
|
|
24
|
+
*/
|
|
25
|
+
export const RUNG_TOOL_DESCRIPTION_SUFFIXES = {
|
|
26
|
+
manual: "Calling this tool will require the user's approval. Only use it when the result cannot be " +
|
|
27
|
+
'achieved with the other provided tools.',
|
|
28
|
+
write: "Calling this tool will require the user's approval. Only use it when the result cannot be " +
|
|
29
|
+
'achieved with the other provided tools.',
|
|
30
|
+
assisted: "Calling this tool MAY require the user's approval if it does not look safe. Only use it when " +
|
|
31
|
+
'it is impossible to achieve the result with the other provided tools.',
|
|
32
|
+
auto: 'Calling this tool MAY be refused by the auto-rater if it does not look safe. Only use it when ' +
|
|
33
|
+
'it is impossible to achieve the result with the other provided tools.',
|
|
34
|
+
bypass: null,
|
|
35
|
+
};
|
|
36
|
+
/** The distinct suffix strings, for {@link stripRungToolDescriptionSuffix}'s idempotency check. */
|
|
37
|
+
const ALL_SUFFIXES = Array.from(new Set(Object.values(RUNG_TOOL_DESCRIPTION_SUFFIXES).filter((s) => s !== null)));
|
|
38
|
+
/**
|
|
39
|
+
* Access class per built-in tool name. Keyed by NAME, not by owner, so it covers gsloth's own
|
|
40
|
+
* `GthFileSystemToolkit` and the conventional filesystem names (`ls`/`glob`/`grep`, and the
|
|
41
|
+
* `read_file`/`write_file`/`edit_file` the two conventions share) that a graph builder or an MCP
|
|
42
|
+
* server may register instead. One flat table serves them all.
|
|
43
|
+
*
|
|
44
|
+
* Deliberately absent: `run_shell_command`, the fixed dev-command tools,
|
|
45
|
+
* `gth_web_fetch`, `gth_checklist`, `gth_status_update`, `show_a2ui_surface`, MCP/custom/A2A tools.
|
|
46
|
+
* None of them is "reading or writing files in the working folder", so none is granted by a rung's
|
|
47
|
+
* access class, and at `manual`/`write` every one of them escalates to the human.
|
|
48
|
+
*
|
|
49
|
+
* **An MCP tool's own `readOnlyHint` earns it nothing here.** A server's self-declared annotation is
|
|
50
|
+
* least earned exactly where the ladder is strictest, so it must not skip the prompt at those two
|
|
51
|
+
* rungs; membership of this table is the only thing that does. Adding a name here grants it at a
|
|
52
|
+
* rung, so add one only for a tool that genuinely reads or writes files in the working folder.
|
|
53
|
+
*/
|
|
54
|
+
export const BUILT_IN_TOOL_ACCESS = {
|
|
55
|
+
// gsloth GthFileSystemToolkit (lean backend)
|
|
56
|
+
read_file: 'read',
|
|
57
|
+
read_multiple_files: 'read',
|
|
58
|
+
gth_read_binary: 'read',
|
|
59
|
+
list_directory: 'read',
|
|
60
|
+
list_directory_with_sizes: 'read',
|
|
61
|
+
directory_tree: 'read',
|
|
62
|
+
search_files: 'read',
|
|
63
|
+
get_file_info: 'read',
|
|
64
|
+
list_allowed_directories: 'read',
|
|
65
|
+
write_file: 'write',
|
|
66
|
+
edit_file: 'write',
|
|
67
|
+
create_directory: 'write',
|
|
68
|
+
move_file: 'write',
|
|
69
|
+
delete_file: 'write',
|
|
70
|
+
delete_directory: 'write',
|
|
71
|
+
// Conventional filesystem read names not already listed above
|
|
72
|
+
ls: 'read',
|
|
73
|
+
glob: 'read',
|
|
74
|
+
grep: 'read',
|
|
75
|
+
// gsloth built-ins that read file contents in the working folder
|
|
76
|
+
gth_grep: 'read',
|
|
77
|
+
};
|
|
78
|
+
/**
|
|
79
|
+
* §4.3/§4.4 — the one-line descriptions handed to the rater with the granted tools' names.
|
|
80
|
+
*
|
|
81
|
+
* **Authored here on purpose.** §4.3 admits this list as *"trusted, locally-generated text, not
|
|
82
|
+
* part of the fenced block"*, so it may not be assembled from tool `description` fields at large:
|
|
83
|
+
* an MCP server's tool description is attacker-influenceable text, and placing it outside the
|
|
84
|
+
* fenced block would open an injection channel straight past the rater's untrusted-input preamble.
|
|
85
|
+
* Only tools named in THIS table are ever offered, so an MCP, custom or A2A tool can never
|
|
86
|
+
* contribute text to the rater prompt.
|
|
87
|
+
*
|
|
88
|
+
* Restricted to tools that could plausibly stand in for a shell command — the file tools, content
|
|
89
|
+
* search, and the fixed dev-command tools (whose command is human-authored config, so suggesting
|
|
90
|
+
* `run_tests` over `npm test` is exactly the trade this section exists to make). `gth_checklist`,
|
|
91
|
+
* `gth_status_update` and `show_a2ui_surface` are omitted: they substitute for nothing a model
|
|
92
|
+
* would otherwise shell out for, and a suggestion list is only useful while it is short.
|
|
93
|
+
*
|
|
94
|
+
* **`gth_web_fetch` is deliberately NOT here**, though it is ungated at every rung. §4.5's
|
|
95
|
+
* justification for disclosing the posture at all is that the granted tools are "by construction,
|
|
96
|
+
* the constrained ones confined to the working folder" — a network fetch is not. Offering it would
|
|
97
|
+
* let a refused `curl`/`wget` come back as a suggestion whose §7 clause tells the model, verbatim,
|
|
98
|
+
* that the alternative "will not interrupt the user": a refused egress turned into a free one,
|
|
99
|
+
* through the rater rather than through the gate. An `attack` halts before any message reaches the
|
|
100
|
+
* model, but a merely `destructive` fetch would not. Same reasoning excludes MCP and custom tools,
|
|
101
|
+
* which additionally supply text we did not author.
|
|
102
|
+
*/
|
|
103
|
+
export const BUILT_IN_TOOL_SUMMARIES = {
|
|
104
|
+
read_file: 'Read one file in the working folder.',
|
|
105
|
+
read_multiple_files: 'Read several files in the working folder in one call.',
|
|
106
|
+
gth_read_binary: 'Read an image or other binary file in the working folder.',
|
|
107
|
+
list_directory: 'List the entries of a directory in the working folder.',
|
|
108
|
+
list_directory_with_sizes: 'List a directory in the working folder with entry sizes.',
|
|
109
|
+
directory_tree: 'Show a recursive tree of a directory in the working folder.',
|
|
110
|
+
search_files: 'Find files in the working folder by name pattern.',
|
|
111
|
+
get_file_info: 'Show size, timestamps and type of a file in the working folder.',
|
|
112
|
+
list_allowed_directories: 'List the directories the file tools are allowed to touch.',
|
|
113
|
+
write_file: 'Create or overwrite a file in the working folder.',
|
|
114
|
+
edit_file: 'Apply a targeted edit to a file in the working folder.',
|
|
115
|
+
create_directory: 'Create a directory in the working folder.',
|
|
116
|
+
move_file: 'Move or rename a file in the working folder.',
|
|
117
|
+
delete_file: 'Delete a file in the working folder.',
|
|
118
|
+
delete_directory: 'Delete a directory in the working folder.',
|
|
119
|
+
ls: 'List the entries of a directory in the working folder.',
|
|
120
|
+
glob: 'Find files in the working folder by glob pattern.',
|
|
121
|
+
grep: 'Search file contents in the working folder by regular expression.',
|
|
122
|
+
gth_grep: 'Search file contents in the working folder by regular expression.',
|
|
123
|
+
run_tests: "Run the project's configured test command.",
|
|
124
|
+
run_single_test: "Run one test file with the project's configured test command.",
|
|
125
|
+
run_lint: "Run the project's configured lint command.",
|
|
126
|
+
run_build: "Run the project's configured build command.",
|
|
127
|
+
};
|
|
128
|
+
/** The sentence §4.5 appends at this rung, or `null` when the rung appends nothing (`bypass`). */
|
|
129
|
+
export function getRungToolDescriptionSuffix(rung) {
|
|
130
|
+
return RUNG_TOOL_DESCRIPTION_SUFFIXES[rung] ?? null;
|
|
131
|
+
}
|
|
132
|
+
/**
|
|
133
|
+
* §2 — does `rung`'s own grant cover this tool's **access class**, i.e. is the tool free *on its
|
|
134
|
+
* class alone*, before anything is asked about whether the gate gates it?
|
|
135
|
+
*
|
|
136
|
+
* - `read` — granted at every rung (§2.1).
|
|
137
|
+
* - `write` — granted from `write` up (§2.2, and §2.3/§2.4 which grant "everything `write` grants"),
|
|
138
|
+
* so it escalates at `manual`.
|
|
139
|
+
* - **no class at all** — the shell, a network call, an MCP tool, a custom or
|
|
140
|
+
* agent-authored tool: granted by no rung. There is no implicit exemption; a tool is free here
|
|
141
|
+
* only by appearing in {@link BUILT_IN_TOOL_ACCESS}.
|
|
142
|
+
*
|
|
143
|
+
* **This is the one implementation of that rule.** {@link isGrantedAtRung} decides a grant with it,
|
|
144
|
+
* and `config/shell-policy.ts`'s `isToolGatedAtRung` decides gated-set membership with it — which
|
|
145
|
+
* is in turn what the backends' interrupt set and `GthAgentRunner`'s own live-rung check are built
|
|
146
|
+
* from. So the gate cannot escalate a call the descriptions and the rater's granted list call free
|
|
147
|
+
* — the drift §4.5 names as worse than having no description at all. Two derivations of one rule is
|
|
148
|
+
* exactly what this function exists to prevent; do not inline it back into either caller.
|
|
149
|
+
*
|
|
150
|
+
* `bypass` is not special-cased: it grants everything for a reason unrelated to access class (the
|
|
151
|
+
* gate is off), which {@link isGrantedAtRung} states where that belongs.
|
|
152
|
+
*/
|
|
153
|
+
export function isAccessClassGrantedAtRung(toolName, rung) {
|
|
154
|
+
const access = BUILT_IN_TOOL_ACCESS[toolName];
|
|
155
|
+
if (access === 'read')
|
|
156
|
+
return true;
|
|
157
|
+
if (access === 'write')
|
|
158
|
+
return rung !== 'manual';
|
|
159
|
+
return false;
|
|
160
|
+
}
|
|
161
|
+
/**
|
|
162
|
+
* Is `toolName` auto-approved (granted, free, no prompt and no rating) at `rung`?
|
|
163
|
+
*
|
|
164
|
+
* @param toolName The registered tool name.
|
|
165
|
+
* @param rung The rung in force for the session.
|
|
166
|
+
* @param gatedTools The LIVE gated set — what `rung` actually gates, i.e.
|
|
167
|
+
* `resolveGatedToolNames` for the rung in force. **This is the parameter that keeps the
|
|
168
|
+
* descriptions honest**: a tool the rung does not gate cannot require approval, whatever a rung's
|
|
169
|
+
* table row says about tool classes, so it is granted. It is deliberately NOT the wider,
|
|
170
|
+
* rung-independent set the backends wire into `interruptOn` (`resolveInterruptToolNames`): a call
|
|
171
|
+
* the live rung does not gate is auto-approved the moment it arrives at the runner, so describing
|
|
172
|
+
* it as needing approval would be a promise nothing keeps.
|
|
173
|
+
*
|
|
174
|
+
* Order:
|
|
175
|
+
* 1. `bypass` grants everything (§2.5) — the gate is off.
|
|
176
|
+
* 2. A tool the live rung does not gate cannot require approval, so it is granted at every rung.
|
|
177
|
+
* 3. A gated tool is granted only where the rung's own grant covers its access class —
|
|
178
|
+
* {@link isAccessClassGrantedAtRung}, the same rule `resolveGatedToolNames` selects the gated set
|
|
179
|
+
* with. At the two deterministic rungs those two uses are complementary by construction: a tool
|
|
180
|
+
* is gated there precisely when this returns false, so step 3 answers false for every tool step 2
|
|
181
|
+
* let through, and the gate and the description say the same thing.
|
|
182
|
+
*/
|
|
183
|
+
export function isGrantedAtRung(toolName, rung, gatedTools) {
|
|
184
|
+
if (rung === 'bypass')
|
|
185
|
+
return true;
|
|
186
|
+
if (!gatedTools.includes(toolName))
|
|
187
|
+
return true;
|
|
188
|
+
return isAccessClassGrantedAtRung(toolName, rung);
|
|
189
|
+
}
|
|
190
|
+
/**
|
|
191
|
+
* Remove a previously-appended §4.5 suffix (any rung's), returning the tool's own description.
|
|
192
|
+
*
|
|
193
|
+
* Makes {@link applyRungAwareToolDescriptions} idempotent and re-appliable at a different rung —
|
|
194
|
+
* which matters because a resolver may hand back the SAME tool instance on a re-init (an MCP
|
|
195
|
+
* client caches its tool objects), and a second pass would otherwise stack sentences.
|
|
196
|
+
*/
|
|
197
|
+
export function stripRungToolDescriptionSuffix(description) {
|
|
198
|
+
let result = description;
|
|
199
|
+
// Loop: a description that was appended to twice by an older build still ends up clean.
|
|
200
|
+
let changed = true;
|
|
201
|
+
while (changed) {
|
|
202
|
+
changed = false;
|
|
203
|
+
for (const suffix of ALL_SUFFIXES) {
|
|
204
|
+
if (result.endsWith(suffix)) {
|
|
205
|
+
result = result.slice(0, -suffix.length).replace(/\s+$/, '');
|
|
206
|
+
changed = true;
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
return result;
|
|
211
|
+
}
|
|
212
|
+
/**
|
|
213
|
+
* §4.5 — at tool-registration time, append the rung's sentence to the description of every tool
|
|
214
|
+
* that is NOT auto-approved at that rung, and leave every granted tool's description untouched.
|
|
215
|
+
*
|
|
216
|
+
* Mutates in place (and returns the same array): the tools are about to be handed to
|
|
217
|
+
* `createAgent`/`createDeepAgent`, and the array is freshly resolved per init. Idempotent — any
|
|
218
|
+
* previously-appended suffix is stripped first, so re-registration at a different rung replaces
|
|
219
|
+
* the sentence rather than stacking one.
|
|
220
|
+
*
|
|
221
|
+
* A tool with no name is left alone (provider-native "magic object" tools carry no name and cannot
|
|
222
|
+
* be classified); a tool with an empty description gets the suffix as its whole description rather
|
|
223
|
+
* than a leading space.
|
|
224
|
+
*/
|
|
225
|
+
export function applyRungAwareToolDescriptions(tools, options) {
|
|
226
|
+
const suffix = getRungToolDescriptionSuffix(options.rung);
|
|
227
|
+
for (const tool of tools) {
|
|
228
|
+
if (!tool || typeof tool.name !== 'string' || tool.name.length === 0)
|
|
229
|
+
continue;
|
|
230
|
+
if (typeof tool.description !== 'string')
|
|
231
|
+
continue;
|
|
232
|
+
const base = stripRungToolDescriptionSuffix(tool.description);
|
|
233
|
+
// A granted tool carries NO sentence — its absence is what marks it free (§4.5).
|
|
234
|
+
if (suffix === null || isGrantedAtRung(tool.name, options.rung, options.gatedTools)) {
|
|
235
|
+
tool.description = base;
|
|
236
|
+
continue;
|
|
237
|
+
}
|
|
238
|
+
tool.description = base.length > 0 ? `${base} ${suffix}` : suffix;
|
|
239
|
+
}
|
|
240
|
+
return tools;
|
|
241
|
+
}
|
|
242
|
+
/**
|
|
243
|
+
* §4.3/§4.4 — the names and one-line descriptions of the built-in tools already granted at `rung`,
|
|
244
|
+
* for the rater prompt.
|
|
245
|
+
*
|
|
246
|
+
* Filtered three ways, each of which matters:
|
|
247
|
+
* - to tools **actually registered** in this session (a suggestion naming a tool the model does not
|
|
248
|
+
* have is worse than no suggestion);
|
|
249
|
+
* - to tools in {@link BUILT_IN_TOOL_SUMMARIES}, so only locally-authored text ever reaches the
|
|
250
|
+
* rater prompt (never an MCP/custom tool's own description);
|
|
251
|
+
* - to tools **granted at the rung** — suggesting a tool that would itself need approval defeats
|
|
252
|
+
* the point.
|
|
253
|
+
*
|
|
254
|
+
* Order follows the registration order so the prompt is stable across runs.
|
|
255
|
+
*/
|
|
256
|
+
export function describeGrantedBuiltInTools(registeredToolNames, rung, gatedTools) {
|
|
257
|
+
const seen = new Set();
|
|
258
|
+
const summaries = [];
|
|
259
|
+
for (const name of registeredToolNames) {
|
|
260
|
+
if (seen.has(name))
|
|
261
|
+
continue;
|
|
262
|
+
seen.add(name);
|
|
263
|
+
const description = BUILT_IN_TOOL_SUMMARIES[name];
|
|
264
|
+
if (!description)
|
|
265
|
+
continue;
|
|
266
|
+
if (!isGrantedAtRung(name, rung, gatedTools))
|
|
267
|
+
continue;
|
|
268
|
+
summaries.push({ name, description });
|
|
269
|
+
}
|
|
270
|
+
return summaries;
|
|
271
|
+
}
|
|
272
|
+
//# sourceMappingURL=tool-descriptions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tool-descriptions.js","sourceRoot":"","sources":["../../src/config/tool-descriptions.ts"],"names":[],"mappings":"AAsCA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,MAAM,CAAC,MAAM,8BAA8B,GAAkD;IAC3F,MAAM,EACJ,4FAA4F;QAC5F,yCAAyC;IAC3C,KAAK,EACH,4FAA4F;QAC5F,yCAAyC;IAC3C,QAAQ,EACN,+FAA+F;QAC/F,uEAAuE;IACzE,IAAI,EACF,gGAAgG;QAChG,uEAAuE;IACzE,MAAM,EAAE,IAAI;CACb,CAAC;AAEF,mGAAmG;AACnG,MAAM,YAAY,GAAsB,KAAK,CAAC,IAAI,CAChD,IAAI,GAAG,CAAC,MAAM,CAAC,MAAM,CAAC,8BAA8B,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAe,EAAE,CAAC,CAAC,KAAK,IAAI,CAAC,CAAC,CAC9F,CAAC;AAUF;;;;;;;;;;;;;;;GAeG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAgD;IAC/E,6CAA6C;IAC7C,SAAS,EAAE,MAAM;IACjB,mBAAmB,EAAE,MAAM;IAC3B,eAAe,EAAE,MAAM;IACvB,cAAc,EAAE,MAAM;IACtB,yBAAyB,EAAE,MAAM;IACjC,cAAc,EAAE,MAAM;IACtB,YAAY,EAAE,MAAM;IACpB,aAAa,EAAE,MAAM;IACrB,wBAAwB,EAAE,MAAM;IAChC,UAAU,EAAE,OAAO;IACnB,SAAS,EAAE,OAAO;IAClB,gBAAgB,EAAE,OAAO;IACzB,SAAS,EAAE,OAAO;IAClB,WAAW,EAAE,OAAO;IACpB,gBAAgB,EAAE,OAAO;IACzB,8DAA8D;IAC9D,EAAE,EAAE,MAAM;IACV,IAAI,EAAE,MAAM;IACZ,IAAI,EAAE,MAAM;IACZ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