@brainai/satp-client 2.0.3 → 2.0.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.
package/README.md CHANGED
@@ -1,8 +1,9 @@
1
1
  # SATP V3 SDK - `@brainai/satp-client`
2
2
 
3
- **Solana Agent Token Protocol** - JavaScript/TypeScript SDK for interacting with the SATP V3 devnet programs.
3
+ **Solana Agent Trust Protocol** - JavaScript/TypeScript SDK for reading and
4
+ building reviewed SATP V3 program interactions.
4
5
 
5
- Current stable npm package: **@brainai/satp-client@2.0.1** | reviewed rc artifact: **@brainai/satp-client@2.0.2-rc.0** | Programs: **6**
6
+ Current stable npm package: **@brainai/satp-client@2.0.3** | rc dist-tag: **@brainai/satp-client@2.0.2** | Programs: **6**
6
7
 
7
8
  ## Installation
8
9
 
@@ -10,31 +11,30 @@ Choose stable, rc, or Git based on what the consumer needs to prove:
10
11
 
11
12
  | Channel | Use when | Command |
12
13
  | --- | --- | --- |
13
- | Stable npm | Default production-style consumption of the stable public package. | `npm install @brainai/satp-client@2.0.1` |
14
- | Release candidate npm | Validating the reviewed rc package before promotion or producing reproducible rc manifests. | `npm install @brainai/satp-client@2.0.2-rc.0` |
15
- | Release candidate tag | Quick rc opt-in where a moving dist-tag is acceptable. | `npm install @brainai/satp-client@rc` |
14
+ | Stable npm | Default production-style consumption of the stable public package. | `npm install @brainai/satp-client@2.0.3` |
15
+ | Historical rc exact version | Explicit HQ-assigned reproduction or lockfile evidence for the historical pre-stable artifact. | `npm install @brainai/satp-client@2.0.2` |
16
+ | Release candidate tag | Explicit HQ-assigned rc validation where a moving dist-tag is acceptable and the task names the tag as the target. | `npm install @brainai/satp-client@rc` |
16
17
  | Reviewed Git commit | PR coordination or source-review installs tied to an exact SATP commit. | `npm install git+https://github.com/brainAI-bot/satp.git#<SATP_COMMIT>` |
17
18
 
18
- The npm `latest` tag still resolves to `@brainai/satp-client@2.0.1`.
19
- Historical rc-tag readback may still show the older `0.1.0-rc.0` package until
20
- the rc channel is promoted. The reviewed RC-S6 artifact in this source tree is
21
- `@brainai/satp-client@2.0.2-rc.0`; downstream apps that need reproducible
22
- manifests should pin that exact version after promotion instead of relying on
23
- the moving `@rc` tag.
19
+ Registry readback on 2026-07-26 shows npm `latest` resolves to
20
+ `@brainai/satp-client@2.0.3` and the `rc` dist-tag resolves to `2.0.2`.
21
+ Stable consumers should use `latest`/`2.0.3` unless HQ assigns an explicit
22
+ release-candidate validation task.
24
23
 
25
24
  For stable consumer installs, pin the current published npm package:
26
25
 
27
26
  ```bash
28
- npm install @brainai/satp-client@2.0.1
27
+ npm install @brainai/satp-client@2.0.3
29
28
  ```
30
29
 
31
- For exact rc validation:
30
+ For rc validation:
32
31
 
33
32
  ```bash
34
- npm install @brainai/satp-client@2.0.2-rc.0
33
+ npm install @brainai/satp-client@2.0.2
35
34
  ```
36
35
 
37
- For short-lived rc opt-in:
36
+ Use `@rc` only when the HQ task names the moving tag itself as the validation
37
+ target:
38
38
 
