@stigmer/server 3.18.0-dev.20260918103812 → 3.18.1-dev.20260919070736

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 (157) hide show
  1. package/README.md +1 -1
  2. package/dist/boot/compose.d.ts +12 -0
  3. package/dist/boot/compose.d.ts.map +1 -1
  4. package/dist/boot/compose.js +46 -8
  5. package/dist/boot/compose.js.map +1 -1
  6. package/dist/boot/config.d.ts +6 -2
  7. package/dist/boot/config.d.ts.map +1 -1
  8. package/dist/boot/config.js.map +1 -1
  9. package/dist/boot/oauth-redirect-uri.d.ts +54 -0
  10. package/dist/boot/oauth-redirect-uri.d.ts.map +1 -0
  11. package/dist/boot/oauth-redirect-uri.js +37 -0
  12. package/dist/boot/oauth-redirect-uri.js.map +1 -0
  13. package/dist/domain/agentexecution/lifecycle.js +1 -1
  14. package/dist/domain/agentexecution/lifecycle.js.map +1 -1
  15. package/dist/domain/iampolicy/constants.d.ts +3 -3
  16. package/dist/domain/iampolicy/constants.js +3 -3
  17. package/dist/domain/mcpserver/complete-endpoint-auth.d.ts +16 -0
  18. package/dist/domain/mcpserver/complete-endpoint-auth.d.ts.map +1 -0
  19. package/dist/domain/mcpserver/complete-endpoint-auth.js +260 -0
  20. package/dist/domain/mcpserver/complete-endpoint-auth.js.map +1 -0
  21. package/dist/domain/mcpserver/complete-oauth-connect.d.ts.map +1 -1
  22. package/dist/domain/mcpserver/complete-oauth-connect.js +1 -1
  23. package/dist/domain/mcpserver/complete-oauth-connect.js.map +1 -1
  24. package/dist/domain/mcpserver/connect.d.ts +25 -0
  25. package/dist/domain/mcpserver/connect.d.ts.map +1 -1
  26. package/dist/domain/mcpserver/connect.js +8 -23
  27. package/dist/domain/mcpserver/connect.js.map +1 -1
  28. package/dist/domain/mcpserver/controller.d.ts.map +1 -1
  29. package/dist/domain/mcpserver/controller.js +12 -0
  30. package/dist/domain/mcpserver/controller.js.map +1 -1
  31. package/dist/domain/mcpserver/initiate-oauth-connect.d.ts.map +1 -1
  32. package/dist/domain/mcpserver/initiate-oauth-connect.js +16 -13
  33. package/dist/domain/mcpserver/initiate-oauth-connect.js.map +1 -1
  34. package/dist/domain/mcpserver/oauth/dcr.d.ts +10 -1
  35. package/dist/domain/mcpserver/oauth/dcr.d.ts.map +1 -1
  36. package/dist/domain/mcpserver/oauth/dcr.js +1 -9
  37. package/dist/domain/mcpserver/oauth/dcr.js.map +1 -1
  38. package/dist/domain/mcpserver/oauth/discovery.d.ts +43 -20
  39. package/dist/domain/mcpserver/oauth/discovery.d.ts.map +1 -1
  40. package/dist/domain/mcpserver/oauth/discovery.js +69 -54
  41. package/dist/domain/mcpserver/oauth/discovery.js.map +1 -1
  42. package/dist/domain/mcpserver/oauth/preflight.d.ts +27 -1
  43. package/dist/domain/mcpserver/oauth/preflight.d.ts.map +1 -1
  44. package/dist/domain/mcpserver/oauth/preflight.js +1 -26
  45. package/dist/domain/mcpserver/oauth/preflight.js.map +1 -1
  46. package/dist/domain/mcpserver/oauth/refresh.d.ts +2 -1
  47. package/dist/domain/mcpserver/oauth/refresh.d.ts.map +1 -1
  48. package/dist/domain/mcpserver/oauth/refresh.js +1 -1
  49. package/dist/domain/mcpserver/oauth/refresh.js.map +1 -1
  50. package/dist/domain/mcpserver/oauth/token.d.ts +9 -2
  51. package/dist/domain/mcpserver/oauth/token.d.ts.map +1 -1
  52. package/dist/domain/mcpserver/oauth/token.js +2 -8
  53. package/dist/domain/mcpserver/oauth/token.js.map +1 -1
  54. package/dist/domain/oauthapp/refresolution/refresolution.js +1 -1
  55. package/dist/domain/oauthapp/refresolution.js +1 -1
  56. package/dist/domain/platform/controller.d.ts +8 -1
  57. package/dist/domain/platform/controller.d.ts.map +1 -1
  58. package/dist/domain/platform/controller.js +2 -3
  59. package/dist/domain/platform/controller.js.map +1 -1
  60. package/dist/domain/plugin/constants.d.ts +7 -1
  61. package/dist/domain/plugin/constants.d.ts.map +1 -1
  62. package/dist/domain/plugin/constants.js +7 -1
  63. package/dist/domain/plugin/constants.js.map +1 -1
  64. package/dist/domain/plugin/materialize/plan.d.ts.map +1 -1
  65. package/dist/domain/plugin/materialize/plan.js +16 -1
  66. package/dist/domain/plugin/materialize/plan.js.map +1 -1
  67. package/dist/domain/plugin/members.d.ts +46 -0
  68. package/dist/domain/plugin/members.d.ts.map +1 -1
  69. package/dist/domain/plugin/members.js +31 -8
  70. package/dist/domain/plugin/members.js.map +1 -1
  71. package/dist/domain/plugin/push.d.ts +5 -3
  72. package/dist/domain/plugin/push.d.ts.map +1 -1
  73. package/dist/domain/plugin/push.js +58 -14
  74. package/dist/domain/plugin/push.js.map +1 -1
  75. package/dist/domain/workflowexecution/lifecycle.js +1 -1
  76. package/dist/domain/workflowexecution/lifecycle.js.map +1 -1
  77. package/dist/extensions/drivers.d.ts +17 -0
  78. package/dist/extensions/drivers.d.ts.map +1 -1
  79. package/dist/extensions/outbound-egress.d.ts +49 -0
  80. package/dist/extensions/outbound-egress.d.ts.map +1 -0
  81. package/dist/extensions/outbound-egress.js +51 -0
  82. package/dist/extensions/outbound-egress.js.map +1 -0
  83. package/dist/extensions/registry.d.ts +6 -0
  84. package/dist/extensions/registry.d.ts.map +1 -1
  85. package/dist/extensions/registry.js +10 -0
  86. package/dist/extensions/registry.js.map +1 -1
  87. package/dist/index.d.ts +2 -0
  88. package/dist/index.d.ts.map +1 -1
  89. package/dist/index.js +1 -0
  90. package/dist/index.js.map +1 -1
  91. package/dist/pipeline/apiresource-labels.d.ts +34 -1
  92. package/dist/pipeline/apiresource-labels.d.ts.map +1 -1
  93. package/dist/pipeline/apiresource-labels.js +31 -0
  94. package/dist/pipeline/apiresource-labels.js.map +1 -1
  95. package/dist/sandbox/kubernetes.d.ts.map +1 -1
  96. package/dist/sandbox/kubernetes.js +1 -8
  97. package/dist/sandbox/kubernetes.js.map +1 -1
  98. package/dist/sandbox/provisioner.d.ts +5 -20
  99. package/dist/sandbox/provisioner.d.ts.map +1 -1
  100. package/dist/sandbox/provisioner.js.map +1 -1
  101. package/dist/sandbox/steps.d.ts +8 -22
  102. package/dist/sandbox/steps.d.ts.map +1 -1
  103. package/dist/sandbox/steps.js +12 -17
  104. package/dist/sandbox/steps.js.map +1 -1
  105. package/dist/store/interface.d.ts +6 -2
  106. package/dist/store/interface.d.ts.map +1 -1
  107. package/dist/store/interface.js.map +1 -1
  108. package/package.json +6 -5
  109. package/src/boot/__tests__/oauth-redirect-uri.test.ts +38 -0
  110. package/src/boot/compose.ts +63 -10
  111. package/src/boot/config.ts +6 -2
  112. package/src/boot/oauth-redirect-uri.ts +53 -0
  113. package/src/domain/agentexecution/lifecycle.ts +1 -1
  114. package/src/domain/iampolicy/constants.ts +3 -3
  115. package/src/domain/mcpserver/__tests__/complete-endpoint-auth.test.ts +270 -0
  116. package/src/domain/mcpserver/__tests__/connect-authorization.test.ts +3 -0
  117. package/src/domain/mcpserver/__tests__/connect.test.ts +31 -0
  118. package/src/domain/mcpserver/complete-endpoint-auth.ts +277 -0
  119. package/src/domain/mcpserver/complete-oauth-connect.ts +1 -0
  120. package/src/domain/mcpserver/connect.ts +21 -15
  121. package/src/domain/mcpserver/controller.ts +16 -0
  122. package/src/domain/mcpserver/initiate-oauth-connect.ts +16 -12
  123. package/src/domain/mcpserver/oauth/__tests__/discovery.test.ts +120 -91
  124. package/src/domain/mcpserver/oauth/__tests__/token-refresh.test.ts +3 -1
  125. package/src/domain/mcpserver/oauth/dcr.ts +2 -1
  126. package/src/domain/mcpserver/oauth/discovery.ts +120 -89
  127. package/src/domain/mcpserver/oauth/preflight.ts +2 -1
  128. package/src/domain/mcpserver/oauth/refresh.ts +2 -1
  129. package/src/domain/mcpserver/oauth/token.ts +4 -3
  130. package/src/domain/oauthapp/__tests__/oauthapp.test.ts +2 -2
  131. package/src/domain/oauthapp/__tests__/refresolution.test.ts +2 -2
  132. package/src/domain/oauthapp/refresolution/refresolution.ts +1 -1
  133. package/src/domain/oauthapp/refresolution.ts +1 -1
  134. package/src/domain/platform/__tests__/platform.test.ts +47 -0
  135. package/src/domain/platform/controller.ts +10 -4
  136. package/src/domain/plugin/__tests__/materialize.test.ts +42 -47
  137. package/src/domain/plugin/__tests__/members.test.ts +149 -0
  138. package/src/domain/plugin/__tests__/plugin.test.ts +219 -8
  139. package/src/domain/plugin/constants.ts +7 -1
  140. package/src/domain/plugin/materialize/plan.ts +20 -1
  141. package/src/domain/plugin/members.ts +76 -7
  142. package/src/domain/plugin/push.ts +80 -20
  143. package/src/domain/workflowexecution/lifecycle.ts +1 -1
  144. package/src/extensions/__tests__/outbound-egress-points.test.ts +58 -0
  145. package/src/extensions/drivers.ts +17 -0
  146. package/src/extensions/outbound-egress.ts +55 -0
  147. package/src/extensions/registry.ts +19 -0
  148. package/src/index.ts +10 -0
  149. package/src/pipeline/apiresource-labels.ts +42 -1
  150. package/src/sandbox/__tests__/docker.integration.test.ts +0 -2
  151. package/src/sandbox/__tests__/kubernetes.test.ts +2 -10
  152. package/src/sandbox/__tests__/local-process.integration.test.ts +0 -3
  153. package/src/sandbox/__tests__/steps.test.ts +19 -72
  154. package/src/sandbox/kubernetes.ts +1 -8
  155. package/src/sandbox/provisioner.ts +5 -20
  156. package/src/sandbox/steps.ts +12 -29
  157. package/src/store/interface.ts +6 -2
