@oxygen-agent/cli 1.1014.2110 → 1.1014.2119

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 CHANGED
@@ -34,4 +34,4 @@ oxygen update
34
34
 
35
35
  For product documentation, visit https://oxygen-agent.com/docs. For support, visit https://oxygen-agent.com.
36
36
 
37
- Version: 1.1014.2110
37
+ Version: 1.1014.2119
@@ -2193,7 +2193,7 @@ export function registerSequencesFamily(program, handleAsyncAction) {
2193
2193
  await handleAsyncAction("sequences delete", options, () => requestOxygen(`/api/cli/sequences/${encodeURIComponent(sequence)}${options.approved ? "?approved=true" : ""}`, { method: "DELETE" }));
2194
2194
  }))
2195
2195
  .addCommand(new Command("enrollments")
2196
- .description("List per-lead enrollment state plus the latest action status, error, attempts, and retry time. --view compact answers 'when is each lead's next message due' per lead: lead, status, invite (accepted, pending, not_invited), accepted_at, current_step and next_due. next_due.summary says it in words, at_local/gives_up_at_local give the time in the campaign's timezone (its schedule's, else UTC) and at/gives_up_at in UTC. Reasons: step_scheduled (planned send time; held_by names what holds it, e.g. send_cap_reached), planner_due (when the planner next looks at the lead), not_started (begins when the campaign is started or resumed), nothing_scheduled (enrolled, no step will run), waiting_for_connection / waiting_for_signal (no send time; acceptance makes the next step due at once; gives_up_at is when the wait ends, and on_timeout says whether the lead then leaves or moves on), finished. A failed lead carries failure: the cause in words (cause_recorded false when OXYGEN never recorded one) and provider_contact (made; none = the step never started; nothing_sent; unknown). missing_source_row is true for a lead whose source-table row was deleted: still enrolled and contacted (remove with `contacts-remove --missing-source-rows`); null when the campaign has no live source table to check against, or the check failed. channels says which of the sequence's channels reach each lead: usable, and unavailable with a reason (no_linkedin_profile = enrolled for email only, its LinkedIn steps are skipped; no_recipient_email; no_phone_number).")
2196
+ .description("List per-lead enrollment state plus the latest action status, error, attempts, and retry time. --view compact answers 'when is each lead's next message due' per lead: lead, status, invite (accepted, pending, not_invited), accepted_at, current_step and next_due. next_due.summary says it in words, at_local/gives_up_at_local give the time in the campaign's timezone (its schedule's, else UTC) and at/gives_up_at in UTC. Reasons: step_scheduled (planned send time; held_by names what holds it, e.g. send_cap_reached), planner_due (when the planner next looks at the lead), not_started (begins when the campaign is started or resumed), nothing_scheduled (enrolled, no step will run), waiting_for_connection / waiting_for_signal (no send time; acceptance makes the next step due at once; gives_up_at is when the wait ends, and on_timeout says whether the lead then leaves or moves on), finished. A failed lead carries failure: the cause in words (cause_recorded false when OXYGEN never recorded one) and provider_contact (made; none = the step never started; nothing_sent; unknown). missing_source_row is true for a lead whose source-table row was deleted: still enrolled and contacted (remove with `contacts-remove --missing-source-rows`); null when the campaign has no live source table to check against, or the check failed. channels says which of the sequence's channels reach each lead: usable, and unavailable with a reason (no_linkedin_profile = enrolled for email only, its LinkedIn steps are skipped; linkedin_profile_unreadable = LinkedIn would not open the profile, so its remaining LinkedIn steps are skipped and the other channels continue; no_recipient_email; no_phone_number).")
2197
2197
  .argument("<sequence>", "Sequence id or slug.")
2198
2198
  .option("--status <status>", "Filter by enrollment status (pending, active, waiting_connection, waiting_signal, replied, completed, stopped, failed, excluded). pending = enrolled, not started (next_due not_started); waiting_connection = invite sent, not accepted yet. Status is the lead's progress, not its invite: use --invite accepted for the leads that accepted.")
2199
2199
  .option("--step <n>", "Only leads currently on this step (0-based index, as in the sequence's steps).")
@@ -208,6 +208,28 @@ export type LinkedInRefusalScope =
208
208
  | "already_engaged"
209
209
  /** Unrecognised. Callers MUST preserve their existing behaviour. */
210
210
  | "unknown";
211
+ /**
212
+ * Classify a LinkedIn refusal from the provider's own account of it.
213
+ *
214
+ * Deliberately a CLOSED set of anchored, full-string matches, in the same
215
+ * discipline as the sequence-recovery allowlists: matching vendor prose is
216
+ * fragile, so an unrecognised message must degrade to `unknown` and leave the
217
+ * caller's behaviour exactly as it was. Extending the set is an evidence-driven
218
+ * act — callers log what they could not classify.
219
+ *
220
+ * Pure and total; never throws.
221
+ */
222
+ /**
223
+ * Enrollment metadata key set when LinkedIn would not open the lead's profile on
224
+ * any attempt of a LinkedIn step, in a journey that still reaches the lead by
225
+ * email, call or WhatsApp.
226
+ * The planner then treats the lead as having no LinkedIn profile: each later
227
+ * LinkedIn step is skipped as linkedin_profile_unreadable, a connection wait
228
+ * passes and a connection branch takes its not-connected path, while the email,
229
+ * call, WhatsApp and CRM steps still run.
230
+ */
231
+ export declare const LINKEDIN_PROFILE_UNREADABLE_METADATA_KEY = "linkedin_profile_unreadable";
232
+ export declare function linkedInProfileMarkedUnreadable(metadata: Record<string, unknown> | null | undefined): boolean;
211
233
  export declare function classifyLinkedInRefusal(input: {
212
234
  providerType: string | null;
213
235
  providerMessage: string | null;
@@ -113,6 +113,20 @@ export const LINKEDIN_INVITE_NOTE_LIMIT_BASIC = 200;
113
113
  *
114
114
  * Pure and total; never throws.
115
115
  */
116
+ /**
117
+ * Enrollment metadata key set when LinkedIn would not open the lead's profile on
118
+ * any attempt of a LinkedIn step, in a journey that still reaches the lead by
119
+ * email, call or WhatsApp.
120
+ * The planner then treats the lead as having no LinkedIn profile: each later
121
+ * LinkedIn step is skipped as linkedin_profile_unreadable, a connection wait
122
+ * passes and a connection branch takes its not-connected path, while the email,
123
+ * call, WhatsApp and CRM steps still run.
124
+ */
125
+ export const LINKEDIN_PROFILE_UNREADABLE_METADATA_KEY = "linkedin_profile_unreadable";
126
+ export function linkedInProfileMarkedUnreadable(metadata) {
127
+ const marker = metadata?.[LINKEDIN_PROFILE_UNREADABLE_METADATA_KEY];
128
+ return typeof marker === "object" && marker !== null;
129
+ }
116
130
  /**
117
131
  * LinkedIn's sentence when an invitation is refused because the member handled
118
132
  * an earlier one from this account (accepted, ignored or withdrawn) within three
@@ -1 +1 @@
1
- export declare const OXYGEN_BUILD_VERSION = "1.1014.2110";
1
+ export declare const OXYGEN_BUILD_VERSION = "1.1014.2119";
@@ -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.1014.2110";
2
+ export const OXYGEN_BUILD_VERSION = "1.1014.2119";
@@ -63,7 +63,7 @@ export function buildWorkspacePlacementBulkPlan(input) {
63
63
  const child = { ...scheduling, request_id: bulkPlacementId(`${organizationId}:${requestId}:child:${offset / 50}`), organization_id: organizationId, provider: "internal", billing_mode: "internal", credits: 0, allow_paused_probe: input.allowPausedProbe, receiver_scope: "workspace", rendered_at: input.renderedAt, rendering: input.rendering, probes: probes.slice(offset, offset + 50), excluded_self_sends: 0, message_count: Math.min(50, probes.length - offset) };
64
64
  children.push({ ...child, plan_hash: createHash("sha256").update(JSON.stringify(child)).digest("hex") });
65
65
  }
66
- const plan = { ...scheduling, ...(input.schedule ? { provider_directions: placementProviderDirections(probes), schedule_summary: placementScheduleSummary(probes.map(p => ({ scheduled_at: p.scheduled_at }))) } : {}), request_id: requestId, organization_id: organizationId, rendered_at: input.renderedAt, message_count: count, child_count: children.length, sender_count: senders.length, receiver_providers: providers, skipped_senders: [...(input.skippedSenders ?? [])].sort((a, b) => a.id.localeCompare(b.id)), coverage, children };
66
+ const plan = { ...scheduling, ...(input.schedule ? { provider_directions: placementProviderDirections(probes), schedule_summary: placementScheduleSummary(probes.map(p => ({ scheduled_at: p.scheduled_at })), { schedule: WORKSPACE_PLACEMENT_SCHEDULE, start: input.renderedAt }) } : {}), request_id: requestId, organization_id: organizationId, rendered_at: input.renderedAt, message_count: count, child_count: children.length, sender_count: senders.length, receiver_providers: providers, skipped_senders: [...(input.skippedSenders ?? [])].sort((a, b) => a.id.localeCompare(b.id)), coverage, children };
67
67
  return { ...plan, plan_hash: createHash("sha256").update(JSON.stringify(plan)).digest("hex") };
68
68
  }
69
69
  export function bulkPlacementSkippedPage(plan, cursor) {
@@ -1,15 +1,38 @@
1
1
  /** Native workspace diagnostics have their own allowance; campaign caps are unchanged. */
2
- export declare const WORKSPACE_PLACEMENT_SCHEDULE: {
2
+ export declare const WORKSPACE_PLACEMENT_SCHEDULE_V1: {
3
3
  readonly version: 1;
4
4
  readonly daily_send_limit: 3;
5
5
  readonly window_minutes: 30;
6
6
  };
7
- export type WorkspacePlacementSchedule = typeof WORKSPACE_PLACEMENT_SCHEDULE;
7
+ /**
8
+ * Every approved probe leaves within 30 minutes of approval (Philipp, 2026-10-27).
9
+ * Sends spread over the first `send_span_minutes`, leaving the rest of the window
10
+ * for the shared send rate; a probe still unsent at the deadline settles as not
11
+ * sent. The per-mailbox daily allowance still applies.
12
+ */
13
+ export declare const WORKSPACE_PLACEMENT_SCHEDULE: {
14
+ readonly version: 2;
15
+ readonly daily_send_limit: 3;
16
+ readonly window_minutes: 30;
17
+ readonly send_span_minutes: 20;
18
+ };
19
+ export type WorkspacePlacementSchedule = typeof WORKSPACE_PLACEMENT_SCHEDULE_V1 | typeof WORKSPACE_PLACEMENT_SCHEDULE;
20
+ /** Terminal, pre-submission reasons a scheduled probe was never sent. */
21
+ export declare const PLACEMENT_NOT_SENT_CODES: readonly ["workspace_test_deadline_passed", "workspace_test_daily_allowance_reached"];
22
+ export type PlacementNotSentCode = (typeof PLACEMENT_NOT_SENT_CODES)[number];
23
+ export declare function isPlacementNotSentCode(value: unknown): value is PlacementNotSentCode;
24
+ export declare function isScheduledPlacementVersion(value: unknown): value is 1 | 2;
25
+ /** The outbound consumer's default fleet-wide ceiling (OXYGEN_OUTBOUND_SEND_GLOBAL_PER_MINUTE). */
26
+ export declare const PLACEMENT_SHARED_SEND_RATE_PER_MINUTE = 30;
27
+ /** Floor between two probes from one mailbox inside a version-2 window. */
28
+ export declare const PLACEMENT_SAME_SENDER_GAP_MS = 60000;
8
29
  export type PlacementSlot = {
9
30
  id: string;
10
31
  mailbox_id: string;
11
32
  scheduled_at: string;
12
33
  spacing_ms: number;
34
+ /** Version 2 only: the approval-bound instant after which this probe never sends. */
35
+ deadline_at?: string;
13
36
  };
14
37
  export declare function placementUtcDay(at: number): number;
15
38
  /** Deterministic estimate, also used under mailbox locks to reserve the actual schedule. */
@@ -21,13 +44,36 @@ export declare function planPlacementSlots(probes: Array<{
21
44
  }>, start: Date, occupied?: Array<{
22
45
  mailbox_id: string;
23
46
  at: string;
24
- }>): PlacementSlot[];
47
+ }>, schedule?: WorkspacePlacementSchedule): PlacementSlot[];
48
+ /**
49
+ * Version 2 summaries need the window start (preview rendering or run creation):
50
+ * probes placed past the send span are those over a mailbox's daily allowance.
51
+ */
25
52
  export declare function placementScheduleSummary(slots: Array<{
26
53
  scheduled_at: string;
27
- }>): {
54
+ }>, window?: {
55
+ schedule?: WorkspacePlacementSchedule;
56
+ start: string | Date;
57
+ }): {
58
+ first_send_at: string | null;
59
+ estimated_last_send_at: string | null;
60
+ daily_batches: number;
61
+ deadline_at?: never;
62
+ /** Over a mailbox's daily test allowance: recorded as not sent at the deadline. */
63
+ not_sendable_count?: never;
64
+ /** Planned sends per minute; above the shared ceiling some may miss the deadline. */
65
+ send_rate_per_minute?: never;
66
+ shared_send_rate_per_minute?: never;
67
+ } | {
28
68
  first_send_at: string | null;
29
69
  estimated_last_send_at: string | null;
30
70
  daily_batches: number;
71
+ deadline_at: string;
72
+ /** Over a mailbox's daily test allowance: recorded as not sent at the deadline. */
73
+ not_sendable_count: number;
74
+ /** Planned sends per minute; above the shared ceiling some may miss the deadline. */
75
+ send_rate_per_minute: number;
76
+ shared_send_rate_per_minute: number;
31
77
  };
32
78
  export declare function placementProviderDirections(probes: Array<{
33
79
  sender: {
@@ -1,16 +1,106 @@
1
1
  /** Native workspace diagnostics have their own allowance; campaign caps are unchanged. */
2
- export const WORKSPACE_PLACEMENT_SCHEDULE = {
2
+ export const WORKSPACE_PLACEMENT_SCHEDULE_V1 = {
3
3
  version: 1,
4
4
  daily_send_limit: 3,
5
5
  window_minutes: 30,
6
6
  };
7
+ /**
8
+ * Every approved probe leaves within 30 minutes of approval (Philipp, 2026-10-27).
9
+ * Sends spread over the first `send_span_minutes`, leaving the rest of the window
10
+ * for the shared send rate; a probe still unsent at the deadline settles as not
11
+ * sent. The per-mailbox daily allowance still applies.
12
+ */
13
+ export const WORKSPACE_PLACEMENT_SCHEDULE = {
14
+ version: 2,
15
+ daily_send_limit: 3,
16
+ window_minutes: 30,
17
+ send_span_minutes: 20,
18
+ };
19
+ /** Terminal, pre-submission reasons a scheduled probe was never sent. */
20
+ export const PLACEMENT_NOT_SENT_CODES = [
21
+ "workspace_test_deadline_passed",
22
+ "workspace_test_daily_allowance_reached",
23
+ ];
24
+ export function isPlacementNotSentCode(value) {
25
+ return PLACEMENT_NOT_SENT_CODES.includes(value);
26
+ }
27
+ export function isScheduledPlacementVersion(value) {
28
+ return value === 1 || value === 2;
29
+ }
30
+ /** The outbound consumer's default fleet-wide ceiling (OXYGEN_OUTBOUND_SEND_GLOBAL_PER_MINUTE). */
31
+ export const PLACEMENT_SHARED_SEND_RATE_PER_MINUTE = 30;
32
+ /** Floor between two probes from one mailbox inside a version-2 window. */
33
+ export const PLACEMENT_SAME_SENDER_GAP_MS = 60_000;
34
+ /**
35
+ * The slot table's CHECK floor for `spacing_ms` (version-1 spacing). Version-2 slots
36
+ * store it only to satisfy the column; their gate applies PLACEMENT_SAME_SENDER_GAP_MS.
37
+ */
38
+ const SLOT_SPACING_FLOOR_MS = 900_000;
7
39
  const DAY = 86_400_000;
8
40
  const WINDOW = WORKSPACE_PLACEMENT_SCHEDULE.window_minutes * 60_000;
9
41
  export function placementUtcDay(at) {
10
42
  return Math.floor(at / DAY) * DAY;
11
43
  }
12
44
  /** Deterministic estimate, also used under mailbox locks to reserve the actual schedule. */
13
- export function planPlacementSlots(probes, start, occupied = []) {
45
+ export function planPlacementSlots(probes, start, occupied = [], schedule = WORKSPACE_PLACEMENT_SCHEDULE) {
46
+ return schedule.version === 2
47
+ ? planWindowSlots(probes, start, occupied)
48
+ : planDailySlots(probes, start, occupied);
49
+ }
50
+ /**
51
+ * Version 2: one window from approval. Probes interleave by each sender's rank (every
52
+ * sender's first probe, then every second probe) and spread evenly over the send span,
53
+ * so a sender's probes sit apart without a second wave. Probes beyond a mailbox's
54
+ * remaining daily allowance wait at the deadline, where they settle as not sent.
55
+ */
56
+ function planWindowSlots(probes, start, occupied) {
57
+ const from = start.getTime();
58
+ const span = WORKSPACE_PLACEMENT_SCHEDULE.send_span_minutes * 60_000;
59
+ const deadline = new Date(from + WINDOW).toISOString();
60
+ const day = placementUtcDay(from);
61
+ const used = new Map();
62
+ for (const slot of occupied)
63
+ if (placementUtcDay(Date.parse(slot.at)) === day)
64
+ used.set(slot.mailbox_id, (used.get(slot.mailbox_id) ?? 0) + 1);
65
+ const rank = new Map();
66
+ const ordered = probes
67
+ .map((probe, index) => {
68
+ const r = rank.get(probe.sender.id) ?? 0;
69
+ rank.set(probe.sender.id, r + 1);
70
+ return { probe, r, index };
71
+ })
72
+ .sort((a, b) => a.r - b.r || a.index - b.index);
73
+ const inWindow = [];
74
+ const held = [];
75
+ for (const { probe } of ordered) {
76
+ const n = used.get(probe.sender.id) ?? 0;
77
+ if (n >= WORKSPACE_PLACEMENT_SCHEDULE.daily_send_limit)
78
+ held.push(probe);
79
+ else {
80
+ used.set(probe.sender.id, n + 1);
81
+ inWindow.push(probe);
82
+ }
83
+ }
84
+ const step = inWindow.length > 1 ? span / (inWindow.length - 1) : 0;
85
+ return [
86
+ ...inWindow.map((probe, i) => ({
87
+ id: probe.id,
88
+ mailbox_id: probe.sender.id,
89
+ scheduled_at: new Date(from + Math.round(i * step)).toISOString(),
90
+ spacing_ms: SLOT_SPACING_FLOOR_MS,
91
+ deadline_at: deadline,
92
+ })),
93
+ ...held.map((probe) => ({
94
+ id: probe.id,
95
+ mailbox_id: probe.sender.id,
96
+ scheduled_at: deadline,
97
+ spacing_ms: SLOT_SPACING_FLOOR_MS,
98
+ deadline_at: deadline,
99
+ })),
100
+ ];
101
+ }
102
+ /** Version 1 (2026-10-23): up to three per mailbox per UTC day, each day over 30 minutes. */
103
+ function planDailySlots(probes, start, occupied) {
14
104
  const groups = new Map();
15
105
  for (const p of probes)
16
106
  groups.set(p.sender.id, [...(groups.get(p.sender.id) ?? []), p.id]);
@@ -66,12 +156,33 @@ export function planPlacementSlots(probes, start, occupied = []) {
66
156
  }
67
157
  return result;
68
158
  }
69
- export function placementScheduleSummary(slots) {
70
- const times = slots.map((s) => s.scheduled_at).sort();
159
+ /**
160
+ * Version 2 summaries need the window start (preview rendering or run creation):
161
+ * probes placed past the send span are those over a mailbox's daily allowance.
162
+ */
163
+ export function placementScheduleSummary(slots, window) {
164
+ const all = slots.map((s) => s.scheduled_at).sort();
165
+ const schedule = window?.schedule;
166
+ if (!window || schedule?.version !== 2) {
167
+ return {
168
+ first_send_at: all[0] ?? null,
169
+ estimated_last_send_at: all.at(-1) ?? null,
170
+ daily_batches: new Set(all.map((at) => at.slice(0, 10))).size,
171
+ };
172
+ }
173
+ const start = new Date(window.start).getTime();
174
+ const spanEnd = start + (schedule.send_span_minutes + 1) * 60_000;
175
+ const times = all.filter((at) => Date.parse(at) <= spanEnd);
71
176
  return {
72
177
  first_send_at: times[0] ?? null,
73
178
  estimated_last_send_at: times.at(-1) ?? null,
74
- daily_batches: new Set(times.map((at) => at.slice(0, 10))).size,
179
+ daily_batches: times.length ? 1 : 0,
180
+ deadline_at: new Date(start + schedule.window_minutes * 60_000).toISOString(),
181
+ /** Over a mailbox's daily test allowance: recorded as not sent at the deadline. */
182
+ not_sendable_count: all.length - times.length,
183
+ /** Planned sends per minute; above the shared ceiling some may miss the deadline. */
184
+ send_rate_per_minute: Math.ceil(times.length / schedule.send_span_minutes),
185
+ shared_send_rate_per_minute: PLACEMENT_SHARED_SEND_RATE_PER_MINUTE,
75
186
  };
76
187
  }
77
188
  export function placementProviderDirections(probes) {
@@ -45,6 +45,7 @@ export type WorkspacePlacementView = {
45
45
  body_html_characters: number;
46
46
  state: string;
47
47
  status_label: string;
48
+ error_code?: string;
48
49
  delivery?: {
49
50
  id: string;
50
51
  status: string;
@@ -67,6 +68,7 @@ export declare function workspacePlacementView(input: {
67
68
  outcomes: Record<string, {
68
69
  state: string;
69
70
  observation?: WorkspacePlacementObservation;
71
+ error_code?: string;
70
72
  }>;
71
73
  deliveries?: Record<string, {
72
74
  id: string;
@@ -171,5 +173,17 @@ export declare function workspacePlacementPreviewPage(plan: WorkspacePlacementPl
171
173
  first_send_at: string | null;
172
174
  estimated_last_send_at: string | null;
173
175
  daily_batches: number;
176
+ deadline_at?: never;
177
+ not_sendable_count?: never;
178
+ send_rate_per_minute?: never;
179
+ shared_send_rate_per_minute?: never;
180
+ } | {
181
+ first_send_at: string | null;
182
+ estimated_last_send_at: string | null;
183
+ daily_batches: number;
184
+ deadline_at: string;
185
+ not_sendable_count: number;
186
+ send_rate_per_minute: number;
187
+ shared_send_rate_per_minute: number;
174
188
  };
175
189
  };
@@ -1,4 +1,4 @@
1
- import { placementScheduleSummary, placementProviderDirections } from "./workspace-placement-schedule.js";
1
+ import { isPlacementNotSentCode, placementScheduleSummary, placementProviderDirections } from "./workspace-placement-schedule.js";
2
2
  import { CliHttpError } from "./cli-http-error.js";
3
3
  import { placementReceiverLabel } from "./workspace-placement.js";
4
4
  export function workspacePlacementView(input, webUrl) {
@@ -47,16 +47,21 @@ export function workspacePlacementView(input, webUrl) {
47
47
  v.send_unknown++;
48
48
  else if (out?.state === "read_blocked")
49
49
  v.read_blocked++;
50
- const state = out?.state ?? (input.deliveries?.[p.id]?.status === "sent" ? "awaiting_results" : input.deliveries?.[p.id]?.status ?? "pending");
51
- return { ...workspacePlacementProbeMeta(p), ...(input.deliveries?.[p.id]?.ready_at ? { scheduled_at: input.deliveries[p.id].ready_at } : {}), state, status_label: state === "pending" && input.plan.scheduling ? "Scheduled" : workspacePlacementStateLabel(state), ...(input.deliveries?.[p.id] ? { delivery: input.deliveries[p.id] } : {}), ...(o ? { observation: p.receiver.network_id ? { ...o, receiver_message_id: "private" } : o } : {}) };
50
+ const state = out?.state === "send_failed" && isPlacementNotSentCode(out.error_code) ? "not_sent" : out?.state ?? (input.deliveries?.[p.id]?.status === "sent" ? "awaiting_results" : input.deliveries?.[p.id]?.status ?? "pending");
51
+ return { ...workspacePlacementProbeMeta(p), ...(input.deliveries?.[p.id]?.ready_at ? { scheduled_at: input.deliveries[p.id].ready_at } : {}), state, status_label: state === "pending" && input.plan.scheduling ? "Scheduled" : workspacePlacementStateLabel(state), ...(input.deliveries?.[p.id] ? { delivery: input.deliveries[p.id] } : {}), ...(state === "not_sent" ? { error_code: out.error_code } : {}), ...(o ? { observation: p.receiver.network_id ? { ...o, receiver_message_id: "private" } : o } : {}) };
52
52
  });
53
53
  const settled = input.plan.probes.filter(p => input.outcomes[p.id]).length;
54
- return { ...(input.plan.scheduling ? { provider_directions: placementProviderDirections(input.plan.probes), scheduling: input.plan.scheduling, schedule_summary: placementScheduleSummary(probes.filter(p => p.scheduled_at).map(p => ({ scheduled_at: p.scheduled_at }))) } : {}), id: input.id, provider: "internal", billing_mode: "internal", credits_used: 0, status: settled < probes.length ? "running" : probes.every(p => p.state === "observed") ? "completed" : "incomplete",
54
+ // A version-2 window starts at its first reserved slot; the row's creation time is
55
+ // only a fallback (it is the transaction start, possibly before lock waits).
56
+ const created = new Date(input.created_at).getTime();
57
+ const firstReady = Math.min(...probes.filter(p => p.scheduled_at).map(p => Date.parse(p.scheduled_at)));
58
+ const windowStart = Number.isFinite(firstReady) && firstReady - created < 5 * 60_000 ? new Date(firstReady) : new Date(created);
59
+ return { ...(input.plan.scheduling ? { provider_directions: placementProviderDirections(input.plan.probes), scheduling: input.plan.scheduling, schedule_summary: placementScheduleSummary(probes.filter(p => p.scheduled_at).map(p => ({ scheduled_at: p.scheduled_at })), { schedule: input.plan.scheduling, start: windowStart }) } : {}), id: input.id, provider: "internal", billing_mode: "internal", credits_used: 0, status: settled < probes.length ? "running" : probes.every(p => p.state === "observed") ? "completed" : "incomplete",
55
60
  created_at: new Date(input.created_at).toISOString(), message_count: probes.length, variants: [...variants.values()], probes, plan_hash: input.plan.plan_hash, web_url: webUrl,
56
61
  directional_note: "Observed placement in participating receiving accounts; not a campaign placement guarantee. Primary and Focused are separate provider classifications." };
57
62
  }
58
63
  export function workspacePlacementStateLabel(state) {
59
- return { pending: "Queued", leased: "Preparing send", sent: "Awaiting receiver observation", awaiting_results: "Awaiting receiver observation", observed: "Observed", not_observed: "Not observed within two hours", send_failed: "Send failed", send_unknown: "Send outcome unknown; do not resend", read_blocked: "Receiver could not be checked", uncertain: "Send outcome unknown; do not resend", canceled: "Send canceled", failed: "Send failed" }[state] ?? "Pending";
64
+ return { pending: "Queued", leased: "Preparing send", sent: "Awaiting receiver observation", awaiting_results: "Awaiting receiver observation", observed: "Observed", not_observed: "Not observed within two hours", send_failed: "Send failed", not_sent: "Not sent within the 30-minute test window", send_unknown: "Send outcome unknown; do not resend", read_blocked: "Receiver could not be checked", uncertain: "Send outcome unknown; do not resend", canceled: "Send canceled", failed: "Send failed" }[state] ?? "Pending";
60
65
  }
61
66
  function pageNumber(value, fallback, max, field) {
62
67
  if (value === undefined)
@@ -99,5 +104,5 @@ export function workspacePlacementProbePage(probes, input, defaultLimit = 10) {
99
104
  }
100
105
  export function workspacePlacementPreviewPage(plan, input = {}) {
101
106
  const { probes: _probes, ...metadata } = plan;
102
- return { ...metadata, ...(plan.scheduling ? { provider_directions: placementProviderDirections(plan.probes), schedule_summary: placementScheduleSummary(plan.probes.map(p => ({ scheduled_at: p.scheduled_at }))) } : {}), ...workspacePlacementProbePage(plan.probes.map(workspacePlacementProbeMeta), input, 5) };
107
+ return { ...metadata, ...(plan.scheduling ? { provider_directions: placementProviderDirections(plan.probes), schedule_summary: placementScheduleSummary(plan.probes.map(p => ({ scheduled_at: p.scheduled_at })), { schedule: plan.scheduling, start: plan.rendered_at ?? plan.probes[0]?.scheduled_at ?? new Date(0) }) } : {}), ...workspacePlacementProbePage(plan.probes.map(workspacePlacementProbeMeta), input, 5) };
103
108
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@oxygen-agent/cli",
3
- "version": "1.1014.2110",
3
+ "version": "1.1014.2119",
4
4
  "private": false,
5
5
  "license": "UNLICENSED",
6
6
  "type": "module",