@oxygen-agent/cli 1.1014.1997 → 1.1014.2040

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.
Files changed (119) hide show
  1. package/README.md +1 -1
  2. package/dist/command-families/tables/options.d.ts +1 -0
  3. package/dist/command-families/tables/register-automation.js +3 -1
  4. package/dist/commands/observability.js +4 -4
  5. package/dist/commands/table-runs.js +10 -0
  6. package/dist/commands/tags.js +2 -2
  7. package/dist/commands/workflows.js +31 -10
  8. package/dist/http-client.d.ts +1 -1
  9. package/dist/http-client.js +1 -1
  10. package/node_modules/@oxygen/formula/dist/cross-row-function.d.ts +13 -0
  11. package/node_modules/@oxygen/formula/dist/cross-row-function.js +1 -0
  12. package/node_modules/@oxygen/formula/dist/{refactor-internals → cross-row-functions}/novelty-score.d.ts +2 -0
  13. package/node_modules/@oxygen/formula/dist/{refactor-internals → cross-row-functions}/novelty-score.js +1 -0
  14. package/node_modules/@oxygen/formula/dist/cross-row-functions.generated.d.ts +3 -0
  15. package/node_modules/@oxygen/formula/dist/cross-row-functions.generated.js +3 -0
  16. package/node_modules/@oxygen/formula/dist/evaluate.d.ts +12 -1
  17. package/node_modules/@oxygen/formula/dist/evaluate.js +28 -3
  18. package/node_modules/@oxygen/recipe-sdk/dist/index.d.ts +2 -0
  19. package/node_modules/@oxygen/shared/dist/capability-discovery.js +1 -1
  20. package/node_modules/@oxygen/shared/dist/cell-format.js +2 -2
  21. package/node_modules/@oxygen/shared/dist/collab.d.ts +1 -1
  22. package/node_modules/@oxygen/shared/dist/contracts/geo.js +1 -1
  23. package/node_modules/@oxygen/shared/dist/dnc-identities.js +1 -1
  24. package/node_modules/@oxygen/shared/dist/error-redaction.d.ts +1 -1
  25. package/node_modules/@oxygen/shared/dist/error-redaction.js +2 -2
  26. package/node_modules/@oxygen/shared/dist/esp-contract.d.ts +133 -0
  27. package/node_modules/@oxygen/shared/dist/esp-contract.js +121 -0
  28. package/node_modules/@oxygen/shared/dist/{geo.js → geo/geo.js} +2 -2
  29. package/node_modules/@oxygen/shared/dist/index.d.ts +6 -5
  30. package/node_modules/@oxygen/shared/dist/index.js +7 -5
  31. package/node_modules/@oxygen/shared/dist/knowledge-bootstrap.js +1 -1
  32. package/node_modules/@oxygen/shared/dist/linkedin-connection-identity.js +1 -1
  33. package/node_modules/@oxygen/shared/dist/{sending-domain-rollout.js → mailboxes/sending-domain-rollout.js} +1 -1
  34. package/node_modules/@oxygen/shared/dist/mcp-event-contract.js +1 -1
  35. package/node_modules/@oxygen/shared/dist/{social-post-metrics-core.d.ts → posts/metrics-core.d.ts} +1 -1
  36. package/node_modules/@oxygen/shared/dist/{social-post-metrics-linkedin.d.ts → posts/metrics-linkedin.d.ts} +1 -1
  37. package/node_modules/@oxygen/shared/dist/{social-post-metrics-linkedin.js → posts/metrics-linkedin.js} +2 -2
  38. package/node_modules/@oxygen/shared/dist/{social-post-metrics-series.d.ts → posts/metrics-series.d.ts} +1 -1
  39. package/node_modules/@oxygen/shared/dist/{social-post-metrics-series.js → posts/metrics-series.js} +1 -1
  40. package/node_modules/@oxygen/shared/dist/{social-post-metrics-x.d.ts → posts/metrics-x.d.ts} +1 -1
  41. package/node_modules/@oxygen/shared/dist/{social-post-metrics-x.js → posts/metrics-x.js} +2 -2
  42. package/node_modules/@oxygen/shared/dist/{social-post-metrics.d.ts → posts/metrics.d.ts} +3 -3
  43. package/node_modules/@oxygen/shared/dist/{social-post-metrics.js → posts/metrics.js} +3 -3
  44. package/node_modules/@oxygen/shared/dist/recipient-provider.d.ts +2 -10
  45. package/node_modules/@oxygen/shared/dist/recipient-provider.js +1 -9
  46. package/node_modules/@oxygen/shared/dist/sequence-internals/esp-policy.d.ts +2 -118
  47. package/node_modules/@oxygen/shared/dist/sequence-internals/esp-policy.js +2 -107
  48. package/node_modules/@oxygen/shared/dist/sequences.d.ts +0 -1
  49. package/node_modules/@oxygen/shared/dist/sequences.js +0 -2
  50. package/node_modules/@oxygen/shared/dist/{native-chat-discovery.d.ts → support/native-chat-discovery.d.ts} +1 -1
  51. package/node_modules/@oxygen/shared/dist/{native-chat-discovery.js → support/native-chat-discovery.js} +1 -1
  52. package/node_modules/@oxygen/shared/dist/suppression-entries.js +1 -1
  53. package/node_modules/@oxygen/shared/dist/table-field-types.d.ts +1 -1
  54. package/node_modules/@oxygen/shared/dist/table-field-types.js +2 -2
  55. package/node_modules/@oxygen/shared/dist/{column-output-fields.js → tables/column-output-fields.js} +4 -4
  56. package/node_modules/@oxygen/shared/dist/{tags.d.ts → tags/tags.d.ts} +1 -1
  57. package/node_modules/@oxygen/shared/dist/{tags.js → tags/tags.js} +1 -1
  58. package/node_modules/@oxygen/shared/dist/ugc-amplification-identity.js +1 -1
  59. package/node_modules/@oxygen/shared/dist/version.generated.d.ts +1 -1
  60. package/node_modules/@oxygen/shared/dist/version.generated.js +1 -1
  61. package/node_modules/@oxygen/shared/dist/workspace-placement-bulk.d.ts +6 -0
  62. package/node_modules/@oxygen/shared/dist/workspace-placement-bulk.js +9 -2
  63. package/node_modules/@oxygen/shared/dist/workspace-placement-schedule.d.ts +44 -0
  64. package/node_modules/@oxygen/shared/dist/workspace-placement-schedule.js +90 -0
  65. package/node_modules/@oxygen/shared/dist/workspace-placement-view.d.ts +24 -0
  66. package/node_modules/@oxygen/shared/dist/workspace-placement-view.js +5 -4
  67. package/node_modules/@oxygen/shared/dist/workspace-placement.d.ts +4 -0
  68. package/node_modules/@oxygen/shared/dist/workspace-placement.js +7 -1
  69. package/node_modules/@oxygen/shared/package.json +0 -25
  70. package/node_modules/@oxygen/workflows/dist/cron.d.ts +42 -0
  71. package/node_modules/@oxygen/workflows/dist/cron.js +271 -0
  72. package/node_modules/@oxygen/workflows/dist/event-dispatch.d.ts +2 -1
  73. package/node_modules/@oxygen/workflows/dist/graph/condition.d.ts +3 -0
  74. package/node_modules/@oxygen/workflows/dist/graph/condition.js +19 -0
  75. package/node_modules/@oxygen/workflows/dist/graph/expression.d.ts +1 -2
  76. package/node_modules/@oxygen/workflows/dist/graph/expression.js +2 -19
  77. package/node_modules/@oxygen/workflows/dist/graph/types.d.ts +4 -3
  78. package/node_modules/@oxygen/workflows/dist/index.d.ts +8 -985
  79. package/node_modules/@oxygen/workflows/dist/index.js +8 -1221
  80. package/node_modules/@oxygen/workflows/dist/manifest-builders.d.ts +73 -0
  81. package/node_modules/@oxygen/workflows/dist/manifest-builders.js +102 -0
  82. package/node_modules/@oxygen/workflows/dist/manifest-guards.d.ts +16 -0
  83. package/node_modules/@oxygen/workflows/dist/manifest-guards.js +34 -0
  84. package/node_modules/@oxygen/workflows/dist/manifest-hash.d.ts +47 -0
  85. package/node_modules/@oxygen/workflows/dist/manifest-hash.js +102 -0
  86. package/node_modules/@oxygen/workflows/dist/manifest-lint.d.ts +17 -0
  87. package/node_modules/@oxygen/workflows/dist/manifest-lint.js +474 -0
  88. package/node_modules/@oxygen/workflows/dist/manifest-types.d.ts +256 -0
  89. package/node_modules/@oxygen/workflows/dist/manifest-types.js +9 -0
  90. package/node_modules/@oxygen/workflows/dist/pure-function.d.ts +17 -0
  91. package/node_modules/@oxygen/workflows/dist/pure-function.js +130 -0
  92. package/node_modules/@oxygen/workflows/dist/refactor-internals/condition-comparison.d.ts +1 -17
  93. package/node_modules/@oxygen/workflows/dist/refactor-internals/condition-comparison.js +1 -93
  94. package/node_modules/@oxygen/workflows/dist/refactor-internals/condition-pattern.d.ts +16 -0
  95. package/node_modules/@oxygen/workflows/dist/refactor-internals/condition-pattern.js +92 -0
  96. package/node_modules/@oxygen/workflows/dist/workflow-schemas.d.ts +545 -0
  97. package/node_modules/@oxygen/workflows/dist/workflow-schemas.js +135 -0
  98. package/node_modules/@oxygen/workflows/package.json +4 -0
  99. package/package.json +1 -1
  100. /package/node_modules/@oxygen/shared/dist/{geo.d.ts → geo/geo.d.ts} +0 -0
  101. /package/node_modules/@oxygen/shared/dist/{sending-domain-rollout.d.ts → mailboxes/sending-domain-rollout.d.ts} +0 -0
  102. /package/node_modules/@oxygen/shared/dist/{attempt-provenance.d.ts → observability/attempt-provenance.d.ts} +0 -0
  103. /package/node_modules/@oxygen/shared/dist/{attempt-provenance.js → observability/attempt-provenance.js} +0 -0
  104. /package/node_modules/@oxygen/shared/dist/{linkedin-mentions.d.ts → posts/linkedin-mentions.d.ts} +0 -0
  105. /package/node_modules/@oxygen/shared/dist/{linkedin-mentions.js → posts/linkedin-mentions.js} +0 -0
  106. /package/node_modules/@oxygen/shared/dist/{linkedin-post-keywords.d.ts → posts/linkedin-post-keywords.d.ts} +0 -0
  107. /package/node_modules/@oxygen/shared/dist/{linkedin-post-keywords.js → posts/linkedin-post-keywords.js} +0 -0
  108. /package/node_modules/@oxygen/shared/dist/{linkedin-post-url.d.ts → posts/linkedin-post-url.d.ts} +0 -0
  109. /package/node_modules/@oxygen/shared/dist/{linkedin-post-url.js → posts/linkedin-post-url.js} +0 -0
  110. /package/node_modules/@oxygen/shared/dist/{social-post-metrics-core.js → posts/metrics-core.js} +0 -0
  111. /package/node_modules/@oxygen/shared/dist/{native-chat.d.ts → support/native-chat.d.ts} +0 -0
  112. /package/node_modules/@oxygen/shared/dist/{native-chat.js → support/native-chat.js} +0 -0
  113. /package/node_modules/@oxygen/shared/dist/{plain-support-events.d.ts → support/plain-support-events.d.ts} +0 -0
  114. /package/node_modules/@oxygen/shared/dist/{plain-support-events.js → support/plain-support-events.js} +0 -0
  115. /package/node_modules/@oxygen/shared/dist/{column-output-fields.d.ts → tables/column-output-fields.d.ts} +0 -0
  116. /package/node_modules/@oxygen/shared/dist/{linkedin-url.d.ts → tables/linkedin-url.d.ts} +0 -0
  117. /package/node_modules/@oxygen/shared/dist/{linkedin-url.js → tables/linkedin-url.js} +0 -0
  118. /package/node_modules/@oxygen/shared/dist/{select-options.d.ts → tables/select-options.d.ts} +0 -0
  119. /package/node_modules/@oxygen/shared/dist/{select-options.js → tables/select-options.js} +0 -0
