1
0
Fork 0
Commit graph

116 commits

Author SHA1 Message Date
e9bc929213 feat(bot): post modlist reminder 8 hours before scheduled operations
Adds reconcileModlistBuffer, which resends the modlist-updated message once per Scheduled mission with a modlist attached, when its start is within DISCORD_MODLIST_BUFFER_HOURS (default 8). Tracked by the new discordModlistBufferSentAt marker, so it is independent of the roll-call modlist sync. Also fixes type errors in modlist-file-access.int.spec.ts.
2026-11-01 15:20:02 -05:00
afe47ccd87 feat(mission-ratings): add collection, mission field, and discord rating marker
- add_mission_ratings: mission-ratings collection + enum values + missions
  missionRating.customFactors field
- add_mission_rating_sent_at_marker: Missions.discordRatingSentAt one-shot flag
- register both in migrations/index.ts
2026-10-31 10:25:33 -04:00
66666547ad refactor(evaluations): drop stored kind, derive rating direction from ranks 2026-10-31 03:26:51 -04:00
acf47a75ea feat(operations): gate logistics extractions behind an officer review screen
Logistics operation-extraction effects now park as pending_action instead of auto-settling. Officers visit Operations > Extractions to keep, scrap, or expel each line; only kept lines deposit into HQ. A capacity failure leaves the effect retryable (pending_action) so a full HQ can free space and re-resolve. Adds resolveLogisticsExtraction/listPendingExtractions actions + ExtractionReview UI + tests.
2026-10-26 22:20:14 -04:00
40b074a693 feat(vehicles): add per-vehicle disallowed-cargo blacklist enforced at shipment
Vehicles gain a virtual-block disallowedCargo array (asset/vehicle/resource item + optional amount cap, 0 forbids outright). createShipment consults findDisallowedCargo() before deducting any origin stock and rejects matching cargo lines cleanly. Includes Payload migration + 7 integration tests.
2026-10-26 22:17:21 -04:00
1fdb6bf872 feat(vehicles): add 'static' and 'drone' vehicle categories 2026-10-26 03:39:38 -04:00
633853589f feat(arma): dedupe vehicle templates by name and mod with cleanup CLI 2026-10-22 13:18:11 -04:00
68cd3cce7c feat(interior): fixture repairs, condition decay, and station blocking
completeInteriorJob restores broken fixtures on repair jobs. New decay.ts applies per-room condition loss (elapsed days x conditionPerDay x Game Rules multiplier) on the interior-tick bin, gated by interior.decayEnabled with a baseline first run that only stamps the structure clock; fixtures at or below the authored effectFloor break with new interior:fixture-broken events, floors condition at 0, and station starts fail room_damaged below the floor.

Declares blocksStation on structure-rooms fixture state: provisioning wrote it but the missing column silently stripped it, so broken doorway fixtures could never block stations. Regression test covers persistence through provisioning plus the end-to-end gate.
2026-10-20 16:17:01 -04:00
6bc295b630 feat(interior): station recipes unlock gating and flagged asset outputs
Produce starts now honor presence-based unlocks_recipe/unlocks_station effects (station marker is its authored name) and reject unknown or gated recipes with recipe_locked, locked stations with station_locked. Asset outputs credit game-structures.storedAssets behind a new Game Rules interior.assetOutputsEnabled switch (default off), prechecked before any deposit so a disabled switch parks the job untouched; storageBridge.depositAssetsToStructure merges quantities by asset without duplicate rows.
2026-10-20 16:01:35 -04:00
0b7959662a feat(interior): upgrade completion, tech/labor gates, and module bonuses
Complete-time level advance (clamped to maxLevel), open/upgrade tech and labor gates sourced from npc-staffing and technologies.researchedAt, and pure duration/output math in effects.ts applied to job durations and produce resource output.

