1
0
Fork 0
Commit graph

1256 commits

Author SHA1 Message Date
d9ed16d430 docs: add v0.16.9 changelog entry
Nothing in this release is reachable by a regular user: the note-card restyle only changes a staff authoring surface, and no note is published on the member tree yet. Uses the standard filler line.
2026-11-24 11:10:16 -05:00
16a5a288d9 chore(tech-tree): restyle note nodes as distinct memo cards
A note was still a rectangle with a strip and a footer, so it read as another technology with an amber accent. Give it its own silhouette instead: warm paper fill, chunky dashed border, a vertical NOTE rail in place of the classification strip, a folded top-right corner, no corner brackets and no readout footer, with the published/internal state moved into the body.

The differences that matter at fit-view zoom are the fill and the dashed edge, since the text is illegible there and colour is all that separates the two node kinds. Documents the contract in the tech-tree AGENTS.md so it does not get harmonised back to tech-card chrome.
2026-11-24 11:09:54 -05:00
7003a321f9 v0.16.8 - add tech tree notes, fix awards without a tier 2026-11-24 10:05:57 -05:00
441dd1e535 docs: add v0.16.8 changelog entry 2026-11-24 09:55:53 -05:00
74b116b9cf fix(awards): save awards without an advancement tier
The beforeChange hook compared advancement values against undefined, but the admin form always submits the group, so an award outside a lineup arrived as { seriesKey: null, tier: null }. Null counted as set, which tripped the duplicate tier check for standalone ribbons and the ribbons-only guard for medals and commendations.

Normalize null, empty, and non-finite values to "not set" before validating. Non-ribbon awards clear leftover lineup values on a type change instead of throwing on a hidden field, and partial API updates that omit advancement keep the stored lineup.
2026-11-24 08:03:30 -05:00
48556c3688 feat(tech-tree): add note nodes with optional frontend visibility
Planners can now drop annotation cards on the Tech Tree canvas without inventing fake technologies. Notes live in their own tech-tree-notes collection (title, body, treePosition) and carry no prerequisites, costs, approval workflow or research state, so the layout engine, edge builder and research rules never see them.

showOnFrontend defaults to false, making notes a backend authoring aid; ticking it publishes the amber card read-only to the member tech tree, which queries showOnFrontend = true.

Canvas work: amber NoteNode card with no connection handles, NoteDialog for create/edit/delete, a New Note toolbar button (technologies:create gated), viewport-centre placement, and namespaced note-<id> React Flow ids so note and technology ids can never collide. Note drags, Save positions and Auto-arrange reuse the single-statement bulk /api/tech-tree/positions write by sending collection: "tech-tree-notes"; no PATCH-per-note path was added.

Also fixes the note card body being clipped by the inherited line-height: the classification strip and footer now have fixed heights with leading-none, and the body takes the remaining flex space instead of line-clamp.

Tests: tech-tree-notes.int.spec.ts (defaults, required title, publication filter, in-place edits, note layout and id namespacing) plus note coverage in tech-tree-positions.int.spec.ts. Migration 20261123_073019_add_tech_tree_notes must be run on prod after deploy.
2026-11-23 03:11:36 -05:00
4e9b2d494f v0.16.7 - fix dialogue draft dialog styling 2026-11-22 23:37:53 -05:00
8299058cb4 docs: add v0.16.7 changelog entry 2026-11-22 23:37:50 -05:00
916040eb70 fix(npc-dialogue): style the draft dialog for the admin panel
The admin bundle never loads src/app/(frontend)/styles.css, so the shadcn
theme variables (--background, --popover, --border-input) do not exist inside
a custom admin field. The brief dialog rendered transparent, and its portaled
Radix Select could not take pointer events, so the dropdowns were keyboard
only.

- describe every surface explicitly in zinc, as NodeEditDialog already does
- replace the four Radix Selects with native selects, which need no theme
  scope and work with mouse and keyboard
- scroll the form body at 62vh instead of letting it collide with the footer
- note the rule in src/lib/npc-dialogue/AGENTS.md and correct the root
  AGENTS.md shadcn sentence, which claimed the admin panel handles styling
2026-11-22 23:34:12 -05:00
8ad7c412e4 v0.16.6 - cut render fan-out and per-render queries 2026-11-22 22:41:32 -05:00
d71a28f3ec docs: add v0.16.6 changelog entry 2026-11-22 22:41:28 -05:00
a0f767cc13 perf: cut queries per render and refreshes per realtime event
Under 10-12 concurrent users the app queued behind itself: every SSE
game-event/profile-update made each client run router.refresh(), i.e. a
full layout + page render at ~15-25 queries, and a mission completion
emitted one XP event per attendee row. Measured against production, no
single query is slow and the DB is small, so this targets render count
and per-render query count instead of indexes.

