@gaunt-sloth/core 2.0.0-alpha.34 → 2.0.0-alpha.36

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.
Files changed (92) hide show
  1. package/dist/config/configDiscovery.d.ts +79 -0
  2. package/dist/config/configDiscovery.js +80 -0
  3. package/dist/config/configDiscovery.js.map +1 -0
  4. package/dist/config/loader.d.ts +6 -5
  5. package/dist/config/loader.js +229 -92
  6. package/dist/config/loader.js.map +1 -1
  7. package/dist/config/schema.d.ts +3 -2
  8. package/dist/config/schema.js +57 -9
  9. package/dist/config/schema.js.map +1 -1
  10. package/dist/config/shell-policy.d.ts +58 -26
  11. package/dist/config/shell-policy.js +60 -27
  12. package/dist/config/shell-policy.js.map +1 -1
  13. package/dist/config/tool-descriptions.d.ts +6 -6
  14. package/dist/config/tool-descriptions.js +7 -7
  15. package/dist/config/tool-descriptions.js.map +1 -1
  16. package/dist/config/types.d.ts +34 -31
  17. package/dist/config/types.js.map +1 -1
  18. package/dist/config.d.ts +3 -0
  19. package/dist/config.js +3 -0
  20. package/dist/config.js.map +1 -1
  21. package/dist/core/GthAbstractAgent.d.ts +11 -13
  22. package/dist/core/GthAbstractAgent.js +9 -11
  23. package/dist/core/GthAbstractAgent.js.map +1 -1
  24. package/dist/core/GthAgentRunner.d.ts +17 -33
  25. package/dist/core/GthAgentRunner.js +31 -41
  26. package/dist/core/GthAgentRunner.js.map +1 -1
  27. package/dist/core/GthLangChainAgent.js +25 -34
  28. package/dist/core/GthLangChainAgent.js.map +1 -1
  29. package/dist/core/approvals/toolAnnotationSources.d.ts +4 -4
  30. package/dist/core/approvals/toolAnnotationSources.js +8 -8
  31. package/dist/core/debugCapture.d.ts +2 -3
  32. package/dist/core/debugCapture.js +1 -2
  33. package/dist/core/debugCapture.js.map +1 -1
  34. package/dist/core/gthLeanAgentFactory.d.ts +4 -4
  35. package/dist/core/gthLeanAgentFactory.js +4 -4
  36. package/dist/core/reasoningBlocks.d.ts +7 -2
  37. package/dist/core/reasoningBlocks.js +7 -2
  38. package/dist/core/reasoningBlocks.js.map +1 -1
  39. package/dist/core/shell/ShellCommandFailedError.d.ts +3 -4
  40. package/dist/core/shell/ShellCommandFailedError.js +3 -4
  41. package/dist/core/shell/ShellCommandFailedError.js.map +1 -1
  42. package/dist/core/shell/approvalStop.d.ts +68 -29
  43. package/dist/core/shell/approvalStop.js +178 -28
  44. package/dist/core/shell/approvalStop.js.map +1 -1
  45. package/dist/core/shell/hardline.d.ts +22 -0
  46. package/dist/core/shell/hardline.js +81 -0
  47. package/dist/core/shell/hardline.js.map +1 -1
  48. package/dist/core/shell/negotiation.d.ts +81 -2
  49. package/dist/core/shell/negotiation.js +144 -11
  50. package/dist/core/shell/negotiation.js.map +1 -1
  51. package/dist/core/shell/rater.d.ts +7 -69
  52. package/dist/core/shell/rater.js +5 -24
  53. package/dist/core/shell/rater.js.map +1 -1
  54. package/dist/core/shell/raterVocabulary.d.ts +119 -0
  55. package/dist/core/shell/raterVocabulary.js +114 -0
  56. package/dist/core/shell/raterVocabulary.js.map +1 -0
  57. package/dist/core/types.d.ts +17 -3
  58. package/dist/providers/anthropic.js +12 -0
  59. package/dist/providers/anthropic.js.map +1 -1
  60. package/dist/providers/configurationPassthrough.d.ts +107 -0
  61. package/dist/providers/configurationPassthrough.js +148 -0
  62. package/dist/providers/configurationPassthrough.js.map +1 -0
  63. package/dist/providers/geminiThinking.d.ts +8 -0
  64. package/dist/providers/geminiThinking.js +33 -13
  65. package/dist/providers/geminiThinking.js.map +1 -1
  66. package/dist/providers/google-genai.js +11 -0
  67. package/dist/providers/google-genai.js.map +1 -1
  68. package/dist/providers/groq.js +12 -0
  69. package/dist/providers/groq.js.map +1 -1
  70. package/dist/providers/ollama.js +12 -0
  71. package/dist/providers/ollama.js.map +1 -1
  72. package/dist/providers/openrouter.d.ts +23 -0
  73. package/dist/providers/openrouter.js +71 -4
  74. package/dist/providers/openrouter.js.map +1 -1
  75. package/dist/providers/vertexai.js +12 -0
  76. package/dist/providers/vertexai.js.map +1 -1
  77. package/dist/providers/xai.js +20 -0
  78. package/dist/providers/xai.js.map +1 -1
  79. package/dist/runtime/conversation.d.ts +2 -2
  80. package/dist/runtime/conversation.js +19 -4
  81. package/dist/runtime/conversation.js.map +1 -1
  82. package/dist/runtime/singleShot.d.ts +2 -3
  83. package/dist/runtime/singleShot.js +22 -7
  84. package/dist/runtime/singleShot.js.map +1 -1
  85. package/dist/utils/systemPromptNotes.d.ts +17 -20
  86. package/dist/utils/systemPromptNotes.js +22 -24
  87. package/dist/utils/systemPromptNotes.js.map +1 -1
  88. package/dist/utils/untrustedText.d.ts +24 -4
  89. package/dist/utils/untrustedText.js +25 -4
  90. package/dist/utils/untrustedText.js.map +1 -1
  91. package/package.json +4 -4
  92. package/schema/gsloth-config.schema.json +0 -1
