run402 3.2.0 → 3.3.1

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.
@@ -1,67 +1,87 @@
1
1
  /**
2
- * `transfers` namespace — two-party SIWX-signed project transfer (v1.59).
2
+ * `transfers` namespace — the unified project-transfer noun (v1.93+).
3
3
  *
4
- * Exposed as `r.admin.transfers.*`. Phase 1A surface: initiate (owner-only),
5
- * preview, accept (recipient), cancel (either party), and incoming/outgoing
6
- * inboxes. The handoff is atomic at accept time: ownership flips, CI
7
- * bindings are revoked, secret names carry over (values are NOT visible to
8
- * the recipient before accept), and the project is decorated with a
9
- * persistent `secrets_rotation_advised` advisory.
4
+ * Exposed as `r.admin.transfers.*`. Project transfer is ONE capability,
5
+ * body-discriminated by recipient kind: a wallet recipient (`toWallet`, SIWX
6
+ * bilateral signing) or an email recipient (`toEmail`, the recipient claims
7
+ * into an org). Both ride the same `/transfers` surface there is no separate
8
+ * `/handoffs` noun (the gateway removed it in `unify-project-transfer-surface`).
10
9
  *
11
10
  * Gateway endpoints:
12
- * POST /projects/v1/:project_id/transfers — A initiates
13
- * GET /agent/v1/transfers/incoming — B's inbox
14
- * GET /agent/v1/transfers/outgoing — A's outbox
15
- * GET /agent/v1/transfers/:transfer_id — preview (either party)
16
- * POST /agent/v1/transfers/:transfer_id/accept — B accepts
17
- * POST /agent/v1/transfers/:transfer_id/cancel either party cancels
11
+ * POST /projects/v1/:project_id/transfers — initiate; body { to_wallet } XOR { to_email }
12
+ * GET /agent/v1/transfers/incoming — inbox (both kinds, unioned)
13
+ * GET /agent/v1/transfers/outgoing — outbox (both kinds, unioned)
14
+ * GET /agent/v1/transfers/:transfer_id — preview (kind-agnostic)
15
+ * POST /agent/v1/transfers/:transfer_id/accept — WALLET completion (recipient SIWX-signs)
16
+ * POST /agent/v1/transfers/:transfer_id/claim EMAIL completion (recipient claims into an org)
17
+ * POST /agent/v1/transfers/:transfer_id/cancel — cancel (kind-agnostic)
18
18
  *
19
19
  * Owner-side mutations against a project with a pending transfer return
20
20
  * 409 `PROJECT_HAS_PENDING_TRANSFER`. The SDK kernel surfaces that as
21
- * {@link TransferFreezeError} so agents can guide the user to cancel.
21
+ * {@link TransferFreezeError} so agents can guide the user to cancel. Calling
22
+ * the wrong completion for a row's kind (e.g. `accept` on an email row) returns
23
+ * 409 `WRONG_COMPLETION_FOR_TRANSFER_KIND`; the thrown error exposes
24
+ * `nextActions` pointing at the sibling completion on the SAME `transfer_id`.
22
25
  */
26
+ import { LocalError } from "../errors.js";
23
27
  // ─── Class ───────────────────────────────────────────────────────────────────
