Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CONTEXT.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ S15/S16 target terms below refine product intent. Definitions explicitly marked

**Bot:** A persistent participant with a stable identity, responsibility, enabled generation, selected model/auth route and capability policy. It is not a model, provider session or container. Creating a permanent Bot requires owner acceptance of its exact proposal.

**Model pin (S16, MODEL16-01):** An owner's exact Bot route/model/effort choice. An unavailable or withdrawn choice holds new work instead of silently selecting the installation default. An explicit profile update affects new admission; already admitted work retains its POLICY pin. Recorded usage distinguishes conservative charges, measured subtotals and unknown values; it is evidence rather than authority. See ADR 0093 and `s16-client-models/v1`.

**Jit (main Bot):** The default conversational assistant and coordinator. It understands requested outcomes, chooses tools and approved team/model resources, and remains responsible for authorized work and evidence. It cannot widen policy or approve its own held actions. In implemented S14, coordinator-only chat has no tools or warm computer; work uses its separate grant path.

**Team:** Bots using installation-approved work resources/accounts for the assigned purpose. S15 defaults to shared team access without repeated per-Bot setup; explicit narrower restrictions still apply. This does not retroactively declassify S14-private sources or expose raw session/credential material.
Expand Down
29 changes: 29 additions & 0 deletions docs/adr/0093-s16-model-choice-and-observed-usage.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
---
status: implemented for MODEL16-01 (#421); deterministic and real-bundle checks passed; CI/review pending
date: 2026-11-18
scope: S16-AC14; FR-02/13/14/27/31/38; NFR-02/03/06/09
---

# Explicit Bot model pins and observed model usage

## Context and alternatives

BOT16-01 already stores an owner-selected route/model/effort and resolves it when admitting work. MODEL15 already owns physical-send authorization, exact effort controls, conservative reservations, provider telemetry and native contexts through Schway's public host API. The S16 client has Bot model controls but does not show these recorded observations. Its Bot resolver and form also silently return to the installation default when a saved selection disappears.

Reusing the existing MODEL service and Bot controls is simpler than adapting Rakazo's provider settings, which would import assumptions about upstream accounts and execution. A separate model registry, provider SDK or session migration would duplicate protected authority. No upstream source or new dependency is needed for this slice.

## Decision

1. A non-null Bot selection is an exact pin. If no longer approved, interpretation/admission holds with `selection_pinned`; neither the resolver nor an unrelated profile edit substitutes the default. The owner can explicitly choose another approved selection or the installation default. This supersedes only the fallback behavior in ADR 0088 decision 6 and `s16-bots/v1`.
2. Updating a Bot's model applies to newly admitted work. Existing work retains its POLICY `selectionPin`, native context and reservations. Later requests retain the same Bot/conversation and current sourced memory, using a fresh native work context under the new selection. No native session or credential is copied between routes.
3. Add `s16-client-models/v1`: a protected read-only catalog/budget projection and bounded per-request observations in conversation snapshots. Show actual recorded provider/model, requested/sent/reported effort, tokens, physical sends, state and unknown measurements. Scripted sends remain explicitly unobservable; subscription spend remains unknown and configured upper bounds are not described as measured bills.
4. Display route/account/billing/recipient identities, current availability and finite limits alongside the existing Bot model controls. Sign-in uses the existing protected `/settings/provider` flow. A catalog read makes no provider/network call and cannot register a route, create an account, increase billing or approve disclosure. New route/account/billing configuration retains its existing owner boundary and current POLICY/DATA15 intersection.
5. Query observations by at most 32 already-authorized work identities, using an additive index and a bounded SQL result. No prompt, output, credential or native-session handle enters the client projection. No journal-format/default-runtime/policy migration occurs. Old clients ignore additive fields; services without MODEL omit the capability.

## Verification

Deterministic composed-client tests must cover unavailable pins without fallback, profile edits preserving explicit pins, active-work selection versus subsequent requests, retained Bot/conversation/memory, actual versus unknown telemetry, stale/authenticated reads, bounded SQL projections, current recipient/account/budget guards and no provider work on reads. Run the existing packed Schway consumer and model dispatch/renewal/disclosure/restart regressions. Real React bundle tests cover English/Thai controls and usage at desktop/mobile widths. Live subscription/account/device evidence remains separately attributed to #431; fixtures do not certify it.

## Current evidence

The composed client/model/Bot/dispatch/disclosure/restart/packed-consumer suites pass 118 tests. Reinstating the old resolver makes the withdrawn-pin regression fail. Real React bundle checks pass in English at 1440 px and Thai at 390 px, including an unavailable saved pin, an unrelated profile edit, explicit default selection, protected sign-in entry, recorded unknown usage and no horizontal overflow. The exact packed Schway artifact is loaded in a fresh process: importing/creating a headless host loads no unselected provider implementation or TUI, then the existing protocol consumer checks exact physical-send authorization, pins, caps and renewal. Local typecheck, provenance and diff checks pass. Live provider/account evidence remains unrun here and owned by #431.
2 changes: 1 addition & 1 deletion docs/contracts/s16-bots-v1.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ Bounds: name 1–60 characters, responsibility up to 2000, at most 32 created Bo

## Conversations

- `ConversationPolicy` (`createConversationPolicy({ bots })`) resolves `{ bot, selection, route, excluded }` per `conversationId`; interpretation and work both use that selection and route. `selection` is the Bot's choice when it is still in the policy's selections, else `conversation.selection`. Work `selectionPin` is that selection; physical reservations use the work's own selection.
- `ConversationPolicy` (`createConversationPolicy({ bots })`) resolves `{ bot, selection, route, excluded }` per `conversationId`; interpretation and work both use that selection and route. `selection` is the Bot's exact choice, or `conversation.selection` only when the owner selected the default. A saved choice no longer in policy holds `selection_pinned` (MODEL16-01, ADR 0093); it never falls back silently. Work `selectionPin` is that selection; physical reservations use the work's own selection.
- `ConversationOptions.admitConversation(conversationId)` runs for every new request (message, clarification, routine occurrence, assignment) and refuses `bot_archived` / `bot_unavailable`.
- Owner decisions for a work include `{"bot":{"name","responsibility"}}` when the profile has either, and `{"assignment":{…}}` for a child.

Expand Down
11 changes: 11 additions & 0 deletions docs/contracts/s16-models-v1.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# s16-client-models/v1

MODEL16-01 (#421), ADR 0093. This is an additive protected S16 projection over MODEL15 and BOT16-01, not another provider, registry or approval service.

- `GET /api/s16/client/models` returns configured approved-route metadata, installed-policy availability and finite/unknown budget facts. Current owner authentication, exact Host, Fetch Metadata and no-store response rules apply. Reading never lists an account catalog, renews a credential or starts inference.
- `ClientCapabilities.models` advertises this projection only when MODEL is composed. Bot model/effort changes continue to use exact revision-bound `s16-bot-command/v1`; non-null selections are exact pins. Missing pins hold `selection_pinned`; a form never converts an unavailable saved selection to the default through an unrelated edit.
- Conversation snapshots add `modelUsage` with `records` keyed by request ID and an explicit `truncated` flag. Only the authorized snapshot's work identities are queried, at most 32. The protected journal query returns at most 128 recent steps; selection history outside the window is not inferred to be empty.
- Each step exposes recorded provider/model, exact selection, reason/state/code, effort observations, token samples/totals, physical-send counts and usage. No prompt/output/native-session handle is returned. Null telemetry remains unknown; provider effort reports do not prove internal computation, and configured spend bounds are not measured bills.
- Bot updates affect future work admission; an active work's POLICY selection pin is unchanged. New requests retain product Bot/conversation/source lineage while Schway creates compatible native contexts. Private-recipient, account, billing, limits and unknown-effect guards remain mandatory.

The existing protected `/settings/provider` surface handles sign-in to configured supported Schway routes. This API has no route/account/credential/billing mutation. New routes are not synthesized from a model catalog or source document. S14 remains the default runtime and S15 remains opt-in; installed policies retain their exact meaning.
2 changes: 2 additions & 0 deletions docs/tickets/S16-rakazo-experience-roadmap.md
Original file line number Diff line number Diff line change
Expand Up @@ -132,3 +132,5 @@ CONN16-01 [#417](https://github.com/chayapats/jit/issues/417), MCP16-01 [#418](h
Artifact revision/HTML preview (#407), file-to-VM collection (#433), and live steering (#406) remain required despite the first working file client. Search/organization (#428) is required; spaces are conditional on a reviewed single-owner isolation/availability decision, never implicit multi-user tenancy. Every substantial slice records reuse versus a simpler alternative; current frameworks/storage are not product scope limits.

Publication validation rereads every issue, required sections, native parents/dependencies and readiness; checks the graph for cycles and verifies all rows/acceptances/requirements have owners. Documentation-only validation runs link checks and `git diff --check`; no runtime tests are claimed by this PR.

MODEL16-01 [#421](https://github.com/chayapats/jit/issues/421) supplies exact Bot pins and protected route/usage projections through [s16-client-models/v1](../contracts/s16-models-v1.md), reusing MODEL15's public Schway composition. [ADR 0093](../adr/0093-s16-model-choice-and-observed-usage.md) records the no-fallback choice, current evidence and separate live-account gate.
50 changes: 48 additions & 2 deletions src/i18n/en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6210,9 +6210,55 @@ export const en: Record<MessageKey, string> = {
"s16.bots.responsibility": "Responsibility",
"s16.bots.responsibilityHint": "What this Bot looks after. It still works only within your rules.",
"s16.bots.model": "Model",
"s16.bots.modelDefault": "Same as Jit (default)",
"s16.bots.modelDefault": "Use installation default",
"s16.bots.modelInstallation": "Installation default",
"s16.bots.modelUnavailable": "The chosen model is not available now, so new work uses the default.",
"s16.bots.modelUnavailable": "The pinned model is unavailable. Choose an approved model or explicitly select the installation default before starting new work.",
"s16.bots.modelUnavailableChoice": "Unavailable pinned model (choose explicitly)",
"s16.models.title": "Model routes and usage",
"s16.models.pinHint": "This pins the exact route, model and effort for new work. Running work keeps its original pin.",
"s16.models.loadFailed": "Model information could not be refreshed.",
"s16.models.configuredHint": "These routes are configured for this installation. Configuration and local sign-in do not prove a successful live call.",
"s16.models.signIn": "Manage protected model sign-in",
"s16.models.empty": "No model routes are configured.",
"s16.models.held": "Unavailable for new work",
"s16.models.available": "Configured and approved; checked again at dispatch",
"s16.models.account": "Account reference",
"s16.models.billing": "Billing reference",
"s16.models.recipient": "Data recipient",
"s16.models.budget": "Limits and recorded usage",
"s16.models.budgetHint": "Reservations are conservative charges. Measurements may be unknown. Subscription access is not a measured zero cost.",
"s16.models.reserved": "Reserved",
"s16.models.measured": "Measured",
"s16.models.ceiling": "Ceiling",
"s16.models.unknown": "Unknown",
"s16.models.partial": "Some usage remains unknown; displayed numbers are measured subtotals.",
"s16.models.subscriptionLimits": "Subscription limits: {calls} calls, {steps} steps and {activeMs} ms per work; {concurrency} concurrent works.",
"s16.models.unsettled": "Unsettled reservations: {count}",
"s16.models.workUsage": "Recorded model usage",
"s16.models.truncated": "Only recent work steps are shown; earlier steps are retained by the service.",
"s16.models.stepState": "Recorded step state",
"s16.models.inputTokens": "Input tokens",
"s16.models.outputTokens": "Output tokens",
"s16.models.sends": "Observed physical sends",
"s16.models.reservedCalls": "Reserved calls",
"s16.models.spend": "Measured spend (minor units)",
"s16.models.effortHint": "Requested, sent and provider-reported effort are separate observations; they do not prove internal computation.",
"s16.models.sentEffort": "Sent effort",
"s16.models.reportedEffort": "Provider-reported effort",
"s16.models.requestedEffort": "Requested effort",
"s16.models.state.selected": "Selected; not yet dispatched",
"s16.models.state.running": "Running",
"s16.models.state.completed": "Completed",
"s16.models.state.held": "Held",
"s16.models.state.failed": "Failed",
"s16.models.state.reconcile_only": "Needs reconciliation",
"s16.models.dimension.attempts": "Attempts",
"s16.models.dimension.steps": "Steps",
"s16.models.dimension.calls": "Calls",
"s16.models.dimension.reads": "Reads",
"s16.models.dimension.outputBytes": "Output bytes",
"s16.models.dimension.activeMs": "Active milliseconds",
"s16.models.dimension.spendMinor": "Spend in minor units",
"s16.bots.assignments": "Other Bots can hand it tasks",
"s16.bots.resources": "Uses",
"s16.bots.resourcesHint": "Team defaults. Untick anything this Bot should not use.",
Expand Down
Loading
Loading