feat(assistant): expenses, shares, wind, journey tracks and Dawarich checks as MCP tools

- list_budget_items lists a trip's expenses with their ids, payers and
  splits, page by page so no page is cut down on its way to a model;
  get_budget_per_person answers who paid and owes what. Both in a new
  budget-items.mcp.ts, checked like their REST twins.
- get_wind_forecast reads the hourly wind, gusts and direction of a day.
- get_journey_tracks lists a journey's GPX tracks; the line for drawing
  rides under a key the provider never receives.
- The Dawarich wishlist scan and the countries the recordings suggest
  become tools, with their confirming writes, in DawarichAtlasMcp in the
  Atlas group; the shared time window check refuses alike on REST and
  MCP, and the model never sees when the user was last seen in a city.
- The journal's map, tracks and recorded days load with the journey
  group instead of riding in the core of every step.
- The prompt points at list_budget_items for expense ids (the trip
  summary never carried them) and names the shares and the wind tools;
  each new read has its own live step.
This commit is contained in:
Maurice
2026-10-22 00:03:19 +00:00
parent 3c0f324266
commit 6d6efddc4e
63 changed files with 2418 additions and 51 deletions
+16 -1
View File
@@ -30,6 +30,8 @@ import {
dawarichSuggestionStateSchemaBody,
dawarichSuggestionTargetSchema,
dawarichSyncStateSchema,
dawarichTimeWindowSchema,
DAWARICH_WINDOW_MAX_DAYS,
dawarichTrackDaySchema,
dawarichTrackSchema,
dawarichTrackSegmentSchema,
@@ -39,7 +41,7 @@ import {
import { describe, expect, it } from 'vitest';
/**
* DAWARICH-SCHEMA-001..043: the Dawarich contracts.
* DAWARICH-SCHEMA-001..044: the Dawarich contracts.
*
* This is the layer both sides of the integration agree on, and the feature is
* built out of things that are deliberately lenient in one place and
@@ -734,3 +736,16 @@ describe('the tuning numbers', () => {
expect(DAWARICH_SYNC_LOOKAHEAD_DAYS).toBe(1);
});
});
describe('dawarichTimeWindowSchema', () => {
it('DAWARICH-SCHEMA-044 needs both ends, each a non-empty string, and leaves the order and the 400-day span to the server', () => {
// The order and the span are the server's to check (parseTimeWindow), because
// the MCP input is this shape's fields and a refinement on the object would
// never run there. What the schema itself owes is that neither end is missing.
expect(dawarichTimeWindowSchema.safeParse({ from: '2025-01-01', to: '2025-12-31' }).success).toBe(true);
expect(dawarichTimeWindowSchema.safeParse({ from: '2025-01-01' }).success).toBe(false);
expect(dawarichTimeWindowSchema.safeParse({ from: '', to: '2025-12-31' }).success).toBe(false);
expect(dawarichTimeWindowSchema.safeParse({ from: 20250101, to: '2025-12-31' }).success).toBe(false);
expect(DAWARICH_WINDOW_MAX_DAYS).toBe(400);
});
});
+24
View File
@@ -331,6 +331,30 @@ export const dawarichTrackSchema = z.object({
});
export type DawarichTrack = z.infer<typeof dawarichTrackSchema>;
/** The longest window one read of the recordings may span. */
export const DAWARICH_WINDOW_MAX_DAYS = 400;
/**
* An explicit window of the recordings, as GET /atlas/suggestions and GET
* /track take it in their query and the MCP tools take it as input. Both ends
* are required and `to` lies after `from`, within DAWARICH_WINDOW_MAX_DAYS:
* a half-open range would read everything since the epoch, the request that
* makes an instance time out. The server checks the order and the span.
*/
export const dawarichTimeWindowSchema = z.object({
from: z
.string()
.min(1)
.describe('Start of the window, ISO 8601 (2025-06-01 or 2025-06-01T00:00:00Z); a bare date is its midnight UTC'),
to: z
.string()
.min(1)
.describe(
`End of the window, ISO 8601, after from and at most ${DAWARICH_WINDOW_MAX_DAYS} days later; a bare date is its midnight UTC, so give the day after the last one to include it`,
),
});
export type DawarichTimeWindow = z.infer<typeof dawarichTimeWindowSchema>;
// ── Atlas ────────────────────────────────────────────────────────────────────
/**