@vibes.diy/api-svc 14.3.85 → 14.3.87

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.
Files changed (106) hide show
  1. package/create-handler.js +2 -0
  2. package/create-handler.js.map +1 -1
  3. package/index.d.ts +3 -1
  4. package/index.js +3 -1
  5. package/index.js.map +1 -1
  6. package/intern/agent-account-tools.d.ts +1 -0
  7. package/intern/agent-account-tools.js +1 -0
  8. package/intern/agent-account-tools.js.map +1 -1
  9. package/intern/agent-assembly.js +5 -1
  10. package/intern/agent-assembly.js.map +1 -1
  11. package/intern/agent-belt.d.ts +1 -3
  12. package/intern/agent-belt.js +25 -21
  13. package/intern/agent-belt.js.map +1 -1
  14. package/intern/agent-build-tools.d.ts +7 -0
  15. package/intern/agent-build-tools.js +6 -2
  16. package/intern/agent-build-tools.js.map +1 -1
  17. package/intern/agent-closing-options.d.ts +26 -0
  18. package/intern/agent-closing-options.js +130 -0
  19. package/intern/agent-closing-options.js.map +1 -0
  20. package/intern/agent-dispatcher.d.ts +1 -0
  21. package/intern/agent-dispatcher.js +17 -3
  22. package/intern/agent-dispatcher.js.map +1 -1
  23. package/intern/agent-session-instruction.d.ts +3 -2
  24. package/intern/agent-session-instruction.js +9 -7
  25. package/intern/agent-session-instruction.js.map +1 -1
  26. package/intern/agent-turn.d.ts +1 -0
  27. package/intern/agent-turn.js +1 -0
  28. package/intern/agent-turn.js.map +1 -1
  29. package/intern/alt-first-build.d.ts +48 -0
  30. package/intern/alt-first-build.js +179 -0
  31. package/intern/alt-first-build.js.map +1 -0
  32. package/intern/alt-landing.d.ts +13 -0
  33. package/intern/alt-landing.js +55 -0
  34. package/intern/alt-landing.js.map +1 -0
  35. package/intern/first-brief.d.ts +1 -1
  36. package/intern/first-brief.js +1 -1
  37. package/intern/first-brief.js.map +1 -1
  38. package/intern/first-build-classifier.d.ts +4 -4
  39. package/intern/first-build-classifier.js +15 -17
  40. package/intern/first-build-classifier.js.map +1 -1
  41. package/intern/first-build-race.d.ts +71 -0
  42. package/intern/first-build-race.js +257 -0
  43. package/intern/first-build-race.js.map +1 -0
  44. package/intern/instruction-variant.d.ts +23 -2
  45. package/intern/instruction-variant.js +159 -2
  46. package/intern/instruction-variant.js.map +1 -1
  47. package/intern/keeps-to-themselves.d.ts +1 -0
  48. package/intern/keeps-to-themselves.js +10 -0
  49. package/intern/keeps-to-themselves.js.map +1 -0
  50. package/intern/llm-tool-loop.d.ts +5 -1
  51. package/intern/llm-tool-loop.js +48 -15
  52. package/intern/llm-tool-loop.js.map +1 -1
  53. package/intern/mercury-capability-triggers.d.ts +1 -0
  54. package/intern/mercury-capability-triggers.js +95 -0
  55. package/intern/mercury-capability-triggers.js.map +1 -0
  56. package/intern/mercury-first-build-seam.d.ts +40 -5
  57. package/intern/mercury-first-build-seam.js +201 -14
  58. package/intern/mercury-first-build-seam.js.map +1 -1
  59. package/intern/mercury-first-build.d.ts +591 -21
  60. package/intern/mercury-first-build.js +2998 -287
  61. package/intern/mercury-first-build.js.map +1 -1
  62. package/intern/mercury-resilience.d.ts +70 -0
  63. package/intern/mercury-resilience.js +122 -0
  64. package/intern/mercury-resilience.js.map +1 -0
  65. package/intern/mint-decision.d.ts +1 -0
  66. package/intern/mint-decision.js +3 -0
  67. package/intern/mint-decision.js.map +1 -1
  68. package/intern/option-line-hold.d.ts +5 -0
  69. package/intern/option-line-hold.js +39 -0
  70. package/intern/option-line-hold.js.map +1 -0
  71. package/intern/pouf-room-catalog.d.ts +2 -0
  72. package/intern/pouf-room-catalog.js +11 -0
  73. package/intern/pouf-room-catalog.js.map +1 -0
  74. package/intern/retire-offer-options.d.ts +3 -0
  75. package/intern/retire-offer-options.js +91 -0
  76. package/intern/retire-offer-options.js.map +1 -0
  77. package/intern/seed-chat-section.d.ts +13 -0
  78. package/intern/seed-chat-section.js +62 -0
  79. package/intern/seed-chat-section.js.map +1 -1
  80. package/intern/server-first-build.js +1 -0
  81. package/intern/server-first-build.js.map +1 -1
  82. package/intern/vibe-font-catalog.d.ts +2 -0
  83. package/intern/vibe-font-catalog.js +8 -0
  84. package/intern/vibe-font-catalog.js.map +1 -0
  85. package/package.json +14 -14
  86. package/public/agent-turn-action.d.ts +1 -0
  87. package/public/agent-turn-action.js +256 -62
  88. package/public/agent-turn-action.js.map +1 -1
  89. package/public/agent-turn-assembly.js +5 -2
  90. package/public/agent-turn-assembly.js.map +1 -1
  91. package/public/prompt-chat-section.js +7 -5
  92. package/public/prompt-chat-section.js.map +1 -1
  93. package/public/prompt-turn-terminal.js +3 -1
  94. package/public/prompt-turn-terminal.js.map +1 -1
  95. package/public/report-activity.js +18 -2
  96. package/public/report-activity.js.map +1 -1
  97. package/public/vibe-traffic-source.js +1 -1
  98. package/public/vibe-traffic-source.js.map +1 -1
  99. package/types.d.ts +1 -0
  100. package/types.js.map +1 -1
  101. package/usage-report/new-user-alert-util.d.ts +6 -0
  102. package/usage-report/new-user-alert-util.js +30 -1
  103. package/usage-report/new-user-alert-util.js.map +1 -1
  104. package/intern/agent-options-tool.d.ts +0 -27
  105. package/intern/agent-options-tool.js +0 -213
  106. package/intern/agent-options-tool.js.map +0 -1
@@ -2,14 +2,25 @@ import { Result } from "@adviser/cement";
2
2
  import type { CreateVibeToolInput, AppNature } from "@vibes.diy/api-types";
3
3
  import type { LLMMessage } from "@vibes.diy/call-ai-v2";
4
4
  import type { VibesApiSQLCtx } from "../types.js";
5
+ import { MercuryCircuitBreaker, type MercuryFallbackCause } from "./mercury-resilience.js";
5
6
  export declare const MERCURY_FIRST_BUILD_MODEL = "inception/mercury-2.5";
6
7
  export declare const MERCURY_FIRST_BUILD_REASONING: {
7
8
  readonly effort: "none";
8
9
  };
10
+ export type MercuryPlanner = "mercury" | "opus" | "haiku";
11
+ export declare const MERCURY_OPUS_PLANNER_MODEL = "~anthropic/claude-opus-latest";
12
+ export declare const MERCURY_OPUS_PLANNER_DEADLINE_MS = 240000;
13
+ export declare const MERCURY_OPUS_PLANNER_BUDGET_MS = 300000;
14
+ export declare const MERCURY_OPUS_PLANNER_FANOUT = 1;
15
+ export declare const MERCURY_OPUS_PLANNER_MAX_TOKENS = 8000;
16
+ export declare const MERCURY_OPUS_PLANNER_BREAKER: MercuryCircuitBreaker;
17
+ export declare const MERCURY_HAIKU_PLANNER_MODEL = "anthropic/claude-haiku-5.5";
18
+ export declare const MERCURY_HAIKU_PLANNER_DEADLINE_MS = 40000;
19
+ export declare const MERCURY_HAIKU_PLANNER_BUDGET_MS = 50000;
20
+ export declare const MERCURY_HAIKU_PLANNER_BREAKER: MercuryCircuitBreaker;
9
21
  export declare const MERCURY_CALL_DEADLINE_MS = 8000;