Adds interior_job_speed and interior_output_bonus module effect types to the shared module system (additive aggregates; existing consumers unaffected) with a migration, which also closes Step 1 drift making structures_rooms_levels_effects.value nullable and adding its target column.
2026-10-20 15:44:36 -04:00
c57fc3d23d feat(interior): add superstructure interior schema and engine core
Adds the interior authoring fields on structure blueprints, runtime interior snapshot fields on game structures, the structure-rooms and interior-jobs collections, GameRules toggles, and a Scrap resource seed.

Adds the src/lib/interior engine: access gate, room provisioning, job-start gates, structure storage bridge, job lifecycle (start, cancel, complete, collect), completion sweep, and the interior-tick bin.

Registers interior event types and the interior:job-ready notification type.
2026-10-20 14:37:13 -04:00
afa79b4be4 feat(tech): member-facing tech research system and tech tree
Add a research pipeline over the existing technology tree: Research
Facility blueprint fields copied to structure instances, tech-researches/
tech-ballots/tech-ballot-votes collections, Game Rules research config,
pure rules lib (capacity, duration math, eligibility, intel-weighted
tally with tie cascade), a timestamp-derived tech-tick bin that opens,
resolves, advances and completes research with notifications, vote
casting server actions, and a read-only member-facing tech tree page at
/intelligence/tech-tree with veil blackout and dossier-style panels.

Includes migration 20261019_184409_add_tech_research_system, permission
groups, event and notification types, sidebar entry, and integration
plus e2e coverage.
2026-10-19 17:28:26 -04:00
15e434998a feat(ai): configure Compose model and label via env
UNSLOTH_MODEL selects the model the Compose plugin calls, and the optional UNSLOTH_MODEL_NAME labels it in the admin (derived from the model id when omitted). The model-id select keeps its stable internal key, a Postgres enum, so switching models needs no schema change.

The seeded per-prompt model value is cleared so the env var applies; an admin can still pin a model on a single prompt row. Migration 20261019_121500_use_env_ai_model drops the column default and clears the seeded value.
2026-10-19 12:13:22 -04:00
88982bfcdf fix(ai): resolve compose title and name the entity in seeded prompts 2026-10-19 11:32:59 -04:00
bfb5cea3c1 feat(minigames): add Ordnance Disposal (bomperator) multiplayer drill
Add a 2-8 player free-for-all Bomberman-style charge-clearing drill at
/minigames/bomperator, category multiplayer. Pure engine plus a single-instance
in-memory match registry, mirroring the call-for-fire-versus split but upgraded
from turn-based to a fixed ~10 Hz tick loop.

Engine (src/lib/minigames/bomperator): seeded RNG via state.rngState/gridSeed;
grid is 15x13 with border, even/even pillars and seeded crates; classic pickups
bomb/range/speed/kick. Movement is grid-locked with sub-cell interpolation,
charges fuse about 2.5s, cross-flames stop at walls, crates are destroyed and
charges chain-detonate and kick-push. Round ends at one alive; sudden death
spawns random explosions after 150s with a draw guard.

Registry (registry.ts): one setInterval per live match started on startMatch and
cleared on complete/dissolve; globalThis-anchored map; holds seats across a
reconnect window then eliminates; below two active seats it dissolves. On a
manual end, broadcasts a bomperator-terminated event so remaining players see a
toast, then awards rewards via stats.ts (minigame:bomperator, profile group
bomperator: matchesPlayed/matchWins/roundsWon/kills/xpEarned).

Clients POST rate-limited inputs and poll fetchBomperatorMatch; the SSE bus pushes
snapshots with a guarded slow-poll fallback. Registry row ships as upcoming so the
page renders the coming-soon shell until an admin flips it active. Adds the
migration for the stats group, the minigame:bomperator event type, XP
aggregation on the profile, generated types, and real-time event wiring.
2026-10-16 00:32:52 -04:00
1d6db3b92b Merge branch 'feat/first-party-analytics'
# Conflicts:
#	src/migrations/index.ts
2026-10-15 00:17:58 -04:00
33f3f7aa75 feat(minigames): add phasing-out status with estimated removal date
Add a "phasingOut" minigame status and an `estimatedRemovalDate` field so a
game can be announced as leaving soon while staying fully playable and keeping
scoring periods (unlike retired games). Visibility is the only difference:

