@oxygen-agent/cli 1.1011.98 → 1.1011.322
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/admin-primary-providers-render.js +25 -5
- package/dist/column-run-notices.d.ts +16 -0
- package/dist/column-run-notices.js +57 -0
- package/dist/command-manifest.js +10 -1
- package/dist/connectors-commands.d.ts +11 -0
- package/dist/connectors-commands.js +63 -0
- package/dist/help.d.ts +27 -1
- package/dist/help.js +112 -29
- package/dist/http-client.js +8 -0
- package/dist/index.js +362 -130
- package/node_modules/@oxygen/cli-ugc/dist/commands.js +20 -69
- package/node_modules/@oxygen/shared/dist/byok-connect.d.ts +6 -4
- package/node_modules/@oxygen/shared/dist/byok-connect.js +11 -4
- package/node_modules/@oxygen/shared/dist/capability-discovery.d.ts +131 -1
- package/node_modules/@oxygen/shared/dist/capability-discovery.js +325 -30
- package/node_modules/@oxygen/shared/dist/collab.d.ts +1 -1
- package/node_modules/@oxygen/shared/dist/collab.js +12 -0
- package/node_modules/@oxygen/shared/dist/column-decision.js +7 -3
- package/node_modules/@oxygen/shared/dist/column-output-fields.js +45 -3
- package/node_modules/@oxygen/shared/dist/company-enrichment-fields.d.ts +20 -13
- package/node_modules/@oxygen/shared/dist/company-enrichment-fields.js +29 -13
- package/node_modules/@oxygen/shared/dist/contracts/connectors.d.ts +23 -0
- package/node_modules/@oxygen/shared/dist/contracts/connectors.js +34 -0
- package/node_modules/@oxygen/shared/dist/contracts/operations.d.ts +0 -6
- package/node_modules/@oxygen/shared/dist/contracts/operations.js +8 -1
- package/node_modules/@oxygen/shared/dist/contracts/sender-limits.js +1 -1
- package/node_modules/@oxygen/shared/dist/copilot-skills.generated.d.ts +2 -2
- package/node_modules/@oxygen/shared/dist/copilot-skills.generated.js +2 -2
- package/node_modules/@oxygen/shared/dist/credit-guidance.js +12 -1
- package/node_modules/@oxygen/shared/dist/enrichment-intents.d.ts +37 -0
- package/node_modules/@oxygen/shared/dist/enrichment-intents.js +79 -44
- package/node_modules/@oxygen/shared/dist/feature-gates.d.ts +5 -0
- package/node_modules/@oxygen/shared/dist/feature-gates.js +6 -0
- package/node_modules/@oxygen/shared/dist/knowledge-bootstrap.d.ts +57 -8
- package/node_modules/@oxygen/shared/dist/knowledge-bootstrap.js +74 -13
- package/node_modules/@oxygen/shared/dist/linkedin-url.d.ts +7 -0
- package/node_modules/@oxygen/shared/dist/linkedin-url.js +9 -0
- package/node_modules/@oxygen/shared/dist/log.d.ts +1 -0
- package/node_modules/@oxygen/shared/dist/log.js +15 -0
- package/node_modules/@oxygen/shared/dist/mcp-event-contract.d.ts +597 -0
- package/node_modules/@oxygen/shared/dist/mcp-event-contract.js +713 -0
- package/node_modules/@oxygen/shared/dist/mcp-events-enabled.d.ts +2 -0
- package/node_modules/@oxygen/shared/dist/mcp-events-enabled.js +14 -0
- package/node_modules/@oxygen/shared/dist/operational-telemetry.d.ts +1 -0
- package/node_modules/@oxygen/shared/dist/operational-telemetry.js +6 -2
- package/node_modules/@oxygen/shared/dist/otlp-log-sink.d.ts +7 -3
- package/node_modules/@oxygen/shared/dist/otlp-log-sink.js +22 -1
- package/node_modules/@oxygen/shared/dist/plan-limits.d.ts +3 -7
- package/node_modules/@oxygen/shared/dist/plan-limits.js +2 -14
- package/node_modules/@oxygen/shared/dist/select-options.d.ts +6 -0
- package/node_modules/@oxygen/shared/dist/select-options.js +6 -1
- package/node_modules/@oxygen/shared/dist/sending-schedule.d.ts +39 -0
- package/node_modules/@oxygen/shared/dist/sending-schedule.js +41 -0
- package/node_modules/@oxygen/shared/dist/sequence-lifecycle.d.ts +19 -0
- package/node_modules/@oxygen/shared/dist/sequence-lifecycle.js +20 -0
- package/node_modules/@oxygen/shared/dist/sequence-sender-variables.d.ts +35 -0
- package/node_modules/@oxygen/shared/dist/sequence-sender-variables.js +63 -0
- package/node_modules/@oxygen/shared/dist/sequences.d.ts +13 -7
- package/node_modules/@oxygen/shared/dist/sequences.js +26 -0
- package/node_modules/@oxygen/shared/dist/signup-lead-payload.d.ts +2 -0
- package/node_modules/@oxygen/shared/dist/signup-lead-payload.js +5 -0
- package/node_modules/@oxygen/shared/dist/social-post-metrics-series.js +1 -15
- package/node_modules/@oxygen/shared/dist/standard-webhooks.d.ts +51 -0
- package/node_modules/@oxygen/shared/dist/standard-webhooks.js +124 -0
- package/node_modules/@oxygen/shared/dist/tags.d.ts +1 -1
- package/node_modules/@oxygen/shared/dist/tags.js +13 -1
- package/node_modules/@oxygen/shared/dist/ugc.d.ts +11 -7
- package/node_modules/@oxygen/shared/dist/ugc.js +14 -6
- package/node_modules/@oxygen/shared/dist/version.generated.d.ts +1 -1
- package/node_modules/@oxygen/shared/dist/version.generated.js +1 -1
- package/node_modules/@oxygen/shared/dist/zoned-time.d.ts +39 -0
- package/node_modules/@oxygen/shared/dist/zoned-time.js +81 -0
- package/package.json +1 -1
|
@@ -115,6 +115,17 @@ export function logLevelForHttpStatus(status) {
|
|
|
115
115
|
// object all bundle copies share; Symbol.for gives every copy the same slot.
|
|
116
116
|
// Same trap + same fix as linkedin-quota's enforcer registration.
|
|
117
117
|
const LOG_SINK_SLOT = Symbol.for("oxygen.log.sink");
|
|
118
|
+
const WEB_LOG_VOLUME_SLOT = Symbol.for("oxygen.log.web-volume");
|
|
119
|
+
// Count the same web records eligible for the log sink before the OTLP WARN
|
|
120
|
+
// floor discards INFO. The slot must be shared across Next.js route bundles and
|
|
121
|
+
// instrumentation, just like LOG_SINK_SLOT. A one-minute summary lets SigNoz
|
|
122
|
+
// detect a fall in total logging without storing every INFO record.
|
|
123
|
+
export function takeWebLogVolumeCount() {
|
|
124
|
+
const carrier = globalThis;
|
|
125
|
+
const count = carrier[WEB_LOG_VOLUME_SLOT] ?? 0;
|
|
126
|
+
carrier[WEB_LOG_VOLUME_SLOT] = 0;
|
|
127
|
+
return count;
|
|
128
|
+
}
|
|
118
129
|
export function setLogSink(sink) {
|
|
119
130
|
globalThis[LOG_SINK_SLOT] = sink;
|
|
120
131
|
}
|
|
@@ -188,6 +199,10 @@ export function log(level, msg, fields) {
|
|
|
188
199
|
const logSink = getLogSink();
|
|
189
200
|
if (!logSink)
|
|
190
201
|
return;
|
|
202
|
+
if (record.service_name === "oxygen-web" && msg !== "web.log_volume") {
|
|
203
|
+
const carrier = globalThis;
|
|
204
|
+
carrier[WEB_LOG_VOLUME_SLOT] = (carrier[WEB_LOG_VOLUME_SLOT] ?? 0) + 1;
|
|
205
|
+
}
|
|
191
206
|
try {
|
|
192
207
|
logSink(record);
|
|
193
208
|
}
|
|
@@ -0,0 +1,597 @@
|
|
|
1
|
+
import { type ContractIssue, type ContractObject, type Infer } from "./contracts/schema.js";
|
|
2
|
+
/** OpenAI MCP Events: one event per request, and the whole request body at most 256 KiB. */
|
|
3
|
+
export declare const MCP_EVENT_MAX_BODY_BYTES = 262144;
|
|
4
|
+
export declare const MCP_EVENT_NAMES: readonly ["reply.classified", "enrollment.ended", "meeting.completed", "record.stage_changed", "run.settled", "approval.requested"];
|
|
5
|
+
export type McpEventName = (typeof MCP_EVENT_NAMES)[number];
|
|
6
|
+
/** The events a workspace event ledger row (`ox_runs.workflow_events`) projects into. */
|
|
7
|
+
export type McpCatalogEventName = Extract<McpEventName, "reply.classified" | "enrollment.ended" | "meeting.completed" | "record.stage_changed">;
|
|
8
|
+
/**
|
|
9
|
+
* How OXYGEN classified a reply. The first six are the Inbox labels the
|
|
10
|
+
* classifier sets, and `bounced` is set when the bounce arrives. A label the
|
|
11
|
+
* workspace defined is `other`, because its key is workspace-authored text; a
|
|
12
|
+
* one-click email unsubscribe, which has no reply, is `unsubscribed`.
|
|
13
|
+
*/
|
|
14
|
+
export declare const MCP_REPLY_CLASSIFICATIONS: readonly ["interested", "neutral", "not_now", "not_interested", "out_of_office", "wrong_person", "bounced", "unsubscribed", "other"];
|
|
15
|
+
export type McpReplyClassification = (typeof MCP_REPLY_CLASSIFICATIONS)[number];
|
|
16
|
+
export declare const MCP_REPLY_CHANNELS: readonly ["email", "linkedin", "whatsapp"];
|
|
17
|
+
/** How an enrollment ended: the Sequencer's own terminal statuses. */
|
|
18
|
+
export declare const MCP_ENROLLMENT_OUTCOMES: readonly ["completed", "replied", "stopped", "failed", "excluded"];
|
|
19
|
+
/** The run ledgers `run_outcome_analytics` reads (`SettledRunKind` in @oxygen/tenant-db). */
|
|
20
|
+
export declare const MCP_RUN_KINDS: readonly ["workflow", "table_action", "table_ingestion", "agent", "copilot_turn"];
|
|
21
|
+
export type McpRunKind = (typeof MCP_RUN_KINDS)[number];
|
|
22
|
+
/**
|
|
23
|
+
* Every terminal status those ledgers write, with one spelling of cancel:
|
|
24
|
+
* Workflow and Table runs write `canceled`, Agent runs and Copilot turns `cancelled`.
|
|
25
|
+
*/
|
|
26
|
+
export declare const MCP_RUN_STATUSES: readonly ["completed", "completed_with_errors", "failed", "canceled", "budget_exhausted", "effect_unknown"];
|
|
27
|
+
export type McpRunStatus = (typeof MCP_RUN_STATUSES)[number];
|
|
28
|
+
export declare const MCP_APPROVAL_KINDS: readonly ["workflow", "agent"];
|
|
29
|
+
export type McpApprovalKind = (typeof MCP_APPROVAL_KINDS)[number];
|
|
30
|
+
declare const REPLY_CLASSIFIED_PAYLOAD: ContractObject<{
|
|
31
|
+
readonly classification: {
|
|
32
|
+
type: "string";
|
|
33
|
+
enum: readonly ("bounced" | "interested" | "neutral" | "not_interested" | "not_now" | "other" | "out_of_office" | "unsubscribed" | "wrong_person")[];
|
|
34
|
+
description?: string;
|
|
35
|
+
};
|
|
36
|
+
readonly channel: {
|
|
37
|
+
type: "string";
|
|
38
|
+
enum: readonly ("email" | "linkedin" | "whatsapp")[];
|
|
39
|
+
description?: string;
|
|
40
|
+
};
|
|
41
|
+
readonly conversation_id: {
|
|
42
|
+
oneOf: [{
|
|
43
|
+
type: "string";
|
|
44
|
+
description?: string;
|
|
45
|
+
enum?: readonly string[];
|
|
46
|
+
minLength?: number;
|
|
47
|
+
maxLength?: number;
|
|
48
|
+
pattern: string;
|
|
49
|
+
}, import("./contracts/schema.js").NullProperty];
|
|
50
|
+
description?: string;
|
|
51
|
+
};
|
|
52
|
+
readonly record_id: {
|
|
53
|
+
oneOf: [{
|
|
54
|
+
type: "string";
|
|
55
|
+
description?: string;
|
|
56
|
+
enum?: readonly string[];
|
|
57
|
+
minLength?: number;
|
|
58
|
+
maxLength?: number;
|
|
59
|
+
pattern: string;
|
|
60
|
+
}, import("./contracts/schema.js").NullProperty];
|
|
61
|
+
description?: string;
|
|
62
|
+
};
|
|
63
|
+
readonly sequence_id: {
|
|
64
|
+
oneOf: [{
|
|
65
|
+
type: "string";
|
|
66
|
+
description?: string;
|
|
67
|
+
enum?: readonly string[];
|
|
68
|
+
minLength?: number;
|
|
69
|
+
maxLength?: number;
|
|
70
|
+
pattern: string;
|
|
71
|
+
}, import("./contracts/schema.js").NullProperty];
|
|
72
|
+
description?: string;
|
|
73
|
+
};
|
|
74
|
+
readonly enrollment_id: {
|
|
75
|
+
oneOf: [{
|
|
76
|
+
type: "string";
|
|
77
|
+
description?: string;
|
|
78
|
+
enum?: readonly string[];
|
|
79
|
+
minLength?: number;
|
|
80
|
+
maxLength?: number;
|
|
81
|
+
pattern: string;
|
|
82
|
+
}, import("./contracts/schema.js").NullProperty];
|
|
83
|
+
description?: string;
|
|
84
|
+
};
|
|
85
|
+
readonly occurred_at: {
|
|
86
|
+
type: "string";
|
|
87
|
+
description?: string;
|
|
88
|
+
enum?: readonly string[];
|
|
89
|
+
minLength?: number;
|
|
90
|
+
maxLength?: number;
|
|
91
|
+
format: "date-time";
|
|
92
|
+
};
|
|
93
|
+
readonly url: {
|
|
94
|
+
type: "string";
|
|
95
|
+
description?: string;
|
|
96
|
+
enum?: readonly string[];
|
|
97
|
+
minLength?: number;
|
|
98
|
+
maxLength?: number;
|
|
99
|
+
format: "uri";
|
|
100
|
+
};
|
|
101
|
+
}, "channel" | "classification" | "conversation_id" | "enrollment_id" | "occurred_at" | "record_id" | "sequence_id" | "url">;
|
|
102
|
+
declare const ENROLLMENT_ENDED_PAYLOAD: ContractObject<{
|
|
103
|
+
readonly outcome: {
|
|
104
|
+
type: "string";
|
|
105
|
+
enum: readonly ("completed" | "excluded" | "failed" | "replied" | "stopped")[];
|
|
106
|
+
description?: string;
|
|
107
|
+
};
|
|
108
|
+
readonly steps_sent: {
|
|
109
|
+
oneOf: [{
|
|
110
|
+
type: "integer";
|
|
111
|
+
description?: string;
|
|
112
|
+
minimum?: number;
|
|
113
|
+
maximum?: number;
|
|
114
|
+
"x-clamp"?: true;
|
|
115
|
+
}, import("./contracts/schema.js").NullProperty];
|
|
116
|
+
description?: string;
|
|
117
|
+
};
|
|
118
|
+
readonly sequence_id: {
|
|
119
|
+
type: "string";
|
|
120
|
+
description?: string;
|
|
121
|
+
enum?: readonly string[];
|
|
122
|
+
minLength?: number;
|
|
123
|
+
maxLength?: number;
|
|
124
|
+
pattern: string;
|
|
125
|
+
};
|
|
126
|
+
readonly enrollment_id: {
|
|
127
|
+
type: "string";
|
|
128
|
+
description?: string;
|
|
129
|
+
enum?: readonly string[];
|
|
130
|
+
minLength?: number;
|
|
131
|
+
maxLength?: number;
|
|
132
|
+
pattern: string;
|
|
133
|
+
};
|
|
134
|
+
readonly occurred_at: {
|
|
135
|
+
type: "string";
|
|
136
|
+
description?: string;
|
|
137
|
+
enum?: readonly string[];
|
|
138
|
+
minLength?: number;
|
|
139
|
+
maxLength?: number;
|
|
140
|
+
format: "date-time";
|
|
141
|
+
};
|
|
142
|
+
readonly url: {
|
|
143
|
+
type: "string";
|
|
144
|
+
description?: string;
|
|
145
|
+
enum?: readonly string[];
|
|
146
|
+
minLength?: number;
|
|
147
|
+
maxLength?: number;
|
|
148
|
+
format: "uri";
|
|
149
|
+
};
|
|
150
|
+
}, "enrollment_id" | "occurred_at" | "outcome" | "sequence_id" | "steps_sent" | "url">;
|
|
151
|
+
declare const MEETING_COMPLETED_PAYLOAD: ContractObject<{
|
|
152
|
+
readonly session_id: {
|
|
153
|
+
type: "string";
|
|
154
|
+
description?: string;
|
|
155
|
+
enum?: readonly string[];
|
|
156
|
+
minLength?: number;
|
|
157
|
+
maxLength?: number;
|
|
158
|
+
pattern: string;
|
|
159
|
+
};
|
|
160
|
+
readonly duration_seconds: {
|
|
161
|
+
oneOf: [{
|
|
162
|
+
type: "integer";
|
|
163
|
+
description?: string;
|
|
164
|
+
minimum?: number;
|
|
165
|
+
maximum?: number;
|
|
166
|
+
"x-clamp"?: true;
|
|
167
|
+
}, import("./contracts/schema.js").NullProperty];
|
|
168
|
+
description?: string;
|
|
169
|
+
};
|
|
170
|
+
readonly record_ids: {
|
|
171
|
+
readonly type: "array";
|
|
172
|
+
readonly description?: string;
|
|
173
|
+
readonly items: {
|
|
174
|
+
type: "string";
|
|
175
|
+
description?: string;
|
|
176
|
+
enum?: readonly string[];
|
|
177
|
+
minLength?: number;
|
|
178
|
+
maxLength?: number;
|
|
179
|
+
pattern: string;
|
|
180
|
+
};
|
|
181
|
+
readonly minItems?: number;
|
|
182
|
+
readonly maxItems?: number;
|
|
183
|
+
readonly uniqueItems: true;
|
|
184
|
+
};
|
|
185
|
+
readonly activity_id: {
|
|
186
|
+
oneOf: [{
|
|
187
|
+
type: "string";
|
|
188
|
+
description?: string;
|
|
189
|
+
enum?: readonly string[];
|
|
190
|
+
minLength?: number;
|
|
191
|
+
maxLength?: number;
|
|
192
|
+
pattern: string;
|
|
193
|
+
}, import("./contracts/schema.js").NullProperty];
|
|
194
|
+
description?: string;
|
|
195
|
+
};
|
|
196
|
+
readonly occurred_at: {
|
|
197
|
+
type: "string";
|
|
198
|
+
description?: string;
|
|
199
|
+
enum?: readonly string[];
|
|
200
|
+
minLength?: number;
|
|
201
|
+
maxLength?: number;
|
|
202
|
+
format: "date-time";
|
|
203
|
+
};
|
|
204
|
+
readonly url: {
|
|
205
|
+
type: "string";
|
|
206
|
+
description?: string;
|
|
207
|
+
enum?: readonly string[];
|
|
208
|
+
minLength?: number;
|
|
209
|
+
maxLength?: number;
|
|
210
|
+
format: "uri";
|
|
211
|
+
};
|
|
212
|
+
}, "activity_id" | "duration_seconds" | "occurred_at" | "record_ids" | "session_id" | "url">;
|
|
213
|
+
declare const RECORD_STAGE_CHANGED_PAYLOAD: ContractObject<{
|
|
214
|
+
readonly object: {
|
|
215
|
+
type: "string";
|
|
216
|
+
description?: string;
|
|
217
|
+
enum?: readonly string[];
|
|
218
|
+
minLength?: number;
|
|
219
|
+
maxLength?: number;
|
|
220
|
+
pattern: string;
|
|
221
|
+
};
|
|
222
|
+
readonly record_id: {
|
|
223
|
+
type: "string";
|
|
224
|
+
description?: string;
|
|
225
|
+
enum?: readonly string[];
|
|
226
|
+
minLength?: number;
|
|
227
|
+
maxLength?: number;
|
|
228
|
+
pattern: string;
|
|
229
|
+
};
|
|
230
|
+
readonly pipeline_id: {
|
|
231
|
+
type: "string";
|
|
232
|
+
description?: string;
|
|
233
|
+
enum?: readonly string[];
|
|
234
|
+
minLength?: number;
|
|
235
|
+
maxLength?: number;
|
|
236
|
+
pattern: string;
|
|
237
|
+
};
|
|
238
|
+
readonly from_stage_id: {
|
|
239
|
+
oneOf: [{
|
|
240
|
+
type: "string";
|
|
241
|
+
description?: string;
|
|
242
|
+
enum?: readonly string[];
|
|
243
|
+
minLength?: number;
|
|
244
|
+
maxLength?: number;
|
|
245
|
+
pattern: string;
|
|
246
|
+
}, import("./contracts/schema.js").NullProperty];
|
|
247
|
+
description?: string;
|
|
248
|
+
};
|
|
249
|
+
readonly to_stage_id: {
|
|
250
|
+
oneOf: [{
|
|
251
|
+
type: "string";
|
|
252
|
+
description?: string;
|
|
253
|
+
enum?: readonly string[];
|
|
254
|
+
minLength?: number;
|
|
255
|
+
maxLength?: number;
|
|
256
|
+
pattern: string;
|
|
257
|
+
}, import("./contracts/schema.js").NullProperty];
|
|
258
|
+
description?: string;
|
|
259
|
+
};
|
|
260
|
+
readonly activity_id: {
|
|
261
|
+
type: "string";
|
|
262
|
+
description?: string;
|
|
263
|
+
enum?: readonly string[];
|
|
264
|
+
minLength?: number;
|
|
265
|
+
maxLength?: number;
|
|
266
|
+
pattern: string;
|
|
267
|
+
};
|
|
268
|
+
readonly occurred_at: {
|
|
269
|
+
type: "string";
|
|
270
|
+
description?: string;
|
|
271
|
+
enum?: readonly string[];
|
|
272
|
+
minLength?: number;
|
|
273
|
+
maxLength?: number;
|
|
274
|
+
format: "date-time";
|
|
275
|
+
};
|
|
276
|
+
readonly url: {
|
|
277
|
+
type: "string";
|
|
278
|
+
description?: string;
|
|
279
|
+
enum?: readonly string[];
|
|
280
|
+
minLength?: number;
|
|
281
|
+
maxLength?: number;
|
|
282
|
+
format: "uri";
|
|
283
|
+
};
|
|
284
|
+
}, "activity_id" | "from_stage_id" | "object" | "occurred_at" | "pipeline_id" | "record_id" | "to_stage_id" | "url">;
|
|
285
|
+
declare const RUN_SETTLED_PAYLOAD: ContractObject<{
|
|
286
|
+
readonly kind: {
|
|
287
|
+
type: "string";
|
|
288
|
+
enum: readonly ("agent" | "copilot_turn" | "table_action" | "table_ingestion" | "workflow")[];
|
|
289
|
+
description?: string;
|
|
290
|
+
};
|
|
291
|
+
readonly status: {
|
|
292
|
+
type: "string";
|
|
293
|
+
enum: readonly ("budget_exhausted" | "canceled" | "completed" | "completed_with_errors" | "effect_unknown" | "failed")[];
|
|
294
|
+
description?: string;
|
|
295
|
+
};
|
|
296
|
+
readonly run_id: {
|
|
297
|
+
type: "string";
|
|
298
|
+
description?: string;
|
|
299
|
+
enum?: readonly string[];
|
|
300
|
+
minLength?: number;
|
|
301
|
+
maxLength?: number;
|
|
302
|
+
pattern: string;
|
|
303
|
+
};
|
|
304
|
+
readonly credits_used: {
|
|
305
|
+
oneOf: [{
|
|
306
|
+
type: "number";
|
|
307
|
+
description?: string;
|
|
308
|
+
minimum?: number;
|
|
309
|
+
maximum?: number;
|
|
310
|
+
"x-clamp"?: true;
|
|
311
|
+
}, import("./contracts/schema.js").NullProperty];
|
|
312
|
+
description?: string;
|
|
313
|
+
};
|
|
314
|
+
readonly occurred_at: {
|
|
315
|
+
type: "string";
|
|
316
|
+
description?: string;
|
|
317
|
+
enum?: readonly string[];
|
|
318
|
+
minLength?: number;
|
|
319
|
+
maxLength?: number;
|
|
320
|
+
format: "date-time";
|
|
321
|
+
};
|
|
322
|
+
readonly url: {
|
|
323
|
+
type: "string";
|
|
324
|
+
description?: string;
|
|
325
|
+
enum?: readonly string[];
|
|
326
|
+
minLength?: number;
|
|
327
|
+
maxLength?: number;
|
|
328
|
+
format: "uri";
|
|
329
|
+
};
|
|
330
|
+
}, "credits_used" | "kind" | "occurred_at" | "run_id" | "status" | "url">;
|
|
331
|
+
declare const APPROVAL_REQUESTED_PAYLOAD: ContractObject<{
|
|
332
|
+
readonly kind: {
|
|
333
|
+
type: "string";
|
|
334
|
+
enum: readonly ("agent" | "workflow")[];
|
|
335
|
+
description?: string;
|
|
336
|
+
};
|
|
337
|
+
readonly approval_id: {
|
|
338
|
+
type: "string";
|
|
339
|
+
description?: string;
|
|
340
|
+
enum?: readonly string[];
|
|
341
|
+
minLength?: number;
|
|
342
|
+
maxLength?: number;
|
|
343
|
+
pattern: string;
|
|
344
|
+
};
|
|
345
|
+
readonly run_id: {
|
|
346
|
+
type: "string";
|
|
347
|
+
description?: string;
|
|
348
|
+
enum?: readonly string[];
|
|
349
|
+
minLength?: number;
|
|
350
|
+
maxLength?: number;
|
|
351
|
+
pattern: string;
|
|
352
|
+
};
|
|
353
|
+
readonly occurred_at: {
|
|
354
|
+
type: "string";
|
|
355
|
+
description?: string;
|
|
356
|
+
enum?: readonly string[];
|
|
357
|
+
minLength?: number;
|
|
358
|
+
maxLength?: number;
|
|
359
|
+
format: "date-time";
|
|
360
|
+
};
|
|
361
|
+
readonly url: {
|
|
362
|
+
type: "string";
|
|
363
|
+
description?: string;
|
|
364
|
+
enum?: readonly string[];
|
|
365
|
+
minLength?: number;
|
|
366
|
+
maxLength?: number;
|
|
367
|
+
format: "uri";
|
|
368
|
+
};
|
|
369
|
+
}, "approval_id" | "kind" | "occurred_at" | "run_id" | "url">;
|
|
370
|
+
export type McpReplyClassifiedPayload = Infer<typeof REPLY_CLASSIFIED_PAYLOAD>;
|
|
371
|
+
export type McpEnrollmentEndedPayload = Infer<typeof ENROLLMENT_ENDED_PAYLOAD>;
|
|
372
|
+
export type McpMeetingCompletedPayload = Infer<typeof MEETING_COMPLETED_PAYLOAD>;
|
|
373
|
+
export type McpRecordStageChangedPayload = Infer<typeof RECORD_STAGE_CHANGED_PAYLOAD>;
|
|
374
|
+
export type McpRunSettledPayload = Infer<typeof RUN_SETTLED_PAYLOAD>;
|
|
375
|
+
export type McpApprovalRequestedPayload = Infer<typeof APPROVAL_REQUESTED_PAYLOAD>;
|
|
376
|
+
/** The `data` object each event delivers. */
|
|
377
|
+
export type McpEventPayloads = {
|
|
378
|
+
"reply.classified": McpReplyClassifiedPayload;
|
|
379
|
+
"enrollment.ended": McpEnrollmentEndedPayload;
|
|
380
|
+
"meeting.completed": McpMeetingCompletedPayload;
|
|
381
|
+
"record.stage_changed": McpRecordStageChangedPayload;
|
|
382
|
+
"run.settled": McpRunSettledPayload;
|
|
383
|
+
"approval.requested": McpApprovalRequestedPayload;
|
|
384
|
+
};
|
|
385
|
+
/** One `events/list` entry, in the shape OpenAI's MCP Events contract defines. */
|
|
386
|
+
export type McpEventDefinition = {
|
|
387
|
+
readonly name: McpEventName;
|
|
388
|
+
readonly description: string;
|
|
389
|
+
readonly delivery: readonly ["webhook"];
|
|
390
|
+
/** The subscription arguments: every one an optional filter. */
|
|
391
|
+
readonly inputSchema: ContractObject;
|
|
392
|
+
/** The delivered `data` object. */
|
|
393
|
+
readonly payloadSchema: ContractObject;
|
|
394
|
+
};
|
|
395
|
+
/** What `events/list` answers, in this order. Plain JSON: nothing internal rides along. Read-only. */
|
|
396
|
+
export declare const MCP_EVENT_DEFINITIONS: readonly McpEventDefinition[];
|
|
397
|
+
export type McpEventFilterBinding = {
|
|
398
|
+
/** The payload field the argument is compared with. */
|
|
399
|
+
readonly field: string;
|
|
400
|
+
/** `equals`: the field holds the argument. `includes`: the field is a list that contains it. */
|
|
401
|
+
readonly match: "equals" | "includes";
|
|
402
|
+
};
|
|
403
|
+
/** How each subscription argument narrows delivery. Applied by OXYGEN before anything is sent. */
|
|
404
|
+
export declare const MCP_EVENT_FILTERS: {
|
|
405
|
+
readonly [N in McpEventName]: Readonly<Record<string, McpEventFilterBinding>>;
|
|
406
|
+
};
|
|
407
|
+
export type McpEventContractErrorCode = "unknown_event" | "invalid_arguments" | "invalid_callback_url" | "invalid_principal" | "invalid_source_event" | "invalid_payload" | "payload_too_large";
|
|
408
|
+
export type McpEventContractIssue = ContractIssue;
|
|
409
|
+
export declare class McpEventContractError extends Error {
|
|
410
|
+
readonly code: McpEventContractErrorCode;
|
|
411
|
+
/** -32011 or -32602 when the caller's request is at fault; null when OXYGEN's own data is. */
|
|
412
|
+
readonly jsonRpcCode: -32011 | -32602 | null;
|
|
413
|
+
readonly issues: readonly McpEventContractIssue[];
|
|
414
|
+
constructor(code: McpEventContractErrorCode, message: string, issues?: readonly McpEventContractIssue[]);
|
|
415
|
+
}
|
|
416
|
+
export declare function isMcpEventName(value: unknown): value is McpEventName;
|
|
417
|
+
/** The event's definition, or `unknown_event` (-32011). */
|
|
418
|
+
export declare function requireMcpEventDefinition(name: unknown): McpEventDefinition;
|
|
419
|
+
/** Validated filter values, keyed by argument, in sorted key order. Every v1 filter is a string. */
|
|
420
|
+
export type McpEventArguments = Readonly<Record<string, string>>;
|
|
421
|
+
/**
|
|
422
|
+
* Check `events/subscribe` and `events/unsubscribe` arguments against the
|
|
423
|
+
* event's closed `inputSchema`. Absent arguments and a `null` value both mean
|
|
424
|
+
* "no filter", as a model sends null for "any". An unknown key, a wrong type or
|
|
425
|
+
* a value outside an enum is `invalid_arguments` (-32602).
|
|
426
|
+
*/
|
|
427
|
+
export declare function validateMcpEventArguments(name: unknown, args: unknown): McpEventArguments;
|
|
428
|
+
/**
|
|
429
|
+
* The payload typed as the event's `data`, or `invalid_payload` when it breaks
|
|
430
|
+
* the closed `payloadSchema`: an unknown field, a missing one, a wrong type, a
|
|
431
|
+
* value outside an enum, or text where an id, timestamp or link belongs. The
|
|
432
|
+
* 256 KiB body cap is enforced where the body is serialized.
|
|
433
|
+
*/
|
|
434
|
+
export declare function assertMcpEventPayload<N extends McpEventName>(name: N, payload: unknown): McpEventPayloads[N];
|
|
435
|
+
/**
|
|
436
|
+
* Whether a subscription wants this delivery: every filter it set must match,
|
|
437
|
+
* and no filters match every event. Fails closed, as the Workflow trigger gate
|
|
438
|
+
* does (`matchesWorkflowEventFilters`): an unknown event, an argument this event
|
|
439
|
+
* does not filter on, or a non-string value never widens a subscription.
|
|
440
|
+
*/
|
|
441
|
+
export declare function mcpEventMatchesSubscription(input: {
|
|
442
|
+
name: unknown;
|
|
443
|
+
arguments: unknown;
|
|
444
|
+
payload: unknown;
|
|
445
|
+
}): boolean;
|
|
446
|
+
/** Who holds a subscription (ADR 0030 §2): one user's OAuth connection in one organization. */
|
|
447
|
+
export type McpEventPrincipal = {
|
|
448
|
+
organizationId: string;
|
|
449
|
+
userId: string;
|
|
450
|
+
/** The OAuth client of the connection, e.g. the ChatGPT connector. */
|
|
451
|
+
oauthClientId: string;
|
|
452
|
+
};
|
|
453
|
+
/**
|
|
454
|
+
* The deterministic subscription id: sha256 over the principal, the callback
|
|
455
|
+
* URL, the event name and the canonical arguments, so a repeated
|
|
456
|
+
* `events/subscribe` refreshes the subscription instead of duplicating it and
|
|
457
|
+
* `events/unsubscribe` finds it from the same inputs. Pass validated arguments.
|
|
458
|
+
*/
|
|
459
|
+
export declare function mcpEventSubscriptionId(input: {
|
|
460
|
+
principal: McpEventPrincipal;
|
|
461
|
+
callbackUrl: string;
|
|
462
|
+
name: McpEventName;
|
|
463
|
+
arguments?: Readonly<Record<string, unknown>> | null;
|
|
464
|
+
}): string;
|
|
465
|
+
/**
|
|
466
|
+
* The `eventId` (and `webhook-id`) of one event for one subscription, derived
|
|
467
|
+
* from the subscription id and the source event's durable key, e.g. its
|
|
468
|
+
* `workflow_events` row id. A redelivered job, a reader rescan or a crash
|
|
469
|
+
* between the POST and the journal therefore reuse the id the receiver
|
|
470
|
+
* deduplicates on (ADR 0030 §4).
|
|
471
|
+
*/
|
|
472
|
+
export declare function mcpEventDeliveryId(input: {
|
|
473
|
+
subscriptionId: string;
|
|
474
|
+
sourceEventKey: string;
|
|
475
|
+
}): string;
|
|
476
|
+
export type McpEventDelivery = {
|
|
477
|
+
/** The body's `eventId` and the `webhook-id` header; the same on every retry. */
|
|
478
|
+
eventId: string;
|
|
479
|
+
/** The exact bytes to sign and send, serialized once. */
|
|
480
|
+
body: string;
|
|
481
|
+
/** UTF-8 length of `body`. */
|
|
482
|
+
bytes: number;
|
|
483
|
+
};
|
|
484
|
+
/**
|
|
485
|
+
* The request body of one event delivery: `{eventId, name, timestamp, data,
|
|
486
|
+
* cursor: null}`, with `timestamp` the event's occurrence time (v1 has no
|
|
487
|
+
* replay, so `cursor` is always null). `data` must pass its schema, and a body
|
|
488
|
+
* over the cap is `payload_too_large` rather than a 413 from the receiver.
|
|
489
|
+
*/
|
|
490
|
+
export declare function serializeMcpEventDelivery<N extends McpEventName>(input: {
|
|
491
|
+
subscriptionId: string;
|
|
492
|
+
name: N;
|
|
493
|
+
sourceEventKey: string;
|
|
494
|
+
data: McpEventPayloads[N];
|
|
495
|
+
/** Defaults to {@link MCP_EVENT_MAX_BODY_BYTES}. */
|
|
496
|
+
maxBodyBytes?: number;
|
|
497
|
+
}): McpEventDelivery;
|
|
498
|
+
/**
|
|
499
|
+
* JSON with every object's keys sorted, so equal values serialize identically
|
|
500
|
+
* however their keys were ordered: the canonical form of stored subscription
|
|
501
|
+
* arguments and of every id hashed here. `undefined` members are dropped as
|
|
502
|
+
* JSON.stringify drops them; anything JSON cannot carry is refused.
|
|
503
|
+
*/
|
|
504
|
+
export declare function canonicalMcpEventJson(value: unknown): string;
|
|
505
|
+
/** Where a payload's deep link points. Defaults to the deployment's public app URL. */
|
|
506
|
+
export type McpEventLinkOptions = {
|
|
507
|
+
appBaseUrl?: string;
|
|
508
|
+
};
|
|
509
|
+
/** One `ox_runs.workflow_events` row as the MCP event reader holds it. */
|
|
510
|
+
export type McpWorkspaceEventRow = {
|
|
511
|
+
source: string;
|
|
512
|
+
/** The row's `event_type`. */
|
|
513
|
+
event: string;
|
|
514
|
+
payload: unknown;
|
|
515
|
+
metadata?: unknown;
|
|
516
|
+
/** The row's `received_at`: the occurrence time when the payload carries none. */
|
|
517
|
+
receivedAt: Date | string;
|
|
518
|
+
};
|
|
519
|
+
/**
|
|
520
|
+
* The v1 event a workspace event row is delivered as, or null. A manual emit
|
|
521
|
+
* is never delivered (ADR 0030 §8): it may name any source and event, so a
|
|
522
|
+
* subscriber would receive whatever a workspace member typed as if OXYGEN had
|
|
523
|
+
* observed it.
|
|
524
|
+
*/
|
|
525
|
+
export declare function mcpEventNameForWorkspaceEvent(row: Pick<McpWorkspaceEventRow, "source" | "event" | "payload" | "metadata">): McpCatalogEventName | null;
|
|
526
|
+
/**
|
|
527
|
+
* `crm / email_reply_classified` as `reply.classified`. The ledger names the
|
|
528
|
+
* lead only by contact details, so the reader passes the CRM person it matched.
|
|
529
|
+
*/
|
|
530
|
+
export declare function projectReplyClassifiedEvent(row: McpWorkspaceEventRow, context?: McpEventLinkOptions & {
|
|
531
|
+
record?: {
|
|
532
|
+
object: string;
|
|
533
|
+
id: string;
|
|
534
|
+
} | null;
|
|
535
|
+
}): McpReplyClassifiedPayload;
|
|
536
|
+
/**
|
|
537
|
+
* `sequencer / enrollment_terminal` as `enrollment.ended`. The outbox row does
|
|
538
|
+
* not count sends, so the reader passes the enrollment's sent steps.
|
|
539
|
+
*/
|
|
540
|
+
export declare function projectEnrollmentEndedEvent(row: McpWorkspaceEventRow, context: McpEventLinkOptions & {
|
|
541
|
+
stepsSent: number | null;
|
|
542
|
+
}): McpEnrollmentEndedPayload;
|
|
543
|
+
/** `oxygen.notetaker / meeting.completed` as `meeting.completed`. */
|
|
544
|
+
export declare function projectMeetingCompletedEvent(row: McpWorkspaceEventRow, context?: McpEventLinkOptions): McpMeetingCompletedPayload;
|
|
545
|
+
/**
|
|
546
|
+
* `crm / activity_created` of kind `stage_changed` as `record.stage_changed`.
|
|
547
|
+
* The activity stores the stage values; when the reader has not resolved their
|
|
548
|
+
* option ids (`stageIds`), each id is derived from its value as the option
|
|
549
|
+
* model derives an id the option did not declare (`slugifyOption`). The stock
|
|
550
|
+
* stages' ids equal their values, and a stage's name, workspace text, never
|
|
551
|
+
* leaves OXYGEN.
|
|
552
|
+
*/
|
|
553
|
+
export declare function projectRecordStageChangedEvent(row: McpWorkspaceEventRow, context?: McpEventLinkOptions & {
|
|
554
|
+
stageIds?: {
|
|
555
|
+
from: string | null;
|
|
556
|
+
to: string | null;
|
|
557
|
+
};
|
|
558
|
+
}): McpRecordStageChangedPayload;
|
|
559
|
+
type McpRunSettledCommon = {
|
|
560
|
+
runId: string;
|
|
561
|
+
/** The ledger's own terminal status. */
|
|
562
|
+
status: string;
|
|
563
|
+
/** Credits the run spent, when its ledger records a figure. */
|
|
564
|
+
creditsUsed: number | null;
|
|
565
|
+
settledAt: Date | string;
|
|
566
|
+
};
|
|
567
|
+
/** A settled run as the `run_outcome_analytics` reader sees it, plus the parent its deep link needs. */
|
|
568
|
+
export type McpRunSettledSource = McpRunSettledCommon & ({
|
|
569
|
+
kind: "workflow";
|
|
570
|
+
workflowId: string;
|
|
571
|
+
} | {
|
|
572
|
+
kind: "table_action" | "table_ingestion";
|
|
573
|
+
tableId: string;
|
|
574
|
+
} | {
|
|
575
|
+
kind: "agent";
|
|
576
|
+
agentSlug: string;
|
|
577
|
+
} | {
|
|
578
|
+
kind: "copilot_turn";
|
|
579
|
+
copilotSessionId: string;
|
|
580
|
+
});
|
|
581
|
+
/** A settled run as `run.settled`. Its producer is OXP-11.5.21. */
|
|
582
|
+
export declare function projectRunSettledEvent(source: McpRunSettledSource, context?: McpEventLinkOptions): McpRunSettledPayload;
|
|
583
|
+
/** A pending approval on a Workflow or Agent run. */
|
|
584
|
+
export type McpApprovalRequestedSource = {
|
|
585
|
+
approvalId: string;
|
|
586
|
+
runId: string;
|
|
587
|
+
requestedAt: Date | string;
|
|
588
|
+
} & ({
|
|
589
|
+
kind: "workflow";
|
|
590
|
+
workflowId: string;
|
|
591
|
+
} | {
|
|
592
|
+
kind: "agent";
|
|
593
|
+
agentSlug: string;
|
|
594
|
+
});
|
|
595
|
+
/** A pending approval as `approval.requested`. Its producer is OXP-11.5.21. */
|
|
596
|
+
export declare function projectApprovalRequestedEvent(source: McpApprovalRequestedSource, context?: McpEventLinkOptions): McpApprovalRequestedPayload;
|
|
597
|
+
export {};
|