@aexhq/sdk 0.40.16 → 0.41.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.
- package/README.md +25 -25
- package/dist/_contracts/api-key.d.ts +6 -4
- package/dist/_contracts/api-key.js +20 -7
- package/dist/_contracts/connection-ticket.d.ts +5 -5
- package/dist/_contracts/connection-ticket.js +7 -7
- package/dist/_contracts/error-codes.d.ts +1 -1
- package/dist/_contracts/error-codes.js +4 -4
- package/dist/_contracts/error-factory.js +1 -1
- package/dist/_contracts/event-envelope.d.ts +41 -41
- package/dist/_contracts/event-envelope.js +49 -49
- package/dist/_contracts/event-stream-client.d.ts +9 -9
- package/dist/_contracts/event-stream-client.js +5 -5
- package/dist/_contracts/event-view.d.ts +6 -6
- package/dist/_contracts/event-view.js +12 -12
- package/dist/_contracts/http.js +1 -1
- package/dist/_contracts/index.d.ts +10 -10
- package/dist/_contracts/index.js +9 -9
- package/dist/_contracts/models.d.ts +17 -17
- package/dist/_contracts/models.js +14 -14
- package/dist/_contracts/operations.d.ts +79 -82
- package/dist/_contracts/operations.js +233 -243
- package/dist/_contracts/provider-support.d.ts +2 -2
- package/dist/_contracts/runner-event.d.ts +8 -8
- package/dist/_contracts/runner-event.js +9 -9
- package/dist/_contracts/runtime-manifest.d.ts +12 -12
- package/dist/_contracts/runtime-manifest.js +1 -1
- package/dist/_contracts/runtime-sizes.d.ts +12 -12
- package/dist/_contracts/runtime-sizes.js +18 -18
- package/dist/_contracts/runtime-types.d.ts +117 -117
- package/dist/_contracts/runtime-types.js +2 -2
- package/dist/_contracts/sdk-errors.d.ts +3 -3
- package/dist/_contracts/sdk-errors.js +4 -4
- package/dist/_contracts/sdk-secrets.js +10 -10
- package/dist/_contracts/session-artifacts.d.ts +151 -0
- package/dist/_contracts/session-artifacts.js +234 -0
- package/dist/_contracts/{run-config.d.ts → session-config.d.ts} +29 -29
- package/dist/_contracts/{run-config.js → session-config.js} +37 -37
- package/dist/_contracts/session-cost.d.ts +140 -0
- package/dist/_contracts/{run-cost.js → session-cost.js} +94 -94
- package/dist/_contracts/{run-custody.d.ts → session-custody.d.ts} +16 -16
- package/dist/_contracts/{run-custody.js → session-custody.js} +42 -42
- package/dist/_contracts/session-record.d.ts +112 -0
- package/dist/_contracts/{run-record.js → session-record.js} +23 -23
- package/dist/_contracts/session-retention.d.ts +209 -0
- package/dist/_contracts/{run-retention.js → session-retention.js} +116 -116
- package/dist/_contracts/{run-unit.d.ts → session-unit.d.ts} +38 -38
- package/dist/_contracts/{run-unit.js → session-unit.js} +33 -33
- package/dist/_contracts/side-effect-audit.d.ts +14 -14
- package/dist/_contracts/side-effect-audit.js +38 -38
- package/dist/_contracts/sse.d.ts +1 -1
- package/dist/_contracts/sse.js +0 -0
- package/dist/_contracts/stable.d.ts +1 -1
- package/dist/_contracts/stable.js +1 -1
- package/dist/_contracts/status.d.ts +18 -18
- package/dist/_contracts/status.js +19 -19
- package/dist/_contracts/submission.d.ts +101 -99
- package/dist/_contracts/submission.js +96 -96
- package/dist/_contracts/{run-trace.d.ts → turn-trace.d.ts} +1 -1
- package/dist/_contracts/webhook-verify.d.ts +1 -1
- package/dist/_contracts/webhook-verify.js +1 -1
- package/dist/agents-md.d.ts +4 -4
- package/dist/agents-md.js +5 -5
- package/dist/agents-md.js.map +1 -1
- package/dist/bundle.d.ts +1 -1
- package/dist/bundle.js +1 -1
- package/dist/bundle.js.map +1 -1
- package/dist/cli.mjs +578 -621
- package/dist/cli.mjs.sha256 +1 -1
- package/dist/client.d.ts +141 -155
- package/dist/client.js +236 -245
- package/dist/client.js.map +1 -1
- package/dist/fetch-archive.js +3 -3
- package/dist/file.d.ts +7 -7
- package/dist/file.js +8 -8
- package/dist/file.js.map +1 -1
- package/dist/index.d.ts +10 -10
- package/dist/index.js +8 -8
- package/dist/index.js.map +1 -1
- package/dist/mcp-server.d.ts +1 -1
- package/dist/retry.d.ts +1 -1
- package/dist/secret.d.ts +6 -6
- package/dist/secret.js +6 -6
- package/dist/secret.js.map +1 -1
- package/dist/skill.d.ts +2 -2
- package/dist/skill.js +3 -3
- package/dist/skill.js.map +1 -1
- package/dist/tool.js +2 -2
- package/dist/tool.js.map +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/dist/version.js.map +1 -1
- package/docs/authentication.md +11 -11
- package/docs/billing.md +3 -3
- package/docs/cleanup.md +5 -5
- package/docs/concepts/agent-tools.md +5 -5
- package/docs/concepts/composition.md +3 -3
- package/docs/concepts/providers-and-runtimes.md +3 -3
- package/docs/concepts/{runs.md → sessions.md} +8 -8
- package/docs/concepts/subagents.md +16 -16
- package/docs/credentials.md +7 -7
- package/docs/defaults.md +14 -14
- package/docs/errors.md +10 -10
- package/docs/events.md +26 -26
- package/docs/files.md +267 -0
- package/docs/limits-and-quotas.md +35 -35
- package/docs/limits.md +6 -6
- package/docs/mcp.md +3 -3
- package/docs/networking.md +24 -24
- package/docs/provider-runtime-capabilities.md +1 -1
- package/docs/public-surface.json +6 -6
- package/docs/quickstart.md +13 -13
- package/docs/release.md +5 -5
- package/docs/retries.md +3 -3
- package/docs/secrets.md +16 -16
- package/docs/session-config.md +58 -0
- package/docs/{run-record.md → session-record.md} +16 -16
- package/docs/skills.md +9 -9
- package/docs/vision-skills.md +7 -7
- package/docs/webhooks.md +11 -11
- package/examples/feature-tour.ts +17 -17
- package/examples/spike-settle-latency.ts +11 -11
- package/package.json +1 -1
- package/dist/_contracts/run-artifacts.d.ts +0 -49
- package/dist/_contracts/run-artifacts.js +0 -102
- package/dist/_contracts/run-cost.d.ts +0 -140
- package/dist/_contracts/run-record.d.ts +0 -116
- package/dist/_contracts/run-retention.d.ts +0 -209
- package/docs/outputs.md +0 -267
- package/docs/run-config.md +0 -58
- /package/dist/_contracts/{run-trace.js → turn-trace.js} +0 -0
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* SessionUnit — the self-contained read shape of a session.
|
|
3
3
|
*
|
|
4
4
|
* One canonical struct that captures every non-secret artifact persisted
|
|
5
|
-
* for a single
|
|
6
|
-
* indexed events, raw-event Storage manifest,
|
|
5
|
+
* for a single session: parsed submission inputs, status/lifecycle, attempts,
|
|
6
|
+
* indexed events, raw-event Storage manifest, session files, and capture failures.
|
|
7
7
|
*
|
|
8
|
-
* Wire contract for `GET /api/
|
|
9
|
-
* `
|
|
10
|
-
* `client.
|
|
8
|
+
* Wire contract for `GET /api/sessions/:sessionId`, the per-session archive's
|
|
9
|
+
* `session.json`/`submission.json`/`caps.json`, and the SDK/CLI
|
|
10
|
+
* `client.sessions.get(sessionId)` return type.
|
|
11
11
|
*
|
|
12
12
|
* Immutability: every field here is read-only. Edit endpoints do not
|
|
13
13
|
* exist by design.
|
|
@@ -17,15 +17,15 @@
|
|
|
17
17
|
* `rawEventPages` (manifest only; bytes downloaded out-of-band so the
|
|
18
18
|
* detail response stays bounded). The archive zip carries the bytes.
|
|
19
19
|
*/
|
|
20
|
-
import { parseMcpServerRef } from "./
|
|
20
|
+
import { parseMcpServerRef } from "./session-config.js";
|
|
21
21
|
import { CLEANUP_STATUSES } from "./status.js";
|
|
22
|
-
import { Models,
|
|
22
|
+
import { Models, parseModelName } from "./models.js";
|
|
23
23
|
import { PLATFORM_PACKAGE_ECOSYSTEMS } from "./submission.js";
|
|
24
24
|
// ---------------------------------------------------------------------------
|
|
25
25
|
// Submission parser
|
|
26
26
|
// ---------------------------------------------------------------------------
|
|
27
27
|
/**
|
|
28
|
-
* Parse a legacy
|
|
28
|
+
* Parse a legacy session snapshot jsonb payload into the typed flat
|
|
29
29
|
* submission. Never throws on minor unknown keys so we can
|
|
30
30
|
* forward-compat with hosted API enrichment.
|
|
31
31
|
*
|
|
@@ -34,7 +34,7 @@ import { PLATFORM_PACKAGE_ECOSYSTEMS } from "./submission.js";
|
|
|
34
34
|
* must still render *something* for a buggy historical row rather than 500ing
|
|
35
35
|
* the whole detail page.
|
|
36
36
|
*/
|
|
37
|
-
export function
|
|
37
|
+
export function parseSessionUnitSubmission(input, fallbackModel) {
|
|
38
38
|
if (!input || typeof input !== "object" || Array.isArray(input)) {
|
|
39
39
|
return fallbackFlat(fallbackModel);
|
|
40
40
|
}
|
|
@@ -48,15 +48,15 @@ export function parseRunUnitSubmission(input, fallbackModel) {
|
|
|
48
48
|
}
|
|
49
49
|
function parseFlatProjection(value, fallbackModel) {
|
|
50
50
|
const submissionRaw = isRecord(value.submission) ? value.submission : {};
|
|
51
|
-
const
|
|
52
|
-
const allowedDirs = toOptionalStringArray(
|
|
53
|
-
const deniedDirs = toOptionalStringArray(
|
|
54
|
-
const captureTimeoutMs = toOptionalPositiveInteger(
|
|
55
|
-
const maxFileBytes = toOptionalPositiveInteger(
|
|
56
|
-
const maxTotalBytes = toOptionalPositiveInteger(
|
|
57
|
-
const maxFiles = toOptionalPositiveInteger(
|
|
51
|
+
const fileCaptureRaw = isRecord(submissionRaw.fileCapture) ? submissionRaw.fileCapture : {};
|
|
52
|
+
const allowedDirs = toOptionalStringArray(fileCaptureRaw.allowedDirs);
|
|
53
|
+
const deniedDirs = toOptionalStringArray(fileCaptureRaw.deniedDirs);
|
|
54
|
+
const captureTimeoutMs = toOptionalPositiveInteger(fileCaptureRaw.captureTimeoutMs);
|
|
55
|
+
const maxFileBytes = toOptionalPositiveInteger(fileCaptureRaw.maxFileBytes);
|
|
56
|
+
const maxTotalBytes = toOptionalPositiveInteger(fileCaptureRaw.maxTotalBytes);
|
|
57
|
+
const maxFiles = toOptionalPositiveInteger(fileCaptureRaw.maxFiles);
|
|
58
58
|
const submission = {
|
|
59
|
-
model:
|
|
59
|
+
model: coerceSessionUnitModel(submissionRaw.model ?? fallbackModel),
|
|
60
60
|
...(typeof submissionRaw.system === "string" ? { system: submissionRaw.system } : {}),
|
|
61
61
|
prompt: toStringArray(submissionRaw.prompt),
|
|
62
62
|
agentsMd: [],
|
|
@@ -77,7 +77,7 @@ function parseFlatProjection(value, fallbackModel) {
|
|
|
77
77
|
maxTotalBytes !== undefined ||
|
|
78
78
|
maxFiles !== undefined
|
|
79
79
|
? {
|
|
80
|
-
|
|
80
|
+
fileCapture: {
|
|
81
81
|
...(allowedDirs ? { allowedDirs } : {}),
|
|
82
82
|
...(deniedDirs ? { deniedDirs } : {}),
|
|
83
83
|
...(captureTimeoutMs !== undefined ? { captureTimeoutMs } : {}),
|
|
@@ -103,7 +103,7 @@ function fallbackFlat(fallbackModel) {
|
|
|
103
103
|
return {
|
|
104
104
|
kind: "submission",
|
|
105
105
|
submission: {
|
|
106
|
-
model:
|
|
106
|
+
model: coerceSessionUnitModel(fallbackModel),
|
|
107
107
|
prompt: [],
|
|
108
108
|
agentsMd: [],
|
|
109
109
|
files: [],
|
|
@@ -121,17 +121,17 @@ function isRecord(value) {
|
|
|
121
121
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
122
122
|
}
|
|
123
123
|
/**
|
|
124
|
-
* Normalize a `GET /api/
|
|
124
|
+
* Normalize a `GET /api/sessions/:sessionId` payload into a SessionUnit whose type contract
|
|
125
125
|
* holds AT RUNTIME. The managed (AWS) plane returns a LEAN record (scalars +
|
|
126
|
-
* costTelemetry only) and omits the aggregate collections; the
|
|
127
|
-
* declares those non-optional, so a naive cast leaves `unit.
|
|
126
|
+
* costTelemetry only) and omits the aggregate collections; the SessionUnit type
|
|
127
|
+
* declares those non-optional, so a naive cast leaves `unit.sessionFiles` /
|
|
128
128
|
* `unit.events.totalCount` `undefined` and a typed consumer crashes on
|
|
129
129
|
* `.map()` / `.totalCount` (pre-launch edge-sweep F25). We fill the aggregates
|
|
130
130
|
* with their empty defaults so array/page access is always safe. NOTE: on the
|
|
131
|
-
* managed plane these summaries are best-effort — read `
|
|
132
|
-
* / `messages()` for the authoritative per-
|
|
131
|
+
* managed plane these summaries are best-effort — read `files()` / `events()`
|
|
132
|
+
* / `messages()` for the authoritative per-session data.
|
|
133
133
|
*/
|
|
134
|
-
export function
|
|
134
|
+
export function normalizeSessionUnit(raw) {
|
|
135
135
|
const r = isRecord(raw) ? raw : {};
|
|
136
136
|
const eventsRaw = isRecord(r.events) ? r.events : {};
|
|
137
137
|
const str = (v) => (typeof v === "string" ? v : undefined);
|
|
@@ -155,9 +155,9 @@ export function normalizeRunUnit(raw) {
|
|
|
155
155
|
? r.attempts.length
|
|
156
156
|
: 0,
|
|
157
157
|
// Plane responses that project a flat record (no `submission` snapshot)
|
|
158
|
-
// still carry the
|
|
159
|
-
// static fallback so `unit()` never claims a model the
|
|
160
|
-
submission:
|
|
158
|
+
// still carry the session's `model` at the top level — prefer it over the
|
|
159
|
+
// static fallback so `unit()` never claims a model the session did not use.
|
|
160
|
+
submission: parseSessionUnitSubmission(r.submission, r.model),
|
|
161
161
|
...(isRecord(r.capsSnapshot) ? { capsSnapshot: r.capsSnapshot } : {}),
|
|
162
162
|
attempts: arr(r.attempts),
|
|
163
163
|
events: {
|
|
@@ -167,8 +167,8 @@ export function normalizeRunUnit(raw) {
|
|
|
167
167
|
...(str(eventsRaw.nextCursor) ? { nextCursor: eventsRaw.nextCursor } : {})
|
|
168
168
|
},
|
|
169
169
|
rawEventPages: arr(r.rawEventPages),
|
|
170
|
-
|
|
171
|
-
|
|
170
|
+
sessionFiles: arr(r.sessionFiles),
|
|
171
|
+
fileCaptureFailures: arr(r.fileCaptureFailures),
|
|
172
172
|
...(isRecord(r.costTelemetry)
|
|
173
173
|
? { costTelemetry: r.costTelemetry }
|
|
174
174
|
: {}),
|
|
@@ -177,11 +177,11 @@ export function normalizeRunUnit(raw) {
|
|
|
177
177
|
: {})
|
|
178
178
|
};
|
|
179
179
|
}
|
|
180
|
-
function
|
|
180
|
+
function coerceSessionUnitModel(value) {
|
|
181
181
|
if (typeof value !== "string")
|
|
182
182
|
return Models.CLAUDE_HAIKU_4_5;
|
|
183
183
|
try {
|
|
184
|
-
return
|
|
184
|
+
return parseModelName(value, "session unit submission.model");
|
|
185
185
|
}
|
|
186
186
|
catch {
|
|
187
187
|
return Models.CLAUDE_HAIKU_4_5;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { ProviderName } from "./submission.js";
|
|
2
2
|
export declare const SIDE_EFFECT_AUDIT_SCHEMA_VERSION = 1;
|
|
3
3
|
export declare const SIDE_EFFECT_AUDIT_REDACTION_SCANNER_VERSION = 1;
|
|
4
4
|
export declare const SIDE_EFFECT_AUDIT_KIND = "aex.side_effect_audit.v1";
|
|
5
|
-
export declare const SIDE_EFFECT_AUDIT_ACTIONS: readonly ["
|
|
5
|
+
export declare const SIDE_EFFECT_AUDIT_ACTIONS: readonly ["session.submit.accepted", "session.submit.rejected", "session.cancel.requested", "session.delete.requested", "session.delete.completed", "session.delete.failed", "session.download.requested", "session.file.downloaded", "session.log.downloaded", "session.event.downloaded", "workspace.asset.uploaded", "workspace.asset.deleted", "proxy.endpoint.called", "mcp.credential.accessed", "mcp.proxy.called", "provider.proxy.called", "custody.manifest.written", "custody.transition.recorded", "runtime.cleanup.completed", "runtime.cleanup.failed", "terminal_redrive.attempted", "terminal_redrive.completed", "api_key.created", "api_key.deleted", "api_key.used"];
|
|
6
6
|
export type SideEffectAuditAction = (typeof SIDE_EFFECT_AUDIT_ACTIONS)[number];
|
|
7
7
|
export declare const SIDE_EFFECT_AUDIT_ACTOR_PRINCIPAL_TYPES: readonly ["user", "api_key", "system", "runtime"];
|
|
8
8
|
export type SideEffectAuditActorPrincipalType = (typeof SIDE_EFFECT_AUDIT_ACTOR_PRINCIPAL_TYPES)[number];
|
|
@@ -10,11 +10,11 @@ export declare const SIDE_EFFECT_AUDIT_SOURCE_PLANES: readonly ["dashboard", "ap
|
|
|
10
10
|
export type SideEffectAuditSourcePlane = (typeof SIDE_EFFECT_AUDIT_SOURCE_PLANES)[number];
|
|
11
11
|
export declare const SIDE_EFFECT_AUDIT_AUTHENTICATION_KINDS: readonly ["dashboard_auth", "api_key", "runner_token", "system"];
|
|
12
12
|
export type SideEffectAuditAuthenticationKind = (typeof SIDE_EFFECT_AUDIT_AUTHENTICATION_KINDS)[number];
|
|
13
|
-
export declare const SIDE_EFFECT_AUDIT_TARGET_TYPES: readonly ["workspace", "
|
|
13
|
+
export declare const SIDE_EFFECT_AUDIT_TARGET_TYPES: readonly ["workspace", "session", "proxy_endpoint", "mcp_credential", "mcp_proxy", "provider_proxy", "file_archive", "session_file", "session_log", "session_event_stream", "workspace_asset", "custody_manifest", "custody_transition", "cleanup", "deletion", "terminal_redrive", "api_key"];
|
|
14
14
|
export type SideEffectAuditTargetType = (typeof SIDE_EFFECT_AUDIT_TARGET_TYPES)[number];
|
|
15
15
|
export declare const SIDE_EFFECT_AUDIT_OUTCOMES: readonly ["accepted", "rejected", "succeeded", "failed", "denied", "canceled", "pending"];
|
|
16
16
|
export type SideEffectAuditOutcome = (typeof SIDE_EFFECT_AUDIT_OUTCOMES)[number];
|
|
17
|
-
export declare const SIDE_EFFECT_AUDIT_COUNT_NAMES: readonly ["requestBytes", "responseBytes", "durationMs", "attemptCount", "retryCount", "
|
|
17
|
+
export declare const SIDE_EFFECT_AUDIT_COUNT_NAMES: readonly ["requestBytes", "responseBytes", "durationMs", "attemptCount", "retryCount", "fileCount", "logCount", "eventCount", "assetCount", "proxyCallCount", "mcpCallCount", "providerProxyCallCount", "secretClassCount", "resourceClassCount", "deletedObjectCount", "retainedObjectCount", "failedObjectCount", "quotaRequestedUnits", "quotaRemainingUnits", "reservationCount"];
|
|
18
18
|
export type SideEffectAuditCountName = (typeof SIDE_EFFECT_AUDIT_COUNT_NAMES)[number];
|
|
19
19
|
export declare const SIDE_EFFECT_AUDIT_TIMESTAMP_NAMES: readonly ["startedAt", "finishedAt", "observedAt", "decidedAt", "deletedAt", "terminalAt", "expiresAt"];
|
|
20
20
|
export type SideEffectAuditTimestampName = (typeof SIDE_EFFECT_AUDIT_TIMESTAMP_NAMES)[number];
|
|
@@ -55,8 +55,8 @@ export interface SideEffectAuditStatusMetadataV1 {
|
|
|
55
55
|
readonly followUpRequired?: boolean;
|
|
56
56
|
}
|
|
57
57
|
export interface SideEffectAuditDimensionsMetadataV1 {
|
|
58
|
-
readonly provider?:
|
|
59
|
-
readonly namespace?: "metadata" | "events" | "logs" | "
|
|
58
|
+
readonly provider?: ProviderName | string;
|
|
59
|
+
readonly namespace?: "metadata" | "events" | "logs" | "files" | "archive";
|
|
60
60
|
readonly method?: "GET" | "POST" | "PUT" | "PATCH" | "DELETE";
|
|
61
61
|
readonly surface?: string;
|
|
62
62
|
}
|
|
@@ -77,7 +77,7 @@ export interface SideEffectAuditEventV1 {
|
|
|
77
77
|
readonly kind: typeof SIDE_EFFECT_AUDIT_KIND;
|
|
78
78
|
readonly auditId?: string;
|
|
79
79
|
readonly workspaceId: string;
|
|
80
|
-
readonly
|
|
80
|
+
readonly sessionId?: string;
|
|
81
81
|
readonly action: SideEffectAuditAction;
|
|
82
82
|
readonly outcome: SideEffectAuditOutcome;
|
|
83
83
|
readonly observedAt: string;
|
|
@@ -96,9 +96,9 @@ export type SideEffectAuditMetadataInput = Omit<SideEffectAuditMetadataV1, "reda
|
|
|
96
96
|
export type SideEffectAuditEventInput = Omit<SideEffectAuditEventV1, "schemaVersion" | "kind" | "metadata"> & {
|
|
97
97
|
readonly metadata?: SideEffectAuditMetadataInput;
|
|
98
98
|
};
|
|
99
|
-
export interface
|
|
99
|
+
export interface SideEffectAuditSessionScopedInput {
|
|
100
100
|
readonly workspaceId: string;
|
|
101
|
-
readonly
|
|
101
|
+
readonly sessionId: string;
|
|
102
102
|
readonly observedAt: string;
|
|
103
103
|
readonly actor: SideEffectAuditActorInput;
|
|
104
104
|
readonly correlation?: SideEffectAuditCorrelationInput;
|
|
@@ -116,11 +116,11 @@ export declare class SideEffectAuditRedactionError extends Error {
|
|
|
116
116
|
constructor(findings: readonly SideEffectAuditRedactionFinding[]);
|
|
117
117
|
}
|
|
118
118
|
export declare function buildSideEffectAuditEvent(input: SideEffectAuditEventInput): SideEffectAuditEventV1;
|
|
119
|
-
export declare function
|
|
120
|
-
export declare function
|
|
121
|
-
export declare function
|
|
122
|
-
export declare function
|
|
123
|
-
export declare function buildCustodyManifestWrittenAuditEvent(input:
|
|
119
|
+
export declare function buildSessionDeletionRequestedAuditEvent(input: SideEffectAuditSessionScopedInput): SideEffectAuditEventV1;
|
|
120
|
+
export declare function buildSessionDeletionCompletedAuditEvent(input: SideEffectAuditSessionScopedInput): SideEffectAuditEventV1;
|
|
121
|
+
export declare function buildSessionDeletionFailedAuditEvent(input: SideEffectAuditSessionScopedInput): SideEffectAuditEventV1;
|
|
122
|
+
export declare function buildSessionDownloadRequestedAuditEvent(input: SideEffectAuditSessionScopedInput): SideEffectAuditEventV1;
|
|
123
|
+
export declare function buildCustodyManifestWrittenAuditEvent(input: SideEffectAuditSessionScopedInput): SideEffectAuditEventV1;
|
|
124
124
|
export declare function redactSideEffectAuditMetadata(input: SideEffectAuditMetadataInput, action?: SideEffectAuditAction): SideEffectAuditMetadataV1;
|
|
125
125
|
export declare function scanSideEffectAuditPayloadForSensitiveValues(input: unknown): readonly SideEffectAuditRedactionFinding[];
|
|
126
126
|
export declare function assertPublicSafeSideEffectAuditPayload(input: unknown): void;
|
|
@@ -2,16 +2,16 @@ export const SIDE_EFFECT_AUDIT_SCHEMA_VERSION = 1;
|
|
|
2
2
|
export const SIDE_EFFECT_AUDIT_REDACTION_SCANNER_VERSION = 1;
|
|
3
3
|
export const SIDE_EFFECT_AUDIT_KIND = "aex.side_effect_audit.v1";
|
|
4
4
|
export const SIDE_EFFECT_AUDIT_ACTIONS = [
|
|
5
|
-
"
|
|
6
|
-
"
|
|
7
|
-
"
|
|
8
|
-
"
|
|
9
|
-
"
|
|
10
|
-
"
|
|
11
|
-
"
|
|
12
|
-
"
|
|
13
|
-
"
|
|
14
|
-
"
|
|
5
|
+
"session.submit.accepted",
|
|
6
|
+
"session.submit.rejected",
|
|
7
|
+
"session.cancel.requested",
|
|
8
|
+
"session.delete.requested",
|
|
9
|
+
"session.delete.completed",
|
|
10
|
+
"session.delete.failed",
|
|
11
|
+
"session.download.requested",
|
|
12
|
+
"session.file.downloaded",
|
|
13
|
+
"session.log.downloaded",
|
|
14
|
+
"session.event.downloaded",
|
|
15
15
|
"workspace.asset.uploaded",
|
|
16
16
|
"workspace.asset.deleted",
|
|
17
17
|
"proxy.endpoint.called",
|
|
@@ -48,15 +48,15 @@ export const SIDE_EFFECT_AUDIT_AUTHENTICATION_KINDS = [
|
|
|
48
48
|
];
|
|
49
49
|
export const SIDE_EFFECT_AUDIT_TARGET_TYPES = [
|
|
50
50
|
"workspace",
|
|
51
|
-
"
|
|
51
|
+
"session",
|
|
52
52
|
"proxy_endpoint",
|
|
53
53
|
"mcp_credential",
|
|
54
54
|
"mcp_proxy",
|
|
55
55
|
"provider_proxy",
|
|
56
|
-
"
|
|
57
|
-
"
|
|
58
|
-
"
|
|
59
|
-
"
|
|
56
|
+
"file_archive",
|
|
57
|
+
"session_file",
|
|
58
|
+
"session_log",
|
|
59
|
+
"session_event_stream",
|
|
60
60
|
"workspace_asset",
|
|
61
61
|
"custody_manifest",
|
|
62
62
|
"custody_transition",
|
|
@@ -80,7 +80,7 @@ export const SIDE_EFFECT_AUDIT_COUNT_NAMES = [
|
|
|
80
80
|
"durationMs",
|
|
81
81
|
"attemptCount",
|
|
82
82
|
"retryCount",
|
|
83
|
-
"
|
|
83
|
+
"fileCount",
|
|
84
84
|
"logCount",
|
|
85
85
|
"eventCount",
|
|
86
86
|
"assetCount",
|
|
@@ -137,7 +137,7 @@ export function buildSideEffectAuditEvent(input) {
|
|
|
137
137
|
kind: SIDE_EFFECT_AUDIT_KIND,
|
|
138
138
|
...(input.auditId ? { auditId: assertSafeIdentifier(input.auditId, "auditId") } : {}),
|
|
139
139
|
workspaceId: assertSafeIdentifier(input.workspaceId, "workspaceId"),
|
|
140
|
-
...(input.
|
|
140
|
+
...(input.sessionId ? { sessionId: assertSafeIdentifier(input.sessionId, "sessionId") } : {}),
|
|
141
141
|
action,
|
|
142
142
|
outcome: normalizeOutcome(input.outcome),
|
|
143
143
|
observedAt: assertTimestamp(input.observedAt, "observedAt"),
|
|
@@ -149,36 +149,36 @@ export function buildSideEffectAuditEvent(input) {
|
|
|
149
149
|
assertPublicSafeSideEffectAuditPayload(event);
|
|
150
150
|
return event;
|
|
151
151
|
}
|
|
152
|
-
export function
|
|
153
|
-
return
|
|
154
|
-
action: "
|
|
152
|
+
export function buildSessionDeletionRequestedAuditEvent(input) {
|
|
153
|
+
return buildSessionScopedAuditEvent(input, {
|
|
154
|
+
action: "session.delete.requested",
|
|
155
155
|
outcome: "accepted",
|
|
156
156
|
targetType: "deletion"
|
|
157
157
|
});
|
|
158
158
|
}
|
|
159
|
-
export function
|
|
160
|
-
return
|
|
161
|
-
action: "
|
|
159
|
+
export function buildSessionDeletionCompletedAuditEvent(input) {
|
|
160
|
+
return buildSessionScopedAuditEvent(input, {
|
|
161
|
+
action: "session.delete.completed",
|
|
162
162
|
outcome: "succeeded",
|
|
163
163
|
targetType: "deletion"
|
|
164
164
|
});
|
|
165
165
|
}
|
|
166
|
-
export function
|
|
167
|
-
return
|
|
168
|
-
action: "
|
|
166
|
+
export function buildSessionDeletionFailedAuditEvent(input) {
|
|
167
|
+
return buildSessionScopedAuditEvent(input, {
|
|
168
|
+
action: "session.delete.failed",
|
|
169
169
|
outcome: "failed",
|
|
170
170
|
targetType: "deletion"
|
|
171
171
|
});
|
|
172
172
|
}
|
|
173
|
-
export function
|
|
174
|
-
return
|
|
175
|
-
action: "
|
|
173
|
+
export function buildSessionDownloadRequestedAuditEvent(input) {
|
|
174
|
+
return buildSessionScopedAuditEvent(input, {
|
|
175
|
+
action: "session.download.requested",
|
|
176
176
|
outcome: "accepted",
|
|
177
|
-
targetType: "
|
|
177
|
+
targetType: "file_archive"
|
|
178
178
|
});
|
|
179
179
|
}
|
|
180
180
|
export function buildCustodyManifestWrittenAuditEvent(input) {
|
|
181
|
-
return
|
|
181
|
+
return buildSessionScopedAuditEvent(input, {
|
|
182
182
|
action: "custody.manifest.written",
|
|
183
183
|
outcome: "succeeded",
|
|
184
184
|
targetType: "custody_manifest"
|
|
@@ -327,15 +327,15 @@ function assertSupportedNestedKeys(input, allowed, field) {
|
|
|
327
327
|
}
|
|
328
328
|
}
|
|
329
329
|
}
|
|
330
|
-
function
|
|
330
|
+
function buildSessionScopedAuditEvent(input, spec) {
|
|
331
331
|
return buildSideEffectAuditEvent({
|
|
332
332
|
workspaceId: input.workspaceId,
|
|
333
|
-
|
|
333
|
+
sessionId: input.sessionId,
|
|
334
334
|
action: spec.action,
|
|
335
335
|
outcome: spec.outcome,
|
|
336
336
|
observedAt: input.observedAt,
|
|
337
337
|
actor: input.actor,
|
|
338
|
-
target: { type: spec.targetType, id: input.
|
|
338
|
+
target: { type: spec.targetType, id: input.sessionId },
|
|
339
339
|
...(input.correlation ? { correlation: input.correlation } : {}),
|
|
340
340
|
...(input.metadata ? { metadata: input.metadata } : {})
|
|
341
341
|
});
|
|
@@ -377,7 +377,7 @@ function normalizeTargetType(input) {
|
|
|
377
377
|
return input;
|
|
378
378
|
}
|
|
379
379
|
function isDeletionAction(action) {
|
|
380
|
-
return action === "
|
|
380
|
+
return action === "session.delete.requested" || action === "session.delete.completed" || action === "session.delete.failed";
|
|
381
381
|
}
|
|
382
382
|
function visitAuditValue(input, path, findings) {
|
|
383
383
|
if (typeof input === "string") {
|
|
@@ -417,18 +417,18 @@ const forbiddenStringPatterns = Object.freeze([
|
|
|
417
417
|
regex: /\b(?:sk-(?:ant|proj|live|test|deepseek|openai)|xox[baprs]-|AIza)[A-Za-z0-9_-]{8,}/i
|
|
418
418
|
},
|
|
419
419
|
{ reason: "signed_url", regex: /[?&](?:X-Amz-Signature|X-Amz-Credential|X-Amz-Algorithm|AWSAccessKeyId)=/i },
|
|
420
|
-
{ reason: "object_store_key", regex: /(^|[\s"'`])(?:
|
|
420
|
+
{ reason: "object_store_key", regex: /(^|[\s"'`])(?:sessions|assets)\/[^?<#\s"'`]+/i },
|
|
421
421
|
{ reason: "vault_id", regex: /\b(?:vault|vlt|secret)[_:-][A-Za-z0-9][A-Za-z0-9_-]{7,}\b/i },
|
|
422
422
|
{
|
|
423
423
|
reason: "private_resource_handle",
|
|
424
|
-
regex: /\b(?:machine|
|
|
424
|
+
regex: /\b(?:machine|agent|resource|handle|token_hash|bearer_hash)[_:-][A-Za-z0-9][A-Za-z0-9_-]{7,}\b/i
|
|
425
425
|
},
|
|
426
426
|
{ reason: "raw_url", regex: /\bhttps?:\/\/\S+/i },
|
|
427
427
|
{ reason: "raw_path", regex: /(^|[\s"'`])\/[A-Za-z0-9._~!$&'()*+,;=:@%-]+(?:[/?#][^\s"'`]*)?/ },
|
|
428
428
|
{ reason: "high_entropy_token", regex: /\b(?=[A-Za-z0-9_-]{40,}\b)(?=.*[A-Za-z])(?=.*\d)[A-Za-z0-9_-]{40,}\b/ }
|
|
429
429
|
]);
|
|
430
430
|
function isForbiddenAuditFieldName(key) {
|
|
431
|
-
return /^(authorization|headers?|requestHeaders?|responseHeaders?|body|requestBody|responseBody|rawBody|prompt|url|rawUrl|href|query|queryString|path|rawPath|signedUrl|objectStoreKey|objectKey|vaultId|providerResponseBody|providerAccountId|providerDeployment|rateCard|rateCardVersion|margin|discount|calculator|reconciliation|resourceHandle|privateResourceHandle|bearerHash|tokenHash|apiKey|apiKeys|secretValue|
|
|
431
|
+
return /^(authorization|headers?|requestHeaders?|responseHeaders?|body|requestBody|responseBody|rawBody|prompt|url|rawUrl|href|query|queryString|path|rawPath|signedUrl|objectStoreKey|objectKey|vaultId|providerResponseBody|providerAccountId|providerDeployment|rateCard|rateCardVersion|margin|discount|calculator|reconciliation|resourceHandle|privateResourceHandle|bearerHash|tokenHash|apiKey|apiKeys|secretValue|providerSessionId|agentId|customerId|endUserId|identity|email)$/i.test(key);
|
|
432
432
|
}
|
|
433
433
|
function assertSafeIdentifier(value, field) {
|
|
434
434
|
assertNonEmptyString(value, field);
|
package/dist/_contracts/sse.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Tiny SSE (text/event-stream) parser used by the SDK / CLI to consume
|
|
3
|
-
* the dashboard's `/api/
|
|
3
|
+
* the dashboard's `/api/sessions/:id/events/stream` endpoint without
|
|
4
4
|
* pulling in a DOM `EventSource` dependency. Node's `fetch` returns a
|
|
5
5
|
* web `ReadableStream<Uint8Array>` body; this parser turns that into
|
|
6
6
|
* an async iterable of `SseFrame`s.
|
package/dist/_contracts/sse.js
CHANGED
|
Binary file
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
*
|
|
6
6
|
* Pinned to `api.aex.dev` on purpose: the dashboard at
|
|
7
7
|
* `aex.dev` is the human UX surface, while `api.aex.dev`
|
|
8
|
-
* owns the runtime/API plane (
|
|
8
|
+
* owns the runtime/API plane (session submission, provider proxy, MCP
|
|
9
9
|
* proxy, runner callbacks). Both the apex `aex.dev` and `www.` host
|
|
10
10
|
* may issue redirects, and HTTP clients strip the `Authorization`
|
|
11
11
|
* header on cross-origin redirects (WHATWG Fetch §5.5) — hitting them
|
|
@@ -6,7 +6,7 @@ import { createHash } from "node:crypto";
|
|
|
6
6
|
*
|
|
7
7
|
* Pinned to `api.aex.dev` on purpose: the dashboard at
|
|
8
8
|
* `aex.dev` is the human UX surface, while `api.aex.dev`
|
|
9
|
-
* owns the runtime/API plane (
|
|
9
|
+
* owns the runtime/API plane (session submission, provider proxy, MCP
|
|
10
10
|
* proxy, runner callbacks). Both the apex `aex.dev` and `www.` host
|
|
11
11
|
* may issue redirects, and HTTP clients strip the `Authorization`
|
|
12
12
|
* header on cross-origin redirects (WHATWG Fetch §5.5) — hitting them
|
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
export declare const
|
|
2
|
-
export type
|
|
1
|
+
export declare const SESSION_CONTROL_STATUSES: readonly ["queued", "claiming", "provisioning", "session_created", "dispatched", "provider_running", "provider_idle", "provider_rescheduled", "idle", "suspending", "suspended", "deleting", "deleted", "expired", "cancelling", "capturing_files", "cleaning_up", "succeeded", "failed", "timed_out", "cancelled", "cleanup_failed"];
|
|
2
|
+
export type SessionControlStatus = typeof SESSION_CONTROL_STATUSES[number];
|
|
3
3
|
/**
|
|
4
4
|
* The RESUMABLE / in-flight lifecycle half of a session's status. A session
|
|
5
5
|
* whose status is one of these is either transitioning or parked resumable
|
|
6
6
|
* (`idle`/`suspended`) — it is NOT a terminal outcome. The terminal outcome
|
|
7
|
-
* half is {@link SESSION_TERMINAL_OUTCOMES}, derived from the
|
|
7
|
+
* half is {@link SESSION_TERMINAL_OUTCOMES}, derived from the session outcome SSoT.
|
|
8
8
|
*/
|
|
9
9
|
export declare const SESSION_LIFECYCLE_STATUSES: readonly ["creating", "running", "idle", "suspending", "suspended", "cancelling", "deleting", "deleted", "expired"];
|
|
10
10
|
export type SessionLifecycleStatus = typeof SESSION_LIFECYCLE_STATUSES[number];
|
|
11
11
|
/**
|
|
12
|
-
* The terminal OUTCOME half of a session's status — DERIVED from the
|
|
13
|
-
* outcome SSoT via `satisfies readonly
|
|
12
|
+
* The terminal OUTCOME half of a session's status — DERIVED from the session
|
|
13
|
+
* outcome SSoT via `satisfies readonly SessionTurnTerminalOutcome[]`, so a new run
|
|
14
14
|
* outcome fails to compile until it is accounted for here (and therefore in
|
|
15
15
|
* {@link SESSION_STATUSES}). This is the compile-time binding that stops the
|
|
16
|
-
* session and
|
|
16
|
+
* session and session terminal vocabularies from drifting: the bare session
|
|
17
17
|
* `error` is gone — a failed turn is `failed`, a wall-clock kill `timed_out`,
|
|
18
18
|
* a cancel `cancelled`, a clean finish `succeeded`.
|
|
19
19
|
*/
|
|
@@ -21,27 +21,27 @@ export declare const SESSION_TERMINAL_OUTCOMES: readonly ["succeeded", "failed",
|
|
|
21
21
|
export type SessionTerminalOutcome = typeof SESSION_TERMINAL_OUTCOMES[number];
|
|
22
22
|
/**
|
|
23
23
|
* The full closed set of session statuses: the resumable lifecycle half, the
|
|
24
|
-
* terminal-outcome half (bound to {@link
|
|
24
|
+
* terminal-outcome half (bound to {@link SESSION_TURN_TERMINAL_OUTCOMES}), and the
|
|
25
25
|
* first-class HITL write-gate `awaiting_approval`. Composed — never
|
|
26
|
-
* hand-listed — so the outcome vocabulary can only be extended at the
|
|
26
|
+
* hand-listed — so the outcome vocabulary can only be extended at the session SSoT.
|
|
27
27
|
*/
|
|
28
28
|
export declare const SESSION_STATUSES: readonly ["creating", "running", "idle", "suspending", "suspended", "cancelling", "deleting", "deleted", "expired", "succeeded", "failed", "timed_out", "cancelled", "awaiting_approval"];
|
|
29
29
|
export type SessionStatus = typeof SESSION_STATUSES[number];
|
|
30
30
|
/** True when a session status is terminal (an outcome, or deleted/expired). */
|
|
31
31
|
export declare function isTerminalSessionStatus(status: SessionStatus): boolean;
|
|
32
|
-
export type
|
|
33
|
-
export declare const
|
|
34
|
-
export declare function
|
|
32
|
+
export type SessionControlStatusKind = "active" | "terminal";
|
|
33
|
+
export declare const TERMINAL_SESSION_CONTROL_STATUSES: readonly ["succeeded", "failed", "timed_out", "cancelled", "deleted", "expired", "cleanup_failed"];
|
|
34
|
+
export declare function isTerminalSessionControlStatus(status: SessionControlStatus): boolean;
|
|
35
35
|
/**
|
|
36
|
-
* The closed set of terminal OUTCOMES the
|
|
37
|
-
* `
|
|
38
|
-
* STRICT SUBSET of {@link
|
|
36
|
+
* The closed set of terminal OUTCOMES the session-lifecycle funnel writes via
|
|
37
|
+
* `markTurnTerminal` (and that a `session/terminal` event carries). This is a
|
|
38
|
+
* STRICT SUBSET of {@link TERMINAL_SESSION_CONTROL_STATUSES}: the read-terminal set also
|
|
39
39
|
* includes `cleanup_failed`, which the funnel never writes as an outcome.
|
|
40
|
-
* The platform lifecycle `
|
|
40
|
+
* The platform lifecycle `TerminalSessionControlStatus` and the workflow `TerminalOutcome` both
|
|
41
41
|
* derive from this so the four call sites can't drift.
|
|
42
42
|
*/
|
|
43
|
-
export declare const
|
|
44
|
-
export type
|
|
45
|
-
export declare function
|
|
43
|
+
export declare const SESSION_TURN_TERMINAL_OUTCOMES: readonly ["succeeded", "failed", "timed_out", "cancelled"];
|
|
44
|
+
export type SessionTurnTerminalOutcome = typeof SESSION_TURN_TERMINAL_OUTCOMES[number];
|
|
45
|
+
export declare function getSessionControlStatusKind(status: SessionControlStatus): SessionControlStatusKind;
|
|
46
46
|
export declare const CLEANUP_STATUSES: readonly ["not_started", "pending", "running", "succeeded", "failed_retryable", "failed_terminal", "skipped"];
|
|
47
47
|
export type CleanupStatus = typeof CLEANUP_STATUSES[number];
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export const
|
|
1
|
+
export const SESSION_CONTROL_STATUSES = [
|
|
2
2
|
"queued",
|
|
3
3
|
"claiming",
|
|
4
4
|
"provisioning",
|
|
@@ -14,7 +14,7 @@ export const RUN_STATUSES = [
|
|
|
14
14
|
"deleted",
|
|
15
15
|
"expired",
|
|
16
16
|
"cancelling",
|
|
17
|
-
"
|
|
17
|
+
"capturing_files",
|
|
18
18
|
"cleaning_up",
|
|
19
19
|
"succeeded",
|
|
20
20
|
"failed",
|
|
@@ -26,7 +26,7 @@ export const RUN_STATUSES = [
|
|
|
26
26
|
* The RESUMABLE / in-flight lifecycle half of a session's status. A session
|
|
27
27
|
* whose status is one of these is either transitioning or parked resumable
|
|
28
28
|
* (`idle`/`suspended`) — it is NOT a terminal outcome. The terminal outcome
|
|
29
|
-
* half is {@link SESSION_TERMINAL_OUTCOMES}, derived from the
|
|
29
|
+
* half is {@link SESSION_TERMINAL_OUTCOMES}, derived from the session outcome SSoT.
|
|
30
30
|
*/
|
|
31
31
|
export const SESSION_LIFECYCLE_STATUSES = [
|
|
32
32
|
"creating",
|
|
@@ -40,11 +40,11 @@ export const SESSION_LIFECYCLE_STATUSES = [
|
|
|
40
40
|
"expired"
|
|
41
41
|
];
|
|
42
42
|
/**
|
|
43
|
-
* The terminal OUTCOME half of a session's status — DERIVED from the
|
|
44
|
-
* outcome SSoT via `satisfies readonly
|
|
43
|
+
* The terminal OUTCOME half of a session's status — DERIVED from the session
|
|
44
|
+
* outcome SSoT via `satisfies readonly SessionTurnTerminalOutcome[]`, so a new run
|
|
45
45
|
* outcome fails to compile until it is accounted for here (and therefore in
|
|
46
46
|
* {@link SESSION_STATUSES}). This is the compile-time binding that stops the
|
|
47
|
-
* session and
|
|
47
|
+
* session and session terminal vocabularies from drifting: the bare session
|
|
48
48
|
* `error` is gone — a failed turn is `failed`, a wall-clock kill `timed_out`,
|
|
49
49
|
* a cancel `cancelled`, a clean finish `succeeded`.
|
|
50
50
|
*/
|
|
@@ -56,9 +56,9 @@ export const SESSION_TERMINAL_OUTCOMES = [
|
|
|
56
56
|
];
|
|
57
57
|
/**
|
|
58
58
|
* The full closed set of session statuses: the resumable lifecycle half, the
|
|
59
|
-
* terminal-outcome half (bound to {@link
|
|
59
|
+
* terminal-outcome half (bound to {@link SESSION_TURN_TERMINAL_OUTCOMES}), and the
|
|
60
60
|
* first-class HITL write-gate `awaiting_approval`. Composed — never
|
|
61
|
-
* hand-listed — so the outcome vocabulary can only be extended at the
|
|
61
|
+
* hand-listed — so the outcome vocabulary can only be extended at the session SSoT.
|
|
62
62
|
*/
|
|
63
63
|
export const SESSION_STATUSES = [
|
|
64
64
|
...SESSION_LIFECYCLE_STATUSES,
|
|
@@ -79,7 +79,7 @@ const SESSION_TERMINAL_STATUSES = new Set([
|
|
|
79
79
|
export function isTerminalSessionStatus(status) {
|
|
80
80
|
return SESSION_TERMINAL_STATUSES.has(status);
|
|
81
81
|
}
|
|
82
|
-
export const
|
|
82
|
+
export const TERMINAL_SESSION_CONTROL_STATUSES = [
|
|
83
83
|
"succeeded",
|
|
84
84
|
"failed",
|
|
85
85
|
"timed_out",
|
|
@@ -88,26 +88,26 @@ export const TERMINAL_RUN_STATUSES = [
|
|
|
88
88
|
"expired",
|
|
89
89
|
"cleanup_failed"
|
|
90
90
|
];
|
|
91
|
-
const
|
|
92
|
-
export function
|
|
93
|
-
return
|
|
91
|
+
const terminalSessionControlStatuses = new Set(TERMINAL_SESSION_CONTROL_STATUSES);
|
|
92
|
+
export function isTerminalSessionControlStatus(status) {
|
|
93
|
+
return terminalSessionControlStatuses.has(status);
|
|
94
94
|
}
|
|
95
95
|
/**
|
|
96
|
-
* The closed set of terminal OUTCOMES the
|
|
97
|
-
* `
|
|
98
|
-
* STRICT SUBSET of {@link
|
|
96
|
+
* The closed set of terminal OUTCOMES the session-lifecycle funnel writes via
|
|
97
|
+
* `markTurnTerminal` (and that a `session/terminal` event carries). This is a
|
|
98
|
+
* STRICT SUBSET of {@link TERMINAL_SESSION_CONTROL_STATUSES}: the read-terminal set also
|
|
99
99
|
* includes `cleanup_failed`, which the funnel never writes as an outcome.
|
|
100
|
-
* The platform lifecycle `
|
|
100
|
+
* The platform lifecycle `TerminalSessionControlStatus` and the workflow `TerminalOutcome` both
|
|
101
101
|
* derive from this so the four call sites can't drift.
|
|
102
102
|
*/
|
|
103
|
-
export const
|
|
103
|
+
export const SESSION_TURN_TERMINAL_OUTCOMES = [
|
|
104
104
|
"succeeded",
|
|
105
105
|
"failed",
|
|
106
106
|
"timed_out",
|
|
107
107
|
"cancelled"
|
|
108
108
|
];
|
|
109
|
-
export function
|
|
110
|
-
return
|
|
109
|
+
export function getSessionControlStatusKind(status) {
|
|
110
|
+
return isTerminalSessionControlStatus(status) ? "terminal" : "active";
|
|
111
111
|
}
|
|
112
112
|
export const CLEANUP_STATUSES = [
|
|
113
113
|
"not_started",
|