- Sidebar badge + tooltip (amber "Phasing out", countdown to removal) in
  NavMinigames, via new phasingOutTooltip in countdown.ts.
- In-game banner (PhasingOutBanner) on all 9 game pages, wired from
  getMinigameReleaseState (added the fetch to call-for-fire, which lacked it).
- registry.ts status union + field; loadRegistry.ts maps the field;
  config status select + estimatedRemovalDate date field added.
- Migration adds the enum value and column (idempotent); types + db schema
  regenerated.

Adds tests for visibility, round-trip, and period scoring; updates the
minigames domain guide.
2026-10-14 23:51:37 -04:00
88e89c9e55 feat(npc-dialogue): post opted-in event effects to Discord dispatch channel
Event nodes gain a 'Post this event to the Discord NPC dispatch channel'
checkbox. The flag rides emit() onto game_event_logs (discordRequested +
announcement bookkeeping columns, migration add_event_log_discord_fields),
and a new bot poller stamps pending rows into an amber NPC Dispatch embed
with relative-time mention and a link back to the source contact.

Bot delivery itself is unverifiable locally (no Discord token or channel id
in dev); the DB-side contract is covered by an integration test and a live
probe walk confirmed discord_requested persists end to end.
2026-10-14 16:57:33 -04:00
799c3216d2 feat(npc-dialogue): back NEW badges with server-side read markers
The per-browser localStorage tracking reset on every new device and kept
re-badging whole conversations whenever a GM edited the flowchart (hash
change), which players read as "nothing I read is remembered". Read
progress now lives in a npc-dialogue-states collection: one row per
(user, dialogue, node) with a unique index, so a node badges NEW exactly
once per player and GM edits never re-flag content they already saw.

- New collection NpcDialogueStates (own-doc access, staff-visible admin
  view) plus migration add_npc_dialogue_states.
- lib/npc-dialogue/states.ts: listSeenNodeIds for the page and an
  idempotent markNodeRead; exposed via the markNpcDialogueNodeRead
  server action, called fire-and-forget as nodes type in.
- The contacts page seeds initialSeenNodeIds into NpcConversation; the
  component keeps an optimistic local set and no longer touches
  localStorage. seen.ts and its tests are removed.

Verified live: fresh account shows NEW on all choices, reading the
"Who are you?" branch and reloading drops that badge while unread
branches keep theirs; npc_dialogue_states holds exactly the traversed
nodes. Interpolation int suite green (30/30).
2026-10-14 15:35:47 -04:00
268d4bb117 feat(analytics): add first-party analytics collector, SDK, rollups, and admin dashboard
Phase 1 of replacing Microsoft Clarity with first-party usage analytics:
- Plain Postgres tables via shared DDL module (src/lib/analytics/schema.ts)
  executed by both the add_analytics_tables migration and the test bootstrap;
  test-db.ts drops them around drizzle push (composite-PK introspector bug)
- /api/collect beacon collector with IP/UA enrichment, retroactive login
  attribution, bot blocklist, per-IP rate limiting, strict validation
- Client SDK (src/lib/client-analytics): SPA pageviews, clicks, scroll depth,
  focus, data-track visibility, heartbeats; NEXT_PUBLIC_ANALYTICS_DEV=1 dev
  gate with console mirror; mounted beside Clarity in the two frontend layouts
- Hourly rollup + daily retention bins (payload analytics-rollup/-purge)
- Chronicle read progress/completion, wiki new-clicked/created, minigame
  route mapping custom events
- admin:analytics:manage permission (+ roles enum migration) and the
  /admin/analytics Payload view with six recharts-backed report panels
2026-10-14 12:12:53 -04:00
6c1bbda944 feat(garage): add vehicle bay schema fields, geometry helpers, and backfill 2026-10-13 16:02:58 -04:00
9409f31dcf feat(contributions): award XP for published journal entries 2026-10-13 14:37:53 -04:00
db9248244d feat(awards): add award automation platform
- award-rules collection: metric/operator/value threshold rules linked to
  awards, with auto-retire-lower-tiers and once-per-series flags, active
  toggle, and award-rules:* permissions
