@happyvertical/smrt-template-sveltekit 0.61.6 → 0.62.1

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/AGENTS.md CHANGED
@@ -4,7 +4,7 @@
4
4
 
5
5
  ## Exports
6
6
 
7
- - [Cookbook host](agents/cookbook-host.md).
7
+ - [Cookbook host](agents/cookbook-host.md); its [workflow runs](agents/cookbook-workflow-runs.md).
8
8
 
9
9
  - `getTemplatePath()` returns the template directory.
10
10
  - `copyTemplate(destination, options)` copies authored files, substitutes the
@@ -509,80 +509,94 @@ no auth, persistence, retry or protocol implementation is duplicated. Reuse sear
509
509
  for CLI setup/config and bridge imports found `generateLocalMcpSetup`,
510
510
  `saveCliConfig`, and the existing async plugin operations; no new helper is added.
511
511
 
512
- ## Assistant work profiles
513
-
514
- The host resolves owner work-profile preferences in inference for each request.
515
- Normal owner work defaults to assist; actual assistant calls while durable
516
- onboarding is unfinished or rerunning use design. Deterministic Fresh/template
517
- preview and apply remain the canonical onboarding operations. An assist design
518
- tool attempt is intercepted before execution and admitted as a durable design
519
- job; authenticated CLI MCP calls run the same check before side effects. Each
520
- CLI binding also checks app-tool count and pass wall time before execution.
521
-
522
- `createInferenceSettingsPage(host.inferenceSettings,host.workProfiles)` composes
523
- the owner quality editor into the existing settings route. Missing engine/model
524
- catalogs leave editing/reset usable. The preferences facade preserves live owner
525
- checks, `inference.customize` and revisions. CLI fallback memos reuse host state,
526
- keyed by owner, engine, requested model, CLI version, connection selection
527
- generation and work-profile preference revision. Selection changes invalidate
528
- old memos; an external CLI account change cannot currently be detected by its
529
- sanitized status API. ChatGPT fallback requires a verified catalog rank, which
530
- the current SDK projection does not provide.
531
-
532
- [Durable design runs](cookbook-design-runs.md) use inference checkpoints and the
533
- existing TaskRunner. The host installs its executor before starting one default
534
- queue runner; `host.shutdown()` drains the runner and disposes its executor.
535
- Internal passes reuse authenticated assistant adapters with a private server
536
- profile binding, original permission ceiling intersected with live permissions,
537
- read-only tools, full schema validation, and a detached job cancellation signal.
538
- Technical prompts and raw reasoning stay server-side. V4 and newer proposals require
539
- separate `summary` and bounded `personSummary` fields; neither model field is
540
- trusted as public prose. The host explicitly projects progress to short fixed
541
- person-facing notes, including errors, repairs and reloaded state. Raw outputs
542
- remain unchanged in durable checkpoints. Pinned v3 schemas and deterministic
543
- Apply/recovery remain supported; the historical v2 adapter still upgrades only
544
- to its exact v3 schema. Ready durable proposals enter a deterministic final check using
545
- core's stable design-action identity and exact result recovery. Preview uses the
546
- existing native thread approval UI; preview-off applies additive changes directly
547
- with change history, while destructive changes retain approval. Completing an
548
- approval resumes that check without another model turn. Explicit owner Resume
549
- can safely migrate a validated ready v2 `app.addField` proposal against its
550
- frozen historical argument schema; v1 never applies. The owner-scoped
551
- `history(event)` read handler projects the normal `app.history` result into
552
- browser-safe, undated entries for the existing Change history component.
553
-
554
- The existing assistant endpoint additionally handles owner-scoped design-run
512
+ ## Which model answers, limits and assistant settings (#5005)
513
+
514
+ Every assistant turn asks for the tier the `chat.assistant.system` prompt
515
+ declares (`best`, read with `resolveChatAssistantTier`). The host
516
+ binds it per request: an API key through core's resolver, Claude Code, Codex
517
+ and a ChatGPT plan through inference's default tier binding
518
+ (`engineTierModel`: `fable`, `gpt-6-astra`, or the strongest ranked model the
519
+ ChatGPT account offers). The effort is the tier binding's
520
+ (`resolveEngineEffort`), else the engine's default. While durable onboarding is
521
+ unfinished or rerunning, assistant requests go straight to a workflow run
522
+ (`deferWorkflowTurn`). Deterministic Fresh/template preview and apply remain the
523
+ canonical onboarding operations. A chat turn that asks for a structural tool
524
+ (limited to workflow runs) is refused before execution and, with the owner's
525
+ `escalateToWorkflow` setting on, admitted as a durable workflow run; with it off
526
+ the turn ends with a refusal. Authenticated CLI MCP calls run the same check
527
+ before side effects.
528
+
529
+ The assistant turn's budget is `ASSISTANT_TURN_LIMITS.budget` (24 steps,
530
+ 160,000 tokens, 10 minutes, 3-minute calls; 16,384 output tokens per call and
531
+ 40,000-character tool results as loop options). It is stored on the turn's AI
532
+ run. Each CLI binding checks the same step count and wall time before
533
+ execution. A workflow step uses the change workflow's budget
534
+ (`WORKFLOW_RUN_BUDGET` in `host/workflow-runs.ts`, overridable by the app's
535
+ `workflowBudget` host option): 4 steps, 2,000,000 run tokens, 2 hours, 2 repairs;
536
+ per step turn 64 tool-loop steps, 32,768 output tokens per call, 400,000 tokens,
537
+ 10-minute calls, 30 minutes, 120,000-character tool results. A workflow run pins
538
+ its engine, tier, model, effort and the preview setting when it starts.
539
+
540
+ `createInferenceSettingsPage(host.inferenceSettings, host.assistantSettings)`
541
+ adds the owner's assistant settings (workflow handoff, preview before applying,
542
+ removal approval, local AI protection) to the one inference settings panel. The
543
+ preferences facade preserves live owner checks, `inference.customize` and
544
+ revisions. CLI fallback memos reuse host state, keyed by owner, engine,
545
+ requested model, CLI version and connection selection generation; the next
546
+ model is one step down the engine's tier binding order. Selection changes
547
+ invalidate old memos; an external CLI account change cannot currently be
548
+ detected by its sanitized status API.
549
+
550
+ [Workflow runs](cookbook-workflow-runs.md) run the cookbook change workflow on
551
+ `@happyvertical/smrt-workflows` (#4994): runs, checkpoints and events in core's
552
+ `_smrt_ai_*` system tables, one named handler job per run on the host's
553
+ TaskRunner (`claimFencing: true`). The host registers the workflow before it
554
+ starts the runner (creating it after throws `JobHandlerRegistrationClosedError`);
555
+ `host.shutdown()` drains the runner, then releases the definition. Each step is
556
+ an assistant turn over the registered prompt `cookbook-host.change.step`, run as
557
+ a child run of the workflow run with read-only tools, the pinned execution, the
558
+ original permission ceiling intersected with live permissions and the job's
559
+ signal. Technical prompts and raw model output stay server-side; progress is
560
+ projected to fixed person-facing notes. A ready proposal is applied by the
561
+ step's host check through the core cookbook service with a stable workflow
562
+ action identity (one native owner hold per gated action); preview-off applies
563
+ additive changes directly with change history, destructive changes keep
564
+ approval. Completing an approval re-runs that check without another model turn.
565
+ The owner-scoped `history(event)` read handler projects the normal
566
+ `app.history` result into browser-safe, undated entries for the existing Change
567
+ history component.
568
+
569
+ The existing assistant endpoint additionally handles owner-scoped `/runs`
555
570
  status by thread and same-origin Stop/Resume. `createCookbookAssistant` enables
556
571
  this transport so tab closure leaves the job alive and reopening restores its
557
- progress. No profile grants authority, disables owner approval, or enables CLI
558
- built-ins. Native CLI per-call output-token limits are unavailable; their token
559
- settings are advisory while reported usage bounds subsequent passes.
560
-
561
- Explicit Resume adopts current owner design aggregate token/time settings while
562
- retaining consumed usage and the pinned engine, model and pass definition. A
563
- lowered cap may pause the same run immediately; it never resets its allowance.
572
+ progress. No setting grants authority, disables owner approval, or enables CLI
573
+ built-ins. Explicit Resume raises the run's token/time limits to the app's
574
+ current `workflowBudget` (never above it) while keeping consumed usage and the
575
+ pinned engine, model and step definition; a budget stop resumes only once the
576
+ stopping limit is raised (else 409), and a run whose worker died is recovered
577
+ instead.
564
578
 
565
579
  The owner layout's `assistantToolCatalog` and plugin settings use one live,
566
580
  principal-filtered host projection. Native cookbook definitions supply their
567
- annotations, including `workProfile: design`; MCP preserves that presentation
568
- hint in `_meta.workProfile`. Provider function schemas remain unchanged. This
569
- metadata cannot select a profile or grant authority: tool arguments retain their
570
- closed schemas, and delegated plugin tokens cannot write owner work profiles or
571
- start host design runs. Native decisions use `OwnerApprovalContinuations` and
572
- its canonical adapters; the design runner only schedules its deterministic
573
- checkpoint after the recorded native outcome.
581
+ annotations, including `runTypes: ['workflow']`; MCP preserves that
582
+ presentation hint in `_meta.runTypes`. Provider function schemas remain
583
+ unchanged. This metadata cannot select a model or grant authority: tool
584
+ arguments retain their closed schemas, and delegated plugin tokens cannot write
585
+ owner assistant settings or start host workflow runs. Native decisions use `OwnerApprovalContinuations` and
586
+ its canonical adapters; the host carries the recorded native outcome into the
587
+ workflow run as its approval decision.
574
588
 
575
589
  Adapter-node emits `sveltekit:shutdown` after closing HTTP connections. The host
576
590
  registers one listener for that lifecycle event and drains its existing TaskRunner
577
591
  through the same idempotent `shutdown()` used by tests. Shutdown waits for any
578
592
  in-flight initialization, stops polling and liveness via TaskRunner's normal stop
579
- path, and disposes the design executor. `dispose()` removes the listener with its
593
+ path, and releases the workflow definition. `dispose()` removes the listener with its
580
594
  other synchronous registrations; callers embedding the host must await
581
595
  `shutdown()` before closing their database. In-flight work can still read the
582
596
  initialized host while it drains; shutdown never starts a new runner, and the
583
597
  stopped host refuses subsequent startup.
584
598
  If initialization failed after creating resources, shutdown still stops the
585
- partially-started runner and removes the retained design executor. The original
599
+ partially-started runner and releases the workflow definition. The original
586
600
  initialization caller owns its error; only cleanup failures reject shutdown.
587
601
  No signal handler, forced process exit, detached runner or timer unref workaround
588
602
  is added. Tests use the actual runner for idle and initialization-race shutdown,
@@ -593,10 +607,9 @@ started before initialization failed without a second failure or exit-code chang
593
607
  C4 follow-up: `/favicon.ico` redirects with public caching to the shipped
594
608
  `/favicon.svg` before runtime authorization/initialization (browser requests need
595
609
  no owner session). Cookbook host regression checks this conventional icon path.
596
- OpenAI work profiles reuse inference's reviewed rankings and single-step fallback;
597
- ChatGPT catalogs stay account-bound, and fallback memos include catalog, connection
598
- generation and preference revision. Codex gets the same fallback-store seam as
599
- Claude. No app-local engine, token or approval implementation is introduced.
610
+ OpenAI models reuse inference's reviewed rankings and single-step fallback;
611
+ ChatGPT catalogs stay account-bound, and fallback memos include catalog and
612
+ connection generation. Codex gets the same fallback-store seam as Claude. No app-local engine, token or approval implementation is introduced.
600
613
 
601
614
  Drive-by validation repair: onboardingWriteThrough's test fixture uses core's public
602
615
  `resolveManifestPath` rather than assuming every package emits dist/manifest.json.
@@ -607,7 +620,7 @@ or exposure behavior changes.
607
620
 
608
621
  `onboardingWriteThrough.test.ts` retains the generated contact route coverage for
609
622
  every bundled template. Mechanic additionally adds a field through the existing
610
- host MCP HTTP workflow and through a three-pass design run with the native owner
623
+ host MCP HTTP workflow and through a three-step workflow run with the native owner
611
624
  approval POST. There is currently no structural field-editor UI in this product;
612
625
  the MCP case exercises its existing HTTP mutation seam rather than claiming a
613
626
  browser editor. Both cases start with the real generated REST fallback, then
@@ -623,8 +636,8 @@ and custom value. No template-host route workaround is added for a core registry
623
636
  or exposure defect.
624
637
 
625
638
  The host opts chat and its client into generic public tool presentation. Trusted
626
- internal pass SSE retains its structured handoff; public events and thread reads
627
- exclude internal pass rows and render legacy unmarked tool rows generically.
639
+ internal step SSE retains its structured handoff; public events and thread reads
640
+ exclude internal step rows and render legacy unmarked tool rows generically.
628
641
  Approval captions come separately from bounded core editor command summaries or
629
642
  the existing manifest's business noun and trusted local-client label; unsafe
630
643
  identity labels, tool/package syntax and implementation captions use the fixed
@@ -633,22 +646,17 @@ authority, and safe business previews persist after completion. Change history
633
646
  retains its count/order and stable technical DTO keys, but displays human command
634
647
  captions with a safe fallback and no revision labels, raw edits or invented dates.
635
648
 
636
- V5 design runs begin by proposing. Without an explicit raw owner pass-count
637
- override, checked scalar/choice/money field additions, field rename/hide and
638
- list-label rename on one existing list can complete after one real pass. Exact
639
- canonical descriptor identities/aliases come from normal `app.describe`; uncertain
640
- or complex work expands to the configured maximum. Explicit pass counts remain
641
- fixed. Private classification metadata grants no authority, and the actual proposal
642
- index survives native holds, Stop and replacement-worker recovery without padded
643
- outputs or reset usage. See [design runs](cookbook-design-runs.md) for boundaries.
644
-
645
- Settings at `/settings/inference` is titled Assistant. Resolved profiles keep the
646
- requested model; their derived `modelSelection` may show the existing remembered
647
- downgrade. Settings and native execution share the same memo connection key:
648
- CLI version, owner engine generation and raw work-profile revision, scoped by
649
- tenant, owner, engine and requested model. Reading this projection neither probes
650
- a provider nor writes a fallback, and a remembered model never becomes the key
651
- for another fallback. Unknown model strength stays configured.
649
+ Workflow runs begin by proposing. Without an explicit app step count
650
+ (`workflowBudget.steps`), checked scalar/choice/money field additions, field
651
+ rename/hide and list-label rename on one existing list can complete after the
652
+ first step. Exact canonical descriptor identities/aliases come from normal
653
+ `app.describe`; uncertain or complex work expands to the configured maximum.
654
+ See [workflow runs](cookbook-workflow-runs.md) for boundaries.
655
+
656
+ Settings at `/settings/inference` is titled Assistant. Native execution keys
657
+ its memo by CLI version and owner engine generation, scoped by tenant, owner,
658
+ engine and requested model; a remembered model never becomes the key for
659
+ another fallback.
652
660
 
653
661
  Canonical approval captions describe pending, approved and executing changes in
654
662
  prospective language; successful captions and history describe completed changes.
@@ -668,7 +676,7 @@ response still has its existing immediate refresh; when that response is only
668
676
  approved, its later completion causes a separate refresh after the effect. An
669
677
  immediate succeeded decision is not refreshed again by subsequent card polls.
670
678
  First-seen historical success, including after transport recreation, is inert;
671
- terminal refusals never count as successful completion. No design-run/approval
679
+ terminal refusals never count as successful completion. No workflow-run/approval
672
680
  correlation metadata, additional poller or authority is introduced. This covers
673
681
  approval completion, not arbitrary preview-off run completion.
674
682
 
@@ -702,9 +710,9 @@ the owning plugin fixture checks this without executing or approving that hold.
702
710
 
703
711
  ## S1 assistant safety composition
704
712
 
705
- The existing work-profile facade stores per-app owner safety choices. Reads report editability only for a verified owner session; writes/reset require that session, live owner membership and revision checks, and protection-off requires explicit confirmation. No tool exposes these settings. Both the built-in chat policy and native/model MCP dispatch read the same removal preference. Only a short-lived token bound to this host's actual thread may opt out; outside MCP/plugin/local tokens always hold. Purges stay held. Only canonical single-record deletes from placed app-data lists receive trusted `recordDeletion` metadata; chat refuses that waiver for security/control identities and sensitive models. Native cookbook services always hold structure removals, undo and recipe disable, independently of both owner settings; design preview remains independent for non-removal changes. There is no host-side structural waiver or duplicate downstream check. Existing CRUD/audit execution is retained. CLI protection reaches turn specs and the same mode-specific readiness preflight; it never alters credential or cancellation boundaries.
713
+ The assistant-settings facade stores per-app owner safety choices. Reads report editability only for a verified owner session; writes/reset require that session, live owner membership and revision checks, and protection-off requires explicit confirmation. No tool exposes these settings. Both the built-in chat policy and native/model MCP dispatch read the same removal preference. Only a short-lived token bound to this host's actual thread may opt out; outside MCP/plugin/local tokens always hold. Purges stay held. Only canonical single-record deletes from placed app-data lists receive trusted `recordDeletion` metadata; chat refuses that waiver for security/control identities and sensitive models. Native cookbook services always hold structure removals, undo and recipe disable, independently of both owner settings; workflow preview remains independent for non-removal changes. There is no host-side structural waiver or duplicate downstream check. Existing CRUD/audit execution is retained. CLI protection reaches turn specs and the same mode-specific readiness preflight; it never alters credential or cancellation boundaries.
706
714
 
707
- Reuse check: smrt-dev-mcp reviews and purpose/name searches covered app-runtime, chat, core, inference, preferences, smrt-svelte, template-sveltekit and app-shell, plus `docs/knowledge/intents/index.md`. No new production files/components/helpers were introduced. Extended the existing work-profile types/facade, approval policy/authority, CLI specs/parsers/preflight, failure reporter/redactor, runtime cookie, ConnectAi route/client and UI primitives.
715
+ Reuse check: smrt-dev-mcp reviews and purpose/name searches covered app-runtime, chat, core, inference, preferences, smrt-svelte, template-sveltekit and app-shell, plus `docs/knowledge/intents/index.md`. No new production files/components/helpers were introduced. Extended the existing settings types/facade, approval policy/authority, CLI specs/parsers/preflight, failure reporter/redactor, runtime cookie, ConnectAi route/client and UI primitives.
708
716
 
709
717
  In-flight removal settings: the MCP boundary honors both the current owner preference and the running turn's existing `requiresApproval` gate. Tightening can add a hold immediately; relaxing never waives a hold already bound to that request. This prevents an effect from running and then being rejected by result authoring. CLI host tests flip the preference just before MCP execution and still require the original owner decision exactly once.
710
718
 
@@ -0,0 +1,102 @@
1
+ # Cookbook workflow runs
2
+
3
+ `host/workflow-runs.ts` (`createCookbookWorkflowRuns`) is the cookbook host's
4
+ change workflow on `@happyvertical/smrt-workflows` (#4994; concepts:
5
+ [AI runs](../../../docs/content/ai-runs.md)). It owns only the cookbook
6
+ definition, its step prompt, schema and check; the driver, checkpoints, job
7
+ handler, leases, claim fencing, stop/resume and approvals are the package's.
8
+ Runs, checkpoints and events live in core's `_smrt_ai_*` system tables; the
9
+ host creates no schema and runs no SQL on them.
10
+
11
+ ## Definition
12
+
13
+ - Key `cookbook-host.change`, version `1/steps-<n>`: one definition per host,
14
+ `n` from `workflowBudget.steps` (default 4). A run resumes only under the
15
+ step count that started it (`definition_changed` otherwise).
16
+ - Step 1 `Propose the change`, steps 2..n `Check and revise the change`. Every
17
+ step sends the registered prompt `cookbook-host.change.step`
18
+ (`cookbookChangeStepPrompt`, resolved with `resolvePrompt` for each attempt:
19
+ request, step, stage, the pinned schema, earlier outputs and any repair).
20
+ - Each step's `execute` runs an internal assistant turn through the host's
21
+ authenticated chat route (`executeStep` in `host/server.ts`): the turn's run
22
+ is a child of the workflow run (chat's internal turn `step`), so its calls
23
+ count in the workflow's totals and budget, a workflow stop/limit/cancel
24
+ reaches it, and its usage rows carry the step prompt's key and hash. The
25
+ turn gets read-only tools only, the run's pinned execution (engine, tier,
26
+ model, effort) and the original permission ceiling intersected with live
27
+ permissions. A turn that ended because the run stopped is the run's stop,
28
+ never a failed step. An external CLI engine's turn opens no run in chat, so
29
+ its step records no calls.
30
+ - Output is validated (Ajv, strict) against the schema pinned at start: the
31
+ output envelope (`summary`, `checks`, `ready`, `operations`, bounded
32
+ `personSummary`) with `oneOf` the live owner's structural tool schemas
33
+ (`approvalId` removed). Invalid output is repaired on the same step up to
34
+ `repairRetries`. Every execute and check re-derives the live schema and
35
+ refuses a changed one (`The change schema changed`).
36
+
37
+ ## Check (host-owned)
38
+
39
+ - The last step, or an adaptive first step (no explicit step count, a ready
40
+ proposal of additive scalar/choice/money fields, field rename/hide or list
41
+ label rename on one existing list, matched exactly against the bounded
42
+ `app.describe` catalog pinned at start), applies the proposal through the
43
+ core cookbook service with `workflowAction { application, runId, actionId }`.
44
+ - Each `approval_required` result is a hold: the check returns
45
+ `waitingApproval` with `holdRef: approval:<id>`; the run waits. One hold per
46
+ gated action; the step passes only when every action applied
47
+ (smrt-workflows counts the approved holds; a run never ends `done` with a
48
+ hold outstanding). Re-running the check after approval replays the held
49
+ action once through core's stable action identity.
50
+ - An unready final proposal fails the run (`check_failed`) with the host's
51
+ fixed note; a pre-effect `collision`/`clarification_required` before the
52
+ last step expands the work; any other non-ok result throws.
53
+ - Every other step passes and marks the work expanded.
54
+
55
+ ## Host surface
56
+
57
+ `host.workflowRuns.forOwner(ownerId, tenantId)`: `start`, `latest(threadId)`
58
+ (newest of the owner's last 100 runs, by the run's `threadId` tag), `get`,
59
+ `present` (wire progress: `{ runId, step: { index, count, name }, status,
60
+ note }`, fixed notes, `checking` while a check runs), `validateAction`,
61
+ `stop`, `resume`, `settleHold`.
62
+
63
+ - Routes: `GET /api/assistant/runs?threadId=`, `POST /api/assistant/runs`
64
+ (`{ threadId, content }` only, same origin, thread ownership through chat's
65
+ own read), `POST /api/assistant/runs/:id/stop|resume`. Errors are a generic
66
+ 409 `workflow_run_unavailable`.
67
+ - Native decisions: after the approval decide route (and on status reads and
68
+ owner recovery) `settleHold` carries the hold's outcome into the run:
69
+ approved, executing or succeeded → approve (the check re-runs); denied,
70
+ failed or expired → refuse (`check_failed`). A run stopped while waiting
71
+ keeps the decision; the cookbook continuation defers executing the hold
72
+ while the run is stopped, and explicit Resume applies it once.
73
+ - Resume raises token/time limits to the app's current budget (never above
74
+ it); a budget stop needs the stopping limit raised (else 409). A run whose
75
+ worker died (its job failed with `stale-recovery`) is recovered by Resume.
76
+ - Registration: `createCookbookWorkflowRuns` registers the smrt-workflows
77
+ handler, so the host creates it before `TaskRunner.start()` (afterwards it
78
+ throws `JobHandlerRegistrationClosedError`). The runner uses
79
+ `claimFencing: true`. Shutdown stops the runner, then disposes.
80
+
81
+ ## SQLite note (#5022)
82
+
83
+ The local runtime opens the app file through more than one `node:sqlite`
84
+ connection. Run writes go through core's run API, which serializes them in
85
+ process with the chat route's writes; a raw transaction on a second handle
86
+ that overlaps a held write stalls the event loop for the busy timeout and
87
+ fails (`database is locked`). The fix belongs in the framework (#5022).
88
+
89
+ ## Tests
90
+
91
+ `__tests__/cookbookWorkflowRuns.test.ts` (in-process SQLite, real TaskRunner
92
+ with claim fencing, scripted step): admission before execution, owner
93
+ isolation, three checked steps on the registered prompt with the pinned
94
+ schema, repair, an unready final proposal, cooperative stop and resume, a
95
+ changed live schema, registration after runner start.
96
+ `__tests__/cookbookHost.test.ts` covers the routes: run status by thread,
97
+ native approval holds (preview on/off, destructive, denied, several holds of
98
+ one proposal), approval while stopped then Resume, budget stop and resume,
99
+ schema repair without effects, and crash recovery with a second real runner
100
+ whose claim fencing refuses the dead worker's late save.
101
+ `__tests__/onboardingWriteThrough.test.ts` (mechanic, `workflow`) runs a
102
+ three-step workflow run with the native approval POST over the real runtime.
@@ -26,6 +26,10 @@ presented as WebMCP execution.
26
26
  - `pnpm test:m5` runs the whole aggregate gate through
27
27
  `e2e/support/gate.mjs`, which requires a PostgreSQL service and fails when a
28
28
  required profile case is missing rather than merely absent from the log.
29
+ Its Vitest half runs this package's whole suite in two passes: files named
30
+ `*.postgres.optional.test.ts` share the gate's one disposable database and
31
+ run one at a time; every other file runs two at a time. A test that connects
32
+ to that database must carry the `.postgres.optional` name.
29
33
  - Tracing, video, and screenshots stay off: onboarding carries a single-use
30
34
  bootstrap token in a URL.
31
35
  - `m5-gate-summary.json` is the one file the gate writes inside the package;
@@ -2,5 +2,5 @@ import { createInferenceSettingsPage } from '@happyvertical/smrt-template-svelte
2
2
  import { host } from '$lib/server/smrt';
3
3
  export const { load, actions } = createInferenceSettingsPage(
4
4
  host.inferenceSettings,
5
- host.workProfiles,
5
+ host.assistantSettings,
6
6
  );
@@ -7,7 +7,7 @@ import { createDataSurfaceRegistry } from '@happyvertical/smrt-ui/data-surface';
7
7
  export function createCookbookAssistant(options = {}) {
8
8
  const transport = createAssistantHttpTransport({
9
9
  endpoint: options.endpoint ?? '/api/assistant',
10
- designRuns: true,
10
+ workflowRuns: true,
11
11
  });
12
12
  // Observe the existing authorized card polls; historical terminal rows are inert.
13
13
  // Retain terminal observations so overlapping/stale requests cannot re-arm them.
@@ -4,13 +4,13 @@ import { type MountAssistantRoutesOptions } from '@happyvertical/smrt-chat/svelt
4
4
  import { type ActivationCoordinator, type ActivationManifest } from '@happyvertical/smrt-core/activation';
5
5
  import { type AppModelSnapshot } from '@happyvertical/smrt-core/app-models';
6
6
  import { type CookbookToolOptions } from '@happyvertical/smrt-core/cookbook/tools';
7
- import { type ChatGPTPlanConnection, createAgentCliService, type WorkProfileName } from '@happyvertical/smrt-inference/server';
8
- import { type WorkProfilePreferences } from '@happyvertical/smrt-preferences';
7
+ import { type AssistantSettings, type ChatGPTPlanConnection, createAgentCliService } from '@happyvertical/smrt-inference/server';
9
8
  import { type CookbookAppData } from '@happyvertical/smrt-svelte/cookbook/server';
10
9
  import type { OnboardingState } from '@happyvertical/smrt-svelte/onboarding';
11
10
  import type { Cookbook } from '@happyvertical/smrt-types';
12
11
  import type { Handle, RequestEvent, ServerLoad } from '@sveltejs/kit';
13
12
  import { type PluginModeState } from './plugin-mode.js';
13
+ import { type WorkflowRunBudget } from './workflow-runs.js';
14
14
  export interface CookbookHostOptions {
15
15
  runtime: SmrtSvelteKitRuntime;
16
16
  packageName?: string;
@@ -29,6 +29,12 @@ export interface CookbookHostOptions {
29
29
  /** In-process test/host seams; inference still owns vendor discovery and credentials. */
30
30
  cli?: ReturnType<typeof createAgentCliService>;
31
31
  chatgpt?: ChatGPTPlanConnection;
32
+ /**
33
+ * The app's setting for the cookbook change workflow's budget (#5005);
34
+ * unset keys keep {@link WORKFLOW_RUN_BUDGET}. `steps` is the workflow
35
+ * definition's step count.
36
+ */
37
+ workflowBudget?: Partial<WorkflowRunBudget>;
32
38
  }
33
39
  /** Normal local runtime, with fixed-graph SQLite activation before owner bootstrap. */
34
40
  export declare function createCookbookApplication(options: Omit<CookbookHostOptions, 'runtime' | 'activation' | 'packageName'> & {
@@ -73,32 +79,14 @@ export declare function createCookbookApplication(options: Omit<CookbookHostOpti
73
79
  };
74
80
  pluginMode: (event: RequestEvent) => Promise<Response>;
75
81
  inferenceSettings: import("@happyvertical/smrt-inference/server").InferenceSettingsController;
76
- workProfiles: {
82
+ assistantSettings: {
77
83
  read(event: RequestEvent): Promise<{
78
- resolved: {
79
- unavailable: boolean;
80
- name: WorkProfileName;
81
- engine: import("@happyvertical/smrt-inference").InferenceEngineId;
82
- model?: string;
83
- effort: import("@happyvertical/smrt-inference").WorkReasoningEffort;
84
- tier: "best" | "good" | "cheap";
85
- budgets: import("@happyvertical/smrt-inference").WorkProfileBudgets;
86
- autoEscalate: boolean;
87
- previewBeforeApply: boolean;
88
- modelSelection?: {
89
- kind: "strongest" | "custom" | "configured" | "fallback";
90
- requestedModel?: string;
91
- resolvedModel?: string;
92
- };
93
- }[];
94
- editable: boolean;
95
- chatgptSignedIn: boolean;
96
- settings: WorkProfilePreferences;
84
+ settings: AssistantSettings;
97
85
  revision: string | null;
98
- issues: import("@happyvertical/smrt-preferences").PreferenceIssue[];
86
+ editable: boolean;
99
87
  }>;
100
88
  write(event: RequestEvent, payload: {
101
- settings: WorkProfilePreferences;
89
+ settings: AssistantSettings;
102
90
  revision: string | null;
103
91
  confirmUnprotectedCli?: boolean;
104
92
  }): Promise<import("@happyvertical/smrt-preferences").PreferenceSaveResult>;
@@ -184,32 +172,14 @@ export declare function createCookbookHost(options: CookbookHostOptions): {
184
172
  };
185
173
  pluginMode: (event: RequestEvent) => Promise<Response>;
186
174
  inferenceSettings: import("@happyvertical/smrt-inference/server").InferenceSettingsController;
187
- workProfiles: {
175
+ assistantSettings: {
188
176
  read(event: RequestEvent): Promise<{
189
- resolved: {
190
- unavailable: boolean;
191
- name: WorkProfileName;
192
- engine: import("@happyvertical/smrt-inference").InferenceEngineId;
193
- model?: string;
194
- effort: import("@happyvertical/smrt-inference").WorkReasoningEffort;
195
- tier: "best" | "good" | "cheap";
196
- budgets: import("@happyvertical/smrt-inference").WorkProfileBudgets;
197
- autoEscalate: boolean;
198
- previewBeforeApply: boolean;
199
- modelSelection?: {
200
- kind: "strongest" | "custom" | "configured" | "fallback";
201
- requestedModel?: string;
202
- resolvedModel?: string;
203
- };
204
- }[];
205
- editable: boolean;
206
- chatgptSignedIn: boolean;
207
- settings: WorkProfilePreferences;
177
+ settings: AssistantSettings;
208
178
  revision: string | null;
209
- issues: import("@happyvertical/smrt-preferences").PreferenceIssue[];
179
+ editable: boolean;
210
180
  }>;
211
181
  write(event: RequestEvent, payload: {
212
- settings: WorkProfilePreferences;
182
+ settings: AssistantSettings;
213
183
  revision: string | null;
214
184
  confirmUnprotectedCli?: boolean;
215
185
  }): Promise<import("@happyvertical/smrt-preferences").PreferenceSaveResult>;