1
0
Fork 0
Commit graph

36 commits

Author SHA1 Message Date
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
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
707c5f6c81 feat(event-log): hide routine tick events behind a toggle
Add a client-safe ROUTINE_EVENT_TYPES list (game:tick, economy:tick, market:auto-generate) and hide those types on /events behind an off-by-default Routine ticks switch. The dashboard always excludes them so real events fill the recent list.

Tick bins now skip no-op emissions: game tick requires shipment, construction, or production activity; market tick requires an expiry or generation; economy tick requires processed items or errors. Historical events stay in the database and remain visible via the toggle or the admin panel.
2026-10-19 20:03:51 -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
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
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
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
ccdeebbd35 feat(minigames): close anchored periods and grant period awards
Phase 2 of the minigame periods feature:

- Pure board + award math (lib/minigames/periods/boards.ts): best-performer
  boards from the ledger, a fixed top-N placement ladder summed across the
  five Core boards, and the five period awards (Period Champion, Diligence,
  Dedication, Precision, Most Improved) with the locked tie-break (raw
  period score, then earliest submission).
- Close pipeline (lib/minigames/periods/lifecycle.ts): computes boards for a
  period, writes its achievement rows, and marks it closed. Idempotent: the
  status is re-checked before committing and the achievements unique key
  makes a duplicate close insert nothing, so the tick and the admin override
  cannot double-grant.
- Shared rules resolver (lib/minigames/periods/rules.ts), now used by both
  the entry recorder and the close pipeline.
- New period-tick bin (registered in payload.config.ts) closes every due
  period and materializes the current one, mirroring the mission tick.
- Admin close/reopen route (POST /api/minigame-periods/close), gated on the
  minigame-periods:close permission. Reopen removes the period's awards so a
  future close can re-grant them.
- Integration tests for the pure math and the full close/reopen cycle, plus a
  clean-slate guard so the two minigame specs stay order-independent.
2026-10-11 17:06:52 -04:00
eed33de2e9 fix(missions): default new main ops to the upcoming Saturday
The startDateTime default in the Missions collection and the weekly
generate-mission bin both forced the date at least a week out by adding 7
days to the offset to the next Saturday. Generated midweek that landed on
the Saturday AFTER the coming one (a Tuesday generation went 11 days out
instead of 4), which also pushed the bot's roll-call (posted within 3 days
of start) days into the future and read as a missing roll-call.

Add nextSaturdayStart() to the unit-timezone date helpers: the nearest
upcoming Saturday at 20:00 America/New_York, rolling a week only once
today's 20:00 has passed. Use it for the collection default and the
generator, derive the generator codeName datestamp in unit time, and cover
the boundary cases in tests/int/next-saturday-start.int.spec.ts.
2026-10-10 14:54:06 -04:00
b28708c590 docs(agents): split domain guidance into nested AGENTS.md files
Move 19 domain sections out of the root guide into per-directory
AGENTS.md files that OpenCode v2 injects lazily when an agent reads
each subtree. The always-loaded root drops from 121KB to ~30KB and
gains a domain index table with never-miss invariants. Original root
and pre-merge sub-guides are preserved under
docs/backups/pre-agents-split-20261009/ for restoration.

Note: also carries the pre-existing uncommitted wiki-section edits to
the root AGENTS.md, preserved verbatim in src/lib/wiki/AGENTS.md.
2026-10-09 15:46:36 -04:00
74564afb2b feat(missions): auto-start and auto-complete ops, plus side-op scheduling
- The mission tick now runs two idempotent sweeps: auto-start flips Scheduled
  missions whose start time has arrived to Active, and auto-complete sets
  missions whose scheduled window (start plus duration) has fully passed to
  Completed with a stamped completedAt.
- Side ops are created as quiet Ready drafts and committed with a "Mark as
  Scheduled" control, which is what posts the Discord roll-call and hands the
  op to the lifecycle above.
- Daily schedule reminders nudge the creator to set a draft live (web
  notification plus Discord DM).