- src/lib/awards/metrics.ts: pure metric resolvers (years of service from
  dossier.enlistmentDate with account-age fallback, account age, missions
  attended, total XP) plus operator comparison, unit tested
- evaluateAwardRules() sweeper: idempotent, dry-run capable; grants land as
  profile rows with awardedBy null so the existing afterChange hook sends
  award:granted notifications; upgrades replace the lower series tier in
  place preserving the original date; emits award:rule-granted events
- award-tick payload bin for daily evaluation + admin Award Automation
  view with Evaluate now (dry run) preview and Apply grants
- seedYearsOfServiceRules.ts wires the four years-of-service ribbons into
  one advancement series and creates their rules (idempotent, dev seeded)
- migration add_award_rules_automation (table + awards event target enum)
2026-10-12 15:11:38 -04:00
8a7d79c369 feat(journals): member-authored journal entries with author-owned publishing
- New Journals collection (Chronicle group): title, Lexical body, status
  draft/published, optional in-world date and mission link; authors read,
  edit, and delete their own entries at any status while every logged-in
  user reads published ones; journals:* staff permissions bypass ownership
  and gate the admin page (registered in the permission registry)
- /journals list with compose dialog and /journals/[id] reader reusing the
  Chronicle typography; edit/delete controls for authors and staff; drafts
  carry the DraftBadge and stay invisible to everyone but their author
- Server actions create/update/delete with ownership checks, publish-time
  journal:created and journal:deleted feed events (journals added to the
  GameEventLogs target collection enum via migration)
- Sidebar entry under Chronicle, command palette destination, admin panel
  icon; excerpt extractor as a pure module (src/lib/journals/excerpt.ts)
- Access-control integration spec covers draft privacy, publish visibility,
  non-author write blocking, and staff override (5 tests)
2026-10-12 14:39:48 -04:00
0ca35ec251 feat(sidebar): add server-persisted section reorder with customize mode
- preferences.display.sidebarOrder json field on Users + named migration
  add_sidebar_order_preference + regenerated types
- New pure helper src/lib/sidebar/order.ts (section ids, labels, default
  order, normalizeSidebarOrder) modeled on lib/dashboard/layout.ts, with
  tests/int/sidebar-order.int.spec.ts covering fallback/dupes/missing ids
- AppSidebar renders sections from the normalized order; feature-flagged-off
  sections skip their slot and keep stored positions
- Customize mode: dnd-kit sortable grips on group headers, save-on-drop via
  new updateSidebarOrder action, Reset clears the preference, Done exits;
  hidden while the sidebar is collapsed
- updateSidebarOrder sanitizes server-side and rewrites full preferences
- Fix sibling clobbering: saveDashboardLayout now preserves sidebarOrder,
  and updatePreferences now preserves both sidebarOrder and dashboard.layout
2026-10-12 13:46:48 -04:00
8148aeb22d feat(bot): add editable Discord Rich Presence via command and CMS
Adds a discord-presence Payload Global as the single source of truth for the bot's Discord activity. Two writers update it and either takes effect live: the admin CMS page and the /discord-presence command (view/edit/clear, guild-only, gated by new discord:rp:read and discord:rp:update permissions). A poll loop reconciles Discord's live presence from the Global so CMS edits propagate without a restart; disabled or blank presence sets the bot idle.
2026-10-12 10:21:37 -04:00
c3d3c8c574 chore(call-for-fire-versus): replace emplace/bracket wording
- Intro, metadata, placement card, error strings, and lobby phase label now
  use place/target/structure instead of emplace/bracket
- Leave the "How to emplace" help block unchanged for now
- Refresh the registry blurb and add a data migration to update the seeded
  minigames description
