@xemahq/kernel-contracts 0.41.0 → 0.43.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/dist/agent-composition/lib/model-resolution-matrix.d.ts +5 -2
- package/dist/agent-composition/lib/model-resolution-matrix.d.ts.map +1 -1
- package/dist/agent-composition/lib/model-resolution-matrix.js +1 -0
- package/dist/agent-composition/lib/model-resolution-matrix.js.map +1 -1
- package/dist/contribution/lib/contribution-kind.d.ts +2 -1
- package/dist/contribution/lib/contribution-kind.d.ts.map +1 -1
- package/dist/contribution/lib/contribution-kind.js +1 -0
- package/dist/contribution/lib/contribution-kind.js.map +1 -1
- package/dist/ingestion-source/index.d.ts +2 -0
- package/dist/ingestion-source/index.d.ts.map +1 -0
- package/dist/ingestion-source/index.js +18 -0
- package/dist/ingestion-source/index.js.map +1 -0
- package/dist/ingestion-source/lib/ingestion-source-contribution.d.ts +62 -0
- package/dist/ingestion-source/lib/ingestion-source-contribution.d.ts.map +1 -0
- package/dist/ingestion-source/lib/ingestion-source-contribution.js +78 -0
- package/dist/ingestion-source/lib/ingestion-source-contribution.js.map +1 -0
- package/dist/llm-gateway/lib/errors.d.ts +5 -0
- package/dist/llm-gateway/lib/errors.d.ts.map +1 -1
- package/dist/llm-gateway/lib/errors.js +21 -1
- package/dist/llm-gateway/lib/errors.js.map +1 -1
- package/dist/output/index.d.ts +1 -0
- package/dist/output/index.d.ts.map +1 -1
- package/dist/output/index.js +1 -0
- package/dist/output/index.js.map +1 -1
- package/dist/output/lib/output-version-dto.d.ts +2 -0
- package/dist/output/lib/output-version-dto.d.ts.map +1 -1
- package/dist/output/lib/point-of-attention.d.ts +19 -0
- package/dist/output/lib/point-of-attention.d.ts.map +1 -0
- package/dist/output/lib/point-of-attention.js +24 -0
- package/dist/output/lib/point-of-attention.js.map +1 -0
- package/dist/worker-runtime/index.d.ts +1 -0
- package/dist/worker-runtime/index.d.ts.map +1 -1
- package/dist/worker-runtime/index.js +1 -0
- package/dist/worker-runtime/index.js.map +1 -1
- package/dist/worker-runtime/lib/enums.d.ts +5 -0
- package/dist/worker-runtime/lib/enums.d.ts.map +1 -1
- package/dist/worker-runtime/lib/enums.js +7 -1
- package/dist/worker-runtime/lib/enums.js.map +1 -1
- package/dist/worker-runtime/lib/runtime-layout-profile.d.ts +4 -1
- package/dist/worker-runtime/lib/runtime-layout-profile.d.ts.map +1 -1
- package/dist/worker-runtime/lib/runtime-layout-profile.js +12 -0
- package/dist/worker-runtime/lib/runtime-layout-profile.js.map +1 -1
- package/dist/worker-runtime/lib/workspace-sandbox.d.ts +7 -0
- package/dist/worker-runtime/lib/workspace-sandbox.d.ts.map +1 -0
- package/dist/worker-runtime/lib/workspace-sandbox.js +36 -0
- package/dist/worker-runtime/lib/workspace-sandbox.js.map +1 -0
- package/dist/workflow/index.d.ts +1 -0
- package/dist/workflow/index.d.ts.map +1 -1
- package/dist/workflow/index.js +1 -0
- package/dist/workflow/index.js.map +1 -1
- package/dist/workflow/lib/enums.d.ts +1 -0
- package/dist/workflow/lib/enums.d.ts.map +1 -1
- package/dist/workflow/lib/enums.js +1 -0
- package/dist/workflow/lib/enums.js.map +1 -1
- package/dist/workflow/lib/model-ref.d.ts +17 -0
- package/dist/workflow/lib/model-ref.d.ts.map +1 -1
- package/dist/workflow/lib/model-ref.js +19 -1
- package/dist/workflow/lib/model-ref.js.map +1 -1
- package/dist/workflow/lib/workflow-control.d.ts +121 -0
- package/dist/workflow/lib/workflow-control.d.ts.map +1 -0
- package/dist/workflow/lib/workflow-control.js +101 -0
- package/dist/workflow/lib/workflow-control.js.map +1 -0
- package/package.json +1 -1
- package/src/agent-composition/lib/model-resolution-matrix.ts +16 -1
- package/src/contribution/lib/contribution-kind.ts +18 -0
- package/src/ingestion-source/index.ts +20 -0
- package/src/ingestion-source/lib/ingestion-source-contribution.ts +238 -0
- package/src/llm-gateway/lib/errors.ts +46 -0
- package/src/output/index.ts +1 -0
- package/src/output/lib/output-version-dto.ts +9 -0
- package/src/output/lib/point-of-attention.ts +69 -0
- package/src/worker-runtime/index.ts +1 -0
- package/src/worker-runtime/lib/enums.ts +29 -0
- package/src/worker-runtime/lib/runtime-layout-profile.ts +61 -1
- package/src/worker-runtime/lib/workspace-sandbox.ts +129 -0
- package/src/workflow/index.ts +1 -0
- package/src/workflow/lib/enums.ts +8 -0
- package/src/workflow/lib/model-ref.ts +45 -0
- package/src/workflow/lib/workflow-control.ts +234 -0
|
@@ -263,6 +263,14 @@ export enum BuiltInActionId {
|
|
|
263
263
|
HTTP = 'xema/http',
|
|
264
264
|
WAIT = 'xema/wait',
|
|
265
265
|
EMIT_ARTIFACT = 'xema/emit-artifact',
|
|
266
|
+
/**
|
|
267
|
+
* Pull a declared external ingestion source into its local catalog — the
|
|
268
|
+
* generic runtime counterpart of a `ContributionKind.IngestionSource`
|
|
269
|
+
* declaration. Any sub-app that materializes an external dataset on a cadence
|
|
270
|
+
* dispatches this action; the caller resolves which source to pull. The
|
|
271
|
+
* implementation ships later in workflow-runtime-worker.
|
|
272
|
+
*/
|
|
273
|
+
INGEST_SOURCE = 'xema/ingest-source',
|
|
266
274
|
ENDPOINT_FETCH = 'xema/endpoint-fetch',
|
|
267
275
|
SCM_POST_REVIEW = 'software-dev/scm-post-review',
|
|
268
276
|
DISPATCH_WORKFLOW = 'xema/dispatch-workflow',
|
|
@@ -64,6 +64,51 @@ export const ModelClassSchema = z.enum(
|
|
|
64
64
|
MODEL_CLASS_VALUES as readonly [ModelClass, ...ModelClass[]],
|
|
65
65
|
);
|
|
66
66
|
|
|
67
|
+
/**
|
|
68
|
+
* A model's INTRINSIC capability / modality — what a concrete model can do
|
|
69
|
+
* regardless of which routing tier ({@link ModelClass}) selected it. The
|
|
70
|
+
* SINGLE source of truth for the closed set
|
|
71
|
+
* `vision | long_context | reasoning | function_calling | audio | embedding`.
|
|
72
|
+
*
|
|
73
|
+
* Consumed as a first-class dimension by the Model Resolution Matrix
|
|
74
|
+
* (`ResolutionDimension.ModelCapability` in `@xemahq/kernel-contracts/agent-composition`),
|
|
75
|
+
* so an org can route "any invocation that needs vision" to a capable model
|
|
76
|
+
* without pinning a provider. Domain-agnostic: describes the model, never a
|
|
77
|
+
* business use-case.
|
|
78
|
+
*/
|
|
79
|
+
export enum ModelCapability {
|
|
80
|
+
/** Accepts image input (multimodal vision). */
|
|
81
|
+
VISION = 'vision',
|
|
82
|
+
/** Supports an extended context window beyond the baseline tier. */
|
|
83
|
+
LONG_CONTEXT = 'long_context',
|
|
84
|
+
/** Exposes explicit step-by-step / extended-thinking reasoning. */
|
|
85
|
+
REASONING = 'reasoning',
|
|
86
|
+
/** Supports structured tool / function calling. */
|
|
87
|
+
FUNCTION_CALLING = 'function_calling',
|
|
88
|
+
/** Accepts or produces audio. */
|
|
89
|
+
AUDIO = 'audio',
|
|
90
|
+
/** Produces embedding vectors (retrieval / similarity). */
|
|
91
|
+
EMBEDDING = 'embedding',
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
export const MODEL_CAPABILITY_VALUES: readonly ModelCapability[] = [
|
|
95
|
+
ModelCapability.VISION,
|
|
96
|
+
ModelCapability.LONG_CONTEXT,
|
|
97
|
+
ModelCapability.REASONING,
|
|
98
|
+
ModelCapability.FUNCTION_CALLING,
|
|
99
|
+
ModelCapability.AUDIO,
|
|
100
|
+
ModelCapability.EMBEDDING,
|
|
101
|
+
];
|
|
102
|
+
|
|
103
|
+
/**
|
|
104
|
+
* Zod schema for {@link ModelCapability}. Built from the enum so the literal
|
|
105
|
+
* list lives in exactly one place. Use this in any YAML/wire schema that
|
|
106
|
+
* needs to validate a model-capability field.
|
|
107
|
+
*/
|
|
108
|
+
export const ModelCapabilitySchema = z.enum(
|
|
109
|
+
MODEL_CAPABILITY_VALUES as readonly [ModelCapability, ...ModelCapability[]],
|
|
110
|
+
);
|
|
111
|
+
|
|
67
112
|
export enum ModelRefKind {
|
|
68
113
|
CONCRETE = 'concrete',
|
|
69
114
|
STRATEGY = 'strategy',
|
|
@@ -0,0 +1,234 @@
|
|
|
1
|
+
// ═══════════════════════════════════════════════════════════════════════════
|
|
2
|
+
// ── Governed Workflow-Control Contracts ──
|
|
3
|
+
//
|
|
4
|
+
// Wire contracts for the least-privilege "workflow-control" surface: an
|
|
5
|
+
// in-session agent invoking its OWN governing workflow run's control signals
|
|
6
|
+
// (decide a decision gate, answer a pending inquiry, change run status) as a
|
|
7
|
+
// governed tool.
|
|
8
|
+
//
|
|
9
|
+
// The agent NEVER supplies the target run or org — those are server-derived
|
|
10
|
+
// from the verified session/token and injected by the mcp-gateway bridge into
|
|
11
|
+
// `runId` / `orgId`. This file carries the closed action set, the settable
|
|
12
|
+
// run-status subset, the typed rejection codes, the engine-internal request
|
|
13
|
+
// shape, and the first-class structured accepted/rejected RESULT.
|
|
14
|
+
//
|
|
15
|
+
// The RESULT is deliberately a structured discriminated union (never an opaque
|
|
16
|
+
// 4xx) so the calling model reads a typed outcome rather than mis-parsing an
|
|
17
|
+
// HTTP error. The engine-internal control endpoint returns HTTP 200 carrying
|
|
18
|
+
// this shape for every BUSINESS outcome (accepted or rejected); only genuine
|
|
19
|
+
// server faults surface as non-2xx.
|
|
20
|
+
//
|
|
21
|
+
// Shared between workflow-engine-api (the control surface) and mcp-gateway-api
|
|
22
|
+
// (the governed tool). Runtime-framework-agnostic — no NestJS, no Prisma.
|
|
23
|
+
// ═══════════════════════════════════════════════════════════════════════════
|
|
24
|
+
|
|
25
|
+
import { z } from 'zod';
|
|
26
|
+
|
|
27
|
+
import { DecisionVerdict } from '../../decision-gate/lib/decision-gate';
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* The closed set of control actions an agent may take against its own
|
|
31
|
+
* governing run. Reuses the platform's existing signal/gate/inquiry
|
|
32
|
+
* mechanisms — no second control path.
|
|
33
|
+
*
|
|
34
|
+
* - `DECIDE_GATE` — submit a decision-gate verdict (approve/reject/abstain)
|
|
35
|
+
* on a `DECISION_GATE` inquiry belonging to the run.
|
|
36
|
+
* - `ANSWER_INQUIRY` — submit a reply to a pending non-gate inquiry
|
|
37
|
+
* (`AGENT_TOOL_INQUIRY` / `REVIEW`) belonging to the run.
|
|
38
|
+
* - `SET_RUN_STATUS` — request a run-status transition (pause / resume /
|
|
39
|
+
* cancel) via the existing run signal.
|
|
40
|
+
* - `REFINE_PHASE` — re-run a completed phase of the run incorporating
|
|
41
|
+
* `feedback`, via the `controlPhase` run signal. A
|
|
42
|
+
* "phase" is addressed by its `phaseKey` (the run's
|
|
43
|
+
* job/stage key). Only a COMPLETED phase is refinable.
|
|
44
|
+
* - `RESTART_PHASE` — re-run a completed phase from scratch (no feedback),
|
|
45
|
+
* via the same `controlPhase` run signal.
|
|
46
|
+
*
|
|
47
|
+
* REFINE/RESTART are a net-new engine+worker phase-control primitive (there
|
|
48
|
+
* was no server-side phase-refinement mechanism to reuse — the run-level
|
|
49
|
+
* "redo" affordance is UI-metadata only). They route through the SAME
|
|
50
|
+
* governed control surface + the SAME run-signal plumbing as the other
|
|
51
|
+
* actions — no second control path.
|
|
52
|
+
*/
|
|
53
|
+
export enum WorkflowControlAction {
|
|
54
|
+
DECIDE_GATE = 'decide_gate',
|
|
55
|
+
ANSWER_INQUIRY = 'answer_inquiry',
|
|
56
|
+
SET_RUN_STATUS = 'set_run_status',
|
|
57
|
+
REFINE_PHASE = 'refine_phase',
|
|
58
|
+
RESTART_PHASE = 'restart_phase',
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* The settable run-status transitions an agent may request. A closed subset of
|
|
63
|
+
* `WorkflowRunStatus` — only the values that map 1:1 onto an existing run
|
|
64
|
+
* signal. The engine translates each to the corresponding signal:
|
|
65
|
+
*
|
|
66
|
+
* PAUSED → `pauseRun`
|
|
67
|
+
* RUNNING → `resumeRun`
|
|
68
|
+
* CANCELLED → `cancelRun`
|
|
69
|
+
*
|
|
70
|
+
* Terminal statuses (succeeded/failed/…) are NOT settable — a run reaches
|
|
71
|
+
* those only through its own execution, never an agent control signal.
|
|
72
|
+
*/
|
|
73
|
+
export enum WorkflowRunStatusTarget {
|
|
74
|
+
PAUSED = 'paused',
|
|
75
|
+
RUNNING = 'running',
|
|
76
|
+
CANCELLED = 'cancelled',
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* Typed rejection codes for the structured control RESULT. Closed set — the
|
|
81
|
+
* calling model branches on these, so free-form strings are forbidden. Each
|
|
82
|
+
* corresponds to a pre-validation against live run/gate/inquiry state.
|
|
83
|
+
*/
|
|
84
|
+
export enum WorkflowControlRejectionCode {
|
|
85
|
+
/** The calling session is not bound to any governing workflow run. */
|
|
86
|
+
NO_GOVERNING_RUN = 'NO_GOVERNING_RUN',
|
|
87
|
+
/** The request failed contract validation before any state was touched. */
|
|
88
|
+
INVALID_REQUEST = 'INVALID_REQUEST',
|
|
89
|
+
/** The bound run does not exist for the session's org (uniform anti-probe). */
|
|
90
|
+
RUN_NOT_FOUND = 'RUN_NOT_FOUND',
|
|
91
|
+
/** The run is in a terminal state and accepts no control signal. */
|
|
92
|
+
RUN_ALREADY_TERMINAL = 'RUN_ALREADY_TERMINAL',
|
|
93
|
+
/** The run's execution rejected the requested signal. */
|
|
94
|
+
RUN_SIGNAL_REJECTED = 'RUN_SIGNAL_REJECTED',
|
|
95
|
+
/** The referenced inquiry does not exist for the session's org. */
|
|
96
|
+
INQUIRY_NOT_FOUND = 'INQUIRY_NOT_FOUND',
|
|
97
|
+
/** The referenced inquiry does not belong to the session's governing run. */
|
|
98
|
+
INQUIRY_NOT_ON_RUN = 'INQUIRY_NOT_ON_RUN',
|
|
99
|
+
/** The inquiry kind does not match the action (gate vs non-gate). */
|
|
100
|
+
INQUIRY_WRONG_KIND = 'INQUIRY_WRONG_KIND',
|
|
101
|
+
/** The gate is no longer pending and accepts no further verdicts. */
|
|
102
|
+
GATE_NOT_PENDING = 'GATE_NOT_PENDING',
|
|
103
|
+
/** The inquiry is no longer pending and accepts no further replies. */
|
|
104
|
+
INQUIRY_NOT_PENDING = 'INQUIRY_NOT_PENDING',
|
|
105
|
+
/** No recipient with the given id exists on the inquiry. */
|
|
106
|
+
RECIPIENT_NOT_FOUND = 'RECIPIENT_NOT_FOUND',
|
|
107
|
+
/** The targeted recipient is not an AGENT recipient — an agent tool may
|
|
108
|
+
* only reply as an agent recipient, never forge a human/endpoint verdict. */
|
|
109
|
+
RECIPIENT_NOT_AGENT = 'RECIPIENT_NOT_AGENT',
|
|
110
|
+
/** The targeted recipient has already replied (idempotent-safe rejection). */
|
|
111
|
+
RECIPIENT_ALREADY_REPLIED = 'RECIPIENT_ALREADY_REPLIED',
|
|
112
|
+
/** No phase with the given `phaseKey` exists on the run (a "phase" is a
|
|
113
|
+
* run job/stage key). Uniform with a phase that never ran. */
|
|
114
|
+
PHASE_NOT_FOUND = 'PHASE_NOT_FOUND',
|
|
115
|
+
/** The phase exists but is not in a state that can be refined/restarted —
|
|
116
|
+
* only a COMPLETED phase is refinable (a still-running or skipped phase
|
|
117
|
+
* is not). */
|
|
118
|
+
PHASE_NOT_REFINABLE = 'PHASE_NOT_REFINABLE',
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
// ─── Request (engine-internal wire shape) ────────────────────────────────────
|
|
122
|
+
//
|
|
123
|
+
// `runId` + `orgId` are the SERVER-derived tenancy/subject binding injected by
|
|
124
|
+
// the gateway from the verified session token — they are part of the wire
|
|
125
|
+
// shape the engine validates, but the AGENT never supplies them.
|
|
126
|
+
|
|
127
|
+
const RunBindingShape = {
|
|
128
|
+
/** The governing run, injected server-side from the session — not agent input. */
|
|
129
|
+
runId: z.string().min(1),
|
|
130
|
+
/** The session's org, injected server-side from the token — not agent input. */
|
|
131
|
+
orgId: z.string().min(1),
|
|
132
|
+
} as const;
|
|
133
|
+
|
|
134
|
+
const DecideGateRequestSchema = z.object({
|
|
135
|
+
...RunBindingShape,
|
|
136
|
+
action: z.literal(WorkflowControlAction.DECIDE_GATE),
|
|
137
|
+
/** The DECISION_GATE inquiry to decide (must belong to the governing run). */
|
|
138
|
+
inquiryId: z.string().min(1),
|
|
139
|
+
/** The agent recipient row on the inquiry the caller replies AS. */
|
|
140
|
+
recipientId: z.string().min(1),
|
|
141
|
+
verdict: z.nativeEnum(DecisionVerdict),
|
|
142
|
+
/** Required (non-empty) when verdict is REJECT — enforced downstream by the
|
|
143
|
+
* reused `DecisionGateReplySchema`. */
|
|
144
|
+
reason: z.string().optional(),
|
|
145
|
+
});
|
|
146
|
+
|
|
147
|
+
const AnswerInquiryRequestSchema = z.object({
|
|
148
|
+
...RunBindingShape,
|
|
149
|
+
action: z.literal(WorkflowControlAction.ANSWER_INQUIRY),
|
|
150
|
+
/** The non-gate inquiry to answer (must belong to the governing run). */
|
|
151
|
+
inquiryId: z.string().min(1),
|
|
152
|
+
/** The agent recipient row on the inquiry the caller replies AS. */
|
|
153
|
+
recipientId: z.string().min(1),
|
|
154
|
+
/** Kind-specific reply payload — validated by the inquiry kind's own schema. */
|
|
155
|
+
payload: z.record(z.string(), z.unknown()),
|
|
156
|
+
});
|
|
157
|
+
|
|
158
|
+
const SetRunStatusRequestSchema = z.object({
|
|
159
|
+
...RunBindingShape,
|
|
160
|
+
action: z.literal(WorkflowControlAction.SET_RUN_STATUS),
|
|
161
|
+
status: z.nativeEnum(WorkflowRunStatusTarget),
|
|
162
|
+
reason: z.string().optional(),
|
|
163
|
+
});
|
|
164
|
+
|
|
165
|
+
const RefinePhaseRequestSchema = z.object({
|
|
166
|
+
...RunBindingShape,
|
|
167
|
+
action: z.literal(WorkflowControlAction.REFINE_PHASE),
|
|
168
|
+
/** The phase to re-run — the run's job/stage key. Must be a COMPLETED phase. */
|
|
169
|
+
phaseKey: z.string().min(1),
|
|
170
|
+
/** Optional refinement feedback folded into the re-run of the phase. */
|
|
171
|
+
feedback: z.string().optional(),
|
|
172
|
+
});
|
|
173
|
+
|
|
174
|
+
const RestartPhaseRequestSchema = z.object({
|
|
175
|
+
...RunBindingShape,
|
|
176
|
+
action: z.literal(WorkflowControlAction.RESTART_PHASE),
|
|
177
|
+
/** The phase to re-run from scratch — the run's job/stage key. Must be COMPLETED. */
|
|
178
|
+
phaseKey: z.string().min(1),
|
|
179
|
+
});
|
|
180
|
+
|
|
181
|
+
/**
|
|
182
|
+
* The engine-internal control request. Discriminated on `action`; every member
|
|
183
|
+
* carries the server-derived `runId` + `orgId` binding.
|
|
184
|
+
*/
|
|
185
|
+
export const WorkflowControlRequestSchema = z.discriminatedUnion('action', [
|
|
186
|
+
DecideGateRequestSchema,
|
|
187
|
+
AnswerInquiryRequestSchema,
|
|
188
|
+
SetRunStatusRequestSchema,
|
|
189
|
+
RefinePhaseRequestSchema,
|
|
190
|
+
RestartPhaseRequestSchema,
|
|
191
|
+
]);
|
|
192
|
+
export type WorkflowControlRequest = z.infer<typeof WorkflowControlRequestSchema>;
|
|
193
|
+
|
|
194
|
+
export type DecideGateRequest = z.infer<typeof DecideGateRequestSchema>;
|
|
195
|
+
export type AnswerInquiryRequest = z.infer<typeof AnswerInquiryRequestSchema>;
|
|
196
|
+
export type SetRunStatusRequest = z.infer<typeof SetRunStatusRequestSchema>;
|
|
197
|
+
export type RefinePhaseRequest = z.infer<typeof RefinePhaseRequestSchema>;
|
|
198
|
+
export type RestartPhaseRequest = z.infer<typeof RestartPhaseRequestSchema>;
|
|
199
|
+
|
|
200
|
+
// ─── Result (first-class structured accepted/rejected outcome) ───────────────
|
|
201
|
+
|
|
202
|
+
export const WorkflowControlResultSchema = z.discriminatedUnion('ok', [
|
|
203
|
+
z.object({
|
|
204
|
+
ok: z.literal(true),
|
|
205
|
+
/** Optional human-readable note (e.g. which signal was sent). */
|
|
206
|
+
detail: z.string().optional(),
|
|
207
|
+
}),
|
|
208
|
+
z.object({
|
|
209
|
+
ok: z.literal(false),
|
|
210
|
+
code: z.nativeEnum(WorkflowControlRejectionCode),
|
|
211
|
+
message: z.string().min(1),
|
|
212
|
+
}),
|
|
213
|
+
]);
|
|
214
|
+
export type WorkflowControlResult = z.infer<typeof WorkflowControlResultSchema>;
|
|
215
|
+
|
|
216
|
+
/** Construct an accepted result. */
|
|
217
|
+
export function workflowControlAccepted(detail?: string): WorkflowControlResult {
|
|
218
|
+
return detail === undefined ? { ok: true } : { ok: true, detail };
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
/** Construct a typed rejection result. */
|
|
222
|
+
export function workflowControlRejected(
|
|
223
|
+
code: WorkflowControlRejectionCode,
|
|
224
|
+
message: string,
|
|
225
|
+
): WorkflowControlResult {
|
|
226
|
+
return { ok: false, code, message };
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
/**
|
|
230
|
+
* The canonical capability ref governing this surface. `workflow` is an
|
|
231
|
+
* existing first-party capability domain; the router dispatches this ref to the
|
|
232
|
+
* engine's internal control endpoint and authorization-api gates it by grant.
|
|
233
|
+
*/
|
|
234
|
+
export const WORKFLOW_CONTROL_CAPABILITY_REF = 'workflow:control@1';
|