@coalex-ai/sdk 1.15.0-beta.262 → 1.16.0-beta.388
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/agents.d.ts.map +1 -1
- package/dist/agents.js +3 -2
- package/dist/agents.js.map +1 -1
- package/dist/decision-request.d.ts +37 -2
- package/dist/decision-request.d.ts.map +1 -1
- package/dist/decision-request.js +74 -4
- package/dist/decision-request.js.map +1 -1
- package/dist/evaluate.d.ts +5 -0
- package/dist/evaluate.d.ts.map +1 -1
- package/dist/evaluate.js +4 -2
- package/dist/evaluate.js.map +1 -1
- package/dist/ext/tool.d.ts.map +1 -1
- package/dist/ext/tool.js +13 -0
- package/dist/ext/tool.js.map +1 -1
- package/dist/http.d.ts +29 -0
- package/dist/http.d.ts.map +1 -0
- package/dist/http.js +43 -0
- package/dist/http.js.map +1 -0
- package/dist/index.d.ts +9 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +8 -0
- package/dist/index.js.map +1 -1
- package/dist/inventory.d.ts +30 -0
- package/dist/inventory.d.ts.map +1 -0
- package/dist/inventory.js +53 -0
- package/dist/inventory.js.map +1 -0
- package/dist/prompts.d.ts.map +1 -1
- package/dist/prompts.js +3 -2
- package/dist/prompts.js.map +1 -1
- package/dist/resolve.d.ts +16 -1
- package/dist/resolve.d.ts.map +1 -1
- package/dist/resolve.js +24 -6
- package/dist/resolve.js.map +1 -1
- package/dist/safe-exporter.d.ts +24 -0
- package/dist/safe-exporter.d.ts.map +1 -1
- package/dist/safe-exporter.js +50 -25
- package/dist/safe-exporter.js.map +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +1 -1
package/dist/agents.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agents.d.ts","sourceRoot":"","sources":["../src/agents.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"agents.d.ts","sourceRoot":"","sources":["../src/agents.ts"],"names":[],"mappings":"AAGA,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;CAC3B;AAED,MAAM,WAAW,mBAAmB;IAClC,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACpC;AAED,wBAAsB,YAAY,CAAC,OAAO,EAAE,mBAAmB,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAiC1F"}
|
package/dist/agents.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { getConfig, getApiKey } from "./index.js";
|
|
2
|
+
import { coalexFetch, httpError } from "./http.js";
|
|
2
3
|
export async function declareAgent(options) {
|
|
3
4
|
const config = getConfig();
|
|
4
5
|
const apiKey = getApiKey();
|
|
@@ -11,7 +12,7 @@ export async function declareAgent(options) {
|
|
|
11
12
|
if (options.metadata !== undefined) {
|
|
12
13
|
payload.metadata = options.metadata;
|
|
13
14
|
}
|
|
14
|
-
const resp = await
|
|
15
|
+
const resp = await coalexFetch("declareAgent()", `${config.endpoint}/api/v1/agents`, {
|
|
15
16
|
method: "POST",
|
|
16
17
|
headers: {
|
|
17
18
|
"Content-Type": "application/json",
|
|
@@ -20,7 +21,7 @@ export async function declareAgent(options) {
|
|
|
20
21
|
body: JSON.stringify(payload),
|
|
21
22
|
});
|
|
22
23
|
if (!resp.ok) {
|
|
23
|
-
throw
|
|
24
|
+
throw await httpError("declareAgent()", resp);
|
|
24
25
|
}
|
|
25
26
|
const data = await resp.json();
|
|
26
27
|
return {
|
package/dist/agents.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agents.js","sourceRoot":"","sources":["../src/agents.ts"],"names":[],"mappings":"AAAA,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,CAAC,SAAS;QACzB,OAAO,EAAE,IAAI,CAAC,OAAO;KACtB,CAAC;AACJ,CAAC"}
|
|
@@ -77,8 +77,41 @@ export interface QuestionSchema {
|
|
|
77
77
|
required: string[];
|
|
78
78
|
}
|
|
79
79
|
/**
|
|
80
|
-
*
|
|
81
|
-
*
|
|
80
|
+
* Fields a Decision Request must never carry to an approver (spec §6, COA-2187).
|
|
81
|
+
*
|
|
82
|
+
* Anchoring: a reviewer told the agent was 94% confident does not review, they ratify. The Python
|
|
83
|
+
* SDK has filtered these since the composer existed and the Console has filtered them at render
|
|
84
|
+
* since COA-1739 — **this SDK filtered nothing**, and the JSDoc below claimed otherwise. So a
|
|
85
|
+
* TypeScript producer whose agent put `{answer, confidence: 0.94}` in the output had that
|
|
86
|
+
* confidence served to every other client of the Decision Requests API, and the anchoring the whole
|
|
87
|
+
* of §6 exists to prevent was live in that organisation.
|
|
88
|
+
*
|
|
89
|
+
* Kept in step with `FORBIDDEN_FIELD_KEYS` in `packages/sdk-python/src/coalex/decision_request.py`
|
|
90
|
+
* and in `apps/console/src/data/decision.ts`. Three copies is one too many; diverging is worse.
|
|
91
|
+
*/
|
|
92
|
+
export declare const FORBIDDEN_FIELD_KEYS: ReadonlySet<string>;
|
|
93
|
+
/** What a Question Composer decides the card shows (spec §6). */
|
|
94
|
+
export interface ComposedQuestion {
|
|
95
|
+
question: string;
|
|
96
|
+
summary?: string;
|
|
97
|
+
output: Record<string, unknown>;
|
|
98
|
+
schema: QuestionSchema;
|
|
99
|
+
}
|
|
100
|
+
/** Decides what an approver sees. A seam, so a better composer changes the card, not the card's code. */
|
|
101
|
+
export interface QuestionComposer {
|
|
102
|
+
compose(escalation: EscalationLike): ComposedQuestion;
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* v1 (spec §6): the card shows what the producer sent, minus what §6 keeps out.
|
|
106
|
+
*
|
|
107
|
+
* Deliberately does nothing interesting. Its whole value is that it is a seam — the Python SDK's
|
|
108
|
+
* `IdentityComposer`, in TypeScript.
|
|
109
|
+
*/
|
|
110
|
+
export declare const identityComposer: QuestionComposer;
|
|
111
|
+
/**
|
|
112
|
+
* What the human needs to judge (spec §4.1, §6 de-biasing). `output` is shown as an editable
|
|
113
|
+
* answer, with the agent's reasoning, confidence and risk score removed by the composer — see
|
|
114
|
+
* `FORBIDDEN_FIELD_KEYS`. Until COA-2187 this comment was a claim this SDK did not honour.
|
|
82
115
|
*/
|
|
83
116
|
export interface ContextPayload {
|
|
84
117
|
question: string;
|
|
@@ -153,6 +186,8 @@ export interface FromEscalationOptions {
|
|
|
153
186
|
resumeHook?: ResumeHook;
|
|
154
187
|
/** The composed question shown on the card. Default: identity composer (§6). */
|
|
155
188
|
question?: string;
|
|
189
|
+
/** Decides what the card shows (spec §6). Default: `identityComposer`. */
|
|
190
|
+
composer?: QuestionComposer;
|
|
156
191
|
}
|
|
157
192
|
/**
|
|
158
193
|
* Materialize an escalation as a Decision Request (spec §4, COA-1278). The task state
|
|
@@ -1 +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;A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AG,IAAI,CAAC;IAClC,WAAW,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAAC;IAC7C,WAAW,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAAC;IAC7C,UAAU,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,UAAU,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;IAClB,0EAA0E;IAC1E,QAAQ,CAAC,EAAE,gBAAgB,CAAC;CAC7B;AAED;;;;;GAKG;AACH,wBAAgB,cAAc,CAC5B,UAAU,EAAE,cAAc,EAC1B,OAAO,GAAE,qBAA0B,GAClC,eAAe,CAwDjB;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,CAkBrF"}
|
package/dist/decision-request.js
CHANGED
|
@@ -64,6 +64,72 @@ export function resumeHookFromDict(data) {
|
|
|
64
64
|
...(typeof data.task_id === "string" ? { taskId: data.task_id } : {}),
|
|
65
65
|
};
|
|
66
66
|
}
|
|
67
|
+
/**
|
|
68
|
+
* Fields a Decision Request must never carry to an approver (spec §6, COA-2187).
|
|
69
|
+
*
|
|
70
|
+
* Anchoring: a reviewer told the agent was 94% confident does not review, they ratify. The Python
|
|
71
|
+
* SDK has filtered these since the composer existed and the Console has filtered them at render
|
|
72
|
+
* since COA-1739 — **this SDK filtered nothing**, and the JSDoc below claimed otherwise. So a
|
|
73
|
+
* TypeScript producer whose agent put `{answer, confidence: 0.94}` in the output had that
|
|
74
|
+
* confidence served to every other client of the Decision Requests API, and the anchoring the whole
|
|
75
|
+
* of §6 exists to prevent was live in that organisation.
|
|
76
|
+
*
|
|
77
|
+
* Kept in step with `FORBIDDEN_FIELD_KEYS` in `packages/sdk-python/src/coalex/decision_request.py`
|
|
78
|
+
* and in `apps/console/src/data/decision.ts`. Three copies is one too many; diverging is worse.
|
|
79
|
+
*/
|
|
80
|
+
export const FORBIDDEN_FIELD_KEYS = new Set([
|
|
81
|
+
"reasoning",
|
|
82
|
+
"reason", // the agent's rationale — distinct from the operator's decline reason
|
|
83
|
+
"rationale",
|
|
84
|
+
"chain_of_thought",
|
|
85
|
+
"cot",
|
|
86
|
+
"thoughts",
|
|
87
|
+
"confidence",
|
|
88
|
+
"confidence_score",
|
|
89
|
+
"certainty",
|
|
90
|
+
"risk",
|
|
91
|
+
"risk_score",
|
|
92
|
+
"risk_tier",
|
|
93
|
+
"score",
|
|
94
|
+
]);
|
|
95
|
+
/**
|
|
96
|
+
* The curated human-readable `reason` from an escalation's metadata, for the card summary
|
|
97
|
+
* (COA-1758).
|
|
98
|
+
*
|
|
99
|
+
* ONLY this field is surfaced from metadata — never the risk tier, the governed flag or the risk
|
|
100
|
+
* score, which is the same rule the denylist enforces one level up.
|
|
101
|
+
*/
|
|
102
|
+
function reasonFromMetadata(metadata) {
|
|
103
|
+
if (metadata && typeof metadata === "object") {
|
|
104
|
+
const reason = metadata.reason;
|
|
105
|
+
if (typeof reason === "string" && reason.trim())
|
|
106
|
+
return reason;
|
|
107
|
+
}
|
|
108
|
+
return undefined;
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* v1 (spec §6): the card shows what the producer sent, minus what §6 keeps out.
|
|
112
|
+
*
|
|
113
|
+
* Deliberately does nothing interesting. Its whole value is that it is a seam — the Python SDK's
|
|
114
|
+
* `IdentityComposer`, in TypeScript.
|
|
115
|
+
*/
|
|
116
|
+
export const identityComposer = {
|
|
117
|
+
compose(escalation) {
|
|
118
|
+
const raw = escalation.output ?? {};
|
|
119
|
+
const output = {};
|
|
120
|
+
for (const [key, value] of Object.entries(raw)) {
|
|
121
|
+
if (!FORBIDDEN_FIELD_KEYS.has(key.toLowerCase()))
|
|
122
|
+
output[key] = value;
|
|
123
|
+
}
|
|
124
|
+
return {
|
|
125
|
+
question: DEFAULT_QUESTION,
|
|
126
|
+
summary: reasonFromMetadata(escalation.metadata),
|
|
127
|
+
output,
|
|
128
|
+
// Derived from the FILTERED output, so a forbidden key cannot come back as a field.
|
|
129
|
+
schema: questionSchemaFromOutput(output, escalation.metrics),
|
|
130
|
+
};
|
|
131
|
+
},
|
|
132
|
+
};
|
|
67
133
|
/**
|
|
68
134
|
* Escalation status -> MCP task state (spec §5). See `fromEscalation` for the full
|
|
69
135
|
* status -> (state, action) reconciliation.
|
|
@@ -136,12 +202,16 @@ export function fromEscalation(escalation, options = {}) {
|
|
|
136
202
|
throw new Error(`unknown escalation status '${status}'; expected one of ${known}`);
|
|
137
203
|
}
|
|
138
204
|
const action = ACTION_BY_STATUS[status];
|
|
139
|
-
|
|
140
|
-
|
|
205
|
+
// Through the composer, not straight from the escalation (COA-2187): this is where §6's
|
|
206
|
+
// forbidden keys are dropped, and where a better composer would change the card.
|
|
207
|
+
const composed = (options.composer ?? identityComposer).compose(escalation);
|
|
208
|
+
const questionSchema = composed.schema;
|
|
141
209
|
const context = {
|
|
142
|
-
question: options.question ??
|
|
143
|
-
output,
|
|
210
|
+
question: options.question ?? composed.question,
|
|
211
|
+
output: composed.output,
|
|
144
212
|
};
|
|
213
|
+
if (composed.summary)
|
|
214
|
+
context.summary = composed.summary;
|
|
145
215
|
if (escalation.input)
|
|
146
216
|
context.input = escalation.input;
|
|
147
217
|
let resolver;
|
|
@@ -1 +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,CAAC,IAAY;IACxC,IAAI,IAAI,KAAK,MAAM;QAAE,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;IAC7C,IAAI,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,EAAE,CAAC;QAC7B,MAAM,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,CAAC;QAC/C,IAAI,CAAC,IAAI;YAAE,MAAM,IAAI,KAAK,CAAC,oDAAoD,CAAC,CAAC;QACjF,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC;IAChC,CAAC;IACD,MAAM,IAAI,KAAK,CAAC,kDAAkD,IAAI,GAAG,CAAC,CAAC;AAC7E,CAAC;AAED,yEAAyE;AACzE,MAAM,UAAU,cAAc,CAAC,MAAsB;IACnD,OAAO,MAAM,CAAC,IAAI,KAAK,MAAM,CAAC,CAAC,CAAC,QAAQ,MAAM,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC;AACjE,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,kBAAkB,CAAC,IAA6B;IAC9D,MAAM,IAAI,GAAuB,IAAI,CAAC,IAA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,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,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
|
@@ -2,6 +2,11 @@ import { type ResumeHook } from "./decision-request.js";
|
|
|
2
2
|
export declare const KNOWN_METRICS: Set<string>;
|
|
3
3
|
export interface EvaluationDecision {
|
|
4
4
|
readonly status: "auto_approved" | "escalated" | "rejected";
|
|
5
|
+
/**
|
|
6
|
+
* The same outcome in MCP vocabulary (COA-1790): "escalated" is "input_required". Undefined
|
|
7
|
+
* against an older platform that does not send it yet.
|
|
8
|
+
*/
|
|
9
|
+
readonly taskState?: string;
|
|
5
10
|
readonly riskScore: number;
|
|
6
11
|
readonly escalationId?: string;
|
|
7
12
|
}
|
package/dist/evaluate.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"evaluate.d.ts","sourceRoot":"","sources":["../src/evaluate.ts"],"names":[],"mappings":"AAEA,OAAO,EAAuB,KAAK,UAAU,EAAE,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"evaluate.d.ts","sourceRoot":"","sources":["../src/evaluate.ts"],"names":[],"mappings":"AAEA,OAAO,EAAuB,KAAK,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAI7E,eAAO,MAAM,aAAa,aASxB,CAAC;AAEH,MAAM,WAAW,kBAAkB;IACjC,QAAQ,CAAC,MAAM,EAAE,eAAe,GAAG,WAAW,GAAG,UAAU,CAAC;IAC5D;;;OAGG;IACH,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;IAC5B,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,CAoEpF"}
|
package/dist/evaluate.js
CHANGED
|
@@ -2,6 +2,7 @@ import { getConfig, getApiKey } from "./index.js";
|
|
|
2
2
|
import { currentAgentId } from "./context.js";
|
|
3
3
|
import { serializeResumeHook } from "./decision-request.js";
|
|
4
4
|
import { VERSION } from "./version.js";
|
|
5
|
+
import { coalexFetch, httpError } from "./http.js";
|
|
5
6
|
export const KNOWN_METRICS = new Set([
|
|
6
7
|
"f1",
|
|
7
8
|
"word_overlap",
|
|
@@ -48,7 +49,7 @@ export async function evaluate(options) {
|
|
|
48
49
|
if (options.resumeHook) {
|
|
49
50
|
payload.resume_hook = serializeResumeHook(options.resumeHook);
|
|
50
51
|
}
|
|
51
|
-
const resp = await
|
|
52
|
+
const resp = await coalexFetch("evaluate()", `${config.endpoint}/api/v1/evaluate`, {
|
|
52
53
|
method: "POST",
|
|
53
54
|
headers: {
|
|
54
55
|
"Content-Type": "application/json",
|
|
@@ -58,7 +59,7 @@ export async function evaluate(options) {
|
|
|
58
59
|
body: JSON.stringify(payload),
|
|
59
60
|
});
|
|
60
61
|
if (!resp.ok) {
|
|
61
|
-
throw
|
|
62
|
+
throw await httpError("evaluate()", resp);
|
|
62
63
|
}
|
|
63
64
|
// COA-261: surface server-side deprecation notices to the caller.
|
|
64
65
|
const deprecation = resp.headers?.get?.("X-Deprecation");
|
|
@@ -68,6 +69,7 @@ export async function evaluate(options) {
|
|
|
68
69
|
const data = await resp.json();
|
|
69
70
|
return {
|
|
70
71
|
status: data.status,
|
|
72
|
+
taskState: data.task_state,
|
|
71
73
|
riskScore: data.risk_score,
|
|
72
74
|
escalationId: data.escalation_id ?? undefined,
|
|
73
75
|
};
|
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,mBAAmB,EAAmB,MAAM,uBAAuB,CAAC;AAC7E,OAAO,EAAE,OAAO,EAAE,MAAM,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;AACvC,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAEnD,MAAM,CAAC,MAAM,aAAa,GAAG,IAAI,GAAG,CAAC;I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,IAAI,CAAC,aAAa,IAAI,SAAS;KAC9C,CAAC;AACJ,CAAC"}
|
package/dist/ext/tool.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tool.d.ts","sourceRoot":"","sources":["../../src/ext/tool.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"tool.d.ts","sourceRoot":"","sources":["../../src/ext/tool.ts"],"names":[],"mappings":"AAGA,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAqBD,wBAAgB,QAAQ,CAAC,CAAC,SAAS,OAAO,EAAE,EAAE,CAAC,EAC7C,OAAO,EAAE,eAAe,EACxB,EAAE,EAAE,CAAC,GAAG,IAAI,EAAE,CAAC,KAAK,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,GACjC,CAAC,GAAG,IAAI,EAAE,CAAC,KAAK,OAAO,CAAC,CAAC,CAAC,CA2C5B"}
|
package/dist/ext/tool.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { getParentContext, getTracer } from "./base.js";
|
|
2
|
+
import { SpanStatusCode } from "@opentelemetry/api";
|
|
2
3
|
const MAX_OUTPUT_LEN = 10_000;
|
|
3
4
|
/**
|
|
4
5
|
* Serialize a tool's return value for the `output.value` span attribute.
|
|
@@ -45,8 +46,20 @@ export function toolSpan(options, fn) {
|
|
|
45
46
|
catch {
|
|
46
47
|
// ignore serialization errors
|
|
47
48
|
}
|
|
49
|
+
span.setStatus({ code: SpanStatusCode.OK });
|
|
48
50
|
return result;
|
|
49
51
|
}
|
|
52
|
+
catch (e) {
|
|
53
|
+
// Its two siblings — `guardrail.ts` and `retrieval.ts` — already do this, and only
|
|
54
|
+
// `toolSpan` was left out (COA-2187). `startActiveSpan` does NOT record exceptions the way
|
|
55
|
+
// Python's `start_as_current_span(record_exception=True)` does, so a tool that threw on
|
|
56
|
+
// every call showed up in the trace viewer with status UNSET and no exception event —
|
|
57
|
+
// indistinguishable from success. The developer concluded the tool was fine and looked
|
|
58
|
+
// somewhere else.
|
|
59
|
+
span.setStatus({ code: SpanStatusCode.ERROR, message: String(e) });
|
|
60
|
+
span.recordException(e instanceof Error ? e : new Error(String(e)));
|
|
61
|
+
throw e;
|
|
62
|
+
}
|
|
50
63
|
finally {
|
|
51
64
|
span.end();
|
|
52
65
|
}
|
package/dist/ext/tool.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tool.js","sourceRoot":"","sources":["../../src/ext/tool.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"tool.js","sourceRoot":"","sources":["../../src/ext/tool.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AACxD,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAOpD,MAAM,cAAc,GAAG,MAAM,CAAC;AAE9B;;;GAGG;AACH,SAAS,mBAAmB,CAAC,KAAc;IACzC,IAAI,IAAY,CAAC;IACjB,IAAI,CAAC;QACH,IAAI,GAAG,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,IAAI,MAAM,CAAC,KAAK,CAAC,CAAC;IAChD,CAAC;IAAC,MAAM,CAAC;QACP,IAAI,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC;IACvB,CAAC;IACD,IAAI,IAAI,CAAC,MAAM,GAAG,cAAc,EAAE,CAAC;QACjC,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,cAAc,CAAC,GAAG,cAAc,CAAC;IACxD,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC;AAED,MAAM,UAAU,QAAQ,CACtB,OAAwB,EACxB,EAAkC;IAElC,OAAO,KAAK,EAAE,GAAG,IAAO,EAAc,EAAE;QACtC,MAAM,MAAM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CAAC,SAAS,CAAC,EAAE,IAAI,EAAE,cAAc,CAAC,KAAK,EAAE,OAAO,EAAE,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;gBACnE,IAAI,CAAC,eAAe,CAAC,CAAC,YAAY,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;gBACpE,MAAM,CAAC,CAAC;YACV,CAAC;oBAAS,CAAC;gBACT,IAAI,CAAC,GAAG,EAAE,CAAC;YACb,CAAC;QACH,CAAC,CAAC,CAAC;IACL,CAAC,CAAC;AACJ,CAAC"}
|
package/dist/http.d.ts
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The two things every governance call to Coalex has to get right (COA-2187).
|
|
3
|
+
*
|
|
4
|
+
* **A timeout.** Node's `fetch` has none. A swallowed connection — the shape a firewall that drops
|
|
5
|
+
* rather than refuses produces — leaves the promise pending *for ever*. A customer's network policy
|
|
6
|
+
* changes, the agent's `evaluate()` never resolves, the handler is stuck, the pool drains, and the
|
|
7
|
+
* service stops answering, with nothing logged. From outside it looks like THEIR agent hung.
|
|
8
|
+
* `inventory.ts` already passed `AbortSignal.timeout`; the governance paths did not.
|
|
9
|
+
*
|
|
10
|
+
* **The server's reason.** `throw new Error(\`… failed: ${resp.status}\`)` discards the response
|
|
11
|
+
* body, so a 422 says the status and nothing about which field was wrong.
|
|
12
|
+
*/
|
|
13
|
+
/** Long enough for a cold start, short enough that a stuck call fails rather than hangs. */
|
|
14
|
+
export declare const REQUEST_TIMEOUT_MS = 30000;
|
|
15
|
+
/**
|
|
16
|
+
* `fetch` that cannot hang. Everything else is the caller's.
|
|
17
|
+
*
|
|
18
|
+
* A timeout surfaces as an error naming the operation and the limit rather than a bare
|
|
19
|
+
* `TimeoutError`, which is indistinguishable from a dozen other things in a customer's log.
|
|
20
|
+
*/
|
|
21
|
+
export declare function coalexFetch(operation: string, url: string, init?: RequestInit, timeoutMs?: number): Promise<Response>;
|
|
22
|
+
/**
|
|
23
|
+
* The error a non-2xx deserves: the status AND what the server said was wrong.
|
|
24
|
+
*
|
|
25
|
+
* Truncated, because a server can return an HTML error page; 500 characters is enough to name the
|
|
26
|
+
* offending field and short enough not to bury a log.
|
|
27
|
+
*/
|
|
28
|
+
export declare function httpError(operation: string, resp: Response): Promise<Error>;
|
|
29
|
+
//# sourceMappingURL=http.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"http.d.ts","sourceRoot":"","sources":["../src/http.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,4FAA4F;AAC5F,eAAO,MAAM,kBAAkB,QAAS,CAAC;AAEzC;;;;;GAKG;AACH,wBAAsB,WAAW,CAC/B,SAAS,EAAE,MAAM,EACjB,GAAG,EAAE,MAAM,EACX,IAAI,GAAE,WAAgB,EACtB,SAAS,GAAE,MAA2B,GACrC,OAAO,CAAC,QAAQ,CAAC,CASnB;AAED;;;;;GAKG;AACH,wBAAsB,SAAS,CAAC,SAAS,EAAE,MAAM,EAAE,IAAI,EAAE,QAAQ,GAAG,OAAO,CAAC,KAAK,CAAC,CAIjF"}
|
package/dist/http.js
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The two things every governance call to Coalex has to get right (COA-2187).
|
|
3
|
+
*
|
|
4
|
+
* **A timeout.** Node's `fetch` has none. A swallowed connection — the shape a firewall that drops
|
|
5
|
+
* rather than refuses produces — leaves the promise pending *for ever*. A customer's network policy
|
|
6
|
+
* changes, the agent's `evaluate()` never resolves, the handler is stuck, the pool drains, and the
|
|
7
|
+
* service stops answering, with nothing logged. From outside it looks like THEIR agent hung.
|
|
8
|
+
* `inventory.ts` already passed `AbortSignal.timeout`; the governance paths did not.
|
|
9
|
+
*
|
|
10
|
+
* **The server's reason.** `throw new Error(\`… failed: ${resp.status}\`)` discards the response
|
|
11
|
+
* body, so a 422 says the status and nothing about which field was wrong.
|
|
12
|
+
*/
|
|
13
|
+
/** Long enough for a cold start, short enough that a stuck call fails rather than hangs. */
|
|
14
|
+
export const REQUEST_TIMEOUT_MS = 30_000;
|
|
15
|
+
/**
|
|
16
|
+
* `fetch` that cannot hang. Everything else is the caller's.
|
|
17
|
+
*
|
|
18
|
+
* A timeout surfaces as an error naming the operation and the limit rather than a bare
|
|
19
|
+
* `TimeoutError`, which is indistinguishable from a dozen other things in a customer's log.
|
|
20
|
+
*/
|
|
21
|
+
export async function coalexFetch(operation, url, init = {}, timeoutMs = REQUEST_TIMEOUT_MS) {
|
|
22
|
+
try {
|
|
23
|
+
return await fetch(url, { ...init, signal: init.signal ?? AbortSignal.timeout(timeoutMs) });
|
|
24
|
+
}
|
|
25
|
+
catch (err) {
|
|
26
|
+
if (err instanceof Error && (err.name === "TimeoutError" || err.name === "AbortError")) {
|
|
27
|
+
throw new Error(`${operation} timed out after ${timeoutMs}ms`);
|
|
28
|
+
}
|
|
29
|
+
throw new Error(`${operation} could not reach Coalex: ${String(err)}`);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* The error a non-2xx deserves: the status AND what the server said was wrong.
|
|
34
|
+
*
|
|
35
|
+
* Truncated, because a server can return an HTML error page; 500 characters is enough to name the
|
|
36
|
+
* offending field and short enough not to bury a log.
|
|
37
|
+
*/
|
|
38
|
+
export async function httpError(operation, resp) {
|
|
39
|
+
const detail = await resp.text().catch(() => "");
|
|
40
|
+
const suffix = detail.trim() ? `: ${detail.trim().slice(0, 500)}` : "";
|
|
41
|
+
return new Error(`${operation} failed: ${resp.status} ${resp.statusText}${suffix}`);
|
|
42
|
+
}
|
|
43
|
+
//# sourceMappingURL=http.js.map
|
package/dist/http.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"http.js","sourceRoot":"","sources":["../src/http.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;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index.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { CoalexConfig } from "./config.js";
|
|
2
|
+
import type { AgentInventory } from "./inventory.js";
|
|
2
3
|
export type { CoalexConfig } from "./config.js";
|
|
3
4
|
export { coalexContext, coalexContextSync, currentAgentId } from "./context.js";
|
|
4
5
|
export type { CoalexContextOptions } from "./context.js";
|
|
@@ -11,6 +12,8 @@ export type { DecisionRequest, TaskState, ElicitationAction, ElicitationResult,
|
|
|
11
12
|
export { getPrompt } from "./prompts.js";
|
|
12
13
|
export type { GetPromptOptions, PromptVersion } from "./prompts.js";
|
|
13
14
|
export { declareAgent } from "./agents.js";
|
|
15
|
+
export { declareInventory } from "./inventory.js";
|
|
16
|
+
export type { AgentInventory } from "./inventory.js";
|
|
14
17
|
export type { AgentDeclaration, DeclareAgentOptions } from "./agents.js";
|
|
15
18
|
export { autoInstrument, autoInstrumentAsync, instrumentOpenAI, instrumentLangChain, instrumentAnthropic } from "./auto-instrument.js";
|
|
16
19
|
export type { AutoInstrumentOptions, InstrumentationStatus } from "./auto-instrument.js";
|
|
@@ -22,6 +25,12 @@ export interface RegisterOptions {
|
|
|
22
25
|
serviceName?: string;
|
|
23
26
|
filterNonAiSpans?: boolean;
|
|
24
27
|
suppressExportErrors?: boolean;
|
|
28
|
+
/**
|
|
29
|
+
* Optionally tell the platform where this agent lives and what tools it has (COA-1969), so it
|
|
30
|
+
* appears in the Console without anyone registering it by hand. Best-effort: a failure is
|
|
31
|
+
* logged and startup continues. Omit it and `register()` makes no network call at all.
|
|
32
|
+
*/
|
|
33
|
+
declare?: AgentInventory;
|
|
25
34
|
}
|
|
26
35
|
export declare function register(options?: RegisterOptions): void;
|
|
27
36
|
/** Reset SDK state — for testing only. */
|
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,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EAAE,MAAM,cAAc,CAAC;AACzC,YAAY,EAAE,gBAAgB,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AACpE,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAC3C,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAClD,YAAY,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AACrD,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;IAC/B;;;;OAIG;IACH,OAAO,CAAC,EAAE,cAAc,CAAC;CAC1B;AAED,wBAAgB,QAAQ,CAAC,OAAO,CAAC,EAAE,eAAe,GAAG,IAAI,CAiCxD;AAED,0CAA0C;AAC1C,wBAAgB,gBAAgB,IAAI,IAAI,CAGvC"}
|
package/dist/index.js
CHANGED
|
@@ -6,12 +6,14 @@ import { ATTR_SERVICE_NAME } from "@opentelemetry/semantic-conventions";
|
|
|
6
6
|
import { SafeOTLPSpanExporter } from "./safe-exporter.js";
|
|
7
7
|
import { FilteringSpanExporter } from "./filtering-exporter.js";
|
|
8
8
|
import { CoalexAttributePropagator } from "./span-processor.js";
|
|
9
|
+
import { declareInventory } from "./inventory.js";
|
|
9
10
|
export { coalexContext, coalexContextSync, currentAgentId } from "./context.js";
|
|
10
11
|
export { evaluate, KNOWN_METRICS } from "./evaluate.js";
|
|
11
12
|
export { resolve, VALID_DECISIONS } from "./resolve.js";
|
|
12
13
|
export { fromEscalation, serializeDecisionRequest, parseResolver, resolverToSpec, resumeHookFromDict, serializeResumeHook, taskStateForStatus, TASK_STATES, TASK_STATE_BY_STATUS, DEFAULT_QUESTION, } from "./decision-request.js";
|
|
13
14
|
export { getPrompt } from "./prompts.js";
|
|
14
15
|
export { declareAgent } from "./agents.js";
|
|
16
|
+
export { declareInventory } from "./inventory.js";
|
|
15
17
|
export { autoInstrument, autoInstrumentAsync, instrumentOpenAI, instrumentLangChain, instrumentAnthropic } from "./auto-instrument.js";
|
|
16
18
|
let _config = null;
|
|
17
19
|
let _apiKey = null;
|
|
@@ -48,6 +50,12 @@ export function register(options) {
|
|
|
48
50
|
provider.addSpanProcessor(new CoalexAttributePropagator());
|
|
49
51
|
provider.addSpanProcessor(new BatchSpanProcessor(finalExporter));
|
|
50
52
|
provider.register();
|
|
53
|
+
if (options?.declare) {
|
|
54
|
+
// Deliberately last, and deliberately not awaited: tracing is configured before we talk to
|
|
55
|
+
// anyone, and register() stays synchronous so an unreachable control plane cannot delay or
|
|
56
|
+
// block an agent's startup. declareInventory never rejects.
|
|
57
|
+
void declareInventory(options.declare, { config: _config, apiKey, defaultName: serviceName });
|
|
58
|
+
}
|
|
51
59
|
}
|
|
52
60
|
/** Reset SDK state — for testing only. */
|
|
53
61
|
export function _resetForTesting() {
|
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,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E,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;IAEpB,IAAI,OAAO,EAAE,OAAO,EAAE,CAAC;QACrB,2FAA2F;QAC3F,2FAA2F;QAC3F,4DAA4D;QAC5D,KAAK,gBAAgB,CAAC,OAAO,CAAC,OAAO,EAAE,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,WAAW,EAAE,CAAC,CAAC;IAChG,CAAC;AACH,CAAC;AAED,0CAA0C;AAC1C,MAAM,UAAU,gBAAgB;IAC9B,OAAO,GAAG,IAAI,CAAC;IACf,OAAO,GAAG,IAAI,CAAC;AACjB,CAAC"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { CoalexConfig } from "./config.js";
|
|
2
|
+
/** What an agent declares about itself. Note the absence of `governed` and `resolver`. */
|
|
3
|
+
export interface AgentInventory {
|
|
4
|
+
/** Where a turn is POSTed — the URL the Console will talk to. */
|
|
5
|
+
endpoint: string;
|
|
6
|
+
/** The names of the tools this agent exposes. Names only; governance is the org's call. */
|
|
7
|
+
tools?: string[];
|
|
8
|
+
/** Where a paused run is resumed, if the agent supports being paused. */
|
|
9
|
+
resumeUrl?: string;
|
|
10
|
+
/**
|
|
11
|
+
* The agent's name on the platform. Defaults to `register()`'s `serviceName`, which is what its
|
|
12
|
+
* traces are already attributed to — so the declared agent and the observed one are one row.
|
|
13
|
+
*/
|
|
14
|
+
name?: string;
|
|
15
|
+
}
|
|
16
|
+
interface DeclareArgs {
|
|
17
|
+
config: CoalexConfig;
|
|
18
|
+
apiKey: string;
|
|
19
|
+
defaultName: string;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* POST the declaration. Resolves to whether it landed; never rejects.
|
|
23
|
+
*
|
|
24
|
+
* `register()` runs at application startup, so this must not be able to stop an agent from
|
|
25
|
+
* starting. A governance registration failing is a reason to log loudly, not a reason for a
|
|
26
|
+
* customer's agent to be down — the agent still traces, and the declaration retries on next boot.
|
|
27
|
+
*/
|
|
28
|
+
export declare function declareInventory(inventory: AgentInventory, { config, apiKey, defaultName }: DeclareArgs): Promise<boolean>;
|
|
29
|
+
export {};
|
|
30
|
+
//# sourceMappingURL=inventory.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"inventory.d.ts","sourceRoot":"","sources":["../src/inventory.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAMhD,0FAA0F;AAC1F,MAAM,WAAW,cAAc;IAC7B,iEAAiE;IACjE,QAAQ,EAAE,MAAM,CAAC;IACjB,2FAA2F;IAC3F,KAAK,CAAC,EAAE,MAAM,EAAE,CAAC;IACjB,yEAAyE;IACzE,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;;OAGG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED,UAAU,WAAW;IACnB,MAAM,EAAE,YAAY,CAAC;IACrB,MAAM,EAAE,MAAM,CAAC;IACf,WAAW,EAAE,MAAM,CAAC;CACrB;AAED;;;;;;GAMG;AACH,wBAAsB,gBAAgB,CACpC,SAAS,EAAE,cAAc,EACzB,EAAE,MAAM,EAAE,MAAM,EAAE,WAAW,EAAE,EAAE,WAAW,GAC3C,OAAO,CAAC,OAAO,CAAC,CA+BlB"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
// Self-declaration: an agent tells the platform where it lives (COA-1969).
|
|
2
|
+
//
|
|
3
|
+
// Until now an agent appeared in the Console only because somebody hand-wrote a config file and
|
|
4
|
+
// PUT it. That drifts the moment an agent moves or a new one is deployed. Here the agent declares
|
|
5
|
+
// itself at startup instead.
|
|
6
|
+
//
|
|
7
|
+
// What it may declare is deliberately narrow: **where it lives and what tools it has**. It cannot
|
|
8
|
+
// declare whether those tools are governed or who may approve them — that is the org's decision,
|
|
9
|
+
// made in the dashboard, because an agent that governs itself is not governed at all. The
|
|
10
|
+
// transformer enforces the same boundary and answers 422 to a policy field rather than dropping it.
|
|
11
|
+
import { VERSION } from "./version.js";
|
|
12
|
+
/** Long enough for a cold control plane, short enough not to hold up an agent's startup. */
|
|
13
|
+
const TIMEOUT_MS = 5000;
|
|
14
|
+
/**
|
|
15
|
+
* POST the declaration. Resolves to whether it landed; never rejects.
|
|
16
|
+
*
|
|
17
|
+
* `register()` runs at application startup, so this must not be able to stop an agent from
|
|
18
|
+
* starting. A governance registration failing is a reason to log loudly, not a reason for a
|
|
19
|
+
* customer's agent to be down — the agent still traces, and the declaration retries on next boot.
|
|
20
|
+
*/
|
|
21
|
+
export async function declareInventory(inventory, { config, apiKey, defaultName }) {
|
|
22
|
+
const body = {
|
|
23
|
+
name: inventory.name ?? defaultName,
|
|
24
|
+
endpoint: inventory.endpoint,
|
|
25
|
+
tools: inventory.tools ?? [],
|
|
26
|
+
sdk: `coalex-typescript/${VERSION}`,
|
|
27
|
+
};
|
|
28
|
+
if (inventory.resumeUrl) {
|
|
29
|
+
body.resume_hook = { kind: "checkpoint", url: inventory.resumeUrl };
|
|
30
|
+
}
|
|
31
|
+
try {
|
|
32
|
+
const res = await fetch(`${config.endpoint}/api/v1/agent-inventory`, {
|
|
33
|
+
method: "POST",
|
|
34
|
+
headers: { Authorization: `Bearer ${apiKey}`, "Content-Type": "application/json" },
|
|
35
|
+
body: JSON.stringify(body),
|
|
36
|
+
signal: AbortSignal.timeout(TIMEOUT_MS),
|
|
37
|
+
});
|
|
38
|
+
if (!res.ok) {
|
|
39
|
+
// 422 here means the declaration itself is wrong (a policy field, a bad endpoint). Say so
|
|
40
|
+
// with the server's reason — silence would leave the agent believing it registered, which
|
|
41
|
+
// is the failure mode this whole change exists to remove.
|
|
42
|
+
const detail = await res.text().catch(() => "");
|
|
43
|
+
console.warn(`coalex: agent self-declaration rejected (HTTP ${res.status}): ${detail.slice(0, 500)}`);
|
|
44
|
+
return false;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
catch (err) {
|
|
48
|
+
console.warn(`coalex: agent self-declaration failed (${String(err)}); the agent still traces`);
|
|
49
|
+
return false;
|
|
50
|
+
}
|
|
51
|
+
return true;
|
|
52
|
+
}
|
|
53
|
+
//# sourceMappingURL=inventory.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"inventory.js","sourceRoot":"","sources":["../src/inventory.ts"],"names":[],"mappings":"AAAA,2EAA2E;AAC3E,EAAE;AACF,gGAAgG;AAChG,kGAAkG;AAClG,6BAA6B;AAC7B,EAAE;AACF,kGAAkG;AAClG,iGAAiG;AACjG,0FAA0F;AAC1F,oGAAoG;AAGpG,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAEvC,4FAA4F;AAC5F,MAAM,UAAU,GAAG,IAAI,CAAC;AAuBxB;;;;;;GAMG;AACH,MAAM,CAAC,KAAK,UAAU,gBAAgB,CACpC,SAAyB,EACzB,EAAE,MAAM,EAAE,MAAM,EAAE,WAAW,EAAe;IAE5C,MAAM,IAAI,GAA4B;QACpC,IAAI,EAAE,SAAS,CAAC,IAAI,IAAI,WAAW;QACnC,QAAQ,EAAE,SAAS,CAAC,QAAQ;QAC5B,KAAK,EAAE,SAAS,CAAC,KAAK,IAAI,EAAE;QAC5B,GAAG,EAAE,qBA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ts.d.ts","sourceRoot":"","sources":["../src/prompts.ts"],"names":[],"mappings":"AAKA,4DAA4D;AAC5D,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAC5C;AAED,MAAM,WAAW,gBAAgB;IAC/B,uCAAuC;IACvC,KAAK,EAAE,MAAM,CAAC;IACd,mCAAmC;IACnC,IAAI,EAAE,MAAM,CAAC;IACb,iFAAiF;IACjF,OAAO,CAAC,EAAE,YAAY,GAAG,SAAS,GAAG,OAAO,GAAG,QAAQ,GAAG,MAAM,CAAC;CAClE;AAED;;;;;GAKG;AACH,wBAAsB,SAAS,CAAC,OAAO,EAAE,gBAAgB,GAAG,OAAO,CAAC,aAAa,CAAC,CAgDjF"}
|
package/dist/prompts.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { trace } from "@opentelemetry/api";
|
|
2
2
|
import { getConfig, getApiKey } from "./index.js";
|
|
3
3
|
import { setLastPrompt } from "./context.js";
|
|
4
|
+
import { coalexFetch, httpError } from "./http.js";
|
|
4
5
|
/**
|
|
5
6
|
* Fetch a prompt template from the Prompt Vault — the TypeScript counterpart of the Python
|
|
6
7
|
* SDK's `coalex.get_prompt()` (COA-355 / COA-264).
|
|
@@ -13,11 +14,11 @@ export async function getPrompt(options) {
|
|
|
13
14
|
const version = options.version ?? "production";
|
|
14
15
|
const url = `${config.endpoint}/api/v2/prompts/${encodeURIComponent(options.agent)}/${encodeURIComponent(options.name)}` +
|
|
15
16
|
`?version=${encodeURIComponent(String(version))}`;
|
|
16
|
-
const resp = await
|
|
17
|
+
const resp = await coalexFetch("getPrompt()", url, {
|
|
17
18
|
headers: { Authorization: `Bearer ${apiKey}` },
|
|
18
19
|
});
|
|
19
20
|
if (!resp.ok) {
|
|
20
|
-
throw
|
|
21
|
+
throw await httpError("getPrompt()", resp);
|
|
21
22
|
}
|
|
22
23
|
const data = await resp.json();
|
|
23
24
|
// Attribute subsequent spans to this prompt version (COA-368): store it as a fallback for
|
package/dist/prompts.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prompts.js","sourceRoot":"","sources":["../src/prompts.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAC3C,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAClD,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"prompts.js","sourceRoot":"","sources":["../src/prompts.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAC3C,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAClD,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAC7C,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAuBnD;;;;;GAKG;AACH,MAAM,CAAC,KAAK,UAAU,SAAS,CAAC,OAAyB;IACvD,MAAM,MAAM,GAAG,SAAS,EAAE,CAAC;IAC3B,MAAM,MAAM,GAAG,SAAS,EAAE,CAAC;IAE3B,MAAM,OAAO,GAAG,OAAO,CAAC,OAAO,IAAI,YAAY,CAAC;IAChD,MAAM,GAAG,GACP,GAAG,MAAM,CAAC,QAAQ,mBAAmB,kBAAkB,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,kB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|
|
1
1
|
export declare const VALID_DECISIONS: Set<"approved" | "corrected" | "rejected" | "expired">;
|
|
2
|
+
/**
|
|
3
|
+
* The MCP spelling of the same four (COA-1790, spec §5). Accepted here and sent on the wire as-is —
|
|
4
|
+
* the API understands both (COA-1694) — so an integration can move vocabulary without the SDK
|
|
5
|
+
* translating behind its back and hiding which words it actually sent.
|
|
6
|
+
*/
|
|
7
|
+
export declare const MCP_DECISIONS: Set<"cancelled" | "accept" | "decline" | "cancel" | "accept-with-content">;
|
|
2
8
|
export interface MetricResult {
|
|
3
9
|
readonly field: string;
|
|
4
10
|
readonly metrics: Record<string, number>;
|
|
@@ -11,10 +17,19 @@ export interface ResolutionResult {
|
|
|
11
17
|
readonly resolvedBy?: string;
|
|
12
18
|
readonly reviewerName?: string;
|
|
13
19
|
readonly reviewerEmail?: string;
|
|
20
|
+
/**
|
|
21
|
+
* The MCP reading of the same resolution (COA-1790). Undefined against an older platform that does
|
|
22
|
+
* not send them yet — the SDK reports what it was told rather than deriving them locally, so a
|
|
23
|
+
* caller can tell "this deployment is older" from "this decision has no action".
|
|
24
|
+
*/
|
|
25
|
+
readonly taskState?: string;
|
|
26
|
+
readonly resultAction?: string;
|
|
14
27
|
}
|
|
28
|
+
/** Either vocabulary; they mean the same things (COA-1790). */
|
|
29
|
+
export type Decision = "approved" | "rejected" | "corrected" | "expired" | "accept" | "accept-with-content" | "decline" | "cancel" | "cancelled";
|
|
15
30
|
export interface ResolveOptions {
|
|
16
31
|
escalationId: string;
|
|
17
|
-
decision:
|
|
32
|
+
decision: Decision;
|
|
18
33
|
corrections?: Record<string, unknown>;
|
|
19
34
|
reviewer?: string | {
|
|
20
35
|
name?: string;
|
package/dist/resolve.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resolve.d.ts","sourceRoot":"","sources":["../src/resolve.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"resolve.d.ts","sourceRoot":"","sources":["../src/resolve.ts"],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,EAAE,cAAc,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAyEhF"}
|
package/dist/resolve.js
CHANGED
|
@@ -1,13 +1,29 @@
|
|
|
1
1
|
import { getConfig, getApiKey } from "./index.js";
|
|
2
|
+
import { coalexFetch, httpError } from "./http.js";
|
|
2
3
|
export const VALID_DECISIONS = new Set(["approved", "rejected", "corrected", "expired"]);
|
|
4
|
+
/**
|
|
5
|
+
* The MCP spelling of the same four (COA-1790, spec §5). Accepted here and sent on the wire as-is —
|
|
6
|
+
* the API understands both (COA-1694) — so an integration can move vocabulary without the SDK
|
|
7
|
+
* translating behind its back and hiding which words it actually sent.
|
|
8
|
+
*/
|
|
9
|
+
export const MCP_DECISIONS = new Set([
|
|
10
|
+
"accept",
|
|
11
|
+
"accept-with-content",
|
|
12
|
+
"decline",
|
|
13
|
+
"cancel",
|
|
14
|
+
"cancelled",
|
|
15
|
+
]);
|
|
16
|
+
const ALL_DECISIONS = new Set([...VALID_DECISIONS, ...MCP_DECISIONS]);
|
|
3
17
|
export async function resolve(options) {
|
|
4
18
|
const config = getConfig();
|
|
5
19
|
const apiKey = getApiKey();
|
|
6
|
-
if (!
|
|
7
|
-
throw new Error(`decision must be one of ${[...
|
|
20
|
+
if (!ALL_DECISIONS.has(options.decision)) {
|
|
21
|
+
throw new Error(`decision must be one of ${[...ALL_DECISIONS].sort().join(", ")}, got '${options.decision}'`);
|
|
8
22
|
}
|
|
9
|
-
|
|
10
|
-
|
|
23
|
+
// An accept that carries corrections is a correction, in either vocabulary — the check is on the
|
|
24
|
+
// meaning rather than the word.
|
|
25
|
+
if ((options.decision === "corrected" || options.decision === "accept-with-content") && !options.corrections) {
|
|
26
|
+
throw new Error(`corrections required when decision is '${options.decision}'`);
|
|
11
27
|
}
|
|
12
28
|
const payload = { decision: options.decision };
|
|
13
29
|
if (options.corrections !== undefined)
|
|
@@ -22,7 +38,7 @@ export async function resolve(options) {
|
|
|
22
38
|
}
|
|
23
39
|
if (options.reason !== undefined)
|
|
24
40
|
payload.reason = options.reason;
|
|
25
|
-
const resp = await
|
|
41
|
+
const resp = await coalexFetch("resolve()", `${config.endpoint}/api/v1/escalations/${options.escalationId}/resolve`, {
|
|
26
42
|
method: "POST",
|
|
27
43
|
headers: {
|
|
28
44
|
"Content-Type": "application/json",
|
|
@@ -31,7 +47,7 @@ export async function resolve(options) {
|
|
|
31
47
|
body: JSON.stringify(payload),
|
|
32
48
|
});
|
|
33
49
|
if (!resp.ok) {
|
|
34
|
-
throw
|
|
50
|
+
throw await httpError("resolve()", resp);
|
|
35
51
|
}
|
|
36
52
|
const data = await resp.json();
|
|
37
53
|
return {
|
|
@@ -45,6 +61,8 @@ export async function resolve(options) {
|
|
|
45
61
|
resolvedBy: data.resolved_by,
|
|
46
62
|
reviewerName: data.reviewer_name,
|
|
47
63
|
reviewerEmail: data.reviewer_email,
|
|
64
|
+
taskState: data.task_state,
|
|
65
|
+
resultAction: data.result_action,
|
|
48
66
|
};
|
|
49
67
|
}
|
|
50
68
|
//# sourceMappingURL=resolve.js.map
|
package/dist/resolve.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resolve.js","sourceRoot":"","sources":["../src/resolve.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"resolve.js","sourceRoot":"","sources":["../src/resolve.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAClD,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAEnD,MAAM,CAAC,MAAM,eAAe,GAAG,IAAI,GAAG,CAAC,CAAC,UAAU,EAAE,UAAU,EAAE,WAAW,EAAE,SAAS,CAAU,CAAC,CAAC;AAClG;;;;GAIG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG,IAAI,GAAG,CAAC;IACnC,QAAQ;IACR,qBAAq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ts
CHANGED
|
@@ -3,13 +3,37 @@ interface ExportResult {
|
|
|
3
3
|
code: number;
|
|
4
4
|
error?: Error;
|
|
5
5
|
}
|
|
6
|
+
/**
|
|
7
|
+
* Never let a broken telemetry endpoint break the customer's agent — but never go quiet about it
|
|
8
|
+
* either (COA-2187, matching the Python SDK's COA-1145).
|
|
9
|
+
*
|
|
10
|
+
* This used to log the first three failures and then say nothing for the life of the process. A
|
|
11
|
+
* long-running agent whose key is rotated at hour six produced three warnings that scrolled past in
|
|
12
|
+
* a busy log, and then **absolute silence while 100% of its spans were discarded**. The customer's
|
|
13
|
+
* dashboard went flat and they opened a ticket saying our platform had lost their data.
|
|
14
|
+
*
|
|
15
|
+
* So: the first few, then a heartbeat, exactly as the Python SDK does — the point of the heartbeat
|
|
16
|
+
* is that a key which breaks mid-run still surfaces, not only the failures at startup.
|
|
17
|
+
*/
|
|
6
18
|
export declare class SafeOTLPSpanExporter implements SpanExporter {
|
|
7
19
|
private readonly wrappedExporter;
|
|
8
20
|
private readonly suppressErrors;
|
|
9
21
|
private errorCount;
|
|
10
22
|
private readonly maxLoggedErrors;
|
|
23
|
+
/** After the initial burst, re-log every Nth failure. Same cadence as the Python SDK. */
|
|
24
|
+
private readonly heartbeatEvery;
|
|
11
25
|
constructor(wrappedExporter: SpanExporter, suppressErrors?: boolean);
|
|
26
|
+
/** Log an export failure, rate-limited: the first few, then a periodic heartbeat. */
|
|
27
|
+
private noteFailure;
|
|
12
28
|
export(spans: ReadableSpan[], resultCallback: (result: ExportResult) => void): void;
|
|
29
|
+
/**
|
|
30
|
+
* The wrapped call can fail in two ways and only one of them was handled: `try/catch` catches a
|
|
31
|
+
* synchronous throw, but these methods RETURN the wrapped exporter's promise, so a rejection
|
|
32
|
+
* escaped this class entirely as an unhandled rejection (COA-2187). And both swallowed the
|
|
33
|
+
* failure with no message at all — a flush that drops the last batch on shutdown is exactly the
|
|
34
|
+
* one worth knowing about.
|
|
35
|
+
*/
|
|
36
|
+
private guard;
|
|
13
37
|
shutdown(): Promise<void>;
|
|
14
38
|
forceFlush(): Promise<void>;
|
|
15
39
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"safe-exporter.d.ts","sourceRoot":"","sources":["../src/safe-exporter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAC;AAEhF,UAAU,YAAY;IACpB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,KAAK,CAAC;CACf;AAGD,qBAAa,oBAAqB,YAAW,YAAY;IACvD,OAAO,CAAC,QAAQ,CAAC,eAAe,CAAe;IAC/C,OAAO,CAAC,QAAQ,CAAC,cAAc,CAAU;IACzC,OAAO,CAAC,UAAU,CAAK;IACvB,OAAO,CAAC,QAAQ,CAAC,eAAe,CAAK;
|
|
1
|
+
{"version":3,"file":"safe-exporter.d.ts","sourceRoot":"","sources":["../src/safe-exporter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAC;AAEhF,UAAU,YAAY;IACpB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,KAAK,CAAC;CACf;AAGD;;;;;;;;;;;GAWG;AACH,qBAAa,oBAAqB,YAAW,YAAY;IACvD,OAAO,CAAC,QAAQ,CAAC,eAAe,CAAe;IAC/C,OAAO,CAAC,QAAQ,CAAC,cAAc,CAAU;IACzC,OAAO,CAAC,UAAU,CAAK;IACvB,OAAO,CAAC,QAAQ,CAAC,eAAe,CAAK;IACrC,yFAAyF;IACzF,OAAO,CAAC,QAAQ,CAAC,cAAc,CAAO;gBAE1B,eAAe,EAAE,YAAY,EAAE,cAAc,UAAO;IAKhE,qFAAqF;IACrF,OAAO,CAAC,WAAW;IAmBnB,MAAM,CAAC,KAAK,EAAE,YAAY,EAAE,EAAE,cAAc,EAAE,CAAC,MAAM,EAAE,YAAY,KAAK,IAAI,GAAG,IAAI;IAmBnF;;;;;;OAMG;IACH,OAAO,CAAC,KAAK;IAab,QAAQ,IAAI,OAAO,CAAC,IAAI,CAAC;IAIzB,UAAU,IAAI,OAAO,CAAC,IAAI,CAAC;CAG5B"}
|
package/dist/safe-exporter.js
CHANGED
|
@@ -1,24 +1,48 @@
|
|
|
1
1
|
const ExportResultCode = { SUCCESS: 0, FAILED: 1 };
|
|
2
|
+
/**
|
|
3
|
+
* Never let a broken telemetry endpoint break the customer's agent — but never go quiet about it
|
|
4
|
+
* either (COA-2187, matching the Python SDK's COA-1145).
|
|
5
|
+
*
|
|
6
|
+
* This used to log the first three failures and then say nothing for the life of the process. A
|
|
7
|
+
* long-running agent whose key is rotated at hour six produced three warnings that scrolled past in
|
|
8
|
+
* a busy log, and then **absolute silence while 100% of its spans were discarded**. The customer's
|
|
9
|
+
* dashboard went flat and they opened a ticket saying our platform had lost their data.
|
|
10
|
+
*
|
|
11
|
+
* So: the first few, then a heartbeat, exactly as the Python SDK does — the point of the heartbeat
|
|
12
|
+
* is that a key which breaks mid-run still surfaces, not only the failures at startup.
|
|
13
|
+
*/
|
|
2
14
|
export class SafeOTLPSpanExporter {
|
|
3
15
|
wrappedExporter;
|
|
4
16
|
suppressErrors;
|
|
5
17
|
errorCount = 0;
|
|
6
18
|
maxLoggedErrors = 3;
|
|
19
|
+
/** After the initial burst, re-log every Nth failure. Same cadence as the Python SDK. */
|
|
20
|
+
heartbeatEvery = 500;
|
|
7
21
|
constructor(wrappedExporter, suppressErrors = true) {
|
|
8
22
|
this.wrappedExporter = wrappedExporter;
|
|
9
23
|
this.suppressErrors = suppressErrors;
|
|
10
24
|
}
|
|
25
|
+
/** Log an export failure, rate-limited: the first few, then a periodic heartbeat. */
|
|
26
|
+
noteFailure(spanCount, detail) {
|
|
27
|
+
this.errorCount++;
|
|
28
|
+
if (this.errorCount <= this.maxLoggedErrors) {
|
|
29
|
+
console.warn(`[coalex] Failed to export ${spanCount} spans (failure #${this.errorCount}): ${detail}`);
|
|
30
|
+
if (this.errorCount === this.maxLoggedErrors) {
|
|
31
|
+
console.warn(`[coalex] Suppressing further span export warnings (total so far: ${this.errorCount}). ` +
|
|
32
|
+
"Tracing will continue but spans may be dropped — check the Coalex endpoint/API key.");
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
else if (this.errorCount % this.heartbeatEvery === 0) {
|
|
36
|
+
console.warn(`[coalex] Span export still failing: ${this.errorCount} failed batches so far (${detail}).`);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
11
39
|
export(spans, resultCallback) {
|
|
12
40
|
try {
|
|
13
41
|
this.wrappedExporter.export(spans, (result) => {
|
|
14
42
|
if (result.code === ExportResultCode.FAILED && this.suppressErrors) {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
if (this.errorCount === this.maxLoggedErrors) {
|
|
19
|
-
console.warn(`[coalex] Suppressing further span export errors (total so far: ${this.errorCount}).`);
|
|
20
|
-
}
|
|
21
|
-
}
|
|
43
|
+
// The OTLP exporter does NOT throw on an auth/HTTP error or a timeout — it reports
|
|
44
|
+
// FAILED. Surfacing that is the whole reason this wrapper exists.
|
|
45
|
+
this.noteFailure(spans.length, result.error?.message ?? "unknown error");
|
|
22
46
|
resultCallback({ code: ExportResultCode.SUCCESS });
|
|
23
47
|
}
|
|
24
48
|
else {
|
|
@@ -29,36 +53,37 @@ export class SafeOTLPSpanExporter {
|
|
|
29
53
|
catch (e) {
|
|
30
54
|
if (!this.suppressErrors)
|
|
31
55
|
throw e;
|
|
32
|
-
this.
|
|
33
|
-
if (this.errorCount <= this.maxLoggedErrors) {
|
|
34
|
-
const msg = e instanceof Error ? e.message : String(e);
|
|
35
|
-
console.warn(`[coalex] Failed to export ${spans.length} spans (error #${this.errorCount}): ${msg}`);
|
|
36
|
-
if (this.errorCount === this.maxLoggedErrors) {
|
|
37
|
-
console.warn(`[coalex] Suppressing further span export errors (total so far: ${this.errorCount}).`);
|
|
38
|
-
}
|
|
39
|
-
}
|
|
56
|
+
this.noteFailure(spans.length, e instanceof Error ? e.message : String(e));
|
|
40
57
|
resultCallback({ code: ExportResultCode.SUCCESS });
|
|
41
58
|
}
|
|
42
59
|
}
|
|
43
|
-
|
|
60
|
+
/**
|
|
61
|
+
* The wrapped call can fail in two ways and only one of them was handled: `try/catch` catches a
|
|
62
|
+
* synchronous throw, but these methods RETURN the wrapped exporter's promise, so a rejection
|
|
63
|
+
* escaped this class entirely as an unhandled rejection (COA-2187). And both swallowed the
|
|
64
|
+
* failure with no message at all — a flush that drops the last batch on shutdown is exactly the
|
|
65
|
+
* one worth knowing about.
|
|
66
|
+
*/
|
|
67
|
+
guard(operation, run) {
|
|
44
68
|
try {
|
|
45
|
-
return
|
|
69
|
+
return run().catch((e) => {
|
|
70
|
+
if (!this.suppressErrors)
|
|
71
|
+
throw e;
|
|
72
|
+
console.warn(`[coalex] span exporter ${operation} failed: ${e instanceof Error ? e.message : String(e)}`);
|
|
73
|
+
});
|
|
46
74
|
}
|
|
47
75
|
catch (e) {
|
|
48
76
|
if (!this.suppressErrors)
|
|
49
77
|
throw e;
|
|
78
|
+
console.warn(`[coalex] span exporter ${operation} failed: ${e instanceof Error ? e.message : String(e)}`);
|
|
50
79
|
return Promise.resolve();
|
|
51
80
|
}
|
|
52
81
|
}
|
|
82
|
+
shutdown() {
|
|
83
|
+
return this.guard("shutdown", () => this.wrappedExporter.shutdown());
|
|
84
|
+
}
|
|
53
85
|
forceFlush() {
|
|
54
|
-
|
|
55
|
-
return this.wrappedExporter.forceFlush?.() ?? Promise.resolve();
|
|
56
|
-
}
|
|
57
|
-
catch (e) {
|
|
58
|
-
if (!this.suppressErrors)
|
|
59
|
-
throw e;
|
|
60
|
-
return Promise.resolve();
|
|
61
|
-
}
|
|
86
|
+
return this.guard("forceFlush", () => this.wrappedExporter.forceFlush?.() ?? Promise.resolve());
|
|
62
87
|
}
|
|
63
88
|
}
|
|
64
89
|
//# sourceMappingURL=safe-exporter.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"safe-exporter.js","sourceRoot":"","sources":["../src/safe-exporter.ts"],"names":[],"mappings":"AAMA,MAAM,gBAAgB,GAAG,EAAE,OAAO,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAW,CAAC;AAE5D,MAAM,OAAO,oBAAoB;IACd,eAAe,CAAe;IAC9B,cAAc,CAAU;IACjC,UAAU,GAAG,CAAC,CAAC;IACN,eAAe,GAAG,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"safe-exporter.js","sourceRoot":"","sources":["../src/safe-exporter.ts"],"names":[],"mappings":"AAMA,MAAM,gBAAgB,GAAG,EAAE,OAAO,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAW,CAAC;AAE5D;;;;;;;;;;;GAWG;AACH,MAAM,OAAO,oBAAoB;IACd,eAAe,CAAe;IAC9B,cAAc,CAAU;IACjC,UAAU,GAAG,CAAC,CAAC;IACN,eAAe,GAAG,CAAC,CAAC;IACrC,yFAAyF;IACxE,cAAc,GAAG,GAAG,CAAC;IAEtC,YAAY,eAA6B,EAAE,cAAc,GAAG,IAAI;QAC9D,IAAI,CAAC,eAAe,GAAG,eAAe,CAAC;QACvC,IAAI,CAAC,cAAc,GAAG,cAAc,CAAC;IACvC,CAAC;IAED,qFAAqF;IAC7E,WAAW,CAAC,SAAiB,EAAE,MAAc;QACnD,IAAI,CAAC,UAAU,EAAE,CAAC;QAClB,IAAI,IAAI,CAAC,UAAU,IAAI,IAAI,CAAC,eAAe,EAAE,CAAC;YAC5C,OAAO,CAAC,IAAI,CACV,6BAA6B,SAAS,oBAAoB,IAAI,CAAC,UAAU,MAAM,MAAM,EAAE,CACxF,CAAC;YACF,IAAI,IAAI,CAAC,UAAU,KAAK,IAAI,CAAC,eAAe,EAAE,CAAC;gBAC7C,OAAO,CAAC,IAAI,CACV,oEAAoE,IAAI,CAAC,UAAU,KAAK;oBACtF,qFAAqF,CACxF,CAAC;YACJ,CAAC;QACH,CAAC;a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;gBAChC,IAAI,CAAC,IAAI,CAAC,cAAc;oBAAE,MAAM,CAAC,CAAC;gBAClC,OAAO,CAAC,IAAI,CAAC,0BAA0B,SAAS,YAAY,CAAC,YAAY,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;YAC5G,CAAC,CAAC,CAAC;QACL,CAAC;QAAC,OAAO,CAAU,EAAE,CAAC;YACpB,IAAI,CAAC,IAAI,CAAC,cAAc;gBAAE,MAAM,CAAC,CAAC;YAClC,OAAO,CAAC,IAAI,CAAC,0BAA0B,SAAS,YAAY,CAAC,YAAY,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;YAC1G,OAAO,OAAO,CAAC,OAAO,EAAE,CAAC;QAC3B,CAAC;IACH,CAAC;IAED,QAAQ;QACN,OAAO,IAAI,CAAC,KAAK,CAAC,UAAU,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,eAAe,CAAC,QAAQ,EAAE,CAAC,CAAC;IACvE,CAAC;IAED,UAAU;QACR,OAAO,IAAI,CAAC,KAAK,CAAC,YAAY,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,eAAe,CAAC,UAAU,EAAE,EAAE,IAAI,OAAO,CAAC,OAAO,EAAE,CAAC,CAAC;IAClG,CAAC;CACF"}
|
package/dist/version.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const VERSION = "1.
|
|
1
|
+
export declare const VERSION = "1.16.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.16.0";
|
|
5
5
|
//# sourceMappingURL=version.js.map
|