2026-10-11 23:25:49 -04:00
005ff0e5df feat(minigames): add Call for Fire: Versus multiplayer artillery duel
Head-to-head artillery duel in a new "multiplayer" registry category
(out of periods). Each operator hides a fire-base fleet on a 10x10 grid,
then takes turns calling fire: the first mission is a grid designation,
every later shot adjusts from that operator's last impact using the
single-player range/deflection controls. First to reduce every enemy
emplacement wins; a cap decides on emplacements then cells.

Pure engine in src/lib/minigames/call-for-fire-versus (engine, views,
types, constants) is client-safe and unit-tested. The server-only
registry mirrors the blackjack table pattern (globalThis-anchored Map,
lobby, per-turn timeout, expiry sweep, single-instance only); its views
are built per viewer so the opponent's fleet layout never leaves the
server. The client polls the match snapshot (the in-memory SSE bus is
unreliable across dev module copies). Rewards on completion update the
callForFireVersus profile group, pay XP and chips, and emit
minigame:call-for-fire-versus.

Wires the game into the registry (new multiplayer category + enum
migration), the sidebar grouping, the command palette, and the profile
XP aggregation. The registry row seed is split into its own migration
because Postgres forbids using a freshly added enum value in the same
transaction.

Verified: 21 new tests (engine + registry) plus the wider minigame suite
pass; tsc clean; a live two-player award run confirmed XP, chips, and
the event.
2026-10-11 21:55:39 -04:00
0bb9719139 feat(minigames): show upcoming games as disabled with a release countdown
- Optional `estimatedReleaseDate` (date and time) on the minigames registry,
  with a named migration and regenerated types.
- Sidebar: an `upcoming` game renders greyed out and non-interactive, with a
  tooltip carrying the estimate and a live countdown. It is a hoverable row
  rather than a disabled menu item, because a disabled Radix item sets
  `pointer-events: none` and would swallow the tooltip.
- Page gate: each minigame page checks its registry status and renders
  `MinigameComingSoon` instead of the arena while the game is upcoming, so a
  typed URL cannot reach unfinished gameplay. The date is display only: the
  game goes live when an admin flips `status` to active.
- Leaderboards exclude upcoming games, so they get neither a tab nor a board.
- Pure `countdown.ts` formatter plus a client ticker that computes the
  remaining time only after mount, avoiding an SSR hydration mismatch.

Note: `registry.ts`, `payload-types.ts` and `migrations/index.ts` also carry
the Call for Fire registry row and its generated types. That feature was
committed as 6d6a5fb and announced a separate commit for those files; they are
included here because they are entangled with these edits in the same files.

Tests: pure countdown unit tests, registry/gate/leaderboard integration tests,
and an e2e that seeds an upcoming row, hovers the disabled sidebar entry to
assert the tooltip, and checks the coming-soon gate.
2026-10-11 18:47:43 -04:00
ce7fb97e0e feat(minigames): register Call for Fire in the minigame registry
Adds the callForFire row to BUILTIN_MINIGAMES (core, period-scored,
order 6; poker/blackjack shift to 7/8), adds it to CORE_MINIGAME_KEYS
period-scoring fallback, and maps the key to the callForFire profile
group. Regenerates payload-types and the generated db schema, and
registers the add_call_for_fire_minigame migration.
2026-10-11 18:34:31 -04:00
5cf245b855 feat(minigames): crown player of the month and year
Phase 3 of the minigame periods feature:

- Record each ledger row's own instant (`occurredAt`, server clock at
  submit) so calendar windows score runs that actually happened in them.
  Backfilled from createdAt for existing rows.
- Pure UTC calendar windows (lib/minigames/periods/calendar.ts): completed
  month and year windows, with the first window of each kind partial because
  it begins at the anchor, and nothing crowned until the window has ended.
- Close pipeline extended: after the period sweep it crowns Player of the
  Month and Player of the Year for every completed window, scored with the
  same placement ladder as the period champion. Idempotent like the period
  close (achievement unique key plus an existence check).
- period-tick logs the crowned windows; integration tests cover window
  enumeration, both crowns and idempotency.
2026-10-11 17:06:52 -04:00
d4d121b5a7 feat(minigames): add period, entry, achievement and registry schema
Phase 0 of the minigame periods feature:

- New collections: minigames (registry), minigame-entries (append-only
  ledger), minigame-periods, achievements; new minigame-rules global
  (anchor, 14-day periods, top-10 ladder, precision minimum).
- Pure registry lib with the seven built-in games, achievement
  type/window enums and rule defaults.
- Permissions: extend the Minigames group with registry/entries/
  periods/achievements CRUD (plus minigame-periods:close) and add a
  Minigame Rules (Global) group; mirror both into ALL_PERMISSION_VALUES.
- Migration add_minigame_periods seeds the seven registry rows and the
  minigame-rules defaults idempotently so production seeds from the
  migration chain; dev seed script mirrors it for local resets.
2026-10-11 17:06:52 -04:00
32365e6612 feat(intelligence): add threat assessment dossier table to mission details
New Intelligence tab on the Missions collection holds a threatAssessment.likelihoods
array (category + 5-level likelihood select). Renders a color-coded, dossier-styled
table on the mission details page, ordered after Mission Details and above the
briefing. Rows match the free-text category to a lucide glyph (helicopter, plane,
armor, infantry, etc.) so the estimate scans at a glance.
2026-10-10 13:26:02 -04:00
3a2ae34b83 feat(contributions): add crowdsourced XP reward system
Reward users for helping build the app: wiki pages, mission planning
markers (queued until the mission completes), surveys, and manual awards.
Contribution XP folds into the existing virtual profile total, so it
flows into the level ladder, sidebar XP display, dashboard, and profile.

- contribution-entries ledger collection + profile progression.contributions.xpEarned bucket
- src/lib/contributions service (record/grant/expire/revoke, caps, idempotency, leaderboard) with a pure rules module
- per-mission planning-map delegation (missions:update grants) and a completed/cancelled map lock
- wiki, survey, and marker action/hook integration
- contribution:* event types, muteable notifications, permissions group, event targets
- profile Contributions section and /contributions leaderboard
- migration, reconcile tool, and integration tests
2026-10-09 16:30:05 -04:00
19112bcde1 feat(campaigns): add on-hold campaign status
Introduce an "onHold" campaign status, placed between inProgress and
completed in the select. The enum value is added via a migration
(ALERT TYPE enum_campaigns_status ADD VALUE 'onHold' BEFORE 'completed'),
the type is regenerated, and every Record<Campaign["status"]> map now
includes onHold so the build stays green.

- Campaigns.ts: add "On Hold" status option
- migration 20261009_160740_add_campaign_on_hold_status + registration
- regenerate payload-types.ts
2026-10-09 13:12:49 -04:00
375023f708 fix(mcp): backfill missing capability columns on payload_mcp_api_keys
The plugin generates one checkbox column per enabled collection
(<slug>_find/_create/_update/_delete), but only recent feature migrations
added theirs; 256 columns for older collections were never created, so any
query against the keys table failed with 'column does not exist' (HTTP 500
on list/create). Adds an idempotent ALTER TABLE IF NOT EXISTS migration for
all missing columns, registered in the migration index with a full-schema
snapshot sidecar (migrate:create reports no diff since the snapshot chain
already contained them).
2026-10-07 18:26:42 -04:00
e0f305b026 feat(tickets): allow staff to archive tickets, hiding them from the front-end
Archived tickets disappear from every front-end surface for all users
(staff included): helpdesk list, detail page 404s, dashboard widget, and
project board/sprints/releases/search views. They remain fully visible in
the Payload admin panel, where un-archiving restores them. The collection
hook stamps archivedAt and appends an activity entry on each toggle; the
archiveTicket server action is tickets:staff gated and emits a
ticket:archive event. Edits and votes on archived tickets are rejected.
2026-10-07 01:22:51 -04:00
38e6b3d89f feat(reinforcement-pools): store per-pool balances and sync to the game bridge
New Game collection reinforcement-pools (name, faction, armaFactions,
available, enabled) with manual-edit audit via reinforcement:adjust. The
events hook applies reinforcement.spawn/.refund deltas (soft limits, no
floor, idempotent by eventId) before the game's next pull, and a new GET
/api/arma/v1/reinforcements endpoint serves enabled pools to the server.
2026-10-07 00:28:42 -04:00
8cda724e21 feat(event-log): configurable per-event visibility with permission gates
- game-event-logs gains visibility (public|restricted) + requiredPermissions
  (any-of gate from the permission registry); read access becomes a Where
  clause: public OR actor-is-me OR held permission; superusers and
  game-event-logs:update staff see all; admin panel gate unchanged
