@terminal3/t3n-sdk 4.11.0 → 4.13.0

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/dist/index.d.ts CHANGED
@@ -939,8 +939,9 @@ declare function parseContractResponse<T = unknown>(raw: string, schema?: Contra
939
939
  * `AGENT_AUTH_MAP` is keyed by the *user* DID — one policy document per
940
940
  * user, global across orgs, with at most one entry per agent DID. Reads
941
941
  * (`agent-auth-get`) and writes (`agent-auth-update`) on
942
- * `tee:user/contracts` are **SelfOnly**: only the user, authenticated as
943
- * themselves, may read or write their own grants. This is the user-approval
942
+ * `tee:authorisations/contracts` (the policy's owning contract) are
943
+ * **SelfOnly**: only the user, authenticated as themselves, may read or
944
+ * write their own grants. This is the user-approval
944
945
  * proof the per-call delegation credential's `user_sig` used to carry.
945
946
  *
946
947
  * The write shape gained `scopes` + a validity window: the
@@ -1879,11 +1880,29 @@ declare class T3nClient {
1879
1880
  * entries. `kinds` filters by `TokenTxKind`; an empty array is
1880
1881
  * treated as "no filter".
1881
1882
  *
1882
- * Unlike {@link execute}, the body of this RPC is plaintext —
1883
- * `token.get-usage` is a session-authed read endpoint and the
1884
- * server-side handler does not run the encryption layer.
1883
+ * Like {@link getAuditEvents} / {@link execute}, this runs the
1884
+ * session-payload encryption: balance and ledger history are
1885
+ * self-only data, so the request params and response are sealed to
1886
+ * the session key rather than sent plaintext over TLS. (Transitional:
1887
+ * the node still accepts the legacy plaintext shape during the
1888
+ * staggered rollout, so a leaked `Session-Id` alone is not fully
1889
+ * de-fanged on this endpoint until the sealed shape becomes
1890
+ * mandatory.)
1885
1891
  */
1886
1892
  getUsage(opts?: GetUsageOptions): Promise<UsagePage>;
1893
+ /**
1894
+ * Fetch the caller's own credit row (`token.get-balance`).
1895
+ *
1896
+ * Like {@link getUsage} / {@link getAuditEvents}, this runs the
1897
+ * session-payload encryption: the balance is self-only data, so the
1898
+ * request (an empty sealed blob showing possession of the session
1899
+ * key) and the response are sealed to the session key rather than
1900
+ * sent plaintext over TLS. (Transitional: the node still accepts the
1901
+ * legacy plaintext shape during the staggered rollout.) Prefer this
1902
+ * over reading `getUsage().balance` when only the credit row is
1903
+ * needed.
1904
+ */
1905
+ getBalance(): Promise<BalanceRow>;
1887
1906
  /**
1888
1907
  * List the caller's discoverable contracts (`contracts.list`) — the
1889
1908
  * node-backed source for the MCP `listContracts` funnel tool.
@@ -1895,8 +1914,9 @@ declare class T3nClient {
1895
1914
  * discovery-grant gated and return a uniform, non-disclosive empty page on a
1896
1915
  * gate miss (R5 anti-enumeration).
1897
1916
  *
1898
- * Plaintext session read (like {@link getUsage}): the response carries only
1899
- * public contract-registry metadata, so it is not sealed.
1917
+ * Plaintext session read: the response carries only public
1918
+ * contract-registry metadata (no PII), so it is not sealed — unlike
1919
+ * the self-only reads {@link getUsage} / {@link getBalance}, which are.
1900
1920
  */
1901
1921
  listContracts(params?: ListContractsParams): Promise<ListContractsResult>;
1902
1922
  /**
@@ -1910,7 +1930,9 @@ declare class T3nClient {
1910
1930
  * and the verdict is uniform + non-disclosive (`disclosed:false`) when the
1911
1931
  * agent is not registered under the member (R5 anti-enumeration).
1912
1932
  *
1913
- * Plaintext session read (like {@link getUsage}).
1933
+ * Plaintext session read: the verdict is uniform and non-disclosive,
1934
+ * so it is not sealed (unlike the self-only reads {@link getUsage} /
1935
+ * {@link getBalance}).
1914
1936
  */
1915
1937
  checkDelegation(params: GrantCheckParams): Promise<GrantCheckResult>;
1916
1938
  /**
@@ -1974,8 +1996,9 @@ declare class T3nClient {
1974
1996
  /**
1975
1997
  * Read the authenticated user's own agent-auth policy — the standing
1976
1998
  * grants delegated to agents. Dispatches `agent-auth-get` on
1977
- * `tee:user/contracts`, which is **SelfOnly**, so this always returns the
1978
- * caller's own `AGENT_AUTH_MAP[self]` document.
1999
+ * `tee:authorisations/contracts` (the policy's owning contract), which is
2000
+ * **SelfOnly**, so this always returns the caller's own
2001
+ * `AGENT_AUTH_MAP[self]` document.
1979
2002
  *
1980
2003
  * @returns the full policy document (normalised to the camelCase write
1981
2004
  * shape): the per-agent `agents` entries plus the document-level
@@ -2044,6 +2067,14 @@ declare class T3nClient {
2044
2067
  * implicit.
2045
2068
  */
2046
2069
  private executeUserContract;
2070
+ /**
2071
+ * Same glue as {@link executeUserContract}, parameterised over the
2072
+ * target system contract — the agent-auth wrappers dispatch on
2073
+ * `tee:authorisations/contracts` (the authorisation policy's owning
2074
+ * contract) while the rest of the user-contract surface stays on
2075
+ * `tee:user/contracts`.
2076
+ */
2077
+ private executeSystemContract;
2047
2078
  /**
2048
2079
  * Return the authenticated user's Ethereum address from their
2049
2080
  * T3N-hosted per-user wallet, as a 0x-prefixed lowercase hex string.
@@ -2448,8 +2479,10 @@ declare class T3nClient {
2448
2479
  /**
2449
2480
  * Send a session-authenticated JSON-RPC request with plaintext
2450
2481
  * params/result (no SessionEncryption layer). Used for tenant-facing
2451
- * read endpoints (`token.get-balance`, `token.get-usage`) where the
2452
- * server-side handler reads the JSON envelope directly.
2482
+ * read endpoints whose payloads carry only public / non-disclosive
2483
+ * metadata (`contracts.list`, `delegation.check`) where the
2484
+ * server-side handler reads the JSON envelope directly. (The token
2485
+ * self-reads moved to the sealed path — see {@link getUsage}.)
2453
2486
  *
2454
2487
  * Auto-attaches the `Session-Id` header; surfaces JSON-RPC errors
2455
2488
  * the same way as {@link sendRpcRequest} (typed