39
39
  ```bash
40
40
  npm install @brainai/satp-client@rc
@@ -49,14 +49,30 @@ npm install git+https://github.com/brainAI-bot/satp.git#<SATP_COMMIT>
49
49
  The old `0.0.0-extraction` label was extraction-branch metadata and is not the
50
50
  current consumer package. Do not treat branch-only Git installs as npm latest.
51
51
 
52
- Mainnet program IDs are intentionally not enabled in this release candidate.
53
- Constructors and helpers fail closed for `network: 'mainnet'` until an approved
54
- mainnet decision packet provides production program IDs.
52
+ Mainnet program IDs are present for the reviewed V3 registry, but availability
53
+ is not action approval. Mainnet writes, deploys, keypair use, authority changes,
54
+ value-bearing escrow actions, npm promotion, and production claims still require
55
+ a separate HQ approval and the relevant owner-gated runbook. See
56
+ `docs/mainnet-authority-decision-packet-6c8a5545.md` for the public authority
57
+ decision packet.
58
+
59
+ RC-S6 semantic uncertainty outcomes are covered by the offline conformance gate
60
+ merged in `93db1b3` (PR #53, `[#43394290]`) and runnable with
61
+ `npm run test:conformance:rc-s6` from the repository root. Treat positive
62
+ fixtures as deterministic SDK/schema compatibility only. Treat stale, revoked,
63
+ malformed, unsupported-issuer, score-meaning, review-weight, escrow-reference,
64
+ and AgentFolio copy-boundary fixtures as warning or fail-closed outcomes; do
65
+ not convert them into verified badges, ranking, eligibility, payment state,
66
+ escrow readiness, mainnet readiness, npm latest adoption, or product approval.
55
67
 
56
68
  **Runtime dependency:** `@solana/web3.js ^1.98.4`
57
69
 
58
70
  ## Quick Start
59
71
 
72
+ For the root consumer quickstart covering stable npm, rc validation, Git-review
73
+ pins, read-only trust packets, conformance checks, and network boundaries, see
74
+ [`docs/quickstart.md`](../../docs/quickstart.md).
75
+
60
76
  ```javascript
61
77
  const { SATPV3SDK } = require('@brainai/satp-client');
62
78
 
@@ -167,6 +183,34 @@ builds a runtime policy action descriptor. It asserts
167
183
  `paymentAuthorization: false`, `actionAuthorization: false`,
168
184
  `spendAuthorized: false`, and `livePaymentRequired: false`.
169
185
 
186
+ ### Runtime Policy Adapter Helper
187
+
188
+ `createRuntimePolicyAdapter(opts)` provides a host-oriented wrapper around the
189
+ offline runtime policy helpers:
190
+
191
+ ```javascript
192
+ const { createRuntimePolicyAdapter } = require('@brainai/satp-client');
193
+
194
+ const adapter = createRuntimePolicyAdapter({
195
+ defaultActionType: 'mcp_protected_tool',
196
+ now: () => '2026-05-21T00:00:00Z',
197
+ policy: { minimumTrustScore: 70, maxAutoSpendUsd: 0 },
198
+ });
199
+
200
+ const action = adapter.action({
201
+ resource: 'mcp://protected/readiness',
202
+ capability: 'mcp:read',
203
+ });
204
+ const result = adapter.evaluate(identityPayload, action);
205
+ const trace = adapter.auditTrace(identityPayload, action, { result });
206
+ const summary = adapter.explain(result);
207
+ ```
208
+
209
+ The adapter only builds local descriptors, local decisions, redacted audit
210
+ traces, and display-safe reason summaries. It does not call RPC, read keypairs,
211
+ sign, send transactions, approve x402 spend, treat payment as action
212
+ authorization, write Solana state, deploy, publish, or restart production.
213
+
170
214
  ### Wallet-Control Challenge Helpers
171
215
 
172
216
  `buildWalletControlChallenge(opts)` creates a canonical, offline challenge that
@@ -213,7 +257,7 @@ if (!verification.ok) throw new Error(verification.errors.join('; '));
213
257
 
214
258
  ```javascript
215
259
  const sdk = new SATPV3SDK({ network, rpcUrl });
216
- // network: 'devnet' (default). 'mainnet' fails closed until approved IDs exist.
260
+ // network: 'devnet' (default) or 'mainnet'.
217
261
  // rpcUrl: optional custom RPC endpoint
218
262
  ```
219
263
 
@@ -446,7 +490,7 @@ node test-v3-devnet.js
446
490
  # CPI integration tests (35)
447
491
  cd .. && node tests/devnet-cpi-integration.js
448
492
 
449
- # Release-safety defaults and mainnet fail-closed checks
493
+ # Release-safety defaults and network-boundary checks
450
494
  node test-release-safety.js
451
495
  ```
452
496
 
@@ -462,8 +506,8 @@ const sdk = new SATPV3SDK({ network: 'devnet' });
462
506
  // Custom RPC
463
507
  const sdk = new SATPV3SDK({ rpcUrl: 'https://my-rpc.example.com' });
464
508
 
465
- // Mainnet currently fails closed until approved program IDs are configured
466
- assert.throws(() => new SATPV3SDK({ network: 'mainnet' }));
509
+ // Mainnet uses the V3 registry IDs documented in Anchor.toml [programs.mainnet].
510
+ const sdk = new SATPV3SDK({ network: 'mainnet' });
467
511
  ```
468
512
 
469
513
  ## Borsh Deserialization Helpers (v3.6.0)
@@ -1,14 +1,18 @@
1
1
  #!/usr/bin/env node
2
2
  'use strict';
3
3
 
4
- const { evaluateRuntimePolicy } = require('..');
4
+ const {
5
+ buildRuntimePolicyActionDescriptor,
6
+ buildRuntimePolicyAuditTrace,
7
+ evaluateRuntimePolicy,
8
+ } = require('..');
5
9
 
6
10
  const trustedIdentity = {
7
11
  agentId: 'brainchain-demo',
8
12
  active: true,
9
13
  satpVerified: true,
10
14
  trustScore: 88,
11
- capabilities: ['mcp:deploy-readiness', 'satp:trust-read'],
15
+ capabilities: ['mcp:deploy-readiness', 'satp:trust-read', 'agentfolio:trust-read'],
12
16
  evidenceUpdatedAt: '2026-05-21T00:00:00Z',
13
17
  };
14
18
 
@@ -16,23 +20,24 @@ const examples = [
16
20
  {
17
21
  name: 'MCP protected tool',
18
22
  identity: trustedIdentity,
19
- action: {
23
+ action: buildRuntimePolicyActionDescriptor({
20
24
  type: 'mcp_protected_tool',
21
25
  resource: 'mcp://protected/deploy-readiness',
22
26
  operation: 'read',
23
- requiresCapability: 'mcp:deploy-readiness',
24
- requiresFreshEvidence: true,
27
+ capability: 'mcp:deploy-readiness',
28
+ }),
29
+ options: {
30
+ now: '2026-05-21T00:00:00Z',
25
31
  },
26
32
  },
27
33
  {
28
34
  name: 'x402 paid endpoint',
29
35
  identity: trustedIdentity,
30
- action: {
36
+ action: buildRuntimePolicyActionDescriptor('x402_endpoint', {
31
37
  type: 'x402_endpoint',
32
38
  resource: 'https://api.example.test/reputation',
33
- operation: 'lookup',
34
39
  costUsd: 0.05,
35
- },
40
+ }),
36
41
  options: {
37
42
  actionPaymentPreapproved: true,
38
43
  policy: { maxAutoSpendUsd: 0.01 },
@@ -41,12 +46,13 @@ const examples = [
41
46
  {
42
47
  name: 'Host trust-score degrade',
43
48
  identity: { ...trustedIdentity, trustScore: 62 },
44
- action: {
45
- type: 'host_trust_gate',
46
- resource: 'satp://trust-score',
47
- operation: 'gate',
49
+ action: buildRuntimePolicyActionDescriptor({
50
+ type: 'agentfolio_trust_gate',
51
+ profileId: 'brainchain-demo',
48
52
  minimumTrustScore: 80,
49
- allowDegraded: true,
53
+ }),
54
+ options: {
55
+ now: '2026-05-21T00:00:00Z',
50
56
  },
51
57
  },
52
58
  {
@@ -73,3 +79,17 @@ for (const item of examples) {
73
79
  const result = evaluateRuntimePolicy(item.identity, item.action, item.options);
74
80
  console.log(JSON.stringify({ name: item.name, ...result }, null, 2));
75
81
  }
82
+
83
+ const auditTrace = buildRuntimePolicyAuditTrace(
84
+ trustedIdentity,
85
+ {
86
+ type: 'mcp_protected_tool',
87
+ resource: 'mcp://protected/deploy-readiness',
88
+ operation: 'read',
89
+ requiresCapability: 'mcp:deploy-readiness',
90
+ requiresFreshEvidence: true,
91
+ },
92
+ { now: '2026-05-21T00:00:00Z' }
93
+ );
94
+
95
+ console.log(JSON.stringify({ name: 'Redacted audit trace', ...auditTrace }, null, 2));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@brainai/satp-client",
3
- "version": "2.0.3",
3
+ "version": "2.0.5",
4
4
  "description": "SATP client SDK surface prepared for release-candidate review; publish only after the release packet passes.",
5
5
  "main": "src/index.js",
6
6
  "types": "src/index.d.ts",
@@ -31,6 +31,7 @@
31
31
  "runtime-policy:example": "node examples/runtime-policy-adapter.js",
32
32
  "test:wallet-control": "node test-wallet-control-challenge.js",
33
33
  "test:x402-discovery": "node test-x402-discovery.js",
34
+ "test:signer-policy": "node test-signer-policy.js",
34
35
  "check:exports": "node test-release-safety.js"
35
36
  },
36
37
  "keywords": [
@@ -43,7 +44,7 @@
43
44
  "web3"
44
45
  ],
45
46
  "author": "brainAI",
46
- "license": "MIT",
47
+ "license": "Apache-2.0",
47
48
  "repository": {
48
49
  "type": "git",
49
50
  "url": "git+https://github.com/brainAI-bot/satp.git"
@@ -55,11 +56,13 @@
55
56
  "dependencies": {
56
57
  "@solana/web3.js": "^1.98.4",
57
58
  "borsh": "^2.0.0",
58
- "bs58": "^6.0.0"
59
+ "bs58": "^6.0.0",
60
+ "rpc-websockets": "9.3.5"
59
61
  },
60
62
  "private": false,
61
63
  "overrides": {
62
64
  "ws": "^8.21.0",
65
+ "rpc-websockets": "9.3.5",
63
66
  "jayson": {
64
67
  "uuid": "^11.1.1"
65
68
  }
@@ -137,6 +137,11 @@ export interface ParsedEscrowV3 {
137
137
  descriptionHash: string;
138
138
  deadline: number;
139
139
  nonce: number;
140
+ currency: 'SOL' | 'USDC' | string;
141
+ currencyCode: number;
142
+ tokenMint: string | null;
143
+ tokenVault: string | null;
144
+ tokenDecimals: number | null;
140
145
  status: EscrowStatusV3 | string;
141
146
  statusCode: number;
142
147
  minVerificationLevel: number;
@@ -18,6 +18,7 @@
18
18
  */
19
19
 
20
20
  const { PublicKey } = require('@solana/web3.js');
21
+ const { V3_IDL_ACCOUNT_DISCRIMINATORS } = require('./v3-idl-discriminators');
21
22
 
22
23
  // ═══════════════════════════════════════════════════
23
24
  // BorshReader — streaming Borsh deserializer
@@ -377,6 +378,7 @@ function deserializeEscrowV3(data) {
377
378
  'Active', 'WorkSubmitted', 'Released',
378
379
  'Cancelled', 'Disputed', 'Resolved',
379
380
  ];
381
+ const ESCROW_CURRENCY_MAP = ['SOL', 'USDC'];
380
382
 
381
383
  const client = r.readPubkeyBase58();
382
384
  const agent = r.readPubkeyBase58();
@@ -386,6 +388,10 @@ function deserializeEscrowV3(data) {
386
388
  const descriptionHash = r.readFixedBytes32().toString('hex');
387
389
  const deadline = r.readI64();
388
390
  const nonce = r.readU64Num();
391
+ const currencyByte = r.readU8();
392
+ const tokenMint = r.readOptionPubkey();
393
+ const tokenVault = r.readOptionPubkey();
394
+ const tokenDecimals = r.readOption(() => r.readU8());
389
395
  const statusByte = r.readU8();
390
396
  const minVerificationLevel = r.readU8();
391
397
  const requireBorn = r.readBool();
@@ -408,6 +414,11 @@ function deserializeEscrowV3(data) {
408
414
  descriptionHash,
409
415
  deadline,
410
416
  nonce,
417
+ currency: ESCROW_CURRENCY_MAP[currencyByte] || `Unknown(${currencyByte})`,
418
+ currencyCode: currencyByte,
419
+ tokenMint,
420
+ tokenVault,
421
+ tokenDecimals,
411
422
  status: ESCROW_STATUS_MAP[statusByte] || `Unknown(${statusByte})`,
412
423
  statusCode: statusByte,
413
424
  minVerificationLevel,
@@ -437,17 +448,20 @@ function accountDiscriminator(accountName) {
437
448
  .slice(0, 8);
438
449
  }
439
450
 
440
- // Pre-compute discriminators for all V3 account types
441
- const DISCRIMINATORS = {
442
- GenesisRecord: accountDiscriminator('GenesisRecord'),
443
- LinkedWallet: accountDiscriminator('LinkedWallet'),
444
- MintTracker: accountDiscriminator('MintTracker'),
445
- NameRegistry: accountDiscriminator('NameRegistry'),
446
- Review: accountDiscriminator('Review'),
447
- ReviewCounter: accountDiscriminator('ReviewCounter'),
448
- Attestation: accountDiscriminator('Attestation'),
449
- EscrowV3: accountDiscriminator('EscrowV3'),
450
- };
451
+ function loadGeneratedIdlDiscriminators() {
452
+ const discriminators = {};
453
+
454
+ for (const [accountName, discriminator] of Object.entries(V3_IDL_ACCOUNT_DISCRIMINATORS)) {
455
+ if (!Array.isArray(discriminator) || discriminator.length !== 8) {
456
+ throw new Error(`${accountName} is missing an 8-byte V3 IDL discriminator`);
457
+ }
458
+ discriminators[accountName] = Buffer.from(discriminator);
459
+ }
460
+
461
+ return Object.freeze(discriminators);
462
+ }
463
+
464
+ const DISCRIMINATORS = loadGeneratedIdlDiscriminators();
451
465
 
452
466
  const DESERIALIZERS = {
453
467
  GenesisRecord: deserializeGenesisRecord,
package/src/index.d.ts CHANGED
@@ -151,11 +151,15 @@ export interface RuntimePolicyIdentityPayload {
151
151
  }
152
152
 
153
153
  export interface RuntimePolicyActionDescriptor {
154
+ schemaVersion?: string;
155
+ surface?: string;
154
156
  type?: string;
155
157
  resource?: string;
156
158
  operation?: string;
159
+ capability?: string;
157
160
  requiresCapability?: string;
158
161
  minimumTrustScore?: number;
162
+ trustScoreMinimum?: number;
159
163
  allowDegraded?: boolean;
160
164
  requiresFreshEvidence?: boolean;
161
165
  costUsd?: number;
@@ -168,6 +172,32 @@ export interface RuntimePolicyActionDescriptor {
168
172
  } | X402EvidenceLookup;
169
173
  }
170
174
 
175
+ export interface RuntimePolicyActionDescriptorBuildInput extends RuntimePolicyActionDescriptor {
176
+ profileId?: string;
177
+ }
178
+
179
+ export interface RuntimePolicyHostActionDescriptor extends RuntimePolicyActionDescriptor {
180
+ schemaVersion: 'satp.runtimePolicyHostActionDescriptor.v1';
181
+ type: string;
182
+ resource: string | null;
183
+ operation: string | null;
184
+ requiresCapability: string | null;
185
+ minimumTrustScore: number | null;
186
+ allowDegraded: boolean;
187
+ requiresFreshEvidence: boolean;
188
+ costUsd: number;
189
+ protectedTool: boolean;
190
+ operatorApprovalRequired: boolean;
191
+ guardrails: {
192
+ localDecisionOnly: true;
193
+ writesSolanaState: false;
194
+ usesKeypairs: false;
195
+ deploysPrograms: false;
196
+ publishesPackages: false;
197
+ livePaymentRequired: false;
198
+ };
199
+ }
200
+
171
201
  export interface RuntimePolicyConfig {
172
202
  minimumTrustScore?: number;
173
203
  denyTrustScoreBelow?: number;
@@ -184,6 +214,13 @@ export interface RuntimePolicyOptions {
184
214
  policy?: RuntimePolicyConfig;
185
215
  }
186
216
 
217
+ export interface RuntimePolicyAdapterOptions {
218
+ policy?: RuntimePolicyConfig;
219
+ now?: string | number | Date | (() => string | number | Date);
220
+ redact?: (value: string) => string;
221
+ defaultActionType?: string;
222
+ }
223
+
187
224
  export interface RuntimePolicyResult {
188
225
  decision: RuntimePolicyDecision;
189
226
  reasonCodes: string[];
@@ -191,6 +228,126 @@ export interface RuntimePolicyResult {
191
228
  checks: Record<string, unknown>;
192
229
  }
193
230
 
231
+ export interface RuntimePolicyAuditTrace {
232
+ schemaVersion: 'satp.runtimePolicyAuditTrace.v1';
233
+ mode: 'offline-local-runtime-policy-trace';
234
+ generatedAt: string;
235
+ decision: RuntimePolicyDecision;
236
+ reasonCodes: string[];
237
+ message: string;
238
+ subject: {
239
+ agentId: string | null;
240
+ active: boolean;
241
+ verified: boolean;
242
+ trustScoreBand: '90-100' | '80-89' | '70-79' | '50-69' | '25-49' | '0-24';
243
+ evidenceUpdatedAt: string | number | Date | null;
244
+ capabilityCount: number;
245
+ };
246
+ action: {
247
+ type: string;
248
+ operation: string | null;
249
+ resourceKind: string | null;
250
+ resourceLabel: string | null;
251
+ requiresCapability: string | null;
252
+ requiresFreshEvidence: boolean;
253
+ protectedTool: boolean;
254
+ operatorApprovalRequired: boolean;
255
+ costUsd: number | null;
256
+ evidenceLookup: {
257
+ type: string | null;
258
+ configured: true;
259
+ maxCostUsd: number | null;
260
+ } | null;
261
+ };
262
+ checks: Record<string, unknown>;
263
+ guardrails: {
264
+ localDecisionOnly: true;
265
+ writesSolanaState: false;
266
+ usesKeypairs: false;
267
+ deploysPrograms: false;
268
+ publishesPackages: false;
269
+ authorizesPayment: false;
270
+ authorizesAgentActionFromPayment: false;
271
+ };
272
+ }
273
+
274
+ export interface RuntimePolicyAdapter {
275
+ action(
276
+ input?: RuntimePolicyActionDescriptorBuildInput | string,
277
+ overrides?: RuntimePolicyActionDescriptorBuildInput
278
+ ): RuntimePolicyHostActionDescriptor;
279
+ evaluate(
280
+ identityPayload: RuntimePolicyIdentityPayload,
281
+ actionDescriptor: RuntimePolicyActionDescriptor,
282
+ options?: RuntimePolicyOptions
283
+ ): RuntimePolicyResult;
284
+ auditTrace(
285
+ identityPayload: RuntimePolicyIdentityPayload,
286
+ actionDescriptor: RuntimePolicyActionDescriptor,
287
+ options?: RuntimePolicyOptions & { result?: RuntimePolicyResult }
288
+ ): RuntimePolicyAuditTrace;
289
+ explain(result: RuntimePolicyResult): string[];
290
+ }
291
+
292
+ export type SatpSignerRole = 'operational_signer' | 'owner_upgrade_authority';
293
+
294
+ export type SatpOperationalSignerAction =
295
+ | 'devnet_fee_payment'
296
+ | 'devnet_transaction_submission'
297
+ | 'offline_transaction_preparation'
298
+ | 'read_only_rpc';
299
+
300
+ export type SatpOwnerGatedAction =
301
+ | 'program_upgrade'
302
+ | 'authority_transfer'
303
+ | 'key_generation'
304
+ | 'key_rotation'
305
+ | 'mainnet_deploy'
306
+ | 'devnet_deploy'
307
+ | 'npm_publish'
308
+ | 'funds_custody'
309
+ | 'funds_transfer';
310
+
311
+ export interface SignerSeparationOptions {
312
+ network?: Network;
313
+ operationalSignerPublicKey: PublicKey | string;
314
+ ownerUpgradeAuthorityPublicKey: PublicKey | string;
315
+ operationalAllowedActions?: SatpOperationalSignerAction[];
316
+ }
317
+
318
+ export interface SignerSeparationConfig {
319
+ schemaVersion: 'satp.signerSeparation.v1';
320
+ network: Network;
321
+ operationalSigner: {
322
+ role: 'operational_signer';
323
+ publicKey: string;
324
+ allowedActions: SatpOperationalSignerAction[];
325
+ blockedActions: SatpOwnerGatedAction[];
326
+ authorityBoundary: 'no_upgrade_authority_no_key_management_no_funds_custody';
327
+ };
328
+ ownerUpgradeAuthority: {
329
+ role: 'owner_upgrade_authority';
330
+ publicKey: string;
331
+ custody: 'owner_held';
332
+ operationalSignerMayUse: false;
333
+ };
334
+ flags: {
335
+ publicKeysOnly: true;
336
+ readsKeypairs: false;
337
+ generatesKeypairs: false;
338
+ transfersAuthority: false;
339
+ deploysPrograms: false;
340
+ publishesPackages: false;
341
+ writesSolanaState: false;
342
+ };
343
+ }
344
+
345
+ export interface SignerSeparationValidation {
346
+ ok: boolean;
347
+ errors: string[];
348
+ normalized: SignerSeparationConfig | null;
349
+ }
350
+
194
351
  export const DECISIONS: Readonly<{
195
352
  ALLOW: 'allow';
196
353
  DENY: 'deny';
@@ -199,14 +356,47 @@ export const DECISIONS: Readonly<{
199
356
  }>;
200
357
 
201
358
  export const REASON_CODES: Readonly<Record<string, string>>;
359
+ export const RUNTIME_POLICY_AUDIT_TRACE_SCHEMA_VERSION: 'satp.runtimePolicyAuditTrace.v1';
360
+ export const RUNTIME_POLICY_HOST_ACTION_DESCRIPTOR_SCHEMA_VERSION: 'satp.runtimePolicyHostActionDescriptor.v1';
202
361
  export const DEFAULT_POLICY: Readonly<Required<RuntimePolicyConfig>>;
203
362
 
363
+ export const SATP_SIGNER_ROLES: Readonly<{
364
+ OPERATIONAL_SIGNER: 'operational_signer';
365
+ OWNER_UPGRADE_AUTHORITY: 'owner_upgrade_authority';
366
+ }>;
367
+
368
+ export const OPERATIONAL_SIGNER_ALLOWED_ACTIONS: Readonly<SatpOperationalSignerAction[]>;
369
+ export const OWNER_UPGRADE_AUTHORITY_BLOCKED_ACTIONS: Readonly<SatpOwnerGatedAction[]>;
370
+
371
+ export function buildSignerSeparationConfig(
372
+ opts: SignerSeparationOptions
373
+ ): SignerSeparationConfig;
374
+
375
+ export function validateSignerSeparationConfig(
376
+ config: SignerSeparationConfig | Record<string, unknown> | null | undefined
377
+ ): SignerSeparationValidation;
378
+
204
379
  export function evaluateRuntimePolicy(
205
380
  identityPayload: RuntimePolicyIdentityPayload,
206
381
  actionDescriptor: RuntimePolicyActionDescriptor,
207
382
  options?: RuntimePolicyOptions
208
383
  ): RuntimePolicyResult;
209
384
 
385
+ export function buildRuntimePolicyActionDescriptor(
386
+ input?: RuntimePolicyActionDescriptorBuildInput | string,
387
+ overrides?: RuntimePolicyActionDescriptorBuildInput
388
+ ): RuntimePolicyHostActionDescriptor;
389
+
390
+ export function buildRuntimePolicyAuditTrace(
391
+ identityPayload: RuntimePolicyIdentityPayload,
392
+ actionDescriptor: RuntimePolicyActionDescriptor,
393
+ options?: RuntimePolicyOptions & { result?: RuntimePolicyResult }
394
+ ): RuntimePolicyAuditTrace;
395
+
396
+ export function createRuntimePolicyAdapter(
397
+ options?: RuntimePolicyAdapterOptions
398
+ ): RuntimePolicyAdapter;
399
+
210
400
  export interface WalletControlChallengeOptions {
211
401
  agentId: string;
212
402
  wallet: PublicKey | string;
@@ -393,7 +583,26 @@ export function anchorDiscriminator(ixName: string): Buffer;
393
583
 
394
584
  // ─── V3 PDA Helpers ─────────────────────────────────────
395
585
 
396
- export { getV3ProgramIds, hashAgentId, hashName, getGenesisPDA, getV3ReputationAuthorityPDA, getV3ValidationAuthorityPDA, getV3MintTrackerPDA, getNameRegistryPDA, getLinkedWalletPDA, getV3ReviewPDA, getV3ReviewCounterPDA, getV3AttestationPDA, getV3EscrowPDA } from './v3-pda';
586
+ export {
587
+ getV3ProgramIds,
588
+ hashAgentId,
589
+ hashName,
590
+ getGenesisPDA,
591
+ getV3ReputationAuthorityPDA,
592
+ getV3ValidationAuthorityPDA,
593
+ getV3MintTrackerPDA,
594
+ getNameRegistryPDA,
595
+ getLinkedWalletPDA,
596
+ getV3ReviewPDA,
597
+ getV3ReviewCounterPDA,
598
+ getV3AttestationPDA,
599
+ getV3EscrowPDA,
600
+ getAssociatedTokenAddress,
601
+ getV3EscrowVaultATA,
602
+ V3_DEVNET_TOKEN_MINTS,
603
+ SPL_TOKEN_PROGRAM_ID,
604
+ ASSOCIATED_TOKEN_PROGRAM_ID,
605
+ } from './v3-pda';
397
606
 
398
607
  export function prepareIdentityAttestationRequest(
399
608
  opts: IdentityAttestationRequestOptions