- src/utils/event-log/visibility.ts: per-type policy map consumed by
  emitGameEvent, with per-emit overrides; npc:dialogue and flag:set start
  restricted, everything else stays public
- PlayerFlags hooks emit restricted flag:set audit events on every flag
  write (admin edits and dialogue effects alike)
- fix dashboard RecentEvents leaking events: local API find now runs as
  the viewer with overrideAccess false
- SSE broadcast sends an opaque nudge for restricted events instead of
  type/actor metadata
- /events table marks restricted rows with a lock badge
- migration 20261007_025942_add_event_log_visibility + regenerated types
- tests/int/event-log-visibility.int.spec.ts (8 cases)
2026-10-06 23:31:30 -04:00
f595828c99 feat(npc-dialogue): stacked markup, link popups, new badges, locked choices, timed flags
- DialogueText rewritten as a recursive parser so markup accumulates
  ({green}**bold green**{/} and friends nest freely, colors close inner-first)
- [label](url) dialogue links open in an iframe popup dialog so
  conversation progress survives; only http(s)/relative urls render
- NEW badges: Converse button + choice buttons badge unread paths via a
  per-browser seen map (ptf:npc-dialogue-seen) keyed by flow hash, so GM
  edits re-flag the conversation
- choices gain lockedHint: failing conditions can show the choice disabled
  with a rich tooltip instead of hiding it (evaluateNpcDialogueChoices now
  returns ChoiceGate pass/showLocked pairs)
- player flags gain activatesAt/expiresAt time windows honored by readFlag,
  flag effects gain flagDelayMinutes for slow-burn writes, and
  {{countdown:key}} tokens tick live toward activation (done/missing states)
- migration 20261006_add_flag_time_windows; spec extended to 33 tests
2026-10-06 17:06:27 -04:00
c1e13e5dc9 feat(npc-dialogue): entry gates and priority for multi-conversation selection
- npc-dialogues gains priority + entryGate (flag key/op/amount) fields
- contact page offers the highest-priority conversation whose gate
  passes (ungated = fallback, ties by oldest); only the winner's flow
  leaves the server so locked story content never reaches clients
- extract shared flag reads (readFlag/evaluateCondition) to
  lib/npc-dialogue/flags and pure selection to lib/npc-dialogue/selection
- migration 20261006_203217_add_dialogue_entry_gate; spec covers
  ordering, gating, fallback, and storage round-trip
