@tangle-network/hub-sdk 0.54.2-develop.20260927014918.a761d6e → 0.60.12-develop.20261003134057.9c42e58

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.
package/README.md CHANGED
@@ -124,6 +124,29 @@ const hub = HubClient.fromEnv({
124
124
  });
125
125
  ```
126
126
 
127
+ ## Tool approvals
128
+
129
+ `tools.invoke()` preserves an existing `HUB_APPROVAL_REQUIRED` error instead of requesting another token.
130
+ The error retains the original approval ID and the server's action details.
131
+ Present that approval through the product's decision flow.
132
+ Set `approve: true` only after the caller has authorized that action.
133
+ Automatic capability-token minting remains available when the server returns no concrete approval.
134
+
135
+ ## GitHub OAuth scopes
136
+
137
+ Pass the exact scope set when the caller needs GitHub repository selection.
138
+ Platform accepts `read:user`, `repo`, and `read:org` together for this request.
139
+ It rejects a callback if GitHub grants a different set.
140
+ Omitting `requestedScopes` retains the existing default GitHub flow.
141
+ The SDK refuses a start response with different scopes, including responses from an older Platform deployment.
142
+
143
+ ```ts
144
+ const hub = HubClient.fromEnv();
145
+ await hub.connections.start("github", {
146
+ requestedScopes: ["read:user", "repo", "read:org"],
147
+ });
148
+ ```
149
+
127
150
  ## Workflows
128
151
 
129
152
  `hub.workflows` covers the `/v1/workflows` surface — the same resource the
@@ -252,6 +275,28 @@ Past it, `admit` answers `allowance_reached`, and `turn.period` shows `spent`, `
252
275
  Only the meter's owner may call these, signed in or with a root key of their own.
253
276
  A delegated or resource-bound key is refused, so an end user's sandbox cannot grant itself the paid tier.
254
277
 
278
+ ## Shared-Line application dispatch
279
+
280
+ Before admitting a shared-Line callback, check its current Hub authority:
281
+
282
+ ```ts
283
+ const current = await hub.lines.applicationDispatchCurrent(
284
+ lineId,
285
+ messageId,
286
+ { attachmentId, memberId, memberRevision, senderAddress, textSha256, binding, dispatchFence, dispatchDeadline },
287
+ callbackBearer,
288
+ );
289
+ ```
290
+
291
+ `textSha256` is the lowercase SHA-256 hex digest of the exact callback `text` UTF-8 bytes, with no normalization.
292
+ Compute it from the received callback text, not from a caller-supplied digest.
293
+ Hub compares it with the persisted inbound message text before returning `current: true`.
294
+ This uses the callback bearer alone; account credentials, cookies, and redirects are excluded.
295
+ It returns a boolean only from a successful, valid Hub response and makes no retry.
296
+ HTTP failures retain their status and code without response bodies or credential details.
297
+ Configure the client's injected `fetch` to enforce the caller's request deadline.
298
+ A current result authorizes this observation; native admission must still enforce its own expiry and deduplication contract.
299
+
255
300
  ## Exports
256
301
 
257
302
  - `HubClient`, `HubClient.fromEnv(options?)`
@@ -304,6 +349,26 @@ revokes one idempotently. App administrators use `hub.apps.revoke(appId)` to
304
349
  suspend the app, revoke all its customer grants, and disable its owned linked
305
350
  OIDC client. An app's broker credential cannot call these management methods.
306
351
 
352
+ An app broker can create `new HubLineGrantsClient(options)` for a line approved by its owner.
353
+ Pass an `authHeaders` provider that mints a fresh scoped broker token for each call.
354
+ Pass the exact `workspaceId` and `workspaceAgentId` binding to every method.
355
+ The `current` response includes `intakeMode`, `priorAttachmentId`, and `priorAttachmentActive`.
356
+ An `owner_only` grant attaches one declared owner sender and rejects unknown senders.
357
+ The app cannot choose its own sender or change the approved intake mode in `attach`.
358
+
359
+ An owner can instead consent with `execution=application` (and `owner_test=1`).
360
+ Then `current().execution` is `"application"` and `attach` is refused.
361
+ The owner's existing attachment stays on the Line.
362
+ `memberApplication()` reads the declared owner member, its `memberRevision`, `eligible`, and the Hub-derived `binding`.
363
+ `selectApplication()` routes that member's texts to an HTTPS callback on the approved origin, with the app's own bearer `secret`.
364
+ `clearApplication()` returns them to the incumbent agent.
365
+ When another app answers, `selection.own` is false and `selection.app.name` and `selection.selectedAt` say which app and since when; its callback URL stays private.
366
+ Show that to the owner with an explicit choice to answer here instead.
367
+ Only on that choice, pass the selection id you read as both `replaceSelectionId` and `expectedSelectionId` to `selectApplication()`.
368
+ Without `replaceSelectionId`, or with a stale id, Hub refuses with 409 and the other app keeps answering.
369
+ The app cannot clear another app's selection, and revoking the grant revokes its selection.
370
+ Each callback carries `binding`; verify currentness with `lines.applicationDispatchCurrent`.
371
+
307
372
  Broker execution keeps the one approved connection even when the invocation
308
373
  omits `connectionId`; it never substitutes another account. Each one-shot broker
309
374
  token is checked against current app policy and the exact active grant when
@@ -315,3 +380,26 @@ admissions and minting, not external side effects already underway.
315
380
 
316
381
  This is identity and resource delegation, **not** generalized spending delegation.
317
382
  Existing product billing checks and action approvals continue to apply.
383
+
384
+
385
+ ### Select an application for one verified line member
386
+
387
+ The account owner can select an app without changing the Line attachment.
388
+ Unselected members keep the existing default agent.
389
+ The member must already be active, declared, verified, and consented.
390
+ An owner without a customer subject can select only their own Platform subject.
391
+ Other members must retain their existing customer subject.
392
+ The app authorizes and funds its own agent execution.
393
+
394
+ Use `hub.lines.memberApplications.get(lineId, memberId)` to read the current selection.
395
+ Its `app.name` is Hub's name for the app that answers: the registered app of a consented grant, or the trusted app that serves the callback origin, else the callback host.
396
+ Bindings starting with `line-grant:` belong to consented app grants and are refused here.
397
+ Use `select(lineId, memberId, input)` with `expectedSelectionId`, `expectedMemberRevision`, `subjectId`, and `application`.
398
+ The application supplies its approved HTTPS callback, binding, and callback secret.
399
+ Use `clear(lineId, memberId, { expectedSelectionId, expectedMemberRevision })` to restore the default for future messages.
400
+ Selection changes use compare-and-swap and refuse while this member has an active callback or provider delivery.
401
+ Each inbound message pins its selected target.
402
+ Revoked selections refuse pending work instead of redirecting it.
403
+ Existing messages and execution receipts retain their original identity.
404
+ This path uses the existing shared-application flag and remains disabled by default.
405
+ Account-owner channel authority is separate from the app's agent workspace key.