@@ -50,7 +50,6 @@ import { ApiResourceKind } from "@stigmer/protos/ai/stigmer/commons/apiresource/
50
50
 
51
51
  import type { Logger } from "../boot/logger.js";
52
52
  import type { AgentExecutionTemporalConfig } from "../domain/agentexecution/temporal/config.js";
53
- import type { CallerIdentity } from "../extensions/identity.js";
54
53
  import {
55
54
  WORKFLOW_ROUTING_EXECUTION,
56
55
  type WorkflowExecutionTemporalConfig,
@@ -73,17 +72,6 @@ import { mintSandboxToken, type SandboxLane } from "./lane.js";
73
72
  export const SANDBOX_PROVISIONING_FAILED_PREFIX =
74
73
  "Sandbox provisioning failed: ";
75
74
 
76
- /**
77
- * The two facts about the requesting caller a sandbox ensure carries, cut
78
- * from the chain's CallerIdentity (the domain/identityaccount/actor.ts
79
- * shape): the id rides into the credential mint, so the session token is
80
- * minted FOR the caller; the class rides onto the driver's environment,
81
- * so a driver can decide the workspace's durability by who asked. A step
82
- * hands `ctx.callerIdentity` in whole; the pick keeps a test's fixture to
83
- * the two fields the body reads.
84
- */
85
- export type SandboxCaller = Pick<CallerIdentity, "identityId" | "callerClass">;
86
-
87
75
  type AgentExecutionCreateDesc = typeof AgentExecutionSchema;
88
76
 
89
77
  export interface EnsureSessionSandboxDeps {
@@ -113,7 +101,7 @@ export function newEnsureSessionSandboxStep(
113
101
  await ensureSessionSandboxForExecution(
114
102
  deps,
115
103
  ctx.newState,
116
- ctx.callerIdentity,
104
+ ctx.callerIdentity.identityId,
117
105
  );
118
106
  },
119
107
  };
@@ -126,18 +114,15 @@ export function newEnsureSessionSandboxStep(
126
114
  * chains' differing context shapes (newState vs loaded execution) meet
127
115
  * at this seam instead.
128
116
  *
129
- * The caller splits two ways (SandboxCaller): `identityId` rides into the
130
- * credential mint (lane.ts) — the Java ensure step mints session tokens
131
- * FOR the requesting caller, so the capability mint needs the identity
132
- * the OSS execution-scoped mint never did — and `callerClass` rides onto
133
- * the driver's environment as the one request fact a driver may decide
134
- * durability by. The chain always has a caller: the in-process transport
135
- * mints `internal` for the server's own calls.
117
+ * `callerIdentityId` rides into the credential mint (lane.ts): the Java
118
+ * ensure step mints session tokens FOR the requesting caller, so the
119
+ * capability mint needs the identity the OSS execution-scoped mint never
120
+ * did. Empty when the invoking site has no caller.
136
121
  */
137
122
  export async function ensureSessionSandboxForExecution(
138
123
  deps: EnsureSessionSandboxDeps,
139
124
  execution: AgentExecution,
140
- caller: SandboxCaller,
125
+ callerIdentityId: string,
141
126
  ): Promise<void> {
142
127
  if (!deps.lane.enabled) {
143
128
  return;
@@ -182,11 +167,10 @@ export async function ensureSessionSandboxForExecution(
182
167
  sessionId,
183
168
  executionId,
184
169
  org: execution.metadata?.org ?? "",
185
- callerIdentityId: caller.identityId,
170
+ callerIdentityId,
186
171
  },
187
172
  deps.logger,
188
173
  ),
189
- callerClass: caller.callerClass,
190
174
  });
191
175
  } catch (error) {
192
176
  // Non-critical: never fail the launch — but never silent either
@@ -263,7 +247,7 @@ export function newEnsureWorkflowSandboxStep(
263
247
  await ensureWorkflowSandboxForExecution(
264
248
  deps,
265
249
  ctx.newState,
266
- ctx.callerIdentity,
250
+ ctx.callerIdentity.identityId,
267
251
  );
268
252
  },
269
253
  };
