1
0
Fork 0
Commit graph

865 commits

Author SHA1 Message Date
6cd94c31f8 v0.7.0 - add Labor Crew admin panel, fix npc-dialogue countdown spacing 2026-10-07 23:29:02 -04:00
0370df6c2d feat(game-structures): add Labor Crew admin panel for staffing writes
Wire the previously orphaned LaborCrewPanel into the game-structures
editor so staff can set actual headcount and per-worker wage for a
labor classification. Adds a laborCrewPanel ui field on the edit view,
a POST route under /api/game-structures that authenticates and gates on
game-structures:update, delegates to the canonical setLaborHeadcount
service (enforcing caps and wage logic), and an integration test
covering auth, validation, and cap enforcement.
2026-10-07 23:28:35 -04:00
02307aa2ee fix(npc-dialogue): split countdown units into controlled-gap cells
The countdown rendered each time unit with a raw monospace space,
which reads wide and odd when inline with proportional text. Split the
value into per-unit inline-flex cells separated by a CSS gap so spacing
stays consistent, and cover the new markup in the interpolate
integration test.
2026-10-07 23:28:31 -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
f97912f1c1 fix(mcp): gate API-key collection with system:admin-access so superusers can issue keys
The MCP plugin's key collection was gated by hasRoles(), which reads only
the legacy roles enum column. All current admins authenticate through
dynamic roleDocs superuser roles, so nobody could create an MCP API key
and every client of /api/mcp got 401. Both override blocks (MCP keys and
the AI plugin instructions) now use requirePermission('system:admin-access'),
and the sync-only admin.hidden checks were dropped in favor of the read
gate, matching the repo's requireAdminPageAccess pattern.

