@whittlelabs/sifter 0.42.3 → 0.42.5

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 +31 -29
  2. package/bin.js.map +2 -2
  3. package/package.json +1 -1
package/bin.js CHANGED
@@ -58641,8 +58641,8 @@ var require_client = __commonJS({
58641
58641
  * service identity recorded as the conduit. Requires this client to be
58642
58642
  * constructed with a service token holding `keep:actor-tokens:write`.
58643
58643
  */
58644
- async mintActorToken(actor) {
58645
- return this.request("POST", "/api/actor-tokens", { actor });
58644
+ async mintActorToken(principal) {
58645
+ return this.request("POST", "/api/actor-tokens", { principal });
58646
58646
  }
58647
58647
  // ── Identity ────────────────────────────────────────────────────
58648
58648
  /**
@@ -58705,41 +58705,41 @@ var require_client = __commonJS({
58705
58705
  }
58706
58706
  // ── Organizations ───────────────────────────────────────────────
58707
58707
  async listOrganizations() {
58708
- const { organizations } = await this.request("GET", "/api/organizations");
58708
+ const { organizations } = await this.request("GET", "/api/orgs");
58709
58709
  return organizations;
58710
58710
  }
58711
58711
  async getOrganization(orgId) {
58712
- return this.request("GET", `/api/organizations/${orgId}`);
58712
+ return this.request("GET", `/api/orgs/${orgId}`);
58713
58713
  }
58714
58714
  async createOrganization(name2, description) {
58715
- return this.request("POST", "/api/organizations", { name: name2, description });
58715
+ return this.request("POST", "/api/orgs", { name: name2, description });
58716
58716
  }
58717
58717
  async updateOrganization(orgId, updates) {
58718
- return this.request("PATCH", `/api/organizations/${orgId}`, updates);
58718
+ return this.request("PATCH", `/api/orgs/${orgId}`, updates);
58719
58719
  }
58720
58720
  async deleteOrganization(orgId) {
58721
- await this.request("DELETE", `/api/organizations/${orgId}`);
58721
+ await this.request("DELETE", `/api/orgs/${orgId}`);
58722
58722
  }
58723
58723
  async listMembers(orgId) {
58724
- return this.request("GET", `/api/organizations/${orgId}/members`);
58724
+ return this.request("GET", `/api/orgs/${orgId}/members`);
58725
58725
  }
58726
58726
  async removeMember(orgId, userId) {
58727
- await this.request("DELETE", `/api/organizations/${orgId}/members/${userId}`);
58727
+ await this.request("DELETE", `/api/orgs/${orgId}/members/${userId}`);
58728
58728
  }
58729
58729
  async listTeams(orgId) {
58730
- return this.request("GET", `/api/organizations/${orgId}/teams`);
58730
+ return this.request("GET", `/api/orgs/${orgId}/teams`);
58731
58731
  }
58732
58732
  async createTeam(orgId, name2, description) {
58733
- return this.request("POST", `/api/organizations/${orgId}/teams`, { name: name2, description });
58733
+ return this.request("POST", `/api/orgs/${orgId}/teams`, { name: name2, description });
58734
58734
  }
58735
58735
  async listTeamMembers(orgId, teamId) {
58736
- return this.request("GET", `/api/organizations/${orgId}/teams/${teamId}/members`);
58736
+ return this.request("GET", `/api/orgs/${orgId}/teams/${teamId}/members`);
58737
58737
  }
58738
58738
  async addTeamMember(orgId, teamId, userId) {
58739
- return this.request("POST", `/api/organizations/${orgId}/teams/${teamId}/members`, { userId });
58739
+ return this.request("POST", `/api/orgs/${orgId}/teams/${teamId}/members`, { userId });
58740
58740
  }
58741
58741
  async createInvitation(orgId, email, roleGrants) {
58742
- return this.request("POST", `/api/organizations/${orgId}/invitations`, { email, roleGrants });
58742
+ return this.request("POST", `/api/orgs/${orgId}/invitations`, { email, roleGrants });
58743
58743
  }
58744
58744
  async getInvitation(token) {
58745
58745
  return this.request("GET", `/api/invitations/${token}`);
@@ -58750,18 +58750,17 @@ var require_client = __commonJS({
58750
58750
  // ── Substrate Provisioning ──────────────────────────────────────
58751
58751
  /**
58752
58752
  * Find-or-create a Keep agent (service identity) on behalf of the
58753
- * given principal. Idempotent on `(ownerPrincipalId, name)`; returns
58753
+ * given principal. Idempotent on `(owner, name)`; returns
58754
58754
  * `clientSecret: null` on re-find.
58755
58755
  *
58756
58756
  * Requires `keep:service-identities:write`.
58757
58757
  */
58758
58758
  async findOrCreateServiceIdentity(request) {
58759
- return this.request("POST", `/api/users/${request.ownerPrincipalId}/service-identities`, request);
58759
+ return this.request("POST", `/api/users/${request.owner.principalId}/service-identities`, request);
58760
58760
  }
58761
58761
  /**
58762
- * Bind a role (by name) to a service identity, anchored to a
58763
- * structural principal: user-owned Sifters pass `userId`;
58764
- * 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.
58765
58764
  *
58766
58765
  * Requires `keep:role-bindings:write`.
58767
58766
  */
@@ -68194,19 +68193,22 @@ var require_client2 = __commonJS({
68194
68193
  return this.request("POST", "/api/job-pools", options);
68195
68194
  }
68196
68195
  /**
68197
- * Idempotent upsert by `(principal_class, principal_id, name)`. When the
68196
+ * Idempotent upsert by owner and name. When the
68198
68197
  * pool exists, returns the existing row without modifying membership
68199
68198
  * constraints. The Sift provisioning hook relies on this semantics.
68200
68199
  */
68201
68200
  async findOrCreateJobPool(options) {
68202
68201
  return this.request("POST", "/api/job-pools?idempotent=true", options);
68203
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
+ */
68204
68208
  async listJobPools(filters) {
68205
68209
  const params = new URLSearchParams();
68206
- if (filters?.principalClass)
68207
- params.set("principalClass", filters.principalClass);
68208
- if (filters?.principalId)
68209
- params.set("principalId", filters.principalId);
68210
+ if (filters?.owner)
68211
+ params.set("owner", `${filters.owner.principalClass}:${filters.owner.principalId}`);
68210
68212
  if (filters?.name)
68211
68213
  params.set("name", filters.name);
68212
68214
  const qs = params.toString();
@@ -68223,15 +68225,15 @@ var require_client2 = __commonJS({
68223
68225
  * reference is inherently ambiguous — and silently picking one (the old
68224
68226
  * behavior took the server's newest-first ordering) is exactly the
68225
68227
  * capture vector the per-owner constraint closed, re-opened cross-owner.
68226
- * So it refuses instead: reference the pool by id, or list with explicit
68227
- * 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.
68228
68230
  */
68229
68231
  async resolveJobPoolByName(name2) {
68230
68232
  const pools = await this.listJobPools({ name: name2 });
68231
68233
  const matches = pools.filter((p) => p.name === name2);
68232
- 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 ?? ""}`));
68233
68235
  if (owners.size > 1) {
68234
- 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).`);
68235
68237
  error.code = "JOB_POOL_NAME_AMBIGUOUS";
68236
68238
  throw error;
68237
68239
  }
@@ -76000,7 +76002,7 @@ var import_path = require("path");
76000
76002
  var import_promises = require("fs/promises");
76001
76003
  var import_yaml = __toESM(require_dist5());
76002
76004
  var import_shuttle = __toESM(require_dist8());
76003
- var buildVersion = true ? "0.42.3" : pkg.version;
76005
+ var buildVersion = true ? "0.42.5" : pkg.version;
76004
76006
  var AGENT_EXECUTORS = ["claude-code", "codex", "copilot"];
76005
76007
  var sifterBrand = {
76006
76008
  product: {