@@ -274,13 +258,13 @@ export function newEnsureWorkflowSandboxStep(
274
258
  * re-provision (lifecycle.ts — the previous sandbox was deprovisioned at
275
259
  * the terminal FAILED, so a recovered execution needs a fresh one before
276
260
  * its fresh workflow starts). Throws Unavailable on provisioning failure
277
- * — the critical posture in both chains. The caller splits exactly as on
278
- * the session body: id to the mint, class to the environment.
261
+ * — the critical posture in both chains. `callerIdentityId` rides into
262
+ * the credential mint exactly as on the session body.
279
263
  */
280
264
  export async function ensureWorkflowSandboxForExecution(
281
265
  deps: EnsureWorkflowSandboxDeps,
282
266
  execution: WorkflowExecution,
283
- caller: SandboxCaller,
267
+ callerIdentityId: string,
284
268
  ): Promise<void> {
285
269
  if (!deps.lane.enabled) {
286
270
  return;
@@ -312,11 +296,10 @@ export async function ensureWorkflowSandboxForExecution(
312
296
  sessionId: "",
313
297
  executionId,
314
298
  org: execution.metadata?.org ?? "",
315
- callerIdentityId: caller.identityId,
299
+ callerIdentityId,
316
300
  },
317
301
  deps.logger,
318
302
  ),
319
- callerClass: caller.callerClass,
320
303
  });
321
304
  } catch (error) {
322
305
  deps.logger.error(
@@ -217,8 +217,12 @@ export interface SearchIndexQueryResult {
217
217
  // =============================================================================
218
218
 
219
219
  /**
220
- * Key-value state for idempotent seedpack bootstrap. Common keys:
221
- * "seedpack_version", "bootstrap_status", "skill:<name>", "agent:<name>".
220
+ * Key-value state for one-shot boot work that must run once per database.
221
+ * The one writer today is the membership rules' reconciliation
222
+ * (`iampolicy/constants.ts` ROLES_RECONCILED_KEY). A database migrated
223
+ * from the Go server carries that server's bootstrap keys too; the
224
+ * migration preserves them (see sqlite/__tests__/migrations.test.ts) and
225
+ * nothing reads them.
222
226
  */
223
227
  export interface BootstrapStateStore {
224
228
  /** Returns "" (not an error) when the key does not exist — Go's contract. */