Adds tests/int/mcp-api-keys.int.spec.ts covering the plain-user rejection,
dynamic-superuser key creation with HMAC index resolution (mirroring the
plugin's resolveAccessSettings), explicit system:admin-access grants, and
read visibility.
2026-10-07 18:21:06 -04:00
a96eddf32c feat(npc-dialogue): bigger flow handles + delete edges via Delete
- Enlarge flow-editor wire handles from size-2 (8px) to size-3 (12px) so
  they are easier to click and grab.
- Select an edge by clicking it, then remove it with the Delete key.
  Selection is tracked in state and the highlight renders through BaseEdge
  stroke props so the chosen line stands out.
- Edges are a derived projection, so deletion scrubs the hop from the
  source node data via a new pure removeHopFromNode() helper in dialogue.ts
  (choice row, condition branch, or single continuation).
- Add tests/int/npc-dialogue-remove-hop.int.spec.ts (4 tests).
2026-10-07 14:25:14 -04:00
538b7d4c4c feat(npc-dialogue): reorder choices in the dialogue editor
Choice rows in the dialogue node editor now have up/down buttons so a
choice can be moved up or down into the desired order, which is the
order shown to the player. The swap lives in a pure reorderChoice
helper (no-op at the edges, input not mutated) with a focused test.
2026-10-07 14:01:00 -04:00
9f0f7db612 feat(npc-dialogue): auto-grow the dialogue line box to fit its content
The Line textarea in the dialogue node editor grows to fit its content
up to a 200px default max, so long lines no longer scroll in a
fixed-height box. It stays drag-resizable (resize-y) and the user can
still expand it past the max.

The auto-grow hooks run above the early-return guard so their call
order never changes, fixing a Rules of Hooks violation the change would
otherwise introduce.
2026-10-07 14:00:15 -04:00
f643028638 feat(npc-dialogue): let event flag effects target self, global, or a specific user
Event node flag effects previously always wrote the active participant's
flag. A flag's identity is (owner, key), so the same key can hold
independent values for different owners, but there was no way to target
them from the editor.

- Add flagTarget ("self" | "global" | "user") + flagTargetUserId to
  NpcDialogueEffect. "self" (default) keeps current behavior.
- Add resolveFlagOwner (flags.ts) to map a scope onto the player-flags
  user column; "user" with no id falls back to the participant so a
  misconfigured effect never nudges the global flag.
- Move applyFlagEffect into flags.ts, parameterized by resolved owner;
  the runtime action resolves the owner and delegates.
- Add a Target control (+ user picker) to the event node editor and
  validateGraph enforcement for the "user" scope.
- Integration tests cover owner resolution and self/global/user writes.
2026-10-07 13:33:52 -04:00
2231cc86ee feat(dashboard): flag restricted events with a lock icon in Recent Events 2026-10-07 13:07:23 -04:00
03c8794026 docs: add v0.6.0 changelog entry 2026-10-07 01:54:09 -04:00
cbccc09e23 v0.6.0 - npc dialogue markup and tooltips, event log visibility, reinforcement pools, ticket archiving 2026-10-07 01:48:11 -04:00
33ed389be0 docs: polish v0.5.x changelog copy 2026-10-07 01:48:01 -04:00
207de71153 fix(dev): allow LAN hosts in allowedDevOrigins so the dev server hydrates on other devices 2026-10-07 01:48:01 -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
565e190c7e test(arma-locker-sync): scope locker.apply assertions to this run
The helper counted arma-commands DB-wide, so any spec file that leaves a
game-server online (operation-*, supply-*, respawn-tickets) made later
web-originated locker edits leak into the count once vitest's timing-based
file order put those files first. Filter commands by this run's instance
refs, and mark the grid-metadata fixture write with the lockerSyncOrigin
context flag so it stops enqueuing an echo command of its own.
2026-10-06 23:31:38 -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
b1168dcc38 fix(personnel): mobile layout for conversations
- Converse button no longer floats over the hero text on phones: it sits
  in the card's content flow below the status chips and only anchors to
  the hero's right edge from md up
- conversation dialog keeps a side margin on small screens instead of
  rendering edge-to-edge
- dialog titles truncate with min-w-0 so long NPC names and attachment
  urls cannot push the close buttons out
2026-10-06 17:21:26 -04:00
6d2cde88db fix(npc-dialogue): content-only flow hashing for NEW badges
Rearranging nodes on the canvas (positions, edge ids, styling) no longer
changes the flow hash, so tidying a conversation in the editor does not
re-badge it as NEW for every player. The hash now covers node identity,
type, data, and edge source/target with order-independent serialization;
real text or branching edits still re-flag.
2026-10-06 17:15:34 -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
43cf29c6f4 test(npc-dialogue): cover inline images and choice tooltips 2026-10-06 16:21:53 -04:00
59fe616024 feat(npc-dialogue): rich hover tooltips on player choices 2026-10-06 16:21:53 -04:00
1e0df82725 feat(npc-dialogue): render inline images in dialogue markup 2026-10-06 16:21:53 -04:00
c7be90f689 test(npc-dialogue): cover flag interpolation and text flags 2026-10-06 16:09:10 -04:00
f20f57de66 feat(npc-dialogue): interpolate flag values into conversation text 2026-10-06 16:09:10 -04:00
38eb8ff771 feat(npc-dialogue): add text flag type to player flags 2026-10-06 16:09:10 -04:00
3b33c45df0 docs: backfill v0.5.0 and v0.5.1 changelog entries 2026-10-06 15:09:09 -04:00
3d93ecafb3 docs: add v0.5.2 changelog entry 2026-10-06 14:56:36 -04:00
94ef0fa2bb v0.5.2 - dialogue flow editor UX pass, routed edges, position persistence 2026-10-06 14:54:51 -04:00
efab41ba29 refactor(flow): share the edge shape builder between both flow canvases
Extract the dialogue canvas's routing upgrades into routeEdge() in the
shared lib: perpendicular handle stubs, candidate scoring (Z-step vs
straight for forward edges, top/bottom bus corridors for back edges),
per-edge detour lane spreading, and multi-pass obstacle clearing. The
NPC dialogue RoutedFlowEdge becomes a thin renderer over it, and the
tech tree RoutedEdge now inherits the same logic while keeping its own
features intact: manual waypoints route verbatim (and define the
add-a-bend base), per-source stepPosition lanes feed the Z-step, and
its fixed right/left handles map to the new direction params.

New pure spec covers the Z-step shape, blocked-forward detouring,
back-edge bus routing, per-id lane spread, and waypoint pass-through.
2026-10-06 14:47:14 -04:00
28bb08f43e fix(npc-dialogue): bus-route return edges and spread detour lanes
Two routing defects on the dialogue canvas:

- Return edges entering the same handle detoured through identical
  corners, stacking into one thick bundle on the left of the target.
  Each edge now derives a stable lane offset from its id, so parallel
  detours run in visibly separate lanes.
- Long leftward runs relied on greedy corner-hopping alone, which could
  still leave a segment cutting under a card. Back edges now try
  structured bus routes (corridor above or below every card, then swing
  in to the entry handle) and score candidates by residual crossings,
  picking the first clean shape. The router also re-runs until clean
  (bounded to three passes) instead of trusting one greedy pass.

Verified on doc #2: all seven edges route with zero card crossings and
no stacked lanes; tech-tree edge-routing specs still pass.
2026-10-06 14:38:42 -04:00
3c70fa70d8 fix(npc-dialogue): persist node drags into the flow field value
Dragging a card updated the canvas but never wrote to the Payload
field, so document Save persisted stale positions. Wrap onNodesChange
and serialize once a drag settles (the final position change with
dragging === false), keeping the write off the mousemove hot path.
Selection and in-progress-drag flags are stripped before serializing
so clicking a card never marks the document dirty.
2026-10-06 14:28:18 -04:00
46f1abd4da feat(npc-dialogue): selection ring, draft-cancel removal, snap-to-grid toggle
- Selected node cards gain a gentle cyan ring so selection state is
  obvious without fighting the per-type border colors.
- A node created via double-click/toolbar/pane menu opens straight into
  its dialog; closing that dialog with Cancel (or Escape/backdrop/X)
  now discards the empty draft instead of persisting it. Saving clears
  the draft marker, so cancelling a later edit never deletes anything.
- New Snap toggle in the editor toolbar enables React Flow grid
  snapping (20px, matching the background dots); the preference is
  remembered per browser like the tech tree's.
2026-10-06 14:20:21 -04:00
5a9bd0052b feat(npc-dialogue): route flow edges around node cards
Crossing Bezier connectors made return edges (a choice looping back to
an earlier line) impossible to trace on the dialogue canvas. Extract
the tech tree's obstacle-avoidance router into a shared pure lib
(src/lib/flow-edge-routing.ts, plus rounded path building and a new
polylineMidpoint for label placement), leave re-export shims where the
tech tree imported it, and render dialogue edges through a new
RoutedFlowEdge type: perpendicular stubs at each handle, an orthogonal
base for forward edges, full-card detouring for back edges, arrowheads,
and condition labels as chips at the path midpoint.
2026-10-06 14:13:13 -04:00
1f7729c509 feat(npc-dialogue): select nodes on click, edit on double-click
- Single click now only selects a node; the edit dialog opens on
  double-click so the Del-to-delete flow is never interrupted by a modal
- Guard the canvas double-click handler so double-clicking a node can
  never also spawn a new dialogue node behind the dialog
- Update the editor hint text to describe the new click model
2026-10-06 13:56:46 -04:00
089246def8 feat(npc-dialogue): flow editor UX pass for authoring dialogue flows
- Delete selected nodes with Del/Backspace (guarded against open dialogs,
  menus, and focused form fields)
- Double-click the canvas to drop a dialogue node at the cursor; right-click
  empty canvas for a New node menu with all six types; toolbar buttons now
  place nodes at the viewport center instead of blind grid coordinates
- Choices support optional flag conditions evaluated server-side per player
  (player flag first, global fallback); gated choices stay hidden until the
  server confirms them, so forbidden options never flash on screen
- Litegraph-style per-output handles: one source handle per choice row plus
  dedicated true/false handles on condition nodes, wired through derived
  edges and handle-aware connections
- Brighten passive edge lines and edge labels on the dark canvas
- New dialogue nodes default to an empty speaker, rendering the NPC's name
2026-10-06 13:44:01 -04:00
0cadd1e062 feat(npc-dialogue): taller flow canvas plus expand-to-screen toggle
Raise the default editor height from h-96 to 60vh (min 28rem) and add an
Expand/Shrink toolbar toggle that floats the whole editor over the document
form, filling the viewport right of the admin sidebar via the shell's
--nav-width/--app-header-height vars. Esc collapses it unless the node
dialog or context menu is open.
2026-10-06 12:43:02 -04:00
78dc4945f7 v0.5.1 - global flags on NPC dialogue condition/flag system 2026-10-06 11:59:11 -04:00
035dd49149 feat(npc-dialogue): add global flag support (nullable user on player-flags) 2026-10-06 11:58:54 -04:00
4c2fc86ecb v0.5.0 - coloured NPC dialogue text, one-time choices, condition/flag branching, player flags 2026-10-06 01:19:14 -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
76ca0e1d72 docs: add OpenChamber browser tab hygiene guidance to agent protocol 2026-10-05 12:40:47 -04:00
d21b36612f docs: add v0.4.1 player-facing changelog 2026-10-05 03:56:42 -04:00
d5bbf86e04 v0.4.1 - coordinate grid, locker sync, item storage, NPC portraits/bio, eval window, flappy ambient layers, /announce role mention 2026-10-05 03:39:43 -04:00
3e9d54486f chore(ui): replace em-dash placeholders with hyphen in NPC readouts
The 'Goods' readout cell rendered an em-dash when the NPC was not a vendor;
dash-sanitize gate requires a plain hyphen on user-facing surfaces.
2026-10-05 03:39:23 -04:00
6959a5ca0d docs: remove stale AI compose changelog entry 2026-10-05 03:37:20 -04:00
9b6935314d feat(bot): auto-mention a role in /announce when unset
Adds DISCORD_ANNOUNCE_MENTION_ROLE_ID; when set, /announce without a message
(compose dialog) posts the announcement with that role mentioned. Documented
in config, env example and the bot design guide.
2026-10-05 03:37:15 -04:00