@bitcobblers/wod-wiki-engine 0.59.2246 → 0.60.2248

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.
package/dist/agent.d.cts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { z } from 'zod';
2
2
  import { IStorage, StoreName } from '@bitcobblers/wod-wiki-storage';
3
- import { F as FeedTree, P as PortableFileEntry, a as FeedSubscriptionEntry, R as ResolvedUpstreamProvenance, S as StatementNode } from './ir-CQnh_Tid.cjs';
3
+ import { F as FeedTree, P as PortableFileEntry, a as FeedSubscriptionEntry, R as ResolvedUpstreamProvenance, S as StatementNode } from './ir-B46Q9icI.cjs';
4
4
  import * as _bitcobblers_wod_wiki_core from '@bitcobblers/wod-wiki-core';
5
5
  import { Note, Session, EventRecord } from '@bitcobblers/wod-wiki-core';
6
6
  import * as _bitcobblers_wod_wiki_wql from '@bitcobblers/wod-wiki-wql';
@@ -59,6 +59,8 @@ interface AgentDomainContext {
59
59
  feedLifecycle?: AgentFeedLifecycleAdapter;
60
60
  /** Surface-specific Tier 2 gate (Radix modal in WebMCP, elicitation in MCP, --yes in CLI). */
61
61
  confirmDestructive?: (req: AgentConfirmationRequest) => Promise<boolean>;
62
+ /** Optional timeout (ms) before an unresolved `confirmDestructive` rejects with `AgentConfirmationRequiredError`. */
63
+ confirmTimeoutMs?: number;
62
64
  /** Optional hook run after writes (e.g. cache invalidation in Playground, domain refresh in SQL). */
63
65
  onMutated?: (stores: readonly StoreName[]) => Promise<void> | void;
64
66
  }