- Adds the mission lifecycle/commit event types and the matching notification
  labels, and updates the bot docs.
2026-10-03 03:29:35 -04:00
f8ce3f3dcc feat(logistics): timestamp shipment lifecycle with client relay
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
2026-09-20 02:43:29 -04:00
5be390012a feat(base): timestamp-based construction lifecycle with progress panel
Blueprints declare constructionDurationMinutes instead of tick counts. Delivering the last material starts construction at delivery time via maybeStartConstruction, setting constructionStartedAt/CompletesAt on the site; the game tick only sweeps completed sites. Structure detail page extracts server data helpers and shows a ConstructionPanel with a literal ETA countdown.

Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
2026-09-16 23:14:07 -04:00
7180b0aa4c feat(missions): make code name optional, add UGC cover images
- Missions.codeName is now optional (still unique when set); migration included
- Campaign and side-op dialogs accept an optional cover image (uploadUgcImage)
- Reminder toasts, evaluation aggregates, calendar, cards and mission headers
  handle a null code name
- Mission read filter no longer hides drafts by status; visibility follows
  ownershipAndStatus.visibility only
2026-09-10 20:02:47 -04:00
d757c58c5d feat(missions): daily ready-check reminders for unfinished side ops
Five days before a player-created side op starts, if it is not yet Ready, the creator gets one in-app notification per day (via mission-tick) plus one Discord DM per day (new bot service). Per-server-local-day dedupe via hidden readyReminderWebSentAt/readyReminderDmSentAt markers. The ready-reminder type is excluded from the notification bridge to avoid double-DMing. Markers are nulled on clone.
2026-09-07 05:07:46 -04:00
a2a5f7877b style: remove em-dashes from user-visible prose (wave 1) 2026-09-07 01:34:28 -04:00
db5745d458 fix(version): compose version+commit label when git describe is unavailable
Coolify builds have no git metadata, so fall back to <semver>+<commit sha> in both the version overlay and version-info generator instead of showing a bare version.

