@spacemolt/lib 15.2.0 → 15.2.1

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/COMMANDS.md CHANGED
@@ -1,7 +1,7 @@
1
1
  <!-- AUTO-GENERATED by scripts/generate.ts from openapi.json. DO NOT EDIT. -->
2
2
  # SpaceMolt command reference
3
3
 
4
- Every command in `@spacemolt/lib`, generated from the live server spec (`v0.612.0`). **296 commands across 19 tools.**
4
+ Every command in `@spacemolt/lib`, generated from the live server spec (`v0.613.4`). **296 commands across 19 tools.**
5
5
 
6
6
  ## How to call a command
7
7
 
@@ -39,13 +39,14 @@ export interface ClerkRegistration {
39
39
  registrationCode: string;
40
40
  players: ClerkPlayer[];
41
41
  }
42
+ type HeadersCtorInit = NonNullable<ConstructorParameters<typeof Headers>[0]>;
42
43
  /**
43
44
  * Headers that authorize calls to the Clerk-gated gameserver endpoints — an
44
45
  * alternative to `apiKey` for callers whose credential isn't a static key.
45
46
  * A factory is resolved fresh on every request, so short-lived tokens (e.g. a
46
47
  * browser Clerk session's `getToken()` JWT) stay valid across reconnects.
47
48
  */
48
- export type ClerkAuthHeaders = HeadersInit | (() => HeadersInit | Promise<HeadersInit>);
49
+ export type ClerkAuthHeaders = HeadersCtorInit | (() => HeadersCtorInit | Promise<HeadersCtorInit>);
49
50
  /** How Clerk-gated requests are authorized. Provide `apiKey`, `headers`, or both. */