@@ -158,8 +158,6 @@ export function recipientEmailFromRow(rowValues, emailColumnKey) {
158
158
  }
159
159
  /** The `{{key}}` columns one template reads (the copy-provenance stamp keys its entries by them). */
160
160
  export { templateColumnKeys };
161
- // Existing Sequence imports retain the same ESP contract and function identities.
162
- export { ESP_MATCHING_MODES, DEFAULT_ESP_MATCHING_MODE, isEspMatchingMode, validateEspMatchingSetting, RECIPIENT_ESPS, ESP_ROUTE_BUCKETS, MAX_ESP_SENDER_EXCLUSIONS, MAX_ESP_ROUTE_WEIGHT, isEspRouteBucket, normalizeEspSenderDomain, espPolicyFromSetting, espRouteWeightsFor, espRouteCandidates, espExcludedSenderDomains, RECIPIENT_ESP_FAMILIES, isRecipientEspFamily, isEspGatewayFamily, matchableEspFromFamily, familyFromMxHosts, espFromSpfRecords, inferRecipientEspFamily, inferRecipientEsp, espFromMxHosts, } from "./sequence-internals/esp-policy.js";
163
161
  /**
164
162
  * row_values keys an enrollment's phone number may live under, in
165
163
  * send-precedence order, for WhatsApp sends. The enroll path resolves the FIRST
@@ -1,4 +1,4 @@
1
- import type { CapabilityRouteMatch } from "./capability-discovery.js";
1
+ import type { CapabilityRouteMatch } from "../capability-discovery.js";
2
2
  export declare function nativeChatEnabled(env?: NodeJS.ProcessEnv): boolean;
3
3
  export declare function isNativeChatTool(name: string): boolean;
4
4
  /** The compiled support card includes the dev surface; hosted discovery projects it away when closed. */
