@spellkave/sdk 0.0.0-bootstrap → 0.0.0-stage

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 (144) hide show
  1. package/README.md +2 -155
  2. package/package.json +4 -63
  3. package/LICENSE +0 -89
  4. package/src/binding_rows.ts +0 -186
  5. package/src/connection.ts +0 -964
  6. package/src/core/actor.ts +0 -62
  7. package/src/core/actor_control.ts +0 -193
  8. package/src/core/actor_control_query_methods.ts +0 -101
  9. package/src/core/actor_control_reaction_methods.ts +0 -79
  10. package/src/core/actor_control_sense_methods.ts +0 -81
  11. package/src/core/actor_control_source.ts +0 -57
  12. package/src/core/actor_session_methods.ts +0 -226
  13. package/src/core/binding_drift.ts +0 -301
  14. package/src/core/credential.ts +0 -259
  15. package/src/core/driver_control.ts +0 -54
  16. package/src/core/effective_environment_state.ts +0 -71
  17. package/src/core/factored_manipulation_attempt.ts +0 -158
  18. package/src/core/ids.ts +0 -60
  19. package/src/core/interaction/canonical.ts +0 -15
  20. package/src/core/interaction/fingerprint.ts +0 -118
  21. package/src/core/interaction/index.ts +0 -31
  22. package/src/core/interaction/intent.ts +0 -284
  23. package/src/core/interaction/outcome.ts +0 -67
  24. package/src/core/interaction/rejection_ledger.ts +0 -108
  25. package/src/core/kernel_contract.generated.ts +0 -10
  26. package/src/core/log.ts +0 -23
  27. package/src/core/movement.ts +0 -111
  28. package/src/core/node-io.ts +0 -208
  29. package/src/core/paths.ts +0 -220
  30. package/src/core/profile.ts +0 -270
  31. package/src/core/profiles.ts +0 -9
  32. package/src/core/provenance_buffer.ts +0 -102
  33. package/src/core/readers/_helpers.ts +0 -273
  34. package/src/core/readers/action_description.ts +0 -17
  35. package/src/core/readers/action_economy_events.ts +0 -149
  36. package/src/core/readers/actor_body_swaps.ts +0 -62
  37. package/src/core/readers/actor_snapshot.ts +0 -197
  38. package/src/core/readers/actor_states.ts +0 -163
  39. package/src/core/readers/actors_and_bodies.ts +0 -179
  40. package/src/core/readers/affordance_cue.ts +0 -59
  41. package/src/core/readers/affordance_defaults.ts +0 -158
  42. package/src/core/readers/affordance_group_membership.ts +0 -67
  43. package/src/core/readers/affordance_input.ts +0 -129
  44. package/src/core/readers/affordance_reference.ts +0 -41
  45. package/src/core/readers/apply_consequences.ts +0 -54
  46. package/src/core/readers/audience_trace_presentation.ts +0 -62
  47. package/src/core/readers/bounded_collection.ts +0 -29
  48. package/src/core/readers/bundle_definitions.ts +0 -74
  49. package/src/core/readers/bundle_entities.ts +0 -62
  50. package/src/core/readers/co_location.ts +0 -71
  51. package/src/core/readers/combat_session.ts +0 -124
  52. package/src/core/readers/combat_session_active.ts +0 -44
  53. package/src/core/readers/combat_session_feedback.ts +0 -37
  54. package/src/core/readers/combat_session_grid.ts +0 -117
  55. package/src/core/readers/combat_session_roster.ts +0 -98
  56. package/src/core/readers/combat_session_types.ts +0 -51
  57. package/src/core/readers/condition_deltas.ts +0 -53
  58. package/src/core/readers/container_contents.ts +0 -92
  59. package/src/core/readers/dialogue_guide.ts +0 -99
  60. package/src/core/readers/dialogue_prompt_presentation.ts +0 -90
  61. package/src/core/readers/driver_control.ts +0 -64
  62. package/src/core/readers/entity_art.ts +0 -219
  63. package/src/core/readers/entity_containment.ts +0 -119
  64. package/src/core/readers/equipment.ts +0 -99
  65. package/src/core/readers/intervention_windows.ts +0 -136
  66. package/src/core/readers/inventory_query.ts +0 -145
  67. package/src/core/readers/item_detail.ts +0 -198
  68. package/src/core/readers/location_snapshot.ts +0 -216
  69. package/src/core/readers/manifest_apply_provenance.ts +0 -32
  70. package/src/core/readers/manifest_export.ts +0 -81
  71. package/src/core/readers/manipulation_context.ts +0 -475
  72. package/src/core/readers/map_layers.ts +0 -49
  73. package/src/core/readers/metadata_rows.ts +0 -56
  74. package/src/core/readers/object_state.ts +0 -124
  75. package/src/core/readers/observer_knowledge.ts +0 -41
  76. package/src/core/readers/observer_place_knowledge.ts +0 -37
  77. package/src/core/readers/observer_trace_knowledge.ts +0 -45
  78. package/src/core/readers/outcome_template.ts +0 -41
  79. package/src/core/readers/place_topology.ts +0 -109
  80. package/src/core/readers/reaction_options.ts +0 -156
  81. package/src/core/readers/resource_deltas.ts +0 -47
  82. package/src/core/readers/scene.ts +0 -275
  83. package/src/core/readers/seats.ts +0 -33
  84. package/src/core/readers/self.ts +0 -245
  85. package/src/core/readers/self_capabilities.ts +0 -159
  86. package/src/core/readers/self_economy.ts +0 -101
  87. package/src/core/readers/self_economy_budget.ts +0 -93
  88. package/src/core/readers/self_evaluations.ts +0 -128
  89. package/src/core/readers/self_identity.ts +0 -104
  90. package/src/core/readers/sense_context.ts +0 -112
  91. package/src/core/readers/session.ts +0 -207
  92. package/src/core/readers/session_detail.ts +0 -211
  93. package/src/core/readers/session_status.ts +0 -68
  94. package/src/core/readers/spatial_environment_state.ts +0 -74
  95. package/src/core/readers/spatial_niche_attachments.ts +0 -28
  96. package/src/core/readers/substrate_definitions.ts +0 -27
  97. package/src/core/readers/suggest_next_action.ts +0 -72
  98. package/src/core/readers/surface_membership.ts +0 -78
  99. package/src/core/readers/tag_reads.ts +0 -54
  100. package/src/core/readers/trace_query.ts +0 -120
  101. package/src/core/readers/trace_response.ts +0 -80
  102. package/src/core/readers/traces.ts +0 -124
  103. package/src/core/readers/travel_session.ts +0 -88
  104. package/src/core/readers/turn_state.ts +0 -34
  105. package/src/core/readers/world_events.ts +0 -43
  106. package/src/core/readers/world_status.ts +0 -63
  107. package/src/core/reducers/manipulation_args.ts +0 -239
  108. package/src/core/reducers/manipulation_receipt.ts +0 -66
  109. package/src/core/reducers/r_actor_wake_up.ts +0 -32
  110. package/src/core/reducers/r_inscribe_trace.ts +0 -109
  111. package/src/core/reducers/r_manipulate.ts +0 -163
  112. package/src/core/reducers/r_move.ts +0 -155
  113. package/src/core/reducers/r_react.ts +0 -143
  114. package/src/core/reducers/r_release_claim.ts +0 -81
  115. package/src/core/reducers/r_sense.ts +0 -84
  116. package/src/core/reducers/r_session_close.ts +0 -130
  117. package/src/core/reducers/r_session_move.ts +0 -116
  118. package/src/core/reducers/r_session_open.ts +0 -91
  119. package/src/core/reducers/session_lookup.ts +0 -64
  120. package/src/core/reducers/tick.ts +0 -65
  121. package/src/core/reducers/trace_lookup.ts +0 -29
  122. package/src/core/reducers/transport.ts +0 -84
  123. package/src/core/resolve.ts +0 -228
  124. package/src/core/shape_telemetry.ts +0 -146
  125. package/src/core/snapshot_rows.ts +0 -109
  126. package/src/core/tick_cadence.ts +0 -61
  127. package/src/core/types.ts +0 -501
  128. package/src/core/watch_provenance.ts +0 -113
  129. package/src/core/world-contract/classify.ts +0 -38
  130. package/src/core/world-contract/index.ts +0 -12
  131. package/src/core/world-contract/normalise.ts +0 -574
  132. package/src/core/world-contract/runtime.ts +0 -144
  133. package/src/core/world-contract/served.ts +0 -173
  134. package/src/core/world-contract/strict-reducers.ts +0 -14
  135. package/src/core/world-contract/typetext.ts +0 -94
  136. package/src/core/world_time.ts +0 -22
  137. package/src/index.ts +0 -262
  138. package/src/manifest-apply.ts +0 -497
  139. package/src/provenance.ts +0 -568
  140. package/src/reader-manifest.ts +0 -338
  141. package/src/readers.ts +0 -392
  142. package/src/replay.ts +0 -515
  143. package/src/watch-buffer.ts +0 -438
  144. package/src/world-events/builder.ts +0 -1042
