@fased/fased 0.1.64 → 0.1.65

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 (91) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/README.md +16 -9
  3. package/config/signer-policies/README.md +10 -1
  4. package/config/signer-protocol-v2.json +2 -0
  5. package/dist/brand.js +1 -1
  6. package/dist/build-info.json +3 -3
  7. package/dist/canvas-host/a2ui/.bundle.hash +1 -1
  8. package/dist/control-ui/assets/{app-bR-fO5ty.js → app-MaQnPa5G.js} +5 -5
  9. package/dist/control-ui/assets/{index-ckCxHwjy.js → index-D4YMr1fA.js} +3 -3
  10. package/dist/control-ui/assets/{mining-BgHFh0ei.js → mining-qMYs4aD-.js} +120 -120
  11. package/dist/control-ui/index.html +1 -1
  12. package/dist/control-ui/version.json +1 -1
  13. package/dist/extensions/sat-mining/src/rpc-read.js +59 -20
  14. package/dist/extensions/sat-mining/src/solana-submit.js +251 -8
  15. package/dist/extensions/sat-mining/src/submission-ledger.js +1 -1
  16. package/dist/plugin-sdk/{audio-preflight-BYxAt775.js → audio-preflight-I4IngVlJ.js} +1 -1
  17. package/dist/plugin-sdk/channel-plugin-common.d.ts +2 -2
  18. package/dist/plugin-sdk/{chunk-items-DIRHG2gJ.js → chunk-items-DLQ6_lLK.js} +1 -1
  19. package/dist/plugin-sdk/command-status.js +1 -1
  20. package/dist/plugin-sdk/{config-schema-BOT7kHb6.js → config-schema-D_8FVI1C.js} +28 -8
  21. package/dist/plugin-sdk/device-pair.d.ts +1 -1
  22. package/dist/plugin-sdk/discord.d.ts +3 -3
  23. package/dist/plugin-sdk/index.d.ts +5 -5
  24. package/dist/plugin-sdk/index.js +1 -1
  25. package/dist/plugin-sdk/{monitor-BCFDaqJ-.js → monitor-B4KF4Kpo.js} +3 -3
  26. package/dist/plugin-sdk/{monitor-BgbjRiPM.js → monitor-Bb6x1KAG.js} +3 -3
  27. package/dist/plugin-sdk/{openresponses-http-DFf87SMM.js → openresponses-http-DCTO8JkL.js} +1 -1
  28. package/dist/plugin-sdk/{pairing-message-CS-9BHug.d.ts → pairing-message-DHPDFZbC.d.ts} +1 -1
  29. package/dist/plugin-sdk/provider-web-search-config-contract.d.ts +1 -1
  30. package/dist/plugin-sdk/sat-runtime.d.ts +18 -2
  31. package/dist/plugin-sdk/sat-runtime.js +1 -1
  32. package/dist/plugin-sdk/{slack-BUTt8cxK.js → slack-BHmvqgjH.js} +3 -3
  33. package/dist/plugin-sdk/slack.d.ts +3 -3
  34. package/dist/plugin-sdk/{sticker-cache-D0wHVqjt.js → sticker-cache-By5AcorL.js} +2 -2
  35. package/dist/plugin-sdk/{telegram-actions-CC_qN4v0.js → telegram-actions-DGnBz1YT.js} +2 -2
  36. package/dist/plugin-sdk/telegram.d.ts +3 -3
  37. package/dist/plugin-sdk/{tmp-fased-dir-xOTGlzBE.d.ts → tmp-fased-dir-EJGTmL1Q.d.ts} +1 -1
  38. package/dist/plugin-sdk/{types-C3avNytw.d.ts → types-BdwdFCD6.d.ts} +2 -2
  39. package/dist/plugin-sdk/{types-DWfbSAaM.d.ts → types-BrCpYMxn.d.ts} +1 -1
  40. package/dist/plugin-sdk/{web-BXsJ1vqe.js → web-DUJwrTYs.js} +1 -1
  41. package/dist/plugin-sdk/whatsapp.d.ts +3 -3
  42. package/dist/wallet/local-socket-signer-protocol.js +18 -0
  43. package/dist/wallet/signer-protocol-v2.generated.js +2 -0
  44. package/dist/wallet/wallet-policy.js +3 -1
  45. package/extensions/acpx/package.json +1 -1
  46. package/extensions/bluebubbles/package.json +1 -1
  47. package/extensions/copilot-proxy/package.json +1 -1
  48. package/extensions/diagnostics-otel/package.json +1 -1
  49. package/extensions/fased-federation/package.json +1 -1
  50. package/extensions/google-gemini-cli-auth/package.json +1 -1
  51. package/extensions/imessage/package.json +1 -1
  52. package/extensions/irc/package.json +1 -1
  53. package/extensions/line/package.json +1 -1
  54. package/extensions/llm-task/package.json +1 -1
  55. package/extensions/lobster/package.json +1 -1
  56. package/extensions/matrix/CHANGELOG.md +6 -0
  57. package/extensions/matrix/package.json +1 -1
  58. package/extensions/mattermost/package.json +1 -1
  59. package/extensions/memory-core/package.json +2 -2
  60. package/extensions/memory-lancedb/package.json +1 -1
  61. package/extensions/minimax-portal-auth/package.json +1 -1
  62. package/extensions/msteams/CHANGELOG.md +6 -0
  63. package/extensions/msteams/package.json +1 -1
  64. package/extensions/nextcloud-talk/package.json +1 -1
  65. package/extensions/nostr/CHANGELOG.md +6 -0
  66. package/extensions/nostr/package.json +1 -1
  67. package/extensions/open-prose/package.json +1 -1
  68. package/extensions/sat-mining/index.ts +89 -1
  69. package/extensions/sat-mining/package.json +1 -1
  70. package/extensions/sat-mining/src/audit-store.ts +45 -4
  71. package/extensions/sat-mining/src/client.ts +13 -0
  72. package/extensions/sat-mining/src/rpc-read.ts +105 -21
  73. package/extensions/sat-mining/src/runtime.ts +2 -0
  74. package/extensions/sat-mining/src/solana-submit.ts +358 -21
  75. package/extensions/sat-mining/src/submission-ledger.ts +2 -1
  76. package/extensions/signal/package.json +1 -1
  77. package/extensions/synology-chat/package.json +1 -1
  78. package/extensions/tlon/package.json +1 -1
  79. package/extensions/twitch/CHANGELOG.md +6 -0
  80. package/extensions/twitch/package.json +1 -1
  81. package/extensions/voice-call/CHANGELOG.md +6 -0
  82. package/extensions/voice-call/package.json +1 -1
  83. package/extensions/zalo/CHANGELOG.md +6 -0
  84. package/extensions/zalo/package.json +1 -1
  85. package/extensions/zalouser/CHANGELOG.md +6 -0
  86. package/extensions/zalouser/package.json +1 -1
  87. package/install.sh +14 -18
  88. package/package.json +1 -1
  89. package/scripts/fased-managed-updater.mjs +1 -1
  90. package/scripts/fased-signer-owner-policy.mjs +13 -1
  91. package/scripts/start-managed.sh +4 -0