Fewer renders per event:
- GameTickRealtime: 250ms coalescing window -> 1s, hidden tabs skip the
  render and refresh once when shown again.
- Delete OperationsRealtimeRefresher (5 routes) and the duplicate
  useGameTick refreshers in ProductionPanel/SlotsPanel; the global
  subscriber already refreshes those routes.
- Presence heartbeats no longer broadcast (was O(N^2) per channel every
  15s for a lastSeen no surface renders).
- NavCore links opt out of prefetch: the layout is force-dynamic with no
  loading.tsx, so ~35 prefetched links per tab were 35 server renders.

Fewer queries per render:
- Qualification flags go through one cached, single-flight profile read
  instead of one query per auth check; invalidated on profile writes.
- Dedupe DIVISION_ADMIN_QUALIFICATIONS (5 identical lookups -> 1).
- Anchor the permission cache on globalThis so route bundles share it.
- Minigame registry: real TTL cache plus invalidation on write.
- New cachedConfig TTL cache for the shims/game-rules globals, with
  invalidation hooks; bank-account existence check stops hydrating.
- pg pool max 10 -> 20 (node-postgres default throttled concurrent
  renders).

Hot-path per-item work:
- Contribution grant sweep: one status write per batch, one bucket write
  and one name lookup per user, one existence query per source
  collection instead of ~5 queries per entry.
- Notifications bell: coalesced refetch, hidden-tab skip; mark-all-read
  filters by the actor instead of scanning 100 foreign unread rows.
- Polling loops (shipments, ledger, mission reminders, chip bank) pause
  while the tab is hidden.
2026-11-22 22:39:10 -05:00
9149b3926f docs: add POLARIS operations timeline with campaign spine and branch stubs 2026-11-22 18:44:10 -05:00
a5f2959b27 v0.16.5 - add attendance unlock timeline, list thresholds in Discord roll call 2026-11-21 02:35:47 -05:00
c595781790 docs: add v0.16.5 changelog entry 2026-11-21 02:35:33 -05:00
4022e5b5f1 feat(intelligence): add attendance-gated feature unlocks to mission pages
Missions gain an attendanceUnlocks tier list (admin tab plus side-op dialog),
rendered as a timeline under the attendance card: reached tiers light up in
their accent, unreached tiers stay muted with an X TO GO tag.

- shared derivation, validation and side-op parser in lib/intelligence
- thresholds sorted on save, duplicates rejected, above-max allowed
- one compact field in the Discord roll-call; attendance hash now includes
  tiers, embed schema version 4
- int tests and an e2e render check at two attendance levels
2026-11-21 02:30:48 -05:00
429d2028d0 v0.16.4 - add unlimited arsenal stock, fix the claimed op notice 2026-11-20 20:14:55 -05:00
86b1c9ae61 docs: add v0.16.4 changelog entry 2026-11-20 20:13:18 -05:00
b90247a288 fix(bot): rewrite the Friday notice in the claimed state
The claim path appended a credit line to the invitation, so a claimed notice
still said the slot was open, that nobody had picked it up, and that Jason
would host if nobody did.

- renderClaimedNotice(): the whole body for the claimed state, role ping
  dropped since there is nothing left to ask for
- compare the live message against the rendered body each poll, so a message
  left contradictory by an older build heals on the next tick
- a cancelled claim still restores the full invitation, ping included
- cover both bodies and the claim parser in the notice integration test
2026-11-20 20:11:53 -05:00
5418d6563e feat(lockers): seed and unlimited-stock sync for limited arsenal 2026-11-20 19:52:15 -05:00
716c87bb87 v0.16.3 - fix relation meters, rating prompts, op notice date 2026-11-20 18:01:20 -05:00
56b53f207d docs: add v0.16.3 changelog entry 2026-11-20 17:27:13 -05:00
4fba0b03c7 fix(bot): show the Friday op slot date in Eastern time
Discord renders <t:epoch:D> in each viewer's timezone, so the slot's Friday
00:00 Eastern epoch read as Thursday for members west of Eastern. Render the
date as a pinned Eastern label instead.