24
28
  export class Transfers {
25
29
  client;
26
30
  constructor(client) {
27
31
  this.client = client;
28
32
  }
29
- /**
30
- * Initiate a two-party project transfer. Caller must currently own
31
- * `projectId` (gateway re-reads owner from DB, not cache). Creates a
32
- * `pending` row with a 72h expiry and freezes owner-side mutations on
33
- * the project until the transfer is accepted, cancelled, or expires.
34
- */
35
33
  async initiate(input) {
36
- const body = { to_wallet: input.toWallet };
37
- if (input.billingPolicy !== undefined)
38
- body.billing_policy = input.billingPolicy;
39
- if (input.message !== undefined)
40
- body.message = input.message;
41
- if (input.kysignedRecordId !== undefined)
42
- body.kysigned_record_id = input.kysignedRecordId;
43
- return this.client.request(`/projects/v1/${encodeURIComponent(input.projectId)}/transfers`, {
34
+ const toWallet = "toWallet" in input ? input.toWallet : undefined;
35
+ const toEmail = "toEmail" in input ? input.toEmail : undefined;
36
+ const hasWallet = typeof toWallet === "string" && toWallet.length > 0;
37
+ const hasEmail = typeof toEmail === "string" && toEmail.length > 0;
38
+ if (hasWallet === hasEmail) {
39
+ throw new LocalError("Provide exactly one of toWallet or toEmail.", "initiating project transfer", { code: "VALIDATION_ERROR", details: { fields: ["toWallet", "toEmail"] } });
40
+ }
41
+ const path = `/projects/v1/${encodeURIComponent(input.projectId)}/transfers`;
42
+ if (hasEmail) {
43
+ const body = { to_email: toEmail };
44
+ if (input.message !== undefined)
45
+ body.message = input.message;
46
+ const retain = input.retainCollaborator;
47
+ if (retain !== undefined)
48
+ body.retain_collaborator = retain;
49
+ return this.client.request(path, {
50
+ method: "POST",
51
+ body,
52
+ context: "initiating project transfer",
53
+ });
54
+ }
55
+ const w = input;
56
+ const body = { to_wallet: toWallet };
57
+ if (w.billingPolicy !== undefined)
58
+ body.billing_policy = w.billingPolicy;
59
+ if (w.message !== undefined)
60
+ body.message = w.message;
61
+ if (w.kysignedRecordId !== undefined)
62
+ body.kysigned_record_id = w.kysignedRecordId;
63
+ return this.client.request(path, {
44
64
  method: "POST",
45
65
  body,
46
66
  context: "initiating project transfer",
47
67
  });
48
68
  }
49
69
  /**
50
- * Fetch the preview document for a pending or terminal transfer. The
51
- * caller must be either the `from_wallet` or the `to_wallet`; other
52
- * wallets receive 403. Preview lists secret NAMES (not values), custom
53
- * domains, functions, CI bindings that will be revoked at accept, and
54
- * the billing implications.
70
+ * Fetch the preview document for a pending or terminal transfer of either
71
+ * kind. The caller must be a party to it (wallet signer, addressed-email
72
+ * principal, or offering-org member); other callers receive 403. Preview
73
+ * lists secret NAMES (not values), custom domains, functions, CI bindings
74
+ * that will be revoked at completion, the billing implications, and — on
75
+ * email rows — the `retain_collaborator` offer.
55
76
  */
56
77
  async preview(transferId) {
57
78
  return this.client.request(`/agent/v1/transfers/${encodeURIComponent(transferId)}`, { context: "previewing project transfer" });
58
79
  }
59
80
  /**
60
- * Accept an incoming transfer. The caller's wallet must equal the
61
- * transfer's `to_wallet`. The accept transaction atomically flips
62
- * ownership, revokes A's CI bindings on the project, enqueues
63
- * notifications to both parties, and stamps the persistent
64
- * `secrets_rotation_advised` advisory on the project.
81
+ * Accept an incoming WALLET transfer. The caller's wallet must equal the
82
+ * transfer's `to_wallet`. The accept transaction atomically flips ownership,
83
+ * revokes A's CI bindings on the project, enqueues notifications to both
84
+ * parties, and stamps the persistent `secrets_rotation_advised` advisory.
65
85
  */
66
86
  async accept(transferId) {
67
87
  const result = await this.client.request(`/agent/v1/transfers/${encodeURIComponent(transferId)}/accept`, {
@@ -86,9 +106,45 @@ export class Transfers {
86
106
  return result;
87
107
  }
88
108
  /**
89
- * Cancel a pending transfer. The caller must be either the `from_wallet`
90
- * or the `to_wallet`. Already-accepted/cancelled/expired transfers
91
- * return 409 `TRANSFER_ALREADY_PROCESSED`.
109
+ * Claim an incoming EMAIL transfer into an org. Omit `organizationId` to claim
110
+ * into a brand-new org. The claim atomically flips ownership (the email analog
111
+ * of {@link Transfers.accept}) and returns the new owner's project keys, which
112
+ * `claim` persists to the keystore — symmetric with `accept` (#428 /
113
+ * `project-transfer-claim-credentials`) — so the claimant can operate the
114
+ * project immediately. Note the claim auth model is principal-based (a
115
+ * control-plane session or a verified-email SIWX match), so — unlike `accept`
116
+ * — a wallet is not assumed to be present.
117
+ */
118
+ async claim(transferId, opts = {}) {
119
+ const body = {};
120
+ if (opts.organizationId !== undefined)
121
+ body.org_id = opts.organizationId;
122
+ if (opts.acceptRetainedCollaborator !== undefined) {
123
+ body.accept_retained_collaborator = opts.acceptRetainedCollaborator;
124
+ }
125
+ const result = await this.client.request(`/agent/v1/transfers/${encodeURIComponent(transferId)}/claim`, { method: "POST", body, context: "claiming project transfer" });
126
+ // Persist the new owner's keys so the claimant can operate the project
127
+ // immediately, mirroring `accept`. Keys are returned only after the
128
+ // ownership flip commits, to the authorized claimant.
129
+ if (result.anon_key && result.service_key) {
130
+ const creds = this.client.credentials;
131
+ if (creds.saveProject) {
132
+ await creds.saveProject(result.project_id, {
133
+ anon_key: result.anon_key,
134
+ service_key: result.service_key,
135
+ });
136
+ }
137
+ if (creds.setActiveProject) {
138
+ await creds.setActiveProject(result.project_id);
139
+ }
140
+ }
141
+ return result;
142
+ }
143
+ /**
144
+ * Cancel a pending transfer of either kind. The caller must be authorized for
145
+ * the row's kind (a wallet signer, or an owner/admin of the offering org /
146
+ * the addressed-email principal). Already-processed transfers return 409
147
+ * `TRANSFER_ALREADY_PROCESSED`.
92
148
  */
93
149
  async cancel(transferId, reason) {
94
150
  const body = {};
@@ -100,7 +156,7 @@ export class Transfers {
100
156
  context: "cancelling project transfer",
101
157
  });
102
158
  }
103
- /** Pending transfers OFFERED TO the authenticated wallet. */
159
+ /** Pending transfers OFFERED TO the caller — both wallet- and email-addressed. */
104
160
  async listIncoming(opts = {}) {
105
161
  const q = buildPagination(opts);
106
162
  const path = q ? `/agent/v1/transfers/incoming?${q}` : "/agent/v1/transfers/incoming";
@@ -109,7 +165,7 @@ export class Transfers {
109
165
  });
110
166
  return res.transfers;
111
167
  }
112
- /** Pending transfers INITIATED BY the authenticated wallet. */
168
+ /** Pending transfers INITIATED BY the caller — both wallet- and email-addressed. */
113
169
  async listOutgoing(opts = {}) {
114
170
  const q = buildPagination(opts);
115
171
  const path = q ? `/agent/v1/transfers/outgoing?${q}` : "/agent/v1/transfers/outgoing";
@@ -118,51 +174,6 @@ export class Transfers {
118
174
  });
119
175
  return res.transfers;
120
176
  }
121
- // ── Email→org handoff (v1.78) ─────────────────────────────────────────────
122
- // Same transfer rail, but the recipient is an EMAIL (resolved to an org at
123
- // claim time) rather than a wallet. The caller must own the project; the
124
- // recipient claims into an org they own (or a brand-new one). Exposed under
125
- // the same `transfer` noun on the CLI (`transfer init --to <email>`).
126
- /**
127
- * Initiate an email→org handoff of `projectId` to `toEmail`. Like a wallet
128
- * transfer, freezes owner-side mutations until the recipient claims, the
129
- * sender cancels, or it expires.
130
- */
131
- async initiateHandoff(input) {
132
- const body = { to_email: input.toEmail };
133
- if (input.message !== undefined)
134
- body.message = input.message;
135
- if (input.retainCollaborator !== undefined)
136
- body.retain_collaborator = input.retainCollaborator;
137
- return this.client.request(`/projects/v1/${encodeURIComponent(input.projectId)}/handoffs`, { method: "POST", body, context: "initiating project handoff" });
138
- }
139
- /** Pending handoffs addressed to the authenticated principal's email. */
140
- async listIncomingHandoffs() {
141
- const res = await this.client.request("/agent/v1/handoffs/incoming", { context: "listing incoming handoffs" });
142
- return res.handoffs ?? res.transfers ?? [];
143
- }
144
- /** Preview a handoff (sender, or the addressed recipient). */
145
- async previewHandoff(transferId) {
146
- return this.client.request(`/agent/v1/handoffs/${encodeURIComponent(transferId)}`, { context: "previewing project handoff" });
147
- }
148
- /**
149
- * Claim an incoming handoff into an org. Omit `organizationId` to claim
150
- * into a brand-new org. The claim atomically flips ownership (the handoff
151
- * analog of {@link Transfers.accept}).
152
- */
153
- async claimHandoff(transferId, input = {}) {
154
- const body = {};
155
- if (input.organizationId !== undefined)
156
- body.organization_id = input.organizationId;
157
- if (input.acceptRetainedCollaborator !== undefined) {
158
- body.accept_retained_collaborator = input.acceptRetainedCollaborator;
159
- }
160
- return this.client.request(`/agent/v1/handoffs/${encodeURIComponent(transferId)}/claim`, { method: "POST", body, context: "claiming project handoff" });
161
- }
162
- /** Cancel a pending handoff (sender or recipient). */
163
- async cancelHandoff(transferId) {
164
- return this.client.request(`/agent/v1/handoffs/${encodeURIComponent(transferId)}/cancel`, { method: "POST", body: {}, context: "cancelling project handoff" });
165
- }
166
177
  }
167
178
  function buildPagination(opts) {
168
179
  const parts = [];
@@ -1 +1 @@
1
- {"version":3,"file":"transfers.js","sourceRoot":"","sources":["../../src/namespaces/transfers.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AA8PH,gFAAgF;AAEhF,MAAM,OAAO,SAAS;IACS;IAA7B,YAA6B,MAAc;QAAd,WAAM,GAAN,MAAM,CAAQ;IAAG,CAAC;IAE/C;;;;;OAKG;IACH,KAAK,CAAC,QAAQ,CAAC,KAA4B;QACzC,MAAM,IAAI,GAA4B,EAAE,SAAS,EAAE,KAAK,CAAC,QAAQ,EAAE,CAAC;QACpE,IAAI,KAAK,CAAC,aAAa,KAAK,SAAS;YAAE,IAAI,CAAC,cAAc,GAAG,KAAK,CAAC,aAAa,CAAC;QACjF,IAAI,KAAK,CAAC,OAAO,KAAK,SAAS;YAAE,IAAI,CAAC,OAAO,GAAG,KAAK,CAAC,OAAO,CAAC;QAC9D,IAAI,KAAK,CAAC,gB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