@@ -36,14 +36,34 @@ export declare const QUOTED_COMMAND_FENCE_END = "[END QUOTED COMMAND TEXT]";
36
36
  export declare const QUOTED_COMMAND_MAX_CHARS = 2000;
37
37
  /** Appended when {@link QUOTED_COMMAND_MAX_CHARS} actually clipped the quoted command. */
38
38
  export declare const QUOTED_COMMAND_TRUNCATION_MARKER = "\u2026 [truncated]";
39
+ /**
40
+ * [[EXT-46]] — the fence the ACP server quotes a prompt's non-text content blocks inside, emitted by
41
+ * `@gaunt-sloth/agent`'s `modules/acp/acpAgentApp.ts`.
42
+ *
43
+ * An ACP client attaches content blocks to a prompt, and the ones that are not the user's own typed
44
+ * text carry values the user did not author: a resource link's `name`, `uri` and `description` come
45
+ * from the editor, the filesystem or an MCP server, and a block's `type` is an arbitrary client
46
+ * string by the v2 schema. The agent has to tell the model that something was attached — dropping it
47
+ * silently is worse — so those values are quoted into the same message as the user's words, which is
48
+ * the situation this module exists for.
49
+ */
50
+ export declare const ACP_ATTACHMENT_FENCE_BEGIN = "[BEGIN CLIENT-PROVIDED ATTACHMENT]";
51
+ export declare const ACP_ATTACHMENT_FENCE_END = "[END CLIENT-PROVIDED ATTACHMENT]";
52
+ /**
53
+ * How much of one attachment FIELD is quoted. These are metadata (a file name, a URI, a one-line
54
+ * description), not documents, so this is generous rather than a limit anything real should reach.
55
+ */
56
+ export declare const ACP_ATTACHMENT_FIELD_MAX_CHARS = 1000;
57
+ /** Appended when {@link ACP_ATTACHMENT_FIELD_MAX_CHARS} actually clipped a field. */
58
+ export declare const ACP_ATTACHMENT_TRUNCATION_MARKER = "\u2026 [truncated]";
39
59
  /**
40
60
  * Neutralize every structural delimiter this codebase emits, inside UNTRUSTED text.
41
61
  *
42
62
  * The text is fully attacker-influenceable, so it may forge:
43
- * - either fence's tokens (`[BEGIN|END MCP SERVER-PROVIDED CONTEXT]`,
44
- * `[BEGIN|END QUOTED COMMAND TEXT]`) — the bracket run is collapsed so they can no longer be
45
- * read as the real delimiter, while staying legible to a reader who wants to see what was
46
- * attempted; and
63
+ * - any fence's tokens (`[BEGIN|END MCP SERVER-PROVIDED CONTEXT]`,
64
+ * `[BEGIN|END QUOTED COMMAND TEXT]`, `[BEGIN|END CLIENT-PROVIDED ATTACHMENT]`) — the bracket run
65
+ * is collapsed so they can no longer be read as the real delimiter, while staying legible to a
66
+ * reader who wants to see what was attempted; and
47
67
  * - a per-server label line `--- Server: …` (EXT-32) — the leading `---` run is broken so it
48
68
  * cannot masquerade as one of ours.
49
69
  *
@@ -36,14 +36,34 @@ export const QUOTED_COMMAND_FENCE_END = '[END QUOTED COMMAND TEXT]';
36
36
  export const QUOTED_COMMAND_MAX_CHARS = 2000;
37
37
  /** Appended when {@link QUOTED_COMMAND_MAX_CHARS} actually clipped the quoted command. */
