@happyvertical/smrt-inference 0.61.6 → 0.62.0

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 (72) hide show
  1. package/AGENTS.md +3 -1
  2. package/README.md +4 -0
  3. package/agents/engines.md +87 -90
  4. package/agents/fusions.md +13 -5
  5. package/dist/agent-cli/session.d.ts +8 -2
  6. package/dist/agent-cli/session.d.ts.map +1 -1
  7. package/dist/agent-cli/stream.d.ts +5 -0
  8. package/dist/agent-cli/stream.d.ts.map +1 -1
  9. package/dist/agent-cli/turn.d.ts +12 -5
  10. package/dist/agent-cli/turn.d.ts.map +1 -1
  11. package/dist/assistant-settings.d.ts +26 -0
  12. package/dist/assistant-settings.d.ts.map +1 -0
  13. package/dist/chatgpt/model.d.ts +14 -6
  14. package/dist/chatgpt/model.d.ts.map +1 -1
  15. package/dist/chunks/{InferenceOverrideCollection-Bd-FsdB1.js → InferenceOverrideCollection-DXfD7iq5.js} +3 -66
  16. package/dist/chunks/InferenceOverrideCollection-DXfD7iq5.js.map +1 -0
  17. package/dist/chunks/model-fallback-BVD3BzkG.js +171 -0
  18. package/dist/chunks/model-fallback-BVD3BzkG.js.map +1 -0
  19. package/dist/chunks/{provider-config-BSpIQRVM.js → provider-config-Q1WaQKfo.js} +164 -31
  20. package/dist/chunks/provider-config-Q1WaQKfo.js.map +1 -0
  21. package/dist/classify.d.ts +9 -0
  22. package/dist/classify.d.ts.map +1 -1
  23. package/dist/engine-tiers.d.ts +100 -0
  24. package/dist/engine-tiers.d.ts.map +1 -0
  25. package/dist/executor.d.ts.map +1 -1
  26. package/dist/fusion.d.ts +7 -1
  27. package/dist/fusion.d.ts.map +1 -1
  28. package/dist/index.d.ts +3 -2
  29. package/dist/index.d.ts.map +1 -1
  30. package/dist/index.js +3 -3
  31. package/dist/index.js.map +1 -1
  32. package/dist/manifest.json +92 -205
  33. package/dist/model-fallback.d.ts +63 -0
  34. package/dist/model-fallback.d.ts.map +1 -0
  35. package/dist/models.d.ts +0 -1
  36. package/dist/models.d.ts.map +1 -1
  37. package/dist/models.js +2 -2
  38. package/dist/node.js +1 -1
  39. package/dist/resolver.js +1 -1
  40. package/dist/server.d.ts +3 -4
  41. package/dist/server.d.ts.map +1 -1
  42. package/dist/server.js +79 -130
  43. package/dist/server.js.map +1 -1
  44. package/dist/smrt-knowledge.json +16 -88
  45. package/dist/smrt-knowledge.okf.md +6 -11
  46. package/dist/svelte/components/InferenceAssistantSettings.svelte +98 -0
  47. package/dist/svelte/components/InferenceAssistantSettings.svelte.d.ts +19 -0
  48. package/dist/svelte/components/InferenceAssistantSettings.svelte.d.ts.map +1 -0
  49. package/dist/svelte/components/InferenceSettingsPanel.svelte +22 -1
  50. package/dist/svelte/components/InferenceSettingsPanel.svelte.d.ts +10 -2
  51. package/dist/svelte/components/InferenceSettingsPanel.svelte.d.ts.map +1 -1
  52. package/dist/svelte/components/InferenceUsageTable.svelte +7 -7
  53. package/dist/svelte/components/InferenceUsageTable.svelte.d.ts +1 -1
  54. package/dist/svelte/index.d.ts +1 -1
  55. package/dist/svelte/index.d.ts.map +1 -1
  56. package/dist/svelte/types.d.ts +27 -4
  57. package/dist/svelte/types.d.ts.map +1 -1
  58. package/dist/svelte/types.js +4 -4
  59. package/package.json +99 -8
  60. package/agents/design-runs.md +0 -110
  61. package/dist/chunks/InferenceOverrideCollection-Bd-FsdB1.js.map +0 -1
  62. package/dist/chunks/provider-config-BSpIQRVM.js.map +0 -1
  63. package/dist/chunks/work-profiles-DCgIbilc.js +0 -484
  64. package/dist/chunks/work-profiles-DCgIbilc.js.map +0 -1
  65. package/dist/design-run-store.d.ts +0 -26
  66. package/dist/design-run-store.d.ts.map +0 -1
  67. package/dist/design-run.d.ts +0 -146
  68. package/dist/design-run.d.ts.map +0 -1
  69. package/dist/models/DesignRunRecord.d.ts +0 -22
  70. package/dist/models/DesignRunRecord.d.ts.map +0 -1
  71. package/dist/work-profiles.d.ts +0 -127
  72. package/dist/work-profiles.d.ts.map +0 -1