Ultraworked with [Sisyphus](https://github.com/code-yeongju/oh-my-openagent)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
2026-09-06 17:23:03 -04:00
d4c8d81e2f feat(economy): ingest purchase demand and price vendor listings from the ledger
Market-tick prices new NPC listings from the economy ledger (base x priceModifier, vendor modifier applied) instead of the old autoPrice +/-15% randomness, and scales restock quantity down under shortage. buyListing records real demand from completed purchases of NPC/vendor stock.

Ultraworked with [Sisyphus](https://github.com/code-yeongju/oh-my-openagent)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
2026-09-06 17:22:32 -04:00
447df220f5 feat(economy): add economy tick with demand simulation and price modifiers
Add the src/lib/economy service (GM baselines, deterministic per-period demand drift, price modifier computation, event emission) and the economy-tick bin. Gated by GameRules economy.enabled; period-idempotent with a cold-start observation gate.

Ultraworked with [Sisyphus](https://github.com/code-yeongju/oh-my-openagent)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
2026-09-06 17:22:30 -04:00
4e9c539682 feat(base): add base tick bin for salaries, maintenance, and upkeep
Registers the base-tick bin: pays staff salaries from the treasury, charges structure maintenance, tracks upkeep shortages from storage, and notifies clients via the game-tick SSE path.

Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
2026-09-06 01:24:11 -04:00
7490f34267 feat(version): add build metadata fields
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
2026-08-27 18:36:11 -04:00
b99520bc64 feat(version): add version bump script for CI deployments 2026-08-26 22:13:24 -04:00
287a0f7db8 feat(server): add stale presence monitoring 2026-08-26 18:05:57 -04:00
c628f8a90b feat(missions): auto-complete past missions via mission-tick bin
Add the mission-tick Payload bin (external cron): sweeps missions
whose status is Scheduled/Active and whose scheduled calendar day
(classification.startDateTime, server-local) has fully passed and
sets them to Completed, emitting a mission:auto-complete event per
mission. Draft and terminal statuses are never touched; idempotent.
Notifies clients via the game-tick SSE path.

Logic lives in src/lib/intelligence/missionLifecycle.ts with an
integration test in tests/int/mission-lifecycle.int.spec.ts.
2026-08-25 12:30:04 -04:00
de1230a757 fix(generate-mission): strip array row ids when cloning missions
Cloning a mission whose array rows still carry the source doc's row
ids trips a unique-constraint violation in the drizzle adapter,
surfacing as 'ValidationError: The following field is invalid: id'.
Walk the collection's field schema (groups, tabs, rows, nested
arrays) and strip row ids before create — schema-driven so Lexical
richText blobs are cloned verbatim.

Also adopt the bin file logger and the standard fatal-error exit
path.
2026-08-25 12:29:26 -04:00
e72b849774 feat(scripts): tee bin script logs to daily files
Add createBinLogger (src/scripts/lib/binFileLogger.ts): every log call
is appended synchronously to logs/<bin-key>/<YYYY-MM-DD>.log (UTC) in
addition to the console logger — sync writes because bin scripts
process.exit() immediately. Bin bodies are wrapped in try/catch so a
fatal error is logged to file and exits code 1. Override the directory
with BIN_LOG_DIR. logs/ is gitignored.

game-tick, market-tick, and processShipmentTick adopt the logger;
generate-mission follows with its clone fix; mission-tick lands with
its feature. Document BIN_LOG_DIR in .env.example and the logging in
AGENTS.md / README.
2026-08-25 12:29:07 -04:00
bfb3e1495a feat(awards): sort awards by experience points in award display 2026-08-21 16:57:31 -04:00
4c03784c68 chore(db): add migration runner and schema baseline 2026-08-20 19:57:22 -04:00
50f964cdf9 style(scripts): format tick scripts, seed tools, and migrations 2026-08-16 23:27:51 -04:00
10560c1446 fix(version): resolve git metadata from env/SOURCE_COMMIT for Coolify builds
Coolify strips .git from the build context, so git CLI calls in
generate:version-info fail during Docker builds. The script now
resolves metadata in priority order: GIT_* env overrides, then
SOURCE_COMMIT (Coolify's injected build arg, shortened to 7 chars),
then git CLI fallback for local builds. Dockerfile passes the ARGs
through as ENV before the build; DEPLOYMENT.md documents the required
'Include Source Commit in Build' setting.
2026-08-16 18:46:21 -04:00
ad774121b0 feat(missions): add generate-mission bin for next Saturday template 2026-08-12 12:38:55 -04:00
bc1456db88 feat(notify): push banking move and shipment arrival owner notifications 2026-08-12 12:38:46 -04:00
bbfbd5966c feat(version): expose build/commit metadata via /api/version and overlay 2026-08-12 12:38:33 -04:00
89b8474e23 feat(market): add trading marketplace with listings, haggling, and NPC vendors
Tarkov-style flea market where users list locker items at a fixed price
and buyers pay through the banking system; items transfer directly
into the buyer's locker.

- market-listings + market-negotiations collections and the market page
  with search/rarity filters and a Countdown timer on each card
- service lib (buyListing with partial-quantity + negotiated-price
  support, clean-stock rule, creditLockerQuantity, auto pricing)
- negotiation flow: make/accept/reject/counter/withdraw, strictly-
  increasing buyer offers, NPC vendor auto-resolution
- NPC vendors: game-npcs attribution, patience meter, dialogue, chat
  bubbles, historical threads dialog
- 30d user / 7d auto listing durations, market-tick bin for expiry +
  vendor restock, SSE notify on tick
- market event types + game-npcs/market target collections in the
  event log; sidebar Market entry under Logistics
- partial-quantity purchases (buyListing/buyMarketListing/makeMarketOffer)
  with full int test coverage (25 tests)
2026-08-10 16:05:57 -04:00
d3afc6a0c1 feat(realtime): add game-tick SSE notification pipeline 2026-08-02 02:03:56 -04:00
75a1c8ed9a feat(logistics): add shipments collection with dispatch, transit, and arrival processing 2026-08-02 02:03:50 -04:00