@coalex-ai/sdk 1.14.0-beta.71 → 1.14.0-beta.92

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.
@@ -0,0 +1,156 @@
1
+ /**
2
+ * Decision Request — the gateway-proof HITL seam (COA-1278, Console spec §4).
3
+ *
4
+ * A Decision Request is the single object the Coalex Console renders and resolves,
5
+ * deliberately agnostic to *who* produced it. In v1 the producer is the SDK's
6
+ * `evaluate()` (an escalation); a future MCP Gateway will produce the *same* object from
7
+ * an intercepted `tools/call`. Nothing in the Console changes between the two.
8
+ *
9
+ * Per Console spec §4, a Decision Request carries four things:
10
+ * 1. Context payload — what the human needs to judge (§6 de-biasing: output shown as an
11
+ * editable answer; never the agent's reasoning, confidence, or risk score).
12
+ * 2. Question schema — the fields to answer, as an elicitation-style JSON Schema with
13
+ * `coalex.*` annotations (a metric type per field).
14
+ * 3. Resolver policy — `self` | `role:<name>` (per governed tool, config).
15
+ * 4. Resume hook — how the producer continues after resolution.
16
+ *
17
+ * It also carries an MCP task state (spec §5): `working` | `input_required` |
18
+ * `completed` | `failed` | `cancelled` — the shared backbone between Console and the
19
+ * future Gateway.
20
+ *
21
+ * This module mirrors `coalex/decision_request.py` in the Python SDK. It is additive: it
22
+ * defines the shared types + a `fromEscalation` mapper and does not rewire
23
+ * `evaluate()`/`resolve()`. `serializeDecisionRequest` emits the exact snake_case wire
24
+ * shape produced by the Python SDK's `DecisionRequest.to_dict()`.
25
+ */
26
+ /** MCP task states carried by a Decision Request (spec §5). */
27
+ export type TaskState = "working" | "input_required" | "completed" | "failed" | "cancelled";
28
+ /** All MCP task states, for validation / catalog use. */
29
+ export declare const TASK_STATES: ReadonlySet<TaskState>;
30
+ /** Elicitation result action for a resolved task (spec §5). */
31
+ export type ElicitationAction = "accept" | "decline" | "cancel";
32
+ /** v1 identity Question Composer (spec §6). */
33
+ export declare const DEFAULT_QUESTION = "Review this output";
34
+ /** Who may resolve this request (spec §4.3): `self` or `role:<name>`. */
35
+ export interface ResolverPolicy {
36
+ readonly kind: "self" | "role";
37
+ readonly role?: string;
38
+ }
39
+ /** Parse the `self` | `role:<name>` config string into a policy. */
40
+ export declare function parseResolver(spec: string): ResolverPolicy;
41
+ /** Serialize a policy back to the `self` | `role:<name>` wire string. */
42
+ export declare function resolverToSpec(policy: ResolverPolicy): string;
43
+ /**
44
+ * How the producer resumes after resolution (spec §4.4). v1 (SDK path): the LangGraph
45
+ * checkpoint-resume callback promoted to a first-class field. Future (Gateway path):
46
+ * completing/failing the held MCP `taskId`.
47
+ */
48
+ export interface ResumeHook {
49
+ readonly kind: "checkpoint" | "mcp_task";
50
+ readonly url?: string;
51
+ readonly checkpointId?: string;
52
+ readonly taskId?: string;
53
+ }
54
+ /**
55
+ * One field of the elicitation-style question schema (spec §4.2, §6): a JSON Schema
56
+ * property extended with the namespaced `coalex.metric` annotation.
57
+ */
58
+ export interface QuestionField {
59
+ type: string;
60
+ title?: string;
61
+ description?: string;
62
+ items?: Record<string, unknown>;
63
+ enum?: unknown[];
64
+ "coalex.metric"?: string;
65
+ }
66
+ /** The elicitation-style question schema (spec §4.2): a flat JSON Schema object. */
67
+ export interface QuestionSchema {
68
+ type: "object";
69
+ properties: Record<string, QuestionField>;
70
+ required: string[];
71
+ }
72
+ /**
73
+ * What the human needs to judge (spec §4.1, §6 de-biasing). Deliberately excludes the
74
+ * agent's reasoning, confidence, and risk score; `output` is shown as an editable answer.
75
+ */
76
+ export interface ContextPayload {
77
+ question: string;
78
+ output: Record<string, unknown>;
79
+ input?: Record<string, unknown>;
80
+ summary?: string;
81
+ }
82
+ /** The resolution of a task (spec §5, §7.2) — action plus the DORA who-did-what trail. */
83
+ export interface ElicitationResult {
84
+ action: ElicitationAction;
85
+ content?: Record<string, unknown>;
86
+ reason?: string;
87
+ reviewer?: string;
88
+ reviewerName?: string;
89
+ reviewerEmail?: string;
90
+ resolvedAt?: string;
91
+ }
92
+ /** The gateway-proof HITL seam (spec §4). */
93
+ export interface DecisionRequest {
94
+ id: string;
95
+ taskState: TaskState;
96
+ context: ContextPayload;
97
+ questionSchema: QuestionSchema;
98
+ resolver: ResolverPolicy;
99
+ accountId?: string;
100
+ agentId?: string;
101
+ agentName?: string;
102
+ requestId?: string;
103
+ resumeHook?: ResumeHook;
104
+ result?: ElicitationResult;
105
+ createdAt?: string;
106
+ updatedAt?: string;
107
+ }
108
+ /** The escalation as returned by the transformer API (snake_case JSON). */
109
+ export interface EscalationLike {
110
+ escalation_id?: string;
111
+ account_id?: string;
112
+ agent_id?: string | null;
113
+ agent_name?: string | null;
114
+ request_id?: string | null;
115
+ input?: Record<string, unknown> | null;
116
+ output?: Record<string, unknown> | null;
117
+ metrics?: Record<string, unknown> | null;
118
+ status?: string;
119
+ resolved_by?: string | null;
120
+ reviewer_name?: string | null;
121
+ reviewer_email?: string | null;
122
+ resolved_at?: string | null;
123
+ resolution_reason?: string | null;
124
+ corrections?: Record<string, unknown> | null;
125
+ created_at?: string | null;
126
+ updated_at?: string | null;
127
+ }
128
+ /**
129
+ * Escalation status -> MCP task state (spec §5). See `fromEscalation` for the full
130
+ * status -> (state, action) reconciliation.
131
+ */
132
+ export declare const TASK_STATE_BY_STATUS: Readonly<Record<string, TaskState>>;
133
+ /** Map an escalation status to its MCP task state (spec §5). */
134
+ export declare function taskStateForStatus(status: string): TaskState;
135
+ export interface FromEscalationOptions {
136
+ /** Resolver policy or its `self` | `role:<name>` string. Default `self`. */
137
+ resolver?: ResolverPolicy | string;
138
+ /** How the producer resumes after resolution (spec §4.4). */
139
+ resumeHook?: ResumeHook;
140
+ /** The composed question shown on the card. Default: identity composer (§6). */
141
+ question?: string;
142
+ }
143
+ /**
144
+ * Materialize an escalation as a Decision Request (spec §4, COA-1278). The task state
145
+ * and elicitation action follow spec §5's mapping. The escalation has no
146
+ * resolver/resume-hook of its own, so the producer supplies them here; `resolver`
147
+ * defaults to `self`. Throws on an unrecognized status.
148
+ */
149
+ export declare function fromEscalation(escalation: EscalationLike, options?: FromEscalationOptions): DecisionRequest;
150
+ /**
151
+ * Serialize to the wire JSON the Console (and future Gateway) consume. Keys are
152
+ * snake_case and mirror the Python SDK's `DecisionRequest.to_dict()` exactly, so the
153
+ * seam is one shared contract across both SDKs.
154
+ */
155
+ export declare function serializeDecisionRequest(dr: DecisionRequest): Record<string, unknown>;
156
+ //# sourceMappingURL=decision-request.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"decision-request.d.ts","sourceRoot":"","sources":["../src/decision-request.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAEH,+DAA+D;AAC/D,MAAM,MAAM,SAAS,GAAG,SAAS,GAAG,gBAAgB,GAAG,WAAW,GAAG,QAAQ,GAAG,WAAW,CAAC;AAE5F,yDAAyD;AACzD,eAAO,MAAM,WAAW,EAAE,WAAW,CAAC,SAAS,CAM7C,CAAC;AAEH,+DAA+D;AAC/D,MAAM,MAAM,iBAAiB,GAAG,QAAQ,GAAG,SAAS,GAAG,QAAQ,CAAC;AAEhE,+CAA+C;AAC/C,eAAO,MAAM,gBAAgB,uBAAuB,CAAC;AAErD,yEAAyE;AACzE,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAAC;IAC/B,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;CACxB;AAED,oEAAoE;AACpE,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,cAAc,CAQ1D;AAED,yEAAyE;AACzE,wBAAgB,cAAc,CAAC,MAAM,EAAE,cAAc,GAAG,MAAM,CAE7D;AAED;;;;GAIG;AACH,MAAM,WAAW,UAAU;IACzB,QAAQ,CAAC,IAAI,EAAE,YAAY,GAAG,UAAU,CAAC;IACzC,QAAQ,CAAC,GAAG,CAAC,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,YAAY,CAAC,EAAE,MAAM,CAAC;IAC/B,QAAQ,CAAC,MAAM,CA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,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CAC5B;AAED;;;GAGG;AACH,eAAO,MAAM,oBAAoB,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,CAMpE,CAAC;AAWF,gEAAgE;AAChE,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAO5D;AAmCD,MAAM,WAAW,qBAAqB;IACpC,4EAA4E;IAC5E,QAAQ,CAAC,EAAE,cAAc,GAAG,MAAM,CAAC;IACnC,6DAA6D;IAC7D,UAAU,CAAC,EAAE,UAAU,CAAC;IACxB,gFAAgF;IAChF,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED;;;;;GAKG;AACH,wBAAgB,cAAc,CAC5B,UAAU,EAAE,cAAc,EAC1B,OAAO,GAAE,qBAA0B,GAClC,eAAe,CAiDjB;AA4BD;;;;GAIG;AACH,wBAAgB,wBAAwB,CAAC,EAAE,EAAE,eAAe,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAiBrF"}
@@ -0,0 +1,243 @@
1
+ /**
2
+ * Decision Request — the gateway-proof HITL seam (COA-1278, Console spec §4).
3
+ *
4
+ * A Decision Request is the single object the Coalex Console renders and resolves,
5
+ * deliberately agnostic to *who* produced it. In v1 the producer is the SDK's
6
+ * `evaluate()` (an escalation); a future MCP Gateway will produce the *same* object from
7
+ * an intercepted `tools/call`. Nothing in the Console changes between the two.
8
+ *
9
+ * Per Console spec §4, a Decision Request carries four things:
10
+ * 1. Context payload — what the human needs to judge (§6 de-biasing: output shown as an
11
+ * editable answer; never the agent's reasoning, confidence, or risk score).
12
+ * 2. Question schema — the fields to answer, as an elicitation-style JSON Schema with
13
+ * `coalex.*` annotations (a metric type per field).
14
+ * 3. Resolver policy — `self` | `role:<name>` (per governed tool, config).
15
+ * 4. Resume hook — how the producer continues after resolution.
16
+ *
17
+ * It also carries an MCP task state (spec §5): `working` | `input_required` |
18
+ * `completed` | `failed` | `cancelled` — the shared backbone between Console and the
19
+ * future Gateway.
20
+ *
21
+ * This module mirrors `coalex/decision_request.py` in the Python SDK. It is additive: it
22
+ * defines the shared types + a `fromEscalation` mapper and does not rewire
23
+ * `evaluate()`/`resolve()`. `serializeDecisionRequest` emits the exact snake_case wire
24
+ * shape produced by the Python SDK's `DecisionRequest.to_dict()`.
25
+ */
26
+ /** All MCP task states, for validation / catalog use. */
27
+ export const TASK_STATES = new Set([
28
+ "working",
29
+ "input_required",
30
+ "completed",
31
+ "failed",
32
+ "cancelled",
33
+ ]);
34
+ /** v1 identity Question Composer (spec §6). */
35
+ export const DEFAULT_QUESTION = "Review this output";
36
+ /** Parse the `self` | `role:<name>` config string into a policy. */
37
+ export function parseResolver(spec) {
38
+ if (spec === "self")
39
+ return { kind: "self" };
40
+ if (spec.startsWith("role:")) {
41
+ const role = spec.slice("role:".length).trim();
42
+ if (!role)
43
+ throw new Error("role resolver requires a name, e.g. 'role:manager'");
44
+ return { kind: "role", role };
45
+ }
46
+ throw new Error(`resolver must be 'self' or 'role:<name>', got '${spec}'`);
47
+ }
48
+ /** Serialize a policy back to the `self` | `role:<name>` wire string. */
49
+ export function resolverToSpec(policy) {
50
+ return policy.kind === "role" ? `role:${policy.role}` : "self";
51
+ }
52
+ /**
53
+ * Escalation status -> MCP task state (spec §5). See `fromEscalation` for the full
54
+ * status -> (state, action) reconciliation.
55
+ */
56
+ export const TASK_STATE_BY_STATUS = {
57
+ pending: "input_required",
58
+ approved: "completed",
59
+ corrected: "completed",
60
+ rejected: "completed",
61
+ expired: "cancelled",
62
+ };
63
+ // pending has no action (awaiting the human); approved/corrected = accept (corrected
64
+ // carries content); rejected = decline (+ reason); expired = cancel.
65
+ const ACTION_BY_STATUS = {
66
+ approved: "accept",
67
+ corrected: "accept",
68
+ rejected: "decline",
69
+ expired: "cancel",
70
+ };
71
+ /** Map an escalation status to its MCP task state (spec §5). */
72
+ export function taskStateForStatus(status) {
73
+ const state = TASK_STATE_BY_STATUS[status];
74
+ if (!state) {
75
+ const known = Object.keys(TASK_STATE_BY_STATUS).sort().join(", ");
76
+ throw new Error(`unknown escalation status '${status}'; expected one of ${known}`);
77
+ }
78
+ return state;
79
+ }
80
+ function fieldForValue(value, metric) {
81
+ if (typeof value === "boolean") {
82
+ return { type: "boolean", "coalex.metric": metric ?? "exact_match" };
83
+ }
84
+ if (typeof value === "number") {
85
+ return { type: "number", "coalex.metric": metric ?? "exact_match" };
86
+ }
87
+ if (Array.isArray(value)) {
88
+ return { type: "array", items: { type: "string" }, "coalex.metric": metric ?? "f1" };
89
+ }
90
+ if (value !== null && typeof value === "object") {
91
+ return { type: "object", "coalex.metric": metric ?? "exact_match" };
92
+ }
93
+ return { type: "string", "coalex.metric": metric ?? "word_overlap" };
94
+ }
95
+ function questionSchemaFromOutput(output, metrics) {
96
+ const properties = {};
97
+ const required = [];
98
+ for (const [name, value] of Object.entries(output)) {
99
+ let declared;
100
+ const m = metrics?.[name];
101
+ if (Array.isArray(m) && m.length > 0)
102
+ declared = String(m[0]);
103
+ else if (typeof m === "string")
104
+ declared = m;
105
+ properties[name] = fieldForValue(value, declared);
106
+ required.push(name);
107
+ }
108
+ return { type: "object", properties, required };
109
+ }
110
+ /**
111
+ * Materialize an escalation as a Decision Request (spec §4, COA-1278). The task state
112
+ * and elicitation action follow spec §5's mapping. The escalation has no
113
+ * resolver/resume-hook of its own, so the producer supplies them here; `resolver`
114
+ * defaults to `self`. Throws on an unrecognized status.
115
+ */
116
+ export function fromEscalation(escalation, options = {}) {
117
+ const status = escalation.status ?? "pending";
118
+ const taskState = TASK_STATE_BY_STATUS[status];
119
+ if (!taskState) {
120
+ const known = Object.keys(TASK_STATE_BY_STATUS).sort().join(", ");
121
+ throw new Error(`unknown escalation status '${status}'; expected one of ${known}`);
122
+ }
123
+ const action = ACTION_BY_STATUS[status];
124
+ const output = escalation.output ?? {};
125
+ const questionSchema = questionSchemaFromOutput(output, escalation.metrics);
126
+ const context = {
127
+ question: options.question ?? DEFAULT_QUESTION,
128
+ output,
129
+ };
130
+ if (escalation.input)
131
+ context.input = escalation.input;
132
+ let resolver;
133
+ if (typeof options.resolver === "string")
134
+ resolver = parseResolver(options.resolver);
135
+ else
136
+ resolver = options.resolver ?? { kind: "self" };
137
+ let result;
138
+ if (action) {
139
+ result = { action };
140
+ if (escalation.corrections)
141
+ result.content = escalation.corrections;
142
+ if (escalation.resolution_reason)
143
+ result.reason = escalation.resolution_reason;
144
+ if (escalation.resolved_by)
145
+ result.reviewer = escalation.resolved_by;
146
+ if (escalation.reviewer_name)
147
+ result.reviewerName = escalation.reviewer_name;
148
+ if (escalation.reviewer_email)
149
+ result.reviewerEmail = escalation.reviewer_email;
150
+ if (escalation.resolved_at)
151
+ result.resolvedAt = escalation.resolved_at;
152
+ }
153
+ const dr = {
154
+ id: escalation.escalation_id ?? "",
155
+ taskState,
156
+ context,
157
+ questionSchema,
158
+ resolver,
159
+ };
160
+ if (escalation.account_id)
161
+ dr.accountId = escalation.account_id;
162
+ if (escalation.agent_id)
163
+ dr.agentId = escalation.agent_id;
164
+ if (escalation.agent_name)
165
+ dr.agentName = escalation.agent_name;
166
+ if (escalation.request_id)
167
+ dr.requestId = escalation.request_id;
168
+ if (options.resumeHook)
169
+ dr.resumeHook = options.resumeHook;
170
+ if (result)
171
+ dr.result = result;
172
+ if (escalation.created_at)
173
+ dr.createdAt = escalation.created_at;
174
+ if (escalation.updated_at)
175
+ dr.updatedAt = escalation.updated_at;
176
+ return dr;
177
+ }
178
+ function serializeResumeHook(hook) {
179
+ const out = { kind: hook.kind };
180
+ if (hook.url !== undefined)
181
+ out.url = hook.url;
182
+ if (hook.checkpointId !== undefined)
183
+ out.checkpoint_id = hook.checkpointId;
184
+ if (hook.taskId !== undefined)
185
+ out.task_id = hook.taskId;
186
+ return out;
187
+ }
188
+ function serializeContext(context) {
189
+ const out = { question: context.question, output: context.output };
190
+ if (context.input !== undefined)
191
+ out.input = context.input;
192
+ if (context.summary !== undefined)
193
+ out.summary = context.summary;
194
+ return out;
195
+ }
196
+ function serializeResult(result) {
197
+ const out = { action: result.action };
198
+ if (result.content !== undefined)
199
+ out.content = result.content;
200
+ if (result.reason !== undefined)
201
+ out.reason = result.reason;
202
+ if (result.reviewer !== undefined)
203
+ out.reviewer = result.reviewer;
204
+ if (result.reviewerName !== undefined)
205
+ out.reviewer_name = result.reviewerName;
206
+ if (result.reviewerEmail !== undefined)
207
+ out.reviewer_email = result.reviewerEmail;
208
+ if (result.resolvedAt !== undefined)
209
+ out.resolved_at = result.resolvedAt;
210
+ return out;
211
+ }
212
+ /**
213
+ * Serialize to the wire JSON the Console (and future Gateway) consume. Keys are
214
+ * snake_case and mirror the Python SDK's `DecisionRequest.to_dict()` exactly, so the
215
+ * seam is one shared contract across both SDKs.
216
+ */
217
+ export function serializeDecisionRequest(dr) {
218
+ const out = {
219
+ id: dr.id,
220
+ task_state: dr.taskState,
221
+ context: serializeContext(dr.context),
222
+ question_schema: dr.questionSchema,
223
+ resolver: resolverToSpec(dr.resolver),
224
+ };
225
+ if (dr.accountId !== undefined)
226
+ out.account_id = dr.accountId;
227
+ if (dr.agentId !== undefined)
228
+ out.agent_id = dr.agentId;
229
+ if (dr.agentName !== undefined)
230
+ out.agent_name = dr.agentName;
231
+ if (dr.requestId !== undefined)
232
+ out.request_id = dr.requestId;
233
+ if (dr.resumeHook !== undefined)
234
+ out.resume_hook = serializeResumeHook(dr.resumeHook);
235
+ if (dr.result !== undefined)
236
+ out.result = serializeResult(dr.result);
237
+ if (dr.createdAt !== undefined)
238
+ out.created_at = dr.createdAt;
239
+ if (dr.updatedAt !== undefined)
240
+ out.updated_at = dr.updatedAt;
241
+ return out;
242
+ }
243
+ //# sourceMappingURL=decision-request.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"decision-request.js","sourceRoot":"","sources":["../src/decision-request.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAKH,yDAAyD;AACzD,MAAM,CAAC,MAAM,W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AE,CAAC,OAAO,CAAC;QACrC,eAAe,EAAE,EAAE,CAAC,cAAc;QAClC,QAAQ,EAAE,cAAc,CAAC,EAAE,CAAC,QAAQ,CAAC;KACtC,CAAC;IACF,IAAI,EAAE,CAAC,SAAS,KAAK,SAAS;QAAE,GAAG,CAAC,UAAU,GAAG,EAAE,CAAC,SAAS,CAAC;IAC9D,IAAI,EAAE,CAAC,OAAO,KAAK,SAAS;QAAE,GAAG,CAAC,QAAQ,GAAG,EAAE,CAAC,OAAO,CAAC;IACxD,IAAI,EAAE,CAAC,SAAS,KAAK,SAAS;QAAE,GAAG,CAAC,UAAU,GAAG,EAAE,CAAC,SAAS,CAAC;IAC9D,IAAI,EAAE,CAAC,SAAS,KAAK,SAAS;QAAE,GAAG,CAAC,UAAU,GAAG,EAAE,CAAC,SAAS,CAAC;IAC9D,IAAI,EAAE,CAAC,UAAU,KAAK,SAAS;QAAE,GAAG,CAAC,WAAW,GAAG,mBAAmB,CAAC,EAAE,CAAC,UAAU,CAAC,CAAC;IACtF,IAAI,EAAE,CAAC,MAAM,KAAK,SAAS;QAAE,GAAG,CAAC,MAAM,GAAG,eAAe,CAAC,EAAE,CAAC,MAAM,CAAC,CAAC;IACrE,IAAI,EAAE,CAAC,SAAS,KAAK,SAAS;QAAE,GAAG,CAAC,UAAU,GAAG,EAAE,CAAC,SAAS,CAAC;IAC9D,IAAI,EAAE,CAAC,SAAS,KAAK,SAAS;QAAE,GAAG,CAAC,UAAU,GAAG,EAAE,CAAC,SAAS,CAAC;IAC9D,OAAO,GAAG,CAAC;AACb,CAAC"}
package/dist/index.d.ts CHANGED
@@ -6,6 +6,8 @@ export { evaluate, KNOWN_METRICS } from "./evaluate.js";
6
6
  export type { EvaluateOptions, EvaluationDecision } from "./evaluate.js";
