@stigmer/sdk 3.35.0 → 3.37.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 (348) 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 +6 -0
  111. package/iam-principal.d.ts.map +1 -1
  112. package/iam-principal.js +19 -0
  113. package/iam-principal.js.map +1 -1
  114. package/iam-role.d.ts.map +1 -1
  115. package/iam-role.js.map +1 -1
  116. package/index.d.ts +1 -1
  117. package/index.d.ts.map +1 -1
  118. package/index.js +1 -1
  119. package/index.js.map +1 -1
  120. package/internal/interceptors.d.ts.map +1 -1
  121. package/internal/interceptors.js.map +1 -1
  122. package/manifest/client.d.ts.map +1 -1
  123. package/manifest/client.js.map +1 -1
  124. package/manifest/document.d.ts.map +1 -1
  125. package/manifest/document.js.map +1 -1
  126. package/manifest/index.d.ts.map +1 -1
  127. package/manifest/index.js.map +1 -1
  128. package/manifest/parse.d.ts.map +1 -1
  129. package/manifest/parse.js.map +1 -1
  130. package/manifest/redaction.d.ts.map +1 -1
  131. package/manifest/redaction.js.map +1 -1
  132. package/manifest/registry.d.ts.map +1 -1
  133. package/manifest/registry.js.map +1 -1
  134. package/manifest/serialize.d.ts.map +1 -1
  135. package/manifest/serialize.js.map +1 -1
  136. package/mcpserver-connect.d.ts.map +1 -1
  137. package/mcpserver-connect.js.map +1 -1
  138. package/node.d.ts.map +1 -1
  139. package/node.js.map +1 -1
  140. package/package.json +2 -2
  141. package/platform-client-auth.d.ts.map +1 -1
  142. package/platform-client-auth.js.map +1 -1
  143. package/platform.d.ts.map +1 -1
  144. package/platform.js.map +1 -1
  145. package/plugin.d.ts.map +1 -1
  146. package/plugin.js.map +1 -1
  147. package/provider-standing.d.ts.map +1 -1
  148. package/provider-standing.js.map +1 -1
  149. package/resource-availability.d.ts.map +1 -1
  150. package/resource-availability.js.map +1 -1
  151. package/runner-adapter.d.ts.map +1 -1
  152. package/runner-adapter.js.map +1 -1
  153. package/search.d.ts.map +1 -1
  154. package/search.js.map +1 -1
  155. package/session.d.ts.map +1 -1
  156. package/session.js.map +1 -1
  157. package/sharing.d.ts.map +1 -1
  158. package/sharing.js.map +1 -1
  159. package/skill.d.ts.map +1 -1
  160. package/skill.js.map +1 -1
  161. package/src/gen/authorization-config.ts +2 -2
  162. package/src/iam-principal.ts +24 -0
  163. package/src/index.ts +1 -0
  164. package/stigmer.d.ts.map +1 -1
  165. package/stigmer.js.map +1 -1
  166. package/transport.d.ts.map +1 -1
  167. package/transport.js.map +1 -1
  168. package/__tests__/billing.test.d.ts +0 -2
  169. package/__tests__/billing.test.d.ts.map +0 -1
  170. package/__tests__/billing.test.js +0 -120
  171. package/__tests__/billing.test.js.map +0 -1
  172. package/__tests__/config.test.d.ts +0 -2
  173. package/__tests__/config.test.d.ts.map +0 -1
  174. package/__tests__/config.test.js +0 -35
  175. package/__tests__/config.test.js.map +0 -1
  176. package/__tests__/ensure-identity-account.test.d.ts +0 -2
  177. package/__tests__/ensure-identity-account.test.d.ts.map +0 -1
  178. package/__tests__/ensure-identity-account.test.js +0 -108
  179. package/__tests__/ensure-identity-account.test.js.map +0 -1
  180. package/__tests__/errors.test.d.ts +0 -2
  181. package/__tests__/errors.test.d.ts.map +0 -1
  182. package/__tests__/errors.test.js +0 -228
  183. package/__tests__/errors.test.js.map +0 -1
  184. package/__tests__/gen/errors.test.d.ts +0 -2
  185. package/__tests__/gen/errors.test.d.ts.map +0 -1
  186. package/__tests__/gen/errors.test.js +0 -97
  187. package/__tests__/gen/errors.test.js.map +0 -1
  188. package/__tests__/gen/invitation-client.test.d.ts +0 -2
  189. package/__tests__/gen/invitation-client.test.d.ts.map +0 -1
  190. package/__tests__/gen/invitation-client.test.js +0 -106
  191. package/__tests__/gen/invitation-client.test.js.map +0 -1
  192. package/__tests__/gen/proto-utils.test.d.ts +0 -2
  193. package/__tests__/gen/proto-utils.test.d.ts.map +0 -1
  194. package/__tests__/gen/proto-utils.test.js +0 -85
  195. package/__tests__/gen/proto-utils.test.js.map +0 -1
  196. package/__tests__/gen/session-client.test.d.ts +0 -2
  197. package/__tests__/gen/session-client.test.d.ts.map +0 -1
  198. package/__tests__/gen/session-client.test.js +0 -152
  199. package/__tests__/gen/session-client.test.js.map +0 -1
  200. package/__tests__/guest-auth.test.d.ts +0 -2
  201. package/__tests__/guest-auth.test.d.ts.map +0 -1
  202. package/__tests__/guest-auth.test.js +0 -223
  203. package/__tests__/guest-auth.test.js.map +0 -1
  204. package/__tests__/iam-principal.test.d.ts +0 -2
  205. package/__tests__/iam-principal.test.d.ts.map +0 -1
  206. package/__tests__/iam-principal.test.js +0 -65
  207. package/__tests__/iam-principal.test.js.map +0 -1
  208. package/__tests__/manifest.test.d.ts +0 -2
  209. package/__tests__/manifest.test.d.ts.map +0 -1
  210. package/__tests__/manifest.test.js +0 -306
  211. package/__tests__/manifest.test.js.map +0 -1
  212. package/__tests__/mcpserver-connect.test.d.ts +0 -2
  213. package/__tests__/mcpserver-connect.test.d.ts.map +0 -1
  214. package/__tests__/mcpserver-connect.test.js +0 -146
  215. package/__tests__/mcpserver-connect.test.js.map +0 -1
  216. package/__tests__/node.test.d.ts +0 -2
  217. package/__tests__/node.test.d.ts.map +0 -1
  218. package/__tests__/node.test.js +0 -67
  219. package/__tests__/node.test.js.map +0 -1
  220. package/__tests__/platform-client-auth.test.d.ts +0 -2
  221. package/__tests__/platform-client-auth.test.d.ts.map +0 -1
  222. package/__tests__/platform-client-auth.test.js +0 -59
  223. package/__tests__/platform-client-auth.test.js.map +0 -1
  224. package/__tests__/platform.test.d.ts +0 -2
  225. package/__tests__/platform.test.d.ts.map +0 -1
  226. package/__tests__/platform.test.js +0 -52
  227. package/__tests__/platform.test.js.map +0 -1
  228. package/__tests__/plugin.test.d.ts +0 -2
  229. package/__tests__/plugin.test.d.ts.map +0 -1
  230. package/__tests__/plugin.test.js +0 -74
  231. package/__tests__/plugin.test.js.map +0 -1
  232. package/__tests__/resource-availability.test.d.ts +0 -2
  233. package/__tests__/resource-availability.test.d.ts.map +0 -1
  234. package/__tests__/resource-availability.test.js +0 -80
  235. package/__tests__/resource-availability.test.js.map +0 -1
  236. package/__tests__/runner-adapter.test.d.ts +0 -2
  237. package/__tests__/runner-adapter.test.d.ts.map +0 -1
  238. package/__tests__/runner-adapter.test.js +0 -88
  239. package/__tests__/runner-adapter.test.js.map +0 -1
  240. package/__tests__/session.test.d.ts +0 -6
  241. package/__tests__/session.test.d.ts.map +0 -1
  242. package/__tests__/session.test.js +0 -50
  243. package/__tests__/session.test.js.map +0 -1
  244. package/__tests__/sharing.test.d.ts +0 -2
  245. package/__tests__/sharing.test.d.ts.map +0 -1
  246. package/__tests__/sharing.test.js +0 -106
  247. package/__tests__/sharing.test.js.map +0 -1
  248. package/__tests__/skill.test.d.ts +0 -2
  249. package/__tests__/skill.test.d.ts.map +0 -1
  250. package/__tests__/skill.test.js +0 -117
  251. package/__tests__/skill.test.js.map +0 -1
  252. package/__tests__/stigmer.test.d.ts +0 -2
  253. package/__tests__/stigmer.test.d.ts.map +0 -1
  254. package/__tests__/stigmer.test.js +0 -127
  255. package/__tests__/stigmer.test.js.map +0 -1
  256. package/__tests__/update-input-roundtrip.test.d.ts +0 -2
  257. package/__tests__/update-input-roundtrip.test.d.ts.map +0 -1
  258. package/__tests__/update-input-roundtrip.test.js +0 -775
  259. package/__tests__/update-input-roundtrip.test.js.map +0 -1
  260. package/__tests__/update-input.test.d.ts +0 -2
  261. package/__tests__/update-input.test.d.ts.map +0 -1
  262. package/__tests__/update-input.test.js +0 -188
  263. package/__tests__/update-input.test.js.map +0 -1
  264. package/execution/__tests__/approval-provenance.test.d.ts +0 -2
  265. package/execution/__tests__/approval-provenance.test.d.ts.map +0 -1
  266. package/execution/__tests__/approval-provenance.test.js +0 -42
  267. package/execution/__tests__/approval-provenance.test.js.map +0 -1
  268. package/execution/__tests__/file-review-fold.corpus.test.d.ts +0 -2
  269. package/execution/__tests__/file-review-fold.corpus.test.d.ts.map +0 -1
  270. package/execution/__tests__/file-review-fold.corpus.test.js +0 -82
  271. package/execution/__tests__/file-review-fold.corpus.test.js.map +0 -1
  272. package/execution/__tests__/file-review-fold.test.d.ts +0 -2
  273. package/execution/__tests__/file-review-fold.test.d.ts.map +0 -1
  274. package/execution/__tests__/file-review-fold.test.js +0 -184
  275. package/execution/__tests__/file-review-fold.test.js.map +0 -1
  276. package/execution/__tests__/to-display-file-change.test.d.ts +0 -2
  277. package/execution/__tests__/to-display-file-change.test.d.ts.map +0 -1
  278. package/execution/__tests__/to-display-file-change.test.js +0 -81
  279. package/execution/__tests__/to-display-file-change.test.js.map +0 -1
  280. package/execution/__tests__/tool-view.file-changes.test.d.ts +0 -2
  281. package/execution/__tests__/tool-view.file-changes.test.d.ts.map +0 -1
  282. package/execution/__tests__/tool-view.file-changes.test.js +0 -86
  283. package/execution/__tests__/tool-view.file-changes.test.js.map +0 -1
  284. package/execution/__tests__/tool-view.fixtures.test.d.ts +0 -2
  285. package/execution/__tests__/tool-view.fixtures.test.d.ts.map +0 -1
  286. package/execution/__tests__/tool-view.fixtures.test.js +0 -152
  287. package/execution/__tests__/tool-view.fixtures.test.js.map +0 -1
  288. package/execution/__tests__/tool-view.output-ref.test.d.ts +0 -2
  289. package/execution/__tests__/tool-view.output-ref.test.d.ts.map +0 -1
  290. package/execution/__tests__/tool-view.output-ref.test.js +0 -64
  291. package/execution/__tests__/tool-view.output-ref.test.js.map +0 -1
  292. package/execution/__tests__/tool-view.read.test.d.ts +0 -2
  293. package/execution/__tests__/tool-view.read.test.d.ts.map +0 -1
  294. package/execution/__tests__/tool-view.read.test.js +0 -56
  295. package/execution/__tests__/tool-view.read.test.js.map +0 -1
  296. package/execution/__tests__/tool-view.search.test.d.ts +0 -2
  297. package/execution/__tests__/tool-view.search.test.d.ts.map +0 -1
  298. package/execution/__tests__/tool-view.search.test.js +0 -200
  299. package/execution/__tests__/tool-view.search.test.js.map +0 -1
  300. package/execution/__tests__/tool-view.shell.test.d.ts +0 -2
  301. package/execution/__tests__/tool-view.shell.test.d.ts.map +0 -1
  302. package/execution/__tests__/tool-view.shell.test.js +0 -104
  303. package/execution/__tests__/tool-view.shell.test.js.map +0 -1
  304. package/execution/__tests__/transcript.test.d.ts +0 -2
  305. package/execution/__tests__/transcript.test.d.ts.map +0 -1
  306. package/execution/__tests__/transcript.test.js +0 -591
  307. package/execution/__tests__/transcript.test.js.map +0 -1
  308. package/node.test.d.ts +0 -2
  309. package/node.test.d.ts.map +0 -1
  310. package/node.test.js +0 -35
  311. package/node.test.js.map +0 -1
  312. package/src/__tests__/billing.test.ts +0 -146
  313. package/src/__tests__/config.test.ts +0 -52
  314. package/src/__tests__/ensure-identity-account.test.ts +0 -146
  315. package/src/__tests__/errors.test.ts +0 -349
  316. package/src/__tests__/gen/errors.test.ts +0 -138
  317. package/src/__tests__/gen/invitation-client.test.ts +0 -132
  318. package/src/__tests__/gen/proto-utils.test.ts +0 -99
  319. package/src/__tests__/gen/session-client.test.ts +0 -208
  320. package/src/__tests__/guest-auth.test.ts +0 -287
  321. package/src/__tests__/iam-principal.test.ts +0 -82
  322. package/src/__tests__/manifest.test.ts +0 -362
  323. package/src/__tests__/mcpserver-connect.test.ts +0 -181
  324. package/src/__tests__/node.test.ts +0 -74
  325. package/src/__tests__/platform-client-auth.test.ts +0 -76
  326. package/src/__tests__/platform.test.ts +0 -74
  327. package/src/__tests__/plugin.test.ts +0 -92
  328. package/src/__tests__/resource-availability.test.ts +0 -118
  329. package/src/__tests__/runner-adapter.test.ts +0 -122
  330. package/src/__tests__/session.test.ts +0 -66
  331. package/src/__tests__/sharing.test.ts +0 -159
  332. package/src/__tests__/skill.test.ts +0 -150
  333. package/src/__tests__/stigmer.test.ts +0 -170
  334. package/src/__tests__/update-input-roundtrip.test.ts +0 -1007
  335. package/src/__tests__/update-input.test.ts +0 -250
  336. package/src/execution/__tests__/approval-provenance.test.ts +0 -60
  337. package/src/execution/__tests__/file-review-fold.corpus.test.ts +0 -127
  338. package/src/execution/__tests__/file-review-fold.test.ts +0 -281
  339. package/src/execution/__tests__/to-display-file-change.test.ts +0 -106
  340. package/src/execution/__tests__/tool-view.file-changes.test.ts +0 -100
  341. package/src/execution/__tests__/tool-view.fixtures.test.ts +0 -225
  342. package/src/execution/__tests__/tool-view.output-ref.test.ts +0 -76
  343. package/src/execution/__tests__/tool-view.read.test.ts +0 -71
  344. package/src/execution/__tests__/tool-view.search.test.ts +0 -264
  345. package/src/execution/__tests__/tool-view.shell.test.ts +0 -127
  346. package/src/execution/__tests__/transcript.golden.md +0 -100
  347. package/src/execution/__tests__/transcript.test.ts +0 -697
  348. package/src/node.test.ts +0 -38
