@oxygen-agent/cli 1.1018.26 → 1.1019.23
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/http-client.js +6 -8
- package/node_modules/@oxygen/shared/dist/cli-envelope.d.ts +10 -0
- package/node_modules/@oxygen/shared/dist/cli-envelope.js +18 -0
- package/node_modules/@oxygen/shared/dist/knowledge/bootstrap.d.ts +6 -0
- package/node_modules/@oxygen/shared/dist/knowledge/bootstrap.js +6 -0
- package/node_modules/@oxygen/shared/dist/otlp-log-sink.d.ts +16 -0
- package/node_modules/@oxygen/shared/dist/otlp-log-sink.js +19 -0
- package/node_modules/@oxygen/shared/dist/sequences/sequences.d.ts +14 -0
- package/node_modules/@oxygen/shared/dist/sequences/sequences.js +19 -0
- 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/workflows/workspace-event-catalog.js +2 -0
- package/package.json +1 -1
package/README.md
CHANGED
package/dist/http-client.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { readGeoExportPagination } from "@oxygen/shared/geo/geo";
|
|
2
|
-
import { isCliResult, readEnvelopeCompatibility, vercelProtectionBypassHeaders, withRetryAfterDetails, } from "@oxygen/shared/cli-envelope";
|
|
2
|
+
import { gatewayAnswerMessage, isCliResult, readEnvelopeCompatibility, vercelProtectionBypassHeaders, withRetryAfterDetails, } from "@oxygen/shared/cli-envelope";
|
|
3
3
|
import { OxygenError } from "@oxygen/shared/cli-result";
|
|
4
4
|
import { isVersionGreater, parseSemver } from "@oxygen/shared/semver";
|
|
5
5
|
import { OXYGEN_VERSION } from "@oxygen/shared/version";
|
|
@@ -154,14 +154,12 @@ path, options = {}) {
|
|
|
154
154
|
const envelope = await readEnvelope(response).catch((error) => {
|
|
155
155
|
// A gateway answered instead of OXYGEN: the request may still be running or
|
|
156
156
|
// may have finished. Say so, with what is needed to check, instead of
|
|
157
|
-
// calling the gateway's page an invalid envelope.
|
|
158
|
-
|
|
157
|
+
// calling the gateway's page an invalid envelope. The MCP decoder shares the copy.
|
|
158
|
+
const message = error instanceof OxygenError
|
|
159
|
+
? gatewayAnswerMessage(response.status, options.previewOnly ? "preview" : readOnly ? "read" : "write")
|
|
160
|
+
: null;
|
|
161
|
+
if (!message)
|
|
159
162
|
throw error;
|
|
160
|
-
const message = options.previewOnly
|
|
161
|
-
? `Oxygen API did not answer in time (HTTP ${response.status}); the preview was not returned.`
|
|
162
|
-
: readOnly
|
|
163
|
-
? `Oxygen API did not answer in time (HTTP ${response.status}); the read was not returned.`
|
|
164
|
-
: `Oxygen API did not answer in time (HTTP ${response.status}); the outcome is unknown.`;
|
|
165
163
|
throw new OxygenError("invalid_response", message, {
|
|
166
164
|
details: {
|
|
167
165
|
status: response.status,
|
|
@@ -17,6 +17,16 @@ export declare function isCliResult<T>(value: unknown): value is CliResult<T>;
|
|
|
17
17
|
*/
|
|
18
18
|
export declare function readEnvelopeCompatibility(envelope: CliResult<unknown>): ServerCompatibility;
|
|
19
19
|
export declare function withRetryAfterDetails(details: unknown, response: Response): unknown;
|
|
20
|
+
/** What a failed request leaves behind, which decides its recovery copy. */
|
|
21
|
+
export type GatewayAnsweredRequest = "preview" | "read" | "write";
|
|
22
|
+
/**
|
|
23
|
+
* Copy for a 502/503/504 answer without an OXYGEN envelope, or null for any
|
|
24
|
+
* other status. The edge in front of the public API (Cloudflare) replaces the
|
|
25
|
+
* body of every origin 502 and 504, so such an answer is the gateway's, not
|
|
26
|
+
* OXYGEN's: never call it an invalid envelope, and never let a write read as
|
|
27
|
+
* failed when it may have run.
|
|
28
|
+
*/
|
|
29
|
+
export declare function gatewayAnswerMessage(status: number, request: GatewayAnsweredRequest): string | null;
|
|
20
30
|
/**
|
|
21
31
|
* Header fragment that lets automated clients reach a password-protected Vercel
|
|
22
32
|
* preview deployment. Returns `{ "x-vercel-protection-bypass": <secret> }` only
|
|
@@ -76,6 +76,24 @@ function retryAfterSecondsFromResponse(response, details) {
|
|
|
76
76
|
}
|
|
77
77
|
return null;
|
|
78
78
|
}
|
|
79
|
+
/**
|
|
80
|
+
* Copy for a 502/503/504 answer without an OXYGEN envelope, or null for any
|
|
81
|
+
* other status. The edge in front of the public API (Cloudflare) replaces the
|
|
82
|
+
* body of every origin 502 and 504, so such an answer is the gateway's, not
|
|
83
|
+
* OXYGEN's: never call it an invalid envelope, and never let a write read as
|
|
84
|
+
* failed when it may have run.
|
|
85
|
+
*/
|
|
86
|
+
export function gatewayAnswerMessage(status, request) {
|
|
87
|
+
if (status !== 502 && status !== 503 && status !== 504)
|
|
88
|
+
return null;
|
|
89
|
+
const answer = status === 504
|
|
90
|
+
? "Oxygen API did not answer in time (HTTP 504)"
|
|
91
|
+
: `A gateway answered HTTP ${status} in place of Oxygen API`;
|
|
92
|
+
const outcome = request === "preview"
|
|
93
|
+
? "the preview was not returned."
|
|
94
|
+
: request === "read" ? "the read was not returned." : "the outcome is unknown.";
|
|
95
|
+
return `${answer}; ${outcome}`;
|
|
96
|
+
}
|
|
79
97
|
const VERCEL_PROTECTION_BYPASS_HEADER = "x-vercel-protection-bypass";
|
|
80
98
|
/**
|
|
81
99
|
* Header fragment that lets automated clients reach a password-protected Vercel
|
|
@@ -323,6 +323,12 @@ export declare const KNOWLEDGE_BOOTSTRAP_STUCK_AFTER_MS: number;
|
|
|
323
323
|
* so readers must not present it as research in progress.
|
|
324
324
|
*/
|
|
325
325
|
export declare const KNOWLEDGE_BOOTSTRAP_HELD_FOR_RECOVERY_REASON = "worker_outcome_requires_recovery";
|
|
326
|
+
/**
|
|
327
|
+
* Reason on a `failed` marker whose owning worker execution ended (succeeded, failed or
|
|
328
|
+
* canceled) while the marker still said `running`, before any paid lookup was admitted.
|
|
329
|
+
* Nothing was read or spent; only a re-arm researches again.
|
|
330
|
+
*/
|
|
331
|
+
export declare const KNOWLEDGE_BOOTSTRAP_ORPHANED_REASON = "interrupted_before_research";
|
|
326
332
|
/**
|
|
327
333
|
* Idempotency-key prefix for the ledger row that hands an automatic pass's
|
|
328
334
|
* credits back to the workspace (property 7 above). The key is
|
|
@@ -301,6 +301,12 @@ export const KNOWLEDGE_BOOTSTRAP_STUCK_AFTER_MS = 60 * 60 * 1000;
|
|
|
301
301
|
* so readers must not present it as research in progress.
|
|
302
302
|
*/
|
|
303
303
|
export const KNOWLEDGE_BOOTSTRAP_HELD_FOR_RECOVERY_REASON = "worker_outcome_requires_recovery";
|
|
304
|
+
/**
|
|
305
|
+
* Reason on a `failed` marker whose owning worker execution ended (succeeded, failed or
|
|
306
|
+
* canceled) while the marker still said `running`, before any paid lookup was admitted.
|
|
307
|
+
* Nothing was read or spent; only a re-arm researches again.
|
|
308
|
+
*/
|
|
309
|
+
export const KNOWLEDGE_BOOTSTRAP_ORPHANED_REASON = "interrupted_before_research";
|
|
304
310
|
/**
|
|
305
311
|
* Idempotency-key prefix for the ledger row that hands an automatic pass's
|
|
306
312
|
* credits back to the workspace (property 7 above). The key is
|
|
@@ -54,6 +54,12 @@ export type OtlpLogSinkOptions = {
|
|
|
54
54
|
minLevel?: LogLevel | null | undefined;
|
|
55
55
|
/** Exact, low-volume monitor events that must reach OTLP below minLevel. */
|
|
56
56
|
includeMessagesBelowMinLevel?: readonly string[] | undefined;
|
|
57
|
+
/**
|
|
58
|
+
* Exact messages this sink never ships at DEBUG, whatever minLevel says
|
|
59
|
+
* (native-only capture sets no floor). The same message at INFO or above
|
|
60
|
+
* still ships. Stdout and composed sinks are unaffected.
|
|
61
|
+
*/
|
|
62
|
+
excludeDebugMessages?: readonly string[] | undefined;
|
|
57
63
|
fetch?: typeof globalThis.fetch | undefined;
|
|
58
64
|
};
|
|
59
65
|
/**
|
|
@@ -62,6 +68,16 @@ export type OtlpLogSinkOptions = {
|
|
|
62
68
|
* which by design never reaches Axiom (OXP-1.6.126).
|
|
63
69
|
*/
|
|
64
70
|
export declare const OTLP_MONITOR_INFO_EVENTS: readonly ["diagnostics.capture_stored", "diagnostics.invocation_completed", "diagnostics.canary_completed", "diagnostics.digest_completed", "tenant.migrations.cron.done", "outbound_send.sent", "worker_workflow_cron_overlap_skipped", "worker_workflow_cron_enqueued", "copilot.turn.finished", "worker.queue.heartbeat", "worker.queue.depth", "worker.queue.ledger", "worker.queue.redis", "worker.queue.unregistered_kind", "automation_usage.reconcile_completed", "provider_health.cron_completed", "provider_balances.cron_completed", "cost_snapshot.cron_completed", "worker.egress_order_reconcile_sweep", "posthog_canary.round_trip_ok", "web.log_volume", "worker.log_shipper.stats"];
|
|
71
|
+
/**
|
|
72
|
+
* Per-scheduler-quantum DEBUG lines of the legacy worker loop, kept on stdout
|
|
73
|
+
* only. Each was downgraded to debug so it would stop being stored (see the
|
|
74
|
+
* comments at their call sites); native-only capture ships every level, so on
|
|
75
|
+
* 2026-10-27 these four were 3.6M of 10.3M SigNoz log rows, almost all from
|
|
76
|
+
* one dev tenant's hot loop. No monitor reads them: the worker.cycle and
|
|
77
|
+
* worker.tenant_cycle spans and oxygen.worker.* metrics carry the same counts.
|
|
78
|
+
* Priority wakes log two of them at INFO, which still ships.
|
|
79
|
+
*/
|
|
80
|
+
export declare const OTLP_STDOUT_ONLY_DEBUG_EVENTS: readonly ["worker_cycle_completed", "worker_hot_tenant_yielded", "worker_wake_quantum_completed", "worker_wake_drain_completed"];
|
|
65
81
|
export type OtlpLogSinkHandle = {
|
|
66
82
|
sink: LogSink;
|
|
67
83
|
flush: () => Promise<void>;
|
|
@@ -35,6 +35,21 @@ export const OTLP_MONITOR_INFO_EVENTS = [
|
|
|
35
35
|
"web.log_volume",
|
|
36
36
|
"worker.log_shipper.stats",
|
|
37
37
|
];
|
|
38
|
+
/**
|
|
39
|
+
* Per-scheduler-quantum DEBUG lines of the legacy worker loop, kept on stdout
|
|
40
|
+
* only. Each was downgraded to debug so it would stop being stored (see the
|
|
41
|
+
* comments at their call sites); native-only capture ships every level, so on
|
|
42
|
+
* 2026-10-27 these four were 3.6M of 10.3M SigNoz log rows, almost all from
|
|
43
|
+
* one dev tenant's hot loop. No monitor reads them: the worker.cycle and
|
|
44
|
+
* worker.tenant_cycle spans and oxygen.worker.* metrics carry the same counts.
|
|
45
|
+
* Priority wakes log two of them at INFO, which still ships.
|
|
46
|
+
*/
|
|
47
|
+
export const OTLP_STDOUT_ONLY_DEBUG_EVENTS = [
|
|
48
|
+
"worker_cycle_completed",
|
|
49
|
+
"worker_hot_tenant_yielded",
|
|
50
|
+
"worker_wake_quantum_completed",
|
|
51
|
+
"worker_wake_drain_completed",
|
|
52
|
+
];
|
|
38
53
|
const DEFAULT_BATCH_SIZE = 500;
|
|
39
54
|
const DEFAULT_FLUSH_INTERVAL_MS = 2_000;
|
|
40
55
|
const DEFAULT_MAX_QUEUE = 10_000;
|
|
@@ -239,6 +254,7 @@ export function createOtlpLogSink(options) {
|
|
|
239
254
|
const now = options.now ?? Date.now;
|
|
240
255
|
const minSeverity = options.minLevel ? SEVERITY_NUMBERS[options.minLevel] : null;
|
|
241
256
|
const includedMessages = new Set(options.includeMessagesBelowMinLevel ?? []);
|
|
257
|
+
const excludedDebugMessages = new Set(options.excludeDebugMessages ?? []);
|
|
242
258
|
// A null/undefined override is dropped rather than applied, so a caller that
|
|
243
259
|
// resolves its own environment and comes back empty-handed falls back to the
|
|
244
260
|
// default here instead of shipping records with no `deployment.environment`.
|
|
@@ -330,6 +346,9 @@ export function createOtlpLogSink(options) {
|
|
|
330
346
|
if (minSeverity !== null && SEVERITY_NUMBERS[recordLevel(record)] < minSeverity
|
|
331
347
|
&& (typeof record.msg !== "string" || !includedMessages.has(record.msg)))
|
|
332
348
|
return;
|
|
349
|
+
if (typeof record.msg === "string" && excludedDebugMessages.has(record.msg)
|
|
350
|
+
&& recordLevel(record) === "debug")
|
|
351
|
+
return;
|
|
333
352
|
// Drop the OLDEST record and keep this one: under sustained backpressure the
|
|
334
353
|
// newest lines are the ones describing the incident being debugged.
|
|
335
354
|
while (queue.length >= maxQueue) {
|
|
@@ -456,6 +456,20 @@ export declare function sequenceInheritedEmailSubject(steps: readonly {
|
|
|
456
456
|
readonly kind: string;
|
|
457
457
|
readonly subject_template?: string;
|
|
458
458
|
}[], index: number): string | null;
|
|
459
|
+
/**
|
|
460
|
+
* The subject a threaded reply inherits from the send it replies to: "Re: <prior>",
|
|
461
|
+
* keeping an existing Re:/RE: prefix rather than stacking another. Undefined when
|
|
462
|
+
* nothing is known about the prior subject, so the caller's own fallback decides.
|
|
463
|
+
*
|
|
464
|
+
* Exists because "the thread supplies the subject" is only true of the SENDER's
|
|
465
|
+
* mailbox: Gmail's API groups the sent copy on threadId, but the recipient's
|
|
466
|
+
* client threads on In-Reply-To/References plus a matching Subject, and Gmail
|
|
467
|
+
* in particular refuses to join a message whose subject does not match. A raw
|
|
468
|
+
* MIME reply with no Subject header therefore arrived as a separate conversation
|
|
469
|
+
* with an empty subject line (Plain T-163, measured 2026-09-17 on Google
|
|
470
|
+
* Workspace: correct In-Reply-To/References, different threadId).
|
|
471
|
+
*/
|
|
472
|
+
export declare function threadedReplySubject(prior: string | null | undefined): string | undefined;
|
|
459
473
|
/**
|
|
460
474
|
* Native WhatsApp message send through one of the sequence's WhatsApp senders
|
|
461
475
|
* (Unipile chats_messages_send into an existing chat, else chats_create to open
|
|
@@ -404,6 +404,25 @@ steps, index) {
|
|
|
404
404
|
}
|
|
405
405
|
return null;
|
|
406
406
|
}
|
|
407
|
+
/**
|
|
408
|
+
* The subject a threaded reply inherits from the send it replies to: "Re: <prior>",
|
|
409
|
+
* keeping an existing Re:/RE: prefix rather than stacking another. Undefined when
|
|
410
|
+
* nothing is known about the prior subject, so the caller's own fallback decides.
|
|
411
|
+
*
|
|
412
|
+
* Exists because "the thread supplies the subject" is only true of the SENDER's
|
|
413
|
+
* mailbox: Gmail's API groups the sent copy on threadId, but the recipient's
|
|
414
|
+
* client threads on In-Reply-To/References plus a matching Subject, and Gmail
|
|
415
|
+
* in particular refuses to join a message whose subject does not match. A raw
|
|
416
|
+
* MIME reply with no Subject header therefore arrived as a separate conversation
|
|
417
|
+
* with an empty subject line (Plain T-163, measured 2026-09-17 on Google
|
|
418
|
+
* Workspace: correct In-Reply-To/References, different threadId).
|
|
419
|
+
*/
|
|
420
|
+
export function threadedReplySubject(prior) {
|
|
421
|
+
const base = prior?.trim();
|
|
422
|
+
if (!base)
|
|
423
|
+
return undefined;
|
|
424
|
+
return /^re:/i.test(base) ? base : `Re: ${base}`;
|
|
425
|
+
}
|
|
407
426
|
// ---- CRM-channel steps (external writes through a connected CRM) ----
|
|
408
427
|
export const SEQUENCE_CRM_TASK_PROVIDERS = ["hubspot"];
|
|
409
428
|
export const SEQUENCE_CRM_IDENTITY_KINDS = [
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const OXYGEN_BUILD_VERSION = "1.
|
|
1
|
+
export declare const OXYGEN_BUILD_VERSION = "1.1019.23";
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// GENERATED by scripts/ci/version-stamp.mjs from VERSION + git history. Do not edit; do not commit.
|
|
2
|
-
export const OXYGEN_BUILD_VERSION = "1.
|
|
2
|
+
export const OXYGEN_BUILD_VERSION = "1.1019.23";
|