7
7
  export { resolve, VALID_DECISIONS } from "./resolve.js";
8
8
  export type { ResolveOptions, ResolutionResult, MetricResult } from "./resolve.js";
9
+ export { fromEscalation, serializeDecisionRequest, parseResolver, resolverToSpec, taskStateForStatus, TASK_STATES, TASK_STATE_BY_STATUS, DEFAULT_QUESTION, } from "./decision-request.js";
10
+ export type { DecisionRequest, TaskState, ElicitationAction, ElicitationResult, ContextPayload, QuestionSchema, QuestionField, ResolverPolicy, ResumeHook, EscalationLike, FromEscalationOptions, } from "./decision-request.js";
9
11
  export { getPrompt } from "./prompts.js";
10
12
  export type { GetPromptOptions, PromptVersion } from "./prompts.js";
11
13
  export { declareAgent } from "./agents.js";
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAKhD,YAAY,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAChD,OAAO,EAAE,aAAa,EAAE,iBAAiB,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAChF,YAAY,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAC;AACzD,OAAO,EAAE,QAAQ,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AACxD,YAAY,EAAE,eAAe,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AACzE,OAAO,EAAE,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AACxD,YAAY,EAAE,cAAc,EAAE,gBAAgB,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AACnF,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACzC,YAAY,EAAE,gBAAgB,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AACpE,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAC3C,YAAY,EAAE,gBAAgB,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AACzE,OAAO,EAAE,cAAc,EAAE,mBAAmB,EAAE,gBAAgB,EAAE,mBAAmB,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AACvI,YAAY,EAAE,qBAAqB,EAAE,qBAAqB,EAAE,M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,EACb,cAAc,EACd,UAAU,EACV,cAAc,EACd,qBAAqB,GACtB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACzC,YAAY,EAAE,gBAAgB,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AACpE,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAC3C,YAAY,EAAE,gBAAgB,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AACzE,OAAO,EAAE,cAAc,EAAE,mBAAmB,EAAE,gBAAgB,EAAE,mBAAmB,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AACvI,YAAY,EAAE,qBAAqB,EAAE,qBAAqB,EAAE,MAAM,sBAAsB,CAAC;AAKzF,wBAAgB,SAAS,IAAI,YAAY,CAKxC;AAED,wBAAgB,SAAS,IAAI,MAAM,CAKlC;AAED,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,oBAAoB,CAAC,EAAE,OAAO,CAAC;CAChC;AAED,wBAAgB,QAAQ,CAAC,OAAO,CAAC,EAAE,eAAe,GAAG,IAAI,CA0BxD;AAED,0CAA0C;AAC1C,wBAAgB,gBAAgB,IAAI,IAAI,CAGvC"}
package/dist/index.js CHANGED
@@ -9,6 +9,7 @@ import { CoalexAttributePropagator } from "./span-processor.js";
9
9
  export { coalexContext, coalexContextSync, currentAgentId } from "./context.js";