@@ -496,7 +498,10 @@ declare const wodNoteGetTool: AgentToolSpec<z.ZodObject<{
496
498
  date: number | undefined;
497
499
  createdAt: number;
498
500
  tags: string[];
499
- notebooks: `notebook/${string}`[];
501
+ notebooks: {
502
+ id: `notebook/${string}`;
503
+ slug: string;
504
+ }[];
500
505
  blocks: {
501
506
  content: string;
502
507
  sport?: string | undefined;
package/dist/agent.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { z } from 'zod';
2
2
  import { IStorage, StoreName } from '@bitcobblers/wod-wiki-storage';
3
- import { F as FeedTree, P as PortableFileEntry, a as FeedSubscriptionEntry, R as ResolvedUpstreamProvenance, S as StatementNode } from './ir-CQnh_Tid.js';
3
+ import { F as FeedTree, P as PortableFileEntry, a as FeedSubscriptionEntry, R as ResolvedUpstreamProvenance, S as StatementNode } from './ir-B46Q9icI.js';
4
4
  import * as _bitcobblers_wod_wiki_core from '@bitcobblers/wod-wiki-core';
5
5
  import { Note, Session, EventRecord } from '@bitcobblers/wod-wiki-core';
6
6
  import * as _bitcobblers_wod_wiki_wql from '@bitcobblers/wod-wiki-wql';
@@ -59,6 +59,8 @@ interface AgentDomainContext {
59
59
  feedLifecycle?: AgentFeedLifecycleAdapter;
60
60
  /** Surface-specific Tier 2 gate (Radix modal in WebMCP, elicitation in MCP, --yes in CLI). */
61
61
  confirmDestructive?: (req: AgentConfirmationRequest) => Promise<boolean>;
62
+ /** Optional timeout (ms) before an unresolved `confirmDestructive` rejects with `AgentConfirmationRequiredError`. */
63
+ confirmTimeoutMs?: number;
62
64
  /** Optional hook run after writes (e.g. cache invalidation in Playground, domain refresh in SQL). */
63
65
  onMutated?: (stores: readonly StoreName[]) => Promise<void> | void;
64
66
  }
@@ -496,7 +498,10 @@ declare const wodNoteGetTool: AgentToolSpec<z.ZodObject<{
496
498
  date: number | undefined;
497
499
  createdAt: number;
498
500
  tags: string[];
499
- notebooks: `notebook/${string}`[];
501
+ notebooks: {
502
+ id: `notebook/${string}`;
503
+ slug: string;
504
+ }[];
500
505
  blocks: {
501
506
  content: string;
502
507
  sport?: string | undefined;
package/dist/agent.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { buildQueryServiceStoresFromStorage, extractNoteIdentity, extractTypedTags, makeNotebookLinkId, resolveScopedPropertyCatalog, effortToMarkdown, equipmentToMarkdown, saveScopedPropertyOverride, listFeedSubscriptionsHeadless, seedMetaKey, subscribeFeedSourceHeadless, unsubscribeFeedSourceHeadless, deleteFeedSourceHeadless, checkUnpublishedFeedChanges, MemoryFeedTree, publishFeedFromStorage, ingestPortableFilesIntoStorage, exportPortableFilesFromStorage, readFrontmatterMeta, createUserNotebookLanding, setNotebookPublic, promoteNoteToNotebooks, removeNoteFromNotebook, getNoteNotebooks, resolveUpstreamProvenance, getNotePublicationSummary, composeNoteMarkdown, buildNoteProvenance, buildStatementTree, prepareJournalSessionRun, setSessionPublic } from './chunk-E6Y2XOUM.mjs';
1
+ import { buildQueryServiceStoresFromStorage, extractNoteIdentity, extractTypedTags, makeNotebookLinkId, resolveScopedPropertyCatalog, effortToMarkdown, equipmentToMarkdown, saveScopedPropertyOverride, listFeedSubscriptionsHeadless, seedMetaKey, subscribeFeedSourceHeadless, unsubscribeFeedSourceHeadless, deleteFeedSourceHeadless, checkUnpublishedFeedChanges, MemoryFeedTree, publishFeedFromStorage, ingestPortableFilesIntoStorage, exportPortableFilesFromStorage, readFrontmatterMeta, createUserNotebookLanding, setNotebookPublic, promoteNoteToNotebooks, removeNoteFromNotebook, getNoteNotebooks, resolveUpstreamProvenance, getNotePublicationSummary, composeNoteMarkdown, buildNoteProvenance, buildStatementTree, prepareJournalSessionRun, setSessionPublic } from './chunk-JRPNOWDS.mjs';
2
2
  import { BUILTIN_NOTEBOOKS, parseDocumentSections, KNOWN_SECTION_WIDGETS, isNoteEditable, reconcileNoteBlocks, validateNoteBlocks, toNotebookId, blockContentId, MetricType, orderPlacements, isSystemReadOnlyNotebook, notebookSlugFromId, isNonPublishableNotebook } from '@bitcobblers/wod-wiki-core';
3
3
  import { bundledEfforts, createReferenceIndex, parseScript, extractStatementRefs, createParser, findUnresolvedChoices, createMockClock, RuntimeStack, EventBus, frozenNow, ScriptRuntime, createCompiler, createAnalyticsEngineForBlock, StartSessionAction, NextEvent, toStoredOutputStatement } from '@bitcobblers/wod-wiki-lang';
4
4
  import { rowsEqual, userDeletedSeedKey } from '@bitcobblers/wod-wiki-storage';
@@ -27,7 +27,16 @@ async function requireDestructiveConfirmation(ctx, req, explicitConfirmId) {
27
27
  return;
28
28
  }
29
29
  if (ctx.confirmDestructive) {
30
- const approved = await ctx.confirmDestructive(req);
30
+ const timeoutMs = ctx.confirmTimeoutMs ?? 1500;
31
+ let timer;
32
+ const approved = await Promise.race([
33
+ ctx.confirmDestructive(req).finally(() => {
34
+ if (timer !== void 0) clearTimeout(timer);
35
+ }),
36
+ new Promise((resolve) => {
37
+ timer = setTimeout(() => resolve(false), timeoutMs);
38
+ })
39
+ ]);
31
40
  if (approved) return;
32
41
  throw new AgentConfirmationRequiredError(
33
42
  req,
@@ -1133,7 +1142,6 @@ var wodNotebookListTool = defineAgentTool({
1133
1142
  if (link.targetKind === "note") bump(toNotebookId(link.notebookId), link.noteId);
1134
1143
  }
1135
1144
  for (const n of allNotes) {
1136
- if (isLandingNote(n)) continue;
1137
1145
  for (const nbId of notebooksOfItem(n)) {
1138
1146
  bump(toNotebookId(nbId), n.id);
1139
1147
  }
@@ -1177,7 +1185,7 @@ var wodNotebookListTool = defineAgentTool({
1177
1185
  const notebooks = [...byId.values()].filter((nb) => filterOrigin === "all" || nb.origin === filterOrigin).map((nb) => ({
1178
1186
  id: nb.notebookId,
1179
1187
  ...nb,
1180
- url: `${prefix}/notebooks/${encodeURIComponent(nb.slug)}`
1188
+ url: `${prefix}/notebook/${encodeURIComponent(nb.slug)}`
1181
1189
  }));
1182
1190
  return {
1183
1191
  totalCount: notebooks.length,
@@ -1526,7 +1534,7 @@ var wodNoteGetTool = defineAgentTool({
1526
1534
  date: note.date,
1527
1535
  createdAt: note.createdAt,
1528
1536
  tags: note.tags ?? [],
1529
- notebooks,
1537
+ notebooks: notebooks.map((id) => ({ id, slug: notebookSlugFromId(id) })),
1530
1538
  blocks,
1531
1539
  sessionCount: sessions.length,
1532
1540
  recentSessions: sessions.sort((a, b) => b.startTime - a.startTime).slice(0, 10).map((s) => ({
@@ -1952,6 +1960,9 @@ var wodSessionRunHeadlessTool = defineAgentTool({
1952
1960
  outputs.push(out);
1953
1961
  });
1954
1962
  runtime.do(new StartSessionAction());
1963
+ if (stack.current?.key.toString().startsWith("waiting-to-start")) {
1964
+ runtime.handle(new NextEvent(void 0, { nowMs: () => clock.currentDate.getTime(), now: () => clock.currentDate }));
1965
+ }
1955
1966
  const stepAdvanceMs = args.stepAdvanceMs ?? 1e4;
1956
1967
  const maxSteps = args.maxSteps ?? 500;
1957
1968
  let steps = 0;