@whittlelabs/sifter 0.42.0 → 0.42.2

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 (3) hide show
  1. package/bin.js +25 -6
  2. package/bin.js.map +2 -2
  3. package/package.json +1 -1
package/bin.js CHANGED
@@ -9636,6 +9636,7 @@ var require_canonicalise = __commonJS({
9636
9636
  description: workflow.description ?? null,
9637
9637
  ownerClass: opts.ownerClass,
9638
9638
  ownerId: opts.ownerId,
9639
+ ...opts.visibility !== void 0 ? { visibility: opts.visibility } : {},
9639
9640
  retainPublishedVersions: workflow.retain?.publishedVersions ?? null,
9640
9641
  ...opts.publish !== void 0 ? { publish: opts.publish } : {},
9641
9642
  nodes,
@@ -9802,7 +9803,15 @@ var require_seed_workflows = __commonJS({
9802
9803
  for (const workflow of opts.workflows) {
9803
9804
  let ownerClass;
9804
9805
  let ownerId;
9805
- if ("service" in workflow.owner) {
9806
+ let visibility;
9807
+ if ("platform" in workflow.owner) {
9808
+ if (!opts.platformOrgId) {
9809
+ throw new errors_1.SeedWorkflowsError(workflow.name, "seedWorkflows: a platform workflow needs platformOrgId, the Whittle Labs org id");
9810
+ }
9811
+ ownerClass = "org";
9812
+ ownerId = opts.platformOrgId;
9813
+ visibility = "published";
9814
+ } else if ("service" in workflow.owner) {
9806
9815
  ownerClass = "service";
9807
9816
  ownerId = workflow.owner.service;
9808
9817
  } else {
@@ -9814,6 +9823,8 @@ var require_seed_workflows = __commonJS({
9814
9823
  ownerId = orgId;
9815
9824
  }
9816
9825
  const opts2 = { ownerClass, ownerId };
9826
+ if (visibility !== void 0)
9827
+ opts2.visibility = visibility;
9817
9828
  if (opts.env !== void 0)
9818
9829
  opts2.env = opts.env;
9819
9830
  if (opts.publish !== void 0)
@@ -9822,6 +9833,7 @@ var require_seed_workflows = __commonJS({
9822
9833
  logger.info(`seeding workflow ${workflow.name}`, {
9823
9834
  ownerClass,
9824
9835
  ownerId,
9836
+ ...visibility !== void 0 ? { visibility } : {},
9825
9837
  nodes: body2.nodes.length,
9826
9838
  transitions: body2.transitions.length
9827
9839
  });
@@ -68685,6 +68697,7 @@ var require_subscribe = __commonJS({
68685
68697
  }
68686
68698
  var STOPPED = Symbol("stopped");
68687
68699
  var STREAMING_POLL_MS = 3e5;
68700
+ var STREAM_RETRY_MS = 3e5;
68688
68701
  var HINT_JITTER_MS = 250;
68689
68702
  var DECLINE_WINDOW = 25;
68690
68703
  var DECLINED_MEMORY = 1e3;
@@ -68701,7 +68714,8 @@ var require_subscribe = __commonJS({
68701
68714
  let pollAgain = false;
68702
68715
  let hintStream = null;
68703
68716
  let streamLive = false;
68704
- let streamSupported = opts.stream ?? true;
68717
+ const streamWanted = opts.stream ?? true;
68718
+ let streamRefusedAt = null;
68705
68719
  let inflight = 0;
68706
68720
  let resolvedPoolIds = [];
68707
68721
  const controllers = /* @__PURE__ */ new Map();
@@ -68858,8 +68872,11 @@ var require_subscribe = __commonJS({
68858
68872
  schedulePoll(pollIntervalMs);
68859
68873
  }
68860
68874
  function openHintStream(mySession) {
68861
- if (!streamSupported || typeof opts.jobsClient.openHintStream !== "function")
68875
+ if (!streamWanted || hintStream || typeof opts.jobsClient.openHintStream !== "function")
68876
+ return;
68877
+ if (streamRefusedAt !== null && Date.now() - streamRefusedAt < STREAM_RETRY_MS)
68862
68878
  return;
68879
+ streamRefusedAt = null;
68863
68880
  hintStream = (0, realtime_client_1.connectStream)({
68864
68881
  open: ({ lastEventId }, signal) => opts.jobsClient.openHintStream({ ...shift ? { shift: shift.id } : {}, lastEventId, signal }),
68865
68882
  onMessage: (message) => {
@@ -68874,9 +68891,9 @@ var require_subscribe = __commonJS({
68874
68891
  return;
68875
68892
  streamLive = status === "live";
68876
68893
  if (status === "stopped") {
68877
- streamSupported = false;
68894
+ streamRefusedAt = Date.now();
68878
68895
  hintStream = null;
68879
- logger.debug?.("Jobs offers no hint stream; polling instead");
68896
+ logger.debug?.("Jobs offers no hint stream; polling instead, and asking again in five minutes");
68880
68897
  }
68881
68898
  if (!streamLive)
68882
68899
  pollSoon(pollIntervalMs);
@@ -69023,6 +69040,8 @@ var require_subscribe = __commonJS({
69023
69040
  }
69024
69041
  }
69025
69042
  async function pollOnce(mySession) {
69043
+ if (!hintStream && streamRefusedAt !== null)
69044
+ openHintStream(mySession);
69026
69045
  let nextPollMs = streamLive ? STREAMING_POLL_MS : pollIntervalMs;
69027
69046
  try {
69028
69047
  const paused = holds.size > 0;
@@ -75984,7 +76003,7 @@ var import_path = require("path");
75984
76003
  var import_promises = require("fs/promises");
75985
76004
  var import_yaml = __toESM(require_dist5());
75986
76005
  var import_shuttle = __toESM(require_dist8());
75987
- var buildVersion = true ? "0.42.0" : pkg.version;
76006
+ var buildVersion = true ? "0.42.2" : pkg.version;
75988
76007
  var AGENT_EXECUTORS = ["claude-code", "codex", "copilot"];
75989
76008
  var sifterBrand = {
75990
76009
  product: {