@@ -1,4 +1,4 @@
1
- import { resolveDeployEnv } from "./deploy-env.js";
1
+ import { resolveDeployEnv } from "../deploy-env.js";
2
2
  export function nativeChatEnabled(env = process.env) {
3
3
  if (!/^(1|true|on)$/i.test(env.OXYGEN_NATIVE_CHAT_ENABLED?.trim() ?? ""))
4
4
  return false;
@@ -1,4 +1,4 @@
1
- import { looksLikeUrlIdentifier, normalizeLinkedinProfileUrl } from "./linkedin-url.js";
1
+ import { looksLikeUrlIdentifier, normalizeLinkedinProfileUrl } from "./tables/linkedin-url.js";
2
2
  /**
3
3
  * A LinkedIn member id as Unipile surfaces it (e.g. "ACoAADXaTD4B…"): the "AC"
4
4
  * prefix plus base64url payload. Anchored and length-bounded so a short word that
@@ -1,4 +1,4 @@
1
- import { type SelectOption } from "./select-options.js";
1
+ import { type SelectOption } from "./tables/select-options.js";
2
2
  export declare const TABLE_FIELD_TYPES: readonly ["text", "number", "checkbox", "date", "json", "markdown", "image", "select", "multi_select", "status"];
3
3
  export type TableFieldType = (typeof TABLE_FIELD_TYPES)[number];
4
4
  export type TableFieldDataType = "text" | "numeric" | "boolean" | "timestamptz" | "jsonb";
@@ -14,8 +14,8 @@
14
14
  // thing a person or an agent actually asks for.
15
15
  //
16
16
  // CLIENT-SAFE LEAF: the web picker imports it; keep runtime imports to
17
- // ./select-options.
18
- import { normalizeSelectOptions } from "./select-options.js";
17
+ // ./tables/select-options.
18
+ import { normalizeSelectOptions } from "./tables/select-options.js";
19
19
  export const TABLE_FIELD_TYPES = [
20
20
  "text",
21
21
  "number",
@@ -26,10 +26,10 @@
26
26
  * may contain a dot or a space. Such a field carries `referenceable: false` and
27
27
  * is display-only.
28
28
  */
29
- import { buildResearchCellSchema, isResearchEnvelopeSchema, researchEvidenceRequired, deriveResearchOutputContract, usesServerManagedResearchSchema, } from "./research-output-contract.js";
30
- import { isTemplateSafePath, parseJsonPath, readJsonPath } from "./json-path.js";
31
- import { isRecord } from "./type-guards.js";
32
- import { readString } from "./value-readers.js";
29
+ import { buildResearchCellSchema, isResearchEnvelopeSchema, researchEvidenceRequired, deriveResearchOutputContract, usesServerManagedResearchSchema, } from "../research-output-contract.js";
30
+ import { isTemplateSafePath, parseJsonPath, readJsonPath } from "../json-path.js";
31
+ import { isRecord } from "../type-guards.js";
32
+ import { readString } from "../value-readers.js";
33
33
  const MAX_FIELDS = 40;
34
34
  const MAX_SCHEMA_DEPTH = 5;
35
35
  const EMPTY_CONTRACT = {
@@ -1,4 +1,4 @@
1
- import type { TagColor } from "./select-options.js";
1
+ import type { TagColor } from "../tables/select-options.js";
2
2
  /** Primitive kinds that participate in the workspace tag union today. */
3
3
  export declare const TAG_KINDS: readonly ["knowledge_page", "publishing_post", "sequence", "table", "workflow", "recipe", "conversation", "mailbox", "sender", "record", "domain", "project", "sender_profile", "voice_number", "signal_type", "dashboard", "agent", "ad_search_collection"];
4
4
  export type TagKind = (typeof TAG_KINDS)[number];
@@ -10,7 +10,7 @@
10
10
  // `ox_context.workspace_tags`) OR CARRIED (some store's tags array holds it).
11
11
  // The registry is an ANNOTATION table — description, color override, pinned —
12
12
  // and never records which items carry a tag. Drift is legal in both directions.
13
- import { casePreservingTagWritesReady } from "./write-rollout.js";
13
+ import { casePreservingTagWritesReady } from "../write-rollout.js";
14
14
  /** Primitive kinds that participate in the workspace tag union today. */
15
15
  export const TAG_KINDS = [
16
16
  "knowledge_page",
@@ -1,4 +1,4 @@
1
- import { linkedinPostIdFromUrl, looksLikeUrlIdentifier } from "./linkedin-url.js";
1
+ import { linkedinPostIdFromUrl, looksLikeUrlIdentifier } from "./tables/linkedin-url.js";
2
2
  /** Provider aliases for the same public post must share one deduplication key. */
3
3
  export function normalizeLinkedInAmplificationTargetId(value) {
4
4
  const raw = value.trim();
@@ -1 +1 @@
1
- export declare const OXYGEN_BUILD_VERSION = "1.1014.1997";
1
+ export declare const OXYGEN_BUILD_VERSION = "1.1014.2040";
@@ -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.1997";
2
+ export const OXYGEN_BUILD_VERSION = "1.1014.2040";
@@ -1,3 +1,4 @@
1
+ import { placementProviderDirections, placementScheduleSummary, type WorkspacePlacementSchedule } from "./workspace-placement-schedule.js";
1
2
  import { type WorkspacePlacementMailbox, type WorkspacePlacementPlan, type WorkspacePlacementVariant } from "./workspace-placement.js";
2
3
  import { type WorkspacePlacementView } from "./workspace-placement-view.js";
3
4
  export declare const MAX_BULK_PLACEMENT_MESSAGES = 20000;
@@ -11,6 +12,9 @@ export type BulkPlacementCoverage = Record<"google" | "microsoft", {
11
12
  planned: number;
12
13
  }>;
13
14
  export type WorkspacePlacementBulkPlan = {
15
+ provider_directions?: ReturnType<typeof placementProviderDirections>;
16
+ schedule_summary?: ReturnType<typeof placementScheduleSummary>;
17
+ scheduling?: WorkspacePlacementSchedule;
14
18
  request_id: string;
15
19
  organization_id: string;
16
20
  plan_hash: string;
@@ -40,6 +44,7 @@ export type WorkspacePlacementBulkPreview = Omit<WorkspacePlacementBulkPlan, "or
40
44
  receiver_provider: "google" | "microsoft";
41
45
  variant: string;
42
46
  subject: string;
47
+ scheduled_at?: string;
43
48
  body_text_characters: number;
44
49
  body_html_characters: number;
45
50
  }>;
@@ -60,6 +65,7 @@ export declare function bulkPlacementId(value: string): string;
60
65
  export declare function readBulkPlacementProviders(value: unknown): Array<"google" | "microsoft">;
61
66
  /** Own-account rotation, never a sender × receiver Cartesian product. */
62
67
  export declare function buildWorkspacePlacementBulkPlan(input: {
68
+ schedule?: boolean;
63
69
  requestId: string;
64
70
  organizationId: string;
65
71
  renderedAt: string;
@@ -1,3 +1,4 @@
1
+ import { WORKSPACE_PLACEMENT_SCHEDULE, planPlacementSlots, placementProviderDirections, placementScheduleSummary } from "./workspace-placement-schedule.js";
1
2
  import { createHash } from "node:crypto";
2
3
  import { CliHttpError } from "./cli-http-error.js";
3
4
  import { readWorkspacePlacementVariants, workspacePlacementId } from "./workspace-placement.js";
@@ -51,12 +52,18 @@ export function buildWorkspacePlacementBulkPlan(input) {
51
52
  probes.push({ id, sender, receiver, variant });
52
53
  coverage[provider].planned++;
53
54
  }
55
+ if (input.schedule) {
56
+ const slots = new Map(planPlacementSlots(probes, new Date(input.renderedAt)).map(s => [s.id, s]));
57
+ for (const p of probes)
58
+ p.scheduled_at = slots.get(p.id).scheduled_at;
59
+ }
60
+ const scheduling = input.schedule ? { scheduling: WORKSPACE_PLACEMENT_SCHEDULE } : {};
54
61
  const children = [];
55
62
  for (let offset = 0; offset < probes.length; offset += 50) {
56
- const child = { 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) };
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) };
57
64
  children.push({ ...child, plan_hash: createHash("sha256").update(JSON.stringify(child)).digest("hex") });
58
65
  }
59
- const plan = { 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 }))) } : {}), 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 };
60
67
  return { ...plan, plan_hash: createHash("sha256").update(JSON.stringify(plan)).digest("hex") };
61
68
  }
62
69
  export function bulkPlacementSkippedPage(plan, cursor) {
@@ -0,0 +1,44 @@
1
+ /** Native workspace diagnostics have their own allowance; campaign caps are unchanged. */
2
+ export declare const WORKSPACE_PLACEMENT_SCHEDULE: {
3
+ readonly version: 1;
4
+ readonly daily_send_limit: 3;
5
+ readonly window_minutes: 30;
6
+ };
7
+ export type WorkspacePlacementSchedule = typeof WORKSPACE_PLACEMENT_SCHEDULE;
8
+ export type PlacementSlot = {
9
+ id: string;
10
+ mailbox_id: string;
11
+ scheduled_at: string;
12
+ spacing_ms: number;
13
+ };
14
+ export declare function placementUtcDay(at: number): number;
15
+ /** Deterministic estimate, also used under mailbox locks to reserve the actual schedule. */
16
+ export declare function planPlacementSlots(probes: Array<{
17
+ id: string;
18
+ sender: {
19
+ id: string;
20
+ };
21
+ }>, start: Date, occupied?: Array<{
22
+ mailbox_id: string;
23
+ at: string;
24
+ }>): PlacementSlot[];
25
+ export declare function placementScheduleSummary(slots: Array<{
26
+ scheduled_at: string;
27
+ }>): {
28
+ first_send_at: string | null;
29
+ estimated_last_send_at: string | null;
30
+ daily_batches: number;
31
+ };
32
+ export declare function placementProviderDirections(probes: Array<{
33
+ sender: {
34
+ provider: string;
35
+ };
36
+ receiver: {
37
+ provider: string;
38
+ };
39
+ }>): {
40
+ google_to_google: number;
41
+ google_to_microsoft: number;
42
+ microsoft_to_google: number;
43
+ microsoft_to_microsoft: number;
44
+ };
@@ -0,0 +1,90 @@
1
+ /** Native workspace diagnostics have their own allowance; campaign caps are unchanged. */
2
+ export const WORKSPACE_PLACEMENT_SCHEDULE = {
3
+ version: 1,
4
+ daily_send_limit: 3,
5
+ window_minutes: 30,
6
+ };
7
+ const DAY = 86_400_000;
8
+ const WINDOW = WORKSPACE_PLACEMENT_SCHEDULE.window_minutes * 60_000;
9
+ export function placementUtcDay(at) {
10
+ return Math.floor(at / DAY) * DAY;
11
+ }
12
+ /** Deterministic estimate, also used under mailbox locks to reserve the actual schedule. */
13
+ export function planPlacementSlots(probes, start, occupied = []) {
14
+ const groups = new Map();
15
+ for (const p of probes)
16
+ groups.set(p.sender.id, [...(groups.get(p.sender.id) ?? []), p.id]);
17
+ const result = [];
18
+ for (const [mailboxId, ids] of groups) {
19
+ const prior = occupied
20
+ .filter((s) => s.mailbox_id === mailboxId)
21
+ .map((s) => Date.parse(s.at));
22
+ let cursor = start.getTime();
23
+ while (ids.length) {
24
+ const day = placementUtcDay(cursor);
25
+ const used = prior.filter((at) => placementUtcDay(at) === day);
26
+ const count = Math.min(3 - used.length, ids.length);
27
+ if (count <= 0) {
28
+ cursor = day + DAY;
29
+ continue;
30
+ }
31
+ const first = Math.max(cursor, ...used.map((at) => at + WINDOW / 2));
32
+ const end = first + (count > 1 ? WINDOW : 0);
33
+ if (end >= day + DAY) {
34
+ cursor = day + DAY;
35
+ continue;
36
+ }
37
+ for (let i = 0; i < count; i++) {
38
+ const at = first + (count > 1 ? (i * WINDOW) / (count - 1) : 0);
39
+ result.push({
40
+ id: ids.shift(),
41
+ mailbox_id: mailboxId,
42
+ scheduled_at: new Date(at).toISOString(),
43
+ spacing_ms: count > 1 ? WINDOW / (count - 1) : WINDOW / 2,
44
+ });
45
+ prior.push(at);
46
+ }
47
+ cursor = day + DAY;
48
+ }
49
+ }
50
+ // A final day may contain one probe per mailbox. Stagger those distinct
51
+ // senders too: a multi-mailbox batch still spans the thirty-minute window.
52
+ const days = new Map();
53
+ for (const slot of result) {
54
+ const day = slot.scheduled_at.slice(0, 10);
55
+ days.set(day, [...(days.get(day) ?? []), slot]);
56
+ }
57
+ for (const slots of days.values()) {
58
+ if (slots.length < 2 ||
59
+ new Set(slots.map((s) => s.mailbox_id)).size !== slots.length)
60
+ continue;
61
+ const first = Math.max(...slots.map((s) => Date.parse(s.scheduled_at)));
62
+ if (first + WINDOW >= placementUtcDay(first) + DAY)
63
+ continue;
64
+ for (const [index, slot] of slots.entries())
65
+ slot.scheduled_at = new Date(first + (index * WINDOW) / (slots.length - 1)).toISOString();
66
+ }
67
+ return result;
68
+ }
69
+ export function placementScheduleSummary(slots) {
70
+ const times = slots.map((s) => s.scheduled_at).sort();
71
+ return {
72
+ first_send_at: times[0] ?? null,
73
+ estimated_last_send_at: times.at(-1) ?? null,
74
+ daily_batches: new Set(times.map((at) => at.slice(0, 10))).size,
75
+ };
76
+ }
77
+ export function placementProviderDirections(probes) {
78
+ const counts = {
79
+ google_to_google: 0,
80
+ google_to_microsoft: 0,
81
+ microsoft_to_google: 0,
82
+ microsoft_to_microsoft: 0,
83
+ };
84
+ for (const p of probes) {
85
+ const key = `${p.sender.provider}_to_${p.receiver.provider}`;
86
+ if (key in counts)
87
+ counts[key]++;
88
+ }
89
+ return counts;
90
+ }
@@ -1,5 +1,9 @@
1
+ import { placementScheduleSummary, placementProviderDirections, type WorkspacePlacementSchedule } from "./workspace-placement-schedule.js";
1
2
  import { type WorkspacePlacementPlan, type WorkspacePlacementObservation } from "./workspace-placement.js";
2
3
  export type WorkspacePlacementView = {
4
+ provider_directions?: ReturnType<typeof placementProviderDirections>;
5
+ scheduling?: WorkspacePlacementSchedule;
6
+ schedule_summary?: ReturnType<typeof placementScheduleSummary>;
3
7
  id: string;
4
8
  provider: "internal";
5
9
  billing_mode: "internal";
@@ -30,6 +34,8 @@ export type WorkspacePlacementView = {
30
34
  probes: Array<{
31
35
  id: string;
32
36
  sender: string;
37
+ sender_provider?: string;
38
+ scheduled_at?: string;
33
39
  receiver: string;
34
40
  receiver_provider: string;
35
41
  variant: string;
@@ -44,6 +50,7 @@ export type WorkspacePlacementView = {
44
50
  status: string;
45
51
  sent_at: string | null;
46
52
  provider_message_id: string | null;
53
+ ready_at?: string;
47
54
  };
48
55
  observation?: WorkspacePlacementObservation;
49
56
  }>;
@@ -66,6 +73,7 @@ export declare function workspacePlacementView(input: {
66
73
  status: string;
67
74
  sent_at: string | null;
68
75
  provider_message_id: string | null;
76
+ ready_at?: string;
69
77
  }>;
70
78
  created_at: Date | string;
71
79
  }, webUrl: string): WorkspacePlacementView;
@@ -86,6 +94,8 @@ export type WorkspacePlacementCopyPage = {
86
94
  next_offset: number | null;
87
95
  };
88
96
  export declare function workspacePlacementProbeMeta(probe: WorkspacePlacementPlan["probes"][number]): {
97
+ scheduled_at?: string;
98
+ sender_provider: "google" | "microsoft";
89
99
  id: string;
90
100
  sender: string;
91
101
  sender_name: string | null;
@@ -125,6 +135,7 @@ export declare function workspacePlacementPreviewPage(plan: WorkspacePlacementPl
125
135
  allow_paused_probe: boolean;
126
136
  receiver_scope?: "workspace" | "network" | "staff";
127
137
  staff?: import("./workspace-placement.js").StaffPlacementGrant;
138
+ scheduling?: WorkspacePlacementSchedule;
128
139
  rendered_at?: string;
129
140
  rendering?: {
130
141
  tracking_opens: boolean;
@@ -135,6 +146,8 @@ export declare function workspacePlacementPreviewPage(plan: WorkspacePlacementPl
135
146
  message_count: number;
136
147
  plan_hash: string;
137
148
  probes: {
149
+ scheduled_at?: string;
150
+ sender_provider: "google" | "microsoft";
138
151
  id: string;
139
152
  sender: string;
140
153
  sender_name: string | null;
@@ -148,4 +161,15 @@ export declare function workspacePlacementPreviewPage(plan: WorkspacePlacementPl
148
161
  probe_count: number;
149
162
  has_more: boolean;
150
163
  next_cursor: string | null;
164
+ provider_directions?: {
165
+ google_to_google: number;
166
+ google_to_microsoft: number;
167
+ microsoft_to_google: number;
168
+ microsoft_to_microsoft: number;
169
+ };
170
+ schedule_summary?: {
171
+ first_send_at: string | null;
172
+ estimated_last_send_at: string | null;
173
+ daily_batches: number;
174
+ };
151
175
  };
@@ -1,3 +1,4 @@
1
+ import { placementScheduleSummary, placementProviderDirections } from "./workspace-placement-schedule.js";
1
2
  import { CliHttpError } from "./cli-http-error.js";
2
3
  import { placementReceiverLabel } from "./workspace-placement.js";
3
4
  export function workspacePlacementView(input, webUrl) {
@@ -47,10 +48,10 @@ export function workspacePlacementView(input, webUrl) {
47
48
  else if (out?.state === "read_blocked")
48
49
  v.read_blocked++;
49
50
  const state = out?.state ?? (input.deliveries?.[p.id]?.status === "sent" ? "awaiting_results" : input.deliveries?.[p.id]?.status ?? "pending");
50
- return { ...workspacePlacementProbeMeta(p), state, status_label: workspacePlacementStateLabel(state), ...(input.deliveries?.[p.id] ? { delivery: input.deliveries[p.id] } : {}), ...(o ? { observation: p.receiver.network_id ? { ...o, receiver_message_id: "private" } : o } : {}) };
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 } : {}) };
51
52
  });
52
53
  const settled = input.plan.probes.filter(p => input.outcomes[p.id]).length;
53
- return { 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
+ 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
55
  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,
55
56
  directional_note: "Observed placement in participating receiving accounts; not a campaign placement guarantee. Primary and Focused are separate provider classifications." };
56
57
  }
@@ -65,7 +66,7 @@ function pageNumber(value, fallback, max, field) {
65
66
  return value;
66
67
  }
67
68
  export function workspacePlacementProbeMeta(probe) {
68
- return { id: probe.id, sender: probe.sender.address, sender_name: probe.sender.display_name ?? null, receiver: placementReceiverLabel(probe.receiver), receiver_provider: probe.receiver.provider, variant: probe.variant.key, subject: probe.variant.subject,
69
+ return { ...(probe.scheduled_at ? { scheduled_at: probe.scheduled_at } : {}), sender_provider: probe.sender.provider, id: probe.id, sender: probe.sender.address, sender_name: probe.sender.display_name ?? null, receiver: placementReceiverLabel(probe.receiver), receiver_provider: probe.receiver.provider, variant: probe.variant.key, subject: probe.variant.subject,
69
70
  body_text_characters: Array.from(probe.variant.body_text).length, body_html_characters: Array.from(probe.variant.body_html ?? "").length };
70
71
  }
71
72
  export function workspacePlacementCopyPage(plan, input) {
@@ -98,5 +99,5 @@ export function workspacePlacementProbePage(probes, input, defaultLimit = 10) {
98
99
  }
99
100
  export function workspacePlacementPreviewPage(plan, input = {}) {
100
101
  const { probes: _probes, ...metadata } = plan;
101
- return { ...metadata, ...workspacePlacementProbePage(plan.probes.map(workspacePlacementProbeMeta), input, 5) };
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) };
102
103
  }
@@ -1,3 +1,4 @@
1
+ import { type WorkspacePlacementSchedule } from "./workspace-placement-schedule.js";
1
2
  export type WorkspacePlacementVariant = {
2
3
  key: string;
3
4
  subject: string;
@@ -27,6 +28,7 @@ export type WorkspacePlacementProbe = {
27
28
  sender: WorkspacePlacementMailbox;
28
29
  receiver: WorkspacePlacementMailbox;
29
30
  variant: WorkspacePlacementVariant;
31
+ scheduled_at?: string;
30
32
  };
31
33
  export type WorkspacePlacementPlan = {
32
34
  request_id: string;
@@ -37,6 +39,7 @@ export type WorkspacePlacementPlan = {
37
39
  allow_paused_probe: boolean;
38
40
  receiver_scope?: "workspace" | "network" | "staff";
39
41
  staff?: StaffPlacementGrant;
42
+ scheduling?: WorkspacePlacementSchedule;
40
43
  rendered_at?: string;
41
44
  rendering?: {
42
45
  tracking_opens: boolean;
@@ -61,6 +64,7 @@ export declare function buildWorkspacePlacementPlan(input: {
61
64
  receivers: WorkspacePlacementMailbox[];
62
65
  variants: WorkspacePlacementVariant[];
63
66
  allowPausedProbe: boolean;
67
+ schedule?: boolean;
64
68
  renderedAt?: string;
65
69
  rendering?: WorkspacePlacementPlan["rendering"];
66
70
  network?: boolean;
@@ -1,3 +1,4 @@
1
+ import { WORKSPACE_PLACEMENT_SCHEDULE, planPlacementSlots } from "./workspace-placement-schedule.js";
1
2
  import { createHash } from "node:crypto";
2
3
  import { CliHttpError } from "./cli-http-error.js";
3
4
  import { placementCopyIssue } from "./placement-copy.js";
@@ -100,7 +101,12 @@ export function buildWorkspacePlacementPlan(input) {
100
101
  }
101
102
  if (!probes.length || probes.length > 50)
102
103
  invalid("A workspace test must send between one and 50 messages after excluding self-sends.");
103
- const plan = { request_id: requestId, organization_id: organizationId, provider: "internal",
104
+ if (input.schedule && !input.network && !input.staff) {
105
+ const slots = new Map(planPlacementSlots(probes, new Date(input.renderedAt)).map(s => [s.id, s]));
106
+ for (const p of probes)
107
+ p.scheduled_at = slots.get(p.id).scheduled_at;
108
+ }
109
+ const plan = { ...(input.schedule && !input.network && !input.staff ? { scheduling: WORKSPACE_PLACEMENT_SCHEDULE } : {}), request_id: requestId, organization_id: organizationId, provider: "internal",
104
110
  ...(input.network ? { receiver_scope: "network" } : input.staff ? { receiver_scope: "staff", staff: input.staff } : {}), billing_mode: "internal", credits: 0, allow_paused_probe: input.allowPausedProbe,
105
111
  ...(input.renderedAt ? { rendered_at: input.renderedAt } : {}), ...(input.rendering ? { rendering: input.rendering } : {}),
106
112
  probes, excluded_self_sends: excluded, message_count: probes.length };
@@ -51,11 +51,6 @@
51
51
  "import": "./dist/mailbox-import.js",
52
52
  "default": "./dist/mailbox-import.js"
53
53
  },
54
- "./linkedin-url": {
55
- "types": "./dist/linkedin-url.d.ts",
56
- "import": "./dist/linkedin-url.js",
57
- "default": "./dist/linkedin-url.js"
58
- },
59
54
  "./cell-format": {
60
55
  "types": "./dist/cell-format.d.ts",
61
56
  "import": "./dist/cell-format.js",
@@ -76,11 +71,6 @@
76
71
  "import": "./dist/json-path.js",
77
72
  "default": "./dist/json-path.js"
78
73
  },
79
- "./column-output-fields": {
80
- "types": "./dist/column-output-fields.d.ts",
81
- "import": "./dist/column-output-fields.js",
82
- "default": "./dist/column-output-fields.js"
83
- },
84
74
  "./research-output-contract": {
85
75
  "types": "./dist/research-output-contract.d.ts",
86
76
  "import": "./dist/research-output-contract.js",
@@ -106,11 +96,6 @@
106
96
  "import": "./dist/freemail-domains.js",
107
97
  "default": "./dist/freemail-domains.js"
108
98
  },
109
- "./select-options": {
110
- "types": "./dist/select-options.d.ts",
111
- "import": "./dist/select-options.js",
112
- "default": "./dist/select-options.js"
113
- },
114
99
  "./suppression-entries": {
115
100
  "types": "./dist/suppression-entries.d.ts",
116
101
  "import": "./dist/suppression-entries.js",
@@ -237,11 +222,6 @@
237
222
  "import": "./dist/sequences.js",
238
223
  "default": "./dist/sequences.js"
239
224
  },
240
- "./tags": {
241
- "types": "./dist/tags.d.ts",
242
- "import": "./dist/tags.js",
243
- "default": "./dist/tags.js"
244
- },
245
225
  "./collab": {
246
226
  "types": "./dist/collab.d.ts",
247
227
  "import": "./dist/collab.js",
@@ -301,11 +281,6 @@
301
281
  "types": "./dist/provider-balance-signal.d.ts",
302
282
  "import": "./dist/provider-balance-signal.js"
303
283
  },
304
- "./attempt-provenance": {
305
- "types": "./dist/attempt-provenance.d.ts",
306
- "import": "./dist/attempt-provenance.js",
307
- "default": "./dist/attempt-provenance.js"
308
- },
309
284
  "./copilot-skills.generated": null
310
285
  },
311
286
  "dependencies": {}
@@ -0,0 +1,42 @@
1
+ export declare function nextCronRunAfter(input: {
2
+ cron: string;
3
+ timezone?: string | null;
4
+ after?: Date;
5
+ }): Date;
6
+ /**
7
+ * The first slot of `cron` strictly after `after` that is also at least
8
+ * `minIntervalMinutes` after `lastFireAt`. This is how a plan's minimum cron
9
+ * interval (repricing 2026-09, decision L4.2) is enforced at fire time: a
10
+ * schedule that fires closer together than the plan allows keeps running, only
11
+ * slower, and is never deleted (proposal P-47). With no last fire or a minimum
12
+ * of one minute or less it is exactly `nextCronRunAfter`.
13
+ */
14
+ export declare function nextCronRunAfterMinInterval(input: {
15
+ cron: string;
16
+ timezone?: string | null;
17
+ after: Date;
18
+ lastFireAt?: Date | null;
19
+ minIntervalMinutes?: number | null;
20
+ }): Date;
21
+ /**
22
+ * The smallest gap in minutes between two consecutive fires of `cron`, which is
23
+ * what a plan's minimum cron interval is checked against (repricing 2026-09,
24
+ * decision L4.2). It is the smallest gap, never the average: `0,5 9 * * *`
25
+ * fires once a day on average but twice five minutes apart, so its gap is 5.
26
+ *
27
+ * Gaps are measured in real time in `timezone`. A daylight-saving change can
28
+ * bring two fires closer than their wall-clock times suggest (01:55 and 03:05
29
+ * are ten minutes apart on the night the clock skips from 02:00 to 03:00, and
30
+ * a repeated hour can fire 01:45 and then 01:00 again), so the fires around
31
+ * each change in the coming year are simulated as well.
32
+ *
33
+ * Returns null when the schedule never fires twice within the scan (for
34
+ * example `0 9 29 2 *` fires once every few years and has no meaningful gap
35
+ * for a minimum to bind). Throws on an unparseable expression, like
36
+ * `nextCronRunAfter`.
37
+ */
38
+ export declare function minCronGapMinutes(input: {
39
+ cron: string;
40
+ timezone?: string | null;
41
+ now?: Date;
42
+ }): number | null;