@whittlelabs/sifter 0.42.2 → 0.42.4

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 +19 -20
  2. package/bin.js.map +2 -2
  3. package/package.json +1 -1
package/bin.js CHANGED
@@ -9811,9 +9811,6 @@ var require_seed_workflows = __commonJS({
9811
9811
  ownerClass = "org";
9812
9812
  ownerId = opts.platformOrgId;
9813
9813
  visibility = "published";
9814
- } else if ("service" in workflow.owner) {
9815
- ownerClass = "service";
9816
- ownerId = workflow.owner.service;
9817
9814
  } else {
9818
9815
  const orgId = opts.ownerSlugToOrgId[workflow.owner.orgSlug];
9819
9816
  if (orgId === void 0) {
@@ -58644,8 +58641,8 @@ var require_client = __commonJS({
58644
58641
  * service identity recorded as the conduit. Requires this client to be
58645
58642
  * constructed with a service token holding `keep:actor-tokens:write`.
58646
58643
  */
58647
- async mintActorToken(actor) {
58648
- return this.request("POST", "/api/actor-tokens", { actor });
58644
+ async mintActorToken(principal) {
58645
+ return this.request("POST", "/api/actor-tokens", { principal });
58649
58646
  }
58650
58647
  // ── Identity ────────────────────────────────────────────────────
58651
58648
  /**
@@ -58753,18 +58750,17 @@ var require_client = __commonJS({
58753
58750
  // ── Substrate Provisioning ──────────────────────────────────────
58754
58751
  /**
58755
58752
  * Find-or-create a Keep agent (service identity) on behalf of the
58756
- * given principal. Idempotent on `(ownerPrincipalId, name)`; returns
58753
+ * given principal. Idempotent on `(owner, name)`; returns
58757
58754
  * `clientSecret: null` on re-find.
58758
58755
  *
58759
58756
  * Requires `keep:service-identities:write`.
58760
58757
  */
58761
58758
  async findOrCreateServiceIdentity(request) {
58762
- return this.request("POST", `/api/users/${request.ownerPrincipalId}/service-identities`, request);
58759
+ return this.request("POST", `/api/users/${request.owner.principalId}/service-identities`, request);
58763
58760
  }
58764
58761
  /**
58765
- * Bind a role (by name) to a service identity, anchored to a
58766
- * structural principal: user-owned Sifters pass `userId`;
58767
- * team/org-anchored bindings pass `teamId`/`orgId`.
58762
+ * Bind a role (by name) to a service identity, held at a structural
58763
+ * principal (`anchor`): a user-owned Sifter's own user, or a team or org.
58768
58764
  *
58769
58765
  * Requires `keep:role-bindings:write`.
58770
58766
  */
@@ -68197,19 +68193,22 @@ var require_client2 = __commonJS({
68197
68193
  return this.request("POST", "/api/job-pools", options);
68198
68194
  }
68199
68195
  /**
68200
- * Idempotent upsert by `(principal_class, principal_id, name)`. When the
68196
+ * Idempotent upsert by owner and name. When the
68201
68197
  * pool exists, returns the existing row without modifying membership
68202
68198
  * constraints. The Sift provisioning hook relies on this semantics.
68203
68199
  */
68204
68200
  async findOrCreateJobPool(options) {
68205
68201
  return this.request("POST", "/api/job-pools?idempotent=true", options);
68206
68202
  }
68203
+ /**
68204
+ * Every tenant's pools, which needs jobs:job-pools:read at operator context
68205
+ * (a service's operator grant). `owner` narrows to one owner and `name` to
68206
+ * one exact name; neither confers standing (BE-035).
68207
+ */
68207
68208
  async listJobPools(filters) {
68208
68209
  const params = new URLSearchParams();
68209
- if (filters?.principalClass)
68210
- params.set("principalClass", filters.principalClass);
68211
- if (filters?.principalId)
68212
- params.set("principalId", filters.principalId);
68210
+ if (filters?.owner)
68211
+ params.set("owner", `${filters.owner.principalClass}:${filters.owner.principalId}`);
68213
68212
  if (filters?.name)
68214
68213
  params.set("name", filters.name);
68215
68214
  const qs = params.toString();
@@ -68226,15 +68225,15 @@ var require_client2 = __commonJS({
68226
68225
  * reference is inherently ambiguous — and silently picking one (the old
68227
68226
  * behavior took the server's newest-first ordering) is exactly the
68228
68227
  * capture vector the per-owner constraint closed, re-opened cross-owner.
68229
- * So it refuses instead: reference the pool by id, or list with explicit
68230
- * principal filters, when more than one owner holds the name.
68228
+ * So it refuses instead: reference the pool by id, or list with an explicit
68229
+ * owner filter, when more than one owner holds the name.
68231
68230
  */
68232
68231
  async resolveJobPoolByName(name2) {
68233
68232
  const pools = await this.listJobPools({ name: name2 });
68234
68233
  const matches = pools.filter((p) => p.name === name2);
68235
- const owners = new Set(matches.map((p) => `${p.principalClass ?? ""}/${p.principalId ?? ""}`));
68234
+ const owners = new Set(matches.map((p) => `${p.owner?.principalClass ?? ""}:${p.owner?.principalId ?? ""}`));
68236
68235
  if (owners.size > 1) {
68237
- const error = new Error(`Job pool name "${name2}" is ambiguous: ${matches.length} pools under ${owners.size} different owners hold it. Reference the pool by id, or resolve it with explicit principal filters (listJobPools).`);
68236
+ const error = new Error(`Job pool name "${name2}" is ambiguous: ${matches.length} pools under ${owners.size} different owners hold it. Reference the pool by id, or resolve it with an explicit owner filter (listJobPools).`);
68238
68237
  error.code = "JOB_POOL_NAME_AMBIGUOUS";
68239
68238
  throw error;
68240
68239
  }
@@ -76003,7 +76002,7 @@ var import_path = require("path");
76003
76002
  var import_promises = require("fs/promises");
76004
76003
  var import_yaml = __toESM(require_dist5());
76005
76004
  var import_shuttle = __toESM(require_dist8());
76006
- var buildVersion = true ? "0.42.2" : pkg.version;
76005
+ var buildVersion = true ? "0.42.4" : pkg.version;
76007
76006
  var AGENT_EXECUTORS = ["claude-code", "codex", "copilot"];
76008
76007
  var sifterBrand = {
76009
76008
  product: {