10
10
  export { evaluate, KNOWN_METRICS } from "./evaluate.js";
11
11
  export { resolve, VALID_DECISIONS } from "./resolve.js";
12
+ export { fromEscalation, serializeDecisionRequest, parseResolver, resolverToSpec, taskStateForStatus, TASK_STATES, TASK_STATE_BY_STATUS, DEFAULT_QUESTION, } from "./decision-request.js";
12
13
  export { getPrompt } from "./prompts.js";
13
14
  export { declareAgent } from "./agents.js";
14
15
  export { autoInstrument, autoInstrumentAsync, instrumentOpenAI, instrumentLangChain, instrumentAnthropic } from "./auto-instrument.js";
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AACpD,OAAO,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAC;AACnE,OAAO,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAC;AACnE,OAAO,EAAE,iBAAiB,EAAE,MAAM,yCAAyC,CAAC;AAC5E,OAAO,EAAE,iBAAiB,EAAE,MAAM,qCAAqC,CAAC;AAGxE,OAAO,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AAC1D,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAChE,OAAO,EAAE,yBAAyB,EAAE,MAAM,qBAAqB,CAAC;AAGhE,OAAO,EAAE,aAAa,EAAE,iBAAiB,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAEhF,OAAO,EAAE,QAAQ,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAExD,OAAO,EAAE,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAExD,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAEzC,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAE3C,OAAO,EAAE,cAAc,EAAE,mBAAmB,EAAE,gBAAgB,EAAE,mBAAmB,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AAGvI,IAAI,OAAO,GAAwB,IAAI,CAAC;AACxC,IAAI,OAAO,GAAkB,IAAI,CAAC;AAElC,MAAM,UAAU,SAAS;IACvB,IAAI,CAAC,OAAO,EAAE,CAAC;QACb,MAAM,IAAI,KAAK,CAAC,uDAAuD,CAAC,CAAC;IAC3E,CAAC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,MAAM,aAAa,GAAG,gBAAgB;QACpC,CAAC,CAAC,IAAI,qBAAqB,CAAC,YAAY,CAAC;QACzC,CAAC,CAAC,YAAY,CAAC;IAEjB,MAAM,QAAQ,GAAG,IAAI,kBAAkB,CAAC,EAAE,QAAQ,EAAE,CAAC,CAAC;IACtD,QAAQ,CAAC,gBAAgB,CAAC,IAAI,yBAAyB,EAAE,CAAC,CAAC;IAC3D,QAAQ,CAAC,gBAAgB,CAAC,IAAI,kBAAkB,CAAC,aAAa,CAAC,CAAC,CAAC;IACjE,QAAQ,CAAC,QAAQ,EAAE,CAAC;AACtB,CAAC;AAED,0CAA0C;AAC1C,MAAM,UAAU,gBAAgB;IAC9B,OAAO,GAAG,IAAI,CAAC;IACf,OAAO,GAAG,IAAI,CAAC;AACjB,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@coalex-ai/sdk",
3
- "version": "1.14.0-beta.71",
3
+ "version": "1.14.0-beta.92",
4
4
  "description": "Coalex TypeScript SDK for AI governance observability",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {