@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,250 +0,0 @@
1
- import { describe, it, expect } from "vitest";
2
- import { create, toJson } from "@bufbuild/protobuf";
3
- import { ApiResourceVisibility } from "@stigmer/protos/ai/stigmer/commons/apiresource/enum_pb";
4
- import { ApiResourceKind } from "@stigmer/protos/ai/stigmer/commons/apiresource/apiresourcekind/api_resource_kind_pb";
5
- import {
6
- OrganizationSchema,
7
- type Organization,
8
- } from "@stigmer/protos/ai/stigmer/tenancy/organization/v1/api_pb";
9
- import { OrganizationSpecSchema } from "@stigmer/protos/ai/stigmer/tenancy/organization/v1/spec_pb";
10
- import { ManagementMode } from "@stigmer/protos/ai/stigmer/tenancy/organization/v1/enum_pb";
11
- import {
12
- IdentityAccountSchema,
13
- type IdentityAccount,
14
- } from "@stigmer/protos/ai/stigmer/iam/identityaccount/v1/api_pb";
15
- import { IdentityAccountSpecSchema } from "@stigmer/protos/ai/stigmer/iam/identityaccount/v1/spec_pb";
16
- import { IdentityAccountProvisioningMode } from "@stigmer/protos/ai/stigmer/iam/identityaccount/v1/enum_pb";
17
- import {
18
- buildOrganizationProto,
19
- toOrganizationUpdateInput,
20
- } from "../gen/organization";
21
- import {
22
- buildIdentityAccountProto,
23
- toIdentityAccountUpdateInput,
24
- } from "../gen/identityaccount";
25
-
26
- /**
27
- * Update RPCs are full-spec replacements, so a complete mapper must
28
- * round-trip EVERY mutable field of a loaded resource through the generated
29
- * builder without loss. These tests pin that contract: fully-populated
30
- * resource → mapper → builder → spec (as JSON, defaults omitted) deep-equals
31
- * the original. If a mapper drops a field, the wipe-bug class is back.
32
- */
33
-
34
- function fullOrganization(): Organization {
35
- return create(OrganizationSchema, {
36
- apiVersion: "tenancy.stigmer.ai/v1",
37
- kind: "Organization",
38
- metadata: {
39
- id: "acme",
40
- name: "Acme Corp",
41
- slug: "acme",
42
- org: "acme",
43
- labels: { tier: "gold" },
44
- visibility: ApiResourceVisibility.visibility_private,
45
- },
46
- spec: {
47
- description: "We make everything.",
48
- logoUrl: "https://acme.example/logo.png",
49
- managementMode: ManagementMode.self_managed,
50
- identityProviderRef: {
51
- org: "acme",
52
- slug: "acme-okta",
53
- kind: ApiResourceKind.identity_provider,
54
- },
55
- externalOrgId: "ext-org-1",
56
- isPersonal: true,
57
- preferences: { standingContext: "We deploy to us-east-1." },
58
- },
59
- });
60
- }
61
-
62
- function fullIdentityAccount(): IdentityAccount {
63
- return create(IdentityAccountSchema, {
64
- apiVersion: "iam.stigmer.ai/v1",
65
- kind: "IdentityAccount",
66
- metadata: {
67
- id: "ia-123",
68
- name: "Ada Lovelace",
69
- slug: "ada-lovelace",
70
- org: "acme",
71
- labels: { team: "platform" },
72
- visibility: ApiResourceVisibility.visibility_private,
73
- },
74
- spec: {
75
- idpId: "auth0|abc123",
76
- email: "ada@acme.example",
77
- firstName: "Ada",
78
- lastName: "Lovelace",
79
- pictureUrl: "https://acme.example/ada.png",
80
- isMachineAccount: true,
81
- provisioningMode: IdentityAccountProvisioningMode.federated,
82
- identityProviderRef: { org: "acme", slug: "acme-okta" },
83
- preferences: {
84
- standingContext: "Keep answers terse.",
85
- defaultHarness: "cursor",
86
- defaultNativeModel: "claude-sonnet-4.6",
87
- defaultCursorModel: "composer-2.5",
88
- },
89
- },
90
- });
91
- }
92
-
93
- describe("toOrganizationUpdateInput", () => {
94
- it("round-trips a fully-populated organization spec through the builder", () => {
95
- const org = fullOrganization();
96
-
97
- const built = buildOrganizationProto(toOrganizationUpdateInput(org));
98
-
99
- expect(toJson(OrganizationSpecSchema, built.spec!)).toEqual(
100
- toJson(OrganizationSpecSchema, org.spec!),
101
- );
102
- expect(built.metadata?.name).toBe("Acme Corp");
103
- expect(built.metadata?.slug).toBe("acme");
104
- expect(built.metadata?.org).toBe("acme");
105
- expect(built.metadata?.labels).toEqual({ tier: "gold" });
106
- expect(built.metadata?.visibility).toBe(
107
- ApiResourceVisibility.visibility_private,
108
- );
109
- });
110
-
111
- it("preserves preferences when a caller overrides only profile fields (the wipe-bug class)", () => {
112
- const org = fullOrganization();
113
-
114
- const built = buildOrganizationProto({
115
- ...toOrganizationUpdateInput(org),
116
- description: "New description",
117
- });
118
-
119
- expect(built.spec?.preferences?.standingContext).toBe(
120
- "We deploy to us-east-1.",
121
- );
122
- expect(built.spec?.description).toBe("New description");
123
- expect(built.spec?.logoUrl).toBe("https://acme.example/logo.png");
124
- });
125
-
126
- it("maps an empty spec without inventing values", () => {
127
- const org = create(OrganizationSchema, {
128
- metadata: { name: "Bare", slug: "bare", org: "bare" },
129
- spec: {},
130
- });
131
-
132
- const built = buildOrganizationProto(toOrganizationUpdateInput(org));
133
-
134
- expect(toJson(OrganizationSpecSchema, built.spec!)).toEqual({});
135
- });
136
-
137
- it("falls back to the slug when metadata.org is empty", () => {
138
- const org = create(OrganizationSchema, {
139
- metadata: { name: "Bare", slug: "bare" },
140
- });
141
-
142
- expect(toOrganizationUpdateInput(org).org).toBe("bare");
143
- });
144
-
145
- it("carries metadata.id for exact update addressing", () => {
146
- const built = buildOrganizationProto(
147
- toOrganizationUpdateInput(fullOrganization()),
148
- );
149
-
150
- expect(built.metadata?.id).toBe("acme");
151
- });
152
- });
153
-
154
- describe("toIdentityAccountUpdateInput", () => {
155
- it("round-trips a fully-populated identity account spec through the builder", () => {
156
- const account = fullIdentityAccount();
157
-
158
- const built = buildIdentityAccountProto(
159
- toIdentityAccountUpdateInput(account),
160
- );
161
-
162
- expect(toJson(IdentityAccountSpecSchema, built.spec!)).toEqual(
163
- toJson(IdentityAccountSpecSchema, account.spec!),
164
- );
165
- expect(built.metadata?.name).toBe("Ada Lovelace");
166
- expect(built.metadata?.labels).toEqual({ team: "platform" });
167
- });
168
-
169
- it("carries org and slug — the update pipeline's fallback address", () => {
170
- const input = toIdentityAccountUpdateInput(fullIdentityAccount());
171
-
172
- expect(input.org).toBe("acme");
173
- expect(input.slug).toBe("ada-lovelace");
174
- });
175
-
176
- it("carries metadata.id — the ONLY address that works for a real (org-less) account", () => {
177
- // Identity accounts are platform-scoped: metadata.org is never set in
178
- // production, so the pipeline's org+slug fallback structurally cannot
179
- // match one. Without the id, this update is NOT_FOUND by construction.
180
- const account = create(IdentityAccountSchema, {
181
- metadata: {
182
- id: "ida_01JEXAMPLE",
183
- name: "ada@acme.example",
184
- slug: "ada-acme-example",
185
- },
186
- spec: { idpId: "auth0|abc123" },
187
- });
188
-
189
- const built = buildIdentityAccountProto(
190
- toIdentityAccountUpdateInput(account),
191
- );
192
-
193
- expect(built.metadata?.id).toBe("ida_01JEXAMPLE");
194
- expect(built.metadata?.slug).toBe("ada-acme-example");
195
- });
196
-
197
- it("preserves the rest of the spec when a caller overrides only preferences", () => {
198
- const account = fullIdentityAccount();
199
- const mapped = toIdentityAccountUpdateInput(account);
200
-
201
- const built = buildIdentityAccountProto({
202
- ...mapped,
203
- preferences: { ...mapped.preferences, standingContext: "Prefer bullet points." },
204
- });
205
-
206
- expect(built.spec?.preferences?.standingContext).toBe(
207
- "Prefer bullet points.",
208
- );
209
- expect(built.spec?.email).toBe("ada@acme.example");
210
- expect(built.spec?.idpId).toBe("auth0|abc123");
211
- expect(built.spec?.provisioningMode).toBe(
212
- IdentityAccountProvisioningMode.federated,
213
- );
214
- });
215
-
216
- it("preserves structured defaults when only standing context is edited (nested wipe-bug class)", () => {
217
- const account = fullIdentityAccount();
218
- const mapped = toIdentityAccountUpdateInput(account);
219
-
220
- // The correct editor pattern for a nested message: spread the mapper's
221
- // COMPLETE preferences and override only the edited field. A bare
222
- // `preferences: { standingContext }` literal would wipe the structured
223
- // defaults — the session-4 wipe bug recurring one level down.
224
- const built = buildIdentityAccountProto({
225
- ...mapped,
226
- preferences: { ...mapped.preferences, standingContext: "Terser still." },
227
- });
228
-
229
- expect(built.spec?.preferences?.standingContext).toBe("Terser still.");
230
- expect(built.spec?.preferences?.defaultHarness).toBe("cursor");
231
- expect(built.spec?.preferences?.defaultNativeModel).toBe("claude-sonnet-4.6");
232
- expect(built.spec?.preferences?.defaultCursorModel).toBe("composer-2.5");
233
- });
234
-
235
- it("clears standing context to wire-absent when the text is emptied", () => {
236
- const account = fullIdentityAccount();
237
- const mapped = toIdentityAccountUpdateInput(account);
238
-
239
- const built = buildIdentityAccountProto({
240
- ...mapped,
241
- preferences: { ...mapped.preferences, standingContext: "" },
242
- });
243
-
244
- // Proto3 empty string is the field default — wire-identical to absent,
245
- // which the server compose steps treat as "no preference declared".
246
- expect(built.spec?.preferences?.standingContext ?? "").toBe("");
247
- // Clearing one field never disturbs its siblings.
248
- expect(built.spec?.preferences?.defaultHarness).toBe("cursor");
249
- });
250
- });
@@ -1,60 +0,0 @@
1
- import { describe, it, expect } from "vitest";
2
- import {
3
- ApprovalPolicySource,
4
- describeApprovalPolicySource,
5
- isInformativePolicySource,
6
- } from "../approval-provenance";
7
-
8
- describe("describeApprovalPolicySource", () => {
9
- it("maps each known source to a stable human phrase", () => {
10
- expect(describeApprovalPolicySource(ApprovalPolicySource.CLASSIFIER_DEFAULT)).toBe(
11
- "required by the tool's default policy",
12
- );
13
- expect(describeApprovalPolicySource(ApprovalPolicySource.BUILTIN_CATEGORY)).toBe(
14
- "required by built-in tool policy",
15
- );
16
- expect(describeApprovalPolicySource(ApprovalPolicySource.AGENT_OVERRIDE)).toBe(
17
- "required by agent override",
18
- );
19
- expect(
20
- describeApprovalPolicySource(ApprovalPolicySource.ANNOTATION_DESTRUCTIVE_TIGHTEN),
21
- ).toBe("required: marked destructive by the server");
22
- });
23
-
24
- it("returns null for UNSPECIFIED (legacy / ungated)", () => {
25
- expect(describeApprovalPolicySource(ApprovalPolicySource.UNSPECIFIED)).toBeNull();
26
- });
27
- });
28
-
29
- describe("isInformativePolicySource", () => {
30
- it("suppresses the everyday default gating reasons", () => {
31
- // These add nothing beyond "this tool needs approval" — noise at the gate.
32
- expect(isInformativePolicySource(ApprovalPolicySource.CLASSIFIER_DEFAULT)).toBe(false);
33
- expect(isInformativePolicySource(ApprovalPolicySource.BUILTIN_CATEGORY)).toBe(false);
34
- expect(isInformativePolicySource(ApprovalPolicySource.UNSPECIFIED)).toBe(false);
35
- });
36
-
37
- it("surfaces reasons that change the user's understanding of the gate", () => {
38
- expect(isInformativePolicySource(ApprovalPolicySource.PINNED_OVERRIDE)).toBe(true);
39
- expect(isInformativePolicySource(ApprovalPolicySource.AGENT_OVERRIDE)).toBe(true);
40
- expect(
41
- isInformativePolicySource(ApprovalPolicySource.ANNOTATION_DESTRUCTIVE_TIGHTEN),
42
- ).toBe(true);
43
- expect(isInformativePolicySource(ApprovalPolicySource.AUTO_APPROVE_ALL)).toBe(true);
44
- expect(isInformativePolicySource(ApprovalPolicySource.APPROVAL_LEASE)).toBe(true);
45
- });
46
-
47
- it("only surfaces a reason that also has a phrase to show", () => {
48
- // The card renders `isInformative(source) && describe(source) != null`; the
49
- // two must never disagree for a surfaced source.
50
- for (const source of [
51
- ApprovalPolicySource.PINNED_OVERRIDE,
52
- ApprovalPolicySource.AGENT_OVERRIDE,
53
- ApprovalPolicySource.ANNOTATION_DESTRUCTIVE_TIGHTEN,
54
- ApprovalPolicySource.AUTO_APPROVE_ALL,
55
- ApprovalPolicySource.APPROVAL_LEASE,
56
- ]) {
57
- expect(describeApprovalPolicySource(source)).not.toBeNull();
58
- }
59
- });
60
- });
@@ -1,127 +0,0 @@
1
- // Cross-edition parity lock for the file-review projection.
2
- //
3
- // The Go (`FileChangeSetProjector` / project.go) and Java (`FileChangeSetProjector`)
4
- // projectors replay the shared corpus at apis/testdata/hitl/file-review/*.json.
5
- // This test replays the SAME corpus against the TypeScript fold, so a drift
6
- // between the SDK and either backend fails here rather than shipping.
7
- //
8
- // The corpus `expected` is the server (actionable) projection, which is empty
9
- // for a terminal execution. The SDK's display fold intentionally has no terminal
10
- // gate, so to reproduce the server contract exactly this test applies the phase
11
- // gate the accessor's callers apply: isTerminalPhase(phase) ? [] : fold(stream).
12
- // That both proves parity for non-terminal vectors AND pins the terminal-empty
13
- // vector — the one place the SDK deliberately differs is covered by the accessor
14
- // test in file-review-fold.test.ts, not here.
15
-
16
- import { readFileSync, readdirSync } from "node:fs";
17
- import { fileURLToPath } from "node:url";
18
- import { dirname, resolve } from "node:path";
19
- import { describe, it, expect } from "vitest";
20
- import { create, fromJson, type JsonValue } from "@bufbuild/protobuf";
21
- import {
22
- FileReviewEventSchema,
23
- FileReviewEventStreamSchema,
24
- } from "@stigmer/protos/ai/stigmer/agentic/agentexecution/v1/filereview_pb";
25
- import {
26
- ExecutionPhase,
27
- FileChangeSetStatus,
28
- } from "@stigmer/protos/ai/stigmer/agentic/agentexecution/v1/enum_pb";
29
- import { foldFileReviewEventStream } from "../file-review-fold";
30
- import { isTerminalPhase } from "../execution-phases";
31
-
32
- const here = dirname(fileURLToPath(import.meta.url));
33
- // sdk/typescript/src/execution/__tests__ -> repo root is five levels up.
34
- const corpusDir = resolve(here, "../../../../../apis/testdata/hitl/file-review");
35
-
36
- /** The `expected` summary shape each vector pins (see the corpus README). */
37
- interface ExpectedSet {
38
- id: string;
39
- status: string; // full proto enum name, e.g. FILE_CHANGE_SET_STATUS_DECIDED
40
- change_ids?: string[];
41
- decision_count?: number;
42
- aggregate_digest?: string;
43
- has_approved_snapshot?: boolean;
44
- }
45
-
46
- interface Vector {
47
- name: string;
48
- description?: string;
49
- execution_id: string;
50
- phase: string;
51
- events: JsonValue[];
52
- expected: ExpectedSet[];
53
- }
54
-
55
- function statusFromName(name: string): FileChangeSetStatus {
56
- const key = name.replace(
57
- /^FILE_CHANGE_SET_STATUS_/,
58
- "",
59
- ) as keyof typeof FileChangeSetStatus;
60
- const value = FileChangeSetStatus[key];
61
- if (typeof value !== "number") {
62
- throw new Error(`unknown FileChangeSetStatus in corpus: ${name}`);
63
- }
64
- return value;
65
- }
66
-
67
- function phaseFromName(name: string): ExecutionPhase {
68
- const value = ExecutionPhase[name as keyof typeof ExecutionPhase];
69
- if (typeof value !== "number") {
70
- throw new Error(`unknown ExecutionPhase in corpus: ${name}`);
71
- }
72
- return value;
73
- }
74
-
75
- const vectorFiles = readdirSync(corpusDir).filter(
76
- (f) => f.endsWith(".json") && f !== "schema.json",
77
- );
78
-
79
- describe("file-review fold — cross-edition corpus parity", () => {
80
- it("finds the corpus vectors", () => {
81
- expect(vectorFiles.length).toBeGreaterThan(0);
82
- });
83
-
84
- for (const file of vectorFiles) {
85
- const vector = JSON.parse(
86
- readFileSync(resolve(corpusDir, file), "utf8"),
87
- ) as Vector;
88
-
89
- it(`${file}: ${vector.name}`, () => {
90
- // Decode each event with the generated schema so a malformed fixture fails
91
- // loudly (matching the backend corpus drivers), then build the stream.
92
- const events = vector.events.map((ev) =>
93
- fromJson(FileReviewEventSchema, ev),
94
- );
95
- const stream = create(FileReviewEventStreamSchema, {
96
- executionId: vector.execution_id,
97
- events,
98
- });
99
-
100
- const phase = phaseFromName(vector.phase);
101
- // Reproduce the server's actionable projection: phase-gated fold.
102
- const projected = isTerminalPhase(phase)
103
- ? []
104
- : foldFileReviewEventStream(stream);
105
-
106
- const actual = projected.map((set) => ({
107
- id: set.id,
108
- status: set.status,
109
- change_ids: set.changes.map((c) => c.id),
110
- decision_count: set.decisions.length,
111
- aggregate_digest: set.aggregateDigest,
112
- has_approved_snapshot: set.approvedSnapshot !== undefined,
113
- }));
114
-
115
- const expected = vector.expected.map((e) => ({
116
- id: e.id,
117
- status: statusFromName(e.status),
118
- change_ids: e.change_ids ?? [],
119
- decision_count: e.decision_count ?? 0,
120
- aggregate_digest: e.aggregate_digest ?? "",
121
- has_approved_snapshot: e.has_approved_snapshot ?? false,
122
- }));
123
-
124
- expect(actual).toEqual(expected);
125
- });
126
- }
127
- });