@bitcobblers/wod-wiki-engine 0.53.2204 → 0.54.2205

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,851 @@
1
+ import { z } from 'zod';
2
+ import { IStorage, StoreName } from '@bitcobblers/wod-wiki-storage';
3
+ import { F as FeedTree, P as PortableFileEntry, R as ResolvedUpstreamProvenance, S as StatementNode } from './ir-CKImc4T0.cjs';
4
+ import * as _bitcobblers_wod_wiki_core from '@bitcobblers/wod-wiki-core';
5
+ import { Note, Session, EventRecord } from '@bitcobblers/wod-wiki-core';
6
+ import * as _bitcobblers_wod_wiki_wql from '@bitcobblers/wod-wiki-wql';
7
+ import { QueryService } from '@bitcobblers/wod-wiki-wql';
8
+ import * as _bitcobblers_wod_wiki_lang from '@bitcobblers/wod-wiki-lang';
9
+
10
+ type AgentRiskTier = 0 | 1 | 2;
11
+ type AgentDomainName = 'script' | 'wql' | 'note' | 'journal' | 'notebook' | 'session' | 'catalog' | 'feed' | 'system';
12
+ interface AgentToolAnnotations {
13
+ title?: string;
14
+ readOnlyHint?: boolean;
15
+ destructiveHint?: boolean;
16
+ idempotentHint?: boolean;
17
+ openWorldHint?: boolean;
18
+ }
19
+ interface AgentConfirmationRequest {
20
+ action: string;
21
+ targetId: string;
22
+ summary: string;
23
+ }
24
+ declare class AgentConfirmationRequiredError extends Error {
25
+ readonly code: "CONFIRMATION_REQUIRED";
26
+ readonly targetId: string;
27
+ readonly action: string;
28
+ constructor(req: AgentConfirmationRequest, detail?: string);
29
+ }
30
+ interface AgentDomainContext {
31
+ storage: IStorage;
32
+ /** Base origin for canonical deep links (e.g. https://wod.wiki or http://127.0.0.1:3000). */
33
+ baseUrl?: string;
34
+ /** Optional feed tree for `wod_feed_manage` (`publish` / `status` on server or CLI). */
35
+ feedTree?: FeedTree;
36
+ /** Surface-specific Tier 2 gate (Radix modal in WebMCP, elicitation in MCP, --yes in CLI). */
37
+ confirmDestructive?: (req: AgentConfirmationRequest) => Promise<boolean>;
38
+ /** Optional hook run after writes (e.g. cache invalidation in Playground, domain refresh in SQL). */
39
+ onMutated?: (stores: readonly StoreName[]) => Promise<void> | void;
40
+ }
41
+ interface AgentToolSpec<TInput extends z.ZodType = z.ZodType, TOutput = unknown> {
42
+ name: string;
43
+ title: string;
44
+ description: string;
45
+ tier: AgentRiskTier;
46
+ domain: AgentDomainName;
47
+ annotations: AgentToolAnnotations;
48
+ inputSchema: TInput;
49
+ outputSchema?: z.ZodType;
50
+ cliEquivalent: string;
51
+ execute: (args: z.infer<TInput>, ctx: AgentDomainContext) => Promise<TOutput>;
52
+ }
53
+ declare function defineAgentTool<TInput extends z.ZodType, TOutput>(spec: AgentToolSpec<TInput, TOutput>): AgentToolSpec<TInput, TOutput>;
54
+ declare function requireDestructiveConfirmation(ctx: AgentDomainContext, req: AgentConfirmationRequest, explicitConfirmId?: string): Promise<void>;
55
+
56
+ declare function normalizeMarkdownOrBareScript(source: string, sport?: string, title?: string): string;
57
+ declare function civilDateKey(input?: string, nowMs?: number): string;
58
+ declare function createQueryServiceForStorage(storage: IStorage): QueryService;
59
+ interface UpsertNoteInStorageInput {
60
+ noteId?: string;
61
+ title?: string;
62
+ rawContent: string;
63
+ expectedSourceRevision?: number;
64
+ notebookId?: string;
65
+ journalDate?: string;
66
+ tags?: Array<{
67
+ label: string;
68
+ type?: string;
69
+ }>;
70
+ type?: Note['type'];
71
+ now?: number;
72
+ }
73
+ interface UpsertNoteInStorageResult {
74
+ note: Note;
75
+ created: boolean;
76
+ blockCount: number;
77
+ effortSlugs: string[];
78
+ equipmentSlugs: string[];
79
+ tagLabels: string[];
80
+ }
81
+ declare function upsertNoteInStorage(storage: IStorage, input: UpsertNoteInStorageInput): Promise<UpsertNoteInStorageResult>;
82
+ declare function deleteNoteFromStorage(storage: IStorage, noteId: string): Promise<boolean>;
83
+ declare function deleteSessionFromStorage(storage: IStorage, sessionId: string): Promise<boolean>;
84
+ declare function noteDeepLink(note: Pick<Note, 'id' | 'notebookId' | 'sourcePath'>, baseUrl?: string): string;
85
+
86
+ declare const wodCatalogLookupTool: AgentToolSpec<z.ZodObject<{
87
+ kind: z.ZodEnum<{
88
+ equipment: "equipment";
89
+ effort: "effort";
90
+ tag: "tag";
91
+ "tag-type": "tag-type";
92
+ }>;
93
+ search: z.ZodOptional<z.ZodString>;
94
+ slug: z.ZodOptional<z.ZodString>;
95
+ notebookId: z.ZodOptional<z.ZodString>;
96
+ limit: z.ZodOptional<z.ZodNumber>;
97
+ }, z.core.$strip>, {
98
+ kind: "effort";
99
+ totalCount: number;
100
+ items: {
101
+ markdown?: string | undefined;
102
+ slug: string;
103
+ label: string;
104
+ aliases: string[];
105
+ met: number;
106
+ scope: string;
107
+ }[];
108
+ } | {
109
+ kind: "equipment";
110
+ totalCount: number;
111
+ items: {
112
+ markdown?: string | undefined;
113
+ slug: string;
114
+ label: string;
115
+ aliases: string[];
116
+ scope: string;
117
+ }[];
118
+ } | {
119
+ kind: "tag";
120
+ totalCount: number;
121
+ items: {
122
+ id: string;
123
+ label: string;
124
+ type: _bitcobblers_wod_wiki_core.TagType;
125
+ contributions: _bitcobblers_wod_wiki_core.TagContribution[];
126
+ scope: string;
127
+ }[];
128
+ } | {
129
+ kind: "tag-type";
130
+ totalCount: number;
131
+ items: _bitcobblers_wod_wiki_core.TagTypeRecord[];
132
+ }>;
133
+ declare const wodCatalogUpsertTool: AgentToolSpec<z.ZodObject<{
134
+ kind: z.ZodEnum<{
135
+ equipment: "equipment";
136
+ effort: "effort";
137
+ tag: "tag";
138
+ "tag-type": "tag-type";
139
+ }>;
140
+ slug: z.ZodString;
141
+ label: z.ZodOptional<z.ZodString>;
142
+ targetNotebookId: z.ZodOptional<z.ZodString>;
143
+ markdown: z.ZodOptional<z.ZodString>;
144
+ met: z.ZodOptional<z.ZodNumber>;
145
+ aliases: z.ZodOptional<z.ZodArray<z.ZodString>>;
146
+ category: z.ZodOptional<z.ZodString>;
147
+ color: z.ZodOptional<z.ZodString>;
148
+ }, z.core.$strip>, {
149
+ id: string;
150
+ kind: _bitcobblers_wod_wiki_core.OverridePropertyKind;
151
+ slug: string;
152
+ label: string;
153
+ notebookId: string;
154
+ ownerNoteId: string;
155
+ }>;
156
+
157
+ declare const wodFeedManageTool: AgentToolSpec<z.ZodObject<{
158
+ action: z.ZodEnum<{
159
+ status: "status";
160
+ list: "list";
161
+ publish: "publish";
162
+ "import-bundle": "import-bundle";
163
+ }>;
164
+ notebookSlug: z.ZodOptional<z.ZodString>;
165
+ name: z.ZodOptional<z.ZodString>;
166
+ description: z.ZodOptional<z.ZodString>;
167
+ files: z.ZodOptional<z.ZodArray<z.ZodObject<{
168
+ path: z.ZodString;
169
+ content: z.ZodString;
170
+ }, z.core.$strip>>>;
171
+ }, z.core.$strip>, {
172
+ action: "list";
173
+ installedCount: number;
174
+ feeds: {
175
+ sourceId: string;
176
+ seedVersion?: number;
177
+ builtAt?: string;
178
+ importedAt?: number;
179
+ chunkCount: number;
180
+ }[];
181
+ notebooks?: undefined;
182
+ totalNotes?: undefined;
183
+ totalPublicSessions?: undefined;
184
+ manifestVersion?: undefined;
185
+ manifestSha256?: undefined;
186
+ } | {
187
+ hasPublicContent: boolean;
188
+ publishedVersion: number | null;
189
+ builtAt: string | null;
190
+ dirty: boolean;
191
+ publicNotebooks: number;
192
+ publicNotes: number;
193
+ publicSessions: number;
194
+ changes: Array<{
195
+ notebookId: string;
196
+ status: "added" | "modified" | "removed";
197
+ }>;
198
+ action: "status";
199
+ installedCount?: undefined;
200
+ feeds?: undefined;
201
+ notebooks?: undefined;
202
+ totalNotes?: undefined;
203
+ totalPublicSessions?: undefined;
204
+ manifestVersion?: undefined;
205
+ manifestSha256?: undefined;
206
+ } | {
207
+ action: "publish";
208
+ notebooks: string[];
209
+ totalNotes: number;
210
+ totalPublicSessions: number;
211
+ manifestVersion: number;
212
+ manifestSha256: string;
213
+ installedCount?: undefined;
214
+ feeds?: undefined;
215
+ } | {
216
+ notesImported: number;
217
+ revisionsImported: number;
218
+ sessionsImported: number;
219
+ eventsImported: number;
220
+ errors: string[];
221
+ action: "import-bundle";
222
+ installedCount?: undefined;
223
+ feeds?: undefined;
224
+ notebooks?: undefined;
225
+ totalNotes?: undefined;
226
+ totalPublicSessions?: undefined;
227
+ manifestVersion?: undefined;
228
+ manifestSha256?: undefined;
229
+ }>;
230
+ declare const wodExportBundleTool: AgentToolSpec<z.ZodObject<{
231
+ noteIds: z.ZodOptional<z.ZodArray<z.ZodString>>;
232
+ telemetryFormat: z.ZodOptional<z.ZodEnum<{
233
+ jsonl: "jsonl";
234
+ csv: "csv";
235
+ both: "both";
236
+ }>>;
237
+ }, z.core.$strip>, {
238
+ fileCount: number;
239
+ files: PortableFileEntry[];
240
+ }>;
241
+ declare const wodResetStorageTool: AgentToolSpec<z.ZodObject<{
242
+ confirmToken: z.ZodOptional<z.ZodString>;
243
+ }, z.core.$strip>, {
244
+ wiped: boolean;
245
+ }>;
246
+
247
+ declare const wodJournalDayTool: AgentToolSpec<z.ZodObject<{
248
+ date: z.ZodOptional<z.ZodString>;
249
+ }, z.core.$strip>, {
250
+ date: string;
251
+ url: string;
252
+ pageId: string;
253
+ noteCount: number;
254
+ notes: {
255
+ id: string;
256
+ title: string;
257
+ sourceRevision: number;
258
+ rawContent: string;
259
+ tags: string[];
260
+ wodBlockIds: string[];
261
+ url: string;
262
+ }[];
263
+ sessionCount: number;
264
+ sessions: {
265
+ id: string;
266
+ noteId: string;
267
+ blockId: string;
268
+ status: "completed" | "in-progress" | undefined;
269
+ completed: boolean;
270
+ duration: number;
271
+ startTime: number;
272
+ }[];
273
+ }>;
274
+ declare const wodJournalAddTool: AgentToolSpec<z.ZodObject<{
275
+ date: z.ZodOptional<z.ZodString>;
276
+ title: z.ZodOptional<z.ZodString>;
277
+ content: z.ZodString;
278
+ sport: z.ZodOptional<z.ZodString>;
279
+ notebookId: z.ZodOptional<z.ZodString>;
280
+ }, z.core.$strip>, {
281
+ date: string;
282
+ noteId: string;
283
+ journalUrl: string;
284
+ note: {
285
+ id: string;
286
+ title: string;
287
+ sourceRevision: number;
288
+ blockCount: number;
289
+ effortSlugs: string[];
290
+ url: string;
291
+ };
292
+ }>;
293
+
294
+ declare const wodNotebookListTool: AgentToolSpec<z.ZodObject<{
295
+ origin: z.ZodOptional<z.ZodEnum<{
296
+ default: "default";
297
+ feed: "feed";
298
+ user: "user";
299
+ all: "all";
300
+ }>>;
301
+ }, z.core.$strip>, {
302
+ totalCount: number;
303
+ notebooks: {
304
+ url: string;
305
+ notebookId: string;
306
+ slug: string;
307
+ name: string;
308
+ description: string;
309
+ icon: string;
310
+ origin: "default" | "user" | "feed";
311
+ writable: boolean;
312
+ public: boolean;
313
+ noteCount: number;
314
+ id: string;
315
+ }[];
316
+ }>;
317
+ declare const wodNotebookSaveTool: AgentToolSpec<z.ZodObject<{
318
+ action: z.ZodEnum<{
319
+ create: "create";
320
+ update: "update";
321
+ promote: "promote";
322
+ detach: "detach";
323
+ "set-public": "set-public";
324
+ }>;
325
+ notebookId: z.ZodOptional<z.ZodString>;
326
+ name: z.ZodOptional<z.ZodString>;
327
+ description: z.ZodOptional<z.ZodString>;
328
+ icon: z.ZodOptional<z.ZodString>;
329
+ noteId: z.ZodOptional<z.ZodString>;
330
+ sessionIds: z.ZodOptional<z.ZodArray<z.ZodString>>;
331
+ public: z.ZodOptional<z.ZodBoolean>;
332
+ }, z.core.$strip>, {
333
+ action: "create";
334
+ notebookId: `notebook/${string}`;
335
+ slug: string;
336
+ name: string;
337
+ noteId?: undefined;
338
+ notebookIds?: undefined;
339
+ promotedSessionIds?: undefined;
340
+ public?: undefined;
341
+ } | {
342
+ action: "update";
343
+ notebookId: `notebook/${string}`;
344
+ slug: string;
345
+ name: string;
346
+ noteId?: undefined;
347
+ notebookIds?: undefined;
348
+ promotedSessionIds?: undefined;
349
+ public?: undefined;
350
+ } | {
351
+ action: "promote";
352
+ noteId: string;
353
+ notebookIds: `notebook/${string}`[];
354
+ promotedSessionIds: string[];
355
+ notebookId?: undefined;
356
+ slug?: undefined;
357
+ name?: undefined;
358
+ public?: undefined;
359
+ } | {
360
+ action: "detach";
361
+ noteId: string;
362
+ notebookIds: `notebook/${string}`[];
363
+ notebookId?: undefined;
364
+ slug?: undefined;
365
+ name?: undefined;
366
+ promotedSessionIds?: undefined;
367
+ public?: undefined;
368
+ } | {
369
+ action: "set-public";
370
+ notebookId: `notebook/${string}`;
371
+ public: boolean;
372
+ slug?: undefined;
373
+ name?: undefined;
374
+ noteId?: undefined;
375
+ notebookIds?: undefined;
376
+ promotedSessionIds?: undefined;
377
+ }>;
378
+ declare const wodNotebookDeleteTool: AgentToolSpec<z.ZodObject<{
379
+ notebookId: z.ZodString;
380
+ confirmId: z.ZodOptional<z.ZodString>;
381
+ }, z.core.$strip>, {
382
+ deleted: boolean;
383
+ notebookId: `notebook/${string}`;
384
+ slug: string;
385
+ }>;
386
+
387
+ declare const wodNoteListTool: AgentToolSpec<z.ZodObject<{
388
+ notebookId: z.ZodOptional<z.ZodString>;
389
+ search: z.ZodOptional<z.ZodString>;
390
+ tag: z.ZodOptional<z.ZodString>;
391
+ includeSeed: z.ZodOptional<z.ZodBoolean>;
392
+ limit: z.ZodOptional<z.ZodNumber>;
393
+ }, z.core.$strip>, {
394
+ totalCount: number;
395
+ notes: {
396
+ id: string;
397
+ title: string;
398
+ sourceRevision: number;
399
+ date: number | undefined;
400
+ createdAt: number;
401
+ editable: boolean;
402
+ notebooks: `notebook/${string}`[];
403
+ tags: string[];
404
+ wodBlockCount: number;
405
+ url: string;
406
+ }[];
407
+ }>;
408
+ declare const wodNoteGetTool: AgentToolSpec<z.ZodObject<{
409
+ noteId: z.ZodString;
410
+ }, z.core.$strip>, {
411
+ visibility: _bitcobblers_wod_wiki_core.PublicationVisibilitySummary;
412
+ url: string;
413
+ provenance?: ResolvedUpstreamProvenance | undefined;
414
+ id: string;
415
+ title: string;
416
+ rawContent: string;
417
+ portableMarkdown: string;
418
+ sourceRevision: number;
419
+ editable: boolean;
420
+ date: number | undefined;
421
+ createdAt: number;
422
+ tags: string[];
423
+ notebooks: `notebook/${string}`[];
424
+ blocks: {
425
+ content: string;
426
+ sport?: string | undefined;
427
+ dialect?: "time" | "log" | undefined;
428
+ id: string;
429
+ kind: _bitcobblers_wod_wiki_core.NoteBlockKind;
430
+ version: number;
431
+ }[];
432
+ sessionCount: number;
433
+ recentSessions: {
434
+ id: string;
435
+ blockId: string;
436
+ status: "completed" | "in-progress" | undefined;
437
+ completed: boolean;
438
+ duration: number;
439
+ startTime: number;
440
+ public: boolean;
441
+ }[];
442
+ }>;
443
+ declare const wodNoteUpsertTool: AgentToolSpec<z.ZodObject<{
444
+ noteId: z.ZodOptional<z.ZodString>;
445
+ title: z.ZodOptional<z.ZodString>;
446
+ content: z.ZodString;
447
+ sport: z.ZodOptional<z.ZodString>;
448
+ expectedSourceRevision: z.ZodOptional<z.ZodNumber>;
449
+ notebookId: z.ZodOptional<z.ZodString>;
450
+ journalDate: z.ZodOptional<z.ZodString>;
451
+ }, z.core.$strip>, {
452
+ id: string;
453
+ noteId: string;
454
+ title: string;
455
+ created: boolean;
456
+ sourceRevision: number;
457
+ blockCount: number;
458
+ effortSlugs: string[];
459
+ equipmentSlugs: string[];
460
+ tags: string[];
461
+ url: string;
462
+ }>;
463
+ declare const wodNoteCloneTool: AgentToolSpec<z.ZodObject<{
464
+ sourceNoteId: z.ZodString;
465
+ targetNotebookId: z.ZodOptional<z.ZodString>;
466
+ title: z.ZodOptional<z.ZodString>;
467
+ journalDate: z.ZodOptional<z.ZodString>;
468
+ }, z.core.$strip>, {
469
+ id: string;
470
+ noteId: string;
471
+ title: string;
472
+ sourceRevision: number;
473
+ targetNotebookId: `notebook/${string}`;
474
+ provenance: _bitcobblers_wod_wiki_core.NoteProvenance;
475
+ url: string;
476
+ }>;
477
+ declare const wodNoteDeleteTool: AgentToolSpec<z.ZodObject<{
478
+ noteId: z.ZodString;
479
+ confirmId: z.ZodOptional<z.ZodString>;
480
+ }, z.core.$strip>, {
481
+ deleted: boolean;
482
+ noteId: string;
483
+ reason: string;
484
+ title?: undefined;
485
+ } | {
486
+ deleted: boolean;
487
+ noteId: string;
488
+ title: string;
489
+ reason?: undefined;
490
+ }>;
491
+
492
+ declare const wodParseScriptTool: AgentToolSpec<z.ZodObject<{
493
+ source: z.ZodString;
494
+ sport: z.ZodOptional<z.ZodString>;
495
+ save: z.ZodOptional<z.ZodBoolean>;
496
+ noteId: z.ZodOptional<z.ZodString>;
497
+ title: z.ZodOptional<z.ZodString>;
498
+ notebookId: z.ZodOptional<z.ZodString>;
499
+ }, z.core.$strip>, {
500
+ savedNote?: {
501
+ noteId: string;
502
+ title: string;
503
+ sourceRevision: number;
504
+ created: boolean;
505
+ } | undefined;
506
+ valid: boolean;
507
+ blockCount: number;
508
+ blocks: {
509
+ valid: boolean;
510
+ errors: _bitcobblers_wod_wiki_core.ParseError[];
511
+ statementCount: number;
512
+ tree: StatementNode;
513
+ unresolvedChoices: {
514
+ statementIndex: number;
515
+ statementId: string | number;
516
+ choice: _bitcobblers_wod_wiki_lang.ChoiceGroupMetric;
517
+ }[];
518
+ collectibles: {
519
+ id?: number | string;
520
+ text: string;
521
+ metricType: string;
522
+ }[];
523
+ sport?: string | undefined;
524
+ index: number;
525
+ dialect: _bitcobblers_wod_wiki_core.FenceDialect;
526
+ }[];
527
+ }>;
528
+
529
+ declare const wodSessionRunHeadlessTool: AgentToolSpec<z.ZodObject<{
530
+ noteId: z.ZodOptional<z.ZodString>;
531
+ blockId: z.ZodOptional<z.ZodString>;
532
+ source: z.ZodOptional<z.ZodString>;
533
+ title: z.ZodOptional<z.ZodString>;
534
+ sport: z.ZodOptional<z.ZodString>;
535
+ journalDate: z.ZodOptional<z.ZodString>;
536
+ collectibles: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>>;
537
+ stepAdvanceMs: z.ZodOptional<z.ZodNumber>;
538
+ maxSteps: z.ZodOptional<z.ZodNumber>;
539
+ public: z.ZodOptional<z.ZodBoolean>;
540
+ }, z.core.$strip>, {
541
+ completed: boolean;
542
+ stepsExecuted: number;
543
+ durationMs: number;
544
+ eventCount: number;
545
+ summaryCount: number;
546
+ upstreamNoteId?: string | undefined;
547
+ sessionId: string;
548
+ noteId: string;
549
+ blockId: string;
550
+ blockVersion: number;
551
+ clonedFromReadOnly: boolean;
552
+ }>;
553
+ declare const wodSessionListTool: AgentToolSpec<z.ZodObject<{
554
+ noteId: z.ZodOptional<z.ZodString>;
555
+ completedOnly: z.ZodOptional<z.ZodBoolean>;
556
+ limit: z.ZodOptional<z.ZodNumber>;
557
+ }, z.core.$strip>, {
558
+ totalCount: number;
559
+ sessions: {
560
+ id: string;
561
+ noteId: string;
562
+ noteTitle: string;
563
+ blockId: string;
564
+ blockVersion: number;
565
+ status: "completed" | "in-progress" | undefined;
566
+ completed: boolean;
567
+ duration: number;
568
+ startTime: number;
569
+ endTime: number;
570
+ public: boolean;
571
+ }[];
572
+ }>;
573
+ declare const wodSessionGetTool: AgentToolSpec<z.ZodObject<{
574
+ sessionId: z.ZodString;
575
+ }, z.core.$strip>, {
576
+ session: Session;
577
+ noteTitle: string | undefined;
578
+ pinnedRevision: _bitcobblers_wod_wiki_core.BlockRevision | null;
579
+ eventCount: number;
580
+ summaryCount: number;
581
+ events: EventRecord[];
582
+ }>;
583
+ declare const wodSessionDeleteTool: AgentToolSpec<z.ZodObject<{
584
+ sessionId: z.ZodString;
585
+ confirmId: z.ZodOptional<z.ZodString>;
586
+ }, z.core.$strip>, {
587
+ deleted: boolean;
588
+ sessionId: string;
589
+ reason: string;
590
+ } | {
591
+ deleted: boolean;
592
+ sessionId: string;
593
+ reason?: undefined;
594
+ }>;
595
+
596
+ declare const wodValidateWqlTool: AgentToolSpec<z.ZodObject<{
597
+ query: z.ZodString;
598
+ targetHint: z.ZodOptional<z.ZodString>;
599
+ }, z.core.$strip>, {
600
+ family: "find" | "aggregate" | "pipeline";
601
+ target: string;
602
+ normalized: string | {
603
+ query: string;
604
+ advisories: string[];
605
+ };
606
+ allowedTargets: ("note" | "notebook" | "session" | "feed" | "page" | "equipment" | "event" | "effort" | "block" | "tag" | "segment")[];
607
+ allowedAggregators: ("count" | "sum" | "avg" | "min" | "max" | "last" | "delta")[];
608
+ allowedRollupPeriods: ("2w" | "4w")[];
609
+ validFilterKeys: string[];
610
+ validGroupingDimensions: string[];
611
+ error?: string | undefined;
612
+ valid: boolean;
613
+ }>;
614
+ declare const wodQueryWqlTool: AgentToolSpec<z.ZodObject<{
615
+ query: z.ZodString;
616
+ preferredUnit: z.ZodOptional<z.ZodString>;
617
+ limit: z.ZodOptional<z.ZodNumber>;
618
+ }, z.core.$strip>, {
619
+ kind: "pipeline-result";
620
+ query: string;
621
+ result: _bitcobblers_wod_wiki_wql.PipelineResult;
622
+ target?: undefined;
623
+ totalRuns?: undefined;
624
+ totalCount?: undefined;
625
+ runs?: undefined;
626
+ truncated?: undefined;
627
+ items?: undefined;
628
+ columns?: undefined;
629
+ } | {
630
+ kind: "rows-result";
631
+ target: string;
632
+ query: string;
633
+ totalRuns: number;
634
+ totalCount: number;
635
+ runs: _bitcobblers_wod_wiki_wql.RowsRun[];
636
+ truncated: boolean;
637
+ result?: undefined;
638
+ items?: undefined;
639
+ columns?: undefined;
640
+ } | {
641
+ kind: "find-result";
642
+ target: string;
643
+ query: string;
644
+ totalCount: number;
645
+ items: _bitcobblers_wod_wiki_lang.IEffort[];
646
+ truncated: boolean;
647
+ result?: undefined;
648
+ totalRuns?: undefined;
649
+ runs?: undefined;
650
+ columns?: undefined;
651
+ } | {
652
+ kind: "find-result";
653
+ target: string;
654
+ query: string;
655
+ columns: _bitcobblers_wod_wiki_wql.TabularColumn[];
656
+ totalCount: number;
657
+ items: Record<string, unknown>[];
658
+ truncated: boolean;
659
+ result?: undefined;
660
+ totalRuns?: undefined;
661
+ runs?: undefined;
662
+ } | {
663
+ kind: "find-result";
664
+ target: string;
665
+ query: string;
666
+ totalCount: number;
667
+ items: _bitcobblers_wod_wiki_core.BlockIndexRow[];
668
+ truncated: boolean;
669
+ result?: undefined;
670
+ totalRuns?: undefined;
671
+ runs?: undefined;
672
+ columns?: undefined;
673
+ } | {
674
+ kind: "find-result";
675
+ target: string;
676
+ query: string;
677
+ totalCount: number;
678
+ items: _bitcobblers_wod_wiki_core.Note[];
679
+ truncated: boolean;
680
+ result?: undefined;
681
+ totalRuns?: undefined;
682
+ runs?: undefined;
683
+ columns?: undefined;
684
+ } | {
685
+ kind: "query-result";
686
+ query: string;
687
+ result: _bitcobblers_wod_wiki_wql.QueryResult;
688
+ target?: undefined;
689
+ totalRuns?: undefined;
690
+ totalCount?: undefined;
691
+ runs?: undefined;
692
+ truncated?: undefined;
693
+ items?: undefined;
694
+ columns?: undefined;
695
+ }>;
696
+
697
+ type AnyAgentToolSpec = AgentToolSpec<any, any>;
698
+ declare const DOMAIN_AGENT_TOOLS: readonly AnyAgentToolSpec[];
699
+ declare const DOMAIN_AGENT_TOOLS_BY_NAME: ReadonlyMap<string, AnyAgentToolSpec>;
700
+ interface AgentToolManifestEntry {
701
+ name: string;
702
+ title: string;
703
+ description: string;
704
+ tier: AgentRiskTier;
705
+ domain: AgentDomainName;
706
+ surfaces: Array<'webmcp' | 'mcp' | 'cli'>;
707
+ cliEquivalent: string;
708
+ annotations: AgentToolAnnotations;
709
+ inputSchema: Record<string, unknown>;
710
+ }
711
+ interface AgentUiToolManifestEntry {
712
+ name: string;
713
+ title: string;
714
+ description: string;
715
+ tier: AgentRiskTier;
716
+ surfaces: Array<'webmcp'>;
717
+ mountScope: string;
718
+ annotations: AgentToolAnnotations;
719
+ inputSchema: Record<string, unknown>;
720
+ }
721
+ interface AgentCapabilitiesManifest {
722
+ schemaVersion: string;
723
+ name: string;
724
+ description: string;
725
+ surfaces: {
726
+ webmcp: {
727
+ supported: boolean;
728
+ globalNamespace: 'navigator.modelContext';
729
+ library: '@mcp-b/react-webmcp';
730
+ };
731
+ mcp: {
732
+ httpEndpoint: string;
733
+ stdioCommand: string;
734
+ sdk: '@modelcontextprotocol/sdk';
735
+ };
736
+ cli: {
737
+ binary: string;
738
+ jsonFlag: '--json';
739
+ confirmationExitCode: 4;
740
+ };
741
+ };
742
+ domainTools: AgentToolManifestEntry[];
743
+ uiTools?: AgentUiToolManifestEntry[];
744
+ resources: Array<{
745
+ uri: string;
746
+ name: string;
747
+ description: string;
748
+ mimeType: string;
749
+ }>;
750
+ prompts: Array<{
751
+ name: string;
752
+ title: string;
753
+ description: string;
754
+ arguments: Array<{
755
+ name: string;
756
+ description: string;
757
+ required: boolean;
758
+ }>;
759
+ }>;
760
+ }
761
+ declare const WHITEBOARD_SCRIPT_REFERENCE_MARKDOWN = "# Whiteboard Language Reference\n\nFence tags: ```time (optional sport suffix e.g. ```time:cardio, ```time:crossfit, ```time:climb) or ```log.\n\n## Core Tokens & Metrics\n- **Timestamps / Durations**: `20:00` (20 min countdown), `:30` (30 sec), `1:05:00` (1 hr 5 min).\n- **Timers & Rounds**: `(21-15-9)` rep scheme, `5 Rounds`, `EMOM 10:00`, `Tabata`, `AMRAP 12:00`.\n- **Reps & Resistance**: `21 Thrusters @95lb`, `5x5 Back Squat @80%`, `15 Kettlebell Swings @24kg`.\n- **Distance**: `400m Run`, `2km Row`, `50ft Handstand Walk`.\n- **Action Modifiers**: `[:Rest 1:00]`, `+Compose`.\n- **Grouping / Indentation**: Indent child movements by 2 spaces beneath timer or round headers.\n\n## Canonical Example\n```time\n# Fran\n(21-15-9)\n Thrusters @95lb\n Pull-ups\n```\n";
762
+ declare function buildWqlReferenceObject(): Record<string, unknown>;
763
+ declare const AGENT_STATIC_RESOURCES: readonly [{
764
+ readonly uri: "wod://schema/whiteboard-script";
765
+ readonly name: "Whiteboard Language Reference";
766
+ readonly description: "Compact syntax, metric token, and fence-tag guide for authoring Whiteboard Language workouts.";
767
+ readonly mimeType: "text/markdown";
768
+ }, {
769
+ readonly uri: "wod://schema/wql";
770
+ readonly name: "WQL Grammar & Capabilities";
771
+ readonly description: "Machine-readable WQL targets, aggregators, filter keys, metric families, and examples.";
772
+ readonly mimeType: "application/json";
773
+ }, {
774
+ readonly uri: "wod://notebooks";
775
+ readonly name: "Notebooks Snapshot";
776
+ readonly description: "Current local and subscribed feed notebooks with member counts.";
777
+ readonly mimeType: "application/json";
778
+ }];
779
+ declare const AGENT_RESOURCE_TEMPLATES: readonly [{
780
+ readonly uriTemplate: "wod://note/{noteId}";
781
+ readonly name: "Workout Note by ID";
782
+ readonly description: "Full Markdown source, block map, tags, and recent sessions for a Note.";
783
+ readonly mimeType: "application/json";
784
+ }, {
785
+ readonly uriTemplate: "wod://journal/{date}";
786
+ readonly name: "Journal Day Stream";
787
+ readonly description: "Scheduled notes and logged sessions for YYYY-MM-DD or today.";
788
+ readonly mimeType: "application/json";
789
+ }, {
790
+ readonly uriTemplate: "wod://session/{sessionId}";
791
+ readonly name: "Workout Session Detail";
792
+ readonly description: "Session record and full segment/summary event ledger.";
793
+ readonly mimeType: "application/json";
794
+ }];
795
+ declare const AGENT_PROMPTS: readonly [{
796
+ readonly name: "encode-workout";
797
+ readonly title: "Encode Plain-Text Workout into Whiteboard Language";
798
+ readonly description: "Convert unstructured workout text into valid ```wod Markdown and verify with wod_parse_script.";
799
+ readonly arguments: readonly [{
800
+ readonly name: "workoutText";
801
+ readonly description: "Plain-text description of the workout to encode.";
802
+ readonly required: true;
803
+ }, {
804
+ readonly name: "sport";
805
+ readonly description: "Optional sport dialect (e.g. crossfit, running, weightlifting).";
806
+ readonly required: false;
807
+ }];
808
+ }, {
809
+ readonly name: "analyze-training-load";
810
+ readonly title: "Analyze Recent Training Load via WQL";
811
+ readonly description: "Inspect recent sessions, volume rollups, and movement balance over a date window.";
812
+ readonly arguments: readonly [{
813
+ readonly name: "window";
814
+ readonly description: "Relative WQL window such as 7d, 30d, or 90d (defaults to 30d).";
815
+ readonly required: false;
816
+ }];
817
+ }, {
818
+ readonly name: "program-journal-day";
819
+ readonly title: "Program a Training Day on the Journal";
820
+ readonly description: "Review recent training history, avoid movement interference, and schedule a workout on a date.";
821
+ readonly arguments: readonly [{
822
+ readonly name: "date";
823
+ readonly description: "Target civil date YYYY-MM-DD or today.";
824
+ readonly required: false;
825
+ }, {
826
+ readonly name: "goal";
827
+ readonly description: "Training focus, time cap, or equipment constraints.";
828
+ readonly required: false;
829
+ }];
830
+ }];
831
+ declare function readAgentResource(uri: string, ctx: AgentDomainContext): Promise<{
832
+ uri: string;
833
+ mimeType: string;
834
+ text: string;
835
+ }>;
836
+ declare function renderAgentPrompt(name: string, args?: Record<string, string | undefined>): {
837
+ description: string;
838
+ messages: Array<{
839
+ role: 'user';
840
+ content: {
841
+ type: 'text';
842
+ text: string;
843
+ };
844
+ }>;
845
+ };
846
+ declare function zodSchemaToJsonSchema(schema: z.ZodType): Record<string, unknown>;
847
+ declare function exportAgentCapabilitiesManifest(options?: {
848
+ uiTools?: AgentUiToolManifestEntry[];
849
+ }): AgentCapabilitiesManifest;
850
+
851
+ export { AGENT_PROMPTS, AGENT_RESOURCE_TEMPLATES, AGENT_STATIC_RESOURCES, type AgentCapabilitiesManifest, type AgentConfirmationRequest, AgentConfirmationRequiredError, type AgentDomainContext, type AgentDomainName, type AgentRiskTier, type AgentToolAnnotations, type AgentToolManifestEntry, type AgentToolSpec, type AgentUiToolManifestEntry, type AnyAgentToolSpec, DOMAIN_AGENT_TOOLS, DOMAIN_AGENT_TOOLS_BY_NAME, type UpsertNoteInStorageInput, type UpsertNoteInStorageResult, WHITEBOARD_SCRIPT_REFERENCE_MARKDOWN, buildWqlReferenceObject, civilDateKey, createQueryServiceForStorage, defineAgentTool, deleteNoteFromStorage, deleteSessionFromStorage, exportAgentCapabilitiesManifest, normalizeMarkdownOrBareScript, noteDeepLink, readAgentResource, renderAgentPrompt, requireDestructiveConfirmation, upsertNoteInStorage, wodCatalogLookupTool, wodCatalogUpsertTool, wodExportBundleTool, wodFeedManageTool, wodJournalAddTool, wodJournalDayTool, wodNoteCloneTool, wodNoteDeleteTool, wodNoteGetTool, wodNoteListTool, wodNoteUpsertTool, wodNotebookDeleteTool, wodNotebookListTool, wodNotebookSaveTool, wodParseScriptTool, wodQueryWqlTool, wodResetStorageTool, wodSessionDeleteTool, wodSessionGetTool, wodSessionListTool, wodSessionRunHeadlessTool, wodValidateWqlTool, zodSchemaToJsonSchema };