10
22
  export declare const MERCURY_CALL_ATTEMPTS = 2;
11
23
  export declare const MERCURY_TRANSIENT_RETRIES = 3;
12
- export declare const MERCURY_TRANSIENT_BACKOFF_MS = 400;
13
24
  export declare const MERCURY_ARCHETYPES: readonly ["personal", "group", "publish", "intake", "open", "toy"];
14
25
  export type MercuryArchetype = (typeof MERCURY_ARCHETYPES)[number];
15
26
  export declare const MERCURY_FLAGS: readonly ["ai", "composer", "imageGen", "backend", "calendar", "audio", "threeD", "charts", "boardGame", "sensitive"];
@@ -21,6 +32,7 @@ export interface MercuryShape {
21
32
  readonly who: string;
22
33
  readonly recordNames: readonly string[];
23
34
  readonly flags: Readonly<Record<MercuryFlag, boolean>>;
35
+ readonly keepsToThemselves?: boolean;
24
36
  }
25
37
  export interface MercuryBriefFields {
26
38
  readonly opening: string;
@@ -37,29 +49,161 @@ export type MercuryBriefField = keyof MercuryBriefFields;
37
49
  export declare const MERCURY_BRIEF_FIELDS: readonly MercuryBriefField[];
38
50
  export declare const MERCURY_SHAPE_SYSTEM = "You classify a person's one-message request for a small web app before a build brief is written. Return only JSON.\n\narchetype, exactly one:\n- personal: one person's own tool (\"for me\", \"my\", \"private\", a tracker, a log, a list, a journal) with no other people named.\n- group: the person names other people who use it with them (we, our, friends, family, team, club, kids, housemates, partner, members, a foursome).\n- publish: the person writes and other people only read (a blog, menu, gallery, portfolio, schedule, zine, \"everyone can read\").\n- intake: strangers or customers submit something without signing up and the person sees the submissions (orders, bookings, requests, sign-ups, replies, reports from the public).\n- open: anyone with the link joins in and adds their own bit (a shared wall, canvas, feed, leaderboard game, community board, swap board, \"anyone can post\").\n- toy: a game, simulator, visual, sound or generator that keeps little or nothing (scores at most).\nTie-breaks: group means other people open the app on their own devices; a calculator, splitter or tool used on one phone \"with friends\" at the table is personal. toy is for games, simulators and visual or sound toys; a tool that analyzes, estimates, designs, counts, tracks or logs stores records and is personal. A \"feed of information\" pulled from the internet is personal with backend true. A test or nonsense phrase is still a request: make the most playful literal app of it (a \"squash bloom soothsayer\" is a fortune teller about squash) and classify that.\n\ncoreAction: the one thing the person does most in this app, as a short verb phrase in their own words (\"tap once per glass\", \"paste the group chat\", \"lasso cows\"). It becomes the biggest control on the first screen.\nkind: 2-6 word noun phrase for the app in the person's own nouns. who: who it is for, 2-8 words.\nrecordNames: 1-5 short singular record type names the app stores (toys may have just \"score\" or none).\nflags, each true only when the request itself needs it:\n- ai: the app must read, write or judge free text or photos with a language model (extract facts from pasted words, answer questions, generate text, chat, analyze a picture, suggest recipes).\n- composer: ai is true AND the person types or pastes their own words or photos as the way records get in.\n- imageGen: the app generates pictures.\n- backend: server work the page cannot do: scheduled reminders or digests, a live feed pulled from outside, secret dealing, email.\n- calendar: dates on a calendar, bookings by slot, recurring events, paystub periods.\n- audio: sound or music playback or synthesis.\n- threeD: 3D graphics, a simulator, a world you move through.\n- charts: heatmaps, graphs, statistics views.\n- boardGame: a turn-based card or board game.\n- sensitive: health, money of real people, kids, or the word private.";
39
51
  export declare function mercuryShapeSchema(): Record<string, unknown>;
40
- export declare function mercuryNonce(): string;
41
52
  export declare function mercuryShapeMessages(o: {
42
53
  readonly personWords: string;
43
- readonly nonce: string;
44
54
  }): LLMMessage[];
45
55
  export declare function parseMercuryShape(raw: unknown): Result<MercuryShape>;
46
- export declare function fixMercuryShape(shape: MercuryShape, personWords: string): MercuryShape;
47
- export declare const MERCURY_EXEMPLAR_FIELD = "## How to read this field\n\nEvery brief has the same parts, in this order. Below, each part is shown as a SPREAD of alternatives, side by side. Each row is tagged with the ownership archetype it fits:\n\n- [personal] one person's own tool: private, records keyed to their own object so a friend could be let in later.\n- [group] a named set of people (friends, family, team, club, housemates): the owner invites them by handle, members read and write; the invite screen is part of this first build.\n- [publish] the owner writes, everyone reads: a blog, menu, gallery, zine, schedule.\n- [intake] strangers submit without signing in (orders, bookings, requests, RSVPs); the owner sees and manages what came in.\n- [open] anyone with the link joins and writes their own bit: a shared wall, a canvas, a leaderboard game. Each person edits what they made.\n- [toy] a game or visual that keeps little or nothing: scores or a save slot at most.\n\nPick the rows that match the archetype you were given. Take every noun from the person's own words.\n\n## 1. Opening \u2014 one sentence: what it is and who it is for\n\n- [personal] A glaze test notebook for a home potter.\n- [personal] A sourdough starter log for one baker's kitchen.\n- [group] A tool library for one neighbourhood block, shared by the households on it.\n- [group] A setlist planner for a four-piece cover band.\n- [publish] A taco truck menu board the owner updates from their phone and customers read.\n- [publish] A micro-poetry zine where one editor posts and everyone reads.\n- [intake] An appointment book for a dog grooming salon: clients book without signing up, the groomer sees every slot.\n- [intake] A repair drop-off form for a bike shop, with the owner's queue on the other side.\n- [open] A lost-and-found board for a music festival that anyone with the link can post to.\n- [open] A wedding photo wall where every guest drops pictures from their phone.\n- [toy] A hex-grid pong game with a slow-motion ball and a local best score.\n- [toy] A kaleidoscope you steer with the mouse, with nothing saved.\n\n## 2. Ownership and access \u2014 who owns what, who gets in, who sees what\n\n- [personal] Each signed-in person has their own notebook object (keyed on their handle, named for the app, renameable in settings); glazes and tiles carry the notebook id so a studio mate could be let in later. The creator reads and writes it alone.\n- [personal] The person's own starter log is ready on arrival. Feedings belong to that log; rules key on its creator, so the entries stay theirs, shaped so a housemate could be admitted later.\n- [group] Each signed-in person starts with their own block library object. Households are let in with the platform's HandleInput invite screen, which writes a membership into the library; members read every tool and write their own loans. The library list shows shared ones with ViewerTag.\n- [group] The owner's band object holds memberships for the other three players, written by the HandleInput invite screen. Any member adds songs and reorders the set; the creator manages members and deletes songs.\n- [publish] The owner's menu object is keyed on their handle. Menu items are written by the owner and readable by everyone, signed in or not. Shaped so a co-owner could be let in later.\n- [publish] One editor owns the zine; poem records are creator-writable and world-readable. Readers see the issues.\n- [intake] Two sides. Clients book anonymously: anyone, signed in or not, can create a booking record on the salon object and reads back the confirmation they just made. The groomer, signed in as the salon's owner, reads and updates every booking.\n- [intake] Drop-off requests are created by visitors without accounts; each request is readable by the shop owner (and staff let in later by membership). The public form page shows the visitor their own request.\n- [open] The owner creates the board and names it for the app. Any visitor with the link reads the whole board and writes their own posts; each poster edits or removes what they wrote, keyed on the record's creator. The board creator can remove anything.\n- [open] Anyone with the link uploads photos to the wall; everyone reads; a photo is deletable by whoever posted it or the couple who own the wall.\n- [toy] Each signed-in player keeps a best score record keyed on their handle; a shared Top Scores list shows everyone's best with ViewerTag.\n- [toy] The toy keeps its state in memory: it opens instantly, with no sign-in and no records.\n\n## 3. Seed cast \u2014 seed.json demo with a named cast, counts and dates near today\n\n- [personal] seed.json demo: the owner's notebook plus 5 glazes (Tenmoku, Shino, Celadon, Chun blue, Ash) and 9 tiles fired between 2026-09-20 and 2026-10-05, two rated 5.\n- [personal] seed.json demo: one starter \"Gus\" born 2026-03-02 with 10 feedings over the last two weeks, rise heights between 3 and 7 cm.\n- [group] seed.json demo: the owner's library \"Maple Street Tools\" with the owner's own membership plus @priya and @tomas, 8 tools (a ladder, a tile saw, a pressure washer...), two loans out due this week and one returned.\n- [group] seed.json demo: the band \"Low Tide\" with the owner's membership and three members (@dee, @marco, @sun), 14 songs with keys and bpm, one setlist for a gig dated 2026-10-18.\n- [publish] seed.json demo: the owner's menu with 6 items across tacos, sides and drinks, one marked sold out, and a note of the day dated 2026-10-07.\n- [intake] seed.json demo: the owner's salon with 7 bookings spread over 2026-10-07 to 2026-10-11 in mixed statuses, dog names like Biscuit and Juno.\n- [open] seed.json demo: the festival board with 9 posts from five handles, five lost and four found, two already resolved, dated across the last three days.\n- [toy] seed.json demo: 6 score records from a small cast including the owner so the Top Scores list opens filled.\n\n## 4. Look note \u2014 one short line: background, accent, card shape, mood\n\n- [personal] Earthy studio: oatmeal background, iron-red accents, chunky rounded tile cards.\n- [personal] Flour-dusted kitchen: warm white, rye brown, a tall rising bar as the hero number.\n- [group] Workshop pegboard: plywood tones, safety-orange accents, square tool cards with big status chips.\n- [group] Backstage: near-black, amber stage light accents, setlist rows like gaffer-tape strips.\n- [publish] Street-food bright: chalkboard dark with chalk-white type and chili-red price tags.\n- [intake] Clean salon: pale mint, charcoal type, generous slot buttons easy to tap one-handed.\n- [open] Festival poster: cream paper, bold two-colour print, pinned-note cards with torn edges.\n- [toy] Neon arcade: deep navy, electric cyan ball, glowing hex outlines.\n\n## 5. Titles, addresses and icon\n\n- pairs: Glaze Ledger / glaze-ledger, Tile Book / tile-book, Kiln Notes / kiln-notes \u2014 icon: a glazed test tile beside a small kiln\n- pairs: Block Tools / block-tools, Maple Street Shelf / maple-street-shelf, Borrow Board / borrow-board \u2014 icon: a hand drill inside a house outline\n- pairs: Truck Board / truck-board, Taco Today / taco-today, Menu Chalk / menu-chalk \u2014 icon: a chalkboard with a taco drawn on it\n- pairs: Groom Book / groom-book, Salon Slots / salon-slots, Paws Diary / paws-diary \u2014 icon: a dog brush beside a clock face\n- pairs: Festival Finds / festival-finds, Lost Tent / lost-tent, Found It / found-it \u2014 icon: a tent peg tied with a ribbon\n- pairs: Hex Pong / hex-pong, Slow Rally / slow-rally, Honey Paddle / honey-paddle \u2014 icon: a hexagonal paddle and a glowing ball";
48
- export declare const MERCURY_BRIEF_RULES = "You write the settled parts of a build brief for a small web app (React, a local-first database, access rules). The brief is read by a builder, who works out the records, screens and mechanics from the person's own words. Write plain, concrete prose in the app's own nouns, as unformatted text in each JSON string.\n\nThe decisions already made are given in the user message; follow them (archetype, record names, capabilities). The access part matches the archetype: who owns the object, who else is let in, what visitors see. The seed part starts with \"seed.json demo:\" and gives a named cast, counts and dates near today, using the given record names. Take from the field the SHAPE of a part (its length and how a cast, a look or a title is named); every noun comes from the person's words. Each pair is a Title Case title of two or three words and a kebab-case address made from it.";
49
- export declare function mercuryBriefSchema(fields: readonly MercuryBriefField[]): Record<string, unknown>;
50
- export declare function mercuryBriefMessages(o: {
56
+ export declare function fixMercuryShape(shape: MercuryShape, personWords: string, opts?: {
57
+ readonly keepBackend?: boolean;
58
+ }): MercuryShape;
59
+ export declare function mercuryBackendWordsNamed(personWords: string): boolean;
60
+ export declare function parseMercuryDraftShape(raw: unknown, personWords: string): Result<MercuryShape>;
61
+ export interface MercuryOneCallReceipt {
62
+ readonly draftArchetypes: readonly (MercuryArchetype | null)[];
63
+ readonly archetypeSplit: boolean;
64
+ readonly flagsWinner: readonly MercuryFlag[];
65
+ readonly flagsUnion: readonly MercuryFlag[];
66
+ readonly backendFilterCleared?: readonly number[];
67
+ readonly backendFilterKept?: number;
68
+ }
69
+ export interface MercuryPair {
70
+ readonly title: string;
71
+ readonly slug: string;
72
+ }
73
+ export interface MercuryAddressEncoding {
74
+ readonly properties: Readonly<Record<string, Record<string, unknown>>>;
75
+ readonly rule: string;
76
+ readonly ask: string;
77
+ readonly hints: Readonly<Record<string, string>>;
78
+ readonly example: (title: string, slugs: readonly string[]) => readonly string[];
79
+ readonly decode: (reply: Readonly<Record<string, unknown>>) => Result<MercuryDecodedAddress>;
80
+ readonly salvage: (json: unknown) => Record<string, unknown> | undefined;
81
+ }
82
+ export type MercuryAddressRepair = "salvage" | "split" | "label" | "slug-fallback" | "title-from-slug";
83
+ export interface MercuryDecodedAddress {
84
+ readonly title?: string;
85
+ readonly slugs: string[];
86
+ readonly repairs: readonly MercuryAddressRepair[];
87
+ }
88
+ export declare function mercuryAddressEncoding(): MercuryAddressEncoding;
89
+ export declare const MERCURY_ADDRESS: MercuryAddressEncoding;
90
+ export declare function mercurySlugWordsSentence(words: readonly string[]): string;
91
+ export declare const MERCURY_OWN_WORLD_SEED_HINT = "demo: a lively cast and where each one stands, in words, in states this app's own records hold";
92
+ export interface MercuryRoomsAsk {
93
+ readonly rooms?: boolean;
94
+ readonly font?: boolean;
95
+ readonly screens?: boolean;
96
+ readonly juice?: MercuryJuice;
97
+ readonly story?: boolean;
98
+ readonly preamble?: boolean;
99
+ readonly classify?: boolean;
100
+ readonly recordsRules?: boolean;
101
+ }
102
+ export declare const MERCURY_ROOMS_HINT = "an array of 2 or 3 room slugs from the room list";
103
+ export declare const MERCURY_ROOMS_ASK = "Also rooms: an array of 2 or 3 room slugs from the room list.";
104
+ export declare const MERCURY_FONT_HINT = "one font slug from the font list";
105
+ export declare const MERCURY_FONT_ASK = "Also font: one font slug from the font list.";
106
+ export declare const MERCURY_CLASSIFY_HINTS: Readonly<Record<string, string>>;
107
+ export declare function mercuryAnswerSkeleton(fields: readonly MercuryBriefField[], opts?: MercuryRoomsAsk): string;
108
+ export declare function mercuryFieldArchetypes(archetype: MercuryArchetype): MercuryArchetype[];
109
+ export declare function mercuryExemplarField(archetype: MercuryArchetype, address?: MercuryAddressEncoding, recordsRules?: boolean): string;
110
+ export declare const MERCURY_ONECALL_TRIPLES: readonly (readonly [MercuryArchetype, MercuryArchetype, MercuryArchetype])[];
111
+ export declare function mercuryOneCallField(draft: number, address?: MercuryAddressEncoding, recordsRules?: boolean): string;
112
+ export declare const MERCURY_BRIEF_FLOORS = "Floors for every brief: each screen names at least two visible controls and one state that changes (a colour, a ribbon, a sort order, a chip, a badge); the demo names a lively cast and where each one stands (who is winning, what is overdue, what just landed, who has nothing yet); the opening names the one moment that makes the app fun to open. All of it in the person's own nouns and in words rather than numbers, and nothing their words did not imply.";
113
+ export declare const MERCURY_DEMO_RULE = "The demo part starts with \"demo:\" and names a lively cast and where each one stands, in words: who is ahead, what is overdue, what just happened, what is still waiting; dates and counts are the builder's to pick, so the demo uses words like recently, just now, last week, nearly, still. Every demo record is one the app's own Add could write.";
114
+ export type MercuryJuice = "examples" | "own-world";
115
+ export type MercuryDepth = "none" | "sub-feature";
116
+ export declare const MERCURY_OWN_WORLD_DEMO_RULE = "The demo part starts with \"demo:\" and names a lively cast and where each one stands, in words, named in the app's own world: the states and progress this app's own records hold; dates and counts are the builder's to pick, so the demo uses words like recently, just now, last week, nearly, still. Every demo record is one the app's own Add could write.";
117
+ export declare const MERCURY_OWN_WORLD_BRIEF_FLOORS = "Floors for every brief: each screen names at least two visible controls and one state that changes (a colour, a ribbon, a sort order, a chip, a badge); the demo names a lively cast and where each one stands, in the app's own world and in states its own records hold; the opening names the one moment that makes the app fun to open. All of it in the person's own nouns and in words rather than numbers, and nothing their words did not imply.";
118
+ export declare const MERCURY_DEPTH_RULE = "Each screen also names one deeper interaction behind its main control, whichever this app's core action calls for: an undo, a long-press, a drag to reorder, an inline edit, or a filter chip.";
119
+ export declare const MERCURY_DEPTH_SCREENS_HINT = "1. the core action as the biggest control, two visible controls, one state that changes, one deeper interaction behind the main control (an undo, a long-press, a drag to reorder, an inline edit or a filter chip), why it exists; 2. ...; 3. ...";
120
+ export declare const MERCURY_RECORDS_RULE = "The records part names each record type the app stores, with its fields, as \"volunteer (name, shift, note)\". The rules part names the one to three computations or invariants the ask hinges on, in the person's terms \u2014 for example \"close each tab as the fewest who-pays-whom transfers and save each payment\", \"a second sign-up under the same name updates that volunteer\", \"the band has a fixed lineup of five players and every player appears on each setlist\", \"every Friday email the summary to the coach's address\". The screens build on the records and the rules.";
121
+ export declare const MERCURY_RECORDS_SCREENS_RULE = "The screens part names two or three screens; each one says what it shows from the records and what the person does there for this ask, and the screen that carries out a rule says so. At most one screen adds a deeper interaction, and only where the ask implies one.";
122
+ export declare const MERCURY_RECORDS_DEMO_RULE = "The demo part starts with \"demo:\" and is lively, in the app's own world: a small cast with names and the records the screens would show, in the states this app's own records hold. When the person typed data \u2014 items, amounts, names, a list \u2014 the demo carries every piece of it verbatim, quantities included (\"half a bag\" stays \"half a bag\"); dates and counts they did not give are the builder's to pick. Every demo record is one the app's own Add could write.";
123
+ export declare const MERCURY_ASK_WORDS_RULE = "Keep the ask's genre and capability words exactly as the person wrote them \u2014 3D, first-person, email, a named recipient, a schedule, a fixed number of people \u2014 in the opening, the rules or the screens.";
124
+ export declare const MERCURY_RECORDS_BRIEF_FLOORS = "Floors for every brief: every record names its fields; the rules carry the computation or invariant the ask hinges on; each screen shows and does something this ask needs; the demo is lively and carries the person's own typed data word for word; the opening names the one moment that makes the app fun to open. All of it in the person's own nouns, and nothing their words did not imply.";
125
+ export declare const MERCURY_RECORDS_HINT = "each record type the app stores, with its fields: \"name (field, field, field); name (field, field)\"";
126
+ export declare const MERCURY_RULES_HINT = "the one to three computations or invariants the ask hinges on, in the person's terms";
127
+ export declare const MERCURY_RECORDS_SCREENS_HINT = "1. the core action's screen: what it shows from the records and what the person does there for this ask, and the rule it carries out; 2. ...; 3. ...";
128
+ export declare const MERCURY_RECORDS_SEED_HINT = "demo: a lively cast and the records the screens show, in the app's own world, with every item, amount and name the person typed, verbatim";
129
+ export declare const MERCURY_CHOPPED_RECORDS_SEED_LINE = "- seed: a small, lively world in the app's own words \u2014 a cast with quoted names and the records the screens would show, in the states this app's own records hold; any data the person typed (items, amounts, names, quantities) appears in it verbatim. Every seeded record is one the app's own Add could write.";
130
+ export declare const MERCURY_BLOCK_WORLD_TRIGGER = " - a Minecraft-style block world to build and break blocks in";
131
+ export declare function mercuryBlockWorldNamed(personWords: string): boolean;
132
+ export type MercuryReplyShape = "split" | "whole";
133
+ export declare const MERCURY_STORY_EXAMPLE_SOUP = "Mia opens the app to post today's soups by taking a picture of the kitchen recipe via the platform camera widget, right after the morning prep; she also sets the inventory level via an onscreen slider\u2026 customers at the queue browse the menu and make selections by clicking the quantity buttons on their phones.";
134
+ export declare const MERCURY_STORY_EXAMPLE_BIKE = "Dev opens the app to post today's repair queue by taking a picture of each bike's tag via the platform camera widget, right after the shop opens; he also sets each repair's progress via an onscreen slider\u2026 riders waiting at the counter browse the queue and pick their pickup time by turning the time picker on their phones.";
135
+ export declare function mercuryStoryExample(personWords: string): string;
136
+ export declare function mercuryStoryRule(example: string): string;
137
+ export declare const MERCURY_STORY_HINT = "three to five sentences: one person from the demo cast using the app through its core loop, every step naming its on-screen action: which control they use, the platform widget if one applies (camera, slider, quantity stepper, picker), and what changes on screen; then who else sees it and which control they use";
138
+ export declare const MERCURY_WHOLE_PREAMBLE_RULE = "The preamble part is spoken to the person who asked, just before the app is built: plain sentences in their own words, starting with \"I'm making\" or \"I'm building\" \u2014 what you are making for them, its core action and the big control on its first screen that does it, then what else it does, its features named in their nouns. Make it vivid, like you can already see the app; it promises what the screens and the story carry.";
139
+ export declare const MERCURY_WHOLE_PREAMBLE_HINT = "plain sentences to the person, starting with \"I'm making\" or \"I'm building\": what it is for them, the core action and its first-screen control, then what else it does";
140
+ export declare const MERCURY_BRIEF_RULES: string;
141
+ export declare const MERCURY_ONECALL_DECIDED = "The classification keys in your reply (archetype, core action, record names, capabilities) decide the brief; follow them.";
142
+ export declare const MERCURY_ONECALL_CLASSIFY: string;
143
+ export declare function mercuryBriefRules(o?: {
144
+ readonly juice?: MercuryJuice;
145
+ readonly depth?: MercuryDepth;
146
+ readonly reply?: MercuryReplyShape;
147
+ readonly personWords?: string;
148
+ readonly recordsRules?: boolean;
149
+ }): string;
150
+ export type MercuryStyle = "base" | "chopped";
151
+ export declare const MERCURY_CHOPPED_BRIEF_RULES = "These parts are turned up, in the person's own nouns, at the field's own lengths:\n- opening: reads like you can already see the app \u2014 what it is, who it is for, and the one moment that makes it fun to open.\n- seed: a small world in words \u2014 a lively cast with quoted names and where each one stands (one leading, one close behind, one just joined), what happened just now and last week, and a couple of records in the interesting states the screens would show (one overdue, one sold out, one on a streak). Every seeded record is one the app's own Add could write.\n- look: a scene \u2014 a surface, a palette, a card shape and one gesture of mood \u2014 in under twenty words.\nThe access part, the title and the slugs stay as plain and exact as the field shows them. A vivid phrase belongs to this app or it stays out; every part describes the app the person asked for, and each part grows by a few words, never by a feature their words did not imply.";
152
+ export declare const MERCURY_CHOPPED_SEED_LINE = "- seed: a small world in words \u2014 a lively cast with quoted names and where each one stands (one leading, one close behind, one just joined), what happened just now and last week, and a couple of records in the interesting states the screens would show (one overdue, one sold out, one on a streak). Every seeded record is one the app's own Add could write.";
153
+ export declare const MERCURY_CHOPPED_OWN_WORLD_SEED_LINE = "- seed: a small world in words \u2014 a lively cast with quoted names and where each one stands in the app's own world, what happened just now and last week, and a couple of records in the interesting states this app's own records hold. Every seeded record is one the app's own Add could write.";
154
+ export declare const MERCURY_CHOPPED_OWN_WORLD_BRIEF_RULES: string;
155
+ export declare const MERCURY_CHOPPED_RECORDS_BRIEF_RULES: string;
156
+ export declare const MERCURY_ONECALL_CLASSIFY_RECORDS: string;
157
+ export declare const MERCURY_CHOPPED_PREAMBLE = "Make it vivid, like you can already see the app: name the first screen's hero control and the one moment that makes it fun to open, in their nouns. The promise stays the brief's: the core action and that control.";
158
+ export declare function mercuryBriefKeys(fields: readonly MercuryBriefField[]): string[];
159
+ export declare function mercuryBriefSchema(fields: readonly MercuryBriefField[], opts?: MercuryRoomsAsk): Record<string, unknown>;
160
+ interface MercuryBriefMessageOpts {
51
161
  readonly personWords: string;
52
- readonly shape: MercuryShape;
53
162
  readonly fields: readonly MercuryBriefField[];
54
163
  readonly words: readonly string[];
55
- readonly today: string;
56
- readonly nonce: string;
164
+ readonly style?: MercuryStyle;
165
+ readonly rooms?: boolean;
166
+ readonly font?: boolean;
167
+ readonly juice?: MercuryJuice;
168
+ readonly depth?: MercuryDepth;
169
+ readonly screens?: boolean;
170
+ readonly reply?: MercuryReplyShape;
171
+ readonly story?: boolean;
172
+ readonly preamble?: boolean;
173
+ readonly recordsRules?: boolean;
174
+ readonly recordsOwed?: boolean;
175
+ }
176
+ export declare function mercuryBriefMessages(o: MercuryBriefMessageOpts & {
177
+ readonly shape: MercuryShape;
178
+ }): LLMMessage[];
179
+ export declare function mercuryOneCallBriefMessages(o: MercuryBriefMessageOpts & {
180
+ readonly draft: number;
57
181
  }): LLMMessage[];
58
182
  export declare function cleanMercuryText(text: string): string;
59
- export declare function gateMercuryPairs(raw: unknown): Result<{
183
+ export type MercuryRepair = "demo-prefix" | "archetype-tag";
184
+ export declare function stripMercuryArchetypeTag(text: string): {
185
+ readonly text: string;
186
+ readonly repaired: boolean;
187
+ };
188
+ export declare function repairMercuryField(field: Exclude<MercuryBriefField, "pairs">, value: string): {
189
+ readonly value: string;
190
+ readonly repaired: readonly MercuryRepair[];
191
+ };
192
+ export declare function prepareMercuryField(field: Exclude<MercuryBriefField, "pairs">, value: string): {
193
+ readonly gate: string;
194
+ readonly value: string;
195
+ readonly misses: readonly MercuryRepair[];
196
+ };
197
+ export interface MercuryGatedAddress {
198
+ readonly pairs: MercuryPair[];
199
+ readonly fallback: boolean;
200
+ readonly tagged: boolean;
201
+ }
202
+ export declare function gateMercuryAddress(o: {
60
203
  readonly title: string;
61
- readonly slug: string;
62
- }[]>;
204
+ readonly slugs: readonly string[];
205
+ }): Result<MercuryGatedAddress>;
206
+ export declare function mercurySlugsWithWord(pairs: readonly MercuryPair[], words: readonly string[]): number;
63
207
  export declare function gateMercuryField(o: {
64
208
  readonly field: Exclude<MercuryBriefField, "pairs">;
65
209
  readonly value: string;
@@ -67,20 +211,83 @@ export declare function gateMercuryField(o: {
67
211
  }): string[];
68
212
  export declare const MERCURY_ACCESS_TAIL: Readonly<Record<MercuryArchetype, string>>;
69
213
  export declare function mercuryAccessLine(shape: MercuryShape, access: string): string;
70
- export declare function mercurySkills(shape: MercuryShape): string[];
71
- export declare function mercuryNature(shape: MercuryShape): AppNature;
214
+ export declare function mercurySkills(shape: MercuryShape, opts?: {
215
+ readonly personWords?: string;
216
+ readonly recordsRules?: boolean;
217
+ }): string[];
218
+ export type MercuryReadPosture = "private" | "members" | "public";
219
+ export type MercuryWritePosture = "owner" | "members";
220
+ export interface MercuryAccessPosture {
221
+ readonly read?: MercuryReadPosture;
222
+ readonly write?: MercuryWritePosture;
223
+ }
224
+ export declare function mercuryAccessPosture(access: string): MercuryAccessPosture;
225
+ export declare function mercuryDuoConflict(a: {
226
+ readonly shape: MercuryShape;
227
+ readonly access: string;
228
+ }, b: {
229
+ readonly shape: MercuryShape;
230
+ readonly access: string;
231
+ }, personWords: string): string | undefined;
232
+ export declare function mercuryNature(shape: MercuryShape, personWords: string): AppNature;
72
233
  export declare function mercuryWorkflowLine(shape: MercuryShape): string;
73
- export declare function assembleMercuryCreateVibe(o: {
234
+ interface MercuryAssembly {
74
235
  readonly personWords: string;
75
236
  readonly shape: MercuryShape;
76
237
  readonly fields: MercuryBriefFields;
77
- }): CreateVibeToolInput;
238
+ readonly rooms?: readonly string[];
239
+ readonly font?: string;
240
+ readonly screens?: string;
241
+ readonly story?: string;
242
+ readonly preamble?: string;
243
+ readonly reply?: MercuryReplyShape;
244
+ readonly partner?: MercuryTake;
245
+ readonly capabilityFlags?: Readonly<Record<MercuryFlag, boolean>>;
246
+ readonly recordsRules?: boolean;
247
+ readonly records?: string;
248
+ readonly rules?: string;
249
+ }
250
+ export interface MercuryTake {
251
+ readonly opening: string;
252
+ readonly access: string;
253
+ readonly seed: string;
254
+ readonly look: string;
255
+ readonly records?: string;
256
+ readonly rules?: string;
257
+ readonly screens?: string;
258
+ readonly story?: string;
259
+ readonly preamble?: string;
260
+ }
261
+ export interface MercuryGatedRooms {
262
+ readonly rooms?: readonly string[];
263
+ readonly dropped: number;
264
+ }
265
+ export declare function gateMercuryRooms(raw: unknown): MercuryGatedRooms;
266
+ export interface MercuryGatedFont {
267
+ readonly font?: string;
268
+ readonly dropped: number;
269
+ }
270
+ export declare function gateMercuryFont(raw: unknown): MercuryGatedFont;
271
+ export interface MercuryGatedScreens {
272
+ readonly screens?: string;
273
+ readonly dropped: number;
274
+ }
275
+ export declare function gateMercuryScreens(raw: unknown): MercuryGatedScreens;
276
+ export interface MercuryGatedStory {
277
+ readonly story?: string;
278
+ readonly dropped: number;
279
+ readonly misses?: readonly string[];
280
+ }
281
+ export declare function gateMercuryStory(raw: unknown): MercuryGatedStory;
282
+ export declare function gateMercuryWholePreamble(text: string): string[];
283
+ export declare function mercuryPreambleBrief(o: MercuryAssembly): string;
284
+ export declare function assembleMercuryCreateVibe(o: MercuryAssembly): CreateVibeToolInput;
78
285
  export declare const MERCURY_PREAMBLE_SYSTEM = "You speak to the person who asked for an app, just before it is built. Write two or three plain sentences in their own words: what you are making for them, its core action, and the big control on its first screen that does it. That is the whole promise \u2014 the builder works out everything else after you speak. Start with \"I'm making\" or \"I'm building\", and write it as plain sentences to the person.";
79
286
  export declare function mercuryPreambleMessages(o: {
80
287
  readonly personWords: string;
81
288
  readonly shape: MercuryShape;
82
289
  readonly enrichedPrompt: string;
83
- readonly nonce: string;
290
+ readonly style?: MercuryStyle;
84
291
  }): LLMMessage[];
85
292
  export declare function mercuryPreambleSchema(): Record<string, unknown>;
86
293
  export declare function gateMercuryPreamble(o: {
@@ -102,20 +309,383 @@ export interface MercuryCallRecord {
102
309
  readonly servedModel?: string;
103
310
  readonly usage: readonly MercuryUsage[];
104
311
  readonly error?: string;
312
+ readonly cause?: MercuryFallbackCause;
313
+ readonly sends: number;
314
+ readonly retries: number;
315
+ readonly history?: readonly string[];
316
+ readonly reasoningTokens?: number;
317
+ readonly passedThrough?: readonly MercuryRepair[];
318
+ readonly addressRepair?: readonly MercuryAddressRepair[];
319
+ readonly slugsWithWord?: number;
320
+ readonly roomsDropped?: number;
321
+ readonly fontDropped?: number;
322
+ readonly fanout?: MercuryFanout;
323
+ readonly juice?: MercuryJuice;
324
+ readonly depth?: MercuryDepth;
325
+ readonly screensDropped?: number;
326
+ readonly reply?: MercuryReplyShape;
327
+ readonly preambleFrom?: "brief" | "classification";
328
+ readonly storyChars?: number;
329
+ readonly storyDropped?: number;
330
+ readonly preambleChars?: number;
331
+ readonly softMisses?: Readonly<Record<string, readonly string[]>>;
332
+ readonly coerced?: readonly string[];
333
+ readonly fieldsDropped?: readonly string[];
334
+ readonly preambleFallback?: 1;
335
+ readonly duo?: true;
336
+ readonly duoDrafts?: readonly number[];
337
+ readonly duoBreadth?: readonly number[];
338
+ readonly duoPool?: number;
339
+ readonly duoArchetypes?: readonly MercuryArchetype[];
340
+ readonly duoConflict?: true;
341
+ readonly duoConflictReason?: string;
342
+ readonly recordsRules?: true;
343
+ readonly recordsDropped?: number;
344
+ readonly rulesDropped?: number;
345
+ readonly oneCall?: true;
346
+ readonly shapeCall?: false;
347
+ readonly draftArchetypes?: readonly (MercuryArchetype | null)[];
348
+ readonly archetypeSplit?: boolean;
349
+ readonly flagsWinner?: readonly MercuryFlag[];
350
+ readonly flagsUnion?: readonly MercuryFlag[];
351
+ readonly backendFilterCleared?: readonly number[];
352
+ readonly backendFilterKept?: number;
353
+ readonly planner?: Exclude<MercuryPlanner, "mercury">;
354
+ readonly format?: MercuryFormat;
355
+ readonly thinkAloud?: {
356
+ readonly narrationChars: number;
357
+ readonly specChars: number;
358
+ readonly guessLines: number;
359
+ };
360
+ readonly cards?: {
361
+ readonly preambleChars: number;
362
+ readonly cards: number;
363
+ readonly acceptLines: number;
364
+ readonly ruleLines: number;
365
+ readonly guessLines: number;
366
+ readonly dataRecords: number;
367
+ };
368
+ readonly fim?: MercuryFimReceipt;
369
+ readonly text?: string;
370
+ readonly partialText?: string;
371
+ readonly duoTexts?: readonly string[];
372
+ readonly filledText?: string;
373
+ }
374
+ export type MercuryFormat = "prose" | "thinkaloud" | "cards" | "cards-fim";
375
+ export interface MercuryBilled {
376
+ readonly prompt_tokens: number;
377
+ readonly completion_tokens: number;
378
+ readonly total_tokens: number;
379
+ readonly cost?: number;
380
+ readonly estimated: number;
381
+ }
382
+ export interface MercuryPickCandidate {
383
+ readonly draft: number;
384
+ readonly breadth: number;
385
+ readonly softMisses: number;
386
+ readonly ms: number;
387
+ readonly archetype?: MercuryArchetype;
388
+ }
389
+ export interface MercuryDuoReceipt {
390
+ readonly drafts: readonly number[];
391
+ readonly breadth: readonly number[];
392
+ readonly pool?: number;
393
+ readonly candidates?: readonly MercuryPickCandidate[];
394
+ readonly archetypes?: readonly MercuryArchetype[];
395
+ readonly archetypeSplit?: boolean;
396
+ readonly conflict?: string;
397
+ }
398
+ export interface MercuryFanout {
399
+ readonly drafts: number;
400
+ readonly valid: number;
401
+ readonly winner?: number;
402
+ readonly winnerMs?: number;
403
+ readonly picked?: number;
404
+ readonly candidates?: readonly MercuryPickCandidate[];
405
+ readonly pickWaitMs?: number;
406
+ readonly aborted: number;
407
+ readonly throttled?: number;
408
+ readonly billed: MercuryBilled;
105
409
  }
410
+ export interface MercuryRowTarget {
411
+ readonly chatId: string;
412
+ readonly userId: string;
413
+ readonly onUsage?: (rounds: readonly MercuryUsageRound[]) => void;
414
+ readonly keepText?: boolean;
415
+ readonly onWritten?: (promptId: string) => void;
416
+ }
417
+ export type MercuryUsageRound = MercuryUsage & {
418
+ readonly model: string;
419
+ readonly role: "mercury";
420
+ };
421
+ export declare function recordMercuryDispatched(vctx: VibesApiSQLCtx, o: {
422
+ readonly chatId: string;
423
+ readonly promptId: string;
424
+ readonly enrichedPrompt: string;
425
+ }): Promise<void>;
426
+ export declare function recordMercuryRace(vctx: VibesApiSQLCtx, o: {
427
+ readonly chatId: string;
428
+ readonly promptId: string;
429
+ readonly race: object;
430
+ }): Promise<void>;
431
+ export declare function recordMercuryFim(vctx: VibesApiSQLCtx, o: {
432
+ readonly chatId: string;
433
+ readonly promptId: string;
434
+ readonly fim: MercuryFimReceipt;
435
+ readonly filledText?: string;
436
+ }): Promise<void>;
437
+ export interface MercuryProseExample {
438
+ readonly ask: string;
439
+ readonly brief: string;
440
+ }
441
+ export declare const MERCURY_PROSE_FORMAT_EXAMPLES: readonly MercuryProseExample[];
442
+ export declare const MERCURY_PROSE_SYSTEM: string;
443
+ export declare function mercuryProseBriefSchema(opts?: {
444
+ readonly rooms?: boolean;
445
+ readonly font?: boolean;
446
+ }): Record<string, unknown>;
447
+ export declare function mercuryProseBriefMessages(o: {
448
+ readonly personWords: string;
449
+ readonly words: readonly string[];
450
+ readonly rooms?: boolean;
451
+ readonly font?: boolean;
452
+ }): LLMMessage[];
453
+ interface MercuryProseDraft {
454
+ readonly shape: MercuryShape;
455
+ readonly brief: string;
456
+ readonly address: MercuryGatedAddress;
457
+ readonly addressRepair: readonly MercuryAddressRepair[];
458
+ readonly rooms?: MercuryGatedRooms;
459
+ readonly font?: MercuryGatedFont;
460
+ }
461
+ export declare function gateMercuryProseDraft(json: unknown, o: {
462
+ readonly personWords: string;
463
+ readonly askRooms: boolean;
464
+ }): Result<MercuryProseDraft>;
465
+ export declare function assembleMercuryProseCreateVibe(o: {
466
+ readonly personWords: string;
467
+ readonly draft: MercuryProseDraft;
468
+ }): CreateVibeToolInput;
469
+ export declare function mercuryProsePreamble(draft: MercuryProseDraft): string;
470
+ export declare const MERCURY_THINKALOUD_MARKER = "--- SPEC ---";
471
+ export declare const MERCURY_THINKALOUD_SPEC_HINTS: Readonly<Record<string, string>>;
472
+ export declare function mercuryThinkAloudSystem(o?: {
473
+ readonly rooms?: boolean;
474
+ readonly font?: boolean;
475
+ }): string;
476
+ export declare function mercuryThinkAloudMessages(o: {
477
+ readonly personWords: string;
478
+ readonly words: readonly string[];
479
+ readonly rooms?: boolean;
480
+ readonly font?: boolean;
481
+ }): LLMMessage[];
482
+ export interface MercuryThinkAloudReply {
483
+ readonly narration: string;
484
+ readonly spec: string;
485
+ readonly keys: Readonly<Record<string, string>>;
486
+ readonly guessLines: number;
487
+ }
488
+ export declare function parseMercuryThinkAloud(text: string): MercuryThinkAloudReply | undefined;
489
+ export interface MercuryThinkAloudDraft {
490
+ readonly shape: MercuryShape;
491
+ readonly reply: string;
492
+ readonly narration: string;
493
+ readonly spec: string;
494
+ readonly address: MercuryGatedAddress;
495
+ readonly addressRepair: readonly MercuryAddressRepair[];
496
+ readonly rooms?: MercuryGatedRooms;
497
+ readonly font?: MercuryGatedFont;
498
+ readonly softMisses: Readonly<Record<string, readonly string[]>>;
499
+ readonly guessLines: number;
500
+ }
501
+ export declare const MERCURY_THINKALOUD_DEFAULT_ARCHETYPE: MercuryArchetype;
502
+ export declare function gateMercuryThinkAloud(raw: unknown, o: {
503
+ readonly personWords: string;
504
+ readonly askRooms: boolean;
505
+ }): Result<MercuryThinkAloudDraft>;
506
+ export declare const MERCURY_TESTER_REPLY_INTRO = "A fast tester's first read:";
507
+ export declare const MERCURY_TESTER_REPLY_RULE = "Guesses only; the creator's words win.";
508
+ export declare function mercuryTesterReplyEnrichedPrompt(reply: string, personWords: string): string;
509
+ export declare function assembleMercuryThinkAloudCreateVibe(o: {
510
+ readonly personWords: string;
511
+ readonly draft: MercuryThinkAloudDraft;
512
+ }): CreateVibeToolInput;
513
+ export declare function mercuryThinkAloudPreamble(draft: MercuryThinkAloudDraft): string;
514
+ export declare const MERCURY_CARDS_MARKER = "--- CARDS ---";
515
+ export declare const MERCURY_CARDS_APP_MARKER = "--- APP ---";
516
+ export declare const MERCURY_CARDS_TAIL_HINTS: Readonly<Record<string, string>>;
517
+ export declare const MERCURY_CARDS_PREAMBLE_RULE = "Start with a short paragraph to the app creator, in plain warm words: what you're making for them and its most important workflow, walked through the way they'll do it. Say \"probably\" where you're guessing.";
518
+ export declare const MERCURY_CARDS_SHAPE = "As a <role>, I <action on a named record>, so that <outcome>.\n Accept: <one testable line, in terms of records and fields>\n Accept: <another>\n Data: <Record>{<field>, <field>, ...}\n Rule: <a value this card depends on and how it comes about, said loosely in one plain English sentence a friend would understand>";
519
+ export declare const MERCURY_CARDS_RULES = "Rules:\n- Use the person's own nouns for records, roles and actions.\n- Give what the person asked for plus what those parts need in order to work.\n- A line that rests on your assumption and not on the person's words ends with (guess). A line the person's words settle carries no label.";
520
+ export declare function mercuryCardsSystem(o?: {
521
+ readonly rooms?: boolean;
522
+ readonly font?: boolean;
523
+ }): string;
524
+ export declare function mercuryCardsMessages(o: {
525
+ readonly personWords: string;
526
+ readonly words: readonly string[];
527
+ readonly rooms?: boolean;
528
+ readonly font?: boolean;
529
+ }): LLMMessage[];
530
+ export interface MercuryCardsReply {
531
+ readonly lines: readonly string[];
532
+ readonly preamble: string;
533
+ readonly cardsMarkerAt?: number;
534
+ readonly appMarkerAt?: number;
535
+ readonly cardLines: readonly number[];
536
+ readonly keys: Readonly<Record<string, string>>;
537
+ readonly dataRecords: readonly string[];
538
+ readonly acceptLines: number;
539
+ readonly ruleLines: number;
540
+ readonly guessLines: number;
541
+ }
542
+ export declare function parseMercuryCards(text: string): MercuryCardsReply;
543
+ export interface MercuryCardsDraft {
544
+ readonly shape: MercuryShape;
545
+ readonly reply: string;
546
+ readonly parsed: MercuryCardsReply;
547
+ readonly address: MercuryGatedAddress;
548
+ readonly addressRepair: readonly MercuryAddressRepair[];
549
+ readonly rooms?: MercuryGatedRooms;
550
+ readonly font?: MercuryGatedFont;
551
+ readonly softMisses: Readonly<Record<string, readonly string[]>>;
552
+ }
553
+ export declare function gateMercuryCards(raw: unknown, o: {
554
+ readonly personWords: string;
555
+ readonly askRooms: boolean;
556
+ }): Result<MercuryCardsDraft>;
557
+ export declare const MERCURY_FIM_MODEL = "mercury-coder";
558
+ export declare const MERCURY_FIM_URL = "https://api.inceptionlabs.ai/v1/fim/completions";
559
+ export declare const MERCURY_FIM_MAX_TOKENS = 2000;
560
+ export declare const MERCURY_FIM_STOP: readonly string[];
561
+ export declare const MERCURY_FIM_CALL_DEADLINE_MS = 20000;
562
+ export declare const MERCURY_FIM_BUDGET_MS = 40000;
563
+ export declare const MERCURY_FIM_CONCURRENCY = 8;
564
+ export declare const MERCURY_FIM_PRICE: {
565
+ readonly inputUsdPerMTok: 0.25;
566
+ readonly outputUsdPerMTok: 1;
567
+ };
568
+ export declare function mercuryFimUsageRound(fim: MercuryFimReceipt): MercuryUsageRound | undefined;
569
+ export declare const MERCURY_FIM_WAVES: readonly ["see", "expect"];
570
+ export type MercuryFimSlot = (typeof MERCURY_FIM_WAVES)[number];
571
+ export declare const MERCURY_FIM_SEEDS: Readonly<Record<MercuryFimSlot, string>>;
572
+ export declare function mercuryFimHeader(personWords: string): string;
573
+ export interface MercuryFimReceipt {
574
+ readonly status: "ok" | "no-key" | "no-cards" | "failed";
575
+ readonly model: string;
576
+ readonly cards: number;
577
+ readonly slots: number;
578
+ readonly filled: number;
579
+ readonly empty: number;
580
+ readonly failed: number;
581
+ readonly ms: number;
582
+ readonly promptTokens: number;
583
+ readonly completionTokens: number;
584
+ readonly errors?: readonly string[];
585
+ }
586
+ export declare function renderMercuryCardsFills(o: {
587
+ readonly lines: readonly string[];
588
+ readonly bodyEnd: number;
589
+ readonly cardLines: readonly number[];
590
+ readonly fills: ReadonlyMap<string, string>;
591
+ readonly gap?: string;
592
+ }): string;
593
+ export declare function mercuryFimRequest(o: {
594
+ readonly personWords: string;
595
+ readonly lines: readonly string[];
596
+ readonly bodyEnd: number;
597
+ readonly cardLines: readonly number[];
598
+ readonly fills: ReadonlyMap<string, string>;
599
+ readonly gap: string;
600
+ }): {
601
+ readonly model: string;
602
+ readonly prompt: string;
603
+ readonly suffix: string;
604
+ readonly max_tokens: number;
605
+ readonly stop: string[];
606
+ };
607
+ export declare function mercuryCardsFim(vctx: Pick<VibesApiSQLCtx, "inferenceFetch">, o: {
608
+ readonly draft: MercuryCardsDraft;
609
+ readonly personWords: string;
610
+ readonly apiKey?: string;
611
+ readonly deadlineMs?: number;
612
+ readonly budgetMs?: number;
613
+ readonly url?: string;
614
+ readonly cancel?: AbortSignal;
615
+ }): Promise<{
616
+ readonly reply: string;
617
+ readonly receipt: MercuryFimReceipt;
618
+ }>;
619
+ export declare function assembleMercuryCardsCreateVibe(o: {
620
+ readonly personWords: string;
621
+ readonly draft: MercuryCardsDraft;
622
+ readonly reply: string;
623
+ }): CreateVibeToolInput;
624
+ export declare function mercuryCardsPreamble(draft: MercuryCardsDraft, personWords: string): string;
106
625
  export interface MercuryFirstBuild {
107
626
  readonly input: CreateVibeToolInput;
108
627
  readonly preamble: string;
628
+ readonly preambleFrom?: "call" | "brief" | "classification";
629
+ readonly storyChars?: number;
630
+ readonly duo?: MercuryDuoReceipt;
631
+ readonly oneCall?: MercuryOneCallReceipt;
632
+ readonly planner?: Exclude<MercuryPlanner, "mercury">;
633
+ readonly format?: MercuryFormat;
634
+ readonly fim?: MercuryFimReceipt;
109
635
  readonly shape: MercuryShape;
110
636
  readonly elapsedMs: number;
637
+ readonly sends?: number;
638
+ readonly retries?: number;
639
+ readonly rowPromptId?: string;
111
640
  }
112
641
  export interface RunMercuryFirstBuildArgs {
113
642
  readonly chatId: string;
114
643
  readonly userId: string;
115
644
  readonly personWords: string;
116
645
  readonly words: readonly string[];
646
+ readonly style?: MercuryStyle;
117
647
  readonly deadlineMs?: number;
118
- readonly nonce?: () => string;
119
- readonly today?: string;
648
+ readonly budgetMs?: number;
649
+ readonly rateLimitedBudgetMs?: number;
650
+ readonly breaker?: MercuryCircuitBreaker;
651
+ readonly onUsage?: (rounds: readonly MercuryUsageRound[]) => void;
652
+ readonly wordBag?: (count: number) => string[];
653
+ readonly rooms?: boolean;
654
+ readonly juice?: MercuryJuice;
655
+ readonly depth?: MercuryDepth;
656
+ readonly reply?: MercuryReplyShape;
657
+ readonly duo?: boolean;
658
+ readonly duoPool?: number;
659
+ readonly oneCall?: boolean;
660
+ readonly recordsRules?: boolean;
661
+ readonly planner?: MercuryPlanner;
662
+ readonly format?: "skeleton" | MercuryFormat;
663
+ readonly fimApiKey?: string;
664
+ readonly fimUrl?: string;
665
+ readonly keepText?: boolean;
666
+ readonly signal?: AbortSignal;
667
+ readonly onRowWritten?: (promptId: string) => void;
120
668
  }
669
+ export declare function coerceMercuryText(v: unknown): {
670
+ readonly text?: string;
671
+ readonly coerced: boolean;
672
+ };
673
+ export declare const MERCURY_DROP_OVER_BOUND = 3;
674
+ export declare const MERCURY_BRIEF_FANOUT = 4;
675
+ export declare const MERCURY_SHAPE_MAX_TOKENS = 800;
676
+ export declare const MERCURY_PICK_WAIT_MS = 1500;
677
+ export declare const MERCURY_PICK_COUNT = 2;
678
+ export declare const MERCURY_DUO_PICK_COUNT = 3;
679
+ export declare const MERCURY_ONECALL_EXTRA_TOKENS = 400;
680
+ export declare function mercuryBreadth(o: {
681
+ readonly screens?: string;
682
+ readonly opening: string;
683
+ readonly seed?: string;
684
+ readonly access?: string;
685
+ }): number;
686
+ export declare const MERCURY_PROSE_MAX_TOKENS = 3200;
687
+ export declare const MERCURY_THINKALOUD_MAX_TOKENS = 16000;
688
+ export declare const MERCURY_THINKALOUD_DEADLINE_MS = 20000;
689
+ export declare const MERCURY_THINKALOUD_BUDGET_MS = 25000;
121
690
  export declare function runMercuryFirstBuild(vctx: VibesApiSQLCtx, args: RunMercuryFirstBuildArgs): Promise<Result<MercuryFirstBuild>>;
691
+ export {};