@stigmer/sdk 3.35.0 → 3.36.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.
Files changed (342) hide show
  1. package/activity.d.ts.map +1 -1
  2. package/activity.js.map +1 -1
  3. package/artifact-routing.d.ts.map +1 -1
  4. package/artifact-routing.js.map +1 -1
  5. package/authorization-config.d.ts.map +1 -1
  6. package/authorization-config.js.map +1 -1
  7. package/billing.d.ts.map +1 -1
  8. package/billing.js.map +1 -1
  9. package/config.d.ts.map +1 -1
  10. package/config.js.map +1 -1
  11. package/cursor-accounts.d.ts.map +1 -1
  12. package/cursor-accounts.js.map +1 -1
  13. package/ensure-identity-account.d.ts.map +1 -1
  14. package/ensure-identity-account.js.map +1 -1
  15. package/errors.d.ts.map +1 -1
  16. package/errors.js.map +1 -1
  17. package/execution/approval-provenance.d.ts.map +1 -1
  18. package/execution/approval-provenance.js.map +1 -1
  19. package/execution/conversation-rules.d.ts.map +1 -1
  20. package/execution/conversation-rules.js.map +1 -1
  21. package/execution/execution-phases.d.ts.map +1 -1
  22. package/execution/execution-phases.js.map +1 -1
  23. package/execution/file-review-fold.d.ts.map +1 -1
  24. package/execution/file-review-fold.js.map +1 -1
  25. package/execution/to-display-file-change.d.ts.map +1 -1
  26. package/execution/to-display-file-change.js.map +1 -1
  27. package/execution/tool-view.d.ts.map +1 -1
  28. package/execution/tool-view.js.map +1 -1
  29. package/execution/transcript.d.ts.map +1 -1
  30. package/execution/transcript.js.map +1 -1
  31. package/gen/agent.d.ts.map +1 -1
  32. package/gen/agent.js.map +1 -1
  33. package/gen/agentchannel.d.ts.map +1 -1
  34. package/gen/agentchannel.js.map +1 -1
  35. package/gen/agentexecution.d.ts.map +1 -1
  36. package/gen/agentexecution.js.map +1 -1
  37. package/gen/agentinstance.d.ts.map +1 -1
  38. package/gen/agentinstance.js.map +1 -1
  39. package/gen/agentshare.d.ts.map +1 -1
  40. package/gen/agentshare.js.map +1 -1
  41. package/gen/apikey.d.ts.map +1 -1
  42. package/gen/apikey.js.map +1 -1
  43. package/gen/artifact.d.ts.map +1 -1
  44. package/gen/artifact.js.map +1 -1
  45. package/gen/authorization-config.d.ts.map +1 -1
  46. package/gen/authorization-config.js +2 -2
  47. package/gen/authorization-config.js.map +1 -1
  48. package/gen/bidi-stream.d.ts.map +1 -1
  49. package/gen/bidi-stream.js.map +1 -1
  50. package/gen/channelapp.d.ts.map +1 -1
  51. package/gen/channelapp.js.map +1 -1
  52. package/gen/client.d.ts.map +1 -1
  53. package/gen/client.js.map +1 -1
  54. package/gen/environment.d.ts.map +1 -1
  55. package/gen/environment.js.map +1 -1
  56. package/gen/errors.d.ts.map +1 -1
  57. package/gen/errors.js.map +1 -1
  58. package/gen/executioncontext.d.ts.map +1 -1
  59. package/gen/executioncontext.js.map +1 -1
  60. package/gen/iampolicy.d.ts.map +1 -1
  61. package/gen/iampolicy.js.map +1 -1
  62. package/gen/identityaccount.d.ts.map +1 -1
  63. package/gen/identityaccount.js.map +1 -1
  64. package/gen/identityprovider.d.ts.map +1 -1
  65. package/gen/identityprovider.js.map +1 -1
  66. package/gen/invitation.d.ts.map +1 -1
  67. package/gen/invitation.js.map +1 -1
  68. package/gen/license.d.ts.map +1 -1
  69. package/gen/license.js.map +1 -1
  70. package/gen/mcpserver.d.ts.map +1 -1
  71. package/gen/mcpserver.js.map +1 -1
  72. package/gen/memory.d.ts.map +1 -1
  73. package/gen/memory.js.map +1 -1
  74. package/gen/oauthapp.d.ts.map +1 -1
  75. package/gen/oauthapp.js.map +1 -1
  76. package/gen/organization.d.ts.map +1 -1
  77. package/gen/organization.js.map +1 -1
  78. package/gen/plan.d.ts.map +1 -1
  79. package/gen/plan.js.map +1 -1
  80. package/gen/platformclient.d.ts.map +1 -1
  81. package/gen/platformclient.js.map +1 -1
  82. package/gen/plugin.d.ts.map +1 -1
  83. package/gen/plugin.js.map +1 -1
  84. package/gen/proto-utils.d.ts.map +1 -1
  85. package/gen/proto-utils.js.map +1 -1
  86. package/gen/resource-availability.d.ts.map +1 -1
  87. package/gen/resource-availability.js.map +1 -1
  88. package/gen/schedule.d.ts.map +1 -1
  89. package/gen/schedule.js.map +1 -1
  90. package/gen/session.d.ts.map +1 -1
  91. package/gen/session.js.map +1 -1
  92. package/gen/skill.d.ts.map +1 -1
  93. package/gen/skill.js.map +1 -1
  94. package/gen/subscription.d.ts.map +1 -1
  95. package/gen/subscription.js.map +1 -1
  96. package/gen/team.d.ts.map +1 -1
  97. package/gen/team.js.map +1 -1
  98. package/gen/types.d.ts.map +1 -1
  99. package/gen/types.js.map +1 -1
  100. package/gen/workflow.d.ts.map +1 -1
  101. package/gen/workflow.js.map +1 -1
  102. package/gen/workflowexecution.d.ts.map +1 -1
  103. package/gen/workflowexecution.js.map +1 -1
  104. package/gen/workflowinstance.d.ts.map +1 -1
  105. package/gen/workflowinstance.js.map +1 -1
  106. package/github.d.ts.map +1 -1
  107. package/github.js.map +1 -1
  108. package/guest-auth.d.ts.map +1 -1
  109. package/guest-auth.js.map +1 -1
  110. package/iam-principal.d.ts.map +1 -1
  111. package/iam-principal.js.map +1 -1
  112. package/iam-role.d.ts.map +1 -1
  113. package/iam-role.js.map +1 -1
  114. package/index.d.ts.map +1 -1
  115. package/index.js.map +1 -1
  116. package/internal/interceptors.d.ts.map +1 -1
  117. package/internal/interceptors.js.map +1 -1
  118. package/manifest/client.d.ts.map +1 -1
  119. package/manifest/client.js.map +1 -1
  120. package/manifest/document.d.ts.map +1 -1
  121. package/manifest/document.js.map +1 -1
  122. package/manifest/index.d.ts.map +1 -1
  123. package/manifest/index.js.map +1 -1
  124. package/manifest/parse.d.ts.map +1 -1
  125. package/manifest/parse.js.map +1 -1
  126. package/manifest/redaction.d.ts.map +1 -1
  127. package/manifest/redaction.js.map +1 -1
  128. package/manifest/registry.d.ts.map +1 -1
  129. package/manifest/registry.js.map +1 -1
  130. package/manifest/serialize.d.ts.map +1 -1
  131. package/manifest/serialize.js.map +1 -1
  132. package/mcpserver-connect.d.ts.map +1 -1
  133. package/mcpserver-connect.js.map +1 -1
  134. package/node.d.ts.map +1 -1
  135. package/node.js.map +1 -1
  136. package/package.json +2 -2
  137. package/platform-client-auth.d.ts.map +1 -1
  138. package/platform-client-auth.js.map +1 -1
  139. package/platform.d.ts.map +1 -1
  140. package/platform.js.map +1 -1
  141. package/plugin.d.ts.map +1 -1
  142. package/plugin.js.map +1 -1
  143. package/provider-standing.d.ts.map +1 -1
  144. package/provider-standing.js.map +1 -1
  145. package/resource-availability.d.ts.map +1 -1
  146. package/resource-availability.js.map +1 -1
  147. package/runner-adapter.d.ts.map +1 -1
  148. package/runner-adapter.js.map +1 -1
  149. package/search.d.ts.map +1 -1
  150. package/search.js.map +1 -1
  151. package/session.d.ts.map +1 -1
  152. package/session.js.map +1 -1
  153. package/sharing.d.ts.map +1 -1
  154. package/sharing.js.map +1 -1
  155. package/skill.d.ts.map +1 -1
  156. package/skill.js.map +1 -1
  157. package/src/gen/authorization-config.ts +2 -2
  158. package/stigmer.d.ts.map +1 -1
  159. package/stigmer.js.map +1 -1
  160. package/transport.d.ts.map +1 -1
  161. package/transport.js.map +1 -1
  162. package/__tests__/billing.test.d.ts +0 -2
  163. package/__tests__/billing.test.d.ts.map +0 -1
  164. package/__tests__/billing.test.js +0 -120
  165. package/__tests__/billing.test.js.map +0 -1
  166. package/__tests__/config.test.d.ts +0 -2
  167. package/__tests__/config.test.d.ts.map +0 -1
  168. package/__tests__/config.test.js +0 -35
  169. package/__tests__/config.test.js.map +0 -1
  170. package/__tests__/ensure-identity-account.test.d.ts +0 -2
  171. package/__tests__/ensure-identity-account.test.d.ts.map +0 -1
  172. package/__tests__/ensure-identity-account.test.js +0 -108
  173. package/__tests__/ensure-identity-account.test.js.map +0 -1
  174. package/__tests__/errors.test.d.ts +0 -2
  175. package/__tests__/errors.test.d.ts.map +0 -1
  176. package/__tests__/errors.test.js +0 -228
  177. package/__tests__/errors.test.js.map +0 -1
  178. package/__tests__/gen/errors.test.d.ts +0 -2
  179. package/__tests__/gen/errors.test.d.ts.map +0 -1
  180. package/__tests__/gen/errors.test.js +0 -97
  181. package/__tests__/gen/errors.test.js.map +0 -1
  182. package/__tests__/gen/invitation-client.test.d.ts +0 -2
  183. package/__tests__/gen/invitation-client.test.d.ts.map +0 -1
  184. package/__tests__/gen/invitation-client.test.js +0 -106
  185. package/__tests__/gen/invitation-client.test.js.map +0 -1
  186. package/__tests__/gen/proto-utils.test.d.ts +0 -2
  187. package/__tests__/gen/proto-utils.test.d.ts.map +0 -1
  188. package/__tests__/gen/proto-utils.test.js +0 -85
  189. package/__tests__/gen/proto-utils.test.js.map +0 -1
  190. package/__tests__/gen/session-client.test.d.ts +0 -2
  191. package/__tests__/gen/session-client.test.d.ts.map +0 -1
  192. package/__tests__/gen/session-client.test.js +0 -152
  193. package/__tests__/gen/session-client.test.js.map +0 -1
  194. package/__tests__/guest-auth.test.d.ts +0 -2
  195. package/__tests__/guest-auth.test.d.ts.map +0 -1
  196. package/__tests__/guest-auth.test.js +0 -223
  197. package/__tests__/guest-auth.test.js.map +0 -1
  198. package/__tests__/iam-principal.test.d.ts +0 -2
  199. package/__tests__/iam-principal.test.d.ts.map +0 -1
  200. package/__tests__/iam-principal.test.js +0 -65
  201. package/__tests__/iam-principal.test.js.map +0 -1
  202. package/__tests__/manifest.test.d.ts +0 -2
  203. package/__tests__/manifest.test.d.ts.map +0 -1
  204. package/__tests__/manifest.test.js +0 -306
  205. package/__tests__/manifest.test.js.map +0 -1
  206. package/__tests__/mcpserver-connect.test.d.ts +0 -2
  207. package/__tests__/mcpserver-connect.test.d.ts.map +0 -1
  208. package/__tests__/mcpserver-connect.test.js +0 -146
  209. package/__tests__/mcpserver-connect.test.js.map +0 -1
  210. package/__tests__/node.test.d.ts +0 -2
  211. package/__tests__/node.test.d.ts.map +0 -1
  212. package/__tests__/node.test.js +0 -67
  213. package/__tests__/node.test.js.map +0 -1
  214. package/__tests__/platform-client-auth.test.d.ts +0 -2
  215. package/__tests__/platform-client-auth.test.d.ts.map +0 -1
  216. package/__tests__/platform-client-auth.test.js +0 -59
  217. package/__tests__/platform-client-auth.test.js.map +0 -1
  218. package/__tests__/platform.test.d.ts +0 -2
  219. package/__tests__/platform.test.d.ts.map +0 -1
  220. package/__tests__/platform.test.js +0 -52
  221. package/__tests__/platform.test.js.map +0 -1
  222. package/__tests__/plugin.test.d.ts +0 -2
  223. package/__tests__/plugin.test.d.ts.map +0 -1
  224. package/__tests__/plugin.test.js +0 -74
  225. package/__tests__/plugin.test.js.map +0 -1
  226. package/__tests__/resource-availability.test.d.ts +0 -2
  227. package/__tests__/resource-availability.test.d.ts.map +0 -1
  228. package/__tests__/resource-availability.test.js +0 -80
  229. package/__tests__/resource-availability.test.js.map +0 -1
  230. package/__tests__/runner-adapter.test.d.ts +0 -2
  231. package/__tests__/runner-adapter.test.d.ts.map +0 -1
  232. package/__tests__/runner-adapter.test.js +0 -88
  233. package/__tests__/runner-adapter.test.js.map +0 -1
  234. package/__tests__/session.test.d.ts +0 -6
  235. package/__tests__/session.test.d.ts.map +0 -1
  236. package/__tests__/session.test.js +0 -50
  237. package/__tests__/session.test.js.map +0 -1
  238. package/__tests__/sharing.test.d.ts +0 -2
  239. package/__tests__/sharing.test.d.ts.map +0 -1
  240. package/__tests__/sharing.test.js +0 -106
  241. package/__tests__/sharing.test.js.map +0 -1
  242. package/__tests__/skill.test.d.ts +0 -2
  243. package/__tests__/skill.test.d.ts.map +0 -1
  244. package/__tests__/skill.test.js +0 -117
  245. package/__tests__/skill.test.js.map +0 -1
  246. package/__tests__/stigmer.test.d.ts +0 -2
  247. package/__tests__/stigmer.test.d.ts.map +0 -1
  248. package/__tests__/stigmer.test.js +0 -127
  249. package/__tests__/stigmer.test.js.map +0 -1
  250. package/__tests__/update-input-roundtrip.test.d.ts +0 -2
  251. package/__tests__/update-input-roundtrip.test.d.ts.map +0 -1
  252. package/__tests__/update-input-roundtrip.test.js +0 -775
  253. package/__tests__/update-input-roundtrip.test.js.map +0 -1
  254. package/__tests__/update-input.test.d.ts +0 -2
  255. package/__tests__/update-input.test.d.ts.map +0 -1
  256. package/__tests__/update-input.test.js +0 -188
  257. package/__tests__/update-input.test.js.map +0 -1
  258. package/execution/__tests__/approval-provenance.test.d.ts +0 -2
  259. package/execution/__tests__/approval-provenance.test.d.ts.map +0 -1
  260. package/execution/__tests__/approval-provenance.test.js +0 -42
  261. package/execution/__tests__/approval-provenance.test.js.map +0 -1
  262. package/execution/__tests__/file-review-fold.corpus.test.d.ts +0 -2
  263. package/execution/__tests__/file-review-fold.corpus.test.d.ts.map +0 -1
  264. package/execution/__tests__/file-review-fold.corpus.test.js +0 -82
  265. package/execution/__tests__/file-review-fold.corpus.test.js.map +0 -1
  266. package/execution/__tests__/file-review-fold.test.d.ts +0 -2
  267. package/execution/__tests__/file-review-fold.test.d.ts.map +0 -1
  268. package/execution/__tests__/file-review-fold.test.js +0 -184
  269. package/execution/__tests__/file-review-fold.test.js.map +0 -1
  270. package/execution/__tests__/to-display-file-change.test.d.ts +0 -2
  271. package/execution/__tests__/to-display-file-change.test.d.ts.map +0 -1
  272. package/execution/__tests__/to-display-file-change.test.js +0 -81
  273. package/execution/__tests__/to-display-file-change.test.js.map +0 -1
  274. package/execution/__tests__/tool-view.file-changes.test.d.ts +0 -2
  275. package/execution/__tests__/tool-view.file-changes.test.d.ts.map +0 -1
  276. package/execution/__tests__/tool-view.file-changes.test.js +0 -86
  277. package/execution/__tests__/tool-view.file-changes.test.js.map +0 -1
  278. package/execution/__tests__/tool-view.fixtures.test.d.ts +0 -2
  279. package/execution/__tests__/tool-view.fixtures.test.d.ts.map +0 -1
  280. package/execution/__tests__/tool-view.fixtures.test.js +0 -152
  281. package/execution/__tests__/tool-view.fixtures.test.js.map +0 -1
  282. package/execution/__tests__/tool-view.output-ref.test.d.ts +0 -2
  283. package/execution/__tests__/tool-view.output-ref.test.d.ts.map +0 -1
  284. package/execution/__tests__/tool-view.output-ref.test.js +0 -64
  285. package/execution/__tests__/tool-view.output-ref.test.js.map +0 -1
  286. package/execution/__tests__/tool-view.read.test.d.ts +0 -2
  287. package/execution/__tests__/tool-view.read.test.d.ts.map +0 -1
  288. package/execution/__tests__/tool-view.read.test.js +0 -56
  289. package/execution/__tests__/tool-view.read.test.js.map +0 -1
  290. package/execution/__tests__/tool-view.search.test.d.ts +0 -2
  291. package/execution/__tests__/tool-view.search.test.d.ts.map +0 -1
  292. package/execution/__tests__/tool-view.search.test.js +0 -200
  293. package/execution/__tests__/tool-view.search.test.js.map +0 -1
  294. package/execution/__tests__/tool-view.shell.test.d.ts +0 -2
  295. package/execution/__tests__/tool-view.shell.test.d.ts.map +0 -1
  296. package/execution/__tests__/tool-view.shell.test.js +0 -104
  297. package/execution/__tests__/tool-view.shell.test.js.map +0 -1
  298. package/execution/__tests__/transcript.test.d.ts +0 -2
  299. package/execution/__tests__/transcript.test.d.ts.map +0 -1
  300. package/execution/__tests__/transcript.test.js +0 -591
  301. package/execution/__tests__/transcript.test.js.map +0 -1
  302. package/node.test.d.ts +0 -2
  303. package/node.test.d.ts.map +0 -1
  304. package/node.test.js +0 -35
  305. package/node.test.js.map +0 -1
  306. package/src/__tests__/billing.test.ts +0 -146
  307. package/src/__tests__/config.test.ts +0 -52
  308. package/src/__tests__/ensure-identity-account.test.ts +0 -146
  309. package/src/__tests__/errors.test.ts +0 -349
  310. package/src/__tests__/gen/errors.test.ts +0 -138
  311. package/src/__tests__/gen/invitation-client.test.ts +0 -132
  312. package/src/__tests__/gen/proto-utils.test.ts +0 -99
  313. package/src/__tests__/gen/session-client.test.ts +0 -208
  314. package/src/__tests__/guest-auth.test.ts +0 -287
  315. package/src/__tests__/iam-principal.test.ts +0 -82
  316. package/src/__tests__/manifest.test.ts +0 -362
  317. package/src/__tests__/mcpserver-connect.test.ts +0 -181
  318. package/src/__tests__/node.test.ts +0 -74
  319. package/src/__tests__/platform-client-auth.test.ts +0 -76
  320. package/src/__tests__/platform.test.ts +0 -74
  321. package/src/__tests__/plugin.test.ts +0 -92
  322. package/src/__tests__/resource-availability.test.ts +0 -118
  323. package/src/__tests__/runner-adapter.test.ts +0 -122
  324. package/src/__tests__/session.test.ts +0 -66
  325. package/src/__tests__/sharing.test.ts +0 -159
  326. package/src/__tests__/skill.test.ts +0 -150
  327. package/src/__tests__/stigmer.test.ts +0 -170
  328. package/src/__tests__/update-input-roundtrip.test.ts +0 -1007
  329. package/src/__tests__/update-input.test.ts +0 -250
  330. package/src/execution/__tests__/approval-provenance.test.ts +0 -60
  331. package/src/execution/__tests__/file-review-fold.corpus.test.ts +0 -127
  332. package/src/execution/__tests__/file-review-fold.test.ts +0 -281
  333. package/src/execution/__tests__/to-display-file-change.test.ts +0 -106
  334. package/src/execution/__tests__/tool-view.file-changes.test.ts +0 -100
  335. package/src/execution/__tests__/tool-view.fixtures.test.ts +0 -225
  336. package/src/execution/__tests__/tool-view.output-ref.test.ts +0 -76
  337. package/src/execution/__tests__/tool-view.read.test.ts +0 -71
  338. package/src/execution/__tests__/tool-view.search.test.ts +0 -264
  339. package/src/execution/__tests__/tool-view.shell.test.ts +0 -127
  340. package/src/execution/__tests__/transcript.golden.md +0 -100
  341. package/src/execution/__tests__/transcript.test.ts +0 -697
  342. package/src/node.test.ts +0 -38
