@stigmer/server 3.16.1-dev.20260917224426 → 3.18.0-dev.20260918103812
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.
- package/dist/boot/compose.d.ts +0 -12
- package/dist/boot/compose.d.ts.map +1 -1
- package/dist/boot/compose.js +6 -2
- package/dist/boot/compose.js.map +1 -1
- package/dist/domain/agentexecution/lifecycle.js +1 -1
- package/dist/domain/agentexecution/lifecycle.js.map +1 -1
- package/dist/domain/platform/controller.d.ts +24 -11
- package/dist/domain/platform/controller.d.ts.map +1 -1
- package/dist/domain/platform/controller.js +47 -3
- package/dist/domain/platform/controller.js.map +1 -1
- package/dist/domain/workflow/registry/data/task-kind-registry.json +4 -1
- package/dist/domain/workflowexecution/lifecycle.js +1 -1
- package/dist/domain/workflowexecution/lifecycle.js.map +1 -1
- package/dist/extensions/drivers.d.ts +11 -0
- package/dist/extensions/drivers.d.ts.map +1 -1
- package/dist/extensions/license-status.d.ts +64 -0
- package/dist/extensions/license-status.d.ts.map +1 -0
- package/dist/extensions/license-status.js +9 -0
- package/dist/extensions/license-status.js.map +1 -0
- package/dist/extensions/registry.d.ts +6 -0
- package/dist/extensions/registry.d.ts.map +1 -1
- package/dist/extensions/registry.js +10 -0
- package/dist/extensions/registry.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/sandbox/kubernetes.d.ts.map +1 -1
- package/dist/sandbox/kubernetes.js +8 -1
- package/dist/sandbox/kubernetes.js.map +1 -1
- package/dist/sandbox/provisioner.d.ts +20 -5
- package/dist/sandbox/provisioner.d.ts.map +1 -1
- package/dist/sandbox/provisioner.js.map +1 -1
- package/dist/sandbox/steps.d.ts +22 -8
- package/dist/sandbox/steps.d.ts.map +1 -1
- package/dist/sandbox/steps.js +17 -12
- package/dist/sandbox/steps.js.map +1 -1
- package/package.json +5 -5
- package/src/boot/compose.ts +6 -14
- package/src/domain/agentexecution/lifecycle.ts +1 -1
- package/src/domain/platform/__tests__/platform.test.ts +147 -46
- package/src/domain/platform/controller.ts +77 -13
- package/src/domain/workflow/registry/data/task-kind-registry.json +4 -1
- package/src/domain/workflowexecution/lifecycle.ts +1 -1
- package/src/extensions/__tests__/license-status-points.test.ts +50 -0
- package/src/extensions/drivers.ts +11 -0
- package/src/extensions/license-status.ts +71 -0
- package/src/extensions/registry.ts +19 -0
- package/src/index.ts +8 -0
- package/src/pipeline/__tests__/billing-contract-rules.test.ts +260 -0
- package/src/sandbox/__tests__/docker.integration.test.ts +2 -0
- package/src/sandbox/__tests__/kubernetes.test.ts +10 -2
- package/src/sandbox/__tests__/local-process.integration.test.ts +23 -6
- package/src/sandbox/__tests__/steps.test.ts +72 -19
- package/src/sandbox/kubernetes.ts +8 -1
- package/src/sandbox/provisioner.ts +20 -5
- package/src/sandbox/steps.ts +29 -12
|
@@ -39,13 +39,16 @@
|
|
|
39
39
|
* runner process polls the queues.
|
|
40
40
|
*/
|
|
41
41
|
import type { Logger } from "../boot/logger.js";
|
|
42
|
+
import type { CallerClass } from "../extensions/identity.js";
|
|
42
43
|
|
|
43
44
|
/**
|
|
44
|
-
*
|
|
45
|
-
* sandboxed runner must poll
|
|
46
|
-
*
|
|
47
|
-
*
|
|
48
|
-
*
|
|
45
|
+
* What is TRUE about one provisioning request, handed to a driver: which
|
|
46
|
+
* queue the sandboxed runner must poll, the credential it authenticates
|
|
47
|
+
* with, and the class of the caller whose request is being served. Facts
|
|
48
|
+
* only — what a driver DOES with them (the workspace's durability, the
|
|
49
|
+
* pod's shape, whether a warm pool is consulted) is driver policy and
|
|
50
|
+
* never travels here. Endpoints, images and resource shapes are driver
|
|
51
|
+
* configuration, not per-sandbox state.
|
|
49
52
|
*/
|
|
50
53
|
export interface SandboxEnvironment {
|
|
51
54
|
/** The Temporal task queue the sandboxed runner polls (session:{id} / wfexec:{id}). */
|
|
@@ -56,6 +59,18 @@ export interface SandboxEnvironment {
|
|
|
56
59
|
* and EC decrypt falls back to redaction, the oss#535 posture.
|
|
57
60
|
*/
|
|
58
61
|
readonly stigmerToken: string;
|
|
62
|
+
/**
|
|
63
|
+
* The class of the caller whose request provisioned this sandbox — the
|
|
64
|
+
* identity interceptor's word for it (`user`, `internal`, a composed
|
|
65
|
+
* verifier's own lane such as a guest or a scheduled fire). A driver
|
|
66
|
+
* that gives some session classes a workspace that does not outlive the
|
|
67
|
+
* conversation reads it here; the built-in drivers (`local-process`,
|
|
68
|
+
* `docker`, `kubernetes`) ignore it and keep every session persistent.
|
|
69
|
+
* Required rather than optional so a construction site that forgets it
|
|
70
|
+
* fails to compile instead of silently reading as a persistent user
|
|
71
|
+
* session to every driver.
|
|
72
|
+
*/
|
|
73
|
+
readonly callerClass: CallerClass;
|
|
59
74
|
}
|
|
60
75
|
|
|
61
76
|
/** One sandbox's observed live state (the Q5 probe result). */
|
package/src/sandbox/steps.ts
CHANGED
|
@@ -50,6 +50,7 @@ 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";
|
|
53
54
|
import {
|
|
54
55
|
WORKFLOW_ROUTING_EXECUTION,
|
|
55
56
|
type WorkflowExecutionTemporalConfig,
|
|
@@ -72,6 +73,17 @@ import { mintSandboxToken, type SandboxLane } from "./lane.js";
|
|
|
72
73
|
export const SANDBOX_PROVISIONING_FAILED_PREFIX =
|
|
73
74
|
"Sandbox provisioning failed: ";
|
|
74
75
|
|
|
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
|
+
|
|
75
87
|
type AgentExecutionCreateDesc = typeof AgentExecutionSchema;
|
|
76
88
|
|
|
77
89
|
export interface EnsureSessionSandboxDeps {
|
|
@@ -101,7 +113,7 @@ export function newEnsureSessionSandboxStep(
|
|
|
101
113
|
await ensureSessionSandboxForExecution(
|
|
102
114
|
deps,
|
|
103
115
|
ctx.newState,
|
|
104
|
-
ctx.callerIdentity
|
|
116
|
+
ctx.callerIdentity,
|
|
105
117
|
);
|
|
106
118
|
},
|
|
107
119
|
};
|
|
@@ -114,15 +126,18 @@ export function newEnsureSessionSandboxStep(
|
|
|
114
126
|
* chains' differing context shapes (newState vs loaded execution) meet
|
|
115
127
|
* at this seam instead.
|
|
116
128
|
*
|
|
117
|
-
*
|
|
118
|
-
*
|
|
119
|
-
*
|
|
120
|
-
*
|
|
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.
|
|
121
136
|
*/
|
|
122
137
|
export async function ensureSessionSandboxForExecution(
|
|
123
138
|
deps: EnsureSessionSandboxDeps,
|
|
124
139
|
execution: AgentExecution,
|
|
125
|
-
|
|
140
|
+
caller: SandboxCaller,
|
|
126
141
|
): Promise<void> {
|
|
127
142
|
if (!deps.lane.enabled) {
|
|
128
143
|
return;
|
|
@@ -167,10 +182,11 @@ export async function ensureSessionSandboxForExecution(
|
|
|
167
182
|
sessionId,
|
|
168
183
|
executionId,
|
|
169
184
|
org: execution.metadata?.org ?? "",
|
|
170
|
-
callerIdentityId,
|
|
185
|
+
callerIdentityId: caller.identityId,
|
|
171
186
|
},
|
|
172
187
|
deps.logger,
|
|
173
188
|
),
|
|
189
|
+
callerClass: caller.callerClass,
|
|
174
190
|
});
|
|
175
191
|
} catch (error) {
|
|
176
192
|
// Non-critical: never fail the launch — but never silent either
|
|
@@ -247,7 +263,7 @@ export function newEnsureWorkflowSandboxStep(
|
|
|
247
263
|
await ensureWorkflowSandboxForExecution(
|
|
248
264
|
deps,
|
|
249
265
|
ctx.newState,
|
|
250
|
-
ctx.callerIdentity
|
|
266
|
+
ctx.callerIdentity,
|
|
251
267
|
);
|
|
252
268
|
},
|
|
253
269
|
};
|
|
@@ -258,13 +274,13 @@ export function newEnsureWorkflowSandboxStep(
|
|
|
258
274
|
* re-provision (lifecycle.ts — the previous sandbox was deprovisioned at
|
|
259
275
|
* the terminal FAILED, so a recovered execution needs a fresh one before
|
|
260
276
|
* its fresh workflow starts). Throws Unavailable on provisioning failure
|
|
261
|
-
* — the critical posture in both chains.
|
|
262
|
-
* the
|
|
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.
|
|
263
279
|
*/
|
|
264
280
|
export async function ensureWorkflowSandboxForExecution(
|
|
265
281
|
deps: EnsureWorkflowSandboxDeps,
|
|
266
282
|
execution: WorkflowExecution,
|
|
267
|
-
|
|
283
|
+
caller: SandboxCaller,
|
|
268
284
|
): Promise<void> {
|
|
269
285
|
if (!deps.lane.enabled) {
|
|
270
286
|
return;
|
|
@@ -296,10 +312,11 @@ export async function ensureWorkflowSandboxForExecution(
|
|
|
296
312
|
sessionId: "",
|
|
297
313
|
executionId,
|
|
298
314
|
org: execution.metadata?.org ?? "",
|
|
299
|
-
callerIdentityId,
|
|
315
|
+
callerIdentityId: caller.identityId,
|
|
300
316
|
},
|
|
301
317
|
deps.logger,
|
|
302
318
|
),
|
|
319
|
+
callerClass: caller.callerClass,
|
|
303
320
|
});
|
|
304
321
|
} catch (error) {
|
|
305
322
|
deps.logger.error(
|