38
38
  export const QUOTED_COMMAND_TRUNCATION_MARKER = '… [truncated]';
39
+ /**
40
+ * [[EXT-46]] — the fence the ACP server quotes a prompt's non-text content blocks inside, emitted by
41
+ * `@gaunt-sloth/agent`'s `modules/acp/acpAgentApp.ts`.
42
+ *
43
+ * An ACP client attaches content blocks to a prompt, and the ones that are not the user's own typed
44
+ * text carry values the user did not author: a resource link's `name`, `uri` and `description` come
45
+ * from the editor, the filesystem or an MCP server, and a block's `type` is an arbitrary client
46
+ * string by the v2 schema. The agent has to tell the model that something was attached — dropping it
47
+ * silently is worse — so those values are quoted into the same message as the user's words, which is
48
+ * the situation this module exists for.
49
+ */
50
+ export const ACP_ATTACHMENT_FENCE_BEGIN = '[BEGIN CLIENT-PROVIDED ATTACHMENT]';
51
+ export const ACP_ATTACHMENT_FENCE_END = '[END CLIENT-PROVIDED ATTACHMENT]';
52
+ /**
53
+ * How much of one attachment FIELD is quoted. These are metadata (a file name, a URI, a one-line
54
+ * description), not documents, so this is generous rather than a limit anything real should reach.
55
+ */
56
+ export const ACP_ATTACHMENT_FIELD_MAX_CHARS = 1000;
57
+ /** Appended when {@link ACP_ATTACHMENT_FIELD_MAX_CHARS} actually clipped a field. */
58
+ export const ACP_ATTACHMENT_TRUNCATION_MARKER = '… [truncated]';
39
59
  /**
40
60
  * Neutralize every structural delimiter this codebase emits, inside UNTRUSTED text.
41
61
  *
42
62
  * The text is fully attacker-influenceable, so it may forge:
43
- * - either fence's tokens (`[BEGIN|END MCP SERVER-PROVIDED CONTEXT]`,
44
- * `[BEGIN|END QUOTED COMMAND TEXT]`) — the bracket run is collapsed so they can no longer be
45
- * read as the real delimiter, while staying legible to a reader who wants to see what was
46
- * attempted; and
63
+ * - any fence's tokens (`[BEGIN|END MCP SERVER-PROVIDED CONTEXT]`,
64
+ * `[BEGIN|END QUOTED COMMAND TEXT]`, `[BEGIN|END CLIENT-PROVIDED ATTACHMENT]`) — the bracket run
65
+ * is collapsed so they can no longer be read as the real delimiter, while staying legible to a
66
+ * reader who wants to see what was attempted; and
47
67
  * - a per-server label line `--- Server: …` (EXT-32) — the leading `---` run is broken so it
48
68
  * cannot masquerade as one of ours.
49
69
  *
@@ -58,6 +78,7 @@ export function defangUntrustedDelimiters(text) {
58
78
  return text
59
79
  .replace(/\[\s*(BEGIN|END)\s+MCP\s+SERVER-PROVIDED\s+CONTEXT\s*\]/gi, (_m, kw) => `(server text: ${kw.toUpperCase()} MCP SERVER-PROVIDED CONTEXT)`)
60
80
  .replace(/\[\s*(BEGIN|END)\s+QUOTED\s+COMMAND\s+TEXT\s*\]/gi, (_m, kw) => `(quoted text: ${kw.toUpperCase()} QUOTED COMMAND TEXT)`)
81
+ .replace(/\[\s*(BEGIN|END)\s+CLIENT-PROVIDED\s+ATTACHMENT\s*\]/gi, (_m, kw) => `(client text: ${kw.toUpperCase()} CLIENT-PROVIDED ATTACHMENT)`)
61
82
  .replace(/-{3,}(\s*Server\s*:)/gi, '- - -$1');
62
83
  }
63
84
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"untrustedText.js","sourceRoot":"","sources":["../../src/utils/untrustedText.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,8FAA8F;AAC9F,MAAM,CAAC,MAAM,eAAe,GAAG,qCAAqC,CAAC;AACrE,MAAM,CAAC,MAAM,aAAa,GAAG,mCAAmC,CAAC;AAEjE;;;;;GAKG;AACH,MAAM,CAAC,MAAM,0BAA0B,GAAG,6BAA6B,CAAC;AACxE,MAAM,CAAC,MAAM,wBAAwB,GAAG,2BAA2B,CAAC;AAEpE,kGAAkG;AAClG,MAAM,CAAC,MAAM,wBAAwB,GAAG,IAAI,CAAC;AAE7C,0FAA0F;AAC1F,MAAM,CAAC,MAAM,gCAAgC,GAAG,eAAe,CAAC;AAEhE;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,UAAU,yBAAyB,CAAC,IAAY;IACpD,OAAO,IAAI;SACR,OAAO,CACN,2DAA2D,EAC3D,CAAC,EAAE,EAAE,EAAU,EAAE,EAAE,CAAC,iBAAiB,EAAE,CAAC,WAAW,EAAE,+BAA+B,CACrF;SACA,OAAO,CACN,mDAAmD,EACnD,CAAC,EAAE,EAAE,EAAU,EAAE,EAAE,CAAC,iBAAiB,EAAE,CAAC,WAAW,EAAE,uBAAuB,CAC7E;SACA,OAAO,CAAC,wBAAwB,EAAE,SA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AAM,gCAAgC,GAAG,eAAe,CAAC;AAEhE;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,UAAU,yBAAyB,CAAC,IAAY;IACpD,OAAO,IAAI;SACR,OAAO,CACN,2DAA2D,EAC3D,CAAC,EAAE,EAAE,EAAU,EAAE,EAAE,CAAC,iBAAiB,EAAE,CAAC,WAAW,EAAE,+BAA+B,CACrF;SACA,OAAO,CACN,mDAAmD,EACnD,CAAC,EAAE,EAAE,EAAU,EAAE,EAAE,CAAC,iBAAiB,EAAE,CAAC,WAAW,EAAE,uBAAuB,CAC7E;SACA,OAAO,CACN,wDAAwD,EACxD,CAAC,EAAE,EAAE,EAAU,EAAE,EAAE,CAAC,iBAAiB,EAAE,CAAC,WAAW,EAAE,8BAA8B,CACpF;SACA,OAAO,CAAC,wBAAwB,EAAE,SAAS,CAAC,CAAC;AAClD,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,gBAAgB,CAAC,IAAY,EAAE,QAAgB,EAAE,MAAc;IAC7E,IAAI,IAAI,CAAC,MAAM,IAAI,QAAQ;QAAE,OAAO,IAAI,CAAC;IACzC,IAAI,GAAG,GAAG,QAAQ,CAAC;IACnB,MAAM,IAAI,GAAG,IAAI,CAAC,UAAU,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC;IACtC,IAAI,IAAI,IAAI,MAAM,IAAI,IAAI,IAAI,MAAM;QAAE,GAAG,IAAI,CAAC,CAAC,CAAC,+BAA+B;IAC/E,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC,OAAO,EAAE,KAAK,MAAM,EAAE,CAAC;AACtD,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gaunt-sloth/core",
3
- "version": "2.0.0-alpha.34",
3
+ "version": "2.0.0-alpha.36",
4
4
  "description": "Core utilities and types for Gaunt Sloth",
5
5
  "license": "MIT",
6
6
  "author": "Andrew Kondratev",
@@ -30,11 +30,11 @@
30
30
  "#src/*.js": "./dist/*.js"
31
31
  },
32
32
  "dependencies": {
33
- "@langchain/core": "^1.2.3",
34
- "@langchain/langgraph": "^1.4.8",
33
+ "@langchain/core": "^1.2.5",
34
+ "@langchain/langgraph": "^1.4.9",
35
35
  "jiti": "^2.7.0",
36
36
  "jsonc-parser": "^3.3.1",
37
- "langchain": "^1.5.4",
37
+ "langchain": "^1.5.5",
38
38
  "string-width": "^8.2.2",
39
39
  "zod": "^4.4.3"
40
40
  },
@@ -36,7 +36,6 @@
36
36
  "backend": {
37
37
  "type": "string",
38
38
  "enum": [
39
- "deep",
40
39
  "lean"
41
40
  ]
42
41
  }