package/AGENTS.md CHANGED
@@ -101,7 +101,9 @@ reasoning, forced single-function `toolChoice` and `stream()` with tools; the
101
101
  caller sends none of them (`classifyChatGPTPlanFailure` names the failures).
102
102
  Guide: [docs/content/inference-settings.md](../../docs/content/inference-settings.md).
103
103
 
104
- [Owner work profiles and durable design runs](agents/design-runs.md).
104
+ Which model answers an engine that is not an API key (its default tier
105
+ binding), reasoning effort and the plan-refusal step:
106
+ [agents/engines.md](agents/engines.md) (#5005).
105
107
 
106
108
  ## Config
107
109
 
package/README.md CHANGED
@@ -68,6 +68,10 @@ await article.do('Summarize this', { tier: 'great' });
68
68
  never a default and never a fallback. See
69
69
  [Inference settings](../../docs/content/inference-settings.md#sign-in-with-chatgpt-local-apps).
70
70
 
71
+ A fusion is recorded as a `fusion` run with one usage row per seat call; the
72
+ vocabulary (run, event, evaluation, budget) is in
73
+ [AI runs](../../docs/content/ai-runs.md).
74
+
71
75
  The app-author guide, with a worked example, is
72
76
  [Inference tiers, bindings and usage](../../docs/content/inference.md).
73
77
 
package/agents/engines.md CHANGED
@@ -59,10 +59,10 @@ a model response; the production exec uses the equivalent workspace overrides.
59
59
  Reuse: configured MCP reviewed inference/Svelte/template/app-shell and architecture
60
60
  context queried disposable sandboxes, rank/fallback and connection composition.
61
61
  Name + purpose `rg` in UI/Svelte/chat/core/inference found `buildAgentRun`,
62
- `runProcess`, `codexParser`, `reportAgentFailure`, `strongestWorkModel`,
63
- `runWorkModelWithFallback` and the existing connection catalog. Extend these
64
- owning modules. New `rankOpenAIWorkModels`/`nextWorkModel` live in the existing
65
- work-profiles module; no parallel engine, approval service or credential reader.
62
+ `runProcess`, `codexParser`, `reportAgentFailure`, `strongestModel`,
63
+ `runWithModelFallback` and the existing connection catalog. Extend these
64
+ owning modules. `rankOpenAIModels`/`nextModel` live in `engine-tiers.ts`; no
65
+ parallel engine, approval service or credential reader.
66
66
 
67
67
  ## Historical 2026-11-11 incompatibility evidence (superseded by containment above)
68
68
 
@@ -321,95 +321,92 @@ reference/error IDs, environment helpers and retry presentation in owning
321
321
  packages, core, smrt-ui and smrt-svelte. Extend existing detection, turn error
322
322
  boundary and dock instead of adding a second engine or error presentation.
323
323
 
324
- ## Owner work profiles
325
-
326
- `work-profiles.ts` exports browser-safe `recommendedWorkProfile` and
327
- `resolveWorkProfile`: `assist` defaults to high effort, `design` to maximum,
328
- `background` to low. Design/assist API calls resolve to `best`; the host must
329
- apply the selected tier to its existing inference client. Owner settings may
330
- select engine/model/effort and each numeric budget, pass/repair counts,
331
- automatic escalation and preview. These settings carry no tool authority.
332
- The preferences package stores owner overrides; inference contains no storage.
333
-
334
- Claude recommendations select the strongest installed alias, `fable`, then
335
- `opus`, then `sonnet`; hosts can supply the installed alias inventory. Codex recommendations use the reviewed OpenAI model table. ChatGPT automatic
336
- recommendations intersect that table with the signed-in account's live catalog.
337
- `rankOpenAIWorkModels` annotates exact IDs only, preserving a future SDK's explicit
338
- finite `intelligenceRank`; `strongestWorkModel` never infers strength from response
339
- order or spelling. Reviewed 2026-11-12 against
340
- [OpenAI's recommended models](https://learn.chatgpt.com/docs/models#recommended-models):
341
- Astra, 6.1 Sol, 6.1 Terra, Luna. This is versioned app recommendation data grounded
342
- in official descriptions, not an undocumented server quality field. Unknown IDs
343
- remain selectable explicitly but never become automatic recommendations. Refresh
344
- this table when the catalog adds a new model; an unknown-only catalog truthfully
345
- has no automatic strongest choice. Both design and assist pick the strongest
346
- ranked offered model. Background keeps its low-effort profile.
347
-
348
- `ChatGPTPlanConnection.models()` retains ranks and its ten-minute account cache;
349
- `defaultModel()` uses ranks. `createChatGPTModel` discovers the catalog when needed
350
- and derives a single next-lower fallback from it. Host memos include account
351
- connection generation, catalog and owner preference revision. Fixed fallback
352
- wording is sent through existing text progress. The installed SDK still rejects
353
- reasoning/format controls on plan requests; omit them, retain requested effort in
354
- metadata, and never claim vendor enforcement. Live sign-in/entitlement/inference
355
- requires the owner and is not proven by fake catalog tests.
356
-
357
- The browser-safe root exports the same `engineLabel` used by server status;
358
- product names come from the existing pure CLI metadata. No server-status graph
359
- is imported by settings. `ResolvedWorkProfile.modelSelection` is derived display
360
- evidence: `strongest` requires the recommended Claude `fable` alias or the
361
- selected top-ranked catalog entry; an explicit model is `custom`, and an
362
- unverified/provider selection is `configured`. Tier names alone do not establish
363
- model strength. The metadata includes requested and resolved selection ids when
364
- known; these are selection aliases, not a claimed provider-reported model.
365
-
366
- `runAgentTurn({ profile, outputSchema })` supplies explicit model and effort,
367
- Claude `--json-schema`, or Codex `--output-schema` through a private per-pass
368
- file. Codex maximum maps to `model_reasoning_effort="xhigh"`. Existing machine
369
- feature prohibitions and parser guards remain in force, including unknown
370
- structured-output tool kinds: they are refused, never allowed as built-in tools.
371
- Claude's final `structured_output` object is serialized for the host's schema
372
- validator. A host still validates and bounds repair attempts through the design
373
- run driver. ChatGPT's SDK rejects reasoning and JSON format controls, so its
374
- adapter omits those unsupported controls; schema validation/repair stays host
375
- side. Recorded effort is the requested policy where the provider cannot honor
376
- an effort option; it is not a claim of vendor enforcement.
324
+ ## Default tier binding of an engine (#5005)
325
+
326
+ `engine-tiers.ts` (browser-safe) binds tiers for an engine that has no stored
327
+ binding: Claude Code, Codex and a ChatGPT plan. An API key binds tiers through
328
+ core's resolver as before. The tier a prompt asks for picks the model from the
329
+ engine's ranked models, strongest first:
330
+
331
+ | Tier | Claude Code | Codex | ChatGPT plan |
332
+ | --- | --- | --- | --- |
333
+ | `best`, `great` | `fable` | `gpt-6-astra` | strongest ranked model the account offers |
334
+ | `good` | `opus` | `gpt-6.1-sol` | next strongest offered (else the strongest) |
335
+ | `cheap` | `sonnet` | `gpt-6-luna` | lowest ranked offered |
336
+ | `auto` | the app's `inference.defaultTier` (else `good`), then as above | same | same |
337
+
338
+ `engineTierModel({ engine, tier, catalog?, defaultTier? })` returns the model;
339
+ `engineModels()` the ranked list; `nextEngineModel()` one rank down the same
340
+ order (the plan-refusal step); `strongestModel`/`weakestModel`/`nextModel`
341
+ work on any ranked catalog. Only explicit `intelligenceRank` orders strength:
342
+ `rankOpenAIModels` annotates exact IDs from `OPENAI_MODEL_RANKS`, reviewed
343
+ 2026-11-12 against
344
+ [OpenAI's recommended models](https://learn.chatgpt.com/docs/models#recommended-models)
345
+ (Astra, 6.1 Sol, 6.1 Terra, Luna); `CLAUDE_MODEL_RANKS` ranks the Claude
346
+ aliases. Unknown IDs stay unranked and never become a binding. Refresh the
347
+ table when the catalog adds a model. `validateModelId` keeps a model a single
348
+ safe CLI value.
349
+
350
+ The assistant asks for `best` (the tier chat's `chat.assistant.system` prompt declares), so on these
351
+ engines it answers with the strongest ranked model, as before; a workflow run
352
+ pins the selection it started with.
353
+
354
+ ## Reasoning effort on an engine (#5005)
355
+
356
+ Precedence, high to low: the caller's option, the prompt's `ai.effort`
357
+ (smrt-prompts, validated), the tier binding's `params.reasoning.effort` (the
358
+ app's `inference.tiers` config; an invalid value is ignored), then none: the
359
+ engine's own default. `resolveEngineEffort({ caller, prompt, tier })` applies
360
+ it; nothing defaults the effort. `engineReasoningEffort(engine, effort)` maps
361
+ it: Claude Code `--effort <value>`; Codex `model_reasoning_effort` with `max`
362
+ sent as `xhigh`; an API call `reasoning: { effort }`. A ChatGPT plan records
363
+ the effort on its execution but does not send it: the installed SDK rejects
364
+ reasoning and format controls on plan requests, so the recorded effort is the
365
+ requested one, never a claim of vendor enforcement. Without an effort neither
366
+ CLI receives an effort flag.
367
+
368
+ `buildAgentRun({ model, effort, outputSchema })` and `runAgentTurn({ model,
369
+ effort, limits, fallback })` take these from the call options; `limits`
370
+ (`turnTimeoutMs`, `toolResultChars`) come from the turn's budget and
371
+ `deps.limits` still wins. Claude Code without a model takes its `best`
372
+ binding. Claude `--json-schema` or Codex `--output-schema` (a private per-pass
373
+ file) carry a workflow step's schema. Existing machine feature prohibitions and
374
+ parser guards remain in force, including unknown structured-output tool kinds:
375
+ they are refused, never allowed as built-in tools. Claude's final
376
+ `structured_output` object is serialized for the host's schema validator.
377
+ ChatGPT's SDK rejects JSON format controls, so schema validation and repair
378
+ stay host side.
379
+
380
+ `ChatGPTPlanConnection.models()` retains ranks and its ten-minute account
381
+ cache; `defaultModel()` is the strongest ranked model. `createChatGPTModel({
382
+ tier, model?, effort?, catalog?, fallback?, recordExecution? })` discovers the
383
+ catalog when a tier must be bound and derives the single next-lower fallback
384
+ from it. Live sign-in, entitlement and inference need the owner and are not
385
+ proven by fake catalog tests.
386
+
387
+ ## Executions and the plan-refusal step
377
388
 
378
389
  Token mint receives the pass timeout; `tokenCredentials` requests a lifetime
379
390
  of at least that timeout plus one minute, retaining owner holder/scopes and
380
391
  revocation at exit. CLI usage is recorded only when input/output token counts
381
- are reported, otherwise unknown. `host.recordExecution` and stored assistant
382
- `meta.workRun` (when a CLI session exists) carry profile, runtime-reported model (unknown when omitted),
383
- requested alias/model, duration, tool count and
384
- fallback. `createChatGPTModel` accepts the same profile and execution callback.
385
-
386
- Both real invocation adapters wire `runWorkModelWithFallback` when a host
387
- supplies a scoped fallback store and the next verified model. Only explicit
388
- plan-model refusal codes qualify; arbitrary failures, policy refusals, quota,
389
- network errors, published text or any tool activity never retry another model.
390
- One fallback step is allowed, with shared fixed wording. The host persists the
391
- memo under owner, engine, refused requested model and a connection/catalog key;
392
- change the key after account/catalog or selection changes. No engine or billing
393
- path fallback is performed. No live CLI/provider call is needed for tests.
394
-
395
- For Settings, pass a freshly resolved profile through
396
- `projectWorkModelSelection` with that same tenant-scoped store, owner, engine,
397
- requested model and connection key. A remembered different model changes only
398
- display metadata to `fallback`; `profile.model` remains the original request so
399
- execution reads the same memo and cannot begin a fallback-of-fallback chain.
400
- The projector only reads the existing memo: it performs no provider probe,
401
- notification or write and exposes no connection key in the result. Hosts must
402
- share their key derivation between display and execution, invalidating it after
403
- connection/selection changes. The existing profile and browser-safety tests cover
404
- selection evidence, scope, model immutability and the public label import.
405
-
406
- Reuse audit: smrt-dev-mcp `review_smrt_project` on inference and
407
- `build_context(task: architecture)` inventoried package exports/models. The
408
- intent index and name/purpose searches across smrt-ui, smrt-svelte, chat, core
409
- and inference found no existing work-intelligence resolver or owner-engine
410
- fallback memo. `work-profiles.ts` owns that pure inference policy and reuses
411
- `InferenceEngineId` moved unchanged to browser-safe `engine-id.ts`; existing session/turn/credentials/model adapters own all
412
- execution. No UI helper, credential store, queue or approval system was added.
392
+ are reported, otherwise unknown. `host.recordExecution(execution)` receives an
393
+ `EngineExecution` (engine, runtime-reported model when known, requested model,
394
+ effort, duration, tool count, tokens when known with their `inputTokens` /
395
+ `outputTokens` split when every report carried it, fallback). It is the host's
396
+ record; it is never stored on a message (a CLI session message carries only
397
+ `cliSession`). `createChatGPTModel` reports the same shape (total only). Chat
398
+ records a CLI turn as one tracked call of its turn run from this record
399
+ ([assistant turn runs](../../chat/agents/assistant-turn-runs.md)).
400
+
401
+ Both invocation adapters wire `runWithModelFallback` (`model-fallback.ts`)
402
+ when a host supplies a scoped fallback store and the next model in the tier
403
+ binding order. Only explicit plan-model refusal codes qualify; arbitrary
404
+ failures, policy refusals, quota, network errors, published text or any tool
405
+ activity never retry another model. One step is allowed, with the fixed
406
+ `MODEL_FALLBACK_MESSAGE`. The host persists the memo under owner, engine,
407
+ refused requested model and a connection/catalog key; change the key after an
408
+ account, catalog or engine change. No engine or billing path fallback is
409
+ performed. No live CLI/provider call is needed for tests.
413
410
 
414
411
  Native CLI budget enforcement is limited to the subprocess wall deadline and
415
412
  observed tool-result truncation for display/history. The vendor has already
@@ -449,7 +446,7 @@ The cookbook host mints only the offered tool slugs intersected with the turn's
449
446
 
450
447
  Codex 0.162.1 off uses `sandbox_mode="danger-full-access"`, `approval_policy="never"`, `web_search="live"`; it omits the optional-feature disable list, `--ignore-user-config`, `--ignore-rules` and protected workspace overrides. This explicitly permits commands, files and network under the person's OS authority and own CLI config/plugins. Modern MCP and `code_mode_host` remain enabled for app tools. `shell_environment_policy.inherit="none"` remains forced in BOTH states: model shell commands do not inherit the app credential. Protection on retains the fresh 0700 per-attempt folder and cleanup. These flags were checked against installed `claude --help` and `codex exec --help`, not inferred.
451
448
 
452
- Always: strip API-key environment variables, loopback-only MCP, short-lived owner-bound token in child environment (never argv/config/logs), app tool allow-list, owner deletion policy, Stop/timeout process-group kill and credential revocation. Off-mode native events record only sanitized tool names (`agent_tool_native`), not input/output; they do not fail an otherwise valid app request. Other app MCP tools remain fail-closed. Off-mode answers buffer to a message/tool boundary and reuse `redactInferenceSecret` to prevent split credential echoes reaching UI/history. Work-profile model/effort and classified one-step fallback are unchanged. Status/preflight caches are separated by protection mode.
449
+ Always: strip API-key environment variables, loopback-only MCP, short-lived owner-bound token in child environment (never argv/config/logs), app tool allow-list, owner deletion policy, Stop/timeout process-group kill and credential revocation. Off-mode native events record only sanitized tool names (`agent_tool_native`), not input/output; they do not fail an otherwise valid app request. Other app MCP tools remain fail-closed. Off-mode answers buffer to a message/tool boundary and reuse `redactInferenceSecret` to prevent split credential echoes reaching UI/history. Tier-binding model/effort and classified one-step fallback are unchanged. Status/preflight caches are separated by protection mode.
453
450
 
454
451
  Stub command specs, stream turns and credential-echo tests cover both modes. The shared ChatGPT connection accepts an optional SDK `begin().cancel` handle; without it, cancellation is explicitly unavailable and pending status remains truthful. Late/expired successful callbacks are signed out instead of silently reconnecting. SDK listener/state/timeout fixes belong upstream.
455
452
 
package/agents/fusions.md CHANGED
@@ -72,11 +72,19 @@ await contract.do('Summarize this contract', { tier: 'best' }); // unchanged cal
72
72
  `onProgress`, …) reach the final seat only; `signal` / `timeout` reach every
73
73
  seat; `history` is the seat's instructions. `onFusionResult(result)`
74
74
  receives the structured `FusionRunResult`. Only `message()` runs a fusion.
75
- - **Record**: every seat's usage row carries `runId`, `fusionKey`, `seat`
76
- and the seat's prompt tags; `context.recordRun()` writes one
77
- `_smrt_ai_runs` row (`ok | degraded | failed`; a seat is degraded when it
78
- died or answered through a substitution) with identities and totals only
79
- (`../../core/agents/ai-usage.md`). `smrt ai:usage --by fusion` totals runs.
75
+ - **Record** (#5005): `run()` opens the `fusion` run through
76
+ `context.openRun()` before the first seat (no seat runs when usage
77
+ tracking is off), reserves every seat and the judge together, all or none
78
+ (`shares()`; the judge's input counts the panel's output allowances), and
79
+ closes it `done` (with `degraded` when a seat died or answered through a
80
+ substitution) or `failed`, with identities and totals only. A refused
81
+ reservation or an ancestor's stop (`AI_RUN_STOPPED`, `isAiRunInterruption`)
82
+ is never a dead seat or a fallback: `handle.stop()` turns it into the
83
+ caller's stop. Every seat's usage row carries `runId`, `fusionKey`, `seat`
84
+ and the seat's prompt tags; the gate's decision call does not carry
85
+ `runId`. Older cores without `openRun` still get `context.recordRun()` at
86
+ the end (`../../core/agents/ai-usage.md`). `smrt ai:usage --by fusion`
87
+ totals runs.
80
88
  - **Validation**: `findInferenceConfigIssues()` names structural offenders
81
89
  by path (`fusion-invalid`, `fusion-unknown`, `fusion-nested`); an
82
90
  unregistered seat prompt key is a load error (`fusion-prompt-unknown`) from
@@ -1,4 +1,4 @@
1
- import { type ResolvedWorkProfile } from '../work-profiles.js';
1
+ import type { ReasoningEffort } from '@happyvertical/smrt-core';
2
2
  import type { AgentCliLocation } from './detect.js';
3
3
  import { type AgentEvent } from './stream.js';
4
4
  import type { AgentTool } from './tools.js';
@@ -20,7 +20,13 @@ export interface SpecInput {
20
20
  /** Owner-confirmed app setting; omitted keeps the protected invocation. */
21
21
  protection?: boolean;
22
22
  tool: AgentTool;
23
- profile?: ResolvedWorkProfile;
23
+ /**
24
+ * The model the tier binding chose. Claude Code without one takes its
25
+ * `best` binding; Codex without one takes its own default.
26
+ */
27
+ model?: string;
28
+ /** Omitted: the CLI's own default effort. */
29
+ effort?: ReasoningEffort;
24
30
  outputSchema?: Record<string, unknown>;
25
31
  location: AgentCliLocation;
26
32
  /** Host-owned engine state under app data: holds `work/` and temporary `run/`. */
@@ -1 +1 @@
1
- {"version":3,"file":"session.d.ts","sourceRoot":"","sources":["../../src/agent-cli/session.ts"],"names":[],"mappings":"AAiBA,OAAO,EACL,KAAK,mBAAmB,EAEzB,MAAM,qBAAqB,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gDAAgD;IAChD,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;IACd,8CAA8C;IAC9C,YAAY,EAAE,MAAM,CAAC;IACrB,MAAM,EAAE,MAAM,CAAC;IACf,oEAAoE;IACpE,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,OAAO,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,CAAC,CAAC;CACxD;AAED,sDAAsD;AACtD,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,MAAM,GAAG,GAAG,CAQpD;AAoMD,4EAA4E;AAC5E,wBAAgB,aAAa,CAAC,KAAK,EAAE,SAAS,GAAG,YAAY,CAqB5D"}
@@ -34,7 +34,12 @@ export type AgentEvent = {
34
34
  ok: boolean;
35
35
  text?: string;
36
36
  error?: string;
37
+ /** Input plus output, as the CLI reported them. */
37
38
  tokens?: number;
39
+ /** The input part (cache reads and writes included). */
40
+ inputTokens?: number;
41
+ /** The output part. */
42
+ outputTokens?: number;
38
43
  };
39
44
  /** The MCP server name both tools are given, and so the tool-name prefix. */
40
45
  export declare const MCP_SERVER_NAME = "smrt";
@@ -1 +1 @@
1
- {"version":3,"file":"stream.d.ts","sourceRoot":"","sources":["../../src/agent-cli/stream.ts"],"names":[],"mappings":"AAQA,MAAM,MAAM,UAAU,GAClB;IAAE,IAAI,EAAE,SAAS,CAAC;IAAC,EAAE,EAAE,MAAM,CAAA;CAAE,GAC/B;IAAE,IAAI,EAAE,iBAAiB,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,GAC1C;IAAE,IAAI,EAAE,gBAAgB,CAAC;IAAC,IAAI,EAAE,kBAAkB,CAAA;CAAE,GACpD;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE;AACjC,4EAA4E;GAC1E;IAAE,IAAI,EAAE,SAAS,CAAC;IAAC,IAAI,EAAE,MAAM,C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M,CAAC,MAAM,EAAE,OAAO,CAAC,EACtC,UAAU,UAAO,IAIT,MAAM,MAAM,KAAG,UAAU,EAAE,CAkHpC;AAgBD,wDAAwD;AACxD,wBAAgB,WAAW,CACzB,OAAO,GAAE;IAAE,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAAC,WAAW,CAAC,EAAE,OAAO,CAAA;CAAO,IAE3D,MAAM,MAAM,KAAG,UAAU,EAAE,CAiHpC"}
@@ -1,5 +1,6 @@
1
1
  import type { AIToolCall } from '@happyvertical/ai';
2
- import { type ResolvedWorkProfile, type WorkModelFallbackStore, type WorkRunMetadata } from '../work-profiles.js';
2
+ import type { ReasoningEffort } from '@happyvertical/smrt-core';
3
+ import { type EngineExecution, type ModelFallbackStore } from '../model-fallback.js';
3
4
  import type { AgentCredentials } from './credentials.js';
4
5
  import type { AgentCliLocation } from './detect.js';
5
6
  import { type AgentTool } from './tools.js';
@@ -85,7 +86,8 @@ export interface AgentTurnHost {
85
86
  summary: string;
86
87
  details?: Record<string, unknown>;
87
88
  }>;
88
- recordExecution?(metadata: WorkRunMetadata): Promise<void>;
89
+ /** What the turn ran with and used; never stored on a message. */
90
+ recordExecution?(execution: EngineExecution): Promise<void>;
89
91
  completionNote?(): Promise<string | null>;
90
92
  }
91
93
  export interface AgentTurnMessage {
@@ -104,20 +106,25 @@ export interface AgentTurnMessage {
104
106
  tool: string;
105
107
  id: string;
106
108
  };
107
- workRun?: WorkRunMetadata;
108
109
  };
109
110
  }
110
111
  export interface AgentTurnOptions {
111
112
  /** Trusted host setting, never engine input; default protected. */
112
113
  protection?: boolean;
113
114
  text: string;
114
- profile?: ResolvedWorkProfile;
115
+ /** The model the engine's tier binding chose (#5005). */
116
+ model?: string;
117
+ /** The effort the caller, prompt or tier binding asks for; omitted: the CLI's. */
118
+ effort?: ReasoningEffort;
119
+ /** This turn's limits, from its budget; `deps.limits` still wins. */
120
+ limits?: Partial<Pick<AgentTurnLimits, 'turnTimeoutMs' | 'toolResultChars'>>;
115
121
  outputSchema?: Record<string, unknown>;
122
+ /** Needs `model`: one step down the tier binding order on a plan refusal. */
116
123
  fallback?: {
117
124
  ownerId: string;
118
125
  connectionKey: string;
119
126
  nextModel: string;
120
- store: WorkModelFallbackStore;
127
+ store: ModelFallbackStore;
121
128
  };
122
129
  tool: AgentTool;
123
130
  mcpUrl: string;
@@ -1 +1 @@
1
- {"version":3,"file":"turn.d.ts","sourceRoot":"","sources":["../../src/agent-cli/turn.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAEpD,OAAO,EACL,KAAK,mBAAmB,EAGxB,KAAK,sBAAsB,EAC3B,KAAK,eAAe,EACrB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AACzD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAIpD,OAAO,EAAmB,KAAK,SAAS,EAAE,MAAM,YAAY,CAAC;AAE7D,MAAM,MAAM,aAAa,GACrB,UAAU,GACV,SAAS,GACT,SAAS,GACT,SAAS,GACT,OAAO,CAAC;AACZ,MAAM,MAAM,cAAc,GACtB;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,GAC/B;IAAE,IAAI,EAAE,WAAW,CAAC;IAAC,EAAE,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,GAC7D;IACE,IAAI,EAAE,aAAa,CAAC;IACpB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,EAAE,EAAE,OAAO,CAAC;IACZ,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACnC,GACD;IACE,IAAI,EAAE,mBAAmB,CAAC;IAC1B,EAAE,EAAE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AAG,SAAS,EAC3B,KAAK,EACD,SAAS,GACT,SAAS,GACT,OAAO,GACP,YAAY,GACZ,WAAW,GACX,QAAQ,EACZ,KAAK,CAAC,EAAE,OAAO,EACf,IAAI,CAAC,EAAE,MAAM,EACb,OAAO,CAAC,EAAE;IACR,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EACA,SAAS,GACT,eAAe,GACf,cAAc,GACd,kBAAkB,GAClB,gBAAgB,CAAC;CACtB,GACA,MAAM,CA6FR;AAED,oGAAoG;AACpG,wBAAsB,YAAY,CAChC,OAAO,EAAE,gBAAgB,GACxB,OAAO,CAAC,aAAa,CAAC,CAOxB"}
@@ -0,0 +1,26 @@
1
+ /**
2
+ * The assistant's ordinary settings (#5005), edited in the inference settings
3
+ * panel and stored by smrt-preferences' `assistant-settings` kind. App-wide
4
+ * owner choices; never accepted from a model. Every setting defaults on.
5
+ * Browser-safe.
6
+ */
7
+ export interface AssistantSettings {
8
+ /**
9
+ * When chat asks for a tool limited to workflow runs, hand the request to a
10
+ * workflow run instead of refusing it.
11
+ */
12
+ escalateToWorkflow?: boolean;
13
+ /** Show a workflow run's proposed changes before applying them. */
14
+ previewBeforeApply?: boolean;
15
+ /** Ask the owner before chat deletes or removes anything. */
16
+ requireRemovalApproval?: boolean;
17
+ /** Run Claude Code and Codex in the app's protected tool setup. */
18
+ protectLocalCli?: boolean;
19
+ }
20
+ /** The setting names, in display order. */
21
+ export declare const ASSISTANT_SETTING_KEYS: readonly ["escalateToWorkflow", "previewBeforeApply", "requireRemovalApproval", "protectLocalCli"];
22
+ /** Every setting resolved: an absent one is on. */
23
+ export declare function resolveAssistantSettings(settings: AssistantSettings | null | undefined): Required<AssistantSettings>;
24
+ /** True when `value` holds only known settings, each a boolean. */
25
+ export declare function isAssistantSettings(value: unknown): value is AssistantSettings;
26
+ //# sourceMappingURL=assistant-settings.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"assistant-settings.d.ts","sourceRoot":"","sources":["../src/assistant-settings.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,MAAM,WAAW,iBAAiB;IAChC;;;OAGG;IACH,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B,mEAAmE;IACnE,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B,6DAA6D;IAC7D,sBAAsB,CAAC,EAAE,OAAO,CAAC;IACjC,mEAAmE;IACnE,eAAe,CAAC,EAAE,OAAO,CAAC;CAC3B;AAED,2CAA2C;AAC3C,eAAO,MAAM,sBAAsB,oGAKsB,CAAC;AAE1D,mDAAmD;AACnD,wBAAgB,wBAAwB,CACtC,QAAQ,EAAE,iBAAiB,GAAG,IAAI,GAAG,SAAS,GAC7C,QAAQ,CAAC,iBAAiB,CAAC,CAO7B;AAED,mEAAmE;AACnE,wBAAgB,mBAAmB,CACjC,KAAK,EAAE,OAAO,GACb,KAAK,IAAI,iBAAiB,CAW5B"}
@@ -1,21 +1,29 @@
1
1
  import type { AIMessage, AITool, AIToolCall } from '@happyvertical/ai';
2
+ import type { InferenceTierRequest, ReasoningEffort } from '@happyvertical/smrt-core';
2
3
  import { type EngineModel } from '../engine-model.js';
3
- import { type WorkModelCatalogEntry, type WorkModelFallbackStore, type WorkProfileName, type WorkProfileSettings, type WorkRunMetadata } from '../work-profiles.js';
4
+ import { type RankedModel } from '../engine-tiers.js';
5
+ import { type EngineExecution, type ModelFallbackStore } from '../model-fallback.js';
4
6
  import type { ChatGPTPlanConnection } from './connection.js';
5
7
  export interface ChatGPTModelOptions {
6
8
  connection: Pick<ChatGPTPlanConnection, 'clientOptions'> & Partial<Pick<ChatGPTPlanConnection, 'models'>>;
9
+ /** An explicit model; otherwise `tier` picks one from the plan's catalog. */
7
10
  model?: string;
8
- profile?: WorkProfileName;
9
- settings?: WorkProfileSettings;
10
- catalog?: readonly WorkModelCatalogEntry[];
11
+ /** The tier the prompt asks for (#5005), bound to the plan's ranked models. */
12
+ tier?: InferenceTierRequest;
13
+ /**
14
+ * Recorded on the execution, never sent: the ChatGPT plan provider
15
+ * rejects reasoning options.
16
+ */
17
+ effort?: ReasoningEffort;
18
+ catalog?: readonly RankedModel[];
11
19
  fallback?: {
12
20
  ownerId: string;
13
21
  connectionKey: string;
14
22
  nextModel?: string;
15
- store: WorkModelFallbackStore;
23
+ store: ModelFallbackStore;
16
24
  notify?(message: string): void;
17
25
  };
18
- recordExecution?(metadata: WorkRunMetadata): Promise<void>;
26
+ recordExecution?(execution: EngineExecution): Promise<void>;
19
27
  toolNamespace: {
20
28
  name: string;
21
29
  description: string;
@@ -1 +1 @@
1
- {"version":3,"file":"model.d.ts","sourceRoot":"","sources":["../../src/chatgpt/model.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AACvE,OAAO,EACL,KAAK,WAAW,EAGjB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAML,KAAK,qBAAqB,EAC1B,KAAK,sBAAsB,EAC3B,KAAK,eAAe,EACpB,KAAK,mBAAmB,EACxB,KAAK,eAAe,EACrB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,iBAAiB,CAAC;AAG7D,MAAM,WAAW,mBAAmB;IAClC,UAAU,EAAE,IAAI,CAAC,qBAAqB,EAAE,eAAe,CAAC,GACtD,OAAO,CAAC,IAAI,CAAC,qBAAqB,EAAE,QAAQ,CAAC,CAAC,CAAC;IACjD,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,eAAe,CAAC;IAC1B,QAAQ,CAAC,EAAE,mBAAmB,CAAC;IAC/B,OAAO,CAAC,EAAE,SAAS,qBAAqB,EAAE,CAAC;IAC3C,QAAQ,CAAC,EAAE;QACT,OAAO,EAAE,MAAM,CAAC;QAChB,aAAa,EAAE,MAAM,CAAC;QACtB,SAAS,CAAC,EAAE,MAAM,CAAC;QACnB,KAAK,EAAE,sBAAsB,CAAC;Q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