@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.
@@ -2,7 +2,6 @@
2
2
  import type { InferenceSettingsPageData } from '@happyvertical/smrt-inference/server';
3
3
  import { InferenceSettingsPanel } from '@happyvertical/smrt-inference/svelte';
4
4
  import { ShellSettingsPage } from '@happyvertical/smrt-svelte/app';
5
- import { WorkProfileSettings } from '@happyvertical/smrt-svelte/settings';
6
5
  import type { createCookbookHost } from '@happyvertical/smrt-template-sveltekit/host/server';
7
6
  import { postSetting } from '@happyvertical/smrt-template-sveltekit/host/sveltekit-client';
8
7
  import { goto } from '$app/navigation';
@@ -12,8 +11,10 @@ let {
12
11
  data,
13
12
  }: {
14
13
  data: InferenceSettingsPageData & {
15
- workProfiles?: Awaited<
16
- ReturnType<ReturnType<typeof createCookbookHost>['workProfiles']['read']>
14
+ assistant?: Awaited<
15
+ ReturnType<
16
+ ReturnType<typeof createCookbookHost>['assistantSettings']['read']
17
+ >
17
18
  >;
18
19
  };
19
20
  } = $props();
@@ -60,11 +61,6 @@ async function discover(): Promise<void> {
60
61
  <ShellSettingsPage basePath="/settings" title="Assistant">
61
62
  <!-- The owner edits the whole app (app scope); a member without the
62
63
  permission reads it, and the server refuses their writes. -->
63
- {#if data.workProfiles}
64
- <WorkProfileSettings settings={data.workProfiles.settings} resolved={data.workProfiles.resolved} editable={data.workProfiles.editable} chatgptSignedIn={data.workProfiles.chatgptSignedIn}
65
- onsave={async (settings, confirmation) => { const result = await postSetting('saveWorkProfiles', { settings, ...confirmation, revision: data.workProfiles?.revision }); if (!result.ok) throw new Error('Save refused'); }}
66
- onreset={async () => { const result = await postSetting('resetWorkProfiles', { revision: data.workProfiles?.revision }); if (!result.ok) throw new Error('Reset refused'); }} />
67
- {/if}
68
64
  <InferenceSettingsPanel
69
65
  defaults={data.defaults}
70
66
  providers={data.providers}
@@ -93,6 +89,11 @@ async function discover(): Promise<void> {
93
89
  onSaveTranscripts={data.canEdit
94
90
  ? (change) => save('saveTranscripts', change)
95
91
  : undefined}
92
+ assistant={data.assistant ?? null}
93
+ onSaveAssistant={(change) =>
94
+ save('saveAssistant', { ...change, revision: data.assistant?.revision ?? null })}
95
+ onResetAssistant={() =>
96
+ save('resetAssistant', { revision: data.assistant?.revision ?? null })}
96
97
  onUsageGroupBy={(by) =>
97
98
  goto(`${page.url.pathname}?by=${by.join(',')}`, {
98
99
  keepFocus: true,
@@ -1,4 +1,4 @@
1
1
  {
2
- "@happyvertical/smrt-app-mcp": "^0.61.6",
3
- "@happyvertical/smrt-mcp-openai": "^0.61.6"
2
+ "@happyvertical/smrt-app-mcp": "^0.62.1",
3
+ "@happyvertical/smrt-mcp-openai": "^0.62.1"
4
4
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@happyvertical/smrt-template-sveltekit",
3
- "version": "0.61.6",
3
+ "version": "0.62.1",
4
4
  "description": "Minimal SvelteKit project template with s-m-r-t framework integration",
5
5
  "type": "module",
6
6
  "main": "index.js",
@@ -86,45 +86,48 @@
86
86
  "directory": "packages/template-sveltekit"
87
87
  },
88
88
  "peerDependencies": {
89
- "@happyvertical/smrt-core": "0.61.6",
90
- "@happyvertical/smrt-agents": "0.61.6",
91
- "@happyvertical/smrt-app-runtime": "0.61.6",
92
- "@happyvertical/smrt-app-mcp": "0.61.6",
93
- "@happyvertical/smrt-chat": "0.61.6",
94
- "@happyvertical/smrt-inference": "0.61.6",
95
- "@happyvertical/smrt-preferences": "0.61.6",
96
- "@happyvertical/smrt-svelte": "0.61.6",
97
- "@happyvertical/smrt-tenancy": "0.61.6",
98
- "@happyvertical/smrt-types": "0.61.6",
99
- "@happyvertical/smrt-ui": "0.61.6",
100
- "@happyvertical/smrt-users": "0.61.6",
89
+ "@happyvertical/smrt-core": "0.62.1",
90
+ "@happyvertical/smrt-agents": "0.62.1",
91
+ "@happyvertical/smrt-app-runtime": "0.62.1",
92
+ "@happyvertical/smrt-app-mcp": "0.62.1",
93
+ "@happyvertical/smrt-chat": "0.62.1",
94
+ "@happyvertical/smrt-inference": "0.62.1",
95
+ "@happyvertical/smrt-preferences": "0.62.1",
96
+ "@happyvertical/smrt-svelte": "0.62.1",
97
+ "@happyvertical/smrt-tenancy": "0.62.1",
98
+ "@happyvertical/smrt-types": "0.62.1",
99
+ "@happyvertical/smrt-ui": "0.62.1",
100
+ "@happyvertical/smrt-users": "0.62.1",
101
101
  "@sveltejs/kit": "^2.70.3",
102
102
  "svelte": "^5.57.1",
103
103
  "@happyvertical/sql": ">=0.89.12",
104
- "@happyvertical/smrt-jobs": "0.61.6"
104
+ "@happyvertical/smrt-jobs": "0.62.1",
105
+ "@happyvertical/smrt-prompts": "0.62.1",
106
+ "@happyvertical/smrt-workflows": "0.62.1"
105
107
  },
106
108
  "devDependencies": {
107
- "@happyvertical/smrt-app-cli": "0.61.6",
108
- "@happyvertical/smrt-app-mcp": "0.61.6",
109
- "@happyvertical/smrt-app-runtime": "0.61.6",
110
- "@happyvertical/smrt-assets": "0.61.6",
111
- "@happyvertical/smrt-chat": "0.61.6",
112
- "@happyvertical/smrt-cli": "0.61.6",
113
- "@happyvertical/smrt-config": "0.61.6",
114
- "@happyvertical/smrt-inference": "0.61.6",
115
- "@happyvertical/smrt-jobs": "0.61.6",
116
- "@happyvertical/smrt-mcp-openai": "0.61.6",
117
- "@happyvertical/smrt-playbooks": "0.61.6",
118
- "@happyvertical/smrt-preferences": "0.61.6",
119
- "@happyvertical/smrt-profiles": "0.61.6",
120
- "@happyvertical/smrt-prompts": "0.61.6",
121
- "@happyvertical/smrt-scanner": "0.61.6",
122
- "@happyvertical/smrt-secrets": "0.61.6",
123
- "@happyvertical/smrt-svelte": "0.61.6",
124
- "@happyvertical/smrt-tenancy": "0.61.6",
125
- "@happyvertical/smrt-ui": "0.61.6",
126
- "@happyvertical/smrt-users": "0.61.6",
127
- "@happyvertical/smrt-web": "0.61.6",
109
+ "@happyvertical/smrt-app-cli": "0.62.1",
110
+ "@happyvertical/smrt-app-mcp": "0.62.1",
111
+ "@happyvertical/smrt-app-runtime": "0.62.1",
112
+ "@happyvertical/smrt-assets": "0.62.1",
113
+ "@happyvertical/smrt-chat": "0.62.1",
114
+ "@happyvertical/smrt-cli": "0.62.1",
115
+ "@happyvertical/smrt-config": "0.62.1",
116
+ "@happyvertical/smrt-inference": "0.62.1",
117
+ "@happyvertical/smrt-jobs": "0.62.1",
118
+ "@happyvertical/smrt-mcp-openai": "0.62.1",
119
+ "@happyvertical/smrt-playbooks": "0.62.1",
120
+ "@happyvertical/smrt-preferences": "0.62.1",
121
+ "@happyvertical/smrt-profiles": "0.62.1",
122
+ "@happyvertical/smrt-prompts": "0.62.1",
123
+ "@happyvertical/smrt-scanner": "0.62.1",
124
+ "@happyvertical/smrt-secrets": "0.62.1",
125
+ "@happyvertical/smrt-svelte": "0.62.1",
126
+ "@happyvertical/smrt-tenancy": "0.62.1",
127
+ "@happyvertical/smrt-ui": "0.62.1",
128
+ "@happyvertical/smrt-users": "0.62.1",
129
+ "@happyvertical/smrt-web": "0.62.1",
130
+ "@happyvertical/smrt-workflows": "0.62.1",
128
131
  "@happyvertical/sql": "^0.89.12",
129
132
  "@modelcontextprotocol/client": "2.3.1",
130
133
  "@modelcontextprotocol/server": "^2.3.1",
@@ -138,20 +141,20 @@
138
141
  "typescript": "6.0.3",
139
142
  "vite": "8.1.6",
140
143
  "vitest": "4.1.10",
141
- "@happyvertical/smrt-reports": "0.61.6",
142
- "@happyvertical/smrt-agents": "0.61.6",
143
- "@happyvertical/smrt-types": "0.61.6",
144
- "@happyvertical/smrt-commerce": "0.61.6",
145
- "@happyvertical/smrt-events": "0.61.6",
146
- "@happyvertical/smrt-inventory": "0.61.6"
144
+ "@happyvertical/smrt-reports": "0.62.1",
145
+ "@happyvertical/smrt-agents": "0.62.1",
146
+ "@happyvertical/smrt-types": "0.62.1",
147
+ "@happyvertical/smrt-commerce": "0.62.1",
148
+ "@happyvertical/smrt-events": "0.62.1",
149
+ "@happyvertical/smrt-inventory": "0.62.1"
147
150
  },
148
151
  "publishConfig": {
149
152
  "registry": "https://registry.npmjs.org",
150
153
  "access": "public"
151
154
  },
152
155
  "dependencies": {
153
- "@happyvertical/smrt-app-cli": "0.61.6",
154
- "@happyvertical/smrt-desktop": "0.61.6",
156
+ "@happyvertical/smrt-app-cli": "0.62.1",
157
+ "@happyvertical/smrt-desktop": "0.62.1",
155
158
  "ajv": "^8.20.0"
156
159
  },
157
160
  "scripts": {
@@ -161,6 +164,6 @@
161
164
  "test:m5": "node ../../scripts/run-with-ci-postgres.mjs -- node e2e/support/gate.mjs",
162
165
  "test:postgres": "node ../../scripts/run-with-ci-postgres.mjs -- pnpm exec vitest run --no-file-parallelism __tests__/*.postgres.optional.test.ts",
163
166
  "test:watch": "vitest",
164
- "typecheck": "tsc --noEmit -p tsconfig.fixture.json && tsc --noEmit -p tsconfig.host.json"
167
+ "typecheck": "node ../../scripts/write-source-typecheck-config.mjs tsconfig.fixture.json .smrt/tsconfig.fixture-typecheck.json && tsc -p .smrt/tsconfig.fixture-typecheck.json && tsc -p tsconfig.host-typecheck.json"
165
168
  }
166
169
  }
@@ -41,26 +41,26 @@
41
41
  "svelte-check": "^4.7.6",
42
42
  "typescript": "6.0.3",
43
43
  "vite": "8.3.3",
44
- "@happyvertical/smrt-cli": "^0.61.6"
44
+ "@happyvertical/smrt-cli": "^0.62.1"
45
45
  },
46
46
  "dependencies": {
47
- "@happyvertical/smrt-app-runtime": "^0.61.6",
48
- "@happyvertical/smrt-config": "^0.61.6",
49
- "@happyvertical/smrt-core": "^0.61.6",
50
- "@happyvertical/smrt-inference": "^0.61.6",
51
- "@happyvertical/smrt-jobs": "^0.61.6",
52
- "@happyvertical/smrt-preferences": "^0.61.6",
53
- "@happyvertical/smrt-profiles": "^0.61.6",
54
- "@happyvertical/smrt-prompts": "^0.61.6",
55
- "@happyvertical/smrt-svelte": "^0.61.6",
56
- "@happyvertical/smrt-tenancy": "^0.61.6",
57
- "@happyvertical/smrt-ui": "^0.61.6",
58
- "@happyvertical/smrt-users": "^0.61.6",
59
- "@happyvertical/smrt-web": "^0.61.6",
47
+ "@happyvertical/smrt-app-runtime": "^0.62.1",
48
+ "@happyvertical/smrt-config": "^0.62.1",
49
+ "@happyvertical/smrt-core": "^0.62.1",
50
+ "@happyvertical/smrt-inference": "^0.62.1",
51
+ "@happyvertical/smrt-jobs": "^0.62.1",
52
+ "@happyvertical/smrt-preferences": "^0.62.1",
53
+ "@happyvertical/smrt-profiles": "^0.62.1",
54
+ "@happyvertical/smrt-prompts": "^0.62.1",
55
+ "@happyvertical/smrt-svelte": "^0.62.1",
56
+ "@happyvertical/smrt-tenancy": "^0.62.1",
57
+ "@happyvertical/smrt-ui": "^0.62.1",
58
+ "@happyvertical/smrt-users": "^0.62.1",
59
+ "@happyvertical/smrt-web": "^0.62.1",
60
60
  "@happyvertical/sql": "^0.89.12",
61
61
  "@modelcontextprotocol/server": "^2.3.1",
62
- "@happyvertical/smrt-reports": "^0.61.6",
63
- "@happyvertical/smrt-secrets": "^0.61.6",
64
- "@happyvertical/smrt-template-sveltekit": "^0.61.6"
62
+ "@happyvertical/smrt-reports": "^0.62.1",
63
+ "@happyvertical/smrt-secrets": "^0.62.1",
64
+ "@happyvertical/smrt-template-sveltekit": "^0.62.1"
65
65
  }
66
66
  }
@@ -19,28 +19,28 @@ export default {
19
19
 
20
20
  // Dependencies to add to generated project
21
21
  dependencies: {
22
- '@happyvertical/smrt-app-runtime': '^0.61.6',
23
- '@happyvertical/smrt-config': '^0.61.6',
24
- '@happyvertical/smrt-core': '^0.61.6',
25
- '@happyvertical/smrt-inference': '^0.61.6',
26
- '@happyvertical/smrt-jobs': '^0.61.6',
27
- '@happyvertical/smrt-preferences': '^0.61.6',
28
- '@happyvertical/smrt-profiles': '^0.61.6',
29
- '@happyvertical/smrt-prompts': '^0.61.6',
30
- '@happyvertical/smrt-reports': '^0.61.6',
31
- '@happyvertical/smrt-secrets': '^0.61.6',
32
- '@happyvertical/smrt-svelte': '^0.61.6',
33
- '@happyvertical/smrt-template-sveltekit': '^0.61.6',
34
- '@happyvertical/smrt-tenancy': '^0.61.6',
35
- '@happyvertical/smrt-ui': '^0.61.6',
36
- '@happyvertical/smrt-users': '^0.61.6',
37
- '@happyvertical/smrt-web': '^0.61.6',
22
+ '@happyvertical/smrt-app-runtime': '^0.62.1',
23
+ '@happyvertical/smrt-config': '^0.62.1',
24
+ '@happyvertical/smrt-core': '^0.62.1',
25
+ '@happyvertical/smrt-inference': '^0.62.1',
26
+ '@happyvertical/smrt-jobs': '^0.62.1',
27
+ '@happyvertical/smrt-preferences': '^0.62.1',
28
+ '@happyvertical/smrt-profiles': '^0.62.1',
29
+ '@happyvertical/smrt-prompts': '^0.62.1',
30
+ '@happyvertical/smrt-reports': '^0.62.1',
31
+ '@happyvertical/smrt-secrets': '^0.62.1',
32
+ '@happyvertical/smrt-svelte': '^0.62.1',
33
+ '@happyvertical/smrt-template-sveltekit': '^0.62.1',
34
+ '@happyvertical/smrt-tenancy': '^0.62.1',
35
+ '@happyvertical/smrt-ui': '^0.62.1',
36
+ '@happyvertical/smrt-users': '^0.62.1',
37
+ '@happyvertical/smrt-web': '^0.62.1',
38
38
  '@happyvertical/sql': '^0.89.12',
39
39
  '@modelcontextprotocol/server': '^2.3.1',
40
40
  },
41
41
 
42
42
  devDependencies: {
43
- '@happyvertical/smrt-cli': '^0.61.6',
43
+ '@happyvertical/smrt-cli': '^0.62.1',
44
44
  '@sveltejs/adapter-node': '^5.5.7',
45
45
  '@sveltejs/kit': '2.70.3',
46
46
  '@sveltejs/vite-plugin-svelte': '^7.3.0',
@@ -1,164 +0,0 @@
1
- # Cookbook design runs
2
-
3
- `host/design-runs.ts` composes inference's `createDesignRunDriver`,
4
- `createDesignRunStore` and registered `DesignRunRecord.execute` with jobs'
5
- `SmrtJobCollection` and the host's existing `TaskRunner`. It installs one executor
6
- per database. Runtime migrations create the checkpoint and job tables; the
7
- factory does not create schema. Dispose the executor after stopping the runner.
8
- Jobs use one attempt: domain checkpoints own resume, so a stopped old invocation
9
- cannot automatically reclaim its job while an external promise is still settling.
10
-
11
- The authenticated host binds `forOwner(ownerId, tenantId)` from the live session.
12
- `start` commits the checkpoint and job admission in one transaction before any
13
- model executes. `status`, `latest(threadId)`, `stop` and `resume` keep the same
14
- owner and tenant binding after a restart. `latest` considers the newest 100 owner
15
- runs. Resume rejects while the prior job still runs, avoiding a dedupe race with
16
- its terminal write; retry once the current pass has stopped.
17
-
18
- The pinned design profile, original authenticated permission ceiling and
19
- thread/request text are durable inputs, never a credential or captured Request.
20
- Live permissions are intersected with that ceiling for every pass, so restart
21
- cannot expand authority. Each pass reauthorizes the owner. A real
22
- TaskRunner context and live job claim are required for execution, and checkpoint
23
- writes recheck that claim. Request disconnects have no signal connection to the
24
- worker. Stop aborts the local pass cooperatively and preserves its durable
25
- checkpoint. Once the original model/check promise actually settles, a worker-only
26
- transaction releases the stopped lease. Its no-op conditional update locks the
27
- captured job, worker and attempt before the checkpoint CAS; a recovered or later
28
- claim cannot release that lease. A cooperative Stop can resume immediately after
29
- settlement, even with a long call deadline. An external engine that ignores
30
- cancellation keeps its lease until actual settlement or the lease deadline; a new
31
- process recovers through jobs' worker-liveness contract.
32
-
33
- New runs pin `cookbook-design/v5/<maximum>`. Their first real pass proposes the
34
- change. With no raw owner `design.budgets.passes` property, a ready proposal of
35
- small changes on one existing list may finish after that pass's normal mechanical
36
- check and native Apply. Additive scalar/choice/money fields, field rename/hide and
37
- list display-label rename are eligible; money's paired currency column remains
38
- one logical field. Relationship fields, multiple resolved lists, removal and
39
- restructuring expand to the configured maximum. Existing schemas, permissions,
40
- revision checks and approvals remain authoritative; eligibility grants no access.
41
-
42
- When the normal service catalog offers `app.describe`, one ordinary read pins
43
- its revision and bounded canonical list IDs, labels and aliases solely for
44
- classification. If that read is not offered (for example, a recipe-only host
45
- without an app editor), classification is absent and the full path remains
46
- available. No permission or app-editor requirement is added to admission; owner
47
- and thread authorization remain mandatory. Current-revision reads for actual
48
- Apply/recovery remain strict. Exact unambiguous descriptor
49
- matches and sequential list-label renames establish same-list identity. Unknown
50
- or ambiguous references expand rather than guessing. A proved pre-effect core
51
- collision or clarification expands the remaining work; after any receipt/hold,
52
- or an uncertain thrown failure, the host never starts another planning pass.
53
- Explicit raw pass counts (including four) remain fixed; untouched defaults,
54
- unrelated edits and Reset `{}` stay adaptive. The private descriptor/fixed-count
55
- pins cannot be supplied by HTTP/tool metadata. No new preference is introduced.
56
-
57
- Ajv validates every engine result and repair against the pinned schema, including
58
- separate raw `summary` and untrusted `personSummary` fields. The host keeps their
59
- raw values privately and publishes fixed safe person notes. An early completion
60
- retains its actual checked index, outputs, attempts and consumed usage; no skipped
61
- pass receives fabricated metadata. Public progress starts with one planned pass
62
- and expands only when more work is needed. Native holds, Stop/Resume and real
63
- replacement job claims replay that same proposal/action identity without another
64
- model call. Pinned v3/v4 contracts and their original pass ordering remain intact;
65
- the narrow historical v2 migration still targets v3, never v5.
66
-
67
- Their operation schema is a `oneOf`
68
- of the current core cookbook structural tool names and input schemas, resolved
69
- under the live owner. Approval ids are excluded from proposal arguments. The
70
- model sees those exact schemas as proposal data while its callable tools remain
71
- read-only; unknown tool names, MCP wire names and extra arguments enter the same
72
- bounded schema repair path without effects. Persisted v1 runs retain their
73
- original schema and review-pending semantics; their completed outputs are never
74
- reinterpreted as valid actions.
75
-
76
- Authenticated same-origin `POST /api/assistant/design-runs` admits a design job
77
- directly using exactly `{ threadId, content }`. It reuses chat's own thread-read
78
- handler to check session ownership, then resolves the design profile and
79
- permission ceiling on the server. It accepts no identity, engine, profile or
80
- action-key overrides and performs no preliminary model turn.
81
-
82
- The server's pass executor uses its existing authenticated assistant route and
83
- engine adapters with job-bound limits. Design passes offer only read/proposal
84
- tools: replay and schema repair cannot repeat mutation effects. The run produces
85
- a concrete proposal (`operations: [{ tool, args }]`) in the original thread.
86
- A ready durable proposal is applied by its deterministic check through the
87
- existing core cookbook service. The host supplies an application/run/action
88
- identity; an action's index is stable and core pins its exact arguments. Preview
89
- creates a native durable owner hold in the existing thread approval UI. Its
90
- ordinary decision route executes the held action with current owner permissions
91
- intersected with the original ceiling, then queues the same final check. That
92
- check recovers the exact core result before advancing to `done`; it never makes
93
- another model call. With preview off, additive changes apply directly and still
94
- enter change history. Destructive changes always retain native owner approval.
95
- An unready final durable proposal terminates as failed with the host's plain note that
96
- no changes were applied and more information is needed. It creates no approval
97
- hold or history entry. Historical v1/v2 review semantics are preserved. The
98
- profile grants no authority. The model
99
- never applies effects as part of a replayable schema pass. Deterministic Fresh,
100
- template application and Start over keep their established policy; only actual
101
- assistant work starts a design job.
102
-
103
- Stop also pauses new effects from an existing native hold. The ordinary owner
104
- decision can still record approval while stopped, returning its normal approved
105
- state without consuming or executing it. Explicit Resume applies that same hold
106
- once and completes the run. Denial remains a durable terminal decision. Stop
107
- does not reverse an effect already recorded in change history.
108
-
109
- Explicit owner Resume can migrate a completed v2 `app.addField` review proposal
110
- to v3's final check without repeating its model passes. This narrow adapter pins
111
- the core argument schema from committed `d3b879bef0` using core's exported
112
- `stableStringify`; other v2 operations require a fresh run. Migration requires
113
- a ready nonempty proposal valid against the current supported core schemas, its
114
- original permission ceiling, live thread ownership and application revision, and
115
- no job or execution lease. One
116
- transaction compares the exact old payload, revision and scoped identity before
117
- changing the definition; attempts, outputs, usage and run id are preserved. A
118
- proposal/schema fingerprint prevents later drift. Durable runs persist their own
119
- schema pin, preserve it through every check and validate it before native
120
- continuation effects. V1 and unready v2 outputs are never migrated. HTTP cannot
121
- select a definition, action or profile.
122
-
123
- Crash recovery preserves the persisted final-check lease. The old job must first
124
- be terminally recovered by TaskRunner's worker-liveness sweep, with an
125
- authoritative `stale-recovery` outcome for that exact job/attempt. Owner Resume
126
- then atomically admits a new existing job against the unchanged checkpoint. Its
127
- real replacement claim authorizes check replay and core returns the exact
128
- committed action result. Generic failed jobs and a live original worker do not
129
- qualify; no lease is cleared to bypass ownership.
130
-
131
- Inference reserves unknown usage conservatively, accumulates time/tokens across
132
- passes and preserves usage on resume. The host's `readResource` callback is
133
- owner-bound and paged; missing resource support fails closed.
134
-
135
- ## Reuse audit
136
-
137
- Before adding the adapter, read `docs/knowledge/intents/index.md`, invoked MCP
138
- `review_smrt_project` for template-sveltekit and `build_context` for durable
139
- cookbook design composition, and searched smrt-ui, smrt-svelte, chat, core, jobs
140
- and inference by name and purpose (`DesignRun`, durable passes, schema validation,
141
- `runAssistantTurn`, engine adapters, job admission). Existing inference
142
- checkpoints/driver and jobs runner own persistence and execution; the host owns
143
- only its cookbook passes and authenticated callback composition. Core already
144
- owns Ajv as a direct dependency; this package declares its own direct dependency
145
- for its host validation rather than reaching through core's dependency tree.
146
-
147
- `__tests__/cookbookDesignRuns.test.ts` uses in-process SQLite and the real
148
- TaskRunner. It verifies admission before execution, owner isolation, stopped-run
149
- resume after replacing the host, active Stop with preserved usage and permission
150
- ceiling, immediate resume of a cooperatively settled pass with a 30-minute lease,
151
- uncooperative execution retaining its reservation, late release refused after a
152
- job claim changes, three ordered checked passes, schema repair and
153
- unknown-usage cumulative budget exhaustion/resume, and durable final-check
154
- replay. Its 22 tests include narrow historical schema drift, live
155
- revision/permission rejection and concurrent migration. The real host suite
156
- verifies default native preview and the
157
- existing approval POST, direct preview-off history, destructive approval,
158
- denial, approval deferred by Stop, schema repair without effects and scoped
159
- history projection. Its
160
- file-backed SQLite crash scenario suspends the completion checkpoint after a
161
- real core mutation, simulates worker death with public liveness retirement,
162
- observes TaskRunner's real orphan outcome and recovers the exact result under a
163
- replacement job claim without clearing the persisted lease or calling a model
164
- again. No external engines or containers are involved.
@@ -1,72 +0,0 @@
1
- import type { CookbookToolDefinition, CookbookToolName, CookbookToolResult } from '@happyvertical/smrt-core/cookbook/tools';
2
- import { type DesignPassRequest, type DesignPassResult, type DesignRunBudget, type DesignRunProgress, type DesignRunState, type ResolvedWorkProfile } from '@happyvertical/smrt-inference/server';
3
- import type { DatabaseInterface } from '@happyvertical/sql';
4
- /** Host callbacks retain the normal authenticated assistant dispatcher and approvals. */
5
- export interface CookbookDesignRunsOptions {
6
- db: DatabaseInterface;
7
- authorize(ownerId: string, tenantId: string | null): Promise<void>;
8
- authorizeThread?(ownerId: string, tenantId: string | null, threadId: string): Promise<void>;
9
- currentRevision?(ownerId: string, tenantId: string | null): Promise<number>;
10
- /** Normal app.describe read; its pinned catalog only classifies work, never authorizes it. */
11
- describeApp?(ownerId: string, tenantId: string | null): Promise<CookbookToolResult | undefined>;
12
- executeOperation?(input: {
13
- ownerId: string;
14
- tenantId: string | null;
15
- threadId: string;
16
- runId: string;
17
- actionId: string;
18
- permissions: readonly string[];
19
- operation: {
20
- tool: CookbookToolName;
21
- args: Record<string, unknown>;
22
- };
23
- signal: AbortSignal;
24
- }): Promise<CookbookToolResult>;
25
- /** Current core-owned structural schemas, resolved under the live owner. */
26
- listOperations?(ownerId: string, tenantId: string | null): Promise<readonly Pick<CookbookToolDefinition, 'name' | 'inputSchema' | 'description'>[]>;
27
- executePass(input: {
28
- ownerId: string;
29
- tenantId: string | null;
30
- threadId: string;
31
- content: string;
32
- stage: 'profile' | 'propose' | 'revise';
33
- request: DesignPassRequest;
34
- profile: ResolvedWorkProfile;
35
- permissions: readonly string[];
36
- }): Promise<DesignPassResult>;
37
- readResource?(ownerId: string, tenantId: string | null, resourceId: string, cursor: string | undefined, maxChars: number): Promise<{
38
- data: unknown;
39
- nextCursor?: string;
40
- }>;
41
- onProgress?(event: DesignRunProgress): void | Promise<void>;
42
- }
43
- /** The actual checked proposal, including a v5 first-pass proposal, owns Apply. */
44
- export declare function isCookbookDesignFinalCheck(state: Readonly<DesignRunState>): boolean;
45
- /** Public progress is host-owned; model prose and raw checkpoint notes stay private. */
46
- export declare function presentCookbookDesignProgress(event: DesignRunProgress, state?: Readonly<DesignRunState>): DesignRunProgress;
47
- /**
48
- * Concrete cookbook workflow on inference checkpoints and the existing jobs queue.
49
- * Construct once per database before starting its TaskRunner. Browser requests only
50
- * admit jobs; model calls occur exclusively through the registered job target.
51
- */
52
- export declare function createCookbookDesignRuns(options: CookbookDesignRunsOptions): {
53
- dispose: () => void;
54
- forOwner(ownerId: string, tenantId: string | null): {
55
- start(input: {
56
- threadId: string;
57
- content: string;
58
- profile: ResolvedWorkProfile;
59
- resourceIds?: string[];
60
- /** Captured authenticated permission ceiling; never model supplied. */
61
- permissions?: readonly string[];
62
- /** Presence of a raw owner pass override, supplied only by the host. */
63
- fixedPasses?: boolean;
64
- }): Promise<DesignRunState>;
65
- latest(threadId: string): Promise<DesignRunState | null>;
66
- status(id: string): Promise<DesignRunState>;
67
- validateAction(id: string, actionId: string, tool: string, args: Record<string, unknown>): Promise<void>;
68
- stop(id: string): Promise<DesignRunState>;
69
- resume(id: string, budget?: Partial<DesignRunBudget>): Promise<DesignRunState>;
70
- resumeAfterApproval(id: string): Promise<DesignRunState>;
71
- };
72
- };