- add fridayDateLabel(): the upcoming Friday in America/New_York
- noticeToken() now returns that label, keeping dedup stable per Friday
- legacyNoticeToken() still matches older <t:epoch:D> notices and the service
  rewrites them in place, so a deploy does not duplicate or leave one behind
- only match the bot's own messages, since a plain-date token could otherwise
  hit a member's message (which the bot cannot edit)
- document the timezone rule in the bot AGENTS.md
2026-11-20 17:25:04 -05:00
9288d1498e refactor(intelligence): reword missing rating blurbs, replace "self rating" text with Alert, improve layout on campaign card 2026-11-20 16:37:12 -05:00
7428efe6aa fix(intelligence): grow negative relation meters left of zero
The two meters on a faction dossier shared a centered track, but a negative
score grew to the right and a positive one to the left, so the side a bar sat
on said the opposite of what it meant. Negative now extends left of the zero
line and positive right.

The labels also read badly side by side: "They see us" and "We see them" each
start with the party being looked at, which invites reading them the wrong way
round. "How they see us" and "How we see them" name the direction first.
2026-11-20 03:03:29 -05:00
fc6fec4a45 v0.16.2 - add faction relations graph view 2026-11-18 16:41:11 -05:00
2501c63481 docs: add v0.16.2 changelog entry 2026-11-18 16:40:30 -05:00
392717bedc feat(intelligence): add a radial graph view to the faction relations page
The matrix answers "what is this faction's score", not "who is tied to whom".
Add a graph view behind a Matrix/Graph switch on the same page.

The player faction sits at the center and every other faction is placed on a
ring by classification (majors innermost, then minors, corporations, specials),
so its relations read as spokes and the rest as chords. Positions are
deterministic: rings ordered by type, members by name, starting at twelve
o'clock, with faint guide rings so the structure is legible without hovering.

Relations are straight lines. A relationship runs both ways, so where both
sides have an opinion the two directions are drawn side by side on either side
of the axis, each spanning the full distance between the factions, colored and
weighted by its own score, with an arrowhead at the faction being regarded. The
two directions differ independently: a faction can be resented by one that it
regards neutrally. A pair with only one opinion keeps a single centered line.

A line that would cut through an unrelated faction steps aside just far enough
to clear it, and only for factions actually alongside the line rather than
beyond either end. Straight stays straight.

Hovering a faction isolates its web and opens a panel listing what it regards
and who regards it; clicking opens the dossier. Pan, wheel zoom and reset are
local, and the whole view is hand-drawn SVG, so no graph library was added.

The layout is pure and unit-tested: input order cannot move a node, the two
directions of a pair run parallel rather than overlapping, single-direction
pairs span the whole pair, and a blocked line dodges instead of crossing a node.
2026-11-18 16:34:50 -05:00
fa87678408 v0.16.1 - replace the wiki body editor, fix caret alignment 2026-11-18 15:17:01 -05:00
21c6b30431 docs: add v0.16.1 changelog entry 2026-11-18 15:16:25 -05:00
5e1f200261 feat(wiki): replace textarea overlay with a CodeMirror markdown editor
The body editor painted highlighted markdown in a div behind a transparent-text
textarea, so the painted text and the caret were two different layout engines.
Any wrap-point difference (borders, scrollbar gutters, engine rounding, trailing
newlines) shifted the overlay by whole lines once content soft-wrapped, making
clicks land on the wrong glyph and the document end feel unreachable. The CSS
patch that preceded this reduced the drift but could not remove the class of bug.

CodeMirror 6 owns text and caret together, so the failure mode is gone by
construction rather than by maintenance. The body remains a markdown string, so
prepareMarkdown, ::: directives, wikilinks, templates, revisions and the preview
pipeline are untouched, with no data migration.

- WikiMarkdownEditor: EditorView lifecycle, theme and markdown HighlightStyle
  bound to the app's CSS tokens, history, line wrapping, IME-safe keymap.
- markdownCommands: one pure command table shared by toolbar buttons and keys.
- editorChange: toolbar updates dispatch only the differing span, keeping undo
  granular and selections outside the edit intact.
- Removes WikiEditorHighlightLayer, editorMetrics, lib/wiki/editorHighlight,
  useEditorHistory and the now-dead textarea selection reader.
- Adds e2e proof: glyph-precise clicks across wrapped paragraphs, list items,
  image markdown and scrolled documents land at the exact clicked offset.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-11-18 15:12:22 -05:00
