@spacemolt/lib 15.2.0 → 16.0.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.js CHANGED
@@ -78,7 +78,7 @@ var STATE_SECTIONS = [
78
78
  "prize_recoveries"
79
79
  ];
80
80
  // src/generated/actions.gen.ts
81
- var GENERATED_SPEC_VERSION = "v0.612.0";
81
+ var GENERATED_SPEC_VERSION = "v0.622.0";
82
82
  var ACTIONS = {
83
83
  "spacemolt_arena/accept": {
84
84
  tool: "spacemolt_arena",
@@ -1127,6 +1127,14 @@ var ACTIONS = {
1127
1127
  { name: "id", type: "string", required: true, description: "ID of the faction mission template to cancel", positional: 0 }
1128
1128
  ]
1129
1129
  },
1130
+ "spacemolt_faction/cancel_mobile_base_jump": {
1131
+ tool: "spacemolt_faction",
1132
+ action: "cancel_mobile_base_jump",
1133
+ kind: "mutation",
1134
+ summary: "Cancel a faction mobile-base jump during preparation",
1135
+ detailsType: "FactionMobileBaseResponse",
1136
+ params: []
1137
+ },
1130
1138
  "spacemolt_faction/create": {
1131
1139
  tool: "spacemolt_faction",
1132
1140
  action: "create",
@@ -1159,6 +1167,14 @@ var ACTIONS = {
1159
1167
  { name: "id", type: "string", required: true, description: "Faction ID to decline invitation from", positional: 0 }
1160
1168
  ]
1161
1169
  },
1170
+ "spacemolt_faction/decommission_mobile_base": {
1171
+ tool: "spacemolt_faction",
1172
+ action: "decommission_mobile_base",
1173
+ kind: "mutation",
1174
+ summary: "Permanently decommission an empty faction mobile base",
1175
+ detailsType: "DecommissionMobileBaseResponse",
1176
+ params: []
1177
+ },
1162
1178
  "spacemolt_faction/delete_role": {
1163
1179
  tool: "spacemolt_faction",
1164
1180
  action: "delete_role",
@@ -1195,6 +1211,14 @@ var ACTIONS = {
1195
1211
  responseType: "FactionGetInvitesResponse",
1196
1212
  params: []
1197
1213
  },
1214
+ "spacemolt_faction/get_mobile_base": {
1215
+ tool: "spacemolt_faction",
1216
+ action: "get_mobile_base",
1217
+ kind: "query",
1218
+ summary: "Inspect your faction's mobile base and its movement state",
1219
+ responseType: "FactionMobileBaseResponse",
1220
+ params: []
1221
+ },
1198
1222
  "spacemolt_faction/info": {
1199
1223
  tool: "spacemolt_faction",
1200
1224
  action: "info",
@@ -1227,6 +1251,16 @@ var ACTIONS = {
1227
1251
  { name: "id", type: "string", required: true, description: "UUID of faction to join (must have pending invite)", positional: 0 }
1228
1252
  ]
1229
1253
  },
1254
+ "spacemolt_faction/jump_mobile_base": {
1255
+ tool: "spacemolt_faction",
1256
+ action: "jump_mobile_base",
1257
+ kind: "mutation",
1258
+ summary: "Prepare an inter-system jump for your faction mobile base",
1259
+ detailsType: "FactionMobileBaseResponse",
1260
+ params: [
1261
+ { name: "id", type: "string", required: true, description: "Adjacent destination system personally known by the commander", positional: 0 }
1262
+ ]
1263
+ },
1230
1264
  "spacemolt_faction/kick": {
1231
1265
  tool: "spacemolt_faction",
1232
1266
  action: "kick",
@@ -1264,6 +1298,17 @@ var ACTIONS = {
1264
1298
  responseType: "FactionListMissionsResponse",
1265
1299
  params: []
1266
1300
  },
1301
+ "spacemolt_faction/move_mobile_base": {
1302
+ tool: "spacemolt_faction",
1303
+ action: "move_mobile_base",
1304
+ kind: "mutation",
1305
+ summary: "Move your faction mobile base to new coordinates in its current system",
1306
+ detailsType: "FactionMobileBaseResponse",
1307
+ params: [
1308
+ { name: "x", type: "number", required: true, description: "Destination X coordinate in AU (within 10 AU of system center)" },
1309
+ { name: "y", type: "number", required: true, description: "Destination Y coordinate in AU (within 10 AU of system center)" }
1310
+ ]
1311
+ },
1267
1312
  "spacemolt_faction/prepay_tax": {
1268
1313
  tool: "spacemolt_faction",
1269
1314
  action: "prepay_tax",
@@ -2331,7 +2376,7 @@ var ACTIONS = {
2331
2376
  { name: "faction_id", type: "string", required: false, description: "View a faction's action log instead of your own (must be a member)" },
2332
2377
  { name: "page", type: "number", required: false, description: "Page number (default 1). Ignored when since_id is set." },
2333
2378
  { name: "page_size", type: "number", required: false, description: "Entries per page, or max entries to return when since_id is set (default 50, max 100)" },
2334
- { name: "since_id", type: "number", required: false, description: "Cursor for gap-free incremental polling: return only entries with id greater than this, oldest-first, up to page_size. Pass 0 or omit for normal newest-first paging. Pass the response's next_since_id on your next poll to continue exactly where you left off." }
2379
+ { name: "since_id", type: "number", required: false, description: "Positive cursor: return entries with greater IDs in ascending ID order, up to page_size. Pass 0 or omit for newest-first paging. Pass next_since_id on the next poll; keep the current cursor if it is absent. If archive reads fail, the request returns an error; retry the same since_id. Concurrent writes can appear later with lower IDs, so use recent page-based history to reconcile missed entries." }
2335
2380
  ]
2336
2381
  },
2337
2382
  "spacemolt_social/get_chat_history": {
@@ -2879,7 +2924,7 @@ var ACTIONS = {
2879
2924
  tool: "spacemolt",
2880
2925
  action: "get_system",
2881
2926
  kind: "query",
2882
- summary: "Get your current system details",
2927
+ summary: "Get your current system's chart: charted POIs and connections. With a ship scanner, each POI also carries ship_count",
2883
2928
  responseType: "GetSystemCommandResponse",
2884
2929
  params: []
2885
2930
  },
@@ -2887,7 +2932,7 @@ var ACTIONS = {
2887
2932
  tool: "spacemolt",
2888
2933
  action: "get_system_agents",
2889
2934
  kind: "query",
2890
- summary: "Get all uncloaked online players in your current system",
2935
+ summary: "DEPRECATED: always returns an empty list. Use get_nearby for the ships at your POI and get_system with a ship scanner for ship counts at the other POIs",
2891
2936
  responseType: "GetSystemAgentsResponse",
2892
2937
  params: []
2893
2938
  },
@@ -3069,7 +3114,7 @@ var ACTIONS = {
3069
3114
  summary: "Scan a target, or sweep the area for cloaked ships when no target is given",
3070
3115
  detailsType: "ScanResponse",
3071
3116
  params: [
3072
- { name: "id", type: "string", required: false, description: "Player ID/username, NPC ID/name, wildlife creature ID, or intact-prize actor ID to scan. Prize actor IDs come from get_nearby. Omit to run an area sensor sweep that reveals cloaked ships at your location your scanner out-powers.", positional: 0 }
3117
+ { name: "id", type: "string", required: false, description: "Player ID/username, NPC ID/name, wildlife creature ID, or intact-prize actor ID to scan. Prize actor IDs come from get_nearby. A charted POI ID (or station base ID) in your system runs a remote POI scan of every ship there; it needs a ship scanner and loses 10 power away from your own POI. Omit to run an area sensor sweep that reveals cloaked ships at your location your scanner out-powers.", positional: 0 }
3073
3118
  ]
3074
3119
  },
3075
3120
  "spacemolt/search_systems": {
@@ -3106,7 +3151,7 @@ var ACTIONS = {
3106
3151
  tool: "spacemolt",
3107
3152
  action: "subscribe_observation",
3108
3153
  kind: "query",
3109
- summary: "Subscribe to live presence updates at your current POI and system",
3154
+ summary: "Subscribe to live presence updates for the players at your POI, plus ship_counts for the other POIs with a ship scanner",
3110
3155
  responseType: "SubscribeObservationResponse",
3111
3156
  params: [
3112
3157
  { name: "active_scan", type: "boolean", required: false, description: "Also run a continuous active sensor sweep that resolves cloaked ships (requires a scanner, must be undocked, burns 1 fuel/tick, alerts cloakers). Omit or false for the passive presence feed only." }
@@ -3116,7 +3161,7 @@ var ACTIONS = {
3116
3161
  tool: "spacemolt",
3117
3162
  action: "survey_system",
3118
3163
  kind: "mutation",
3119
- summary: "Scan for hidden deep core deposits in the current system",
3164
+ summary: "Read ore across the current system and scan for hidden POIs",
3120
3165
  detailsType: "SurveySystemResponse",
3121
3166
  params: []
3122
3167
  },
@@ -3365,20 +3410,25 @@ function buildCommands(dispatch) {
3365
3410
  accept_invite: bind("spacemolt_faction", "accept_invite"),
3366
3411
  accept_peace: bind("spacemolt_faction", "accept_peace"),
3367
3412
  cancel_mission: bind("spacemolt_faction", "cancel_mission"),
3413
+ cancel_mobile_base_jump: bindBare("spacemolt_faction", "cancel_mobile_base_jump"),
3368
3414
  create: bind("spacemolt_faction", "create"),
3369
3415
  declare_war: bind("spacemolt_faction", "declare_war"),
3370
3416
  decline_invite: bind("spacemolt_faction", "decline_invite"),
3417
+ decommission_mobile_base: bindBare("spacemolt_faction", "decommission_mobile_base"),
3371
3418
  delete_role: bind("spacemolt_faction", "delete_role"),
3372
3419
  delete_room: bind("spacemolt_faction", "delete_room"),
3373
3420
  garages: bindBare("spacemolt_faction", "garages"),
3374
3421
  get_invites: bindBare("spacemolt_faction", "get_invites"),
3422
+ get_mobile_base: bindBare("spacemolt_faction", "get_mobile_base"),
3375
3423
  info: bind("spacemolt_faction", "info"),
3376
3424
  invite: bind("spacemolt_faction", "invite"),
3377
3425
  join: bind("spacemolt_faction", "join"),
3426
+ jump_mobile_base: bind("spacemolt_faction", "jump_mobile_base"),
3378
3427
  kick: bind("spacemolt_faction", "kick"),
3379
3428
  leave: bindBare("spacemolt_faction", "leave"),
3380
3429
  list: bind("spacemolt_faction", "list"),
3381
3430
  list_missions: bindBare("spacemolt_faction", "list_missions"),
3431
+ move_mobile_base: bind("spacemolt_faction", "move_mobile_base"),
3382
3432
  prepay_tax: bind("spacemolt_faction", "prepay_tax"),
3383
3433
  propose_ally: bind("spacemolt_faction", "propose_ally"),
3384
3434
  propose_peace: bind("spacemolt_faction", "propose_peace"),
@@ -3867,11 +3917,13 @@ class ObservationCache {
3867
3917
  system_id: snapshot.system_id,
3868
3918
  tick: 0,
3869
3919
  nearby: indexBy(snapshot.nearby, (p) => p.player_id),
3870
- system: indexBy(snapshot.system_agents, (p) => p.player_id),
3871
3920
  pirates: indexBy(snapshot.pirates, (p) => p.pirate_id),
3872
3921
  empireNpcs: indexBy(snapshot.empire_npcs, (n) => n.npc_id),
3873
3922
  creatures: indexBy(snapshot.creatures, (c) => c.creature_id),
3874
3923
  prizes: indexBy(snapshot.prizes, (p) => p.prize_id),
3924
+ arenaNpcs: indexBy(snapshot.arena_npcs, (n) => n.npc_id),
3925
+ offlineCollapsed: snapshot.offline_collapsed ?? 0,
3926
+ shipCounts: new Map(Object.entries(snapshot.ship_counts ?? {})),
3875
3927
  cloaked: indexBy(snapshot.cloaked_contacts, (c) => c.target_id),
3876
3928
  unknownSignature: snapshot.unknown_signature ?? false,
3877
3929
  activeScan: snapshot.active_scan ?? false
@@ -3885,11 +3937,13 @@ class ObservationCache {
3885
3937
  system_id: update.system_id,
3886
3938
  tick: update.tick,
3887
3939
  nearby: new Map,
3888
- system: new Map,
3889
3940
  pirates: new Map,
3890
3941
  empireNpcs: new Map,
3891
3942
  creatures: new Map,
3892
3943
  prizes: new Map,
3944
+ arenaNpcs: new Map,
3945
+ offlineCollapsed: 0,
3946
+ shipCounts: new Map,
3893
3947
  cloaked: new Map,
3894
3948
  unknownSignature: false,
3895
3949
  activeScan: false
@@ -3898,12 +3952,16 @@ class ObservationCache {
3898
3952
  const v = this.view;
3899
3953
  v.tick = update.tick;
3900
3954
  merge(v.nearby, update.nearby_changed, update.nearby_departed, (p) => p.player_id);
3901
- merge(v.system, update.system_changed, update.system_departed, (p) => p.player_id);
3902
3955
  merge(v.pirates, update.pirates_changed, update.pirates_departed, (p) => p.pirate_id);
3903
3956
  merge(v.empireNpcs, update.empire_npcs_changed, update.empire_npcs_departed, (n) => n.npc_id);
3904
3957
  merge(v.creatures, update.creatures_changed, update.creatures_departed, (c) => c.creature_id);
3905
3958
  merge(v.prizes, update.prizes_changed, update.prizes_departed, (p) => p.prize_id);
3959
+ merge(v.arenaNpcs, update.arena_npcs_changed, update.arena_npcs_departed, (n) => n.npc_id);
3906
3960
  merge(v.cloaked, update.cloaked_resolved, update.cloaked_lost, (c) => c.target_id);
3961
+ if (update.offline_collapsed !== undefined)
3962
+ v.offlineCollapsed = update.offline_collapsed;
3963
+ if (update.ship_counts !== undefined)
3964
+ v.shipCounts = new Map(Object.entries(update.ship_counts));
3907
3965
  if (update.unknown_signature !== undefined)
3908
3966
  v.unknownSignature = update.unknown_signature;
3909
3967
  if (update.active_scan !== undefined)
@@ -4211,6 +4269,7 @@ var ARRIVED = {
4211
4269
  nearby_pirate_count: undefined,
4212
4270
  nearby_empire_npcs: undefined,
4213
4271
  nearby_empire_npc_count: undefined,
4272
+ nearby_leviathans: undefined,
4214
4273
  offline_collapsed: undefined,
4215
4274
  unknown_signature: undefined
4216
4275
  };
@@ -4660,48 +4719,17 @@ class Account {
4660
4719
  const view = this.observationCache.current();
4661
4720
  if (!view)
4662
4721
  return;
4663
- const nearbyPlayers = [...view.nearby.entries()].map(([playerId, p]) => ({
4664
- player_id: playerId,
4665
- in_combat: p.in_combat ?? false,
4666
- ...p.clan_tag !== undefined && { clan_tag: p.clan_tag },
4667
- ...p.faction_tag !== undefined && { faction_tag: p.faction_tag },
4668
- ...p.offline !== undefined && { offline: p.offline },
4669
- ...p.ship_class !== undefined && { ship_class: p.ship_class },
4670
- ...p.ship_name !== undefined && { ship_name: p.ship_name },
4671
- ...p.username !== undefined && { username: p.username }
4672
- }));
4673
- const nearbyPirates = [...view.pirates.values()].map((p) => ({
4674
- pirate_id: p.pirate_id,
4675
- name: p.name,
4676
- tier: p.tier,
4677
- is_boss: p.is_boss,
4678
- status: p.status,
4679
- hull: p.hull ?? 0,
4680
- max_hull: p.max_hull ?? 0,
4681
- shield: p.shield ?? 0,
4682
- max_shield: p.max_shield ?? 0,
4683
- ...p.faction !== undefined && { faction: p.faction },
4684
- ...p.faction_name !== undefined && { faction_name: p.faction_name }
4685
- }));
4686
- const nearbyEmpireNpcs = [...view.empireNpcs.values()].map((n) => ({
4687
- npc_id: n.npc_id,
4688
- name: n.name,
4689
- role: n.role,
4690
- empire: n.empire,
4691
- in_combat: n.in_combat,
4692
- ...n.fleet_name !== undefined && { fleet_name: n.fleet_name },
4693
- ...n.ship_class !== undefined && { ship_class: n.ship_class },
4694
- ...n.ship_name !== undefined && { ship_name: n.ship_name }
4695
- }));
4722
+ const nearbyPlayers = [...view.nearby.values()].sort((a, b) => Number(a.offline ?? false) - Number(b.offline ?? false) || (a.username < b.username ? -1 : a.username > b.username ? 1 : 0));
4696
4723
  const changed = this.cache.patchSection("location", {
4697
4724
  nearby_players: nearbyPlayers,
4698
- nearby_player_count: view.nearby.size,
4699
- nearby_pirates: nearbyPirates,
4725
+ nearby_player_count: nearbyPlayers.length,
4726
+ nearby_pirates: [...view.pirates.values()],
4700
4727
  nearby_pirate_count: view.pirates.size,
4701
- nearby_empire_npcs: nearbyEmpireNpcs,
4728
+ nearby_empire_npcs: [...view.empireNpcs.values()],
4702
4729
  nearby_empire_npc_count: view.empireNpcs.size,
4703
4730
  nearby_prizes: [...view.prizes.values()],
4704
4731
  nearby_prize_count: view.prizes.size,
4732
+ offline_collapsed: view.offlineCollapsed,
4705
4733
  unknown_signature: view.unknownSignature
4706
4734
  });
4707
4735
  if (changed.length)
@@ -5149,6 +5177,27 @@ class Account {
5149
5177
  }
5150
5178
  }
5151
5179
  // src/auth/credentials.ts
5180
+ function hasString(value, key) {
5181
+ return typeof value[key] === "string";
5182
+ }
5183
+ function isStoredAccount(value) {
5184
+ if (!isRecord(value) || !hasString(value, "id") || !isRecord(value.credentials))
5185
+ return false;
5186
+ const credentials = value.credentials;
5187
+ switch (credentials.kind) {
5188
+ case "login":
5189
+ return hasString(credentials, "username") && hasString(credentials, "password");
5190
+ case "login_token":
5191
+ return hasString(credentials, "token");
5192
+ case "clerk":
5193
+ return hasString(credentials, "apiKey") && hasString(credentials, "playerId") && hasString(credentials, "httpBaseUrl");
5194
+ case "register":
5195
+ return hasString(credentials, "username") && hasString(credentials, "empire") && (credentials.registration_code === undefined || typeof credentials.registration_code === "string");
5196
+ default:
5197
+ return false;
5198
+ }
5199
+ }
5200
+
5152
5201
  class MemoryCredentialStore {
5153
5202
  accounts = new Map;
5154
5203
  list() {
@@ -5757,6 +5806,7 @@ var TYPED_NOTIFICATION_TYPES = [
5757
5806
  "faction_alliance_broken",
5758
5807
  "faction_alliance_formed",
5759
5808
  "faction_alliance_proposal",
5809
+ "faction_mobile_base_update",
5760
5810
  "faction_peace_accepted",
5761
5811
  "faction_peace_proposal",
5762
5812
  "faction_war_declared",
@@ -5871,3 +5921,6 @@ export {
5871
5921
  mintWsToken,
5872
5922
  retryAfterMsFromClose
5873
5923
  };
5924
+
5925
+ //# debugId=AAB4EA14A4AA073D64756E2164756E21
5926
+ //# sourceMappingURL=index.js.map