@@ -1,10 +0,0 @@
1
- // GENERATED by packages/spellkave-sdk/scripts/generate-kernel-contract.ts from
2
- // @spellkave/bindings/{world.schema.json,epoch.json}. Do not edit:
3
- // regenerate with `pnpm --filter @spellkave/sdk run generate:kernel-contract`.
4
- import type { SchemaSnapshot } from "./world-contract/index.ts";
5
-
6
- /** The world contract epoch this client was built for. */
7
- export const KERNEL_CONTRACT_EPOCH = 2;
8
-
9
- /** The world schema items this SDK uses, as built. */
10
- export const KERNEL_CONTRACT: SchemaSnapshot = {"tables":{"action_definition":{"access":"public","kind":"user","event":false,"columns":["action_id: String","bundle_id: String","required_capability: String","on_success: String","on_failure: String","resolution_mode: ActionResolutionMode","resolution_predicate_source: String","resolution_reads_target: Bool","resolution_scope: String","non_steering: Bool","display_name: String","cost_time_ms: U64","session_def_id: String","resumable: Bool","reaction_eligibility: String","reaction_window_ms: U64","reaction_trigger: String","self_eligible: Bool","self_only: Bool","spends_channel: String","description: String = 0x00000000"],"primaryKey":["action_id"],"unique":["action_id"],"indexes":{"action_definition_action_id_idx_btree":"action_id: btree(action_id)","action_definition_bundle_id_idx_btree":"bundle_id: btree(bundle_id)"},"autoInc":[]},"action_definition_tag":{"access":"public","kind":"user","event":false,"columns":["key: String","action_id: String","tag: String","bundle_id: String","source: String","set_at_tick: U64"],"primaryKey":["key"],"unique":["key"],"indexes":{"action_definition_tag_action_id_idx_btree":"action_id: btree(action_id)","action_definition_tag_bundle_id_idx_btree":"bundle_id: btree(bundle_id)","action_definition_tag_key_idx_btree":"key: btree(key)","action_definition_tag_source_idx_btree":"source: btree(source)","action_definition_tag_tag_idx_btree":"tag: btree(tag)"},"autoInc":[]},"actor":{"access":"public","kind":"user","event":false,"columns":["actor_id: U64","name: String","current_body: U64","created_at_tick: U64","description: String"],"primaryKey":["actor_id"],"unique":["actor_id"],"indexes":{"actor_actor_id_idx_btree":"actor_id: btree(actor_id)","actor_current_body_idx_btree":"current_body: btree(current_body)"},"autoInc":["actor_id"]},"affordance_template":{"access":"public","kind":"user","event":false,"columns":["template_id: String","bundle_id: String","niche_id: String","capability_id: String","display_name: String","predicate: DslExpression","predicate_source: String","outcome_template_id: String","range_m: F32","locality_class: LocalityClass","spends_channel: String","recharges_on: String","composes: Array<String>","predicate_state_inputs: Array<String>","predicate_condition_inputs: Array<String>","reads_occupancy: Bool","description: String","movement_cost_expression_source: String"],"primaryKey":["template_id"],"unique":["template_id"],"indexes":{"affordance_template_bundle_id_idx_btree":"bundle_id: btree(bundle_id)","affordance_template_capability_id_idx_btree":"capability_id: btree(capability_id)","affordance_template_locality_class_idx_btree":"locality_class: btree(locality_class)","affordance_template_niche_id_idx_btree":"niche_id: btree(niche_id)","affordance_template_template_id_idx_btree":"template_id: btree(template_id)"},"autoInc":[]},"capability_definition":{"access":"public","kind":"user","event":false,"columns":["capability_id: String","bundle_id: String","actor_kind: String","display_name: String","description: String","default_visibility: VisibilityClass"],"primaryKey":["capability_id"],"unique":["capability_id"],"indexes":{"capability_definition_actor_kind_idx_btree":"actor_kind: btree(actor_kind)","capability_definition_bundle_id_idx_btree":"bundle_id: btree(bundle_id)","capability_definition_capability_id_idx_btree":"capability_id: btree(capability_id)"},"autoInc":[]},"config":{"access":"public","kind":"user","event":false,"columns":["version: I32","world_name: String","operator_identity: Identity","event_retention_limit: U32","tick_interval_secs: U64","fiction_ms_per_tick: U64","interrupted_action_credit_decay_ticks: U64","condition_hook_retention_ticks: U64","world_instance_id: String = 0x00000000","min_tick_interval_secs: U64 = 0x0500000000000000","max_tick_interval_secs: U64 = 0x8051010000000000","autonomy_lane_index_ready: Bool = 0x00","applyset_ownership_index_ready: Bool = 0x00","max_seats_per_identity: U32 = 0x03000000","world_slug: String = 0x00000000"],"primaryKey":["version"],"unique":["version"],"indexes":{"config_version_idx_btree":"version: btree(version)"},"autoInc":[]},"entity":{"access":"public","kind":"user","event":false,"columns":["entity_id: U64","entity_def_id: String","name: String","kind: String","created_at_tick: U64","quantity: U64","owned_by_entity_id: U64"],"primaryKey":["entity_id"],"unique":["entity_id"],"indexes":{"entity_entity_def_id_idx_btree":"entity_def_id: btree(entity_def_id)","entity_entity_id_idx_btree":"entity_id: btree(entity_id)","entity_owned_by_entity_id_idx_btree":"owned_by_entity_id: btree(owned_by_entity_id)"},"autoInc":["entity_id"]},"entity_definition_tag":{"access":"public","kind":"user","event":false,"columns":["key: String","entity_def_id: String","tag: String","bundle_id: String","source: String","set_at_tick: U64"],"primaryKey":["key"],"unique":["key"],"indexes":{"entity_definition_tag_bundle_id_idx_btree":"bundle_id: btree(bundle_id)","entity_definition_tag_entity_def_id_idx_btree":"entity_def_id: btree(entity_def_id)","entity_definition_tag_key_idx_btree":"key: btree(key)","entity_definition_tag_source_idx_btree":"source: btree(source)","entity_definition_tag_tag_idx_btree":"tag: btree(tag)"},"autoInc":[]},"entity_description":{"access":"public","kind":"user","event":false,"columns":["entity_id: U64","description: String"],"primaryKey":["entity_id"],"unique":["entity_id"],"indexes":{"entity_description_entity_id_idx_btree":"entity_id: btree(entity_id)"},"autoInc":[]},"equipment_slot_definition":{"access":"public","kind":"user","event":false,"columns":["slot_id: String","bundle_id: String","label: String","default_compatibility_predicate: String"],"primaryKey":["slot_id"],"unique":["slot_id"],"indexes":{"equipment_slot_definition_bundle_id_idx_btree":"bundle_id: btree(bundle_id)","equipment_slot_definition_slot_id_idx_btree":"slot_id: btree(slot_id)"},"autoInc":[]},"event_action_recharge_fired":{"access":"public","kind":"user","event":false,"columns":["event_id: U64","actor: U64","affordance: String","boundary: String"],"primaryKey":["event_id"],"unique":["event_id"],"indexes":{"event_action_recharge_fired_event_id_idx_btree":"event_id: btree(event_id)"},"autoInc":[]},"event_boundary_fired":{"access":"public","kind":"user","event":false,"columns":["event_id: U64","boundary: String","owner: U64","source: String","window: U64"],"primaryKey":["event_id"],"unique":["event_id"],"indexes":{"event_boundary_fired_event_id_idx_btree":"event_id: btree(event_id)"},"autoInc":[]},"event_channel_spend":{"access":"public","kind":"user","event":false,"columns":["event_id: U64","actor: U64","channel: String","cost_ms: U64","remaining_ms: U64","window: U64"],"primaryKey":["event_id"],"unique":["event_id"],"indexes":{"event_channel_spend_event_id_idx_btree":"event_id: btree(event_id)"},"autoInc":[]},"event_channel_window_refresh":{"access":"public","kind":"user","event":false,"columns":["event_id: U64","actor: U64","boundary: String","window: U64"],"primaryKey":["event_id"],"unique":["event_id"],"indexes":{"event_channel_window_refresh_event_id_idx_btree":"event_id: btree(event_id)"},"autoInc":[]},"niche_definition":{"access":"public","kind":"user","event":false,"columns":["niche_id: String","bundle_id: String","display_name: String","description: String","predicate: DslExpression","predicate_source: String","provider: String"],"primaryKey":["niche_id"],"unique":["niche_id"],"indexes":{"niche_definition_bundle_id_idx_btree":"bundle_id: btree(bundle_id)","niche_definition_niche_id_idx_btree":"niche_id: btree(niche_id)"},"autoInc":[]},"niche_provider_definition":{"access":"public","kind":"user","event":false,"columns":["provider_id: String","requires_spatial_attachment: Bool","admits_targets_without_membership: Bool","bundle_id: String","description: String"],"primaryKey":["provider_id"],"unique":["provider_id"],"indexes":{"niche_provider_definition_bundle_id_idx_btree":"bundle_id: btree(bundle_id)","niche_provider_definition_provider_id_idx_btree":"provider_id: btree(provider_id)"},"autoInc":[]},"outcome_template":{"access":"public","kind":"user","event":false,"columns":["outcome_template_id: String","bundle_id: String","display_name: String","outcome_expression: DslExpression","outcome_expression_source: String","manipulation_action_id: String","communication_speech_act_id: String","movement_descriptor: String","sense_query_kind: String","sense_visibility: VisibilityClass","consequence_template_id: String","discovery_validated: Bool","description: String"],"primaryKey":["outcome_template_id"],"unique":["outcome_template_id"],"indexes":{"outcome_template_bundle_id_idx_btree":"bundle_id: btree(bundle_id)","outcome_template_outcome_template_id_idx_btree":"outcome_template_id: btree(outcome_template_id)"},"autoInc":[]},"reservation":{"access":"public","kind":"user","event":false,"columns":["reservation_id: U64","holder_session: U64","resource_kind: String","resource_args_hash: String","resource_ref: String","amount: U64","expires_at: Option<U64>","bundle_id: String"],"primaryKey":["reservation_id"],"unique":["reservation_id"],"indexes":{"reservation_bundle_id_idx_btree":"bundle_id: btree(bundle_id)","reservation_holder_session_idx_btree":"holder_session: btree(holder_session)","reservation_reservation_id_idx_btree":"reservation_id: btree(reservation_id)","reservation_resource_kind_idx_btree":"resource_kind: btree(resource_kind)"},"autoInc":["reservation_id"]},"resource_definition":{"access":"public","kind":"user","event":false,"columns":["resource_definition_id: String","bundle_id: String","display_name: String","value_kind: String","min_value: I64","max_value: I64","recovery_rule: String","initial_value: Option<I64>","description: String"],"primaryKey":["resource_definition_id"],"unique":["resource_definition_id"],"indexes":{"resource_definition_bundle_id_idx_btree":"bundle_id: btree(bundle_id)","resource_definition_resource_definition_id_idx_btree":"resource_definition_id: btree(resource_definition_id)"},"autoInc":[]},"resource_definition_tag":{"access":"public","kind":"user","event":false,"columns":["key: String","resource_definition_id: String","tag: String","bundle_id: String","source: String","set_at_tick: U64"],"primaryKey":["key"],"unique":["key"],"indexes":{"resource_definition_tag_bundle_id_idx_btree":"bundle_id: btree(bundle_id)","resource_definition_tag_key_idx_btree":"key: btree(key)","resource_definition_tag_resource_definition_id_idx_btree":"resource_definition_id: btree(resource_definition_id)","resource_definition_tag_source_idx_btree":"source: btree(source)","resource_definition_tag_tag_idx_btree":"tag: btree(tag)"},"autoInc":[]},"seat":{"access":"public","kind":"user","event":false,"columns":["actor_id: U64","entity_id: U64","name: String","embodied: Bool","claimed: Bool"],"primaryKey":["actor_id"],"unique":["actor_id"],"indexes":{"seat_actor_id_idx_btree":"actor_id: btree(actor_id)"},"autoInc":[]},"session_definition":{"access":"public","kind":"user","event":false,"columns":["session_def_id: String","bundle_id: String","participants_pred: String","busy_allow_pred: String","busy_break_pred: String","initial_state: String","legal_moves_csv: String","turn_rule: String","visibility_policy: String","termination_pred: String","on_terminate: String","stakes_required: String","winner_predicate: String","turn_scheduler_id: String","round_duration_ms: U64","auto_join_on_targeting: Bool","combat_grid_blueprint_id: String","grid_edge_affordance_template_id: String","grid_edge_affordance_bindings_json: String"],"primaryKey":["session_def_id"],"unique":["session_def_id"],"indexes":{"session_definition_bundle_id_idx_btree":"bundle_id: btree(bundle_id)","session_definition_session_def_id_idx_btree":"session_def_id: btree(session_def_id)"},"autoInc":[]},"substrate_definition":{"access":"public","kind":"user","event":false,"columns":["substrate_id: String","bundle_id: String","coordinate_kind_id: String","description: String"],"primaryKey":["substrate_id"],"unique":["substrate_id"],"indexes":{"substrate_definition_bundle_id_idx_btree":"bundle_id: btree(bundle_id)","substrate_definition_substrate_id_idx_btree":"substrate_id: btree(substrate_id)"},"autoInc":[]},"tag_capability_grant":{"access":"public","kind":"user","event":false,"columns":["key: String","tag: String","capability_id: String","bundle_id: String"],"primaryKey":["key"],"unique":["key"],"indexes":{"tag_capability_grant_bundle_id_idx_btree":"bundle_id: btree(bundle_id)","tag_capability_grant_capability_id_idx_btree":"capability_id: btree(capability_id)","tag_capability_grant_key_idx_btree":"key: btree(key)","tag_capability_grant_tag_idx_btree":"tag: btree(tag)"},"autoInc":[]},"tag_value_definition":{"access":"public","kind":"user","event":false,"columns":["tag: String","prefix: String","bundle_id: String","description: String"],"primaryKey":["tag"],"unique":["tag"],"indexes":{"tag_value_definition_bundle_id_idx_btree":"bundle_id: btree(bundle_id)","tag_value_definition_prefix_idx_btree":"prefix: btree(prefix)","tag_value_definition_tag_idx_btree":"tag: btree(tag)"},"autoInc":[]},"world_time":{"access":"public","kind":"user","event":false,"columns":["id: I32","tick: U64","last_tick_at: Timestamp"],"primaryKey":["id"],"unique":["id"],"indexes":{"world_time_id_idx_btree":"id: btree(id)"},"autoInc":[]}},"views":{"directly_controlled_actor_spatial_location":{"public":true,"anonymous":false,"params":[],"returns":"Array","columns":["entity_id: U64","place_node_id: String","updated_at_tick: U64","bundle_id: String","selection_path: String"]},"owned_object_state":{"public":true,"anonymous":false,"params":[],"returns":"Array","columns":["key: String","target_kind: String","target_id: String","state_id: String","value: DslValue","source_template_id: String","set_at_tick: U64","expires_at_tick: U64","owner_body_entity_id: U64","visibility: VisibilityClass","bundle_id: String"]},"public_metadata_attachment":{"public":true,"anonymous":true,"params":[],"returns":"Array","columns":["key: String","target_kind: String","target_ref: String","namespace: String","payload_json: String","audience: String","bundle_id: String","source: String","set_at_tick: U64","on_demand: Bool"]},"visible_actor_control_transition":{"public":true,"anonymous":false,"params":[],"returns":"Array","columns":["id: U64","actor_id: U64","generation: U64","transition: String","requested_by: Identity","request_id: String","reason: String","at_micros: I64"]},"visible_actor_driver_control":{"public":true,"anonymous":false,"params":[],"returns":"Array","columns":["actor_id: U64","body_entity_id: U64","world_instance_id: String","generation: U64","held: Bool","holder: Option<Identity>","tombstone: Bool","last_request_id: Option<String>","last_transition: Option<String>"]},"visible_actor_identity":{"public":true,"anonymous":false,"params":[],"returns":"Array","columns":["key: String","actor_id: U64","identity: Identity","role: String","bound_at_tick: U64","connection_id: Option<ConnectionId>","provenance: IdentityProvenance","assigned_by: Option<U64>"]},"visible_actor_spatial_location":{"public":true,"anonymous":false,"params":[],"returns":"Array","columns":["entity_id: U64","place_node_id: String","updated_at_tick: U64","bundle_id: String","selection_path: String"]},"visible_capability":{"public":true,"anonymous":false,"params":[],"returns":"Array","columns":["key: String","entity_id: U64","capability_id: String","source: String","source_args_hash: String","granted_at_tick: U64","expires_at_tick: Option<U64>","bundle_id: String","visibility: VisibilityClass","extent_ref: String","extent_kind_ref: String","elevation_class: VisibilityClass"]},"visible_condition_boundary_expiry":{"public":true,"anonymous":false,"params":[],"returns":"Array","columns":["target_condition_row_id: U64","owner_actor: U64","boundary_id: String","armed_at_window_ms: U64","out_of_session_due_tick: U64"]},"visible_control_continuation":{"public":true,"anonymous":false,"params":[],"returns":"Array","columns":["work_ref: String","body_entity_id: U64","driver_originated: Bool","generation: Option<U64>","refusal: Option<String>"]},"visible_control_continuation_refusal":{"public":true,"anonymous":false,"params":[],"returns":"Array","columns":["work_ref: String","reason: String","at_micros: I64","attempts: U64","classification_reason: Option<String>"]},"visible_economy_channel_budget":{"public":true,"anonymous":false,"params":[],"returns":"Array","columns":["actor_id: U64","channel_id: String","pool_ms_per_round: U64","resets_on: String","off_turn_eligible: Bool","current_window_start_ms: U64","spent_ms: U64","grant_ms: I64","effective_pool_ms: U64","remaining_ms: U64","remaining_disclosed: Bool","status: String"]},"visible_economy_channel_spend":{"public":true,"anonymous":false,"params":[],"returns":"Array","columns":["row_id: U64","actor_id: U64","channel_id: String","spent_ms: U64","window_start_ms: U64"]},"visible_entity_containment":{"public":true,"anonymous":false,"params":[],"returns":"Array","columns":["entity_id: U64","container_id: U64","slot_id: String","direction: String","inserted_at_tick: U64"]},"visible_entity_equipment_slot":{"public":true,"anonymous":false,"params":[],"returns":"Array","columns":["key: String","entity_id: U64","slot_id: String","equipped_entity_id: U64","equipped_at_tick: U64"]},"visible_entity_tag":{"public":true,"anonymous":false,"params":[],"returns":"Array","columns":["key: String","entity_id: U64","tag: String","bundle_id: String","source: String","set_at_tick: U64"]},"visible_entity_tag_coverage":{"public":true,"anonymous":false,"params":[],"returns":"Array","columns":["status: String","projection_version: U32"]},"visible_evaluation_provenance":{"public":true,"anonymous":false,"params":[],"returns":"Array","columns":["provenance_id: String","kind: EvaluationProvenanceKind","status: EvaluationProvenanceStatus","subject_id: String","acting_identity: Identity","owner_body_entity_id: U64","visibility: VisibilityClass","selected_template_ids: Array<String>","expression_ids: Array<String>","stochastic_draws: Array<EvaluationStochasticDraw>","outcome_graph_ids: Array<String>","terminal_event_ids: Array<U64>","failure_kind: String","failure_detail: String","created_at_tick: U64","bundle_id: String"]},"visible_event_actor_body_swapped":{"public":true,"anonymous":false,"params":[],"returns":"Array","columns":["event_id: U64","actor_id: U64","previous_body_entity_id: U64","new_body_entity_id: U64","consequence_template_id: String"]},"visible_event_apply_consequence":{"public":true,"anonymous":false,"params":[],"returns":"Array","columns":["event_id: U64","template_id: String","target_entity_id: Option<U64>","target_entity_ref: String","source_entity_ref: String","outcome: ApplyOutcome","frame_writes_count: U32","traces_inscribed_count: U32","modifiers_composed_count: U32","lane_binding_id: Option<String>","lane_capability_id: Option<String>"]},"visible_event_condition_delta":{"public":true,"anonymous":false,"params":[],"returns":"Array","columns":["event_id: U64","entity_id: U64","condition_definition_id: String","applied: Bool","source_entity_ref: String","template_id: String","expires_at_tick: U64"]},"visible_event_resource_delta":{"public":true,"anonymous":false,"params":[],"returns":"Array","columns":["event_id: U64","entity_id: U64","resource_id: String","delta: I64","new_value: Option<I64>","template_id: String","source_entity_ref: String"]},"visible_event_steering":{"public":true,"anonymous":false,"params":[],"returns":"Array","columns":["event_id: U64","body_entity_id: U64","steered_by_actor_id: Option<U64>"]},"visible_manifest_authored_entity":{"public":true,"anonymous":false,"params":[],"returns":"Array","columns":["manifest_key: String","bundle_id: String","entity_id: U64"]},"visible_manifest_authored_entity_coverage":{"public":true,"anonymous":false,"params":[],"returns":"Array","columns":["status: String","projection_version: U32"]},"visible_manipulation_available_action":{"public":true,"anonymous":false,"params":[],"returns":"Array","columns":["action_fact_id: String","perceiver_entity_id: U64","action_id: String","niche_ids: Array<String>","template_ids: Array<String>"]},"visible_manipulation_context":{"public":true,"anonymous":false,"params":[],"returns":"Array","columns":["perceiver_entity_id: U64","schema_version: U32","revision: U64","ready: Bool"]},"visible_manipulation_observed_target":{"public":true,"anonymous":false,"params":[],"returns":"Array","columns":["target_fact_id: String","perceiver_entity_id: U64","target_ref: TargetRef","niche_ids: Array<String>"]},"visible_manipulation_participant_binding":{"public":true,"anonymous":false,"params":[],"returns":"Array","columns":["row_id: U64","context_id: U64","role_id: String","entity_id: U64"]},"visible_manipulation_participant_context":{"public":true,"anonymous":false,"params":[],"returns":"Array","columns":["context_id: U64","perceiver_entity_id: U64","action_id: String","binding_count: U32"]},"visible_manipulation_prompt":{"public":true,"anonymous":false,"params":[],"returns":"Array","columns":["prompt_fact_id: String","perceiver_entity_id: U64","occurrence_id: U64","prompt_def_id: String","contract_version: U32","source_ref: String","response_action_ids: Array<String>","opened_at_tick: U64","consumed: Bool","audience_trace_id: U64"]},"visible_map_layer":{"public":true,"anonymous":false,"params":[],"returns":"Array","columns":["map_layer_id: String","bundle_id: String","place_graph_id: String","display_name: String","asset_module: String","asset_path: String","source_kind: String","state: String","posture: String","image_width_px: U32","image_height_px: U32","grid_size_px: U32","grid_distance_m: F32","local_width_cells: F32","local_height_cells: F32","image_origin_x: F32","image_origin_y: F32","rotation_deg: F32","min_zoom: F32","max_zoom: F32"]},"visible_metadata_attachment":{"public":true,"anonymous":false,"params":[],"returns":"Array","columns":["key: String","target_kind: String","target_ref: String","namespace: String","payload_json: String","audience: String","bundle_id: String","source: String","set_at_tick: U64","on_demand: Bool"]},"visible_object_state":{"public":true,"anonymous":false,"params":[],"returns":"Array","columns":["key: String","target_kind: String","target_id: String","state_id: String","value: DslValue","source_template_id: String","set_at_tick: U64","expires_at_tick: U64","owner_body_entity_id: U64","visibility: VisibilityClass","bundle_id: String"]},"visible_observer_knowledge":{"public":true,"anonymous":false,"params":[],"returns":"Array","columns":["knowledge_id: U64","observer_entity_id: U64","known_entity_id: U64","learned_at_tick: U64"]},"visible_observer_place_knowledge":{"public":true,"anonymous":false,"params":[],"returns":"Array","columns":["knowledge_id: U64","observer_entity_id: U64","known_node_id: String","learned_at_tick: U64"]},"visible_observer_trace_knowledge":{"public":true,"anonymous":false,"params":[],"returns":"Array","columns":["knowledge_id: U64","observer_entity_id: U64","known_trace_id: U64","content: String","learned_at_tick: U64"]},"visible_pending_resolution":{"public":true,"anonymous":false,"params":[],"returns":"Array","columns":["pending_id: U64","originating_action_id: String","originating_actor: String","target_actor: String","computed_outcome_template: String","session_id: U64","window_opens_at_micros: U64","window_closes_at_micros: U64","depth: U64","bundle_id: String","act_place_node_id: Option<String>","lane: Option<FrameLane>"]},"visible_pending_resolution_reactor":{"public":true,"anonymous":false,"params":[],"returns":"Array","columns":["row_id: U64","pending_id: U64","entity_ref: String","reacted: Bool","selected_draw_index: Option<U32>","windowed_at: U64","bundle_id: String"]},"visible_pending_stochastic_resolution":{"public":true,"anonymous":false,"params":[],"returns":"Array","columns":["pending_id: U64","draws: Array<EvaluationStochasticDraw>","predicate_source: String","roll_bias_json: String","frozen_facts_json: String","commit_tail_json: String","original_provenance_id: String","bundle_id: String"]},"visible_place_edge":{"public":true,"anonymous":false,"params":[],"returns":"Array","columns":["edge_id: U64","edge_key: String","bundle_id: String","place_graph_id: String","from_node_id: String","to_node_id: String","pose_dt_elevation: F32","pose_dt_elevation_present: Bool","substrate_crossing: Bool","cell_anchor: U64","cell_anchor_u: F32","cell_anchor_v: F32","cell_anchor_present: Bool","from_anchor_side: String","from_anchor_offset: F32","to_anchor_side: String","to_anchor_offset: F32","description: String","inherit_movement_default: Bool"]},"visible_place_graph_definition":{"public":true,"anonymous":false,"params":[],"returns":"Array","columns":["place_graph_id: String","bundle_id: String","substrate_id: String","display_name: String","origin_cell_res10: U64","origin_cell_res7: U64","origin_cell_res4: U64","description: String","bearing: F32","metres_per_unit: F32","blueprint_id: String","parent_graph_id: String","anchor_node_id: String","is_ephemeral_instance: Bool","distance_metric_id: Option<String>"]},"visible_place_node":{"public":true,"anonymous":false,"params":[],"returns":"Array","columns":["node_id: String","bundle_id: String","place_graph_id: String","local_id: String","substrate_id: String","display_name: String","description: String","cell_res10: U64","cell_res7: U64","cell_res4: U64","pose_elevation: F32","pose_elevation_present: Bool","pos_x: I32","pos_y: I32","pos_present: Bool","extent_shape_id: String","extent_params_json: String","is_ephemeral: Bool"]},"visible_prompt_occurrence":{"public":true,"anonymous":false,"params":[],"returns":"Array","columns":["occurrence_id: U64","prompt_def_id: String","contract_version: U32","response_action_ids: Array<String>","source_entity_id: U64","addressee_entity_id: U64","opened_at_tick: U64","opening_provenance_id: String","closed_at_tick: Option<U64>","audience_trace_id: U64"]},"visible_session":{"public":true,"anonymous":false,"params":[],"returns":"Array","columns":["session_id: U64","session_def_id: String","lifecycle: String","current_actor: String","state_json: String","opened_by: String","opened_at: U64","last_advanced_at: U64","promoted_duration_ticks: U64","originating_action: String","originating_target: TargetRef","bundle_id: String"]},"visible_session_participant":{"public":true,"anonymous":false,"params":[],"returns":"Array","columns":["row_id: U64","session_id: U64","actor_id: String","ordinal: U32","joined_at: U64","pre_session_place_node_id: String","bundle_id: String"]},"visible_spatial_environment_state":{"public":true,"anonymous":false,"params":[],"returns":"Array","columns":["state_row_id: U64","bundle_id: String","target_ref: DslSpatialReference","target_kind: String","state_id: String","value: DslValue","visibility: VisibilityClass","updated_tick: U64","place_node_id: String","place_edge_id: U64","location_def_id: String","cell_res10: U64","cell_res7: U64","cell_res4: U64","substrate_id: String","place_edge_key: String"]},"visible_spatial_niche_attachment":{"public":true,"anonymous":false,"params":[],"returns":"Array","columns":["attachment_id: U64","bundle_id: String","target_ref: DslSpatialReference","target_kind: String","niche_id: String","visibility: VisibilityClass","condition: DslExpression","ecological_invariant: Bool","on_entry_action_id: String","on_entry_target_entity_id: U64","place_node_id: String","place_edge_id: U64","location_def_id: String","cell_res10: U64","cell_res7: U64","cell_res4: U64","substrate_id: String"]},"visible_target_condition":{"public":true,"anonymous":false,"params":[],"returns":"Array","columns":["row_id: U64","target_kind: TargetKind","target_id: U64","condition_definition_id: String","source_id: String","target_body_entity_id: U64","source_body_entity_id: U64","visibility: VisibilityClass","parent_row_id: Option<U64>","applied_at_tick: U64","expires_at_tick: U64","stack_count: U32","bundle_id: String"]},"visible_trace":{"public":true,"anonymous":false,"params":[],"returns":"Array","columns":["trace_id: U64","kind: String","location_kind: String","location_ref: String","payload_json: String","inscribed_at: U64","expires_at: Option<U64>","inscribed_by: String","visibility: VisibilityClass","bundle_id: String","event_id: U64"]},"visible_turn_state":{"public":true,"anonymous":false,"params":[],"returns":"Array","columns":["id: I32","turn: U64","current_actor: U64","active_scheduler_id: String","scope_session_id: U64"]},"visible_world_event":{"public":true,"anonymous":false,"params":[],"returns":"Array","columns":["id: U64","tick: U64","timestamp: Timestamp","kind: EventKind","summary: Option<String>","notable: Bool","request_id: Option<String>"]}},"reducers":{"r_manipulate":{"visibility":"client","params":["actor_id: U64","target_ref: TargetRef","action_id: String","args: ManipulationArgs","driver_token: Option<DriverToken>"],"ok":"()","err":"String"},"r_move":{"visibility":"client","params":["actor_id: U64","from_node: String","to_node: String","edge_id: String","driver_token: Option<DriverToken>"],"ok":"()","err":"String"},"r_sense":{"visibility":"client","params":["actor_id: U64","query_kind: String","visibility_class: String","driver_token: Option<DriverToken>"],"ok":"()","err":"String"},"r_session_close":{"visibility":"client","params":["session_id: U64","outcome: String","driver_token: Option<DriverToken>","driver_tokens: Option<Array<DriverToken>>"],"ok":"()","err":"String"},"r_session_move":{"visibility":"client","params":["session_id: U64","move_template_id: String","driver_token: Option<DriverToken>"],"ok":"()","err":"String"},"r_session_open":{"visibility":"client","params":["session_def_id: String","participants: Array<U64>","grid_extent_json: String","driver_tokens: Array<DriverToken>"],"ok":"()","err":"String"}},"procedures":{},"lifecycle":{},"types":{"ActionResolutionMode":{"sum":["Deterministic: ()","Stochastic: ()","Deferred: ()"]},"ApplyOutcome":{"sum":["Applied: ()","Cancelled: ()","Suspended: ()","Deferred: ()","PartiallyApplied: ()"]},"DriverToken":{"product":["world_instance_id: String","generation: U64","actor_id: U64","body_entity_id: U64"]},"DslApplyStatus":{"product":["subject: DslSubjectRef","condition_definition_id: String"]},"DslArbitrate":{"product":["request_shape_id: String","context_nodes: Array<U32>","allowed_outcome_nodes: Array<U32>"]},"DslArithmetic":{"product":["op: DslArithmeticOp","left: U32","right: U32"]},"DslArithmeticOp":{"sum":["Add: ()","Sub: ()","Mul: ()","Div: ()","Max: ()","Min: ()"]},"DslBindingRef":{"product":["name: String"]},"DslBoolLiteral":{"product":["value: Bool"]},"DslChannelPool":{"product":["channel_id: String"]},"DslCompare":{"product":["op: DslCompareOp","left: U32","right: U32"]},"DslCompareOp":{"sum":["Eq: ()","Ne: ()","Lt: ()","Lte: ()","Gt: ()","Gte: ()"]},"DslCond":{"product":["cond: U32","then_node: U32","else_node: U32"]},"DslDice":{"product":["count: U32","sides: U32"]},"DslEmitTrace":{"product":["subject: DslSubjectRef","trace_kind_id: String"]},"DslEventRef":{"sum":["Kind: ()","Detail: String"]},"DslExpression":{"product":["kind: DslExpressionKind","root_node_id: U32","nodes: Array<DslNode>"]},"DslExpressionKind":{"sum":["Predicate: ()","Outcome: ()"]},"DslH3CellRef":{"product":["cell: U64"]},"DslHasCapability":{"product":["subject: DslSubjectRef","capability_id: String"]},"DslHasItem":{"product":["subject: DslSubjectRef","item_def_id: String"]},"DslHasNiche":{"product":["subject: DslSubjectRef","niche_id: String"]},"DslHasStatus":{"product":["subject: DslSubjectRef","condition_definition_id: String"]},"DslHasTag":{"product":["subject: DslSubjectRef","tag: String"]},"DslImpliedByCount":{"product":["condition_definition_id: Option<String>"]},"DslIntLiteral":{"product":["value: I64"]},"DslInvokeOutcomeGraph":{"product":["outcome_graph_id: String"]},"DslKnowsEntity":{"product":["subject: DslSubjectRef","entity_id: String"]},"DslLet":{"product":["name: String","value: U32","body: U32"]},"DslLocationDefinitionRef":{"product":["location_def_id: String"]},"DslModifyResource":{"product":["subject: DslSubjectRef","resource_definition_id: String","delta_node: U32"]},"DslNode":{"product":["node_id: U32","value_type: DslValueType","op: DslOp"]},"DslOccupantsAt":{"product":["scope: String","excluding_condition_definition_id: Option<String>"]},"DslOp":{"sum":["BoolLiteral: DslBoolLiteral","IntLiteral: DslIntLiteral","TextLiteral: DslTextLiteral","ReadInt: DslReadField","ReadEffectiveInt: DslReadField","ReadText: DslReadField","ReadBool: DslReadField","ReadResourceMax: DslReadField","ReadResourceMin: DslReadField","HasCapability: DslHasCapability","HasItem: DslHasItem","HasNiche: DslHasNiche","HasTag: DslHasTag","SharesTag: DslSharesTag","HasStatus: DslHasStatus","ImpliedByCount: DslImpliedByCount","ParticipantTagGroupCount: DslParticipantTagGroupCount","PeersNearTarget: DslPeersNearTarget","OccupantsAt: DslOccupantsAt","ChannelPool: DslChannelPool","TracePresent: DslTracePresent","KnowsEntity: DslKnowsEntity","And: DslOperands","Or: DslOperands","Not: DslUnaryNode","Compare: DslCompare","Arithmetic: DslArithmetic","Cond: DslCond","Roll: DslRoll","RollUnder: DslRollUnder","RollTable: DslRollTable","DslSource: DslSource","Let: DslLet","OutcomeSequence: DslOutcomeSequence","InvokeOutcomeGraph: DslInvokeOutcomeGraph","ModifyResource: DslModifyResource","ApplyStatus: DslApplyStatus","EmitTrace: DslEmitTrace","Arbitrate: DslArbitrate"]},"DslOperands":{"product":["operands: Array<U32>"]},"DslOutcomeSequence":{"product":["steps: Array<U32>"]},"DslParticipantTagGroupCount":{"product":["prefix: String","excluding_condition_definition_id: Option<String>"]},"DslPeersNearTarget":{"product":["prefix: String","radius_mm: I64","excluding_condition_definition_id: Option<String>"]},"DslPlaceEdgeRef":{"product":["edge_id: U64"]},"DslPlaceNodeRef":{"product":["node_id: String"]},"DslReadField":{"product":["subject: DslSubjectRef","field_id: String"]},"DslRoll":{"product":["dice: DslDice"]},"DslRollTable":{"product":["table_id_node: U32","draw_node: U32"]},"DslRollUnder":{"product":["roll_node: U32","target_node: U32"]},"DslSharesTag":{"product":["subject_a: DslSubjectRef","subject_b: DslSubjectRef","prefix: String"]},"DslSource":{"product":["subject: DslSubjectRef","slot_node: U32"]},"DslSpatialReference":{"sum":["PlaceNode: DslPlaceNodeRef","PlaceEdge: DslPlaceEdgeRef","LocationDefinition: DslLocationDefinitionRef","H3Cell: DslH3CellRef","Tile: DslTileRef"]},"DslSubjectRef":{"sum":["Actor: ()","ActorWieldedItem: ()","Target: ()","Location: ()","Session: ()","World: ()","Binding: DslBindingRef","Event: DslEventRef","ActorEquippedItem: String"]},"DslTextLiteral":{"product":["value: String"]},"DslTileRef":{"product":["substrate_id: String","coordinate_kind_id: String","value: String"]},"DslTracePresent":{"product":["subject: DslSubjectRef","trace_kind_id: String"]},"DslUnaryNode":{"product":["operand: U32"]},"DslValue":{"sum":["Bool: Bool","Int: I64","Text: String","RowRef: String","Outcome: String"]},"DslValueType":{"sum":["Bool: ()","Int: ()","Text: ()","RowRef: ()","Outcome: ()"]},"EvaluationProvenanceKind":{"sum":["Affordance: ()","Predicate: ()","OutcomeGraph: ()","Arbitration: ()"]},"EvaluationProvenanceStatus":{"sum":["Started: ()","Succeeded: ()","Failed: ()","RolledBack: ()"]},"EvaluationStochasticDraw":{"product":["source_id: String","draw_index: U32","value: I64"]},"EventKind":{"sum":["Tick: ()","Manual: ManualKind","Autonomy: ()","Layer2: Layer2Kind"]},"FrameItemDestination":{"sum":["ActorInventory: String","Ground: FrameSpatialRef","ObjectContainer: String","MachinePort: String"]},"FrameLane":{"sum":["Ordinary: ()","Privileged: PrivilegedFrame"]},"FrameSpatialRef":{"product":["kind: String","id: String"]},"IdentityProvenance":{"sum":["Person: ()","Service: ()"]},"Layer2Kind":{"sum":["Frame: ()","SessionOpen: ()","SessionMove: ()","SessionClose: ()","React: ()","ApplyConsequence: ()","ResourceDelta: ()","TurnStart: ()","TurnEnd: ()","ChannelSpend: ()","BoundaryFired: ()","ChannelWindowRefresh: ()","ActionRechargeFired: ()","ConditionDelta: ()"]},"LocalityClass":{"sum":["Local: ()","Place: ()","Family: ()","Global: ()"]},"ManipulationArgs":{"product":["selected_items: Array<ManipulationSelectedItemArg>","quantity: Option<U32>","destination: Option<FrameItemDestination>","station_ref: Option<String>","build_target: Option<FrameSpatialRef>","required_absent_state_ids: Array<String>","dispatch_text: Option<String>","expected_participants: Option<Array<ManipulationParticipantArg>>","participant_context: Option<String>","semantic_context: Option<ManipulationSemanticContextArg>","definition_ref: Option<String>","participant_entity_ids: Option<Array<U64>>","private_input_ref: Option<String>","dispatch_options: Option<Array<String>>","dispatch_option_refs: Option<Array<Option<String>>>","dispatch_context: Option<String>"]},"ManipulationParticipantArg":{"product":["role_id: String","entity_id: U64"]},"ManipulationSelectedItemArg":{"product":["binding: String","item_id: U64","quantity: U32","item_def_id: Option<String>"]},"ManipulationSemanticContextArg":{"product":["source_ref: String","occurrence_id: U64"]},"ManualKind":{"sum":["CreateEntity: ()","MoveEntity: ()","TakeItem: ()","DropItem: ()","ClockAdvance: ()","SpawnEntityDefinition: ()","PaceTime: ()"]},"PrivilegedFrame":{"product":["binding_id: String","body: U64","capability_id: String"]},"TargetKind":{"sum":["Entity: ()","Item: ()","WorldObject: ()"]},"TargetRef":{"sum":["Entity: U64","Item: U64","PlaceNode: String","PlaceNodeSet: TargetSetRef","PlaceEdge: U64","Location: String","World: ()"]},"TargetSetRef":{"product":["origin_place_node_id: String","range_millimeters: U32","affordance_template_id: String"]},"VisibilityClass":{"sum":["Public: ()","Local: ()","Hidden: ()","Internal: ()","Discoverable: ()"]}}};
package/src/core/log.ts DELETED
@@ -1,23 +0,0 @@
1
- type LogSink = (line: string) => void;
2
-
3
- function defaultSink(line: string): void {
4
- if (typeof process !== "undefined" && process.stderr?.write) {
5
- process.stderr.write(`${line}\n`);
6
- } else {
7
- console.warn(line);
8
- }
9
- }
10
-
11
- let _sink: LogSink = defaultSink;
12
-
13
- export function setLogSink(fn: LogSink): void {
14
- _sink = fn;
15
- }
16
-
17
- function bigintReplacer(_key: string, value: unknown): unknown {
18
- return typeof value === "bigint" ? value.toString() : value;
19
- }
20
-
21
- export function logKind(kind: string, fields: Record<string, unknown>): void {
22
- _sink(JSON.stringify({ kind, ...fields }, bigintReplacer));
23
- }
@@ -1,111 +0,0 @@
1
- // Movement-tool validation against a live snapshot.
2
- //
3
- // The LLM-callable `spellkave_move` tool accepts ONLY an adjacent move
4
- // identifier (`edge_id`). It does NOT accept arbitrary actor_id, source
5
- // node, or placement parameters. Source and destination are derived from
6
- // the live snapshot here; if anything has gone stale between the LLM
7
- // reading widget context and the tool firing, validation rejects the
8
- // move BEFORE invoking `r_move`. We never call `actor_spatial_location_set`
9
- // as a fallback — that path is reserved for authoring/placement, not
10
- // gameplay.
11
-
12
- import type { ResolvedActor } from "./actor";
13
-
14
- export interface PlaceEdgeRow {
15
- /** Stringified `edge_id`. The generated table column is `u64`, but
16
- * `r_move` accepts a string `edgeId` in its reducer schema. We carry the
17
- * stringified form throughout so widget rendering, LLM tool input, and
18
- * reducer invocation all share one identifier shape. */
19
- edge_id: string;
20
- from_node_id: string;
21
- to_node_id: string;
22
- }
23
-
24
- export interface PlaceNodeRow {
25
- node_id: string;
26
- }
27
-
28
- export interface LiveMovementReader {
29
- edges(): Iterable<PlaceEdgeRow>;
30
- nodes(): Iterable<PlaceNodeRow>;
31
- }
32
-
33
- export interface MoveCall {
34
- actor_id: string;
35
- from_node: string;
36
- to_node: string;
37
- edge_id: string;
38
- }
39
-
40
- /**
41
- * Validate an LLM-supplied edge against the actor's current location and
42
- * the live edge/node graph. Returns the concrete `r_move` call, or throws
43
- * with a structured message that the tool reports back to the LLM.
44
- */
45
- export function validateMove(
46
- actor: ResolvedActor,
47
- edgeId: string,
48
- reader: LiveMovementReader,
49
- ): MoveCall {
50
- if (edgeId.trim().length === 0) {
51
- throw new Error("edge_id is empty");
52
- }
53
- if (actor.current_node_id === undefined) {
54
- throw new Error(
55
- `actor '${actor.body_entity_id}' has no current place node; movement requires a starting node`,
56
- );
57
- }
58
- let edge: PlaceEdgeRow | undefined;
59
- for (const e of reader.edges()) {
60
- if (e.edge_id === edgeId) {
61
- edge = e;
62
- break;
63
- }
64
- }
65
- if (edge === undefined) {
66
- throw new Error(`edge '${edgeId}' not found in live world state`);
67
- }
68
- const from = actor.current_node_id;
69
- if (edge.from_node_id !== from) {
70
- throw new Error(
71
- `edge '${edgeId}' is not adjacent to actor's current node '${from}' (edge runs ${edge.from_node_id} → ${edge.to_node_id})`,
72
- );
73
- }
74
- const to = edge.to_node_id;
75
- // Confirm destination node still exists in the live snapshot.
76
- let destOk = false;
77
- for (const n of reader.nodes()) {
78
- if (n.node_id === to) {
79
- destOk = true;
80
- break;
81
- }
82
- }
83
- if (!destOk) {
84
- throw new Error(`destination node '${to}' not found in live world state`);
85
- }
86
- return {
87
- actor_id: actor.body_entity_id,
88
- from_node: from,
89
- to_node: to,
90
- edge_id: edgeId,
91
- };
92
- }
93
-
94
- /**
95
- * Enumerate adjacent moves for the active actor. The widget displays this
96
- * read-only context so the LLM can pick a valid `edge_id` to feed the tool.
97
- */
98
- export function listAdjacentMoves(
99
- actor: ResolvedActor,
100
- reader: LiveMovementReader,
101
- ): Array<{ edge_id: string; to_node: string }> {
102
- if (actor.current_node_id === undefined) return [];
103
- const from = actor.current_node_id;
104
- const out: Array<{ edge_id: string; to_node: string }> = [];
105
- for (const e of reader.edges()) {
106
- if (e.from_node_id === from) {
107
- out.push({ edge_id: e.edge_id, to_node: e.to_node_id });
108
- }
109
- }
110
- return out;
111
- }
@@ -1,208 +0,0 @@
1
- // Node-only I/O bindings for the host-neutral SDK core modules.
2
- //
3
- // This is the SINGLE SDK file that imports Node builtins (`node:fs`/`node:os`).
4
- // The browser-reachable core modules (`credential`, `paths`, `profile`,
5
- // `resolve`) are pure: they take injected readers and a `home` string, with no
6
- // top-level `node:*` import. Pulling them through the `@spellkave/sdk` barrel
7
- // must NOT drag `node:fs` into a Vite dev pre-bundle — that externalizes the
8
- // builtin into a shim that throws at module-eval and blanks the app. The
9
- // `__tests__/browser-import-boundary.test.ts` guard encodes that invariant.
10
- //
11
- // Node hosts (the pi extension `main.ts`, the world-explorer wanderer) import
12
- // their file-system-bound variants of these functions from here — exposed as
13
- // the `@spellkave/sdk/node` subpath — instead of from the pure modules. Each
14
- // wrapper just pre-injects the `node:fs`/`node:os` defaults that used to live
15
- // inside the pure modules, preserving the original behavior exactly.
16
-
17
- import {
18
- existsSync,
19
- mkdirSync,
20
- readdirSync,
21
- readFileSync,
22
- realpathSync,
23
- writeFileSync,
24
- } from "node:fs";
25
- import { homedir } from "node:os";
26
- import { dirname, join, resolve as resolvePath } from "node:path";
27
-
28
- import {
29
- type CredentialRef,
30
- type CredentialResolveEnv,
31
- resolveCredential as resolveCredentialPure,
32
- resolveSpacetimeClientCredentialToken as resolveSpacetimeClientCredentialTokenPure,
33
- resolveSpacetimeConfigPathToken as resolveSpacetimeConfigPathTokenPure,
34
- resolveSpacetimeLoginToken as resolveSpacetimeLoginTokenPure,
35
- type SpacetimeConfigTokenResolveEnv,
36
- } from "./credential";
37
- import {
38
- type CliPaths,
39
- type CliPathsEnv,
40
- resolveCliPaths as resolveCliPathsPure,
41
- scopedCurrentContextFile,
42
- scopedLastUsedProfileFile,
43
- validateProfileName,
44
- } from "./paths";
45
- import {
46
- type AppConfig,
47
- loadAppConfigFromDisk as loadAppConfigFromDiskPure,
48
- loadProfileFromDisk as loadProfileFromDiskPure,
49
- type PersonaProfile,
50
- } from "./profile";
51
- import {
52
- type CliOverrides,
53
- listProfileNames as listProfileNamesPure,
54
- type ResolutionInputs,
55
- type ResolvedConnection,
56
- readCurrentContext as readCurrentContextPure,
57
- readLastUsedProfile as readLastUsedProfilePure,
58
- resolveConnection as resolveConnectionPure,
59
- } from "./resolve";
60
-
61
- // --- Node-backed reader primitives ------------------------------------------
62
-
63
- export function nodeReadFileUtf8(path: string): string {
64
- return readFileSync(path, "utf8");
65
- }
66
-
67
- export function nodeReadFileBytes(path: string): Uint8Array {
68
- return readFileSync(path);
69
- }
70
-
71
- export function nodeReaddirSync(path: string): string[] {
72
- return readdirSync(path);
73
- }
74
-
75
- export function nodeHomedir(): string {
76
- return homedir();
77
- }
78
-
79
- /**
80
- * Walk `cwd` (default: process.cwd) for a `.git` file or directory, matching
81
- * `client/src/state.rs` `worktree_root_from_dir`. Canonicalizes when possible
82
- * so the TypeScript last-used hash matches the Rust CLI.
83
- */
84
- export function currentWorktreeRoot(cwd = process.cwd()): string | undefined {
85
- let dir = resolvePath(cwd);
86
- while (true) {
87
- if (existsSync(join(dir, ".git"))) {
88
- try {
89
- return realpathSync(dir);
90
- } catch {
91
- return dir;
92
- }
93
- }
94
- const parent = dirname(dir);
95
- if (parent === dir) return undefined;
96
- dir = parent;
97
- }
98
- }
99
-
100
- // --- Node-bound wrappers over the pure core functions ------------------------
101
-
102
- export function resolveCliPaths(opts: CliPathsEnv = {}): CliPaths {
103
- return resolveCliPathsPure({ ...opts, home: opts.home ?? nodeHomedir() });
104
- }
105
-
106
- export function resolveCredential(ref: CredentialRef, opts: CredentialResolveEnv = {}): string {
107
- return resolveCredentialPure(ref, { ...opts, readFile: opts.readFile ?? nodeReadFileUtf8 });
108
- }
109
-
110
- export function resolveSpacetimeLoginToken(opts: CredentialResolveEnv = {}): string {
111
- return resolveSpacetimeLoginTokenPure({
112
- ...opts,
113
- home: opts.home ?? nodeHomedir(),
114
- readFile: opts.readFile ?? nodeReadFileUtf8,
115
- });
116
- }
117
-
118
- export function resolveSpacetimeConfigPathToken(
119
- opts: SpacetimeConfigTokenResolveEnv = {},
120
- ): string | undefined {
121
- return resolveSpacetimeConfigPathTokenPure({
122
- ...opts,
123
- readFile: opts.readFile ?? nodeReadFileUtf8,
124
- });
125
- }
126
-
127
- export function resolveSpacetimeClientCredentialToken(
128
- url: string,
129
- db: string,
130
- opts: SpacetimeConfigTokenResolveEnv = {},
131
- ): string | undefined {
132
- return resolveSpacetimeClientCredentialTokenPure(url, db, {
133
- ...opts,
134
- home: opts.home ?? nodeHomedir(),
135
- readFileBytes: opts.readFileBytes ?? nodeReadFileBytes,
136
- });
137
- }
138
-
139
- export function loadAppConfigFromDisk(path: string): AppConfig {
140
- return loadAppConfigFromDiskPure(path, { readFileSync: nodeReadFileUtf8 });
141
- }
142
-
143
- export function loadProfileFromDisk(path: string): PersonaProfile {
144
- return loadProfileFromDiskPure(path, { readFileSync: nodeReadFileUtf8 });
145
- }
146
-
147
- export function resolveConnection(
148
- overrides: CliOverrides,
149
- inputs: ResolutionInputs,
150
- ): ResolvedConnection {
151
- return resolveConnectionPure(overrides, {
152
- ...inputs,
153
- io: { readFileSync: nodeReadFileUtf8, ...inputs.io },
154
- });
155
- }
156
-
157
- export function readLastUsedProfile(paths: CliPaths): string | undefined {
158
- const root = currentWorktreeRoot();
159
- if (root === undefined) return undefined;
160
- return readLastUsedProfilePure(paths, { readFileSync: nodeReadFileUtf8 }, root);
161
- }
162
-
163
- /**
164
- * Persist the last-used profile name for the CURRENT worktree. No-op (returns
165
- * undefined) when cwd is not inside a git worktree — matching the Rust CLI,
166
- * which cannot scope a last-used pointer without a worktree root.
167
- */
168
- export function writeLastUsedProfile(paths: CliPaths, name: string): string | undefined {
169
- const root = currentWorktreeRoot();
170
- if (root === undefined) return undefined;
171
- const file = scopedLastUsedProfileFile(paths, root);
172
- mkdirSync(dirname(file), { recursive: true });
173
- writeFileSync(file, `${name.trim()}\n`, "utf8");
174
- return file;
175
- }
176
-
177
- /**
178
- * The current author context for `cwd`'s worktree, or `undefined` when none is
179
- * set or `cwd` is outside a git worktree (sk-config-contexts D1).
180
- */
181
- export function readCurrentContext(paths: CliPaths, cwd?: string): string | undefined {
182
- const root = currentWorktreeRoot(cwd);
183
- if (root === undefined) return undefined;
184
- return readCurrentContextPure(paths, { readFileSync: nodeReadFileUtf8 }, root);
185
- }
186
-
187
- /**
188
- * Select the current author context for `cwd`'s worktree. Throws outside a git
189
- * worktree, since the pointer cannot be scoped there; unlike the last-used
190
- * pointer this is an explicit user action, so silence would hide the failure.
191
- */
192
- export function writeCurrentContext(paths: CliPaths, name: string, cwd?: string): string {
193
- validateProfileName(name);
194
- const root = currentWorktreeRoot(cwd);
195
- if (root === undefined) {
196
- throw new Error(
197
- "current directory is not inside a git worktree; cannot scope the current context",
198
- );
199
- }
200
- const file = scopedCurrentContextFile(paths, root);
201
- mkdirSync(dirname(file), { recursive: true });
202
- writeFileSync(file, `${name.trim()}\n`, "utf8");
203
- return file;
204
- }
205
-
206
- export function listProfileNames(paths: CliPaths): string[] {
207
- return listProfileNamesPure(paths, { readdirSync: nodeReaddirSync });
208
- }