de60e5d3e0 v0.16.0 - add faction relations ledger and relations overview, fix rich text and wiki editor rendering 2026-11-18 14:15:00 -05:00
b3bf5c8a46 docs: add v0.16.0 changelog entry 2026-11-18 14:14:31 -05:00
9e6cd55fe6 refactor(intelligence): drop the factions.relationships array in favour of the ledger
Nothing stores a pairwise score on a faction any more, so remove the array
field, its admin UI and the masking line that blanked it for undiscovered
factions. The disposal-mask doc comment now points at the ledger, which
applies the same rule by filtering entries that name an undiscovered faction.

The second migration converts every non-zero legacy value into an
opening-balance entry (custom delta, dated at the owning faction's last update
so it does not read as a fresh event, legacy note preserved) and then drops
the table. Zero rows are skipped because a stored 0 and no entries mean the
same thing.

Two integration specs that created or asserted `relationships` now use the
ledger instead.
2026-11-18 14:13:29 -05:00
cb06ba79c0 feat(intelligence): show derived faction relations on the faction and relations pages
The faction dossier's Relationships block only ever showed one direction, and
only the directions someone had bothered to type by hand.

Read both directions from the ledger instead: each row now carries "they see
us" and "we see them" meters, and a Recent Developments list under them spells
out the events behind those numbers in plain language. Hidden entries move the
meters without appearing in that list.

Add /intelligence/factions/relations, a full cross-table of every faction
against every other, player faction first, with the existing band labels as a
legend. Rows and headers link back to dossiers, and the table scrolls sideways
rather than truncating scores. A Relations entry in the Intelligence sidebar
points at it.
2026-11-18 14:13:20 -05:00
2384c7f5a4 feat(intelligence): add the faction relation ledger collection and score math
Pairwise faction attitudes were hand-typed into a per-faction array, so the
two directions of one relationship lived in different documents and could
disagree with each other.

Add `faction-relation-entries`: one row per event that moved one faction's
attitude toward another, with the score computed on read instead of stored.
Entries are directed by default with a mutual flag for shared events; severity
tiers set the delta with a custom override; decaying entries halve per
half-life (new GameRules knob, 30 days default) while lasting shifts never
fade; voiding retires an entry with a stamped reason instead of deleting it;
hidden entries still move the score but never explain it to players.

`factionRelations.ts` holds the pure math (severity presets, decay, directed
and mutual scores, bands), and `factionRelationLedger.ts` is the single read
path so the voided, hidden and undiscovered-faction rules exist in one place.
Reads run as the caller, never with `overrideAccess`; GM notes are gated by
field read access, and hidden rows are censored by an `afterRead` hook.

Includes the permission group, the `admin:faction-relation-entries:manage`
page gate, the integration spec, and the migration that creates the table and
its enums.
2026-11-18 14:13:20 -05:00
e15b0923ad fix(wiki): align highlight overlay and textarea wrapping so caret/click match painted text
The markdown overlay shared the wrapper's inset-0 box with the transparent-text
textarea, but its inner div added a 1px transparent border while the textarea is
border-0, shrinking its text width by ~2px; Firefox/Safari classic scrollbars
reserve another ~15px inside the scrolled textarea that the overflow-hidden
overlay never sees. Either gutter makes long unbreakable tokens (e.g. image
markdown URLs) wrap differently between the two layers, so the overlay text
drifts vertically under the caret/click math and editing feels like it's one or
more lines off right after inserting an image.

Compose both layers' classes from a shared WIKI_EDITOR_METRICS constant, drop
the overlay border, hide the textarea scrollbar so its content width matches the
overlay in every browser, and lock class parity with a jsdom RTL spec.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-11-18 13:56:10 -05:00
34c0d5681f fix(rich-text): render full lexical formatting incl. colours across all fields
RichText authored in the admin panel was rendered as plain text on the
public site: headings/lists/quotes were flattened by Tailwind preflight
(no @tailwindcss/typography installed), and Payload's default JSX
converter ignored text colours.

- src/lib/lexical: shared editor factory (ptfLexicalEditor) + shared
  colour palette (textState) + colour converter (richTextConverters)
- RichTextView: canonical .lexical-content renderer (colour-aware),
  swapped into every frontend render site
- All rich-text editors route through the factory, so every field
  inherits the coloured editor (incl. the previously-unedited ones)
- .lexical-content CSS extended with checklist/table/heading rules,
  wrapped in @layer components so per-page utilities still override;
  dropped the now-dead per-page prose hacks
- Remove the now-dead briefingConverters in favour of the shared
  converter; add tests/int/rich-text-view.int.spec.ts