@@ -1,150 +0,0 @@
1
- // Wire-shape tests for RoutedSkillClient's size-routed push (stigmer#701).
2
- // A router transport fakes the skill service in-process, so the routing is
3
- // exercised through the REAL generated client and its error wrapping — the
4
- // CLI's earlier copy of this logic keyed its fallback on `instanceof
5
- // ConnectError`, which the SDK's wrapError made unreachable; these pins run
6
- // the wrapped path. Mirrors sdk/go/skill_test.go's five routing pins.
7
- import { describe, expect, it, vi } from "vitest";
8
- import { Code, ConnectError, createRouterTransport, type Transport } from "@connectrpc/connect";
9
- import { create } from "@bufbuild/protobuf";
10
- import { SkillCommandController } from "@stigmer/protos/ai/stigmer/agentic/skill/v1/command_pb";
11
- import { SkillSchema } from "@stigmer/protos/ai/stigmer/agentic/skill/v1/api_pb";
12
- import {
13
- PushSkillRequestSchema,
14
- SkillArtifactUploadUrlSchema,
15
- type PushSkillRequest,
16
- } from "@stigmer/protos/ai/stigmer/agentic/skill/v1/io_pb";
17
- import { StigmerError } from "../gen/errors.js";
18
- import { MAX_INLINE_ARTIFACT_BYTES, RoutedSkillClient } from "../skill.js";
19
-
20
- const STAGING_URL = "http://stage.example/v1/skill-artifacts/uploads/sau_t";
21
-
22
- interface Captured {
23
- pushes: PushSkillRequest[];
24
- mints: number;
25
- }
26
-
27
- /**
28
- * In-process skill service. `withMint: false` leaves createArtifactUploadUrl
29
- * unregistered, so the router answers Unimplemented — the exact wire shape
30
- * of a pre-transfer-lane server.
31
- */
32
- function fakeTransport(captured: Captured, opts: { withMint: boolean } = { withMint: true }): Transport {
33
- return createRouterTransport(({ service }) => {
34
- service(SkillCommandController, {
35
- push: (req) => {
36
- captured.pushes.push(req);
37
- return create(SkillSchema, {});
38
- },
39
- ...(opts.withMint
40
- ? {
41
- createArtifactUploadUrl: (req) => {
42
- captured.mints++;
43
- expect(req.sizeBytes).toBeGreaterThan(0n);
44
- return create(SkillArtifactUploadUrlSchema, {
45
- url: STAGING_URL,
46
- artifactUploadRef: "sau_t",
47
- ttlSeconds: 900,
48
- });
49
- },
50
- }
51
- : {}),
52
- });
53
- });
54
- }
55
-
56
- function okFetch(record: { putUrl?: string; putBytes?: number; contentType?: string }) {
57
- return vi.fn(async (url: any, init: any) => {
58
- record.putUrl = String(url);
59
- record.putBytes = init.body instanceof Uint8Array ? init.body.byteLength : -1;
60
- record.contentType = init.headers["content-type"];
61
- return new Response(null, { status: 200 });
62
- }) as unknown as typeof globalThis.fetch;
63
- }
64
-
65
- describe("RoutedSkillClient.push size routing", () => {
66
- it("keeps small artifacts inline — no mint, bytes in the request", async () => {
67
- const captured: Captured = { pushes: [], mints: 0 };
68
- const client = new RoutedSkillClient(fakeTransport(captured));
69
-
70
- await client.push(create(PushSkillRequestSchema, { org: "acme", artifact: new Uint8Array(1024) }));
71
-
72
- expect(captured.mints).toBe(0);
73
- expect(captured.pushes).toHaveLength(1);
74
- expect(captured.pushes[0].artifact.length).toBe(1024);
75
- });
76
-
77
- it("stages large artifacts over HTTP and pushes by reference, preserving the envelope", async () => {
78
- const captured: Captured = { pushes: [], mints: 0 };
79
- const record: { putUrl?: string; putBytes?: number; contentType?: string } = {};
80
- const client = new RoutedSkillClient(fakeTransport(captured), okFetch(record));
81
- const artifact = new Uint8Array(MAX_INLINE_ARTIFACT_BYTES + 1);
82
-
83
- await client.push(create(PushSkillRequestSchema, { org: "acme", artifact, tag: "stable", message: "big" }));
84
-
85
- expect(captured.mints).toBe(1);
86
- expect(record.putUrl).toBe(STAGING_URL);
87
- expect(record.putBytes).toBe(artifact.length);
88
- expect(record.contentType).toBe("application/zip");
89
- expect(captured.pushes).toHaveLength(1);
90
- expect(captured.pushes[0].artifact.length).toBe(0);
91
- expect(captured.pushes[0].artifactUploadRef).toBe("sau_t");
92
- // The by-ref rewrite must not lose the rest of the request.
93
- expect(captured.pushes[0].tag).toBe("stable");
94
- expect(captured.pushes[0].message).toBe("big");
95
- });
96
-
97
- it("passes an explicit upload ref through untouched — the caller staged it", async () => {
98
- const captured: Captured = { pushes: [], mints: 0 };
99
- const client = new RoutedSkillClient(fakeTransport(captured));
100
-
101
- await client.push(create(PushSkillRequestSchema, { org: "acme", artifactUploadRef: "sau_mine" }));
102
-
103
- expect(captured.mints).toBe(0);
104
- expect(captured.pushes).toHaveLength(1);
105
- expect(captured.pushes[0].artifactUploadRef).toBe("sau_mine");
106
- });
107
-
108
- it("fails loud against servers that predate the transfer lane (wrapped Unimplemented)", async () => {
109
- const captured: Captured = { pushes: [], mints: 0 };
110
- const client = new RoutedSkillClient(fakeTransport(captured, { withMint: false }));
111
-
112
- await expect(
113
- client.push(create(PushSkillRequestSchema, { org: "acme", artifact: new Uint8Array(MAX_INLINE_ARTIFACT_BYTES + 1) })),
114
- ).rejects.toThrow(/upgrade stigmer-server/);
115
- expect(captured.pushes).toHaveLength(0);
116
- });
117
-
118
- it("surfaces the staging rejection body and never proceeds to push", async () => {
119
- const captured: Captured = { pushes: [], mints: 0 };
120
- const rejectingFetch = (async () =>
121
- new Response("staging slot expired", { status: 404 })) as unknown as typeof globalThis.fetch;
122
- const client = new RoutedSkillClient(fakeTransport(captured), rejectingFetch);
123
-
124
- await expect(
125
- client.push(create(PushSkillRequestSchema, { org: "acme", artifact: new Uint8Array(MAX_INLINE_ARTIFACT_BYTES + 1) })),
126
- ).rejects.toThrow(/HTTP 404: staging slot expired/);
127
- expect(captured.pushes).toHaveLength(0);
128
- });
129
-
130
- it("propagates non-Unimplemented mint errors unmasked", async () => {
131
- const captured: Captured = { pushes: [], mints: 0 };
132
- const transport = createRouterTransport(({ service }) => {
133
- service(SkillCommandController, {
134
- push: (req) => {
135
- captured.pushes.push(req);
136
- return create(SkillSchema, {});
137
- },
138
- createArtifactUploadUrl: () => {
139
- throw new ConnectError("artifact too large", Code.InvalidArgument);
140
- },
141
- });
142
- });
143
- const client = new RoutedSkillClient(transport);
144
-
145
- await expect(
146
- client.push(create(PushSkillRequestSchema, { org: "acme", artifact: new Uint8Array(MAX_INLINE_ARTIFACT_BYTES + 1) })),
147
- ).rejects.toSatisfy((err: unknown) => err instanceof StigmerError && err.code === "invalid-argument");
148
- expect(captured.pushes).toHaveLength(0);
149
- });
150
- });
@@ -1,170 +0,0 @@
1
- import { describe, it, expect, beforeEach } from "vitest";
2
- import type { Transport } from "@connectrpc/connect";
3
- import type { AgentExecution } from "@stigmer/protos/ai/stigmer/agentic/agentexecution/v1/api_pb";
4
- import type { Session } from "@stigmer/protos/ai/stigmer/agentic/session/v1/api_pb";
5
- import { ExecutionTarget } from "@stigmer/protos/ai/stigmer/agentic/session/v1/enum_pb";
6
- import { Stigmer } from "../stigmer";
7
-
8
- interface CapturedRequest {
9
- methodName: string;
10
- message: unknown;
11
- }
12
-
13
- function createCapturingTransport(): {
14
- transport: Transport;
15
- captured: CapturedRequest[];
16
- } {
17
- const captured: CapturedRequest[] = [];
18
-
19
- const transport = {
20
- unary: async (
21
- method: { name: string },
22
- _signal: unknown,
23
- _timeout: unknown,
24
- _header: unknown,
25
- message: unknown,
26
- ) => ({
27
- header: new Headers(),
28
- trailer: new Headers(),
29
- message,
30
- }),
31
- stream: async () => {
32
- throw new Error("streaming not implemented in test transport");
33
- },
34
- } as unknown as Transport;
35
-
36
- const originalUnary = (transport as unknown as Record<string, unknown>).unary as (
37
- ...args: unknown[]
38
- ) => Promise<unknown>;
39
-
40
- (transport as unknown as Record<string, unknown>).unary = async (
41
- method: { name: string },
42
- signal: unknown,
43
- timeout: unknown,
44
- header: unknown,
45
- message: unknown,
46
- ...rest: unknown[]
47
- ) => {
48
- captured.push({ methodName: method.name, message });
49
- return originalUnary(method, signal, timeout, header, message, ...rest);
50
- };
51
-
52
- return { transport, captured };
53
- }
54
-
55
- describe("Stigmer execution target defaults", () => {
56
- let captured: CapturedRequest[];
57
- let stigmer: Stigmer;
58
-
59
- describe("with executionTarget: 'local'", () => {
60
- beforeEach(() => {
61
- const ctx = createCapturingTransport();
62
- captured = ctx.captured;
63
- stigmer = new Stigmer({
64
- baseUrl: "http://localhost:7234",
65
- apiKey: "test-key",
66
- executionTarget: "local",
67
- customTransport: ctx.transport,
68
- });
69
- });
70
-
71
- it("injects LOCAL into session.create when per-call input omits it", async () => {
72
- await stigmer.session.create({ name: "test", org: "test-org" });
73
- const proto = captured[0].message as Session;
74
- expect(proto.spec?.executionTarget).toBe(ExecutionTarget.LOCAL);
75
- });
76
-
77
- it("preserves per-call override on session.create", async () => {
78
- await stigmer.session.create({
79
- name: "test",
80
- org: "test-org",
81
- executionTarget: ExecutionTarget.CLOUD,
82
- });
83
- const proto = captured[0].message as Session;
84
- expect(proto.spec?.executionTarget).toBe(ExecutionTarget.CLOUD);
85
- });
86
-
87
- it("injects LOCAL into session.apply when per-call input omits it", async () => {
88
- await stigmer.session.apply({ name: "test", org: "test-org" });
89
- const proto = captured[0].message as Session;
90
- expect(proto.spec?.executionTarget).toBe(ExecutionTarget.LOCAL);
91
- });
92
-
93
- it("injects LOCAL into agentExecution.create's sessionSpec (one-call bootstrap)", async () => {
94
- await stigmer.agentExecution.create({
95
- name: "test",
96
- org: "test-org",
97
- message: "hi",
98
- sessionSpec: { agentInstanceId: "ain_1" },
99
- });
100
- const proto = captured[0].message as AgentExecution;
101
- expect(proto.spec?.sessionSpec?.executionTarget).toBe(ExecutionTarget.LOCAL);
102
- });
103
-
104
- it("preserves a per-call sessionSpec.executionTarget override", async () => {
105
- await stigmer.agentExecution.create({
106
- name: "test",
107
- org: "test-org",
108
- message: "hi",
109
- sessionSpec: {
110
- agentInstanceId: "ain_1",
111
- executionTarget: ExecutionTarget.CLOUD,
112
- },
113
- });
114
- const proto = captured[0].message as AgentExecution;
115
- expect(proto.spec?.sessionSpec?.executionTarget).toBe(ExecutionTarget.CLOUD);
116
- });
117
-
118
- it("does not synthesize a sessionSpec on agentExecution.create without one", async () => {
119
- await stigmer.agentExecution.create({
120
- name: "test",
121
- org: "test-org",
122
- message: "hi",
123
- sessionId: "ses_1",
124
- });
125
- const proto = captured[0].message as AgentExecution;
126
- expect(proto.spec?.sessionSpec).toBeUndefined();
127
- });
128
- });
129
-
130
- describe("with executionTarget: 'cloud'", () => {
131
- beforeEach(() => {
132
- const ctx = createCapturingTransport();
133
- captured = ctx.captured;
134
- stigmer = new Stigmer({
135
- baseUrl: "http://localhost:7234",
136
- apiKey: "test-key",
137
- executionTarget: "cloud",
138
- customTransport: ctx.transport,
139
- });
140
- });
141
-
142
- it("injects CLOUD into session.create", async () => {
143
- await stigmer.session.create({ name: "test", org: "test-org" });
144
- const proto = captured[0].message as Session;
145
- expect(proto.spec?.executionTarget).toBe(ExecutionTarget.CLOUD);
146
- });
147
- });
148
-
149
- describe("without executionTarget config", () => {
150
- beforeEach(() => {
151
- const ctx = createCapturingTransport();
152
- captured = ctx.captured;
153
- stigmer = new Stigmer({
154
- baseUrl: "http://localhost:7234",
155
- apiKey: "test-key",
156
- customTransport: ctx.transport,
157
- });
158
- });
159
-
160
- it("does not inject executionTarget on session.create", async () => {
161
- await stigmer.session.create({ name: "test", org: "test-org" });
162
- const proto = captured[0].message as Session;
163
- expect(proto.spec?.executionTarget).toBe(ExecutionTarget.UNSPECIFIED);
164
- });
165
-
166
- it("defaultExecutionTarget is undefined", () => {
167
- expect(stigmer.defaultExecutionTarget).toBeUndefined();
168
- });
169
- });
170
- });