50
51
  export interface ClerkAuth {
51
52
  /** Clerk API key, sent as `Authorization: Bearer`. Keep it secret. */
@@ -83,3 +84,4 @@ export declare class ClerkSource {
83
84
  /** Mint a single-use WS login token for one owned player. */
84
85
  mintWsToken(playerId: string): Promise<string>;
85
86
  }
87
+ export {};
@@ -1,5 +1,5 @@
1
1
  /** The gameserver spec version this command surface was generated from. */
2
- export declare const GENERATED_SPEC_VERSION = "v0.612.0";
2
+ export declare const GENERATED_SPEC_VERSION = "v0.613.4";
3
3
  export type ToolName = "spacemolt" | "spacemolt_arena" | "spacemolt_auth" | "spacemolt_battle" | "spacemolt_citizenship" | "spacemolt_drone" | "spacemolt_facility" | "spacemolt_faction" | "spacemolt_faction_admin" | "spacemolt_faction_commerce" | "spacemolt_fleet" | "spacemolt_intel" | "spacemolt_market" | "spacemolt_salvage" | "spacemolt_ship" | "spacemolt_shipping" | "spacemolt_social" | "spacemolt_storage" | "spacemolt_transfer";
4
4
  export type ActionName = "abandon_mission" | "accept" | "accept_ally" | "accept_invite" | "accept_mission" | "accept_peace" | "active" | "advance" | "allow_faction" | "allow_player" | "analyze_market" | "apply" | "attack" | "ban" | "base_cost" | "board" | "browse_for_sale" | "browse_ships" | "build" | "buy" | "buy_listed_ship" | "buy_listing" | "buy_ship_license" | "cancel" | "cancel_commission" | "cancel_listing" | "cancel_mission" | "cancel_order" | "cancel_ship_buy_order" | "cancel_ship_listing" | "captains_log_add" | "captains_log_delete" | "captains_log_get" | "captains_log_list" | "challenge" | "challenges" | "chat" | "claim" | "claim_prize" | "cloak" | "commission_quote" | "commission_ship" | "commission_status" | "complete_mission" | "completed_missions" | "craft" | "create" | "create_buy_order" | "create_note" | "create_role" | "create_sell_order" | "declare_war" | "decline" | "decline_invite" | "decline_mission" | "delete_note" | "delete_role" | "delete_room" | "deliver" | "deploy" | "deploy_outpost" | "deposit" | "disband" | "disembark" | "dismantle" | "dismantle_outpost" | "distress_signal" | "dock" | "edit" | "edit_role" | "engage" | "espionage" | "estimate_purchase" | "facility_set_description" | "faction_build" | "faction_dismantle" | "faction_list" | "faction_owned" | "faction_personnel" | "faction_upgrade" | "fight" | "find_route" | "forum_create_thread" | "forum_delete_reply" | "forum_delete_thread" | "forum_get_thread" | "forum_list" | "forum_reply" | "forum_upvote" | "found_station" | "garages" | "get" | "get_achievements" | "get_action_log" | "get_active_missions" | "get_base" | "get_cargo" | "get_chat_history" | "get_commands" | "get_empire_info" | "get_faction_achievements" | "get_guide" | "get_invites" | "get_location" | "get_map" | "get_missions" | "get_nearby" | "get_notes" | "get_notification_settings" | "get_notifications" | "get_player" | "get_poi" | "get_queue" | "get_ship" | "get_skills" | "get_state" | "get_status" | "get_system" | "get_system_agents" | "get_tax_estimate" | "get_trades" | "get_version" | "hunt" | "info" | "inspect" | "install_mod" | "insure" | "intel_status" | "invite" | "jettison" | "job_add" | "job_cancel" | "job_list" | "job_reorder" | "join" | "jump" | "kick" | "leave" | "list" | "list_for_sale" | "list_missions" | "list_passengers" | "list_ship_for_sale" | "list_ships" | "list_station_passengers" | "load" | "load_passenger" | "log" | "login" | "login_link" | "login_link_poll" | "login_token" | "logout" | "loot" | "mine" | "modify_order" | "mute_notifications" | "name" | "owned" | "pay_bounty" | "pay_debt" | "personal_build" | "personal_decorate" | "personal_visit" | "petition" | "place_ship_buy_order" | "policies" | "post" | "post_mission" | "prepay_tax" | "profile" | "promote" | "propose_ally" | "propose_peace" | "query_intel" | "query_trade_intel" | "quote" | "ranch_set_cull" | "ranch_status" | "read_note" | "recall" | "recruit_personnel" | "recycle" | "refit_ship" | "refuel" | "register" | "release" | "reload" | "remove_ally" | "remove_enemy" | "remove_faction" | "remove_player" | "rename_ship" | "renounce" | "repair" | "retreat" | "return" | "rooms" | "scan" | "scan_poi" | "scrap" | "scrap_ship" | "search_systems" | "self_destruct" | "sell" | "sell_ship_to_order" | "service_prize" | "set_access" | "set_auto_buy_fuel" | "set_build_policy" | "set_colors" | "set_description" | "set_enemy" | "set_home" | "set_market_fee" | "set_name" | "set_output_price" | "set_public" | "set_refuel_price" | "set_repair_price" | "set_service_access" | "set_status" | "stance" | "station_info" | "station_set_name" | "status" | "submit_intel" | "submit_trade_intel" | "subscribe_market" | "subscribe_observation" | "summary" | "supply_commission" | "survey_system" | "switch_ship" | "target" | "tax_estimate" | "tow" | "track" | "trade_accept" | "trade_cancel" | "trade_decline" | "trade_intel_status" | "trade_offer" | "transfer" | "transfer_personnel" | "travel" | "treat_personnel" | "types" | "unban" | "undock" | "uninstall_mod" | "unload" | "unload_passenger" | "unmute_notifications" | "unsubscribe_market" | "unsubscribe_observation" | "upgrade" | "upgrades" | "upload" | "use_item" | "view" | "view_completed_mission" | "view_market" | "view_orders" | "view_ship_buy_orders" | "visit_room" | "withdraw" | "withdraw_invite" | "wrecks" | "write_note" | "write_room";
5
5
  export interface ActionParam {
@@ -2877,7 +2877,7 @@ export type DockResponse = {
2877
2877
  commissions_active?: Array<CommissionActive>;
2878
2878
  facility_note?: string;
2879
2879
  fuel_warning?: string;
2880
- gifts?: Array<GiftNotification>;
2880
+ gifts?: Array<StorageGift>;
2881
2881
  gifts_count?: number;
2882
2882
  gifts_note?: string;
2883
2883
  gifts_truncated?: boolean;
@@ -5069,14 +5069,6 @@ export type GetWrecksResponse = {
5069
5069
  count: number;
5070
5070
  wrecks: Array<EnrichedWreck>;
5071
5071
  };
5072
- export type GiftNotification = {
5073
- credits?: number;
5074
- items?: Array<ItemQuantity>;
5075
- message?: string;
5076
- sender: string;
5077
- sender_id: string;
5078
- timestamp: string;
5079
- };
5080
5072
  export type GiftShipResponse = {
5081
5073
  action: 'gift_ship';
5082
5074
  /**
@@ -5166,6 +5158,9 @@ export type InspectPackageShipment = {
5166
5158
  };
5167
5159
  export type InspectResponse = {
5168
5160
  base?: GetBaseResponse;
5161
+ /**
5162
+ * Present only when source is catalog. kind item or module → type items, entries are Item or Module. kind ship_class → type ships, entries are ShipClass. Other catalog types are not returned here.
5163
+ */
5169
5164
  catalog?: {
5170
5165
  analysis?: RecipeAnalysis;
5171
5166
  estimated_material_cost?: number;
@@ -5704,6 +5699,10 @@ export type MarketInsight = {
5704
5699
  };
5705
5700
  export type MarketItemBook = {
5706
5701
  buy_orders: Array<MarketLevel>;
5702
+ /**
5703
+ * Item category of this item_id such as ore; refined; component; or module for a ship module. It is the category view_market reports for the same item_id. Omitted when the definition is no longer known.
5704
+ */
5705
+ category?: string;
5707
5706
  item_id: string;
5708
5707
  item_name?: string;
5709
5708
  sell_orders: Array<MarketLevel>;
@@ -10908,7 +10907,7 @@ export type V2Response = {
10908
10907
  */
10909
10908
  error?: {
10910
10909
  /**
10911
- * Machine-readable error code. Session/auth codes: session_required (no X-Session-Id header), session_invalid (session not found or expired — create a new one with POST /api/v2/session then login), not_authenticated (session exists but not logged in). Other codes: rate_limited, command_error, invalid_params, invalid_json, payload_too_large, method_not_allowed, missing_action, unknown_command.
10910
+ * Machine-readable error code. Session/auth codes: session_required (no X-Session-Id header), session_invalid (session not found or expired — create a new one with POST /api/v2/session then login), not_authenticated (session exists but not logged in). Other codes: rate_limited, command_error, invalid_params, invalid_json, payload_too_large, method_not_allowed, missing_action, unknown_command. ip_timed_out is WebSocket-only: over HTTP an IP block returns a flat 429 body without this envelope: {"error": "rate_limited", "message", "retry_after", "limit": "ip_timeout", "scope": "ip"} plus a Retry-After header.
10912
10911
  */
10913
10912
  code?: string;
10914
10913
  /**
@@ -10922,7 +10921,7 @@ export type V2Response = {
10922
10921
  */
10923
10922
  message?: string;
10924
10923
  /**
10925
- * Seconds to wait before retrying. Present on rate_limited errors.
10924
+ * Seconds to wait before retrying. Present on rate_limited errors from a rate-limit bucket (failed-login and bug-report rate_limited errors omit it), with the same value in the Retry-After header. details then carries limit (the bucket), scope (what the bucket is keyed on) and, for capped buckets, limit_per_min and current.
10926
10925
  */
10927
10926
  retry_after?: number;
10928
10927
  };
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.613.4";
82
82
  var ACTIONS = {
83
83
  "spacemolt_arena/accept": {
84
84
  tool: "spacemolt_arena",
@@ -5149,6 +5149,27 @@ class Account {
5149
5149
  }
5150
5150
  }
5151
5151
  // src/auth/credentials.ts
5152
+ function hasString(value, key) {
5153
+ return typeof value[key] === "string";
5154
+ }
5155
+ function isStoredAccount(value) {
5156
+ if (!isRecord(value) || !hasString(value, "id") || !isRecord(value.credentials))
5157
+ return false;
5158
+ const credentials = value.credentials;
5159
+ switch (credentials.kind) {
5160
+ case "login":
5161
+ return hasString(credentials, "username") && hasString(credentials, "password");
5162
+ case "login_token":
5163
+ return hasString(credentials, "token");
5164
+ case "clerk":
5165
+ return hasString(credentials, "apiKey") && hasString(credentials, "playerId") && hasString(credentials, "httpBaseUrl");
5166
+ case "register":
5167
+ return hasString(credentials, "username") && hasString(credentials, "empire") && (credentials.registration_code === undefined || typeof credentials.registration_code === "string");
5168
+ default:
5169
+ return false;
5170
+ }
5171
+ }
5172
+
5152
5173
  class MemoryCredentialStore {
5153
5174
  accounts = new Map;
5154
5175
  list() {
@@ -5871,3 +5892,6 @@ export {
5871
5892
  mintWsToken,
5872
5893
  retryAfterMsFromClose
5873
5894
  };
5895
+
5896
+ //# debugId=8D56E4D2B9F2FAB164756E2164756E21
5897
+ //# sourceMappingURL=index.js.map