@@ -1,225 +0,0 @@
1
- // Validates the tool-view layer against the shared cross-surface contract in
2
- // test/fixtures/tool-view/. The runner's middleware tests assert the same
3
- // fixtures from the writer side, so producers and this reader cannot drift in
4
- // classification, result interpretation, intent extraction, or secret redaction.
5
-
6
- import { readFileSync } from "node:fs";
7
- import { fileURLToPath } from "node:url";
8
- import { dirname, resolve } from "node:path";
9
- import { describe, it, expect } from "vitest";
10
- import { create, type JsonObject } from "@bufbuild/protobuf";
11
- import { ToolCallSchema } from "@stigmer/protos/ai/stigmer/agentic/agentexecution/v1/message_pb";
12
- import { ToolCallStatus } from "@stigmer/protos/ai/stigmer/agentic/agentexecution/v1/enum_pb";
13
- import {
14
- ToolKind,
15
- resolveToolKindByName,
16
- normalizeToolResult,
17
- extractShellIntent,
18
- SHELL_INTENT_ARG_FIELD,
19
- isSecretArgKey,
20
- redactSecretArgs,
21
- } from "../tool-view";
22
-
23
- const here = dirname(fileURLToPath(import.meta.url));
24
- // sdk/typescript/src/execution/__tests__ -> repo root is five levels up.
25
- const fixtureDir = resolve(here, "../../../../../test/fixtures/tool-view");
26
-
27
- function loadFixture<T>(name: string): T {
28
- return JSON.parse(readFileSync(resolve(fixtureDir, name), "utf8")) as T;
29
- }
30
-
31
- describe("classification fixtures", () => {
32
- const { cases } = loadFixture<{
33
- cases: { name: string; mcpServerSlug: string; toolKind: string }[];
34
- }>("classification.json");
35
-
36
- it("loads the fixture", () => {
37
- expect(cases.length).toBeGreaterThan(0);
38
- });
39
-
40
- for (const c of cases) {
41
- const expected = ToolKind[c.toolKind.replace(/^TOOL_KIND_/, "") as keyof typeof ToolKind];
42
- it(`classifies ${c.name || "(empty)"}${c.mcpServerSlug ? ` @${c.mcpServerSlug}` : ""}`, () => {
43
- expect(resolveToolKindByName(c.name, c.mcpServerSlug)).toBe(expected);
44
- });
45
- }
46
- });
47
-
48
- describe("result-view fixtures", () => {
49
- interface ResultCase {
50
- name: string;
51
- toolName: string;
52
- mcpServerSlug: string;
53
- args: Record<string, unknown>;
54
- result: string;
55
- error?: string;
56
- status?: string;
57
- expected: {
58
- type: string;
59
- path?: string;
60
- exitCode?: number;
61
- command?: string;
62
- count?: number;
63
- mcpServerSlug?: string;
64
- linesAdded?: number;
65
- linesRemoved?: number;
66
- memoryId?: string;
67
- fact?: string;
68
- };
69
- }
70
-
71
- const { cases } = loadFixture<{ cases: ResultCase[] }>("result-views.json");
72
-
73
- it("loads the fixture", () => {
74
- expect(cases.length).toBeGreaterThan(0);
75
- });
76
-
77
- for (const c of cases) {
78
- it(`normalizes ${c.name} -> ${c.expected.type}`, () => {
79
- const status =
80
- c.status === "TOOL_CALL_FAILED"
81
- ? ToolCallStatus.TOOL_CALL_FAILED
82
- : ToolCallStatus.TOOL_CALL_COMPLETED;
83
-
84
- const toolCall = create(ToolCallSchema, {
85
- id: c.name,
86
- name: c.toolName,
87
- mcpServerSlug: c.mcpServerSlug,
88
- result: c.result,
89
- error: c.error ?? "",
90
- status,
91
- args: c.args as JsonObject,
92
- });
93
-
94
- const view = normalizeToolResult(toolCall);
95
- expect(view.type).toBe(c.expected.type);
96
-
97
- // Only deterministic facts are part of the shared contract.
98
- if (c.expected.path !== undefined && view.type === "diff") {
99
- expect(view.path).toBe(c.expected.path);
100
- }
101
- if (c.expected.path !== undefined && view.type === "file") {
102
- expect(view.path).toBe(c.expected.path);
103
- }
104
- if (c.expected.exitCode !== undefined && view.type === "terminal") {
105
- expect(view.exitCode).toBe(c.expected.exitCode);
106
- }
107
- if (c.expected.command !== undefined && view.type === "terminal") {
108
- expect(view.command).toBe(c.expected.command);
109
- }
110
- if (c.expected.count !== undefined && view.type === "search") {
111
- expect(view.count).toBe(c.expected.count);
112
- }
113
- if (c.expected.count !== undefined && view.type === "list") {
114
- expect(view.count).toBe(c.expected.count);
115
- }
116
- if (c.expected.mcpServerSlug !== undefined && view.type === "contentBlocks") {
117
- expect(view.mcpServerSlug).toBe(c.expected.mcpServerSlug);
118
- }
119
- if (c.expected.linesAdded !== undefined && view.type === "diff") {
120
- expect(view.linesAdded).toBe(c.expected.linesAdded);
121
- }
122
- if (c.expected.linesRemoved !== undefined && view.type === "diff") {
123
- expect(view.linesRemoved).toBe(c.expected.linesRemoved);
124
- }
125
- if (c.expected.memoryId !== undefined && view.type === "memoryProposal") {
126
- expect(view.memoryId).toBe(c.expected.memoryId);
127
- }
128
- if (c.expected.fact !== undefined && view.type === "memoryProposal") {
129
- expect(view.fact).toBe(c.expected.fact);
130
- }
131
- });
132
- }
133
- });
134
-
135
- describe("intent-title fixtures", () => {
136
- interface IntentCase {
137
- name: string;
138
- mcpServerSlug: string;
139
- args: Record<string, unknown>;
140
- intent: string | null;
141
- }
142
-
143
- const fixture = loadFixture<{ argField: string; cases: IntentCase[] }>(
144
- "intent-title.json",
145
- );
146
-
147
- it("loads the fixture and agrees on the wire key", () => {
148
- expect(fixture.cases.length).toBeGreaterThan(0);
149
- expect(SHELL_INTENT_ARG_FIELD).toBe(fixture.argField);
150
- });
151
-
152
- for (const c of fixture.cases) {
153
- it(`extracts ${c.name}${c.mcpServerSlug ? ` @${c.mcpServerSlug}` : ""} -> ${JSON.stringify(c.intent)}`, () => {
154
- const toolCall = create(ToolCallSchema, {
155
- id: c.name,
156
- name: c.name,
157
- mcpServerSlug: c.mcpServerSlug,
158
- args: c.args as JsonObject,
159
- });
160
- expect(extractShellIntent(toolCall)).toBe(c.intent);
161
- });
162
- }
163
- });
164
-
165
- describe("secret-args fixtures", () => {
166
- // The runner's args-preview tests assert the same file from the writer side.
167
- const { keys, marker, cases } = loadFixture<{
168
- keys: string[];
169
- marker: string;
170
- cases: { name: string; args: Record<string, unknown>; redacted: Record<string, unknown> }[];
171
- }>("secret-args.json");
172
-
173
- it("recognises every secret key, in any case, and nothing that merely contains one", () => {
174
- for (const key of keys) {
175
- expect(isSecretArgKey(key)).toBe(true);
176
- expect(isSecretArgKey(key.toUpperCase())).toBe(true);
177
- }
178
- expect(isSecretArgKey("token_count")).toBe(false);
179
- expect(isSecretArgKey("repo")).toBe(false);
180
- });
181
-
182
- for (const c of cases) {
183
- it(`redacts ${c.name}`, () => {
184
- expect(redactSecretArgs(c.args)).toEqual(c.redacted);
185
- });
186
- }
187
-
188
- it("writes the runner's marker and keeps the reference when nothing is secret", () => {
189
- expect(redactSecretArgs({ token: "t" }).token).toBe(marker);
190
- const clean = { repo: "acme/x" };
191
- expect(redactSecretArgs(clean)).toBe(clean);
192
- });
193
- });
194
-
195
- describe("resolveToolKind wire field precedence", () => {
196
- it("prefers the wire tool_kind over the name fallback", () => {
197
- const toolCall = create(ToolCallSchema, {
198
- name: "some_unknown_name",
199
- toolKind: ToolKind.SHELL,
200
- });
201
- // resolveToolKind is exercised indirectly via normalizeToolResult routing.
202
- const view = normalizeToolResult(
203
- create(ToolCallSchema, {
204
- name: "some_unknown_name",
205
- toolKind: ToolKind.SHELL,
206
- result: "done\n[Command succeeded]",
207
- status: ToolCallStatus.TOOL_CALL_COMPLETED,
208
- }),
209
- );
210
- expect(view.type).toBe("terminal");
211
- expect(toolCall.toolKind).toBe(ToolKind.SHELL);
212
- });
213
-
214
- it("degrades unknown results to json or text", () => {
215
- const jsonView = normalizeToolResult(
216
- create(ToolCallSchema, { name: "mystery", result: '{"a":1}', status: ToolCallStatus.TOOL_CALL_COMPLETED }),
217
- );
218
- expect(jsonView.type).toBe("json");
219
-
220
- const textView = normalizeToolResult(
221
- create(ToolCallSchema, { name: "mystery", result: "plain", status: ToolCallStatus.TOOL_CALL_COMPLETED }),
222
- );
223
- expect(textView.type).toBe("text");
224
- });
225
- });
@@ -1,76 +0,0 @@
1
- // Covers the offloaded tool-output path: when a result is spilled to artifact
2
- // storage the runner replaces it with a ToolCallOutputRef. The view must surface
3
- // the STABLE storageKey (+ contentHash) so consumers resolve the bytes/URL on
4
- // demand — it must never depend on a persisted (ephemeral) URL.
5
-
6
- import { describe, it, expect } from "vitest";
7
- import { create, type JsonObject } from "@bufbuild/protobuf";
8
- import {
9
- ToolCallSchema,
10
- ToolCallOutputRefSchema,
11
- } from "@stigmer/protos/ai/stigmer/agentic/agentexecution/v1/message_pb";
12
- import {
13
- ToolCallStatus,
14
- ToolKind,
15
- } from "@stigmer/protos/ai/stigmer/agentic/agentexecution/v1/enum_pb";
16
- import { normalizeToolResult } from "../tool-view";
17
-
18
- function toolCallWithOutputRef(ref: ReturnType<typeof create<typeof ToolCallOutputRefSchema>> | undefined, result = "") {
19
- return create(ToolCallSchema, {
20
- id: "tc-1",
21
- name: "some_tool",
22
- toolKind: ToolKind.UNSPECIFIED,
23
- status: ToolCallStatus.TOOL_CALL_COMPLETED,
24
- args: {} as JsonObject,
25
- result,
26
- outputRef: ref,
27
- });
28
- }
29
-
30
- describe("normalizeToolResult — offloaded output ref", () => {
31
- it("emits an outputRef view carrying the stable storageKey and contentHash", () => {
32
- const ref = create(ToolCallOutputRefSchema, {
33
- storageKey: "artifacts/exec-1/toolcalls/tc-1.txt",
34
- contentHash: "sha256:abc",
35
- sizeBytes: 900_000n,
36
- mimeType: "text/plain",
37
- isImage: false,
38
- truncatedPreview: "head of the output…",
39
- });
40
-
41
- const view = normalizeToolResult(toolCallWithOutputRef(ref, "[output truncated]"));
42
-
43
- expect(view.type).toBe("outputRef");
44
- if (view.type !== "outputRef") return;
45
- expect(view.storageKey).toBe("artifacts/exec-1/toolcalls/tc-1.txt");
46
- expect(view.contentHash).toBe("sha256:abc");
47
- expect(view.isImage).toBe(false);
48
- expect(view.mimeType).toBe("text/plain");
49
- expect(view.sizeBytes).toBe(900_000);
50
- expect(view.preview).toBe("head of the output…");
51
- });
52
-
53
- it("gates on storageKey, not a URL — an image ref renders inline", () => {
54
- const ref = create(ToolCallOutputRefSchema, {
55
- storageKey: "artifacts/exec-1/toolcalls/tc-1.png",
56
- contentHash: "sha256:img",
57
- sizeBytes: 12_345n,
58
- mimeType: "image/png",
59
- isImage: true,
60
- });
61
-
62
- const view = normalizeToolResult(toolCallWithOutputRef(ref));
63
-
64
- expect(view.type).toBe("outputRef");
65
- if (view.type !== "outputRef") return;
66
- expect(view.isImage).toBe(true);
67
- expect(view.storageKey).toBe("artifacts/exec-1/toolcalls/tc-1.png");
68
- });
69
-
70
- it("does not produce an outputRef view when no storageKey is present", () => {
71
- // A ref with no storageKey is not a usable offload pointer; fall back to text.
72
- const ref = create(ToolCallOutputRefSchema, { sizeBytes: 10n });
73
- const view = normalizeToolResult(toolCallWithOutputRef(ref, "plain result"));
74
- expect(view.type).not.toBe("outputRef");
75
- });
76
- });
@@ -1,71 +0,0 @@
1
- // Covers read normalization over the native engine's read frame: deepagents
2
- // (1.12+) renders a text read as one-line bracketed notices, a status header
3
- // `@@ lines A-B[ of T][ | …] @@`, and then the file's lines unmodified. The view
4
- // shows the file, so the frame is dropped; a truncation the header reports is
5
- // kept. The cross-language fixture (result-views.json) asserts the happy path;
6
- // these cover the frame's variants and the results that carry no frame (Cursor,
7
- // and native rows recorded before the frame existed).
8
-
9
- import { describe, it, expect } from "vitest";
10
- import { create, type JsonObject } from "@bufbuild/protobuf";
11
- import { ToolCallSchema } from "@stigmer/protos/ai/stigmer/agentic/agentexecution/v1/message_pb";
12
- import {
13
- ToolCallStatus,
14
- ToolKind,
15
- } from "@stigmer/protos/ai/stigmer/agentic/agentexecution/v1/enum_pb";
16
- import { normalizeToolResult } from "../tool-view";
17
-
18
- function readCall(result: string) {
19
- return create(ToolCallSchema, {
20
- id: "tc-read",
21
- name: "read_file",
22
- toolKind: ToolKind.FILE_READ,
23
- status: ToolCallStatus.TOOL_CALL_COMPLETED,
24
- args: { file_path: "/workspace/main.go" } as JsonObject,
25
- result,
26
- });
27
- }
28
-
29
- function fileView(result: string) {
30
- const view = normalizeToolResult(readCall(result));
31
- expect(view.type).toBe("file");
32
- if (view.type !== "file") throw new Error("not a file view");
33
- return view;
34
- }
35
-
36
- describe("normalizeToolResult — native read frame", () => {
37
- it("drops the status header and shows the file's lines", () => {
38
- const view = fileView("@@ lines 1-2 of 2 @@\npackage main\n");
39
- expect(view.content).toBe("package main\n");
40
- expect(view.truncated).toBe(false);
41
- });
42
-
43
- it("drops a paginated header and the notices above it", () => {
44
- const view = fileView(
45
- "[Requested offset -3 is before the start of the file; read from line 1 instead.]\n" +
46
- "@@ lines 1-100 of 250 | next offset 100 @@\nline one\nline two",
47
- );
48
- expect(view.content).toBe("line one\nline two");
49
- expect(view.truncated).toBe(false);
50
- });
51
-
52
- it("keeps a truncation the header reports", () => {
53
- const whole = fileView(
54
- "[Output was truncated due to size limits.]\n@@ lines 1-40 of 900 | next offset 40 | truncated due to size @@\nfirst",
55
- );
56
- expect(whole.content).toBe("first");
57
- expect(whole.truncated).toBe(true);
58
-
59
- const midLine = fileView("@@ lines 1-1 | truncated mid-line | 10 of 90 chars @@\n0123456789");
60
- expect(midLine.content).toBe("0123456789");
61
- expect(midLine.truncated).toBe(true);
62
- });
63
-
64
- it("leaves a result without the frame as it is", () => {
65
- expect(fileView(" 1\tpackage main\n 2\t").content).toBe(" 1\tpackage main\n 2\t");
66
- expect(fileView("[a bracketed first line of the file]\nsecond").content).toBe(
67
- "[a bracketed first line of the file]\nsecond",
68
- );
69
- expect(fileView("@@ -1,2 +1,3 @@\n diff text").content).toBe("@@ -1,2 +1,3 @@\n diff text");
70
- });
71
- });
@@ -1,264 +0,0 @@
1
- // Covers search normalization's envelope handling: the Cursor SDK returns search
2
- // results as a stringified JSON envelope (file-name search via {status,value} and
3
- // grep/codebase search via {workspaceResults}), which the original parser dumped
4
- // as a single fake "match". The cross-language fixture (result-views.json)
5
- // asserts the happy-path `type`/`count`; these cover the `kind`/`truncated`
6
- // presentation hints, the multi-workspace flatten, the content-match mapping, and
7
- // the unrecognized-JSON -> json degradation that is not a shared scalar fact.
8
-
9
- import { describe, it, expect } from "vitest";
10
- import { create, type JsonObject } from "@bufbuild/protobuf";
11
- import { ToolCallSchema } from "@stigmer/protos/ai/stigmer/agentic/agentexecution/v1/message_pb";
12
- import {
13
- ToolCallStatus,
14
- ToolKind,
15
- } from "@stigmer/protos/ai/stigmer/agentic/agentexecution/v1/enum_pb";
16
- import { normalizeToolResult } from "../tool-view";
17
-
18
- function searchCall(args: Record<string, unknown>, result: string) {
19
- return create(ToolCallSchema, {
20
- id: "tc-search",
21
- name: "Grep",
22
- toolKind: ToolKind.SEARCH,
23
- status: ToolCallStatus.TOOL_CALL_COMPLETED,
24
- args: args as JsonObject,
25
- result,
26
- });
27
- }
28
-
29
- describe("normalizeToolResult — Cursor file-name search envelope", () => {
30
- it("unwraps an empty {status,value} file search (the reported bug: not '1 match')", () => {
31
- const view = normalizeToolResult(
32
- searchCall(
33
- { pattern: "**/*.nope" },
34
- JSON.stringify({
35
- status: "success",
36
- value: { files: [], totalFiles: 0, clientTruncated: false, ripgrepTruncated: false },
37
- }),
38
- ),
39
- );
40
- expect(view.type).toBe("search");
41
- if (view.type !== "search") return;
42
- expect(view.kind).toBe("files");
43
- expect(view.count).toBe(0);
44
- expect(view.matches).toHaveLength(0);
45
- expect(view.truncated).toBe(false);
46
- });
47
-
48
- it("unwraps a non-empty file search into clickable file matches", () => {
49
- const view = normalizeToolResult(
50
- searchCall(
51
- { pattern: "Dockerfile" },
52
- JSON.stringify({
53
- status: "success",
54
- value: { files: ["Dockerfile"], totalFiles: 1, clientTruncated: false, ripgrepTruncated: false },
55
- }),
56
- ),
57
- );
58
- expect(view.type).toBe("search");
59
- if (view.type !== "search") return;
60
- expect(view.kind).toBe("files");
61
- expect(view.count).toBe(1);
62
- // Both file and text are set so a kind-unaware consumer still shows the path.
63
- expect(view.matches[0]).toEqual({ file: "Dockerfile", text: "Dockerfile" });
64
- });
65
-
66
- it("carries the engine's truncation flags and authoritative totalFiles", () => {
67
- const view = normalizeToolResult(
68
- searchCall(
69
- { pattern: "*.ts" },
70
- JSON.stringify({
71
- status: "success",
72
- value: { files: ["a.ts", "b.ts"], totalFiles: 200, clientTruncated: true, ripgrepTruncated: false },
73
- }),
74
- ),
75
- );
76
- expect(view.type).toBe("search");
77
- if (view.type !== "search") return;
78
- // totalFiles is authoritative and can exceed the returned page.
79
- expect(view.count).toBe(200);
80
- expect(view.matches).toHaveLength(2);
81
- expect(view.truncated).toBe(true);
82
- });
83
- });
84
-
85
- describe("normalizeToolResult — Cursor grep workspaceResults envelope", () => {
86
- it("unwraps the real {status,value:{workspaceResults}} grep shape (the reported bug)", () => {
87
- // The grep payload nests workspaceResults INSIDE the {status,value} envelope —
88
- // the shape the runner actually persists. The original parser only looked at
89
- // the top level, so this fell through to a raw JSON dump.
90
- const view = normalizeToolResult(
91
- searchCall(
92
- { pattern: "pipeline" },
93
- JSON.stringify({
94
- status: "success",
95
- value: {
96
- workspaceResults: {
97
- "/work/demo": { type: "files", output: { files: [], count: 0 } },
98
- },
99
- },
100
- }),
101
- ),
102
- );
103
- expect(view.type).toBe("search");
104
- if (view.type !== "search") return;
105
- expect(view.kind).toBe("files");
106
- expect(view.count).toBe(0);
107
- });
108
-
109
- it("still reads an un-enveloped top-level workspaceResults (defensive)", () => {
110
- const view = normalizeToolResult(
111
- searchCall(
112
- { pattern: "pipeline" },
113
- JSON.stringify({
114
- workspaceResults: { "/work/demo": { type: "files", output: { files: [], count: 0 } } },
115
- }),
116
- ),
117
- );
118
- expect(view.type).toBe("search");
119
- if (view.type !== "search") return;
120
- expect(view.kind).toBe("files");
121
- expect(view.count).toBe(0);
122
- });
123
-
124
- it("flattens file matches across multiple workspaces and sums reported counts", () => {
125
- const view = normalizeToolResult(
126
- searchCall(
127
- { pattern: "TODO" },
128
- JSON.stringify({
129
- status: "success",
130
- value: {
131
- workspaceResults: {
132
- "/work/a": { type: "files", output: { files: ["a/x.ts"], count: 1 } },
133
- "/work/b": { type: "files", output: { files: ["b/y.ts"], count: 1 } },
134
- },
135
- },
136
- }),
137
- ),
138
- );
139
- expect(view.type).toBe("search");
140
- if (view.type !== "search") return;
141
- expect(view.kind).toBe("files");
142
- expect(view.count).toBe(2);
143
- expect(view.matches.map((m) => m.file)).toEqual(["a/x.ts", "b/y.ts"]);
144
- });
145
-
146
- it("renders a non-empty grep (type:files) as a file list, not 0 files", () => {
147
- // The real wrapped shape with results present — proves a populated grep is
148
- // shown (the user's concern that a non-empty response might render as empty).
149
- const view = normalizeToolResult(
150
- searchCall(
151
- { pattern: "pipeline" },
152
- JSON.stringify({
153
- status: "success",
154
- value: {
155
- workspaceResults: {
156
- "/work/demo": {
157
- type: "files",
158
- output: { files: [".tekton/pipeline.yaml", "README.md"], count: 2 },
159
- },
160
- },
161
- },
162
- }),
163
- ),
164
- );
165
- expect(view.type).toBe("search");
166
- if (view.type !== "search") return;
167
- expect(view.kind).toBe("files");
168
- expect(view.count).toBe(2);
169
- expect(view.matches.map((m) => m.file)).toEqual([".tekton/pipeline.yaml", "README.md"]);
170
- });
171
-
172
- it("falls back to JSON (never hides data) when a count is reported but nothing extracts", () => {
173
- // Shape drift: the engine says count:5 but the matches live under a key we
174
- // don't recognise. Surfacing the raw JSON beats a misleading "No matches".
175
- const view = normalizeToolResult(
176
- searchCall(
177
- { pattern: "x" },
178
- JSON.stringify({
179
- status: "success",
180
- value: {
181
- workspaceResults: {
182
- "/work/demo": { type: "weird", output: { hits: ["a", "b"], count: 5 } },
183
- },
184
- },
185
- }),
186
- ),
187
- );
188
- expect(view.type).toBe("json");
189
- });
190
-
191
- it("falls back to JSON when a file search reports totalFiles but no extractable paths", () => {
192
- // files are objects, not strings (a drift) — but totalFiles says 3.
193
- const view = normalizeToolResult(
194
- searchCall(
195
- { pattern: "*.ts" },
196
- JSON.stringify({
197
- status: "success",
198
- value: { files: [{ path: "a.ts" }], totalFiles: 3 },
199
- }),
200
- ),
201
- );
202
- expect(view.type).toBe("json");
203
- });
204
-
205
- it("maps line-bearing matches into grouped content matches", () => {
206
- const view = normalizeToolResult(
207
- searchCall(
208
- { pattern: "TODO" },
209
- JSON.stringify({
210
- status: "success",
211
- value: {
212
- workspaceResults: {
213
- "/work/a": {
214
- type: "matches",
215
- output: {
216
- matches: [
217
- { file: "a/x.ts", line: 12, text: "// TODO: fix" },
218
- { file: "a/x.ts", line: 30, text: "// TODO: later" },
219
- ],
220
- count: 2,
221
- },
222
- },
223
- },
224
- },
225
- }),
226
- ),
227
- );
228
- expect(view.type).toBe("search");
229
- if (view.type !== "search") return;
230
- expect(view.kind).toBe("content");
231
- expect(view.count).toBe(2);
232
- expect(view.matches[0]).toEqual({ file: "a/x.ts", line: 12, text: "// TODO: fix" });
233
- });
234
- });
235
-
236
- describe("normalizeToolResult — search plain text and graceful degradation", () => {
237
- it("keeps native grep line matches as content (unchanged behavior)", () => {
238
- const view = normalizeToolResult(
239
- searchCall(
240
- { pattern: "TODO" },
241
- "\n/workspace/a.go:\n 12: // TODO: fix\n/workspace/b.go:\n 7: // TODO: later",
242
- ),
243
- );
244
- expect(view.type).toBe("search");
245
- if (view.type !== "search") return;
246
- expect(view.kind).toBe("content");
247
- expect(view.count).toBe(2);
248
- });
249
-
250
- it("treats native path/name lines as file matches", () => {
251
- const view = normalizeToolResult(searchCall({ pattern: "*.go" }, "src/a.go\nsrc/b.go"));
252
- expect(view.type).toBe("search");
253
- if (view.type !== "search") return;
254
- expect(view.kind).toBe("files");
255
- expect(view.count).toBe(2);
256
- });
257
-
258
- it("degrades an unrecognized JSON shape to a json view, not a fake match", () => {
259
- const view = normalizeToolResult(
260
- searchCall({ pattern: "x" }, JSON.stringify({ somethingElse: true })),
261
- );
262
- expect(view.type).toBe("json");
263
- });
264
- });