@@ -33,6 +33,7 @@ const SAT_DISPUTE_SEED = "sat_dispute";
33
33
  const MINING_STAKE_SEED = "mining_stake";
34
34
  const TOKEN_PROGRAM_ID = "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA";
35
35
  const ASSOCIATED_TOKEN_PROGRAM_ID = "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL";
36
+ const ADDRESS_LOOKUP_TABLE_PROGRAM_ID = "AddressLookupTab1e1111111111111111111111111";
36
37
 
37
38
  function assertDedicatedBondProgramConfigured(env: NodeJS.ProcessEnv = process.env): void {
38
39
  const resolved = resolveSatBondProgramIdFromEnv(env);
@@ -399,6 +400,7 @@ export type SatCycleSettlementProgressV2View = {
399
400
  scoreExclusiveUntilSlot?: number | undefined;
400
401
  distributeExclusiveUntilSlot?: number | undefined;
401
402
  keeperBountyPaidLamports?: string | undefined;
403
+ keeperBountyUnpaidLamports?: string | undefined;
402
404
  };
403
405
 
404
406
  export type SatTreasuryStateView = {
@@ -421,6 +423,7 @@ export type SatPayoutReadinessView = {
421
423
  export type SatMiningStatusAccountsView = {
422
424
  globalState: SatGlobalStateView | null;
423
425
  currentCycle: SatCycleView | null;
426
+ currentSettlementProgress: SatCycleSettlementProgressV2View | null;
424
427
  currentMinerCycle: SatMinerCycleView | null;
425
428
  claimMinerCycle: SatMinerCycleView | null;
426
429
  minerCapital: SatMinerCapitalView | null;
@@ -1127,7 +1130,7 @@ export function decodeSatCycleRegistryPage(
1127
1130
  };
1128
1131
  }
1129
1132
 
1130
- function decodeSatCycleSettlementProgressV2(
1133
+ export function decodeSatCycleSettlementProgressV2(
1131
1134
  data: Buffer,
1132
1135
  address: string,
1133
1136
  ): SatCycleSettlementProgressV2View {
@@ -1153,6 +1156,7 @@ function decodeSatCycleSettlementProgressV2(
1153
1156
  scoreExclusiveUntilSlot: readU64Number(body, 992),
1154
1157
  distributeExclusiveUntilSlot: readU64Number(body, 1000),
1155
1158
  keeperBountyPaidLamports: readU64String(body, 1008),
1159
+ keeperBountyUnpaidLamports: readU64String(body, 1016),
1156
1160
  };
1157
1161
  }
1158
1162
 
@@ -2140,9 +2144,13 @@ export function createReadConnection(
2140
2144
  } catch (secondaryError) {
2141
2145
  throw new Error(
2142
2146
  `rpc ${method} failed on primary (${String(
2143
- primaryError instanceof Error ? primaryError.message : primaryError,
2147
+ redactSensitiveUrlLikeString(
2148
+ primaryError instanceof Error ? primaryError.message : String(primaryError),
2149
+ ),
2144
2150
  )}) and fallback (${String(
2145
- secondaryError instanceof Error ? secondaryError.message : secondaryError,
2151
+ redactSensitiveUrlLikeString(
2152
+ secondaryError instanceof Error ? secondaryError.message : String(secondaryError),
2153
+ ),
2146
2154
  )})`,
2147
2155
  );
2148
2156
  }
@@ -2192,12 +2200,27 @@ async function resolveBondProgramContext(env: NodeJS.ProcessEnv) {
2192
2200
  };
2193
2201
  }
2194
2202
 
2195
- const SAT_PROTOCOL_VAULT_ACCOUNT_SPACE = 0;
2196
- const SAT_CYCLE_STATE_ACCOUNT_SPACE = 336;
2197
- const SAT_CYCLE_REGISTRY_META_ACCOUNT_SPACE = 88;
2198
- const SAT_CYCLE_REGISTRY_PAGE_ACCOUNT_SPACE = 2_072;
2199
- const SAT_CYCLE_SETTLEMENT_PROGRESS_V2_ACCOUNT_SPACE = 1_048;
2200
- const SAT_MINER_CYCLE_ACCOUNT_SPACE = 296;
2203
+ export const SAT_RENT_ACCOUNT_SPACES = {
2204
+ protocolVault: 0,
2205
+ cycleState: 376,
2206
+ cycleRegistryMeta: 88,
2207
+ cycleRegistryPage: 2_072,
2208
+ cycleSettlementProgressV2: 1_048,
2209
+ minerCycle: 352,
2210
+ unlockInterval: 80,
2211
+ } as const;
2212
+
2213
+ export function calculateSatRevealSharedRentLamports(params: {
2214
+ cycleSettlementProgressLamports: number;
2215
+ cycleRegistryPageLamports: number;
2216
+ unlockIntervalLamports: number;
2217
+ }): number {
2218
+ return (
2219
+ params.cycleSettlementProgressLamports +
2220
+ params.cycleRegistryPageLamports +
2221
+ params.unlockIntervalLamports
2222
+ );
2223
+ }
2201
2224
 
2202
2225
  function normalizeReadRpcConfig(rpc: string | SatReadRpcConfig): SatReadRpcConfig {
2203
2226
  return typeof rpc === "string" ? { primaryUrl: rpc, secondaryUrl: null } : rpc;
@@ -2255,7 +2278,9 @@ async function rpcRequestOnce<T>(rpcUrl: string, method: string, params: unknown
2255
2278
  );
2256
2279
  req.setTimeout(satRpcRequestTimeoutMs(), () => {
2257
2280
  req.destroy(
2258
- new Error(`rpc ${method} timed out after ${satRpcRequestTimeoutMs()}ms (${rpcUrl})`),
2281
+ new Error(
2282
+ `rpc ${method} timed out after ${satRpcRequestTimeoutMs()}ms (${redactSensitiveUrlLikeString(rpcUrl)})`,
2283
+ ),
2259
2284
  );
2260
2285
  });
2261
2286
  req.on("error", (error) => finishReject(error));
@@ -2321,10 +2346,12 @@ async function rpcRequest<T>(
2321
2346
  return result;
2322
2347
  } catch (secondaryError) {
2323
2348
  markReadRpcFailure(secondaryError, normalized.secondaryUrl);
2324
- const primaryMessage =
2325
- primaryError instanceof Error ? primaryError.message : String(primaryError);
2326
- const secondaryMessage =
2327
- secondaryError instanceof Error ? secondaryError.message : String(secondaryError);
2349
+ const primaryMessage = redactSensitiveUrlLikeString(
2350
+ primaryError instanceof Error ? primaryError.message : String(primaryError),
2351
+ );
2352
+ const secondaryMessage = redactSensitiveUrlLikeString(
2353
+ secondaryError instanceof Error ? secondaryError.message : String(secondaryError),
2354
+ );
2328
2355
  throw new Error(
2329
2356
  `rpc ${method} failed on primary (${primaryMessage}) and fallback (${secondaryMessage})`,
2330
2357
  );
@@ -2532,6 +2559,37 @@ export async function inspectSatChainSlot(_config: SatMiningConfig): Promise<num
2532
2559
  return await rpcRequest<number>(rpc, "getSlot", []);
2533
2560
  }
2534
2561
 
2562
+ export type SatAddressLookupTableView = {
2563
+ address: string;
2564
+ authority: string | null;
2565
+ addresses: string[];
2566
+ active: boolean;
2567
+ lastExtendedSlot: number;
2568
+ };
2569
+
2570
+ export async function inspectSatAddressLookupTable(
2571
+ _config: SatMiningConfig,
2572
+ params: { address: string },
2573
+ ): Promise<SatAddressLookupTableView | null> {
2574
+ const { solana, connection } = await resolveConnection(process.env);
2575
+ const address = new solana.PublicKey(params.address);
2576
+ const account = await connection.getAccountInfo(address, "confirmed");
2577
+ if (!account) {
2578
+ return null;
2579
+ }
2580
+ if (!account.owner.equals(new solana.PublicKey(ADDRESS_LOOKUP_TABLE_PROGRAM_ID))) {
2581
+ throw new Error("SAT distribution lookup table has the wrong program owner");
2582
+ }
2583
+ const state = solana.AddressLookupTableAccount.deserialize(account.data);
2584
+ return {
2585
+ address: address.toBase58(),
2586
+ authority: state.authority?.toBase58() ?? null,
2587
+ addresses: state.addresses.map((entry) => entry.toBase58()),
2588
+ active: state.deactivationSlot === 18_446_744_073_709_551_615n,
2589
+ lastExtendedSlot: state.lastExtendedSlot,
2590
+ };
2591
+ }
2592
+
2535
2593
  export async function inspectSatLamportBalance(
2536
2594
  _config: SatMiningConfig,
2537
2595
  params: { address: string },
@@ -2803,6 +2861,10 @@ export async function inspectSatMiningStatusAccounts(
2803
2861
  [Buffer.from("sat_cycle_state"), encodeU64(currentCycleId)],
2804
2862
  programId,
2805
2863
  );
2864
+ const [currentSettlementProgressAddress] = solana.PublicKey.findProgramAddressSync(
2865
+ [Buffer.from("sat_cycle_settlement_progress_v2"), encodeU64(currentCycleId)],
2866
+ programId,
2867
+ );
2806
2868
  const [treasuryStateAddress] = solana.PublicKey.findProgramAddressSync(
2807
2869
  [Buffer.from("sat_treasury_state")],
2808
2870
  programId,
@@ -2832,6 +2894,7 @@ export async function inspectSatMiningStatusAccounts(
2832
2894
 
2833
2895
  const coreEntries = [
2834
2896
  ["currentCycle", currentCycleAddress],
2897
+ ["currentSettlementProgress", currentSettlementProgressAddress],
2835
2898
  ["currentMinerCycle", currentMinerCycleAddress],
2836
2899
  ["claimMinerCycle", claimMinerCycleAddress],
2837
2900
  ["minerCapital", minerCapitalAddress],
@@ -2866,6 +2929,7 @@ export async function inspectSatMiningStatusAccounts(
2866
2929
 
2867
2930
  const globalRecord = recordFor(globalAddress);
2868
2931
  const currentCycleRecord = recordFor(currentCycleAddress);
2932
+ const currentSettlementProgressRecord = recordFor(currentSettlementProgressAddress);
2869
2933
  const currentMinerCycleRecord = recordFor(currentMinerCycleAddress);
2870
2934
  const claimMinerCycleRecord = recordFor(claimMinerCycleAddress);
2871
2935
  const minerCapitalRecord = recordFor(minerCapitalAddress);
@@ -2879,6 +2943,12 @@ export async function inspectSatMiningStatusAccounts(
2879
2943
  const currentCycle = currentCycleRecord?.data
2880
2944
  ? decodeSatCycle(currentCycleRecord.data, currentCycleAddress.toBase58())
2881
2945
  : null;
2946
+ const currentSettlementProgress = currentSettlementProgressRecord?.data
2947
+ ? decodeSatCycleSettlementProgressV2(
2948
+ currentSettlementProgressRecord.data,
2949
+ currentSettlementProgressAddress.toBase58(),
2950
+ )
2951
+ : null;
2882
2952
  const currentMinerCycle = currentMinerCycleRecord?.data
2883
2953
  ? decodeSatMinerCycle(currentMinerCycleRecord.data, currentMinerCycleAddress?.toBase58() ?? "")
2884
2954
  : null;
@@ -2913,6 +2983,11 @@ export async function inspectSatMiningStatusAccounts(
2913
2983
  SAT_RPC_LIVE_VIEW_CACHE_TTL_MS,
2914
2984
  currentCycle,
2915
2985
  );
2986
+ writeRpcCacheValue(
2987
+ `view:settlement-progress:${rpcCacheScope(rpc)}:${currentCycleId}`,
2988
+ SAT_RPC_LIVE_VIEW_CACHE_TTL_MS,
2989
+ currentSettlementProgress,
2990
+ );
2916
2991
  if (owner && currentMinerCycleAddress) {
2917
2992
  writeRpcCacheValue(
2918
2993
  `view:miner-cycle:${rpcCacheScope(rpc)}:${authority}:${currentCycleId}`,
@@ -2950,6 +3025,7 @@ export async function inspectSatMiningStatusAccounts(
2950
3025
  return {
2951
3026
  globalState,
2952
3027
  currentCycle,
3028
+ currentSettlementProgress,
2953
3029
  currentMinerCycle,
2954
3030
  claimMinerCycle,
2955
3031
  minerCapital,
@@ -3574,6 +3650,7 @@ export async function inspectSatRentExemptionLamports(config: SatMiningConfig):
3574
3650
  cycleRegistryPageLamports: string;
3575
3651
  cycleSettlementProgressLamports: string;
3576
3652
  minerCycleLamports: string;
3653
+ unlockIntervalLamports: string;
3577
3654
  openCycleLamports: string;
3578
3655
  submitCycleSharedLamports: string;
3579
3656
  submitCycleSignerLamports: string;
@@ -3594,18 +3671,24 @@ export async function inspectSatRentExemptionLamports(config: SatMiningConfig):
3594
3671
  cycleRegistryPageLamports,
3595
3672
  cycleSettlementProgressLamports,
3596
3673
  minerCycleLamports,
3674
+ unlockIntervalLamports,
3597
3675
  ] = await Promise.all([
3598
- connection.getMinimumBalanceForRentExemption(SAT_PROTOCOL_VAULT_ACCOUNT_SPACE),
3599
- connection.getMinimumBalanceForRentExemption(SAT_CYCLE_STATE_ACCOUNT_SPACE),
3600
- connection.getMinimumBalanceForRentExemption(SAT_CYCLE_REGISTRY_META_ACCOUNT_SPACE),
3601
- connection.getMinimumBalanceForRentExemption(SAT_CYCLE_REGISTRY_PAGE_ACCOUNT_SPACE),
3676
+ connection.getMinimumBalanceForRentExemption(SAT_RENT_ACCOUNT_SPACES.protocolVault),
3677
+ connection.getMinimumBalanceForRentExemption(SAT_RENT_ACCOUNT_SPACES.cycleState),
3678
+ connection.getMinimumBalanceForRentExemption(SAT_RENT_ACCOUNT_SPACES.cycleRegistryMeta),
3679
+ connection.getMinimumBalanceForRentExemption(SAT_RENT_ACCOUNT_SPACES.cycleRegistryPage),
3602
3680
  connection.getMinimumBalanceForRentExemption(
3603
- SAT_CYCLE_SETTLEMENT_PROGRESS_V2_ACCOUNT_SPACE,
3681
+ SAT_RENT_ACCOUNT_SPACES.cycleSettlementProgressV2,
3604
3682
  ),
3605
- connection.getMinimumBalanceForRentExemption(SAT_MINER_CYCLE_ACCOUNT_SPACE),
3683
+ connection.getMinimumBalanceForRentExemption(SAT_RENT_ACCOUNT_SPACES.minerCycle),
3684
+ connection.getMinimumBalanceForRentExemption(SAT_RENT_ACCOUNT_SPACES.unlockInterval),
3606
3685
  ]);
3607
3686
  const openCycleLamports = cycleStateLamports + cycleRegistryMetaLamports;
3608
- const submitCycleSharedLamports = cycleSettlementProgressLamports + cycleRegistryPageLamports;
3687
+ const submitCycleSharedLamports = calculateSatRevealSharedRentLamports({
3688
+ cycleSettlementProgressLamports,
3689
+ cycleRegistryPageLamports,
3690
+ unlockIntervalLamports,
3691
+ });
3609
3692
  return {
3610
3693
  registryReserveTargetLamports: String(registryReserveTargetLamports),
3611
3694
  protocolVaultLamports: String(protocolVaultLamports),
@@ -3614,6 +3697,7 @@ export async function inspectSatRentExemptionLamports(config: SatMiningConfig):
3614
3697
  cycleRegistryPageLamports: String(cycleRegistryPageLamports),
3615
3698
  cycleSettlementProgressLamports: String(cycleSettlementProgressLamports),
3616
3699
  minerCycleLamports: String(minerCycleLamports),
3700
+ unlockIntervalLamports: String(unlockIntervalLamports),
3617
3701
  openCycleLamports: String(openCycleLamports),
3618
3702
  submitCycleSharedLamports: String(submitCycleSharedLamports),
3619
3703
  submitCycleSignerLamports: String(minerCycleLamports),
@@ -184,6 +184,7 @@ export type SatMiningRuntimeState = {
184
184
  roundExecution: Map<string, SatRoundExecutionState>;
185
185
  claimBacklog: Map<number, SatClaimBacklogEntry>;
186
186
  settlementPageParticipants: Map<string, string[]>;
187
+ settlementPageLookupTables: Map<string, string>;
187
188
  auditArtifacts: Map<string, SatAuditArtifact>;
188
189
  auditStorePath: string | null;
189
190
  runtimeStorePath: string | null;
@@ -673,6 +674,7 @@ export function createSatMiningRuntimeState(_config: SatMiningConfig): SatMining
673
674
  roundExecution: new Map(),
674
675
  claimBacklog: new Map(),
675
676
  settlementPageParticipants: new Map(),
677
+ settlementPageLookupTables: new Map(),
676
678
  auditArtifacts: new Map(),
677
679
  auditStorePath: null,
678
680
  runtimeStorePath: null,