2026-11-18 13:10:26 -05:00
1bb5cdde60 v0.15.3 - add private wiki drafts, one-way publish 2026-11-18 11:18:05 -05:00
60f85e240d docs: add v0.15.3 changelog entry 2026-11-18 11:07:31 -05:00
b5f48de0b9 feat(wiki): add private drafts with a one-way publish
Wiki pages gain a Draft flag pinned to their original creator. A draft is
visible only to its creator, wiki moderators and admins: the collection's
read access returns a where clause so the REST/local API filters drafts,
and every frontend query ANDs the same clause (they run with overrideAccess).

Publishing is one-way. A page whose stored draft is false is rejected (403)
when sent draft: true, both in the service and in access.update.

UI: amber DraftBanner on the detail page, a Draft chip in WikiRow, and a
Draft switch in the editor that disables once the page is published.
2026-11-18 11:06:37 -05:00
def32f2c82 v0.15.2 - add undiscovered factions, draft NPC dialogue in the editor 2026-11-18 09:34:46 -05:00
7c92ffaa1a docs: add v0.15.2 changelog entry 2026-11-18 09:33:58 -05:00
1d45c3fee1 feat(intelligence): add undiscovered faction state with read masking
Factions gain a discovered checkbox plus a read-time mask so players see
the entry (UNDISCOVERED card, classified detail stub) without its name,
description, standing, relationships, campaigns or cover image.

The mask runs in the Factions afterRead hook, so every reader path is
covered: pages, REST, and populated relationships. Readers holding the new
factions:view-undiscovered permission or system:admin-access see the real
record; admin panel reads are exempt so a masked edit form can never write
the placeholder name back over a record.
2026-11-18 09:19:57 -05:00
4264431e4d feat(npc-dialogue): AI-assisted conversation drafting behind the review gate
Add a Generate button to the flow editor that drafts a whole conversation
from a form brief, and per-line Rewrite/Shorten/Sharpen controls in the node
dialog. Both land in unsaved field state, so a draft only reaches players when
an author saves the document: neither server action writes to npc-dialogues.

- src/lib/ai/generate.ts: extract the Unsloth client out of payload.config so
  Compose and dialogue drafting share one path; add generateStructured and
  resolveModel, with an optional UNSLOTH_MODEL_STRUCTURED override
- generationSchema.ts (pure): strict-safe JSON schema, normalizer with
  breadth layout, validator that rejects unknown flag keys, unauthorised
  effects, dangling hops and missing keys
- generation.ts: context loading, one validate-and-retry, then give up rather
  than hand back a broken graph; dash normalization keeps shipped copy clean
- effect vocabulary limited to notify and flag; emit, reward and discord stay
  author-only
- provenance group on npc-dialogues (migration 20261112_171955) records model,
  prompt version, attempts and the brief the draft was accepted from
- tests: 21 cases covering the normalizer, validator, retry paths and the
  rewrite parser, with the model call injected
- docs/npc-dialogue-ai.md and src/lib/npc-dialogue/AGENTS.md
2026-11-12 12:26:35 -05:00
9f192a8159 v0.15.1 - fix Discord bot crash on stale interactions 2026-11-03 12:51:35 -05:00
8108465354 docs: add v0.15.1 changelog entry 2026-11-03 12:50:36 -05:00
6ee32f5085 docs(bot): record the interaction ack and error-path rules 2026-11-03 12:50:29 -05:00
c4cbe43c4f fix(bot): survive a stale Discord interaction instead of crashing
A manual /rollcall took the bot down: the command fetched the guild member
and ran the staff check before acknowledging, missed Discord's 3 second ack
window, then died on "Unknown interaction" when it tried to defer (and again
when the error path tried to reply). discord.js re-emits a rejected event
listener on the client as an 'error' event, and with no handler attached Node
threw and exited the process.

Ack first, protect the error paths:
- /rollcall, /remind-evaluations and /debug defer immediately and report
  permission denials through editReply.
- safeEphemeralReply (bot/lib/interactions.ts) never rethrows, and the RSVP
  and transfer handlers use the same guarded behaviour.
- client.on(Events.Error) logs instead of exiting. The entrypoint restarts a
  dead bot after 5 seconds, so the previous symptom was a silent gap.
2026-11-03 12:50:29 -05:00
8fff9c3f92 v0.15.0 - style mission detail as dossier cards, add command chain editor, faction links 2026-11-02 16:13:47 -05:00