2026-10-06 16:42:56 -04:00
38eb8ff771 feat(npc-dialogue): add text flag type to player flags 2026-10-06 16:09:10 -04:00
035dd49149 feat(npc-dialogue): add global flag support (nullable user on player-flags) 2026-10-06 11:58:54 -04:00
ac6415d034 feat(npc): complete dialogue feature and fix migration snapshot base
Finish the NPC dialogue flowchart work carried over from the base commit:
- Coloured NPC dialogue text via friendly names ({red}) or hex ({#ff00ff});
  invalid names/hex render as literal text. Shared client-safe renderer
  (DialogueText.tsx) used by both the admin canvas preview and the runtime.
- Player-flags feature: condition nodes branch on flags (evaluated
  server-side), flag effects set/clear/adjust flags, PlayerFlags collection
  + migration, and event nodes can set flags.
- One-time ("once") choices: a choice flagged "Hide after picked" is hidden
  for the rest of the current conversation only (per-session, resets on
  begin()); GMs can persist across conversations with a condition flag.
- Admin editor: colour hint, once checkbox on choices, amber "once" badge.

Migration repair: the player_flags migration (20261005_185014) was sorting
before 20261006_000000, whose stale snapshot omitted player_flags, so any
future `migrate:create` re-emitted player_flags DDL. Restored 20261006_000000's
snapshot to the full current schema so it is the correct diff base.

Verified: `bun run payload migrate` clean, `migrate:create` reports no
schema changes, `tsc --noEmit` clean.
2026-10-05 16:02:53 -04:00
2a3ad57bce feat(npc): add weighted activity, level, and dialogue conversations
- GameNpcs: Narrative Activity group (weighted options, forced flag,
  configurable reshuffle interval), level + richText levelDescription,
  canMessage toggle
- New npc-dialogues collection with a purpose-built React Flow dialogue
  editor (dialogue/choice/event/end nodes) in the admin panel
- Frontend: Currently-activity line and level description on the contact
  profile page; NpcConversation messaging surface with a documented
  (disabled) LLM extension seam
- Permissions: npc-dialogues CRUD + admin manage in a new NPC Dialogue
  group; event types for dialogue triggers
- Migration 20261006_000000 (applied to dev DB) with full schema
  snapshot sidecar
2026-10-05 12:51:59 -04:00
d530de315b chore(migrations): register grid, item storage and NPC migrations
Register 20261005_001212_add_map_grid_config,
20261005_051452_add_game_structure_item_storage and the two game-npc
migrations in the migration index, and normalize trailing commas on the
preceding entries.
2026-10-05 03:27:14 -04:00
1f230c0868 feat(missions): add a per-mission planning map with Arma markers
- New mission-map-markers collection (permission-gated, removed with its
  mission via a Missions beforeDelete hook) plus an opt-in
  classification.planningMapEnabled flag on missions.
- The mission page gains a planning section: place and edit Arma markers
  (icons, ellipses, rectangles, polylines) with debounced saves, an SQF copy
  export, and an Arma grid readout. Everyone who can read the mission sees the
  plan once enabled; editing requires missions:update or mission ownership.
- Base layers come from GET /api/map-features?layers=base, which skips the
  structure, node and shipment queries; marker icons render tinted by color
  exactly like in-game.
- Includes the hand-written migration, the missionMap service lib, server
  actions emitting mission:map-marker-* events, and integration plus e2e
  coverage.
2026-10-04 02:53:21 -04:00
d9253e6725 chore(payload): regenerate types and schema, harden sequence reset
- Regenerate payload-types and the drizzle schema for the new collections and
  fields (promotion nominations, leadership transfers, the accessory asset
  type, the Ornith model settings) and register the new migrations.
- Fix the reset-sequences SQL function to skip empty tables, and update the
  prod sync script to match.
2026-10-03 03:30:43 -04:00
15f2d0c573 feat(tech-tree): add tech-categories collection, permissions, and treePosition
Add the tech-categories collection that gives technologies a home off the
flat uncategorized pool, plus the schema support the admin editor needs.

- New `tech-categories` collection (unique name, timeline `position`,
  optional hex `color`) with a `Technologies.category` FK (ON DELETE set
  null) so deleting a category just unfiles its technologies.
- Add `Technologies.treePosition {x,y}` so the canvas can pin a node's
  manual position; clearing it uses `{x:null,y:null}`.
- Register the two hand-written migrations (tech-categories + treePosition)
  and regenerate payload-types, the drizzle schema, and the admin importMap.
- Register the `tech-categories:*` permission group and grant Intelligence
  division members admin-panel access, mirroring technologies.
2026-10-01 10:03:49 -04:00
c9a3d23f96 feat(wiki): add Documentation category restricted to admins and developers
New in-depth, non-developer guides for the core systems: logistics and storage rules, banking, market and negotiation, shipments, base management, and the map. Read stays open to any logged-in user; create and edit require admin or developer roles (enforced in the collection access functions and the wiki server actions, since the service layer runs with overrideAccess). Category escalation via update is blocked too. Ships the enum migration, regenerated schema/types, and the idempotent seed script with its markdown sources.
2026-09-30 18:41:07 -04:00