@coalex-ai/sdk 1.14.0 → 1.15.0-beta.148
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/decision-request.d.ts +165 -0
- package/dist/decision-request.d.ts.map +1 -0
- package/dist/decision-request.js +262 -0
- package/dist/decision-request.js.map +1 -0
- package/dist/evaluate.d.ts +7 -0
- package/dist/evaluate.d.ts.map +1 -1
- package/dist/evaluate.js +4 -0
- package/dist/evaluate.js.map +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/resolve.d.ts +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,165 @@
|
|
|
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
|
+
* Rebuild a ResumeHook from its `serializeResumeHook` wire shape (spec §4.4) — the inverse
|
|
45
|
+
* used when a persisted escalation carries a stored hook (`escalations.resume_hook`,
|
|
46
|
+
* COA-1761). An unrecognized `kind` falls back to `checkpoint` so a forward Gateway value
|
|
47
|
+
* can never break the read path. Mirrors the Python SDK's `ResumeHook.from_dict`.
|
|
48
|
+
*/
|
|
49
|
+
export declare function resumeHookFromDict(data: Record<string, unknown>): ResumeHook;
|
|
50
|
+
/**
|
|
51
|
+
* How the producer resumes after resolution (spec §4.4). v1 (SDK path): the LangGraph
|
|
52
|
+
* checkpoint-resume callback promoted to a first-class field. Future (Gateway path):
|
|
53
|
+
* completing/failing the held MCP `taskId`.
|
|
54
|
+
*/
|
|
55
|
+
export interface ResumeHook {
|
|
56
|
+
readonly kind: "checkpoint" | "mcp_task";
|
|
57
|
+
readonly url?: string;
|
|
58
|
+
readonly checkpointId?: string;
|
|
59
|
+
readonly taskId?: string;
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* One field of the elicitation-style question schema (spec §4.2, §6): a JSON Schema
|
|
63
|
+
* property extended with the namespaced `coalex.metric` annotation.
|
|
64
|
+
*/
|
|
65
|
+
export interface QuestionField {
|
|
66
|
+
type: string;
|
|
67
|
+
title?: string;
|
|
68
|
+
description?: string;
|
|
69
|
+
items?: Record<string, unknown>;
|
|
70
|
+
enum?: unknown[];
|
|
71
|
+
"coalex.metric"?: string;
|
|
72
|
+
}
|
|
73
|
+
/** The elicitation-style question schema (spec §4.2): a flat JSON Schema object. */
|
|
74
|
+
export interface QuestionSchema {
|
|
75
|
+
type: "object";
|
|
76
|
+
properties: Record<string, QuestionField>;
|
|
77
|
+
required: string[];
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* What the human needs to judge (spec §4.1, §6 de-biasing). Deliberately excludes the
|
|
81
|
+
* agent's reasoning, confidence, and risk score; `output` is shown as an editable answer.
|
|
82
|
+
*/
|
|
83
|
+
export interface ContextPayload {
|
|
84
|
+
question: string;
|
|
85
|
+
output: Record<string, unknown>;
|
|
86
|
+
input?: Record<string, unknown>;
|
|
87
|
+
summary?: string;
|
|
88
|
+
}
|
|
89
|
+
/** The resolution of a task (spec §5, §7.2) — action plus the DORA who-did-what trail. */
|
|
90
|
+
export interface ElicitationResult {
|
|
91
|
+
action: ElicitationAction;
|
|
92
|
+
content?: Record<string, unknown>;
|
|
93
|
+
reason?: string;
|
|
94
|
+
reviewer?: string;
|
|
95
|
+
reviewerName?: string;
|
|
96
|
+
reviewerEmail?: string;
|
|
97
|
+
resolvedAt?: string;
|
|
98
|
+
}
|
|
99
|
+
/** The gateway-proof HITL seam (spec §4). */
|
|
100
|
+
export interface DecisionRequest {
|
|
101
|
+
id: string;
|
|
102
|
+
taskState: TaskState;
|
|
103
|
+
context: ContextPayload;
|
|
104
|
+
questionSchema: QuestionSchema;
|
|
105
|
+
resolver: ResolverPolicy;
|
|
106
|
+
accountId?: string;
|
|
107
|
+
agentId?: string;
|
|
108
|
+
agentName?: string;
|
|
109
|
+
requestId?: string;
|
|
110
|
+
resumeHook?: ResumeHook;
|
|
111
|
+
result?: ElicitationResult;
|
|
112
|
+
createdAt?: string;
|
|
113
|
+
updatedAt?: string;
|
|
114
|
+
}
|
|
115
|
+
/** The escalation as returned by the transformer API (snake_case JSON). */
|
|
116
|
+
export interface EscalationLike {
|
|
117
|
+
escalation_id?: string;
|
|
118
|
+
account_id?: string;
|
|
119
|
+
agent_id?: string | null;
|
|
120
|
+
agent_name?: string | null;
|
|
121
|
+
request_id?: string | null;
|
|
122
|
+
input?: Record<string, unknown> | null;
|
|
123
|
+
output?: Record<string, unknown> | null;
|
|
124
|
+
metrics?: Record<string, unknown> | null;
|
|
125
|
+
status?: string;
|
|
126
|
+
resolved_by?: string | null;
|
|
127
|
+
reviewer_name?: string | null;
|
|
128
|
+
reviewer_email?: string | null;
|
|
129
|
+
resolved_at?: string | null;
|
|
130
|
+
resolution_reason?: string | null;
|
|
131
|
+
corrections?: Record<string, unknown> | null;
|
|
132
|
+
resume_hook?: Record<string, unknown> | null;
|
|
133
|
+
created_at?: string | null;
|
|
134
|
+
updated_at?: string | null;
|
|
135
|
+
}
|
|
136
|
+
/**
|
|
137
|
+
* Escalation status -> MCP task state (spec §5). See `fromEscalation` for the full
|
|
138
|
+
* status -> (state, action) reconciliation.
|
|
139
|
+
*/
|
|
140
|
+
export declare const TASK_STATE_BY_STATUS: Readonly<Record<string, TaskState>>;
|
|
141
|
+
/** Map an escalation status to its MCP task state (spec §5). */
|
|
142
|
+
export declare function taskStateForStatus(status: string): TaskState;
|
|
143
|
+
export interface FromEscalationOptions {
|
|
144
|
+
/** Resolver policy or its `self` | `role:<name>` string. Default `self`. */
|
|
145
|
+
resolver?: ResolverPolicy | string;
|
|
146
|
+
/** How the producer resumes after resolution (spec §4.4). */
|
|
147
|
+
resumeHook?: ResumeHook;
|
|
148
|
+
/** The composed question shown on the card. Default: identity composer (§6). */
|
|
149
|
+
question?: string;
|
|
150
|
+
}
|
|
151
|
+
/**
|
|
152
|
+
* Materialize an escalation as a Decision Request (spec §4, COA-1278). The task state
|
|
153
|
+
* and elicitation action follow spec §5's mapping. The escalation has no
|
|
154
|
+
* resolver/resume-hook of its own, so the producer supplies them here; `resolver`
|
|
155
|
+
* defaults to `self`. Throws on an unrecognized status.
|
|
156
|
+
*/
|
|
157
|
+
export declare function fromEscalation(escalation: EscalationLike, options?: FromEscalationOptions): DecisionRequest;
|
|
158
|
+
export declare function serializeResumeHook(hook: ResumeHook): Record<string, unknown>;
|
|
159
|
+
/**
|
|
160
|
+
* Serialize to the wire JSON the Console (and future Gateway) consume. Keys are
|
|
161
|
+
* snake_case and mirror the Python SDK's `DecisionRequest.to_dict()` exactly, so the
|
|
162
|
+
* seam is one shared contract across both SDKs.
|
|
163
|
+
*/
|
|
164
|
+
export declare function serializeDecisionRequest(dr: DecisionRequest): Record<string, unknown>;
|
|
165
|
+
//# 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,CAA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AU,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,CAoDjB;AAED,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,UAAU,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAM7E;AAoBD;;;;GAIG;AACH,wBAAgB,wBAAwB,CAAC,EAAE,EAAE,eAAe,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAiBrF"}
|
|
@@ -0,0 +1,262 @@
|
|
|
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
|
+
* Rebuild a ResumeHook from its `serializeResumeHook` wire shape (spec §4.4) — the inverse
|
|
54
|
+
* used when a persisted escalation carries a stored hook (`escalations.resume_hook`,
|
|
55
|
+
* COA-1761). An unrecognized `kind` falls back to `checkpoint` so a forward Gateway value
|
|
56
|
+
* can never break the read path. Mirrors the Python SDK's `ResumeHook.from_dict`.
|
|
57
|
+
*/
|
|
58
|
+
export function resumeHookFromDict(data) {
|
|
59
|
+
const kind = data.kind === "mcp_task" ? "mcp_task" : "checkpoint";
|
|
60
|
+
return {
|
|
61
|
+
kind,
|
|
62
|
+
...(typeof data.url === "string" ? { url: data.url } : {}),
|
|
63
|
+
...(typeof data.checkpoint_id === "string" ? { checkpointId: data.checkpoint_id } : {}),
|
|
64
|
+
...(typeof data.task_id === "string" ? { taskId: data.task_id } : {}),
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Escalation status -> MCP task state (spec §5). See `fromEscalation` for the full
|
|
69
|
+
* status -> (state, action) reconciliation.
|
|
70
|
+
*/
|
|
71
|
+
export const TASK_STATE_BY_STATUS = {
|
|
72
|
+
pending: "input_required",
|
|
73
|
+
approved: "completed",
|
|
74
|
+
corrected: "completed",
|
|
75
|
+
rejected: "completed",
|
|
76
|
+
expired: "cancelled",
|
|
77
|
+
};
|
|
78
|
+
// pending has no action (awaiting the human); approved/corrected = accept (corrected
|
|
79
|
+
// carries content); rejected = decline (+ reason); expired = cancel.
|
|
80
|
+
const ACTION_BY_STATUS = {
|
|
81
|
+
approved: "accept",
|
|
82
|
+
corrected: "accept",
|
|
83
|
+
rejected: "decline",
|
|
84
|
+
expired: "cancel",
|
|
85
|
+
};
|
|
86
|
+
/** Map an escalation status to its MCP task state (spec §5). */
|
|
87
|
+
export function taskStateForStatus(status) {
|
|
88
|
+
const state = TASK_STATE_BY_STATUS[status];
|
|
89
|
+
if (!state) {
|
|
90
|
+
const known = Object.keys(TASK_STATE_BY_STATUS).sort().join(", ");
|
|
91
|
+
throw new Error(`unknown escalation status '${status}'; expected one of ${known}`);
|
|
92
|
+
}
|
|
93
|
+
return state;
|
|
94
|
+
}
|
|
95
|
+
function fieldForValue(value, metric) {
|
|
96
|
+
if (typeof value === "boolean") {
|
|
97
|
+
return { type: "boolean", "coalex.metric": metric ?? "exact_match" };
|
|
98
|
+
}
|
|
99
|
+
if (typeof value === "number") {
|
|
100
|
+
return { type: "number", "coalex.metric": metric ?? "exact_match" };
|
|
101
|
+
}
|
|
102
|
+
if (Array.isArray(value)) {
|
|
103
|
+
return { type: "array", items: { type: "string" }, "coalex.metric": metric ?? "f1" };
|
|
104
|
+
}
|
|
105
|
+
if (value !== null && typeof value === "object") {
|
|
106
|
+
return { type: "object", "coalex.metric": metric ?? "exact_match" };
|
|
107
|
+
}
|
|
108
|
+
return { type: "string", "coalex.metric": metric ?? "word_overlap" };
|
|
109
|
+
}
|
|
110
|
+
function questionSchemaFromOutput(output, metrics) {
|
|
111
|
+
const properties = {};
|
|
112
|
+
const required = [];
|
|
113
|
+
for (const [name, value] of Object.entries(output)) {
|
|
114
|
+
let declared;
|
|
115
|
+
const m = metrics?.[name];
|
|
116
|
+
if (Array.isArray(m) && m.length > 0)
|
|
117
|
+
declared = String(m[0]);
|
|
118
|
+
else if (typeof m === "string")
|
|
119
|
+
declared = m;
|
|
120
|
+
properties[name] = fieldForValue(value, declared);
|
|
121
|
+
required.push(name);
|
|
122
|
+
}
|
|
123
|
+
return { type: "object", properties, required };
|
|
124
|
+
}
|
|
125
|
+
/**
|
|
126
|
+
* Materialize an escalation as a Decision Request (spec §4, COA-1278). The task state
|
|
127
|
+
* and elicitation action follow spec §5's mapping. The escalation has no
|
|
128
|
+
* resolver/resume-hook of its own, so the producer supplies them here; `resolver`
|
|
129
|
+
* defaults to `self`. Throws on an unrecognized status.
|
|
130
|
+
*/
|
|
131
|
+
export function fromEscalation(escalation, options = {}) {
|
|
132
|
+
const status = escalation.status ?? "pending";
|
|
133
|
+
const taskState = TASK_STATE_BY_STATUS[status];
|
|
134
|
+
if (!taskState) {
|
|
135
|
+
const known = Object.keys(TASK_STATE_BY_STATUS).sort().join(", ");
|
|
136
|
+
throw new Error(`unknown escalation status '${status}'; expected one of ${known}`);
|
|
137
|
+
}
|
|
138
|
+
const action = ACTION_BY_STATUS[status];
|
|
139
|
+
const output = escalation.output ?? {};
|
|
140
|
+
const questionSchema = questionSchemaFromOutput(output, escalation.metrics);
|
|
141
|
+
const context = {
|
|
142
|
+
question: options.question ?? DEFAULT_QUESTION,
|
|
143
|
+
output,
|
|
144
|
+
};
|
|
145
|
+
if (escalation.input)
|
|
146
|
+
context.input = escalation.input;
|
|
147
|
+
let resolver;
|
|
148
|
+
if (typeof options.resolver === "string")
|
|
149
|
+
resolver = parseResolver(options.resolver);
|
|
150
|
+
else
|
|
151
|
+
resolver = options.resolver ?? { kind: "self" };
|
|
152
|
+
let result;
|
|
153
|
+
if (action) {
|
|
154
|
+
result = { action };
|
|
155
|
+
if (escalation.corrections)
|
|
156
|
+
result.content = escalation.corrections;
|
|
157
|
+
if (escalation.resolution_reason)
|
|
158
|
+
result.reason = escalation.resolution_reason;
|
|
159
|
+
if (escalation.resolved_by)
|
|
160
|
+
result.reviewer = escalation.resolved_by;
|
|
161
|
+
if (escalation.reviewer_name)
|
|
162
|
+
result.reviewerName = escalation.reviewer_name;
|
|
163
|
+
if (escalation.reviewer_email)
|
|
164
|
+
result.reviewerEmail = escalation.reviewer_email;
|
|
165
|
+
if (escalation.resolved_at)
|
|
166
|
+
result.resolvedAt = escalation.resolved_at;
|
|
167
|
+
}
|
|
168
|
+
const dr = {
|
|
169
|
+
id: escalation.escalation_id ?? "",
|
|
170
|
+
taskState,
|
|
171
|
+
context,
|
|
172
|
+
questionSchema,
|
|
173
|
+
resolver,
|
|
174
|
+
};
|
|
175
|
+
if (escalation.account_id)
|
|
176
|
+
dr.accountId = escalation.account_id;
|
|
177
|
+
if (escalation.agent_id)
|
|
178
|
+
dr.agentId = escalation.agent_id;
|
|
179
|
+
if (escalation.agent_name)
|
|
180
|
+
dr.agentName = escalation.agent_name;
|
|
181
|
+
if (escalation.request_id)
|
|
182
|
+
dr.requestId = escalation.request_id;
|
|
183
|
+
// The producer may pass the hook explicitly; otherwise adopt the one persisted on the
|
|
184
|
+
// escalation at evaluate() (COA-1761), so the Decision Request API returns it verbatim.
|
|
185
|
+
if (options.resumeHook)
|
|
186
|
+
dr.resumeHook = options.resumeHook;
|
|
187
|
+
else if (escalation.resume_hook)
|
|
188
|
+
dr.resumeHook = resumeHookFromDict(escalation.resume_hook);
|
|
189
|
+
if (result)
|
|
190
|
+
dr.result = result;
|
|
191
|
+
if (escalation.created_at)
|
|
192
|
+
dr.createdAt = escalation.created_at;
|
|
193
|
+
if (escalation.updated_at)
|
|
194
|
+
dr.updatedAt = escalation.updated_at;
|
|
195
|
+
return dr;
|
|
196
|
+
}
|
|
197
|
+
export function serializeResumeHook(hook) {
|
|
198
|
+
const out = { kind: hook.kind };
|
|
199
|
+
if (hook.url !== undefined)
|
|
200
|
+
out.url = hook.url;
|
|
201
|
+
if (hook.checkpointId !== undefined)
|
|
202
|
+
out.checkpoint_id = hook.checkpointId;
|
|
203
|
+
if (hook.taskId !== undefined)
|
|
204
|
+
out.task_id = hook.taskId;
|
|
205
|
+
return out;
|
|
206
|
+
}
|
|
207
|
+
function serializeContext(context) {
|
|
208
|
+
const out = { question: context.question, output: context.output };
|
|
209
|
+
if (context.input !== undefined)
|
|
210
|
+
out.input = context.input;
|
|
211
|
+
if (context.summary !== undefined)
|
|
212
|
+
out.summary = context.summary;
|
|
213
|
+
return out;
|
|
214
|
+
}
|
|
215
|
+
function serializeResult(result) {
|
|
216
|
+
const out = { action: result.action };
|
|
217
|
+
if (result.content !== undefined)
|
|
218
|
+
out.content = result.content;
|
|
219
|
+
if (result.reason !== undefined)
|
|
220
|
+
out.reason = result.reason;
|
|
221
|
+
if (result.reviewer !== undefined)
|
|
222
|
+
out.reviewer = result.reviewer;
|
|
223
|
+
if (result.reviewerName !== undefined)
|
|
224
|
+
out.reviewer_name = result.reviewerName;
|
|
225
|
+
if (result.reviewerEmail !== undefined)
|
|
226
|
+
out.reviewer_email = result.reviewerEmail;
|
|
227
|
+
if (result.resolvedAt !== undefined)
|
|
228
|
+
out.resolved_at = result.resolvedAt;
|
|
229
|
+
return out;
|
|
230
|
+
}
|
|
231
|
+
/**
|
|
232
|
+
* Serialize to the wire JSON the Console (and future Gateway) consume. Keys are
|
|
233
|
+
* snake_case and mirror the Python SDK's `DecisionRequest.to_dict()` exactly, so the
|
|
234
|
+
* seam is one shared contract across both SDKs.
|
|
235
|
+
*/
|
|
236
|
+
export function serializeDecisionRequest(dr) {
|
|
237
|
+
const out = {
|
|
238
|
+
id: dr.id,
|
|
239
|
+
task_state: dr.taskState,
|
|
240
|
+
context: serializeContext(dr.context),
|
|
241
|
+
question_schema: dr.questionSchema,
|
|
242
|
+
resolver: resolverToSpec(dr.resolver),
|
|
243
|
+
};
|
|
244
|
+
if (dr.accountId !== undefined)
|
|
245
|
+
out.account_id = dr.accountId;
|
|
246
|
+
if (dr.agentId !== undefined)
|
|
247
|
+
out.agent_id = dr.agentId;
|
|
248
|
+
if (dr.agentName !== undefined)
|
|
249
|
+
out.agent_name = dr.agentName;
|
|
250
|
+
if (dr.requestId !== undefined)
|
|
251
|
+
out.request_id = dr.requestId;
|
|
252
|
+
if (dr.resumeHook !== undefined)
|
|
253
|
+
out.resume_hook = serializeResumeHook(dr.resumeHook);
|
|
254
|
+
if (dr.result !== undefined)
|
|
255
|
+
out.result = serializeResult(dr.result);
|
|
256
|
+
if (dr.createdAt !== undefined)
|
|
257
|
+
out.created_at = dr.createdAt;
|
|
258
|
+
if (dr.updatedAt !== undefined)
|
|
259
|
+
out.updated_at = dr.updatedAt;
|
|
260
|
+
return out;
|
|
261
|
+
}
|
|
262
|
+
//# 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,WAAW,GAA2B,IAAI,GAAG,CAAC;IACzD,SAAS;IACT,gBAAgB;IAChB,WAAW;IACX,QAAQ;IACR,WAAW;CACZ,CAAC,CAAC;AAKH,+CAA+C;AAC/C,MAAM,CAAC,MAAM,gBAAgB,GAAG,oBAAoB,CAAC;AAQrD,oEAAoE;AACpE,MAAM,UAAU,aAAa,CA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AAK,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/evaluate.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { type ResumeHook } from "./decision-request.js";
|
|
1
2
|
export declare const KNOWN_METRICS: Set<string>;
|
|
2
3
|
export interface EvaluationDecision {
|
|
3
4
|
readonly status: "auto_approved" | "escalated" | "rejected";
|
|
@@ -17,6 +18,12 @@ export interface EvaluateOptions {
|
|
|
17
18
|
* so mid-run escalations get the right agent even before the trace ingests (COA-1076).
|
|
18
19
|
*/
|
|
19
20
|
agentId?: string;
|
|
21
|
+
/**
|
|
22
|
+
* How the producer resumes after resolution (Decision Request §4.4, COA-1765). When given,
|
|
23
|
+
* the agent's checkpoint/task hook is persisted on the resulting escalation so the Console
|
|
24
|
+
* (and the COA-1279 resolve trigger) can continue the run. Omitted → no hook sent.
|
|
25
|
+
*/
|
|
26
|
+
resumeHook?: ResumeHook;
|
|
20
27
|
}
|
|
21
28
|
export declare function evaluate(options: EvaluateOptions): Promise<EvaluationDecision>;
|
|
22
29
|
//# sourceMappingURL=evaluate.d.ts.map
|
package/dist/evaluate.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"evaluate.d.ts","sourceRoot":"","sources":["../src/evaluate.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"evaluate.d.ts","sourceRoot":"","sources":["../src/evaluate.ts"],"names":[],"mappings":"AAEA,OAAO,EAAuB,KAAK,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAG7E,eAAO,MAAM,aAAa,aASxB,CAAC;AAEH,MAAM,WAAW,kBAAkB;IACjC,QAAQ,CAAC,MAAM,EAAE,eAAe,GAAG,WAAW,GAAG,UAAU,CAAC;IAC5D,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,YAAY,CAAC,EAAE,MAAM,CAAC;CAChC;AAED,MAAM,WAAW,eAAe;IAC9B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,wCAAwC;IACxC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC/B,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAChC,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC;IACnC,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACnC;;;OAGG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB;;;;OAIG;IACH,UAAU,CAAC,EAAE,UAAU,CAAC;CACzB;AAED,wBAAsB,QAAQ,CAAC,OAAO,EAAE,eAAe,GAAG,OAAO,CAAC,kBAAkB,CAAC,CAmEpF"}
|
package/dist/evaluate.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { getConfig, getApiKey } from "./index.js";
|
|
2
2
|
import { currentAgentId } from "./context.js";
|
|
3
|
+
import { serializeResumeHook } from "./decision-request.js";
|
|
3
4
|
import { VERSION } from "./version.js";
|
|
4
5
|
export const KNOWN_METRICS = new Set([
|
|
5
6
|
"f1",
|
|
@@ -44,6 +45,9 @@ export async function evaluate(options) {
|
|
|
44
45
|
if (options.metadata) {
|
|
45
46
|
payload.metadata = options.metadata;
|
|
46
47
|
}
|
|
48
|
+
if (options.resumeHook) {
|
|
49
|
+
payload.resume_hook = serializeResumeHook(options.resumeHook);
|
|
50
|
+
}
|
|
47
51
|
const resp = await fetch(`${config.endpoint}/api/v1/evaluate`, {
|
|
48
52
|
method: "POST",
|
|
49
53
|
headers: {
|
package/dist/evaluate.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"evaluate.js","sourceRoot":"","sources":["../src/evaluate.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAClD,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAEvC,MAAM,CAAC,MAAM,aAAa,GAAG,IAAI,GAAG,CAAC;IACnC,IAAI;IACJ,cAAc;IACd,MAAM;IACN,SAAS;IACT,qBAAqB;IACrB,aAAa;IACb,aAAa;IACb,UAAU;CACX,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"evaluate.js","sourceRoot":"","sources":["../src/evaluate.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAClD,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,EAAE,mBAAmB,EAAmB,MAAM,uBAAuB,CAAC;AAC7E,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAEvC,MAAM,CAAC,MAAM,aAAa,GAAG,IAAI,GAAG,CAAC;IACnC,IAAI;IACJ,cAAc;IACd,MAAM;IACN,SAAS;IACT,qBAAqB;IACrB,aAAa;IACb,aAAa;IACb,UAAU;CACX,CAAC,CAAC;AA6BH,MAAM,CAAC,KAAK,UAAU,QAAQ,CAAC,OAAwB;IACrD,MAAM,MAAM,GAAG,SAAS,EAAE,CAAC;IAC3B,MAAM,MAAM,GAAG,SAAS,EAAE,CAAC;IAE3B,IAAI,OAAO,CAAC,OAAO,EAAE,CAAC;QACpB,KAAK,MAAM,CAAC,KAAK,EAAE,UAAU,CAAC,IAAI,MAAM,CAAC,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AC,OAAO,CAAC,UAAU,CAAC,CAAC;IAChE,CAAC;IAED,MAAM,IAAI,GAAG,MAAM,KAAK,CAAC,GAAG,MAAM,CAAC,QAAQ,kBAAkB,EAAE;QAC7D,MAAM,EAAE,MAAM;QACd,OAAO,EAAE;YACP,cAAc,EAAE,kBAAkB;YAClC,aAAa,EAAE,UAAU,MAAM,EAAE;YACjC,eAAe,EAAE,aAAa,OAAO,EAAE;SACxC;QACD,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC;KAC9B,CAAC,CAAC;IAEH,IAAI,CAAC,IAAI,CAAC,EAAE,EAAE,CAAC;QACb,MAAM,IAAI,KAAK,CAAC,sBAAsB,IAAI,CAAC,MAAM,IAAI,IAAI,CAAC,UAAU,EAAE,CAAC,CAAC;IAC1E,CAAC;IAED,kEAAkE;IAClE,MAAM,WAAW,GAAG,IAAI,CAAC,OAAO,EAAE,GAAG,EAAE,CAAC,eAAe,CAAC,CAAC;IACzD,IAAI,WAAW,EAAE,CAAC;QAChB,OAAO,CAAC,IAAI,CAAC,6BAA6B,WAAW,EAAE,CAAC,CAAC;IAC3D,CAAC;IAED,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,IAAI,EAAE,CAAC;IAC/B,OAAO;QACL,MAAM,EAAE,IAAI,CAAC,MAAM;QACnB,SAAS,EAAE,IAAI,CAAC,UAAU;QAC1B,YAAY,EAAE,IAAI,CAAC,aAAa,IAAI,SAAS;KAC9C,CAAC;AACJ,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, resumeHookFromDict, serializeResumeHook, 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";
|
package/dist/index.d.ts.map
CHANGED
|
@@ -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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AuB,CAAC;AAC/B,YAAY,EACV,eAAe,EACf,SAAS,EACT,iBAAiB,EACjB,iBAAiB,EACjB,cAAc,EACd,cAAc,EACd,aAAa,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, resumeHookFromDict, serializeResumeHook, 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;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,YAAY,GAAG,IAAI,iBAAiB,CAAC;QACzC,GAAG,EAAE,GAAG,QAAQ,YAAY;QAC5B,OAAO,EAAE,EAAE,aAAa,EAAE,UAAU,MAAM,EAAE,EAAE;KAC/C,CAAC,CAAC;IAEH,MAAM,YAAY,GAAG,IAAI,oBAAoB,CAAC,YAAY,EAAE,oBAAoB,CAAC,CAAC;IAClF,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/dist/resolve.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export declare const VALID_DECISIONS: Set<"
|
|
1
|
+
export declare const VALID_DECISIONS: Set<"approved" | "corrected" | "rejected" | "expired">;
|
|
2
2
|
export interface MetricResult {
|
|
3
3
|
readonly field: string;
|
|
4
4
|
readonly metrics: Record<string, number>;
|
package/dist/version.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const VERSION = "1.
|
|
1
|
+
export declare const VERSION = "1.15.0";
|
|
2
2
|
//# sourceMappingURL=version.d.ts.map
|
package/dist/version.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// SDK version, sent in the X-SDK-Version header so the platform can see which
|
|
2
2
|
// SDK releases customers run before removing a deprecated field (COA-261).
|
|
3
3
|
// Keep in sync with package.json "version".
|
|
4
|
-
export const VERSION = "1.
|
|
4
|
+
export const VERSION = "1.15.0";
|
|
5
5
|
//# sourceMappingURL=version.js.map
|